@visactor/react-vtable 0.25.4 → 0.25.6-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/tables/base-table.js +7 -3
- package/cjs/tables/base-table.js.map +1 -1
- package/dist/react-vtable.js +8 -3
- package/dist/react-vtable.min.js +2 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/tables/base-table.js +7 -2
- package/es/tables/base-table.js.map +1 -1
- package/package.json +5 -5
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -34,4 +34,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
34
34
|
const VTable = __importStar(require("@visactor/vtable"));
|
|
35
35
|
|
|
36
36
|
exports.VTable = VTable, __exportStar(require("./tables"), exports), __exportStar(require("./components"), exports),
|
|
37
|
-
exports.version = "0.25.
|
|
37
|
+
exports.version = "0.25.6-alpha.0";
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAIlC,wBAAM;AAFf,2CAAyB;AACzB,+CAA6B;AAGhB,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAIlC,wBAAM;AAFf,2CAAyB;AACzB,+CAA6B;AAGhB,QAAA,OAAO,GAAG,gBAAgB,CAAC","file":"index.js","sourcesContent":["import * as VTable from '@visactor/vtable';\n\nexport * from './tables';\nexport * from './components';\nexport { VTable };\n\nexport const version = \"0.25.6-alpha.0\";\n"]}
|
package/cjs/tables/base-table.js
CHANGED
|
@@ -55,11 +55,15 @@ const VTable = __importStar(require("@visactor/vtable")), react_1 = __importStar
|
|
|
55
55
|
react_1.useRef)(!1), prevOption = (0, react_1.useRef)((0, vutils_1.pickWithout)(props, notOptionKeys)), optionFromChildren = (0,
|
|
56
56
|
react_1.useRef)(null), prevRecords = (0, react_1.useRef)(props.records), eventsBinded = react_1.default.useRef(null), skipFunctionDiff = !!props.skipFunctionDiff, parseOption = (0,
|
|
57
57
|
react_1.useCallback)((props => hasOption && props.option ? hasRecords && props.records ? Object.assign(Object.assign({}, props.option), {
|
|
58
|
+
clearDOM: !1,
|
|
58
59
|
records: props.records
|
|
59
|
-
}) :
|
|
60
|
+
}) : Object.assign(Object.assign({}, props.option), {
|
|
61
|
+
clearDOM: !1
|
|
62
|
+
}) : Object.assign(Object.assign(Object.assign({
|
|
60
63
|
records: props.records
|
|
61
|
-
}, prevOption.current), optionFromChildren.current)
|
|
62
|
-
|
|
64
|
+
}, prevOption.current), optionFromChildren.current), {
|
|
65
|
+
clearDOM: !1
|
|
66
|
+
})), [ hasOption, hasRecords ]), createTable = (0, react_1.useCallback)((props => {
|
|
63
67
|
let vtable;
|
|
64
68
|
vtable = "pivot-table" === props.type ? new VTable.PivotTable(props.container, parseOption(props)) : "pivot-chart" === props.type ? new VTable.PivotChart(props.container, parseOption(props)) : new VTable.ListTable(props.container, parseOption(props)),
|
|
65
69
|
tableContext.current = Object.assign(Object.assign({}, tableContext.current), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yDAA2C;AAC3C,+CAA6F;AAE7F,gFAAwD;AAExD,6DAAgD;AAChD,6CAA+D;AAC/D,kCAAkC;AAClC,4CAAmD;AAanD,gDAAoF;AA8BpF,MAAM,aAAa,GAAG;IACpB,GAAG,+BAAmB;IACtB,GAAG,+BAAiB;IACpB,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,WAAW;CACZ,CAAC;A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IAAa,EAAE,QAA0B,EAAE,EAAE;IAC/G,MAAM,GAAG,GAAG,IAAA,uBAAa,EAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QACzF,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,QAAQ,EAAE;YACZ,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,IAAI,IAAI,EAAE;YACR,uCAAY,KAAK,KAAE,IAAI,IAAG;SAC3B;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAfW,QAAA,WAAW,eAetB","file":"base-table.js","sourcesContent":["/* eslint-disable react/display-name */\nimport * as VTable from '@visactor/vtable';\nimport React, { useState, useEffect, useRef, useImperativeHandle, useCallback } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { isEqual, isNil, pickWithout } from '@visactor/vutils';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type { IMarkElement } from '../components';\nimport type {\n EventsProps\n // LegendEventProps,\n // ScrollBarEventProps,\n // BrushEventProps,\n // DataZoomEventProps,\n // PlayerEventProps,\n // DimensionEventProps,\n // HierarchyEventProps,\n // TableLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToTable, TABLE_EVENTS_KEYS, TABLE_EVENTS } from '../eventsUtils';\n\nexport type IVTable = VTable.ListTable | VTable.PivotTable | VTable.PivotChart;\nexport type IOption =\n | VTable.ListTableConstructorOptions\n | VTable.PivotTableConstructorOptions\n | VTable.PivotChartConstructorOptions;\n\nexport interface BaseTableProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: any;\n /** 数据 */\n records?: Record<string, unknown>[];\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n skipFunctionDiff?: boolean;\n\n /** 表格渲染完成事件 */\n onReady?: (instance: IVTable, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n}\n\ntype Props = React.PropsWithChildren<BaseTableProps>;\n\nconst notOptionKeys = [\n ...REACT_PRIVATE_PROPS,\n ...TABLE_EVENTS_KEYS,\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'option',\n 'records',\n 'container'\n];\n\nconst getComponentId = (child: React.ReactNode, index: number) => {\n const componentName = child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n return `${componentName}-${index}`;\n};\n\nconst parseOptionFromChildren = (props: Props) => {\n const optionFromChildren: Omit<IOption, 'type' | 'data' | 'width' | 'height'> = {};\n\n toArray(props.children).map((child, index) => {\n const parseOption = child && (child as any).type && (child as any).type.parseOption;\n\n if (parseOption && (child as any).props) {\n const childProps = isNil((child as any).props.componentId)\n ? {\n ...(child as any).props,\n componentId: getComponentId(child, index)\n }\n : (child as any).props;\n\n const optionResult = parseOption(childProps);\n\n if (optionResult.isSingle) {\n optionFromChildren[optionResult.optionName] = optionResult.option;\n } else {\n if (!optionFromChildren[optionResult.optionName]) {\n optionFromChildren[optionResult.optionName] = [];\n }\n\n optionFromChildren[optionResult.optionName].push(optionResult.option);\n }\n }\n });\n\n return optionFromChildren;\n};\n\nconst BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const tableContext = useRef<TableContextType>({});\n useImperativeHandle(ref, () => tableContext.current?.table);\n const hasOption = !!props.option;\n const hasRecords = !!props.records;\n const isUnmount = useRef<boolean>(false);\n const prevOption = useRef(pickWithout(props, notOptionKeys));\n const optionFromChildren = useRef<Omit<IOption, 'records'>>(null);\n const prevRecords = useRef(props.records);\n const eventsBinded = React.useRef<BaseTableProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseOption = useCallback(\n (props: Props) => {\n if (hasOption && props.option) {\n if (hasRecords && props.records) {\n return {\n ...props.option,\n records: props.records\n };\n }\n return props.option;\n }\n return {\n records: props.records,\n ...prevOption.current,\n ...optionFromChildren.current\n // ...tableContext.current?.optionFromChildren\n } as IOption;\n },\n [hasOption, hasRecords]\n );\n\n const createTable = useCallback(\n (props: Props) => {\n let vtable;\n if (props.type === 'pivot-table') {\n vtable = new VTable.PivotTable(props.container, parseOption(props));\n } else if (props.type === 'pivot-chart') {\n vtable = new VTable.PivotChart(props.container, parseOption(props));\n } else {\n vtable = new VTable.ListTable(props.container, parseOption(props));\n }\n tableContext.current = { ...tableContext.current, table: vtable };\n isUnmount.current = false;\n },\n [parseOption]\n );\n\n const handleTableRender = useCallback(() => {\n if (!isUnmount.current) {\n if (!tableContext.current || !tableContext.current.table) {\n return;\n }\n // rebind events after render\n bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS);\n\n // to be fixed\n // will cause another useEffect\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(tableContext.current.table, updateId === 0);\n }\n }\n }, [updateId, setUpdateId, props]);\n\n const renderTable = useCallback(() => {\n if (tableContext.current.table) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.render();\n handleTableRender();\n }\n }, [handleTableRender]);\n\n useEffect(() => {\n const newOptionFromChildren = hasOption ? null : parseOptionFromChildren(props);\n\n if (!tableContext.current?.table) {\n if (!hasOption) {\n optionFromChildren.current = newOptionFromChildren;\n }\n\n createTable(props);\n renderTable();\n // bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS);\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n eventsBinded.current = props;\n return;\n }\n\n if (hasOption) {\n if (!isEqual(eventsBinded.current.option, props.option, { skipFunction: skipFunctionDiff })) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n tableContext.current.table.setRecords(props.records as any[]);\n handleTableRender();\n eventsBinded.current = props;\n }\n return;\n }\n\n const newOption = pickWithout(props, notOptionKeys);\n\n if (\n !isEqual(newOption, prevOption.current, { skipFunction: skipFunctionDiff }) ||\n // tableContext.current.isChildrenUpdated\n !isEqual(newOptionFromChildren, optionFromChildren.current, { skipFunction: skipFunctionDiff })\n ) {\n prevOption.current = newOption;\n optionFromChildren.current = newOptionFromChildren;\n\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n tableContext.current.table.setRecords(props.records);\n handleTableRender();\n eventsBinded.current = props;\n }\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n }, [createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props]);\n\n useEffect(() => {\n return () => {\n if (tableContext) {\n if (tableContext.current && tableContext.current.table) {\n tableContext.current.table.release();\n tableContext.current = null;\n }\n }\n eventsBinded.current = null;\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootTableContext.Provider value={tableContext.current}>\n {toArray(props.children).map((child: React.ReactNode, index: number) => {\n if (typeof child === 'string') {\n return;\n }\n\n const childId = getComponentId(child, index);\n\n // const componentName =\n // child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n // const childId = `${componentName}-${index}`;\n\n return (\n // <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n // {React.cloneElement(child as IMarkElement, {\n // updateId: updateId\n // })}\n // </React.Fragment>\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId\n })}\n </React.Fragment>\n );\n })}\n </RootTableContext.Provider>\n );\n});\n\nexport const createTable = <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => {\n const Com = withContainer<ContainerProps, T>(BaseTable as any, componentName, (props: T) => {\n props.type = type;\n\n if (callback) {\n return callback(props);\n }\n\n if (type) {\n return { ...props, type };\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yDAA2C;AAC3C,+CAA6F;AAE7F,gFAAwD;AAExD,6DAAgD;AAChD,6CAA+D;AAC/D,kCAAkC;AAClC,4CAAmD;AAanD,gDAAoF;AA8BpF,MAAM,aAAa,GAAG;IACpB,GAAG,+BAAmB;IACtB,GAAG,+BAAiB;IACpB,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,WAAW;CACZ,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAsB,EAAE,KAAa,EAAE,EAAE;IAC/D,MAAM,aAAa,GAAG,KAAK,IAAK,KAAa,CAAC,IAAI,IAAI,CAAE,KAAa,CAAC,IAAI,CAAC,WAAW,IAAK,KAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpH,OAAO,GAAG,aAAa,IAAI,KAAK,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,KAAY,EAAE,EAAE;IAC/C,MAAM,kBAAkB,GAAwD,EAAE,CAAC;IAEnF,IAAA,cAAO,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC3C,MAAM,WAAW,GAAG,KAAK,IAAK,KAAa,CAAC,IAAI,IAAK,KAAa,CAAC,IAAI,CAAC,WAAW,CAAC;QAEpF,IAAI,WAAW,IAAK,KAAa,CAAC,KAAK,EAAE;YACvC,MAAM,UAAU,GAAG,IAAA,cAAK,EAAE,KAAa,CAAC,K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EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,8BAAC,eAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,CAAC,OAAO,IACnD,IAAA,cAAO,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAsB,EAAE,KAAa,EAAE,EAAE;QACrE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,OAAO;SACR;QAED,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAM7C,OAAO,CAML,8BAAC,eAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,OAAO,IACzB,eAAK,CAAC,YAAY,CAAC,KAAkE,EAAE;YACtF,QAAQ,EAAE,QAAQ;YAClB,WAAW,EAAE,OAAO;SACrB,CAAC,CACa,CAClB,CAAC;IACJ,CAAC,CAAC,CACwB,CAC7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEI,MAAM,WAAW,GAAG,CAAkB,aAAqB,EAAE,IAAa,EAAE,QAA0B,EAAE,EAAE;IAC/G,MAAM,GAAG,GAAG,IAAA,uBAAa,EAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QACzF,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,QAAQ,EAAE;YACZ,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,IAAI,IAAI,EAAE;YACR,uCAAY,KAAK,KAAE,IAAI,IAAG;SAC3B;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAfW,QAAA,WAAW,eAetB","file":"base-table.js","sourcesContent":["/* eslint-disable react/display-name */\nimport * as VTable from '@visactor/vtable';\nimport React, { useState, useEffect, useRef, useImperativeHandle, useCallback } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { isEqual, isNil, pickWithout } from '@visactor/vutils';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type { IMarkElement } from '../components';\nimport type {\n EventsProps\n // LegendEventProps,\n // ScrollBarEventProps,\n // BrushEventProps,\n // DataZoomEventProps,\n // PlayerEventProps,\n // DimensionEventProps,\n // HierarchyEventProps,\n // TableLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToTable, TABLE_EVENTS_KEYS, TABLE_EVENTS } from '../eventsUtils';\n\nexport type IVTable = VTable.ListTable | VTable.PivotTable | VTable.PivotChart;\nexport type IOption =\n | VTable.ListTableConstructorOptions\n | VTable.PivotTableConstructorOptions\n | VTable.PivotChartConstructorOptions;\n\nexport interface BaseTableProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: any;\n /** 数据 */\n records?: Record<string, unknown>[];\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n skipFunctionDiff?: boolean;\n\n /** 表格渲染完成事件 */\n onReady?: (instance: IVTable, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n}\n\ntype Props = React.PropsWithChildren<BaseTableProps>;\n\nconst notOptionKeys = [\n ...REACT_PRIVATE_PROPS,\n ...TABLE_EVENTS_KEYS,\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'option',\n 'records',\n 'container'\n];\n\nconst getComponentId = (child: React.ReactNode, index: number) => {\n const componentName = child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n return `${componentName}-${index}`;\n};\n\nconst parseOptionFromChildren = (props: Props) => {\n const optionFromChildren: Omit<IOption, 'type' | 'data' | 'width' | 'height'> = {};\n\n toArray(props.children).map((child, index) => {\n const parseOption = child && (child as any).type && (child as any).type.parseOption;\n\n if (parseOption && (child as any).props) {\n const childProps = isNil((child as any).props.componentId)\n ? {\n ...(child as any).props,\n componentId: getComponentId(child, index)\n }\n : (child as any).props;\n\n const optionResult = parseOption(childProps);\n\n if (optionResult.isSingle) {\n optionFromChildren[optionResult.optionName] = optionResult.option;\n } else {\n if (!optionFromChildren[optionResult.optionName]) {\n optionFromChildren[optionResult.optionName] = [];\n }\n\n optionFromChildren[optionResult.optionName].push(optionResult.option);\n }\n }\n });\n\n return optionFromChildren;\n};\n\nconst BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const tableContext = useRef<TableContextType>({});\n useImperativeHandle(ref, () => tableContext.current?.table);\n const hasOption = !!props.option;\n const hasRecords = !!props.records;\n const isUnmount = useRef<boolean>(false);\n const prevOption = useRef(pickWithout(props, notOptionKeys));\n const optionFromChildren = useRef<Omit<IOption, 'records'>>(null);\n const prevRecords = useRef(props.records);\n const eventsBinded = React.useRef<BaseTableProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseOption = useCallback(\n (props: Props) => {\n if (hasOption && props.option) {\n if (hasRecords && props.records) {\n return {\n ...props.option,\n clearDOM: false,\n records: props.records\n };\n }\n return {\n ...props.option,\n clearDOM: false\n };\n }\n return {\n records: props.records,\n ...prevOption.current,\n ...optionFromChildren.current,\n clearDOM: false\n // ...tableContext.current?.optionFromChildren\n } as IOption;\n },\n [hasOption, hasRecords]\n );\n\n const createTable = useCallback(\n (props: Props) => {\n let vtable;\n if (props.type === 'pivot-table') {\n vtable = new VTable.PivotTable(props.container, parseOption(props));\n } else if (props.type === 'pivot-chart') {\n vtable = new VTable.PivotChart(props.container, parseOption(props));\n } else {\n vtable = new VTable.ListTable(props.container, parseOption(props));\n }\n tableContext.current = { ...tableContext.current, table: vtable };\n isUnmount.current = false;\n },\n [parseOption]\n );\n\n const handleTableRender = useCallback(() => {\n if (!isUnmount.current) {\n if (!tableContext.current || !tableContext.current.table) {\n return;\n }\n // rebind events after render\n bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS);\n\n // to be fixed\n // will cause another useEffect\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(tableContext.current.table, updateId === 0);\n }\n }\n }, [updateId, setUpdateId, props]);\n\n const renderTable = useCallback(() => {\n if (tableContext.current.table) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.render();\n handleTableRender();\n }\n }, [handleTableRender]);\n\n useEffect(() => {\n const newOptionFromChildren = hasOption ? null : parseOptionFromChildren(props);\n\n if (!tableContext.current?.table) {\n if (!hasOption) {\n optionFromChildren.current = newOptionFromChildren;\n }\n\n createTable(props);\n renderTable();\n // bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS);\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n eventsBinded.current = props;\n return;\n }\n\n if (hasOption) {\n if (!isEqual(eventsBinded.current.option, props.option, { skipFunction: skipFunctionDiff })) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n tableContext.current.table.setRecords(props.records as any[]);\n handleTableRender();\n eventsBinded.current = props;\n }\n return;\n }\n\n const newOption = pickWithout(props, notOptionKeys);\n\n if (\n !isEqual(newOption, prevOption.current, { skipFunction: skipFunctionDiff }) ||\n // tableContext.current.isChildrenUpdated\n !isEqual(newOptionFromChildren, optionFromChildren.current, { skipFunction: skipFunctionDiff })\n ) {\n prevOption.current = newOption;\n optionFromChildren.current = newOptionFromChildren;\n\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n tableContext.current.table.setRecords(props.records);\n handleTableRender();\n eventsBinded.current = props;\n }\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n }, [createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props]);\n\n useEffect(() => {\n return () => {\n if (tableContext) {\n if (tableContext.current && tableContext.current.table) {\n tableContext.current.table.release();\n tableContext.current = null;\n }\n }\n eventsBinded.current = null;\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootTableContext.Provider value={tableContext.current}>\n {toArray(props.children).map((child: React.ReactNode, index: number) => {\n if (typeof child === 'string') {\n return;\n }\n\n const childId = getComponentId(child, index);\n\n // const componentName =\n // child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n // const childId = `${componentName}-${index}`;\n\n return (\n // <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n // {React.cloneElement(child as IMarkElement, {\n // updateId: updateId\n // })}\n // </React.Fragment>\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId\n })}\n </React.Fragment>\n );\n })}\n </RootTableContext.Provider>\n );\n});\n\nexport const createTable = <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => {\n const Com = withContainer<ContainerProps, T>(BaseTable as any, componentName, (props: T) => {\n props.type = type;\n\n if (callback) {\n return callback(props);\n }\n\n if (type) {\n return { ...props, type };\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
|
package/dist/react-vtable.js
CHANGED
|
@@ -3468,15 +3468,20 @@
|
|
|
3468
3468
|
if (hasRecords && props.records) {
|
|
3469
3469
|
return {
|
|
3470
3470
|
...props.option,
|
|
3471
|
+
clearDOM: false,
|
|
3471
3472
|
records: props.records
|
|
3472
3473
|
};
|
|
3473
3474
|
}
|
|
3474
|
-
return
|
|
3475
|
+
return {
|
|
3476
|
+
...props.option,
|
|
3477
|
+
clearDOM: false
|
|
3478
|
+
};
|
|
3475
3479
|
}
|
|
3476
3480
|
return {
|
|
3477
3481
|
records: props.records,
|
|
3478
3482
|
...prevOption.current,
|
|
3479
|
-
...optionFromChildren.current
|
|
3483
|
+
...optionFromChildren.current,
|
|
3484
|
+
clearDOM: false
|
|
3480
3485
|
};
|
|
3481
3486
|
}, [hasOption, hasRecords]);
|
|
3482
3487
|
const createTable = reactExports.useCallback((props) => {
|
|
@@ -3746,7 +3751,7 @@
|
|
|
3746
3751
|
return 0;
|
|
3747
3752
|
}
|
|
3748
3753
|
|
|
3749
|
-
const version = "0.25.
|
|
3754
|
+
const version = "0.25.6-alpha.0";
|
|
3750
3755
|
|
|
3751
3756
|
exports.VTable = VTable__namespace;
|
|
3752
3757
|
exports.CustomComponent = CustomComponent;
|
package/dist/react-vtable.min.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/"production"===process.env.NODE_ENV?u.exports=function(){if(a)return i;a=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.iterator,y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,h={};function v(e,t,r){this.props=e,this.context=t,this.refs=h,this.updater=r||y}function b(){}function g(e,t,r){this.props=e,this.context=t,this.refs=h,this.updater=r||y}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=v.prototype;var _=g.prototype=new b;_.constructor=g,m(_,v.prototype),_.isPureReactComponent=!0;var E=Array.isArray,C=Object.prototype.hasOwnProperty,S={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function O(t,r,n){var o,a={},u=null,i=null;if(null!=r)for(o in void 0!==r.ref&&(i=r.ref),void 0!==r.key&&(u=""+r.key),r)C.call(r,o)&&!w.hasOwnProperty(o)&&(a[o]=r[o]);var c=arguments.length-2;if(1===c)a.children=n;else if(1<c){for(var s=Array(c),l=0;l<c;l++)s[l]=arguments[l+2];a.children=s}if(t&&t.defaultProps)for(o in c=t.defaultProps)void 0===a[o]&&(a[o]=c[o]);return{$$typeof:e,type:t,key:u,ref:i,props:a,_owner:S.current}}function R(t){return"object"==typeof t&&null!==t&&t.$$typeof===e}var k=/\/+/g;function L(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function T(r,n,o,a,u){var i=typeof r;"undefined"!==i&&"boolean"!==i||(r=null);var c=!1;if(null===r)c=!0;else switch(i){case"string":case"number":c=!0;break;case"object":switch(r.$$typeof){case e:case t:c=!0}}if(c)return u=u(c=r),r=""===a?"."+L(c,0):a,E(u)?(o="",null!=r&&(o=r.replace(k,"$&/")+"/"),T(u,n,o,"",(function(e){return e}))):null!=u&&(R(u)&&(u=function(t,r){return{$$typeof:e,type:t.type,key:r,ref:t.ref,props:t.props,_owner:t._owner}}(u,o+(!u.key||c&&c.key===u.key?"":(""+u.key).replace(k,"$&/")+"/")+r)),n.push(u)),1;if(c=0,a=""===a?".":a+":",E(r))for(var s=0;s<r.length;s++){var l=a+L(i=r[s],s);c+=T(i,n,o,l,u)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=d&&e[d]||e["@@iterator"])?e:null}(r),"function"==typeof l)for(r=l.call(r),s=0;!(i=r.next()).done;)c+=T(i=i.value,n,o,l=a+L(i,s++),u);else if("object"===i)throw n=String(r),Error("Objects are not valid as a React child (found: "+("[object Object]"===n?"object with keys {"+Object.keys(r).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.");return c}function P(e,t,r){if(null==e)return e;var n=[],o=0;return T(e,n,"","",(function(e){return t.call(r,e,o++)})),n}function N(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var j={current:null},x={transition:null},$={ReactCurrentDispatcher:j,ReactCurrentBatchConfig:x,ReactCurrentOwner:S};return i.Children={map:P,forEach:function(e,t,r){P(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return P(e,(function(){t++})),t},toArray:function(e){return P(e,(function(e){return e}))||[]},only:function(e){if(!R(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},i.Component=v,i.Fragment=r,i.Profiler=o,i.PureComponent=g,i.StrictMode=n,i.Suspense=l,i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$,i.cloneElement=function(t,r,n){if(null==t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var o=m({},t.props),a=t.key,u=t.ref,i=t._owner;if(null!=r){if(void 0!==r.ref&&(u=r.ref,i=S.current),void 0!==r.key&&(a=""+r.key),t.type&&t.type.defaultProps)var c=t.type.defaultProps;for(s in r)C.call(r,s)&&!w.hasOwnProperty(s)&&(o[s]=void 0===r[s]&&void 0!==c?c[s]:r[s])}var s=arguments.length-2;if(1===s)o.children=n;else if(1<s){c=Array(s);for(var l=0;l<s;l++)c[l]=arguments[l+2];o.children=c}return{$$typeof:e,type:t.type,key:a,ref:u,props:o,_owner:i}},i.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:u,_context:e},e.Consumer=e},i.createElement=O,i.createFactory=function(e){var t=O.bind(null,e);return t.type=e,t},i.createRef=function(){return{current:null}},i.forwardRef=function(e){return{$$typeof:s,render:e}},i.isValidElement=R,i.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:N}},i.memo=function(e,t){return{$$typeof:f,type:e,compare:void 0===t?null:t}},i.startTransition=function(e){var t=x.transition;x.transition={};try{e()}finally{x.transition=t}},i.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},i.useCallback=function(e,t){return j.current.useCallback(e,t)},i.useContext=function(e){return j.current.useContext(e)},i.useDebugValue=function(){},i.useDeferredValue=function(e){return j.current.useDeferredValue(e)},i.useEffect=function(e,t){return j.current.useEffect(e,t)},i.useId=function(){return j.current.useId()},i.useImperativeHandle=function(e,t,r){return j.current.useImperativeHandle(e,t,r)},i.useInsertionEffect=function(e,t){return j.current.useInsertionEffect(e,t)},i.useLayoutEffect=function(e,t){return j.current.useLayoutEffect(e,t)},i.useMemo=function(e,t){return j.current.useMemo(e,t)},i.useReducer=function(e,t,r){return j.current.useReducer(e,t,r)},i.useRef=function(e){return j.current.useRef(e)},i.useState=function(e){return j.current.useState(e)},i.useSyncExternalStore=function(e,t,r){return j.current.useSyncExternalStore(e,t,r)},i.useTransition=function(){return j.current.useTransition()},i.version="18.2.0",i}():u.exports=(c||(c=1,function(e,t){"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),m=Symbol.iterator,h="@@iterator";function v(e){if(null===e||"object"!=typeof e)return null;var t=m&&e[m]||e[h];return"function"==typeof t?t:null}var b={current:null},g={transition:null},_={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},E={current:null},C={},S=null;function w(e){S=e}C.setExtraStackFrame=function(e){S=e},C.getCurrentStack=null,C.getStackAddendum=function(){var e="";S&&(e+=S);var t=C.getCurrentStack;return t&&(e+=t()||""),e};var O=!1,R=!1,k=!1,L=!1,T=!1,P={ReactCurrentDispatcher:b,ReactCurrentBatchConfig:g,ReactCurrentOwner:E};function N(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];x("warn",e,r)}function j(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];x("error",e,r)}function x(e,t,r){var n=P.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var o=r.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}P.ReactDebugCurrentFrame=C,P.ReactCurrentActQueue=_;var $={};function I(e,t){var r=e.constructor,n=r&&(r.displayName||r.name)||"ReactClass",o=n+"."+t;$[o]||(j("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",t,n),$[o]=!0)}var M={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,r){I(e,"forceUpdate")},enqueueReplaceState:function(e,t,r,n){I(e,"replaceState")},enqueueSetState:function(e,t,r,n){I(e,"setState")}},D=Object.assign,A={};function F(e,t,r){this.props=e,this.context=t,this.refs=A,this.updater=r||M}Object.freeze(A),F.prototype.isReactComponent={},F.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},F.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var V={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},H=function(e,t){Object.defineProperty(F.prototype,e,{get:function(){N("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var U in V)V.hasOwnProperty(U)&&H(U,V[U]);function z(){}function B(e,t,r){this.props=e,this.context=t,this.refs=A,this.updater=r||M}z.prototype=F.prototype;var W=B.prototype=new z;W.constructor=B,D(W,F.prototype),W.isPureReactComponent=!0;var Y=Array.isArray;function K(e){return Y(e)}function q(e){return""+e}function G(e){if(function(e){try{return q(e),!1}catch(e){return!0}}(e))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),q(e)}function X(e){return e.displayName||"Context"}function Z(e){if(null==e)return null;if("number"==typeof e.tag&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case n:return"Portal";case u:return"Profiler";case a:return"StrictMode";case l:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return X(e)+".Consumer";case i:return X(e._context)+".Provider";case s:return function(e,t,r){var n=e.displayName;if(n)return n;var o=t.displayName||t.name||"";return""!==o?r+"("+o+")":r}(e,e.render,"ForwardRef");case p:var t=e.displayName||null;return null!==t?t:Z(e.type)||"Memo";case d:var r=e,y=r._payload,m=r._init;try{return Z(m(y))}catch(e){return null}}return null}var J,Q,ee,te=Object.prototype.hasOwnProperty,re={key:!0,ref:!0,__self:!0,__source:!0};function ne(e){if(te.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}function oe(e){if(te.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}ee={};var ae=function(e,t,n,o,a,u,i){var c={$$typeof:r,type:e,key:t,ref:n,props:i,_owner:u,_store:{}};return Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c};function ue(e,t,r){var n,o={},a=null,u=null,i=null,c=null;if(null!=t)for(n in ne(t)&&(u=t.ref,function(e){if("string"==typeof e.ref&&E.current&&e.__self&&E.current.stateNode!==e.__self){var t=Z(E.current.type);ee[t]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',t,e.ref),ee[t]=!0)}}(t)),oe(t)&&(G(t.key),a=""+t.key),i=void 0===t.__self?null:t.__self,c=void 0===t.__source?null:t.__source,t)te.call(t,n)&&!re.hasOwnProperty(n)&&(o[n]=t[n]);var s=arguments.length-2;if(1===s)o.children=r;else if(s>1){for(var l=Array(s),f=0;f<s;f++)l[f]=arguments[f+2];Object.freeze&&Object.freeze(l),o.children=l}if(e&&e.defaultProps){var p=e.defaultProps;for(n in p)void 0===o[n]&&(o[n]=p[n])}if(a||u){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;a&&function(e,t){var r=function(){J||(J=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(o,d),u&&function(e,t){var r=function(){Q||(Q=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(o,d)}return ae(e,a,u,i,c,E.current,o)}function ie(e,t,r){if(null==e)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n,o,a=D({},e.props),u=e.key,i=e.ref,c=e._self,s=e._source,l=e._owner;if(null!=t)for(n in ne(t)&&(i=t.ref,l=E.current),oe(t)&&(G(t.key),u=""+t.key),e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)te.call(t,n)&&!re.hasOwnProperty(n)&&(void 0===t[n]&&void 0!==o?a[n]=o[n]:a[n]=t[n]);var f=arguments.length-2;if(1===f)a.children=r;else if(f>1){for(var p=Array(f),d=0;d<f;d++)p[d]=arguments[d+2];a.children=p}return ae(e.type,u,i,c,s,l,a)}function ce(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var se=".",le=":",fe=!1,pe=/\/+/g;function de(e){return e.replace(pe,"$&/")}function ye(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(G(e.key),r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,(function(e){return n[e]}))):t.toString(36);var r,n}function me(e,t,o,a,u){var i=typeof e;"undefined"!==i&&"boolean"!==i||(e=null);var c,s,l,f=!1;if(null===e)f=!0;else switch(i){case"string":case"number":f=!0;break;case"object":switch(e.$$typeof){case r:case n:f=!0}}if(f){var p=e,d=u(p),y=""===a?se+ye(p,0):a;if(K(d)){var m="";null!=y&&(m=de(y)+"/"),me(d,t,m,"",(function(e){return e}))}else null!=d&&(ce(d)&&(!d.key||p&&p.key===d.key||G(d.key),c=d,s=o+(!d.key||p&&p.key===d.key?"":de(""+d.key)+"/")+y,d=ae(c.type,s,c.ref,c._self,c._source,c._owner,c.props)),t.push(d));return 1}var h=0,b=""===a?se:a+le;if(K(e))for(var g=0;g<e.length;g++)h+=me(l=e[g],t,o,b+ye(l,g),u);else{var _=v(e);if("function"==typeof _){var E=e;_===E.entries&&(fe||N("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),fe=!0);for(var C,S=_.call(E),w=0;!(C=S.next()).done;)h+=me(l=C.value,t,o,b+ye(l,w++),u)}else if("object"===i){var O=String(e);throw new Error("Objects are not valid as a React child (found: "+("[object Object]"===O?"object with keys {"+Object.keys(e).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.")}}return h}function he(e,t,r){if(null==e)return e;var n=[],o=0;return me(e,n,"","",(function(e){return t.call(r,e,o++)})),n}var ve,be=-1,ge=0,_e=1,Ee=2;function Ce(e){if(e._status===be){var t=(0,e._result)();if(t.then((function(t){if(e._status===ge||e._status===be){var r=e;r._status=_e,r._result=t}}),(function(t){if(e._status===ge||e._status===be){var r=e;r._status=Ee,r._result=t}})),e._status===be){var r=e;r._status=ge,r._result=t}}if(e._status===_e){var n=e._result;return void 0===n&&j("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",n),"default"in n||j("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",n),n.default}throw e._result}function Se(e){return"string"==typeof e||"function"==typeof e||!!(e===o||e===u||T||e===a||e===l||e===f||L||e===y||O||R||k)||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===p||e.$$typeof===i||e.$$typeof===c||e.$$typeof===s||e.$$typeof===ve||void 0!==e.getModuleId)}function we(){var e=b.current;return null===e&&j("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."),e}ve=Symbol.for("react.module.reference");var Oe,Re,ke,Le,Te,Pe,Ne,je=0;function xe(){}xe.__reactDisabledLog=!0;var $e,Ie=P.ReactCurrentDispatcher;function Me(e,t,r){if(void 0===$e)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);$e=n&&n[1]||""}return"\n"+$e+e}var De,Ae=!1,Fe="function"==typeof WeakMap?WeakMap:Map;function Ve(e,t){if(!e||Ae)return"";var r,n=De.get(e);if(void 0!==n)return n;Ae=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=Ie.current,Ie.current=null,function(){if(0===je){Oe=console.log,Re=console.info,ke=console.warn,Le=console.error,Te=console.group,Pe=console.groupCollapsed,Ne=console.groupEnd;var e={configurable:!0,enumerable:!0,value:xe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}je++}();try{if(t){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(u,[])}catch(e){r=e}Reflect.construct(e,[],u)}else{try{u.call()}catch(e){r=e}e.call(u.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var i=t.stack.split("\n"),c=r.stack.split("\n"),s=i.length-1,l=c.length-1;s>=1&&l>=0&&i[s]!==c[l];)l--;for(;s>=1&&l>=0;s--,l--)if(i[s]!==c[l]){if(1!==s||1!==l)do{if(s--,--l<0||i[s]!==c[l]){var f="\n"+i[s].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&De.set(e,f),f}}while(s>=1&&l>=0);break}}}finally{Ae=!1,Ie.current=o,function(){if(0==--je){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:Oe}),info:D({},e,{value:Re}),warn:D({},e,{value:ke}),error:D({},e,{value:Le}),group:D({},e,{value:Te}),groupCollapsed:D({},e,{value:Pe}),groupEnd:D({},e,{value:Ne})})}je<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var p=e?e.displayName||e.name:"",d=p?Me(p):"";return"function"==typeof e&&De.set(e,d),d}function He(e,t,r){if(null==e)return"";if("function"==typeof e)return Ve(e,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(e));if("string"==typeof e)return Me(e);switch(e){case l:return Me("Suspense");case f:return Me("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case s:return Ve(e.render,!1);case p:return He(e.type,t,r);case d:var n=e,o=n._payload,a=n._init;try{return He(a(o),t,r)}catch(e){}}return""}De=new Fe;var Ue,ze={},Be=P.ReactDebugCurrentFrame;function We(e){if(e){var t=e._owner,r=He(e.type,e._source,t?t.type:null);Be.setExtraStackFrame(r)}else Be.setExtraStackFrame(null)}function Ye(e){if(e){var t=e._owner;w(He(e.type,e._source,t?t.type:null))}else w(null)}function Ke(){if(E.current){var e=Z(E.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Ue=!1;var qe={};function Ge(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=Ke();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!qe[r]){qe[r]=!0;var n="";e&&e._owner&&e._owner!==E.current&&(n=" It was passed a child from "+Z(e._owner.type)+"."),Ye(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),Ye(null)}}}function Xe(e,t){if("object"==typeof e)if(K(e))for(var r=0;r<e.length;r++){var n=e[r];ce(n)&&Ge(n,t)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var o=v(e);if("function"==typeof o&&o!==e.entries)for(var a,u=o.call(e);!(a=u.next()).done;)ce(a.value)&&Ge(a.value,t)}}function Ze(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==s&&r.$$typeof!==p)return;t=r.propTypes}if(t){var n=Z(r);!function(e,t,r,n,o){var a=Function.call.bind(te);for(var u in e)if(a(e,u)){var i=void 0;try{if("function"!=typeof e[u]){var c=Error((n||"React class")+": "+r+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}i=e[u](t,u,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){i=e}!i||i instanceof Error||(We(o),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,u,typeof i),We(null)),i instanceof Error&&!(i.message in ze)&&(ze[i.message]=!0,We(o),j("Failed %s type: %s",r,i.message),We(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||Ue||(Ue=!0,j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Z(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Je(e,t,n){var a,u,i=Se(e);if(!i){var c,s="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(s+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),s+=(null!=(a=t)&&void 0!==(u=a.__source)?"\n\nCheck your code at "+u.fileName.replace(/^.*[\\\/]/,"")+":"+u.lineNumber+".":"")||Ke(),null===e?c="null":K(e)?c="array":void 0!==e&&e.$$typeof===r?(c="<"+(Z(e.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):c=typeof e,j("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",c,s)}var l=ue.apply(this,arguments);if(null==l)return l;if(i)for(var f=2;f<arguments.length;f++)Xe(arguments[f],e);return e===o?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){Ye(e),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),Ye(null);break}}null!==e.ref&&(Ye(e),j("Invalid attribute `ref` supplied to `React.Fragment`."),Ye(null))}(l):Ze(l),l}var Qe=!1,et=!1,tt=null,rt=0,nt=!1;function ot(e){e!==rt-1&&j("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),rt=e}function at(t,r,n){var o=_.current;if(null!==o)try{it(o),function(t){if(null===tt)try{var r=("require"+Math.random()).slice(0,7);tt=(e&&e[r]).call(e,"timers").setImmediate}catch(e){tt=function(e){!1===et&&(et=!0,"undefined"==typeof MessageChannel&&j("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(void 0)}}tt(t)}((function(){0===o.length?(_.current=null,r(t)):at(t,r,n)}))}catch(e){n(e)}else r(t)}var ut=!1;function it(e){if(!ut){ut=!0;var t=0;try{for(;t<e.length;t++){var r=e[t];do{r=r(!0)}while(null!==r)}e.length=0}catch(r){throw e=e.slice(t+1),r}finally{ut=!1}}}var ct=Je,st=function(e,t,r){for(var n=ie.apply(this,arguments),o=2;o<arguments.length;o++)Xe(arguments[o],n.type);return Ze(n),n},lt=function(e){var t=Je.bind(null,e);return t.type=e,Qe||(Qe=!0,N("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return N("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},ft={map:he,forEach:function(e,t,r){he(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return he(e,(function(){t++})),t},toArray:function(e){return he(e,(function(e){return e}))||[]},only:function(e){if(!ce(e))throw new Error("React.Children.only expected to receive a single React element child.");return e}};t.Children=ft,t.Component=F,t.Fragment=o,t.Profiler=u,t.PureComponent=B,t.StrictMode=a,t.Suspense=l,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=P,t.cloneElement=st,t.createContext=function(e){var t={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};t.Provider={$$typeof:i,_context:t};var r=!1,n=!1,o=!1,a={$$typeof:c,_context:t};return Object.defineProperties(a,{Provider:{get:function(){return n||(n=!0,j("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),t.Provider},set:function(e){t.Provider=e}},_currentValue:{get:function(){return t._currentValue},set:function(e){t._currentValue=e}},_currentValue2:{get:function(){return t._currentValue2},set:function(e){t._currentValue2=e}},_threadCount:{get:function(){return t._threadCount},set:function(e){t._threadCount=e}},Consumer:{get:function(){return r||(r=!0,j("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),t.Consumer}},displayName:{get:function(){return t.displayName},set:function(e){o||(N("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",e),o=!0)}}}),t.Consumer=a,t._currentRenderer=null,t._currentRenderer2=null,t},t.createElement=ct,t.createFactory=lt,t.createRef=function(){var e={current:null};return Object.seal(e),e},t.forwardRef=function(e){null!=e&&e.$$typeof===p?j("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?j("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&j("forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null==e.defaultProps&&null==e.propTypes||j("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"));var t,r={$$typeof:s,render:e};return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(r){t=r,e.name||e.displayName||(e.displayName=r)}}),r},t.isValidElement=ce,t.lazy=function(e){var t,r,n={$$typeof:d,_payload:{_status:be,_result:e},_init:Ce};return Object.defineProperties(n,{defaultProps:{configurable:!0,get:function(){return t},set:function(e){j("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),t=e,Object.defineProperty(n,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return r},set:function(e){j("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),r=e,Object.defineProperty(n,"propTypes",{enumerable:!0})}}}),n},t.memo=function(e,t){Se(e)||j("memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e);var r,n={$$typeof:p,type:e,compare:void 0===t?null:t};return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return r},set:function(t){r=t,e.name||e.displayName||(e.displayName=t)}}),n},t.startTransition=function(e,t){var r=g.transition;g.transition={};var n=g.transition;g.transition._updatedFibers=new Set;try{e()}finally{g.transition=r,null===r&&n._updatedFibers&&(n._updatedFibers.size>10&&N("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),n._updatedFibers.clear())}},t.unstable_act=function(e){var t=rt;rt++,null===_.current&&(_.current=[]);var r,n=_.isBatchingLegacy;try{if(_.isBatchingLegacy=!0,r=e(),!n&&_.didScheduleLegacyUpdate){var o=_.current;null!==o&&(_.didScheduleLegacyUpdate=!1,it(o))}}catch(e){throw ot(t),e}finally{_.isBatchingLegacy=n}if(null!==r&&"object"==typeof r&&"function"==typeof r.then){var a=r,u=!1,i={then:function(e,r){u=!0,a.then((function(n){ot(t),0===rt?at(n,e,r):e(n)}),(function(e){ot(t),r(e)}))}};return nt||"undefined"==typeof Promise||Promise.resolve().then((function(){})).then((function(){u||(nt=!0,j("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))})),i}var c=r;if(ot(t),0===rt){var s=_.current;return null!==s&&(it(s),_.current=null),{then:function(e,t){null===_.current?(_.current=[],at(c,e,t)):e(c)}}}return{then:function(e,t){e(c)}}},t.useCallback=function(e,t){return we().useCallback(e,t)},t.useContext=function(e){var t=we();if(void 0!==e._context){var r=e._context;r.Consumer===e?j("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&j("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return t.useContext(e)},t.useDebugValue=function(e,t){return we().useDebugValue(e,t)},t.useDeferredValue=function(e){return we().useDeferredValue(e)},t.useEffect=function(e,t){return we().useEffect(e,t)},t.useId=function(){return we().useId()},t.useImperativeHandle=function(e,t,r){return we().useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return we().useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return we().useLayoutEffect(e,t)},t.useMemo=function(e,t){return we().useMemo(e,t)},t.useReducer=function(e,t,r){return we().useReducer(e,t,r)},t.useRef=function(e){return we().useRef(e)},t.useState=function(e){return we().useState(e)},t.useSyncExternalStore=function(e,t,r){return we().useSyncExternalStore(e,t,r)},t.useTransition=function(){return we().useTransition()},t.version="18.2.0","undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(s,s.exports)),s.exports);var l=u.exports,f=o(l);const p=f.createContext(null);p.displayName="TableContext";var d=(e,t)=>Object.prototype.toString.call(e)===`[object ${t}]`;var y=e=>"function"==typeof e;var m=e=>null==e;var h=e=>null!=e;var v=e=>"object"==typeof e&&null!==e;var b=function(e){if(!v(e)||!d(e,"Object"))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};var g=function(e){const t=typeof e;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===t:"string"===t||d(e,"String")};var _=e=>Array.isArray?Array.isArray(e):d(e,"Array");var E=function(e){return null!==e&&"function"!=typeof e&&Number.isFinite(e.length)};var C=function(e){const t=typeof e;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===t:"number"===t||d(e,"Number")};function S(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t){if(e===t)return;if(h(t)&&"object"==typeof t){const n=Object(t),o=[];for(const e in n)o.push(e);let{length:a}=o,u=-1;for(;a--;){const a=o[++u];h(n[a])&&"object"==typeof n[a]?w(e,t,a,r):O(e,a,n[a])}}}}function w(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=e[r],a=t[r];let u=t[r],i=!0;if(_(a)){if(n)u=[];else if(_(o))u=o;else if(E(o)){u=new Array(o.length);let e=-1;const t=o.length;for(;++e<t;)u[e]=o[e]}}else b(a)?(u=o,"function"!=typeof o&&"object"==typeof o||(u={})):i=!1;i&&S(u,a,n),O(e,r,u)}function O(e,t,r){(void 0!==r&&!function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}(e[t],r)||void 0===r&&!(t in e))&&(e[t]=r)}function R(e){let t=-1;const r=arguments.length<=1?0:arguments.length-1;for(;++t<r;)S(e,t+1<1||arguments.length<=t+1?void 0:arguments[t+1],!0);return e}function k(e,t){if(!e||!b(e))return e;const r={};return Object.keys(e).forEach((n=>{const o=e[n];let a=!1;t.forEach((e=>{(g(e)&&e===n||e instanceof RegExp&&n.match(e))&&(a=!0)})),a||(r[n]=o)})),r}function L(e){return Object.prototype.toString.call(e)}function T(e){return Object.keys(e)}function P(e,t,r){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(null==e||null==t)return!1;if(Number.isNaN(e)&&Number.isNaN(t))return!0;if(L(e)!==L(t))return!1;if(y(e))return!!(null==r?void 0:r.skipFunction);if("object"!=typeof e)return!1;if(_(e)){if(e.length!==t.length)return!1;for(let n=e.length-1;n>=0;n--)if(!P(e[n],t[n],r))return!1;return!0}if(!b(e))return!1;const n=T(e),o=T(t);if(n.length!==o.length)return!1;n.sort(),o.sort();for(let e=n.length-1;e>=0;e--)if(n[e]!=o[e])return!1;for(let o=n.length-1;o>=0;o--){const a=n[o];if(!P(e[a],t[a],r))return!1}return!0}var N,j={exports:{}},x={};var $,I={};
|
|
10
|
+
*/"production"===process.env.NODE_ENV?u.exports=function(){if(a)return i;a=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.iterator,y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,h={};function v(e,t,r){this.props=e,this.context=t,this.refs=h,this.updater=r||y}function b(){}function g(e,t,r){this.props=e,this.context=t,this.refs=h,this.updater=r||y}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=v.prototype;var _=g.prototype=new b;_.constructor=g,m(_,v.prototype),_.isPureReactComponent=!0;var E=Array.isArray,C=Object.prototype.hasOwnProperty,S={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function w(t,r,n){var o,a={},u=null,i=null;if(null!=r)for(o in void 0!==r.ref&&(i=r.ref),void 0!==r.key&&(u=""+r.key),r)C.call(r,o)&&!O.hasOwnProperty(o)&&(a[o]=r[o]);var c=arguments.length-2;if(1===c)a.children=n;else if(1<c){for(var s=Array(c),l=0;l<c;l++)s[l]=arguments[l+2];a.children=s}if(t&&t.defaultProps)for(o in c=t.defaultProps)void 0===a[o]&&(a[o]=c[o]);return{$$typeof:e,type:t,key:u,ref:i,props:a,_owner:S.current}}function R(t){return"object"==typeof t&&null!==t&&t.$$typeof===e}var k=/\/+/g;function L(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function T(r,n,o,a,u){var i=typeof r;"undefined"!==i&&"boolean"!==i||(r=null);var c=!1;if(null===r)c=!0;else switch(i){case"string":case"number":c=!0;break;case"object":switch(r.$$typeof){case e:case t:c=!0}}if(c)return u=u(c=r),r=""===a?"."+L(c,0):a,E(u)?(o="",null!=r&&(o=r.replace(k,"$&/")+"/"),T(u,n,o,"",(function(e){return e}))):null!=u&&(R(u)&&(u=function(t,r){return{$$typeof:e,type:t.type,key:r,ref:t.ref,props:t.props,_owner:t._owner}}(u,o+(!u.key||c&&c.key===u.key?"":(""+u.key).replace(k,"$&/")+"/")+r)),n.push(u)),1;if(c=0,a=""===a?".":a+":",E(r))for(var s=0;s<r.length;s++){var l=a+L(i=r[s],s);c+=T(i,n,o,l,u)}else if(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=d&&e[d]||e["@@iterator"])?e:null}(r),"function"==typeof l)for(r=l.call(r),s=0;!(i=r.next()).done;)c+=T(i=i.value,n,o,l=a+L(i,s++),u);else if("object"===i)throw n=String(r),Error("Objects are not valid as a React child (found: "+("[object Object]"===n?"object with keys {"+Object.keys(r).join(", ")+"}":n)+"). If you meant to render a collection of children, use an array instead.");return c}function P(e,t,r){if(null==e)return e;var n=[],o=0;return T(e,n,"","",(function(e){return t.call(r,e,o++)})),n}function N(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var j={current:null},x={transition:null},$={ReactCurrentDispatcher:j,ReactCurrentBatchConfig:x,ReactCurrentOwner:S};return i.Children={map:P,forEach:function(e,t,r){P(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return P(e,(function(){t++})),t},toArray:function(e){return P(e,(function(e){return e}))||[]},only:function(e){if(!R(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},i.Component=v,i.Fragment=r,i.Profiler=o,i.PureComponent=g,i.StrictMode=n,i.Suspense=l,i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$,i.cloneElement=function(t,r,n){if(null==t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var o=m({},t.props),a=t.key,u=t.ref,i=t._owner;if(null!=r){if(void 0!==r.ref&&(u=r.ref,i=S.current),void 0!==r.key&&(a=""+r.key),t.type&&t.type.defaultProps)var c=t.type.defaultProps;for(s in r)C.call(r,s)&&!O.hasOwnProperty(s)&&(o[s]=void 0===r[s]&&void 0!==c?c[s]:r[s])}var s=arguments.length-2;if(1===s)o.children=n;else if(1<s){c=Array(s);for(var l=0;l<s;l++)c[l]=arguments[l+2];o.children=c}return{$$typeof:e,type:t.type,key:a,ref:u,props:o,_owner:i}},i.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:u,_context:e},e.Consumer=e},i.createElement=w,i.createFactory=function(e){var t=w.bind(null,e);return t.type=e,t},i.createRef=function(){return{current:null}},i.forwardRef=function(e){return{$$typeof:s,render:e}},i.isValidElement=R,i.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:N}},i.memo=function(e,t){return{$$typeof:f,type:e,compare:void 0===t?null:t}},i.startTransition=function(e){var t=x.transition;x.transition={};try{e()}finally{x.transition=t}},i.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},i.useCallback=function(e,t){return j.current.useCallback(e,t)},i.useContext=function(e){return j.current.useContext(e)},i.useDebugValue=function(){},i.useDeferredValue=function(e){return j.current.useDeferredValue(e)},i.useEffect=function(e,t){return j.current.useEffect(e,t)},i.useId=function(){return j.current.useId()},i.useImperativeHandle=function(e,t,r){return j.current.useImperativeHandle(e,t,r)},i.useInsertionEffect=function(e,t){return j.current.useInsertionEffect(e,t)},i.useLayoutEffect=function(e,t){return j.current.useLayoutEffect(e,t)},i.useMemo=function(e,t){return j.current.useMemo(e,t)},i.useReducer=function(e,t,r){return j.current.useReducer(e,t,r)},i.useRef=function(e){return j.current.useRef(e)},i.useState=function(e){return j.current.useState(e)},i.useSyncExternalStore=function(e,t,r){return j.current.useSyncExternalStore(e,t,r)},i.useTransition=function(){return j.current.useTransition()},i.version="18.2.0",i}():u.exports=(c||(c=1,function(e,t){"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),c=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen"),m=Symbol.iterator,h="@@iterator";function v(e){if(null===e||"object"!=typeof e)return null;var t=m&&e[m]||e[h];return"function"==typeof t?t:null}var b={current:null},g={transition:null},_={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},E={current:null},C={},S=null;function O(e){S=e}C.setExtraStackFrame=function(e){S=e},C.getCurrentStack=null,C.getStackAddendum=function(){var e="";S&&(e+=S);var t=C.getCurrentStack;return t&&(e+=t()||""),e};var w=!1,R=!1,k=!1,L=!1,T=!1,P={ReactCurrentDispatcher:b,ReactCurrentBatchConfig:g,ReactCurrentOwner:E};function N(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];x("warn",e,r)}function j(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];x("error",e,r)}function x(e,t,r){var n=P.ReactDebugCurrentFrame.getStackAddendum();""!==n&&(t+="%s",r=r.concat([n]));var o=r.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}P.ReactDebugCurrentFrame=C,P.ReactCurrentActQueue=_;var $={};function I(e,t){var r=e.constructor,n=r&&(r.displayName||r.name)||"ReactClass",o=n+"."+t;$[o]||(j("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",t,n),$[o]=!0)}var M={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,r){I(e,"forceUpdate")},enqueueReplaceState:function(e,t,r,n){I(e,"replaceState")},enqueueSetState:function(e,t,r,n){I(e,"setState")}},D=Object.assign,A={};function F(e,t,r){this.props=e,this.context=t,this.refs=A,this.updater=r||M}Object.freeze(A),F.prototype.isReactComponent={},F.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},F.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};var V={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},H=function(e,t){Object.defineProperty(F.prototype,e,{get:function(){N("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var U in V)V.hasOwnProperty(U)&&H(U,V[U]);function z(){}function B(e,t,r){this.props=e,this.context=t,this.refs=A,this.updater=r||M}z.prototype=F.prototype;var W=B.prototype=new z;W.constructor=B,D(W,F.prototype),W.isPureReactComponent=!0;var Y=Array.isArray;function K(e){return Y(e)}function q(e){return""+e}function G(e){if(function(e){try{return q(e),!1}catch(e){return!0}}(e))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),q(e)}function X(e){return e.displayName||"Context"}function Z(e){if(null==e)return null;if("number"==typeof e.tag&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case n:return"Portal";case u:return"Profiler";case a:return"StrictMode";case l:return"Suspense";case f:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return X(e)+".Consumer";case i:return X(e._context)+".Provider";case s:return function(e,t,r){var n=e.displayName;if(n)return n;var o=t.displayName||t.name||"";return""!==o?r+"("+o+")":r}(e,e.render,"ForwardRef");case p:var t=e.displayName||null;return null!==t?t:Z(e.type)||"Memo";case d:var r=e,y=r._payload,m=r._init;try{return Z(m(y))}catch(e){return null}}return null}var J,Q,ee,te=Object.prototype.hasOwnProperty,re={key:!0,ref:!0,__self:!0,__source:!0};function ne(e){if(te.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}function oe(e){if(te.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}ee={};var ae=function(e,t,n,o,a,u,i){var c={$$typeof:r,type:e,key:t,ref:n,props:i,_owner:u,_store:{}};return Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c};function ue(e,t,r){var n,o={},a=null,u=null,i=null,c=null;if(null!=t)for(n in ne(t)&&(u=t.ref,function(e){if("string"==typeof e.ref&&E.current&&e.__self&&E.current.stateNode!==e.__self){var t=Z(E.current.type);ee[t]||(j('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',t,e.ref),ee[t]=!0)}}(t)),oe(t)&&(G(t.key),a=""+t.key),i=void 0===t.__self?null:t.__self,c=void 0===t.__source?null:t.__source,t)te.call(t,n)&&!re.hasOwnProperty(n)&&(o[n]=t[n]);var s=arguments.length-2;if(1===s)o.children=r;else if(s>1){for(var l=Array(s),f=0;f<s;f++)l[f]=arguments[f+2];Object.freeze&&Object.freeze(l),o.children=l}if(e&&e.defaultProps){var p=e.defaultProps;for(n in p)void 0===o[n]&&(o[n]=p[n])}if(a||u){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;a&&function(e,t){var r=function(){J||(J=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(o,d),u&&function(e,t){var r=function(){Q||(Q=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(o,d)}return ae(e,a,u,i,c,E.current,o)}function ie(e,t,r){if(null==e)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var n,o,a=D({},e.props),u=e.key,i=e.ref,c=e._self,s=e._source,l=e._owner;if(null!=t)for(n in ne(t)&&(i=t.ref,l=E.current),oe(t)&&(G(t.key),u=""+t.key),e.type&&e.type.defaultProps&&(o=e.type.defaultProps),t)te.call(t,n)&&!re.hasOwnProperty(n)&&(void 0===t[n]&&void 0!==o?a[n]=o[n]:a[n]=t[n]);var f=arguments.length-2;if(1===f)a.children=r;else if(f>1){for(var p=Array(f),d=0;d<f;d++)p[d]=arguments[d+2];a.children=p}return ae(e.type,u,i,c,s,l,a)}function ce(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var se=".",le=":",fe=!1,pe=/\/+/g;function de(e){return e.replace(pe,"$&/")}function ye(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(G(e.key),r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,(function(e){return n[e]}))):t.toString(36);var r,n}function me(e,t,o,a,u){var i=typeof e;"undefined"!==i&&"boolean"!==i||(e=null);var c,s,l,f=!1;if(null===e)f=!0;else switch(i){case"string":case"number":f=!0;break;case"object":switch(e.$$typeof){case r:case n:f=!0}}if(f){var p=e,d=u(p),y=""===a?se+ye(p,0):a;if(K(d)){var m="";null!=y&&(m=de(y)+"/"),me(d,t,m,"",(function(e){return e}))}else null!=d&&(ce(d)&&(!d.key||p&&p.key===d.key||G(d.key),c=d,s=o+(!d.key||p&&p.key===d.key?"":de(""+d.key)+"/")+y,d=ae(c.type,s,c.ref,c._self,c._source,c._owner,c.props)),t.push(d));return 1}var h=0,b=""===a?se:a+le;if(K(e))for(var g=0;g<e.length;g++)h+=me(l=e[g],t,o,b+ye(l,g),u);else{var _=v(e);if("function"==typeof _){var E=e;_===E.entries&&(fe||N("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),fe=!0);for(var C,S=_.call(E),O=0;!(C=S.next()).done;)h+=me(l=C.value,t,o,b+ye(l,O++),u)}else if("object"===i){var w=String(e);throw new Error("Objects are not valid as a React child (found: "+("[object Object]"===w?"object with keys {"+Object.keys(e).join(", ")+"}":w)+"). If you meant to render a collection of children, use an array instead.")}}return h}function he(e,t,r){if(null==e)return e;var n=[],o=0;return me(e,n,"","",(function(e){return t.call(r,e,o++)})),n}var ve,be=-1,ge=0,_e=1,Ee=2;function Ce(e){if(e._status===be){var t=(0,e._result)();if(t.then((function(t){if(e._status===ge||e._status===be){var r=e;r._status=_e,r._result=t}}),(function(t){if(e._status===ge||e._status===be){var r=e;r._status=Ee,r._result=t}})),e._status===be){var r=e;r._status=ge,r._result=t}}if(e._status===_e){var n=e._result;return void 0===n&&j("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",n),"default"in n||j("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))",n),n.default}throw e._result}function Se(e){return"string"==typeof e||"function"==typeof e||!!(e===o||e===u||T||e===a||e===l||e===f||L||e===y||w||R||k)||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===p||e.$$typeof===i||e.$$typeof===c||e.$$typeof===s||e.$$typeof===ve||void 0!==e.getModuleId)}function Oe(){var e=b.current;return null===e&&j("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."),e}ve=Symbol.for("react.module.reference");var we,Re,ke,Le,Te,Pe,Ne,je=0;function xe(){}xe.__reactDisabledLog=!0;var $e,Ie=P.ReactCurrentDispatcher;function Me(e,t,r){if(void 0===$e)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);$e=n&&n[1]||""}return"\n"+$e+e}var De,Ae=!1,Fe="function"==typeof WeakMap?WeakMap:Map;function Ve(e,t){if(!e||Ae)return"";var r,n=De.get(e);if(void 0!==n)return n;Ae=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=Ie.current,Ie.current=null,function(){if(0===je){we=console.log,Re=console.info,ke=console.warn,Le=console.error,Te=console.group,Pe=console.groupCollapsed,Ne=console.groupEnd;var e={configurable:!0,enumerable:!0,value:xe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}je++}();try{if(t){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(u,[])}catch(e){r=e}Reflect.construct(e,[],u)}else{try{u.call()}catch(e){r=e}e.call(u.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var i=t.stack.split("\n"),c=r.stack.split("\n"),s=i.length-1,l=c.length-1;s>=1&&l>=0&&i[s]!==c[l];)l--;for(;s>=1&&l>=0;s--,l--)if(i[s]!==c[l]){if(1!==s||1!==l)do{if(s--,--l<0||i[s]!==c[l]){var f="\n"+i[s].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&De.set(e,f),f}}while(s>=1&&l>=0);break}}}finally{Ae=!1,Ie.current=o,function(){if(0==--je){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:D({},e,{value:we}),info:D({},e,{value:Re}),warn:D({},e,{value:ke}),error:D({},e,{value:Le}),group:D({},e,{value:Te}),groupCollapsed:D({},e,{value:Pe}),groupEnd:D({},e,{value:Ne})})}je<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var p=e?e.displayName||e.name:"",d=p?Me(p):"";return"function"==typeof e&&De.set(e,d),d}function He(e,t,r){if(null==e)return"";if("function"==typeof e)return Ve(e,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(e));if("string"==typeof e)return Me(e);switch(e){case l:return Me("Suspense");case f:return Me("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case s:return Ve(e.render,!1);case p:return He(e.type,t,r);case d:var n=e,o=n._payload,a=n._init;try{return He(a(o),t,r)}catch(e){}}return""}De=new Fe;var Ue,ze={},Be=P.ReactDebugCurrentFrame;function We(e){if(e){var t=e._owner,r=He(e.type,e._source,t?t.type:null);Be.setExtraStackFrame(r)}else Be.setExtraStackFrame(null)}function Ye(e){if(e){var t=e._owner;O(He(e.type,e._source,t?t.type:null))}else O(null)}function Ke(){if(E.current){var e=Z(E.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Ue=!1;var qe={};function Ge(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=Ke();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!qe[r]){qe[r]=!0;var n="";e&&e._owner&&e._owner!==E.current&&(n=" It was passed a child from "+Z(e._owner.type)+"."),Ye(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),Ye(null)}}}function Xe(e,t){if("object"==typeof e)if(K(e))for(var r=0;r<e.length;r++){var n=e[r];ce(n)&&Ge(n,t)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var o=v(e);if("function"==typeof o&&o!==e.entries)for(var a,u=o.call(e);!(a=u.next()).done;)ce(a.value)&&Ge(a.value,t)}}function Ze(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==s&&r.$$typeof!==p)return;t=r.propTypes}if(t){var n=Z(r);!function(e,t,r,n,o){var a=Function.call.bind(te);for(var u in e)if(a(e,u)){var i=void 0;try{if("function"!=typeof e[u]){var c=Error((n||"React class")+": "+r+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}i=e[u](t,u,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){i=e}!i||i instanceof Error||(We(o),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,u,typeof i),We(null)),i instanceof Error&&!(i.message in ze)&&(ze[i.message]=!0,We(o),j("Failed %s type: %s",r,i.message),We(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||Ue||(Ue=!0,j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Z(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Je(e,t,n){var a,u,i=Se(e);if(!i){var c,s="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(s+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),s+=(null!=(a=t)&&void 0!==(u=a.__source)?"\n\nCheck your code at "+u.fileName.replace(/^.*[\\\/]/,"")+":"+u.lineNumber+".":"")||Ke(),null===e?c="null":K(e)?c="array":void 0!==e&&e.$$typeof===r?(c="<"+(Z(e.type)||"Unknown")+" />",s=" Did you accidentally export a JSX literal instead of a component?"):c=typeof e,j("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",c,s)}var l=ue.apply(this,arguments);if(null==l)return l;if(i)for(var f=2;f<arguments.length;f++)Xe(arguments[f],e);return e===o?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){Ye(e),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),Ye(null);break}}null!==e.ref&&(Ye(e),j("Invalid attribute `ref` supplied to `React.Fragment`."),Ye(null))}(l):Ze(l),l}var Qe=!1,et=!1,tt=null,rt=0,nt=!1;function ot(e){e!==rt-1&&j("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),rt=e}function at(t,r,n){var o=_.current;if(null!==o)try{it(o),function(t){if(null===tt)try{var r=("require"+Math.random()).slice(0,7);tt=(e&&e[r]).call(e,"timers").setImmediate}catch(e){tt=function(e){!1===et&&(et=!0,"undefined"==typeof MessageChannel&&j("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(void 0)}}tt(t)}((function(){0===o.length?(_.current=null,r(t)):at(t,r,n)}))}catch(e){n(e)}else r(t)}var ut=!1;function it(e){if(!ut){ut=!0;var t=0;try{for(;t<e.length;t++){var r=e[t];do{r=r(!0)}while(null!==r)}e.length=0}catch(r){throw e=e.slice(t+1),r}finally{ut=!1}}}var ct=Je,st=function(e,t,r){for(var n=ie.apply(this,arguments),o=2;o<arguments.length;o++)Xe(arguments[o],n.type);return Ze(n),n},lt=function(e){var t=Je.bind(null,e);return t.type=e,Qe||(Qe=!0,N("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(t,"type",{enumerable:!1,get:function(){return N("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},ft={map:he,forEach:function(e,t,r){he(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return he(e,(function(){t++})),t},toArray:function(e){return he(e,(function(e){return e}))||[]},only:function(e){if(!ce(e))throw new Error("React.Children.only expected to receive a single React element child.");return e}};t.Children=ft,t.Component=F,t.Fragment=o,t.Profiler=u,t.PureComponent=B,t.StrictMode=a,t.Suspense=l,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=P,t.cloneElement=st,t.createContext=function(e){var t={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};t.Provider={$$typeof:i,_context:t};var r=!1,n=!1,o=!1,a={$$typeof:c,_context:t};return Object.defineProperties(a,{Provider:{get:function(){return n||(n=!0,j("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),t.Provider},set:function(e){t.Provider=e}},_currentValue:{get:function(){return t._currentValue},set:function(e){t._currentValue=e}},_currentValue2:{get:function(){return t._currentValue2},set:function(e){t._currentValue2=e}},_threadCount:{get:function(){return t._threadCount},set:function(e){t._threadCount=e}},Consumer:{get:function(){return r||(r=!0,j("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),t.Consumer}},displayName:{get:function(){return t.displayName},set:function(e){o||(N("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",e),o=!0)}}}),t.Consumer=a,t._currentRenderer=null,t._currentRenderer2=null,t},t.createElement=ct,t.createFactory=lt,t.createRef=function(){var e={current:null};return Object.seal(e),e},t.forwardRef=function(e){null!=e&&e.$$typeof===p?j("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?j("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&j("forwardRef render functions accept exactly two parameters: props and ref. %s",1===e.length?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),null!=e&&(null==e.defaultProps&&null==e.propTypes||j("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?"));var t,r={$$typeof:s,render:e};return Object.defineProperty(r,"displayName",{enumerable:!1,configurable:!0,get:function(){return t},set:function(r){t=r,e.name||e.displayName||(e.displayName=r)}}),r},t.isValidElement=ce,t.lazy=function(e){var t,r,n={$$typeof:d,_payload:{_status:be,_result:e},_init:Ce};return Object.defineProperties(n,{defaultProps:{configurable:!0,get:function(){return t},set:function(e){j("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),t=e,Object.defineProperty(n,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return r},set:function(e){j("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),r=e,Object.defineProperty(n,"propTypes",{enumerable:!0})}}}),n},t.memo=function(e,t){Se(e)||j("memo: The first argument must be a component. Instead received: %s",null===e?"null":typeof e);var r,n={$$typeof:p,type:e,compare:void 0===t?null:t};return Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return r},set:function(t){r=t,e.name||e.displayName||(e.displayName=t)}}),n},t.startTransition=function(e,t){var r=g.transition;g.transition={};var n=g.transition;g.transition._updatedFibers=new Set;try{e()}finally{g.transition=r,null===r&&n._updatedFibers&&(n._updatedFibers.size>10&&N("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),n._updatedFibers.clear())}},t.unstable_act=function(e){var t=rt;rt++,null===_.current&&(_.current=[]);var r,n=_.isBatchingLegacy;try{if(_.isBatchingLegacy=!0,r=e(),!n&&_.didScheduleLegacyUpdate){var o=_.current;null!==o&&(_.didScheduleLegacyUpdate=!1,it(o))}}catch(e){throw ot(t),e}finally{_.isBatchingLegacy=n}if(null!==r&&"object"==typeof r&&"function"==typeof r.then){var a=r,u=!1,i={then:function(e,r){u=!0,a.then((function(n){ot(t),0===rt?at(n,e,r):e(n)}),(function(e){ot(t),r(e)}))}};return nt||"undefined"==typeof Promise||Promise.resolve().then((function(){})).then((function(){u||(nt=!0,j("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))})),i}var c=r;if(ot(t),0===rt){var s=_.current;return null!==s&&(it(s),_.current=null),{then:function(e,t){null===_.current?(_.current=[],at(c,e,t)):e(c)}}}return{then:function(e,t){e(c)}}},t.useCallback=function(e,t){return Oe().useCallback(e,t)},t.useContext=function(e){var t=Oe();if(void 0!==e._context){var r=e._context;r.Consumer===e?j("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):r.Provider===e&&j("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return t.useContext(e)},t.useDebugValue=function(e,t){return Oe().useDebugValue(e,t)},t.useDeferredValue=function(e){return Oe().useDeferredValue(e)},t.useEffect=function(e,t){return Oe().useEffect(e,t)},t.useId=function(){return Oe().useId()},t.useImperativeHandle=function(e,t,r){return Oe().useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return Oe().useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return Oe().useLayoutEffect(e,t)},t.useMemo=function(e,t){return Oe().useMemo(e,t)},t.useReducer=function(e,t,r){return Oe().useReducer(e,t,r)},t.useRef=function(e){return Oe().useRef(e)},t.useState=function(e){return Oe().useState(e)},t.useSyncExternalStore=function(e,t,r){return Oe().useSyncExternalStore(e,t,r)},t.useTransition=function(){return Oe().useTransition()},t.version="18.2.0","undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(s,s.exports)),s.exports);var l=u.exports,f=o(l);const p=f.createContext(null);p.displayName="TableContext";var d=(e,t)=>Object.prototype.toString.call(e)===`[object ${t}]`;var y=e=>"function"==typeof e;var m=e=>null==e;var h=e=>null!=e;var v=e=>"object"==typeof e&&null!==e;var b=function(e){if(!v(e)||!d(e,"Object"))return!1;if(null===Object.getPrototypeOf(e))return!0;let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};var g=function(e){const t=typeof e;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===t:"string"===t||d(e,"String")};var _=e=>Array.isArray?Array.isArray(e):d(e,"Array");var E=function(e){return null!==e&&"function"!=typeof e&&Number.isFinite(e.length)};var C=function(e){const t=typeof e;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===t:"number"===t||d(e,"Number")};function S(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t){if(e===t)return;if(h(t)&&"object"==typeof t){const n=Object(t),o=[];for(const e in n)o.push(e);let{length:a}=o,u=-1;for(;a--;){const a=o[++u];h(n[a])&&"object"==typeof n[a]?O(e,t,a,r):w(e,a,n[a])}}}}function O(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=e[r],a=t[r];let u=t[r],i=!0;if(_(a)){if(n)u=[];else if(_(o))u=o;else if(E(o)){u=new Array(o.length);let e=-1;const t=o.length;for(;++e<t;)u[e]=o[e]}}else b(a)?(u=o,"function"!=typeof o&&"object"==typeof o||(u={})):i=!1;i&&S(u,a,n),w(e,r,u)}function w(e,t,r){(void 0!==r&&!function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}(e[t],r)||void 0===r&&!(t in e))&&(e[t]=r)}function R(e){let t=-1;const r=arguments.length<=1?0:arguments.length-1;for(;++t<r;)S(e,t+1<1||arguments.length<=t+1?void 0:arguments[t+1],!0);return e}function k(e,t){if(!e||!b(e))return e;const r={};return Object.keys(e).forEach((n=>{const o=e[n];let a=!1;t.forEach((e=>{(g(e)&&e===n||e instanceof RegExp&&n.match(e))&&(a=!0)})),a||(r[n]=o)})),r}function L(e){return Object.prototype.toString.call(e)}function T(e){return Object.keys(e)}function P(e,t,r){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(null==e||null==t)return!1;if(Number.isNaN(e)&&Number.isNaN(t))return!0;if(L(e)!==L(t))return!1;if(y(e))return!!(null==r?void 0:r.skipFunction);if("object"!=typeof e)return!1;if(_(e)){if(e.length!==t.length)return!1;for(let n=e.length-1;n>=0;n--)if(!P(e[n],t[n],r))return!1;return!0}if(!b(e))return!1;const n=T(e),o=T(t);if(n.length!==o.length)return!1;n.sort(),o.sort();for(let e=n.length-1;e>=0;e--)if(n[e]!=o[e])return!1;for(let o=n.length-1;o>=0;o--){const a=n[o];if(!P(e[a],t[a],r))return!1}return!0}var N,j={exports:{}},x={};var $,I={};
|
|
11
11
|
/**
|
|
12
12
|
* @license React
|
|
13
13
|
* react-is.development.js
|
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
*
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/"production"===process.env.NODE_ENV?j.exports=function(){if(N)return x;N=1;var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var y=e.$$typeof;switch(y){case t:switch(e=e.type){case n:case a:case o:case l:case f:return e;default:switch(e=e&&e.$$typeof){case c:case i:case s:case d:case p:case u:return e;default:return y}}case r:return y}}}return e=Symbol.for("react.module.reference"),x.ContextConsumer=i,x.ContextProvider=u,x.Element=t,x.ForwardRef=s,x.Fragment=n,x.Lazy=d,x.Memo=p,x.Portal=r,x.Profiler=a,x.StrictMode=o,x.Suspense=l,x.SuspenseList=f,x.isAsyncMode=function(){return!1},x.isConcurrentMode=function(){return!1},x.isContextConsumer=function(e){return m(e)===i},x.isContextProvider=function(e){return m(e)===u},x.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},x.isForwardRef=function(e){return m(e)===s},x.isFragment=function(e){return m(e)===n},x.isLazy=function(e){return m(e)===d},x.isMemo=function(e){return m(e)===p},x.isPortal=function(e){return m(e)===r},x.isProfiler=function(e){return m(e)===a},x.isStrictMode=function(e){return m(e)===o},x.isSuspense=function(e){return m(e)===l},x.isSuspenseList=function(e){return m(e)===f},x.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===a||t===o||t===l||t===f||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===p||t.$$typeof===u||t.$$typeof===i||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},x.typeOf=m,x}():j.exports=($||($=1,"production"!==process.env.NODE_ENV&&function(){var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var y=e.$$typeof;switch(y){case t:var m=e.type;switch(m){case n:case a:case o:case l:case f:return m;default:var h=m&&m.$$typeof;switch(h){case c:case i:case s:case d:case p:case u:return h;default:return y}}case r:return y}}}e=Symbol.for("react.module.reference");var h=i,v=u,b=t,g=s,_=n,E=d,C=p,S=r,w=a,O=o,R=l,k=f,L=!1,T=!1;I.ContextConsumer=h,I.ContextProvider=v,I.Element=b,I.ForwardRef=g,I.Fragment=_,I.Lazy=E,I.Memo=C,I.Portal=S,I.Profiler=w,I.StrictMode=O,I.Suspense=R,I.SuspenseList=k,I.isAsyncMode=function(e){return L||(L=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},I.isConcurrentMode=function(e){return T||(T=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},I.isContextConsumer=function(e){return m(e)===i},I.isContextProvider=function(e){return m(e)===u},I.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},I.isForwardRef=function(e){return m(e)===s},I.isFragment=function(e){return m(e)===n},I.isLazy=function(e){return m(e)===d},I.isMemo=function(e){return m(e)===p},I.isPortal=function(e){return m(e)===r},I.isProfiler=function(e){return m(e)===a},I.isStrictMode=function(e){return m(e)===o},I.isSuspense=function(e){return m(e)===l},I.isSuspenseList=function(e){return m(e)===f},I.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===a||t===o||t===l||t===f||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===p||t.$$typeof===u||t.$$typeof===i||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},I.typeOf=m}()),I);var M=j.exports;const D=e=>{let t=[];return f.Children.forEach(e,(e=>{m(e)||(M.isFragment(e)?t=t.concat(D(e.props.children)):t.push(e))})),t},A={...t.ListTable.EVENT_TYPE,...t.PivotTable.EVENT_TYPE,...t.PivotChart.EVENT_TYPE},F={onClickCell:A.CLICK_CELL,onDblClickCell:A.DBLCLICK_CELL,onMouseDownCell:A.MOUSEDOWN_CELL,onMouseUpCell:A.MOUSEUP_CELL,onSelectedCell:A.SELECTED_CELL,onKeyDown:A.KEYDOWN,onMouseEnterTable:A.MOUSEENTER_TABLE,onMouseLeaveTable:A.MOUSELEAVE_TABLE,onMouseDownTable:A.MOUSEDOWN_TABLE,onMouseMoveCell:A.MOUSEMOVE_CELL,onMouseEnterCell:A.MOUSEENTER_CELL,onMouseLeaveCell:A.MOUSELEAVE_CELL,onContextMenuCell:A.CONTEXTMENU_CELL,onResizeColumn:A.RESIZE_COLUMN,onResizeColumnEnd:A.RESIZE_COLUMN_END,onChangeHeaderPosition:A.CHANGE_HEADER_POSITION,onSortClick:A.SORT_CLICK,onFreezeClick:A.FREEZE_CLICK,onScroll:A.SCROLL,onDropdownMenuClick:A.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:A.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:A.DRAG_SELECT_END,onDropdownIconClick:A.DROPDOWN_ICON_CLICK,onDropdownMenuClear:A.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:A.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:A.SHOW_MENU,onHideMenu:A.HIDE_MENU,onIconClick:A.ICON_CLICK,onLegendItemClick:A.LEGEND_ITEM_CLICK,onLegendItemHover:A.LEGEND_ITEM_HOVER,onLegendItemUnHover:A.LEGEND_ITEM_UNHOVER,onLegendChange:A.LEGEND_CHANGE,onMouseEnterAxis:A.MOUSEENTER_AXIS,onMouseLeaveAxis:A.MOUSELEAVE_AXIS,onCheckboxStateChange:A.CHECKBOX_STATE_CHANGE,onRadioStateChange:A.RADIO_STATE_CHANGE,onAfterRender:A.AFTER_RENDER,onInitialized:A.INITIALIZED,onPivotSortClick:A.PIVOT_SORT_CLICK,onDrillMenuClick:A.DRILLMENU_CLICK,onVChartEventType:A.VCHART_EVENT_TYPE,onChangCellValue:A.CHANGE_CELL_VALUE,onMousedownFillHandle:A.MOUSEDOWN_FILL_HANDLE,onDragFillHandleEnd:A.DRAG_FILL_HANDLE_END,onDblclickFillHandle:A.DBLCLICK_FILL_HANDLE,onScrollVerticalEnd:A.SCROLL_VERTICAL_END,onScrollHorizontalEnd:A.SCROLL_HORIZONTAL_END},V=Object.keys(F),H=(e,t=F)=>{const r={};return Object.keys(e).forEach((n=>{t[n]&&e[n]&&(r[n]=e[n])})),r},U=(e,t,r,n=F)=>{if(!t&&!r||!e)return!1;const o=r?H(r,n):null,a=t?H(t,n):null;return o&&Object.keys(o).forEach((t=>{a&&a[t]&&a[t]===o[t]||e.off(n[t],r[t])})),a&&Object.keys(a).forEach((t=>{o&&o[t]&&o[t]===a[t]||e.on(n[t],a[t])})),!0},z=["children","hooks","ref",...V,"skipFunctionDiff","onError","onReady","option","records","container"],B=(e,t)=>`${e&&e.type&&(e.type.displayName||e.type.name)}-${t}`,W=f.forwardRef(((e,t)=>{const[r,o]=l.useState(0),a=l.useRef({});l.useImperativeHandle(t,(()=>a.current?.table));const u=!!e.option,i=!!e.records,c=l.useRef(!1),s=l.useRef(k(e,z)),d=l.useRef(null),y=l.useRef(e.records),h=f.useRef(null),v=!!e.skipFunctionDiff,b=l.useCallback((e=>u&&e.option?i&&e.records?{...e.option,records:e.records}:e.option:{records:e.records,...s.current,...d.current}),[u,i]),g=l.useCallback((e=>{let t;t="pivot-table"===e.type?new n.PivotTable(e.container,b(e)):"pivot-chart"===e.type?new n.PivotChart(e.container,b(e)):new n.ListTable(e.container,b(e)),a.current={...a.current,table:t},c.current=!1}),[b]),_=l.useCallback((()=>{if(!c.current){if(!a.current||!a.current.table)return;U(a.current.table,e,h.current,F),o(r+1),e.onReady&&e.onReady(a.current.table,0===r)}}),[r,o,e]),E=l.useCallback((()=>{a.current.table&&(a.current.table.render(),_())}),[_]);return l.useEffect((()=>{const t=u?null:(e=>{const t={};return D(e.children).map(((e,r)=>{const n=e&&e.type&&e.type.parseOption;if(n&&e.props){const o=n(m(e.props.componentId)?{...e.props,componentId:B(e,r)}:e.props);o.isSingle?t[o.optionName]=o.option:(t[o.optionName]||(t[o.optionName]=[]),t[o.optionName].push(o.option))}})),t})(e);if(!a.current?.table)return u||(d.current=t),g(e),E(),void(h.current=e);if(u)return void(P(h.current.option,e.option,{skipFunction:v})?i&&!P(h.current.records,e.records,{skipFunction:v})&&(a.current.table.setRecords(e.records),_(),h.current=e):(a.current.table.updateOption(b(e)),_(),h.current=e));const r=k(e,z);P(r,s.current,{skipFunction:v})&&P(t,d.current,{skipFunction:v})?i&&!P(e.records,y.current,{skipFunction:v})&&(y.current=e.records,a.current.table.setRecords(e.records),_(),h.current=e):(s.current=r,d.current=t,a.current.table.updateOption(b(e)),_(),h.current=e)}),[g,u,i,b,_,E,v,e]),l.useEffect((()=>()=>{a&&a.current&&a.current.table&&(a.current.table.release(),a.current=null),h.current=null,c.current=!0}),[]),f.createElement(p.Provider,{value:a.current},D(e.children).map(((e,t)=>{if("string"==typeof e)return;const n=B(e,t);return f.createElement(f.Fragment,{key:n},f.cloneElement(e,{updateId:r,componentId:n}))})))})),Y=(e,t,r)=>{const n=function(e,t="TableContainer",r){const n=f.forwardRef(((t,n)=>{const o=l.useRef(),[a,u]=l.useState(!1),{className:i,style:c,width:s,...p}=t;return l.useLayoutEffect((()=>{u(!0)}),[]),f.createElement("div",{ref:o,className:i,style:{position:"relative",height:t.height||"100%",width:t.width||"100%",...c}},a?f.createElement(e,{ref:n,container:o.current,...r?r(p):p}):f.createElement(f.Fragment,null))}));return n.displayName=t||e.name,n}(W,e,(e=>(e.type=t,r?r(e):t?{...e,type:t}:e)));return n.displayName=e,n},K=Y("ListTable","list-table"),q=Y("PivotTable","pivot-table"),G=Y("PivotChart","pivot-chart");const X=(e,t,r,n)=>{const o=["id","updateId","componentId"],a=r?Object.keys(r).concat(o):o,u=e=>{const t=l.useContext(p),n=f.useRef(null),o=f.useRef(e.updateId);if(e.updateId!==o.current){o.current=e.updateId;!!r&&U(t.table,e,n.current,r)&&(n.current=e)}return l.useEffect((()=>()=>{r&&U(t.table,null,n.current,r)}),[]),null};return u.displayName=e,u.parseOption=e=>({option:k(e,a),optionName:t,isSingle:n}),u},Z=X("ListColumn","columns"),J=X("PivotColumnDimension","columns"),Q=X("PivotRowDimension","rows"),ee=X("PivotIndicator","indicators"),te=X("PivotColumnHeaderTitle","columnHeaderTitle",void 0,!0),re=X("PivotRowHeaderTitle","rowHeaderTitle",void 0,!0),ne=X("PivotCorner","corner",void 0,!0),oe=X("Menu","menu",void 0,!0),ae=X("Tooltip","tooltip",void 0,!0);function ue(e,t){return C(e)?e:"string"==typeof e&&e.endsWith("%")?Number(e.slice(0,-1))/100*t:0}e.VTable=n,e.CustomComponent=e=>{const t=l.useContext(p),{table:r}=t,n=function(e,t){const r=l.useMemo((()=>({...t})),[t]),n=l.useMemo((()=>{const t=R({},e);for(const e in r)void 0===t[e]&&(t[e]=r[e]);return t}),[e,r]);return n}(e,{style:{left:0,top:0},className:"vtable-custom-component",displayMode:"position",x:0,y:0,width:0,height:0,row:0,col:0,anchor:"top-left",dx:0,dy:0}),{displayMode:o,x:a,y:u,width:i,height:c,row:s,col:d,anchor:y,dx:m,dy:h,className:v,children:b,style:g}=n;let _,E,C,S;if("position"===o)_=a+m+"px",E=u+h+"px",C=i+"px",S=c+"px";else if("cell"===o){const e=r&&d>=0&&s>=0?r?.getCellRelativeRect(d,s):{width:0,height:0,left:-9999,top:-9999};C=ue(i,e.width)+"px",S=ue(c,e.height)+"px","top-left"===y?(_=e.left+ue(m,e.width)+"px",E=e.top+ue(h,e.height)+"px"):"top-right"===y?(_=e.left+ue(m,e.width)+e.width+"px",E=e.top+ue(h,e.height)+"px"):"bottom-left"===y?(_=e.left+ue(m,e.width)+"px",E=e.top+ue(h,e.height)+e.height+"px"):"bottom-right"===y&&(_=e.left+ue(m,e.width)+e.width+"px",E=e.top+ue(h,e.height)+e.height+"px")}const w=R({},g,{position:"absolute",zIndex:1e3,width:C,height:S,left:_,top:E});return f.createElement("div",{className:v,style:w},f.Children.map(b,(e=>e?f.cloneElement(e,{}):e)))},e.ListColumn=Z,e.ListTable=K,e.Menu=oe,e.PivotChart=G,e.PivotColumnDimension=J,e.PivotColumnHeaderTitle=te,e.PivotCorner=ne,e.PivotIndicator=ee,e.PivotRowDimension=Q,e.PivotRowHeaderTitle=re,e.PivotTable=q,e.Tooltip=ae,e.registerChartModule=function(e,t){n.register.chartModule(e,t)},e.version="0.25.4"}));
|
|
19
|
+
*/"production"===process.env.NODE_ENV?j.exports=function(){if(N)return x;N=1;var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var y=e.$$typeof;switch(y){case t:switch(e=e.type){case n:case a:case o:case l:case f:return e;default:switch(e=e&&e.$$typeof){case c:case i:case s:case d:case p:case u:return e;default:return y}}case r:return y}}}return e=Symbol.for("react.module.reference"),x.ContextConsumer=i,x.ContextProvider=u,x.Element=t,x.ForwardRef=s,x.Fragment=n,x.Lazy=d,x.Memo=p,x.Portal=r,x.Profiler=a,x.StrictMode=o,x.Suspense=l,x.SuspenseList=f,x.isAsyncMode=function(){return!1},x.isConcurrentMode=function(){return!1},x.isContextConsumer=function(e){return m(e)===i},x.isContextProvider=function(e){return m(e)===u},x.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},x.isForwardRef=function(e){return m(e)===s},x.isFragment=function(e){return m(e)===n},x.isLazy=function(e){return m(e)===d},x.isMemo=function(e){return m(e)===p},x.isPortal=function(e){return m(e)===r},x.isProfiler=function(e){return m(e)===a},x.isStrictMode=function(e){return m(e)===o},x.isSuspense=function(e){return m(e)===l},x.isSuspenseList=function(e){return m(e)===f},x.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===a||t===o||t===l||t===f||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===p||t.$$typeof===u||t.$$typeof===i||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},x.typeOf=m,x}():j.exports=($||($=1,"production"!==process.env.NODE_ENV&&function(){var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var y=e.$$typeof;switch(y){case t:var m=e.type;switch(m){case n:case a:case o:case l:case f:return m;default:var h=m&&m.$$typeof;switch(h){case c:case i:case s:case d:case p:case u:return h;default:return y}}case r:return y}}}e=Symbol.for("react.module.reference");var h=i,v=u,b=t,g=s,_=n,E=d,C=p,S=r,O=a,w=o,R=l,k=f,L=!1,T=!1;I.ContextConsumer=h,I.ContextProvider=v,I.Element=b,I.ForwardRef=g,I.Fragment=_,I.Lazy=E,I.Memo=C,I.Portal=S,I.Profiler=O,I.StrictMode=w,I.Suspense=R,I.SuspenseList=k,I.isAsyncMode=function(e){return L||(L=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},I.isConcurrentMode=function(e){return T||(T=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},I.isContextConsumer=function(e){return m(e)===i},I.isContextProvider=function(e){return m(e)===u},I.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},I.isForwardRef=function(e){return m(e)===s},I.isFragment=function(e){return m(e)===n},I.isLazy=function(e){return m(e)===d},I.isMemo=function(e){return m(e)===p},I.isPortal=function(e){return m(e)===r},I.isProfiler=function(e){return m(e)===a},I.isStrictMode=function(e){return m(e)===o},I.isSuspense=function(e){return m(e)===l},I.isSuspenseList=function(e){return m(e)===f},I.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===a||t===o||t===l||t===f||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===p||t.$$typeof===u||t.$$typeof===i||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},I.typeOf=m}()),I);var M=j.exports;const D=e=>{let t=[];return f.Children.forEach(e,(e=>{m(e)||(M.isFragment(e)?t=t.concat(D(e.props.children)):t.push(e))})),t},A={...t.ListTable.EVENT_TYPE,...t.PivotTable.EVENT_TYPE,...t.PivotChart.EVENT_TYPE},F={onClickCell:A.CLICK_CELL,onDblClickCell:A.DBLCLICK_CELL,onMouseDownCell:A.MOUSEDOWN_CELL,onMouseUpCell:A.MOUSEUP_CELL,onSelectedCell:A.SELECTED_CELL,onKeyDown:A.KEYDOWN,onMouseEnterTable:A.MOUSEENTER_TABLE,onMouseLeaveTable:A.MOUSELEAVE_TABLE,onMouseDownTable:A.MOUSEDOWN_TABLE,onMouseMoveCell:A.MOUSEMOVE_CELL,onMouseEnterCell:A.MOUSEENTER_CELL,onMouseLeaveCell:A.MOUSELEAVE_CELL,onContextMenuCell:A.CONTEXTMENU_CELL,onResizeColumn:A.RESIZE_COLUMN,onResizeColumnEnd:A.RESIZE_COLUMN_END,onChangeHeaderPosition:A.CHANGE_HEADER_POSITION,onSortClick:A.SORT_CLICK,onFreezeClick:A.FREEZE_CLICK,onScroll:A.SCROLL,onDropdownMenuClick:A.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:A.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:A.DRAG_SELECT_END,onDropdownIconClick:A.DROPDOWN_ICON_CLICK,onDropdownMenuClear:A.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:A.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:A.SHOW_MENU,onHideMenu:A.HIDE_MENU,onIconClick:A.ICON_CLICK,onLegendItemClick:A.LEGEND_ITEM_CLICK,onLegendItemHover:A.LEGEND_ITEM_HOVER,onLegendItemUnHover:A.LEGEND_ITEM_UNHOVER,onLegendChange:A.LEGEND_CHANGE,onMouseEnterAxis:A.MOUSEENTER_AXIS,onMouseLeaveAxis:A.MOUSELEAVE_AXIS,onCheckboxStateChange:A.CHECKBOX_STATE_CHANGE,onRadioStateChange:A.RADIO_STATE_CHANGE,onAfterRender:A.AFTER_RENDER,onInitialized:A.INITIALIZED,onPivotSortClick:A.PIVOT_SORT_CLICK,onDrillMenuClick:A.DRILLMENU_CLICK,onVChartEventType:A.VCHART_EVENT_TYPE,onChangCellValue:A.CHANGE_CELL_VALUE,onMousedownFillHandle:A.MOUSEDOWN_FILL_HANDLE,onDragFillHandleEnd:A.DRAG_FILL_HANDLE_END,onDblclickFillHandle:A.DBLCLICK_FILL_HANDLE,onScrollVerticalEnd:A.SCROLL_VERTICAL_END,onScrollHorizontalEnd:A.SCROLL_HORIZONTAL_END},V=Object.keys(F),H=(e,t=F)=>{const r={};return Object.keys(e).forEach((n=>{t[n]&&e[n]&&(r[n]=e[n])})),r},U=(e,t,r,n=F)=>{if(!t&&!r||!e)return!1;const o=r?H(r,n):null,a=t?H(t,n):null;return o&&Object.keys(o).forEach((t=>{a&&a[t]&&a[t]===o[t]||e.off(n[t],r[t])})),a&&Object.keys(a).forEach((t=>{o&&o[t]&&o[t]===a[t]||e.on(n[t],a[t])})),!0},z=["children","hooks","ref",...V,"skipFunctionDiff","onError","onReady","option","records","container"],B=(e,t)=>`${e&&e.type&&(e.type.displayName||e.type.name)}-${t}`,W=f.forwardRef(((e,t)=>{const[r,o]=l.useState(0),a=l.useRef({});l.useImperativeHandle(t,(()=>a.current?.table));const u=!!e.option,i=!!e.records,c=l.useRef(!1),s=l.useRef(k(e,z)),d=l.useRef(null),y=l.useRef(e.records),h=f.useRef(null),v=!!e.skipFunctionDiff,b=l.useCallback((e=>u&&e.option?i&&e.records?{...e.option,clearDOM:!1,records:e.records}:{...e.option,clearDOM:!1}:{records:e.records,...s.current,...d.current,clearDOM:!1}),[u,i]),g=l.useCallback((e=>{let t;t="pivot-table"===e.type?new n.PivotTable(e.container,b(e)):"pivot-chart"===e.type?new n.PivotChart(e.container,b(e)):new n.ListTable(e.container,b(e)),a.current={...a.current,table:t},c.current=!1}),[b]),_=l.useCallback((()=>{if(!c.current){if(!a.current||!a.current.table)return;U(a.current.table,e,h.current,F),o(r+1),e.onReady&&e.onReady(a.current.table,0===r)}}),[r,o,e]),E=l.useCallback((()=>{a.current.table&&(a.current.table.render(),_())}),[_]);return l.useEffect((()=>{const t=u?null:(e=>{const t={};return D(e.children).map(((e,r)=>{const n=e&&e.type&&e.type.parseOption;if(n&&e.props){const o=n(m(e.props.componentId)?{...e.props,componentId:B(e,r)}:e.props);o.isSingle?t[o.optionName]=o.option:(t[o.optionName]||(t[o.optionName]=[]),t[o.optionName].push(o.option))}})),t})(e);if(!a.current?.table)return u||(d.current=t),g(e),E(),void(h.current=e);if(u)return void(P(h.current.option,e.option,{skipFunction:v})?i&&!P(h.current.records,e.records,{skipFunction:v})&&(a.current.table.setRecords(e.records),_(),h.current=e):(a.current.table.updateOption(b(e)),_(),h.current=e));const r=k(e,z);P(r,s.current,{skipFunction:v})&&P(t,d.current,{skipFunction:v})?i&&!P(e.records,y.current,{skipFunction:v})&&(y.current=e.records,a.current.table.setRecords(e.records),_(),h.current=e):(s.current=r,d.current=t,a.current.table.updateOption(b(e)),_(),h.current=e)}),[g,u,i,b,_,E,v,e]),l.useEffect((()=>()=>{a&&a.current&&a.current.table&&(a.current.table.release(),a.current=null),h.current=null,c.current=!0}),[]),f.createElement(p.Provider,{value:a.current},D(e.children).map(((e,t)=>{if("string"==typeof e)return;const n=B(e,t);return f.createElement(f.Fragment,{key:n},f.cloneElement(e,{updateId:r,componentId:n}))})))})),Y=(e,t,r)=>{const n=function(e,t="TableContainer",r){const n=f.forwardRef(((t,n)=>{const o=l.useRef(),[a,u]=l.useState(!1),{className:i,style:c,width:s,...p}=t;return l.useLayoutEffect((()=>{u(!0)}),[]),f.createElement("div",{ref:o,className:i,style:{position:"relative",height:t.height||"100%",width:t.width||"100%",...c}},a?f.createElement(e,{ref:n,container:o.current,...r?r(p):p}):f.createElement(f.Fragment,null))}));return n.displayName=t||e.name,n}(W,e,(e=>(e.type=t,r?r(e):t?{...e,type:t}:e)));return n.displayName=e,n},K=Y("ListTable","list-table"),q=Y("PivotTable","pivot-table"),G=Y("PivotChart","pivot-chart");const X=(e,t,r,n)=>{const o=["id","updateId","componentId"],a=r?Object.keys(r).concat(o):o,u=e=>{const t=l.useContext(p),n=f.useRef(null),o=f.useRef(e.updateId);if(e.updateId!==o.current){o.current=e.updateId;!!r&&U(t.table,e,n.current,r)&&(n.current=e)}return l.useEffect((()=>()=>{r&&U(t.table,null,n.current,r)}),[]),null};return u.displayName=e,u.parseOption=e=>({option:k(e,a),optionName:t,isSingle:n}),u},Z=X("ListColumn","columns"),J=X("PivotColumnDimension","columns"),Q=X("PivotRowDimension","rows"),ee=X("PivotIndicator","indicators"),te=X("PivotColumnHeaderTitle","columnHeaderTitle",void 0,!0),re=X("PivotRowHeaderTitle","rowHeaderTitle",void 0,!0),ne=X("PivotCorner","corner",void 0,!0),oe=X("Menu","menu",void 0,!0),ae=X("Tooltip","tooltip",void 0,!0);function ue(e,t){return C(e)?e:"string"==typeof e&&e.endsWith("%")?Number(e.slice(0,-1))/100*t:0}e.VTable=n,e.CustomComponent=e=>{const t=l.useContext(p),{table:r}=t,n=function(e,t){const r=l.useMemo((()=>({...t})),[t]),n=l.useMemo((()=>{const t=R({},e);for(const e in r)void 0===t[e]&&(t[e]=r[e]);return t}),[e,r]);return n}(e,{style:{left:0,top:0},className:"vtable-custom-component",displayMode:"position",x:0,y:0,width:0,height:0,row:0,col:0,anchor:"top-left",dx:0,dy:0}),{displayMode:o,x:a,y:u,width:i,height:c,row:s,col:d,anchor:y,dx:m,dy:h,className:v,children:b,style:g}=n;let _,E,C,S;if("position"===o)_=a+m+"px",E=u+h+"px",C=i+"px",S=c+"px";else if("cell"===o){const e=r&&d>=0&&s>=0?r?.getCellRelativeRect(d,s):{width:0,height:0,left:-9999,top:-9999};C=ue(i,e.width)+"px",S=ue(c,e.height)+"px","top-left"===y?(_=e.left+ue(m,e.width)+"px",E=e.top+ue(h,e.height)+"px"):"top-right"===y?(_=e.left+ue(m,e.width)+e.width+"px",E=e.top+ue(h,e.height)+"px"):"bottom-left"===y?(_=e.left+ue(m,e.width)+"px",E=e.top+ue(h,e.height)+e.height+"px"):"bottom-right"===y&&(_=e.left+ue(m,e.width)+e.width+"px",E=e.top+ue(h,e.height)+e.height+"px")}const O=R({},g,{position:"absolute",zIndex:1e3,width:C,height:S,left:_,top:E});return f.createElement("div",{className:v,style:O},f.Children.map(b,(e=>e?f.cloneElement(e,{}):e)))},e.ListColumn=Z,e.ListTable=K,e.Menu=oe,e.PivotChart=G,e.PivotColumnDimension=J,e.PivotColumnHeaderTitle=te,e.PivotCorner=ne,e.PivotIndicator=ee,e.PivotRowDimension=Q,e.PivotRowHeaderTitle=re,e.PivotTable=q,e.Tooltip=ae,e.registerChartModule=function(e,t){n.register.chartModule(e,t)},e.version="0.25.6-alpha.0"}));
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC","file":"index.js","sourcesContent":["import * as VTable from '@visactor/vtable';\n\nexport * from './tables';\nexport * from './components';\nexport { VTable };\n\nexport const version = \"0.25.6-alpha.0\";\n"]}
|
package/es/tables/base-table.js
CHANGED
|
@@ -33,10 +33,15 @@ const notOptionKeys = [ ...REACT_PRIVATE_PROPS, ...TABLE_EVENTS_KEYS, "skipFunct
|
|
|
33
33
|
return null === (_a = tableContext.current) || void 0 === _a ? void 0 : _a.table;
|
|
34
34
|
}));
|
|
35
35
|
const hasOption = !!props.option, hasRecords = !!props.records, isUnmount = useRef(!1), prevOption = useRef(pickWithout(props, notOptionKeys)), optionFromChildren = useRef(null), prevRecords = useRef(props.records), eventsBinded = React.useRef(null), skipFunctionDiff = !!props.skipFunctionDiff, parseOption = useCallback((props => hasOption && props.option ? hasRecords && props.records ? Object.assign(Object.assign({}, props.option), {
|
|
36
|
+
clearDOM: !1,
|
|
36
37
|
records: props.records
|
|
37
|
-
}) :
|
|
38
|
+
}) : Object.assign(Object.assign({}, props.option), {
|
|
39
|
+
clearDOM: !1
|
|
40
|
+
}) : Object.assign(Object.assign(Object.assign({
|
|
38
41
|
records: props.records
|
|
39
|
-
}, prevOption.current), optionFromChildren.current)
|
|
42
|
+
}, prevOption.current), optionFromChildren.current), {
|
|
43
|
+
clearDOM: !1
|
|
44
|
+
})), [ hasOption, hasRecords ]), createTable = useCallback((props => {
|
|
40
45
|
let vtable;
|
|
41
46
|
vtable = "pivot-table" === props.type ? new VTable.PivotTable(props.container, parseOption(props)) : "pivot-chart" === props.type ? new VTable.PivotChart(props.container, parseOption(props)) : new VTable.ListTable(props.container, parseOption(props)),
|
|
42
47
|
tableContext.current = Object.assign(Object.assign({}, tableContext.current), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAC3C,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE7F,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,OAAO,gBAAgB,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAanD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA8BpF,MAAM,aAAa,GAAG;IACpB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E;IAC/G,MAAM,GAAG,GAAG,aAAa,CAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QACzF,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,QAAQ,EAAE;YACZ,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,IAAI,IAAI,EAAE;YACR,uCAAY,KAAK,KAAE,IAAI,IAAG;SAC3B;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","file":"base-table.js","sourcesContent":["/* eslint-disable react/display-name */\nimport * as VTable from '@visactor/vtable';\nimport React, { useState, useEffect, useRef, useImperativeHandle, useCallback } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { isEqual, isNil, pickWithout } from '@visactor/vutils';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type { IMarkElement } from '../components';\nimport type {\n EventsProps\n // LegendEventProps,\n // ScrollBarEventProps,\n // BrushEventProps,\n // DataZoomEventProps,\n // PlayerEventProps,\n // DimensionEventProps,\n // HierarchyEventProps,\n // TableLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToTable, TABLE_EVENTS_KEYS, TABLE_EVENTS } from '../eventsUtils';\n\nexport type IVTable = VTable.ListTable | VTable.PivotTable | VTable.PivotChart;\nexport type IOption =\n | VTable.ListTableConstructorOptions\n | VTable.PivotTableConstructorOptions\n | VTable.PivotChartConstructorOptions;\n\nexport interface BaseTableProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: any;\n /** 数据 */\n records?: Record<string, unknown>[];\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n skipFunctionDiff?: boolean;\n\n /** 表格渲染完成事件 */\n onReady?: (instance: IVTable, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n}\n\ntype Props = React.PropsWithChildren<BaseTableProps>;\n\nconst notOptionKeys = [\n ...REACT_PRIVATE_PROPS,\n ...TABLE_EVENTS_KEYS,\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'option',\n 'records',\n 'container'\n];\n\nconst getComponentId = (child: React.ReactNode, index: number) => {\n const componentName = child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n return `${componentName}-${index}`;\n};\n\nconst parseOptionFromChildren = (props: Props) => {\n const optionFromChildren: Omit<IOption, 'type' | 'data' | 'width' | 'height'> = {};\n\n toArray(props.children).map((child, index) => {\n const parseOption = child && (child as any).type && (child as any).type.parseOption;\n\n if (parseOption && (child as any).props) {\n const childProps = isNil((child as any).props.componentId)\n ? {\n ...(child as any).props,\n componentId: getComponentId(child, index)\n }\n : (child as any).props;\n\n const optionResult = parseOption(childProps);\n\n if (optionResult.isSingle) {\n optionFromChildren[optionResult.optionName] = optionResult.option;\n } else {\n if (!optionFromChildren[optionResult.optionName]) {\n optionFromChildren[optionResult.optionName] = [];\n }\n\n optionFromChildren[optionResult.optionName].push(optionResult.option);\n }\n }\n });\n\n return optionFromChildren;\n};\n\nconst BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const tableContext = useRef<TableContextType>({});\n useImperativeHandle(ref, () => tableContext.current?.table);\n const hasOption = !!props.option;\n const hasRecords = !!props.records;\n const isUnmount = useRef<boolean>(false);\n const prevOption = useRef(pickWithout(props, notOptionKeys));\n const optionFromChildren = useRef<Omit<IOption, 'records'>>(null);\n const prevRecords = useRef(props.records);\n const eventsBinded = React.useRef<BaseTableProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseOption = useCallback(\n (props: Props) => {\n if (hasOption && props.option) {\n if (hasRecords && props.records) {\n return {\n ...props.option,\n records: props.records\n };\n }\n return props.option;\n }\n return {\n records: props.records,\n ...prevOption.current,\n ...optionFromChildren.current\n // ...tableContext.current?.optionFromChildren\n } as IOption;\n },\n [hasOption, hasRecords]\n );\n\n const createTable = useCallback(\n (props: Props) => {\n let vtable;\n if (props.type === 'pivot-table') {\n vtable = new VTable.PivotTable(props.container, parseOption(props));\n } else if (props.type === 'pivot-chart') {\n vtable = new VTable.PivotChart(props.container, parseOption(props));\n } else {\n vtable = new VTable.ListTable(props.container, parseOption(props));\n }\n tableContext.current = { ...tableContext.current, table: vtable };\n isUnmount.current = false;\n },\n [parseOption]\n );\n\n const handleTableRender = useCallback(() => {\n if (!isUnmount.current) {\n if (!tableContext.current || !tableContext.current.table) {\n return;\n }\n // rebind events after render\n bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS);\n\n // to be fixed\n // will cause another useEffect\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(tableContext.current.table, updateId === 0);\n }\n }\n }, [updateId, setUpdateId, props]);\n\n const renderTable = useCallback(() => {\n if (tableContext.current.table) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.render();\n handleTableRender();\n }\n }, [handleTableRender]);\n\n useEffect(() => {\n const newOptionFromChildren = hasOption ? null : parseOptionFromChildren(props);\n\n if (!tableContext.current?.table) {\n if (!hasOption) {\n optionFromChildren.current = newOptionFromChildren;\n }\n\n createTable(props);\n renderTable();\n // bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS);\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n eventsBinded.current = props;\n return;\n }\n\n if (hasOption) {\n if (!isEqual(eventsBinded.current.option, props.option, { skipFunction: skipFunctionDiff })) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n tableContext.current.table.setRecords(props.records as any[]);\n handleTableRender();\n eventsBinded.current = props;\n }\n return;\n }\n\n const newOption = pickWithout(props, notOptionKeys);\n\n if (\n !isEqual(newOption, prevOption.current, { skipFunction: skipFunctionDiff }) ||\n // tableContext.current.isChildrenUpdated\n !isEqual(newOptionFromChildren, optionFromChildren.current, { skipFunction: skipFunctionDiff })\n ) {\n prevOption.current = newOption;\n optionFromChildren.current = newOptionFromChildren;\n\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n tableContext.current.table.setRecords(props.records);\n handleTableRender();\n eventsBinded.current = props;\n }\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n }, [createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props]);\n\n useEffect(() => {\n return () => {\n if (tableContext) {\n if (tableContext.current && tableContext.current.table) {\n tableContext.current.table.release();\n tableContext.current = null;\n }\n }\n eventsBinded.current = null;\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootTableContext.Provider value={tableContext.current}>\n {toArray(props.children).map((child: React.ReactNode, index: number) => {\n if (typeof child === 'string') {\n return;\n }\n\n const childId = getComponentId(child, index);\n\n // const componentName =\n // child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n // const childId = `${componentName}-${index}`;\n\n return (\n // <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n // {React.cloneElement(child as IMarkElement, {\n // updateId: updateId\n // })}\n // </React.Fragment>\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId\n })}\n </React.Fragment>\n );\n })}\n </RootTableContext.Provider>\n );\n});\n\nexport const createTable = <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => {\n const Com = withContainer<ContainerProps, T>(BaseTable as any, componentName, (props: T) => {\n props.type = type;\n\n if (callback) {\n return callback(props);\n }\n\n if (type) {\n return { ...props, type };\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAC3C,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE7F,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,OAAO,gBAAgB,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAanD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AA8BpF,MAAM,aAAa,GAAG;IACpB,GAAG,mBAAmB;IACtB,GAAG,iBAAiB;IACpB,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,WAAW;CACZ,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAsB,EAAE,KAAa,EAAE,EAAE;IAC/D,MAAM,aAAa,GAAG,KAAK,IAAK,KAAa,CAAC,IAAI,IAAI,CAAE,KAAa,CAAC,IAAI,CAAC,WAAW,IAAK,KAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpH,OAAO,GAAG,aAAa,IAAI,KAAK,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,KAAY,EAAE,EAAE;IAC/C,MAAM,kBAAkB,GAAwD,EAAE,CAAC;IAEnF,OAAO,CAAC,KAAK,CA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nimport * as VTable from '@visactor/vtable';\nimport React, { useState, useEffect, useRef, useImperativeHandle, useCallback } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { isEqual, isNil, pickWithout } from '@visactor/vutils';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type { IMarkElement } from '../components';\nimport type {\n EventsProps\n // LegendEventProps,\n // ScrollBarEventProps,\n // BrushEventProps,\n // DataZoomEventProps,\n // PlayerEventProps,\n // DimensionEventProps,\n // HierarchyEventProps,\n // TableLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToTable, TABLE_EVENTS_KEYS, TABLE_EVENTS } from '../eventsUtils';\n\nexport type IVTable = VTable.ListTable | VTable.PivotTable | VTable.PivotChart;\nexport type IOption =\n | VTable.ListTableConstructorOptions\n | VTable.PivotTableConstructorOptions\n | VTable.PivotChartConstructorOptions;\n\nexport interface BaseTableProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: any;\n /** 数据 */\n records?: Record<string, unknown>[];\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n skipFunctionDiff?: boolean;\n\n /** 表格渲染完成事件 */\n onReady?: (instance: IVTable, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n}\n\ntype Props = React.PropsWithChildren<BaseTableProps>;\n\nconst notOptionKeys = [\n ...REACT_PRIVATE_PROPS,\n ...TABLE_EVENTS_KEYS,\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'option',\n 'records',\n 'container'\n];\n\nconst getComponentId = (child: React.ReactNode, index: number) => {\n const componentName = child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n return `${componentName}-${index}`;\n};\n\nconst parseOptionFromChildren = (props: Props) => {\n const optionFromChildren: Omit<IOption, 'type' | 'data' | 'width' | 'height'> = {};\n\n toArray(props.children).map((child, index) => {\n const parseOption = child && (child as any).type && (child as any).type.parseOption;\n\n if (parseOption && (child as any).props) {\n const childProps = isNil((child as any).props.componentId)\n ? {\n ...(child as any).props,\n componentId: getComponentId(child, index)\n }\n : (child as any).props;\n\n const optionResult = parseOption(childProps);\n\n if (optionResult.isSingle) {\n optionFromChildren[optionResult.optionName] = optionResult.option;\n } else {\n if (!optionFromChildren[optionResult.optionName]) {\n optionFromChildren[optionResult.optionName] = [];\n }\n\n optionFromChildren[optionResult.optionName].push(optionResult.option);\n }\n }\n });\n\n return optionFromChildren;\n};\n\nconst BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const tableContext = useRef<TableContextType>({});\n useImperativeHandle(ref, () => tableContext.current?.table);\n const hasOption = !!props.option;\n const hasRecords = !!props.records;\n const isUnmount = useRef<boolean>(false);\n const prevOption = useRef(pickWithout(props, notOptionKeys));\n const optionFromChildren = useRef<Omit<IOption, 'records'>>(null);\n const prevRecords = useRef(props.records);\n const eventsBinded = React.useRef<BaseTableProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseOption = useCallback(\n (props: Props) => {\n if (hasOption && props.option) {\n if (hasRecords && props.records) {\n return {\n ...props.option,\n clearDOM: false,\n records: props.records\n };\n }\n return {\n ...props.option,\n clearDOM: false\n };\n }\n return {\n records: props.records,\n ...prevOption.current,\n ...optionFromChildren.current,\n clearDOM: false\n // ...tableContext.current?.optionFromChildren\n } as IOption;\n },\n [hasOption, hasRecords]\n );\n\n const createTable = useCallback(\n (props: Props) => {\n let vtable;\n if (props.type === 'pivot-table') {\n vtable = new VTable.PivotTable(props.container, parseOption(props));\n } else if (props.type === 'pivot-chart') {\n vtable = new VTable.PivotChart(props.container, parseOption(props));\n } else {\n vtable = new VTable.ListTable(props.container, parseOption(props));\n }\n tableContext.current = { ...tableContext.current, table: vtable };\n isUnmount.current = false;\n },\n [parseOption]\n );\n\n const handleTableRender = useCallback(() => {\n if (!isUnmount.current) {\n if (!tableContext.current || !tableContext.current.table) {\n return;\n }\n // rebind events after render\n bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS);\n\n // to be fixed\n // will cause another useEffect\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(tableContext.current.table, updateId === 0);\n }\n }\n }, [updateId, setUpdateId, props]);\n\n const renderTable = useCallback(() => {\n if (tableContext.current.table) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.render();\n handleTableRender();\n }\n }, [handleTableRender]);\n\n useEffect(() => {\n const newOptionFromChildren = hasOption ? null : parseOptionFromChildren(props);\n\n if (!tableContext.current?.table) {\n if (!hasOption) {\n optionFromChildren.current = newOptionFromChildren;\n }\n\n createTable(props);\n renderTable();\n // bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS);\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n eventsBinded.current = props;\n return;\n }\n\n if (hasOption) {\n if (!isEqual(eventsBinded.current.option, props.option, { skipFunction: skipFunctionDiff })) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n tableContext.current.table.setRecords(props.records as any[]);\n handleTableRender();\n eventsBinded.current = props;\n }\n return;\n }\n\n const newOption = pickWithout(props, notOptionKeys);\n\n if (\n !isEqual(newOption, prevOption.current, { skipFunction: skipFunctionDiff }) ||\n // tableContext.current.isChildrenUpdated\n !isEqual(newOptionFromChildren, optionFromChildren.current, { skipFunction: skipFunctionDiff })\n ) {\n prevOption.current = newOption;\n optionFromChildren.current = newOptionFromChildren;\n\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n tableContext.current.table.setRecords(props.records);\n handleTableRender();\n eventsBinded.current = props;\n }\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n }, [createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props]);\n\n useEffect(() => {\n return () => {\n if (tableContext) {\n if (tableContext.current && tableContext.current.table) {\n tableContext.current.table.release();\n tableContext.current = null;\n }\n }\n eventsBinded.current = null;\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootTableContext.Provider value={tableContext.current}>\n {toArray(props.children).map((child: React.ReactNode, index: number) => {\n if (typeof child === 'string') {\n return;\n }\n\n const childId = getComponentId(child, index);\n\n // const componentName =\n // child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n // const childId = `${componentName}-${index}`;\n\n return (\n // <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n // {React.cloneElement(child as IMarkElement, {\n // updateId: updateId\n // })}\n // </React.Fragment>\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId\n })}\n </React.Fragment>\n );\n })}\n </RootTableContext.Provider>\n );\n});\n\nexport const createTable = <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => {\n const Com = withContainer<ContainerProps, T>(BaseTable as any, componentName, (props: T) => {\n props.type = type;\n\n if (callback) {\n return callback(props);\n }\n\n if (type) {\n return { ...props, type };\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/react-vtable",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.6-alpha.0",
|
|
4
4
|
"description": "The react version of VTable",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
+
"@visactor/vtable": "0.25.6-alpha.0",
|
|
46
47
|
"@visactor/vutils": "~0.18.1",
|
|
47
|
-
"react-is": "^18.2.0"
|
|
48
|
-
"@visactor/vtable": "0.25.4"
|
|
48
|
+
"react-is": "^18.2.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@visactor/vchart": "1.10.5",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"axios": "^1.4.0",
|
|
90
90
|
"@types/react-is": "^17.0.3",
|
|
91
91
|
"@arco-design/web-react": "2.60.2",
|
|
92
|
+
"@internal/eslint-config": "0.0.1",
|
|
92
93
|
"@internal/bundler": "0.0.1",
|
|
93
|
-
"@internal/ts-config": "0.0.1"
|
|
94
|
-
"@internal/eslint-config": "0.0.1"
|
|
94
|
+
"@internal/ts-config": "0.0.1"
|
|
95
95
|
},
|
|
96
96
|
"scripts": {
|
|
97
97
|
"start": "vite ./demo",
|