🚀 代码优化 ⚡️ 功能优化 🏆 新增功能 🎨 样式调整 🔧 修改配置 🛠️ 修复BUG
🎉 发布版本 ⛔️ 删除文件 ✅ 添加组件 🔔 更新通知
更多 Emoji 请查看:https://twemoji.maxcdn.com/2/test/preview.html
🚀 代码优化 ⚡️ 功能优化 🏆 新增功能 🎨 样式调整 🔧 修改配置 🛠️ 修复BUG
🎉 发布版本 ⛔️ 删除文件 ✅ 添加组件 🔔 更新通知
更多 Emoji 请查看:https://twemoji.maxcdn.com/2/test/preview.html
/** ========== 滚动条样式 ========== */ | |
::-webkit-scrollbar { | |
width: 12px !important; | |
height: 12px !important; | |
background-color: transparent; | |
} | |
::-webkit-scrollbar-thumb { | |
background-color: rgba(116 120 141 / 0.22) !important; |
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>> | |
// usage: | |
interface A { | |
requireX: string | |
requireY: string | |
requireZ: string | |
} |
import { createContext, useContext, useEffect, useState } from 'react'; | |
const XxxContext = createContext({}); | |
export function XxxContextProvider(props: { children: React.ReactNode }) { | |
const [state, setState] = useState(); | |
const value = { state, setState }; | |
return <XxxContext.Provider value={value}>{props.children}</XxxContext.Provider>; |
import type { FormInstance } from 'antd'; | |
import { Button, Form, Input, Popconfirm, Table } from 'antd'; | |
import React, { useContext, useEffect, useRef, useState } from 'react'; | |
const EditableContext = React.createContext<FormInstance | null>(null); | |
const EditableRow = ({ index, ...props }: { index: number; [x: string]: any }) => { | |
const [form] = Form.useForm(); | |
return ( |
export function highlightJSON(json: string): string { | |
if (!json) { | |
return '' | |
} | |
if (typeof json !== 'string') { | |
json = JSON.stringify(json, undefined, 2) | |
} | |
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>') |
/** | |
* 创建表单 shouldUpdate 函数的简易工具方法 | |
* | |
* @param namePath - 要响应变化的表单字段,路径格式与调用 Form.getFieldValue 方法的传参一致 | |
*/ | |
export function shouldFormItemUpdate<Values>( | |
namePath: string | (string | number)[] | |
): (...value: [Values, Values]) => boolean { | |
const shouldUpdate = (...value: [Values, Values]) => { | |
const [prevValue, curValue] = value; |
const none = Symbol('lazyRef.Uninitialized') | |
export default useJitRef(init) { | |
const value = useRef(none) | |
const ref = useLazyRef(() => ({ | |
get current() { | |
if (value.current === none) { | |
value.current = init() | |
} | |
return value.current |
/** | |
* RuntimeGlobalsChecker | |
* | |
* You can use this utility to quickly check what variables have been added (or | |
* leaked) to the global window object at runtime (by JavaScript code). | |
* By running this code, the globals checker itself is attached as a singleton | |
* to the window object as "__runtimeGlobalsChecker__". | |
* You can check the runtime globals programmatically at any time by invoking | |
* "window.__runtimeGlobalsChecker__.getRuntimeGlobals()". | |
* |