@visactor/react-vtable 0.23.2-alpha.0 → 0.23.3
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/eventsUtils.d.ts +2 -0
- package/cjs/eventsUtils.js +1 -0
- package/cjs/eventsUtils.js.map +1 -1
- 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 +6 -5
- package/cjs/tables/base-table.js.map +1 -1
- package/dist/react-vtable.js +6 -3
- package/dist/react-vtable.min.js +2 -2
- package/es/eventsUtils.d.ts +2 -0
- package/es/eventsUtils.js +1 -0
- package/es/eventsUtils.js.map +1 -1
- 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 +6 -5
- package/es/tables/base-table.js.map +1 -1
- package/package.json +7 -4
package/cjs/eventsUtils.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface EventsProps {
|
|
|
10
10
|
onKeyDown?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['keydown']>;
|
|
11
11
|
onMouseEnterTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_table']>;
|
|
12
12
|
onMouseLeaveTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_table']>;
|
|
13
|
+
onMouseDownTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_table']>;
|
|
13
14
|
onMouseMoveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousemove_cell']>;
|
|
14
15
|
onMouseEnterCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_cell']>;
|
|
15
16
|
onMouseLeaveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_cell']>;
|
|
@@ -57,6 +58,7 @@ export declare const TABLE_EVENTS: {
|
|
|
57
58
|
onKeyDown: "keydown";
|
|
58
59
|
onMouseEnterTable: "mouseenter_table";
|
|
59
60
|
onMouseLeaveTable: "mouseleave_table";
|
|
61
|
+
onMouseDownTable: "mouseleave_table";
|
|
60
62
|
onMouseMoveCell: "mousemove_cell";
|
|
61
63
|
onMouseEnterCell: "mouseenter_cell";
|
|
62
64
|
onMouseLeaveCell: "mouseleave_cell";
|
package/cjs/eventsUtils.js
CHANGED
|
@@ -15,6 +15,7 @@ exports.TABLE_EVENTS = {
|
|
|
15
15
|
onKeyDown: EVENT_TYPE.KEYDOWN,
|
|
16
16
|
onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,
|
|
17
17
|
onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,
|
|
18
|
+
onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,
|
|
18
19
|
onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,
|
|
19
20
|
onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,
|
|
20
21
|
onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,
|
package/cjs/eventsUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":";;;AAAA,6CAAqE;AAMrE,MAAM,UAAU,iDACX,kBAAS,CAAC,UAAU,GACpB,mBAAU,CAAC,UAAU,GACrB,mBAAU,CAAC,UAAU,CACzB,CAAC;AAgEW,QAAA,YAAY,GAAG;IAC1B,WAAW,EAAE,UAAU,CAAC,UAAU;IAClC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,aAAa,EAAE,UAAU,CAAC,YAAY;IACtC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,SAAS,EAAE,UAAU,CAAC,OAAO;IAC7B,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,gBAA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,CAAC,EAAE;YAC7C,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,KAAK,cAAc,CAAC,QAAQ,CAAC,EAAE;gBACtG,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC3D;QACH,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5C,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE;gBACxG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAmD,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAChH;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA9BW,QAAA,iBAAiB,qBA8B5B","file":"eventsUtils.js","sourcesContent":["import { ListTable, PivotTable, PivotChart } from '@visactor/vtable';\nimport type { IVTable } from './tables/base-table';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type EventCallback<Params> = (params: Params) => void;\n\nconst EVENT_TYPE = {\n ...ListTable.EVENT_TYPE,\n ...PivotTable.EVENT_TYPE,\n ...PivotChart.EVENT_TYPE\n};\n\nexport interface EventsProps {\n onClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['click_cell']>;\n onDblClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_cell']>;\n onMouseDownCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_cell']>;\n onMouseUpCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseup_cell']>;\n onSelectedCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['selected_cell']>;\n onKeyDown?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['keydown']>;\n onMouseEnterTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_table']>;\n onMouseLeaveTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_table']>;\n onMouseMoveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousemove_cell']>;\n onMouseEnterCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_cell']>;\n onMouseLeaveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_cell']>;\n onContextMenuCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['contextmenu_cell']>;\n onResizeColumn?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column']>;\n onResizeColumnEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column_end']>;\n onChangeHeaderPosition?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_header_position']>;\n onSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['sort_click']>;\n onFreezeClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['freeze_click']>;\n onScroll?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll']>;\n onDropdownMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_click']>;\n onMouseOverChartSymbol?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseover_chart_symbol']>;\n onDragSelectEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_select_end']>;\n\n onDropdownIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_icon_click']>;\n onDropdownMenuClear?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_clear']>;\n\n onTreeHierarchyStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['tree_hierarchy_state_change']>;\n\n onShowMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['show_menu']>;\n onHideMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['hide_menu']>;\n\n onIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['icon_click']>;\n\n onLegendItemClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_click']>;\n onLegendItemHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_hover']>;\n onLegendItemUnHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_unHover']>;\n onLegendChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_change']>;\n\n onMouseEnterAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_axis']>;\n onMouseLeaveAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_axis']>;\n\n onCheckboxStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['checkbox_state_change']>;\n onAfterRender?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['after_render']>;\n onInitialized?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['initialized']>;\n\n // pivot table only\n onPivotSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['pivot_sort_click']>;\n onDrillMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drillmenu_click']>;\n\n // pivot chart only\n onVChartEventType?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['vchart_event_type']>;\n\n onChangCellValue?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_cell_value']>;\n\n onMousedownFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_fill_handle']>;\n onDragFillHandleEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_fill_handle_end']>;\n onDblclickFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_fill_handle']>;\n\n onScrollVerticalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_vertical_end']>;\n onScrollHorizontalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_horizontal_end']>;\n}\n\nexport const TABLE_EVENTS = {\n onClickCell: EVENT_TYPE.CLICK_CELL,\n onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,\n onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,\n onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,\n onSelectedCell: EVENT_TYPE.SELECTED_CELL,\n onKeyDown: EVENT_TYPE.KEYDOWN,\n onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,\n onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,\n onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,\n onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,\n onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,\n onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,\n onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,\n onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,\n onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,\n onSortClick: EVENT_TYPE.SORT_CLICK,\n onFreezeClick: EVENT_TYPE.FREEZE_CLICK,\n onScroll: EVENT_TYPE.SCROLL,\n onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,\n onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,\n onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,\n\n onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,\n onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,\n\n onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,\n\n onShowMenu: EVENT_TYPE.SHOW_MENU,\n onHideMenu: EVENT_TYPE.HIDE_MENU,\n\n onIconClick: EVENT_TYPE.ICON_CLICK,\n\n onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,\n onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,\n onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,\n onLegendChange: EVENT_TYPE.LEGEND_CHANGE,\n\n onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,\n onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,\n\n onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,\n onAfterRender: EVENT_TYPE.AFTER_RENDER,\n onInitialized: EVENT_TYPE.INITIALIZED,\n\n // pivot table only\n onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,\n onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,\n\n // pivot chart only\n onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,\n\n onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,\n onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,\n onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,\n onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,\n onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,\n onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END\n};\n\nexport const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key] && props[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToTable = <T>(\n table: IVTable,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n) => {\n if ((!newProps && !prevProps) || !table) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n table.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n table.on(supportedEvents[eventKey] as keyof TYPES.TableEventHandlersEventArgumentMap, newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":";;;AAAA,6CAAqE;AAMrE,MAAM,UAAU,iDACX,kBAAS,CAAC,UAAU,GACpB,mBAAU,CAAC,UAAU,GACrB,mBAAU,CAAC,UAAU,CACzB,CAAC;AAiEW,QAAA,YAAY,GAAG;IAC1B,WAAW,EAAE,UAAU,CAAC,UAAU;IAClC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,aAAa,EAAE,UAAU,CAAC,YAAY;IACtC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,SAAS,EAAE,UAAU,CAAC,OAAO;IAC7B,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,gBAAgB,EAAE,UAAU,CAAC,eAAe;IAC5C,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,gBAAgB,EAAE,UAAU,CAAC,eAAe;IAC5C,gBAAgB,EAAE,UAAU,CAAC,eAAe;IAC5C,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;IAC/C,sBAAsB,EAAE,UAAU,CAAC,sBAAsB;IACzD,WAAW,EAAE,UAAU,CAAC,UAAU;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AC,CAAC;KACJ;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5C,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE;gBACxG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAmD,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAChH;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA9BW,QAAA,iBAAiB,qBA8B5B","file":"eventsUtils.js","sourcesContent":["import { ListTable, PivotTable, PivotChart } from '@visactor/vtable';\nimport type { IVTable } from './tables/base-table';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type EventCallback<Params> = (params: Params) => void;\n\nconst EVENT_TYPE = {\n ...ListTable.EVENT_TYPE,\n ...PivotTable.EVENT_TYPE,\n ...PivotChart.EVENT_TYPE\n};\n\nexport interface EventsProps {\n onClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['click_cell']>;\n onDblClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_cell']>;\n onMouseDownCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_cell']>;\n onMouseUpCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseup_cell']>;\n onSelectedCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['selected_cell']>;\n onKeyDown?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['keydown']>;\n onMouseEnterTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_table']>;\n onMouseLeaveTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_table']>;\n onMouseDownTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_table']>;\n onMouseMoveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousemove_cell']>;\n onMouseEnterCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_cell']>;\n onMouseLeaveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_cell']>;\n onContextMenuCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['contextmenu_cell']>;\n onResizeColumn?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column']>;\n onResizeColumnEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column_end']>;\n onChangeHeaderPosition?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_header_position']>;\n onSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['sort_click']>;\n onFreezeClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['freeze_click']>;\n onScroll?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll']>;\n onDropdownMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_click']>;\n onMouseOverChartSymbol?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseover_chart_symbol']>;\n onDragSelectEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_select_end']>;\n\n onDropdownIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_icon_click']>;\n onDropdownMenuClear?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_clear']>;\n\n onTreeHierarchyStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['tree_hierarchy_state_change']>;\n\n onShowMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['show_menu']>;\n onHideMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['hide_menu']>;\n\n onIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['icon_click']>;\n\n onLegendItemClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_click']>;\n onLegendItemHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_hover']>;\n onLegendItemUnHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_unHover']>;\n onLegendChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_change']>;\n\n onMouseEnterAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_axis']>;\n onMouseLeaveAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_axis']>;\n\n onCheckboxStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['checkbox_state_change']>;\n onAfterRender?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['after_render']>;\n onInitialized?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['initialized']>;\n\n // pivot table only\n onPivotSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['pivot_sort_click']>;\n onDrillMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drillmenu_click']>;\n\n // pivot chart only\n onVChartEventType?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['vchart_event_type']>;\n\n onChangCellValue?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_cell_value']>;\n\n onMousedownFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_fill_handle']>;\n onDragFillHandleEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_fill_handle_end']>;\n onDblclickFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_fill_handle']>;\n\n onScrollVerticalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_vertical_end']>;\n onScrollHorizontalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_horizontal_end']>;\n}\n\nexport const TABLE_EVENTS = {\n onClickCell: EVENT_TYPE.CLICK_CELL,\n onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,\n onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,\n onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,\n onSelectedCell: EVENT_TYPE.SELECTED_CELL,\n onKeyDown: EVENT_TYPE.KEYDOWN,\n onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,\n onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,\n onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,\n onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,\n onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,\n onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,\n onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,\n onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,\n onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,\n onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,\n onSortClick: EVENT_TYPE.SORT_CLICK,\n onFreezeClick: EVENT_TYPE.FREEZE_CLICK,\n onScroll: EVENT_TYPE.SCROLL,\n onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,\n onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,\n onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,\n\n onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,\n onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,\n\n onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,\n\n onShowMenu: EVENT_TYPE.SHOW_MENU,\n onHideMenu: EVENT_TYPE.HIDE_MENU,\n\n onIconClick: EVENT_TYPE.ICON_CLICK,\n\n onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,\n onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,\n onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,\n onLegendChange: EVENT_TYPE.LEGEND_CHANGE,\n\n onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,\n onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,\n\n onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,\n onAfterRender: EVENT_TYPE.AFTER_RENDER,\n onInitialized: EVENT_TYPE.INITIALIZED,\n\n // pivot table only\n onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,\n onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,\n\n // pivot chart only\n onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,\n\n onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,\n onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,\n onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,\n onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,\n onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,\n onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END\n};\n\nexport const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key] && props[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToTable = <T>(\n table: IVTable,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n) => {\n if ((!newProps && !prevProps) || !table) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n table.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n table.on(supportedEvents[eventKey] as keyof TYPES.TableEventHandlersEventArgumentMap, newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
|
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -34,5 +34,5 @@ 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.23.
|
|
37
|
+
exports.version = "0.23.3";
|
|
38
38
|
//# sourceMappingURL=index.js.map
|
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,QAAQ,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.23.3\";\n"]}
|
package/cjs/tables/base-table.js
CHANGED
|
@@ -83,9 +83,9 @@ const VTable = __importStar(require("@visactor/vtable")), react_1 = __importStar
|
|
|
83
83
|
skipFunction: skipFunctionDiff
|
|
84
84
|
}) ? hasRecords && !(0, vutils_1.isEqual)(eventsBinded.current.records, props.records, {
|
|
85
85
|
skipFunction: skipFunctionDiff
|
|
86
|
-
}) && (
|
|
87
|
-
|
|
88
|
-
handleTableRender()));
|
|
86
|
+
}) && (tableContext.current.table.setRecords(props.records), handleTableRender(),
|
|
87
|
+
eventsBinded.current = props) : (tableContext.current.table.updateOption(parseOption(props)),
|
|
88
|
+
handleTableRender(), eventsBinded.current = props));
|
|
89
89
|
const newOption = (0, vutils_1.pickWithout)(props, notOptionKeys);
|
|
90
90
|
(0, vutils_1.isEqual)(newOption, prevOption.current, {
|
|
91
91
|
skipFunction: skipFunctionDiff
|
|
@@ -94,8 +94,9 @@ const VTable = __importStar(require("@visactor/vtable")), react_1 = __importStar
|
|
|
94
94
|
}) ? hasRecords && !(0, vutils_1.isEqual)(props.records, prevRecords.current, {
|
|
95
95
|
skipFunction: skipFunctionDiff
|
|
96
96
|
}) && (prevRecords.current = props.records, tableContext.current.table.setRecords(props.records),
|
|
97
|
-
handleTableRender()) : (prevOption.current = newOption,
|
|
98
|
-
tableContext.current.table.updateOption(parseOption(props)),
|
|
97
|
+
handleTableRender(), eventsBinded.current = props) : (prevOption.current = newOption,
|
|
98
|
+
optionFromChildren.current = newOptionFromChildren, tableContext.current.table.updateOption(parseOption(props)),
|
|
99
|
+
handleTableRender(), eventsBinded.current = props);
|
|
99
100
|
}), [ createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props ]),
|
|
100
101
|
(0, react_1.useEffect)((() => () => {
|
|
101
102
|
tableContext && tableContext.current && tableContext.current.table && (tableContext.current.table.release(),
|
|
@@ -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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,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 eventsBinded.current = props;\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n eventsBinded.current = props;\n tableContext.current.table.setRecords(props.records as any[]);\n handleTableRender();\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 } 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 }\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,KAAK,CAAC,WAAW,CAAC;gBACxD,CAAC,iCACO,KAAa,CAAC,KAAK,KACvB,WAAW,EA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,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 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"]}
|
package/dist/react-vtable.js
CHANGED
|
@@ -3274,6 +3274,7 @@
|
|
|
3274
3274
|
onKeyDown: EVENT_TYPE.KEYDOWN,
|
|
3275
3275
|
onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,
|
|
3276
3276
|
onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,
|
|
3277
|
+
onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,
|
|
3277
3278
|
onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,
|
|
3278
3279
|
onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,
|
|
3279
3280
|
onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,
|
|
@@ -3457,15 +3458,15 @@
|
|
|
3457
3458
|
}
|
|
3458
3459
|
if (hasOption) {
|
|
3459
3460
|
if (!isEqual(eventsBinded.current.option, props.option, { skipFunction: skipFunctionDiff })) {
|
|
3460
|
-
eventsBinded.current = props;
|
|
3461
3461
|
tableContext.current.table.updateOption(parseOption(props));
|
|
3462
3462
|
handleTableRender();
|
|
3463
|
+
eventsBinded.current = props;
|
|
3463
3464
|
}
|
|
3464
3465
|
else if (hasRecords &&
|
|
3465
3466
|
!isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })) {
|
|
3466
|
-
eventsBinded.current = props;
|
|
3467
3467
|
tableContext.current.table.setRecords(props.records);
|
|
3468
3468
|
handleTableRender();
|
|
3469
|
+
eventsBinded.current = props;
|
|
3469
3470
|
}
|
|
3470
3471
|
return;
|
|
3471
3472
|
}
|
|
@@ -3476,11 +3477,13 @@
|
|
|
3476
3477
|
optionFromChildren.current = newOptionFromChildren;
|
|
3477
3478
|
tableContext.current.table.updateOption(parseOption(props));
|
|
3478
3479
|
handleTableRender();
|
|
3480
|
+
eventsBinded.current = props;
|
|
3479
3481
|
}
|
|
3480
3482
|
else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {
|
|
3481
3483
|
prevRecords.current = props.records;
|
|
3482
3484
|
tableContext.current.table.setRecords(props.records);
|
|
3483
3485
|
handleTableRender();
|
|
3486
|
+
eventsBinded.current = props;
|
|
3484
3487
|
}
|
|
3485
3488
|
}, [createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props]);
|
|
3486
3489
|
reactExports.useEffect(() => {
|
|
@@ -3583,7 +3586,7 @@
|
|
|
3583
3586
|
|
|
3584
3587
|
const Tooltip = createComponent('Tooltip', 'tooltip', undefined, true);
|
|
3585
3588
|
|
|
3586
|
-
const version = "0.23.
|
|
3589
|
+
const version = "0.23.3";
|
|
3587
3590
|
|
|
3588
3591
|
exports.VTable = VTable__namespace;
|
|
3589
3592
|
exports.ListColumn = ListColumn;
|
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,v={};function h(e,t,r){this.props=e,this.context=t,this.refs=v,this.updater=r||y}function b(){}function _(e,t,r){this.props=e,this.context=t,this.refs=v,this.updater=r||y}h.prototype.isReactComponent={},h.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")},h.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=h.prototype;var g=_.prototype=new b;g.constructor=_,m(g,h.prototype),g.isPureReactComponent=!0;var E=Array.isArray,C=Object.prototype.hasOwnProperty,S={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function R(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 w(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&&(w(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 j(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 N={current:null},$={transition:null},I={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:$,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(!w(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},i.Component=h,i.Fragment=r,i.Profiler=o,i.PureComponent=_,i.StrictMode=n,i.Suspense=l,i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,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=R,i.createFactory=function(e){var t=R.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=w,i.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:j}},i.memo=function(e,t){return{$$typeof:f,type:e,compare:void 0===t?null:t}},i.startTransition=function(e){var t=$.transition;$.transition={};try{e()}finally{$.transition=t}},i.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},i.useCallback=function(e,t){return N.current.useCallback(e,t)},i.useContext=function(e){return N.current.useContext(e)},i.useDebugValue=function(){},i.useDeferredValue=function(e){return N.current.useDeferredValue(e)},i.useEffect=function(e,t){return N.current.useEffect(e,t)},i.useId=function(){return N.current.useId()},i.useImperativeHandle=function(e,t,r){return N.current.useImperativeHandle(e,t,r)},i.useInsertionEffect=function(e,t){return N.current.useInsertionEffect(e,t)},i.useLayoutEffect=function(e,t){return N.current.useLayoutEffect(e,t)},i.useMemo=function(e,t){return N.current.useMemo(e,t)},i.useReducer=function(e,t,r){return N.current.useReducer(e,t,r)},i.useRef=function(e){return N.current.useRef(e)},i.useState=function(e){return N.current.useState(e)},i.useSyncExternalStore=function(e,t,r){return N.current.useSyncExternalStore(e,t,r)},i.useTransition=function(){return N.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,v="@@iterator";function h(e){if(null===e||"object"!=typeof e)return null;var t=m&&e[m]||e[v];return"function"==typeof t?t:null}var b={current:null},_={transition:null},g={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 R=!1,w=!1,k=!1,L=!1,T=!1,P={ReactCurrentDispatcher:b,ReactCurrentBatchConfig:_,ReactCurrentOwner:E};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];$("warn",e,r)}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];$("error",e,r)}function $(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=g;var I={};function D(e,t){var r=e.constructor,n=r&&(r.displayName||r.name)||"ReactClass",o=n+"."+t;I[o]||(N("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),I[o]=!0)}var M={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,r){D(e,"forceUpdate")},enqueueReplaceState:function(e,t,r,n){D(e,"replaceState")},enqueueSetState:function(e,t,r,n){D(e,"setState")}},x=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(){j("%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 Y=B.prototype=new z;Y.constructor=B,x(Y,F.prototype),Y.isPureReactComponent=!0;var K=Array.isArray;function W(e){return K(e)}function q(e){return""+e}function G(e){if(function(e){try{return q(e),!1}catch(e){return!0}}(e))return N("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&&N("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]||(N('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,N("%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,N("%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=x({},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(W(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 v=0,b=""===a?se:a+le;if(W(e))for(var _=0;_<e.length;_++)v+=me(l=e[_],t,o,b+ye(l,_),u);else{var g=h(e);if("function"==typeof g){var E=e;g===E.entries&&(fe||j("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),fe=!0);for(var C,S=g.call(E),O=0;!(C=S.next()).done;)v+=me(l=C.value,t,o,b+ye(l,O++),u)}else if("object"===i){var R=String(e);throw new Error("Objects are not valid as a React child (found: "+("[object Object]"===R?"object with keys {"+Object.keys(e).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}}return v}function ve(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 he,be=-1,_e=0,ge=1,Ee=2;function Ce(e){if(e._status===be){var t=(0,e._result)();if(t.then((function(t){if(e._status===_e||e._status===be){var r=e;r._status=ge,r._result=t}}),(function(t){if(e._status===_e||e._status===be){var r=e;r._status=Ee,r._result=t}})),e._status===be){var r=e;r._status=_e,r._result=t}}if(e._status===ge){var n=e._result;return void 0===n&&N("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||N("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||R||w||k)||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===p||e.$$typeof===i||e.$$typeof===c||e.$$typeof===s||e.$$typeof===he||void 0!==e.getModuleId)}function Oe(){var e=b.current;return null===e&&N("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}he=Symbol.for("react.module.reference");var Re,we,ke,Le,Te,Pe,je,Ne=0;function $e(){}$e.__reactDisabledLog=!0;var Ie,De=P.ReactCurrentDispatcher;function Me(e,t,r){if(void 0===Ie)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);Ie=n&&n[1]||""}return"\n"+Ie+e}var xe,Ae=!1,Fe="function"==typeof WeakMap?WeakMap:Map;function Ve(e,t){if(!e||Ae)return"";var r,n=xe.get(e);if(void 0!==n)return n;Ae=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=De.current,De.current=null,function(){if(0===Ne){Re=console.log,we=console.info,ke=console.warn,Le=console.error,Te=console.group,Pe=console.groupCollapsed,je=console.groupEnd;var e={configurable:!0,enumerable:!0,value:$e,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Ne++}();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&&xe.set(e,f),f}}while(s>=1&&l>=0);break}}}finally{Ae=!1,De.current=o,function(){if(0==--Ne){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:x({},e,{value:Re}),info:x({},e,{value:we}),warn:x({},e,{value:ke}),error:x({},e,{value:Le}),group:x({},e,{value:Te}),groupCollapsed:x({},e,{value:Pe}),groupEnd:x({},e,{value:je})})}Ne<0&&N("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&&xe.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""}xe=new Fe;var Ue,ze={},Be=P.ReactDebugCurrentFrame;function Ye(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 Ke(e){if(e){var t=e._owner;O(He(e.type,e._source,t?t.type:null))}else O(null)}function We(){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=We();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)+"."),Ke(e),N('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),Ke(null)}}}function Xe(e,t){if("object"==typeof e)if(W(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=h(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||(Ye(o),N("%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),Ye(null)),i instanceof Error&&!(i.message in ze)&&(ze[i.message]=!0,Ye(o),N("Failed %s type: %s",r,i.message),Ye(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||Ue||(Ue=!0,N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Z(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||N("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+".":"")||We(),null===e?c="null":W(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,N("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){Ke(e),N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),Ke(null);break}}null!==e.ref&&(Ke(e),N("Invalid attribute `ref` supplied to `React.Fragment`."),Ke(null))}(l):Ze(l),l}var Qe=!1,et=!1,tt=null,rt=0,nt=!1;function ot(e){e!==rt-1&&N("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=g.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&&N("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?(g.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,j("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 j("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},ft={map:ve,forEach:function(e,t,r){ve(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return ve(e,(function(){t++})),t},toArray:function(e){return ve(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,N("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,N("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||(j("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?N("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?N("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&N("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||N("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){N("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){N("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)||N("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=_.transition;_.transition={};var n=_.transition;_.transition._updatedFibers=new Set;try{e()}finally{_.transition=r,null===r&&n._updatedFibers&&(n._updatedFibers.size>10&&j("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===g.current&&(g.current=[]);var r,n=g.isBatchingLegacy;try{if(g.isBatchingLegacy=!0,r=e(),!n&&g.didScheduleLegacyUpdate){var o=g.current;null!==o&&(g.didScheduleLegacyUpdate=!1,it(o))}}catch(e){throw ot(t),e}finally{g.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,N("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=g.current;return null!==s&&(it(s),g.current=null),{then:function(e,t){null===g.current?(g.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?N("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&&N("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 v=e=>"object"==typeof e&&null!==e;var h=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 b=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");function g(e,t){if(!e||!h(e))return e;const r={};return Object.keys(e).forEach((n=>{const o=e[n];let a=!1;t.forEach((e=>{(b(e)&&e===n||e instanceof RegExp&&n.match(e))&&(a=!0)})),a||(r[n]=o)})),r}function E(e){return Object.prototype.toString.call(e)}function C(e){return Object.keys(e)}function S(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(E(e)!==E(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(!S(e[n],t[n],r))return!1;return!0}if(!h(e))return!1;const n=C(e),o=C(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(!S(e[a],t[a],r))return!1}return!0}var O,R={exports:{}},w={};var k,L={};
|
|
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,v={};function h(e,t,r){this.props=e,this.context=t,this.refs=v,this.updater=r||y}function b(){}function _(e,t,r){this.props=e,this.context=t,this.refs=v,this.updater=r||y}h.prototype.isReactComponent={},h.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")},h.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=h.prototype;var g=_.prototype=new b;g.constructor=_,m(g,h.prototype),g.isPureReactComponent=!0;var E=Array.isArray,C=Object.prototype.hasOwnProperty,S={current:null},O={key:!0,ref:!0,__self:!0,__source:!0};function R(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 w(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&&(w(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 j(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 N={current:null},$={transition:null},I={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:$,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(!w(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},i.Component=h,i.Fragment=r,i.Profiler=o,i.PureComponent=_,i.StrictMode=n,i.Suspense=l,i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,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=R,i.createFactory=function(e){var t=R.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=w,i.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:j}},i.memo=function(e,t){return{$$typeof:f,type:e,compare:void 0===t?null:t}},i.startTransition=function(e){var t=$.transition;$.transition={};try{e()}finally{$.transition=t}},i.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},i.useCallback=function(e,t){return N.current.useCallback(e,t)},i.useContext=function(e){return N.current.useContext(e)},i.useDebugValue=function(){},i.useDeferredValue=function(e){return N.current.useDeferredValue(e)},i.useEffect=function(e,t){return N.current.useEffect(e,t)},i.useId=function(){return N.current.useId()},i.useImperativeHandle=function(e,t,r){return N.current.useImperativeHandle(e,t,r)},i.useInsertionEffect=function(e,t){return N.current.useInsertionEffect(e,t)},i.useLayoutEffect=function(e,t){return N.current.useLayoutEffect(e,t)},i.useMemo=function(e,t){return N.current.useMemo(e,t)},i.useReducer=function(e,t,r){return N.current.useReducer(e,t,r)},i.useRef=function(e){return N.current.useRef(e)},i.useState=function(e){return N.current.useState(e)},i.useSyncExternalStore=function(e,t,r){return N.current.useSyncExternalStore(e,t,r)},i.useTransition=function(){return N.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,v="@@iterator";function h(e){if(null===e||"object"!=typeof e)return null;var t=m&&e[m]||e[v];return"function"==typeof t?t:null}var b={current:null},_={transition:null},g={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 R=!1,w=!1,k=!1,L=!1,T=!1,P={ReactCurrentDispatcher:b,ReactCurrentBatchConfig:_,ReactCurrentOwner:E};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];$("warn",e,r)}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];$("error",e,r)}function $(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=g;var I={};function D(e,t){var r=e.constructor,n=r&&(r.displayName||r.name)||"ReactClass",o=n+"."+t;I[o]||(N("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),I[o]=!0)}var M={isMounted:function(e){return!1},enqueueForceUpdate:function(e,t,r){D(e,"forceUpdate")},enqueueReplaceState:function(e,t,r,n){D(e,"replaceState")},enqueueSetState:function(e,t,r,n){D(e,"setState")}},x=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)."]},U=function(e,t){Object.defineProperty(F.prototype,e,{get:function(){j("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1])}})};for(var H in V)V.hasOwnProperty(H)&&U(H,V[H]);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 Y=B.prototype=new z;Y.constructor=B,x(Y,F.prototype),Y.isPureReactComponent=!0;var K=Array.isArray;function W(e){return K(e)}function q(e){return""+e}function G(e){if(function(e){try{return q(e),!1}catch(e){return!0}}(e))return N("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&&N("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]||(N('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,N("%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,N("%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=x({},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(W(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 v=0,b=""===a?se:a+le;if(W(e))for(var _=0;_<e.length;_++)v+=me(l=e[_],t,o,b+ye(l,_),u);else{var g=h(e);if("function"==typeof g){var E=e;g===E.entries&&(fe||j("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),fe=!0);for(var C,S=g.call(E),O=0;!(C=S.next()).done;)v+=me(l=C.value,t,o,b+ye(l,O++),u)}else if("object"===i){var R=String(e);throw new Error("Objects are not valid as a React child (found: "+("[object Object]"===R?"object with keys {"+Object.keys(e).join(", ")+"}":R)+"). If you meant to render a collection of children, use an array instead.")}}return v}function ve(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 he,be=-1,_e=0,ge=1,Ee=2;function Ce(e){if(e._status===be){var t=(0,e._result)();if(t.then((function(t){if(e._status===_e||e._status===be){var r=e;r._status=ge,r._result=t}}),(function(t){if(e._status===_e||e._status===be){var r=e;r._status=Ee,r._result=t}})),e._status===be){var r=e;r._status=_e,r._result=t}}if(e._status===ge){var n=e._result;return void 0===n&&N("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||N("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||R||w||k)||"object"==typeof e&&null!==e&&(e.$$typeof===d||e.$$typeof===p||e.$$typeof===i||e.$$typeof===c||e.$$typeof===s||e.$$typeof===he||void 0!==e.getModuleId)}function Oe(){var e=b.current;return null===e&&N("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}he=Symbol.for("react.module.reference");var Re,we,ke,Le,Te,Pe,je,Ne=0;function $e(){}$e.__reactDisabledLog=!0;var Ie,De=P.ReactCurrentDispatcher;function Me(e,t,r){if(void 0===Ie)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);Ie=n&&n[1]||""}return"\n"+Ie+e}var xe,Ae=!1,Fe="function"==typeof WeakMap?WeakMap:Map;function Ve(e,t){if(!e||Ae)return"";var r,n=xe.get(e);if(void 0!==n)return n;Ae=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=De.current,De.current=null,function(){if(0===Ne){Re=console.log,we=console.info,ke=console.warn,Le=console.error,Te=console.group,Pe=console.groupCollapsed,je=console.groupEnd;var e={configurable:!0,enumerable:!0,value:$e,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Ne++}();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&&xe.set(e,f),f}}while(s>=1&&l>=0);break}}}finally{Ae=!1,De.current=o,function(){if(0==--Ne){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:x({},e,{value:Re}),info:x({},e,{value:we}),warn:x({},e,{value:ke}),error:x({},e,{value:Le}),group:x({},e,{value:Te}),groupCollapsed:x({},e,{value:Pe}),groupEnd:x({},e,{value:je})})}Ne<0&&N("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&&xe.set(e,d),d}function Ue(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 Ue(e.type,t,r);case d:var n=e,o=n._payload,a=n._init;try{return Ue(a(o),t,r)}catch(e){}}return""}xe=new Fe;var He,ze={},Be=P.ReactDebugCurrentFrame;function Ye(e){if(e){var t=e._owner,r=Ue(e.type,e._source,t?t.type:null);Be.setExtraStackFrame(r)}else Be.setExtraStackFrame(null)}function Ke(e){if(e){var t=e._owner;O(Ue(e.type,e._source,t?t.type:null))}else O(null)}function We(){if(E.current){var e=Z(E.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}He=!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=We();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)+"."),Ke(e),N('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),Ke(null)}}}function Xe(e,t){if("object"==typeof e)if(W(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=h(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||(Ye(o),N("%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),Ye(null)),i instanceof Error&&!(i.message in ze)&&(ze[i.message]=!0,Ye(o),N("Failed %s type: %s",r,i.message),Ye(null))}}(t,e.props,"prop",n,e)}else void 0===r.PropTypes||He||(He=!0,N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Z(r)||"Unknown"));"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||N("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+".":"")||We(),null===e?c="null":W(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,N("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){Ke(e),N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),Ke(null);break}}null!==e.ref&&(Ke(e),N("Invalid attribute `ref` supplied to `React.Fragment`."),Ke(null))}(l):Ze(l),l}var Qe=!1,et=!1,tt=null,rt=0,nt=!1;function ot(e){e!==rt-1&&N("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=g.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&&N("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?(g.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,j("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 j("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),t},ft={map:ve,forEach:function(e,t,r){ve(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return ve(e,(function(){t++})),t},toArray:function(e){return ve(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,N("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,N("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||(j("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?N("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):"function"!=typeof e?N("forwardRef requires a render function but was given %s.",null===e?"null":typeof e):0!==e.length&&2!==e.length&&N("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||N("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){N("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){N("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)||N("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=_.transition;_.transition={};var n=_.transition;_.transition._updatedFibers=new Set;try{e()}finally{_.transition=r,null===r&&n._updatedFibers&&(n._updatedFibers.size>10&&j("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===g.current&&(g.current=[]);var r,n=g.isBatchingLegacy;try{if(g.isBatchingLegacy=!0,r=e(),!n&&g.didScheduleLegacyUpdate){var o=g.current;null!==o&&(g.didScheduleLegacyUpdate=!1,it(o))}}catch(e){throw ot(t),e}finally{g.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,N("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=g.current;return null!==s&&(it(s),g.current=null),{then:function(e,t){null===g.current?(g.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?N("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&&N("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 v=e=>"object"==typeof e&&null!==e;var h=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 b=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");function g(e,t){if(!e||!h(e))return e;const r={};return Object.keys(e).forEach((n=>{const o=e[n];let a=!1;t.forEach((e=>{(b(e)&&e===n||e instanceof RegExp&&n.match(e))&&(a=!0)})),a||(r[n]=o)})),r}function E(e){return Object.prototype.toString.call(e)}function C(e){return Object.keys(e)}function S(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(E(e)!==E(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(!S(e[n],t[n],r))return!1;return!0}if(!h(e))return!1;const n=C(e),o=C(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(!S(e[a],t[a],r))return!1}return!0}var O,R={exports:{}},w={};var k,L={};
|
|
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?R.exports=function(){if(O)return w;O=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"),w.ContextConsumer=i,w.ContextProvider=u,w.Element=t,w.ForwardRef=s,w.Fragment=n,w.Lazy=d,w.Memo=p,w.Portal=r,w.Profiler=a,w.StrictMode=o,w.Suspense=l,w.SuspenseList=f,w.isAsyncMode=function(){return!1},w.isConcurrentMode=function(){return!1},w.isContextConsumer=function(e){return m(e)===i},w.isContextProvider=function(e){return m(e)===u},w.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},w.isForwardRef=function(e){return m(e)===s},w.isFragment=function(e){return m(e)===n},w.isLazy=function(e){return m(e)===d},w.isMemo=function(e){return m(e)===p},w.isPortal=function(e){return m(e)===r},w.isProfiler=function(e){return m(e)===a},w.isStrictMode=function(e){return m(e)===o},w.isSuspense=function(e){return m(e)===l},w.isSuspenseList=function(e){return m(e)===f},w.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)},w.typeOf=m,w}():R.exports=(k||(k=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 v=m&&m.$$typeof;switch(v){case c:case i:case s:case d:case p:case u:return v;default:return y}}case r:return y}}}e=Symbol.for("react.module.reference");var v=i,h=u,b=t,_=s,g=n,E=d,C=p,S=r,O=a,R=o,w=l,k=f,T=!1,P=!1;L.ContextConsumer=v,L.ContextProvider=h,L.Element=b,L.ForwardRef=_,L.Fragment=g,L.Lazy=E,L.Memo=C,L.Portal=S,L.Profiler=O,L.StrictMode=R,L.Suspense=w,L.SuspenseList=k,L.isAsyncMode=function(e){return T||(T=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},L.isConcurrentMode=function(e){return P||(P=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},L.isContextConsumer=function(e){return m(e)===i},L.isContextProvider=function(e){return m(e)===u},L.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},L.isForwardRef=function(e){return m(e)===s},L.isFragment=function(e){return m(e)===n},L.isLazy=function(e){return m(e)===d},L.isMemo=function(e){return m(e)===p},L.isPortal=function(e){return m(e)===r},L.isProfiler=function(e){return m(e)===a},L.isStrictMode=function(e){return m(e)===o},L.isSuspense=function(e){return m(e)===l},L.isSuspenseList=function(e){return m(e)===f},L.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)},L.typeOf=m}()),L);var T=R.exports;const P=e=>{let t=[];return f.Children.forEach(e,(e=>{m(e)||(T.isFragment(e)?t=t.concat(P(e.props.children)):t.push(e))})),t},j={...t.ListTable.EVENT_TYPE,...t.PivotTable.EVENT_TYPE,...t.PivotChart.EVENT_TYPE},N={onClickCell:j.CLICK_CELL,onDblClickCell:j.DBLCLICK_CELL,onMouseDownCell:j.MOUSEDOWN_CELL,onMouseUpCell:j.MOUSEUP_CELL,onSelectedCell:j.SELECTED_CELL,onKeyDown:j.KEYDOWN,onMouseEnterTable:j.MOUSEENTER_TABLE,onMouseLeaveTable:j.MOUSELEAVE_TABLE,onMouseMoveCell:j.MOUSEMOVE_CELL,onMouseEnterCell:j.MOUSEENTER_CELL,onMouseLeaveCell:j.MOUSELEAVE_CELL,onContextMenuCell:j.CONTEXTMENU_CELL,onResizeColumn:j.RESIZE_COLUMN,onResizeColumnEnd:j.RESIZE_COLUMN_END,onChangeHeaderPosition:j.CHANGE_HEADER_POSITION,onSortClick:j.SORT_CLICK,onFreezeClick:j.FREEZE_CLICK,onScroll:j.SCROLL,onDropdownMenuClick:j.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:j.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:j.DRAG_SELECT_END,onDropdownIconClick:j.DROPDOWN_ICON_CLICK,onDropdownMenuClear:j.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:j.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:j.SHOW_MENU,onHideMenu:j.HIDE_MENU,onIconClick:j.ICON_CLICK,onLegendItemClick:j.LEGEND_ITEM_CLICK,onLegendItemHover:j.LEGEND_ITEM_HOVER,onLegendItemUnHover:j.LEGEND_ITEM_UNHOVER,onLegendChange:j.LEGEND_CHANGE,onMouseEnterAxis:j.MOUSEENTER_AXIS,onMouseLeaveAxis:j.MOUSELEAVE_AXIS,onCheckboxStateChange:j.CHECKBOX_STATE_CHANGE,onAfterRender:j.AFTER_RENDER,onInitialized:j.INITIALIZED,onPivotSortClick:j.PIVOT_SORT_CLICK,onDrillMenuClick:j.DRILLMENU_CLICK,onVChartEventType:j.VCHART_EVENT_TYPE,onChangCellValue:j.CHANGE_CELL_VALUE,onMousedownFillHandle:j.MOUSEDOWN_FILL_HANDLE,onDragFillHandleEnd:j.DRAG_FILL_HANDLE_END,onDblclickFillHandle:j.DBLCLICK_FILL_HANDLE,onScrollVerticalEnd:j.SCROLL_VERTICAL_END,onScrollHorizontalEnd:j.SCROLL_HORIZONTAL_END},$=Object.keys(N),I=(e,t=N)=>{const r={};return Object.keys(e).forEach((n=>{t[n]&&e[n]&&(r[n]=e[n])})),r},D=(e,t,r,n=N)=>{if(!t&&!r||!e)return!1;const o=r?I(r,n):null,a=t?I(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},M=["children","hooks","ref",...$,"skipFunctionDiff","onError","onReady","option","records","container"],x=(e,t)=>`${e&&e.type&&(e.type.displayName||e.type.name)}-${t}`,A=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(g(e,M)),d=l.useRef(null),y=l.useRef(e.records),v=f.useRef(null),h=!!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]),_=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]),E=l.useCallback((()=>{if(!c.current){if(!a.current||!a.current.table)return;D(a.current.table,e,v.current,N),o(r+1),e.onReady&&e.onReady(a.current.table,0===r)}}),[r,o,e]),C=l.useCallback((()=>{a.current.table&&(a.current.table.render(),E())}),[E]);return l.useEffect((()=>{const t=u?null:(e=>{const t={};return P(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:x(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),_(e),C(),void(v.current=e);if(u)return void(S(v.current.option,e.option,{skipFunction:h})?i&&!S(v.current.records,e.records,{skipFunction:h})&&(v.current=e,a.current.table.setRecords(e.records),E()):(v.current=e,a.current.table.updateOption(b(e)),E()));const r=g(e,M);S(r,s.current,{skipFunction:h})&&S(t,d.current,{skipFunction:h})?i&&!S(e.records,y.current,{skipFunction:h})&&(y.current=e.records,a.current.table.setRecords(e.records),E()):(s.current=r,d.current=t,a.current.table.updateOption(b(e)),E())}),[_,u,i,b,E,C,h,e]),l.useEffect((()=>()=>{a&&a.current&&a.current.table&&(a.current.table.release(),a.current=null),v.current=null,c.current=!0}),[]),f.createElement(p.Provider,{value:a.current},P(e.children).map(((e,t)=>{if("string"==typeof e)return;const n=x(e,t);return f.createElement(f.Fragment,{key:n},f.cloneElement(e,{updateId:r,componentId:n}))})))})),F=(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}(A,e,(e=>(e.type=t,r?r(e):t?{...e,type:t}:e)));return n.displayName=e,n},V=F("ListTable","list-table"),H=F("PivotTable","pivot-table"),U=F("PivotChart","pivot-chart");const z=(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&&D(t.table,e,n.current,r)&&(n.current=e)}return l.useEffect((()=>()=>{r&&D(t.table,null,n.current,r)}),[]),null};return u.displayName=e,u.parseOption=e=>({option:g(e,a),optionName:t,isSingle:n}),u},B=z("ListColumn","columns"),Y=z("PivotColumnDimension","columns"),K=z("PivotRowDimension","rows"),W=z("PivotIndicator","indicators"),q=z("PivotColumnHeaderTitle","columnHeaderTitle",void 0,!0),G=z("PivotRowHeaderTitle","rowHeaderTitle",void 0,!0),X=z("PivotCorner","corner",void 0,!0),Z=z("Menu","menu",void 0,!0),J=z("Tooltip","tooltip",void 0,!0);e.VTable=n,e.ListColumn=B,e.ListTable=V,e.Menu=Z,e.PivotChart=U,e.PivotColumnDimension=Y,e.PivotColumnHeaderTitle=q,e.PivotCorner=X,e.PivotIndicator=W,e.PivotRowDimension=K,e.PivotRowHeaderTitle=G,e.PivotTable=H,e.Tooltip=J,e.registerChartModule=function(e,t){n.register.chartModule(e,t)},e.version="0.23.2-alpha.0"}));
|
|
19
|
+
*/"production"===process.env.NODE_ENV?R.exports=function(){if(O)return w;O=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"),w.ContextConsumer=i,w.ContextProvider=u,w.Element=t,w.ForwardRef=s,w.Fragment=n,w.Lazy=d,w.Memo=p,w.Portal=r,w.Profiler=a,w.StrictMode=o,w.Suspense=l,w.SuspenseList=f,w.isAsyncMode=function(){return!1},w.isConcurrentMode=function(){return!1},w.isContextConsumer=function(e){return m(e)===i},w.isContextProvider=function(e){return m(e)===u},w.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},w.isForwardRef=function(e){return m(e)===s},w.isFragment=function(e){return m(e)===n},w.isLazy=function(e){return m(e)===d},w.isMemo=function(e){return m(e)===p},w.isPortal=function(e){return m(e)===r},w.isProfiler=function(e){return m(e)===a},w.isStrictMode=function(e){return m(e)===o},w.isSuspense=function(e){return m(e)===l},w.isSuspenseList=function(e){return m(e)===f},w.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)},w.typeOf=m,w}():R.exports=(k||(k=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 v=m&&m.$$typeof;switch(v){case c:case i:case s:case d:case p:case u:return v;default:return y}}case r:return y}}}e=Symbol.for("react.module.reference");var v=i,h=u,b=t,_=s,g=n,E=d,C=p,S=r,O=a,R=o,w=l,k=f,T=!1,P=!1;L.ContextConsumer=v,L.ContextProvider=h,L.Element=b,L.ForwardRef=_,L.Fragment=g,L.Lazy=E,L.Memo=C,L.Portal=S,L.Profiler=O,L.StrictMode=R,L.Suspense=w,L.SuspenseList=k,L.isAsyncMode=function(e){return T||(T=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},L.isConcurrentMode=function(e){return P||(P=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},L.isContextConsumer=function(e){return m(e)===i},L.isContextProvider=function(e){return m(e)===u},L.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},L.isForwardRef=function(e){return m(e)===s},L.isFragment=function(e){return m(e)===n},L.isLazy=function(e){return m(e)===d},L.isMemo=function(e){return m(e)===p},L.isPortal=function(e){return m(e)===r},L.isProfiler=function(e){return m(e)===a},L.isStrictMode=function(e){return m(e)===o},L.isSuspense=function(e){return m(e)===l},L.isSuspenseList=function(e){return m(e)===f},L.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)},L.typeOf=m}()),L);var T=R.exports;const P=e=>{let t=[];return f.Children.forEach(e,(e=>{m(e)||(T.isFragment(e)?t=t.concat(P(e.props.children)):t.push(e))})),t},j={...t.ListTable.EVENT_TYPE,...t.PivotTable.EVENT_TYPE,...t.PivotChart.EVENT_TYPE},N={onClickCell:j.CLICK_CELL,onDblClickCell:j.DBLCLICK_CELL,onMouseDownCell:j.MOUSEDOWN_CELL,onMouseUpCell:j.MOUSEUP_CELL,onSelectedCell:j.SELECTED_CELL,onKeyDown:j.KEYDOWN,onMouseEnterTable:j.MOUSEENTER_TABLE,onMouseLeaveTable:j.MOUSELEAVE_TABLE,onMouseDownTable:j.MOUSEDOWN_TABLE,onMouseMoveCell:j.MOUSEMOVE_CELL,onMouseEnterCell:j.MOUSEENTER_CELL,onMouseLeaveCell:j.MOUSELEAVE_CELL,onContextMenuCell:j.CONTEXTMENU_CELL,onResizeColumn:j.RESIZE_COLUMN,onResizeColumnEnd:j.RESIZE_COLUMN_END,onChangeHeaderPosition:j.CHANGE_HEADER_POSITION,onSortClick:j.SORT_CLICK,onFreezeClick:j.FREEZE_CLICK,onScroll:j.SCROLL,onDropdownMenuClick:j.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:j.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:j.DRAG_SELECT_END,onDropdownIconClick:j.DROPDOWN_ICON_CLICK,onDropdownMenuClear:j.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:j.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:j.SHOW_MENU,onHideMenu:j.HIDE_MENU,onIconClick:j.ICON_CLICK,onLegendItemClick:j.LEGEND_ITEM_CLICK,onLegendItemHover:j.LEGEND_ITEM_HOVER,onLegendItemUnHover:j.LEGEND_ITEM_UNHOVER,onLegendChange:j.LEGEND_CHANGE,onMouseEnterAxis:j.MOUSEENTER_AXIS,onMouseLeaveAxis:j.MOUSELEAVE_AXIS,onCheckboxStateChange:j.CHECKBOX_STATE_CHANGE,onAfterRender:j.AFTER_RENDER,onInitialized:j.INITIALIZED,onPivotSortClick:j.PIVOT_SORT_CLICK,onDrillMenuClick:j.DRILLMENU_CLICK,onVChartEventType:j.VCHART_EVENT_TYPE,onChangCellValue:j.CHANGE_CELL_VALUE,onMousedownFillHandle:j.MOUSEDOWN_FILL_HANDLE,onDragFillHandleEnd:j.DRAG_FILL_HANDLE_END,onDblclickFillHandle:j.DBLCLICK_FILL_HANDLE,onScrollVerticalEnd:j.SCROLL_VERTICAL_END,onScrollHorizontalEnd:j.SCROLL_HORIZONTAL_END},$=Object.keys(N),I=(e,t=N)=>{const r={};return Object.keys(e).forEach((n=>{t[n]&&e[n]&&(r[n]=e[n])})),r},D=(e,t,r,n=N)=>{if(!t&&!r||!e)return!1;const o=r?I(r,n):null,a=t?I(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},M=["children","hooks","ref",...$,"skipFunctionDiff","onError","onReady","option","records","container"],x=(e,t)=>`${e&&e.type&&(e.type.displayName||e.type.name)}-${t}`,A=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(g(e,M)),d=l.useRef(null),y=l.useRef(e.records),v=f.useRef(null),h=!!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]),_=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]),E=l.useCallback((()=>{if(!c.current){if(!a.current||!a.current.table)return;D(a.current.table,e,v.current,N),o(r+1),e.onReady&&e.onReady(a.current.table,0===r)}}),[r,o,e]),C=l.useCallback((()=>{a.current.table&&(a.current.table.render(),E())}),[E]);return l.useEffect((()=>{const t=u?null:(e=>{const t={};return P(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:x(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),_(e),C(),void(v.current=e);if(u)return void(S(v.current.option,e.option,{skipFunction:h})?i&&!S(v.current.records,e.records,{skipFunction:h})&&(a.current.table.setRecords(e.records),E(),v.current=e):(a.current.table.updateOption(b(e)),E(),v.current=e));const r=g(e,M);S(r,s.current,{skipFunction:h})&&S(t,d.current,{skipFunction:h})?i&&!S(e.records,y.current,{skipFunction:h})&&(y.current=e.records,a.current.table.setRecords(e.records),E(),v.current=e):(s.current=r,d.current=t,a.current.table.updateOption(b(e)),E(),v.current=e)}),[_,u,i,b,E,C,h,e]),l.useEffect((()=>()=>{a&&a.current&&a.current.table&&(a.current.table.release(),a.current=null),v.current=null,c.current=!0}),[]),f.createElement(p.Provider,{value:a.current},P(e.children).map(((e,t)=>{if("string"==typeof e)return;const n=x(e,t);return f.createElement(f.Fragment,{key:n},f.cloneElement(e,{updateId:r,componentId:n}))})))})),F=(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}(A,e,(e=>(e.type=t,r?r(e):t?{...e,type:t}:e)));return n.displayName=e,n},V=F("ListTable","list-table"),U=F("PivotTable","pivot-table"),H=F("PivotChart","pivot-chart");const z=(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&&D(t.table,e,n.current,r)&&(n.current=e)}return l.useEffect((()=>()=>{r&&D(t.table,null,n.current,r)}),[]),null};return u.displayName=e,u.parseOption=e=>({option:g(e,a),optionName:t,isSingle:n}),u},B=z("ListColumn","columns"),Y=z("PivotColumnDimension","columns"),K=z("PivotRowDimension","rows"),W=z("PivotIndicator","indicators"),q=z("PivotColumnHeaderTitle","columnHeaderTitle",void 0,!0),G=z("PivotRowHeaderTitle","rowHeaderTitle",void 0,!0),X=z("PivotCorner","corner",void 0,!0),Z=z("Menu","menu",void 0,!0),J=z("Tooltip","tooltip",void 0,!0);e.VTable=n,e.ListColumn=B,e.ListTable=V,e.Menu=Z,e.PivotChart=H,e.PivotColumnDimension=Y,e.PivotColumnHeaderTitle=q,e.PivotCorner=X,e.PivotIndicator=W,e.PivotRowDimension=K,e.PivotRowHeaderTitle=G,e.PivotTable=U,e.Tooltip=J,e.registerChartModule=function(e,t){n.register.chartModule(e,t)},e.version="0.23.3"}));
|
package/es/eventsUtils.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface EventsProps {
|
|
|
10
10
|
onKeyDown?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['keydown']>;
|
|
11
11
|
onMouseEnterTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_table']>;
|
|
12
12
|
onMouseLeaveTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_table']>;
|
|
13
|
+
onMouseDownTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_table']>;
|
|
13
14
|
onMouseMoveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousemove_cell']>;
|
|
14
15
|
onMouseEnterCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_cell']>;
|
|
15
16
|
onMouseLeaveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_cell']>;
|
|
@@ -57,6 +58,7 @@ export declare const TABLE_EVENTS: {
|
|
|
57
58
|
onKeyDown: "keydown";
|
|
58
59
|
onMouseEnterTable: "mouseenter_table";
|
|
59
60
|
onMouseLeaveTable: "mouseleave_table";
|
|
61
|
+
onMouseDownTable: "mouseleave_table";
|
|
60
62
|
onMouseMoveCell: "mousemove_cell";
|
|
61
63
|
onMouseEnterCell: "mouseenter_cell";
|
|
62
64
|
onMouseLeaveCell: "mouseleave_cell";
|
package/es/eventsUtils.js
CHANGED
|
@@ -11,6 +11,7 @@ export const TABLE_EVENTS = {
|
|
|
11
11
|
onKeyDown: EVENT_TYPE.KEYDOWN,
|
|
12
12
|
onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,
|
|
13
13
|
onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,
|
|
14
|
+
onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,
|
|
14
15
|
onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,
|
|
15
16
|
onMouseEnterCell: EVENT_TYPE.MOUSEENTER_C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E;gBACxG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAmD,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAChH;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","file":"eventsUtils.js","sourcesContent":["import { ListTable, PivotTable, PivotChart } from '@visactor/vtable';\nimport type { IVTable } from './tables/base-table';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type EventCallback<Params> = (params: Params) => void;\n\nconst EVENT_TYPE = {\n ...ListTable.EVENT_TYPE,\n ...PivotTable.EVENT_TYPE,\n ...PivotChart.EVENT_TYPE\n};\n\nexport interface EventsProps {\n onClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['click_cell']>;\n onDblClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_cell']>;\n onMouseDownCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_cell']>;\n onMouseUpCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseup_cell']>;\n onSelectedCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['selected_cell']>;\n onKeyDown?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['keydown']>;\n onMouseEnterTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_table']>;\n onMouseLeaveTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_table']>;\n onMouseMoveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousemove_cell']>;\n onMouseEnterCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_cell']>;\n onMouseLeaveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_cell']>;\n onContextMenuCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['contextmenu_cell']>;\n onResizeColumn?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column']>;\n onResizeColumnEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column_end']>;\n onChangeHeaderPosition?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_header_position']>;\n onSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['sort_click']>;\n onFreezeClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['freeze_click']>;\n onScroll?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll']>;\n onDropdownMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_click']>;\n onMouseOverChartSymbol?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseover_chart_symbol']>;\n onDragSelectEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_select_end']>;\n\n onDropdownIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_icon_click']>;\n onDropdownMenuClear?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_clear']>;\n\n onTreeHierarchyStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['tree_hierarchy_state_change']>;\n\n onShowMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['show_menu']>;\n onHideMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['hide_menu']>;\n\n onIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['icon_click']>;\n\n onLegendItemClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_click']>;\n onLegendItemHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_hover']>;\n onLegendItemUnHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_unHover']>;\n onLegendChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_change']>;\n\n onMouseEnterAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_axis']>;\n onMouseLeaveAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_axis']>;\n\n onCheckboxStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['checkbox_state_change']>;\n onAfterRender?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['after_render']>;\n onInitialized?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['initialized']>;\n\n // pivot table only\n onPivotSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['pivot_sort_click']>;\n onDrillMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drillmenu_click']>;\n\n // pivot chart only\n onVChartEventType?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['vchart_event_type']>;\n\n onChangCellValue?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_cell_value']>;\n\n onMousedownFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_fill_handle']>;\n onDragFillHandleEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_fill_handle_end']>;\n onDblclickFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_fill_handle']>;\n\n onScrollVerticalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_vertical_end']>;\n onScrollHorizontalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_horizontal_end']>;\n}\n\nexport const TABLE_EVENTS = {\n onClickCell: EVENT_TYPE.CLICK_CELL,\n onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,\n onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,\n onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,\n onSelectedCell: EVENT_TYPE.SELECTED_CELL,\n onKeyDown: EVENT_TYPE.KEYDOWN,\n onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,\n onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,\n onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,\n onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,\n onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,\n onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,\n onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,\n onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,\n onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,\n onSortClick: EVENT_TYPE.SORT_CLICK,\n onFreezeClick: EVENT_TYPE.FREEZE_CLICK,\n onScroll: EVENT_TYPE.SCROLL,\n onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,\n onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,\n onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,\n\n onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,\n onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,\n\n onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,\n\n onShowMenu: EVENT_TYPE.SHOW_MENU,\n onHideMenu: EVENT_TYPE.HIDE_MENU,\n\n onIconClick: EVENT_TYPE.ICON_CLICK,\n\n onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,\n onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,\n onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,\n onLegendChange: EVENT_TYPE.LEGEND_CHANGE,\n\n onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,\n onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,\n\n onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,\n onAfterRender: EVENT_TYPE.AFTER_RENDER,\n onInitialized: EVENT_TYPE.INITIALIZED,\n\n // pivot table only\n onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,\n onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,\n\n // pivot chart only\n onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,\n\n onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,\n onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,\n onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,\n onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,\n onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,\n onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END\n};\n\nexport const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key] && props[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToTable = <T>(\n table: IVTable,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n) => {\n if ((!newProps && !prevProps) || !table) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n table.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n table.on(supportedEvents[eventKey] as keyof TYPES.TableEventHandlersEventArgumentMap, newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAMrE,MAAM,UAAU,iDACX,SAAS,CAAC,UAAU,G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\nimport type { IVTable } from './tables/base-table';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type EventCallback<Params> = (params: Params) => void;\n\nconst EVENT_TYPE = {\n ...ListTable.EVENT_TYPE,\n ...PivotTable.EVENT_TYPE,\n ...PivotChart.EVENT_TYPE\n};\n\nexport interface EventsProps {\n onClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['click_cell']>;\n onDblClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_cell']>;\n onMouseDownCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_cell']>;\n onMouseUpCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseup_cell']>;\n onSelectedCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['selected_cell']>;\n onKeyDown?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['keydown']>;\n onMouseEnterTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_table']>;\n onMouseLeaveTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_table']>;\n onMouseDownTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_table']>;\n onMouseMoveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousemove_cell']>;\n onMouseEnterCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_cell']>;\n onMouseLeaveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_cell']>;\n onContextMenuCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['contextmenu_cell']>;\n onResizeColumn?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column']>;\n onResizeColumnEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column_end']>;\n onChangeHeaderPosition?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_header_position']>;\n onSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['sort_click']>;\n onFreezeClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['freeze_click']>;\n onScroll?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll']>;\n onDropdownMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_click']>;\n onMouseOverChartSymbol?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseover_chart_symbol']>;\n onDragSelectEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_select_end']>;\n\n onDropdownIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_icon_click']>;\n onDropdownMenuClear?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_clear']>;\n\n onTreeHierarchyStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['tree_hierarchy_state_change']>;\n\n onShowMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['show_menu']>;\n onHideMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['hide_menu']>;\n\n onIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['icon_click']>;\n\n onLegendItemClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_click']>;\n onLegendItemHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_hover']>;\n onLegendItemUnHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_unHover']>;\n onLegendChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_change']>;\n\n onMouseEnterAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_axis']>;\n onMouseLeaveAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_axis']>;\n\n onCheckboxStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['checkbox_state_change']>;\n onAfterRender?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['after_render']>;\n onInitialized?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['initialized']>;\n\n // pivot table only\n onPivotSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['pivot_sort_click']>;\n onDrillMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drillmenu_click']>;\n\n // pivot chart only\n onVChartEventType?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['vchart_event_type']>;\n\n onChangCellValue?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_cell_value']>;\n\n onMousedownFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_fill_handle']>;\n onDragFillHandleEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_fill_handle_end']>;\n onDblclickFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_fill_handle']>;\n\n onScrollVerticalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_vertical_end']>;\n onScrollHorizontalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_horizontal_end']>;\n}\n\nexport const TABLE_EVENTS = {\n onClickCell: EVENT_TYPE.CLICK_CELL,\n onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,\n onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,\n onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,\n onSelectedCell: EVENT_TYPE.SELECTED_CELL,\n onKeyDown: EVENT_TYPE.KEYDOWN,\n onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,\n onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,\n onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,\n onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,\n onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,\n onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,\n onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,\n onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,\n onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,\n onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,\n onSortClick: EVENT_TYPE.SORT_CLICK,\n onFreezeClick: EVENT_TYPE.FREEZE_CLICK,\n onScroll: EVENT_TYPE.SCROLL,\n onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,\n onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,\n onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,\n\n onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,\n onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,\n\n onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,\n\n onShowMenu: EVENT_TYPE.SHOW_MENU,\n onHideMenu: EVENT_TYPE.HIDE_MENU,\n\n onIconClick: EVENT_TYPE.ICON_CLICK,\n\n onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,\n onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,\n onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,\n onLegendChange: EVENT_TYPE.LEGEND_CHANGE,\n\n onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,\n onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,\n\n onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,\n onAfterRender: EVENT_TYPE.AFTER_RENDER,\n onInitialized: EVENT_TYPE.INITIALIZED,\n\n // pivot table only\n onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,\n onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,\n\n // pivot chart only\n onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,\n\n onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,\n onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,\n onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,\n onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,\n onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,\n onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END\n};\n\nexport const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key] && props[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToTable = <T>(\n table: IVTable,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n) => {\n if ((!newProps && !prevProps) || !table) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n table.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n table.on(supportedEvents[eventKey] as keyof TYPES.TableEventHandlersEventArgumentMap, newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
|
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,QAAQ,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.23.3\";\n"]}
|
package/es/tables/base-table.js
CHANGED
|
@@ -60,9 +60,9 @@ const notOptionKeys = [ ...REACT_PRIVATE_PROPS, ...TABLE_EVENTS_KEYS, "skipFunct
|
|
|
60
60
|
skipFunction: skipFunctionDiff
|
|
61
61
|
}) ? hasRecords && !isEqual(eventsBinded.current.records, props.records, {
|
|
62
62
|
skipFunction: skipFunctionDiff
|
|
63
|
-
}) && (
|
|
64
|
-
|
|
65
|
-
handleTableRender()));
|
|
63
|
+
}) && (tableContext.current.table.setRecords(props.records), handleTableRender(),
|
|
64
|
+
eventsBinded.current = props) : (tableContext.current.table.updateOption(parseOption(props)),
|
|
65
|
+
handleTableRender(), eventsBinded.current = props));
|
|
66
66
|
const newOption = pickWithout(props, notOptionKeys);
|
|
67
67
|
isEqual(newOption, prevOption.current, {
|
|
68
68
|
skipFunction: skipFunctionDiff
|
|
@@ -71,8 +71,9 @@ const notOptionKeys = [ ...REACT_PRIVATE_PROPS, ...TABLE_EVENTS_KEYS, "skipFunct
|
|
|
71
71
|
}) ? hasRecords && !isEqual(props.records, prevRecords.current, {
|
|
72
72
|
skipFunction: skipFunctionDiff
|
|
73
73
|
}) && (prevRecords.current = props.records, tableContext.current.table.setRecords(props.records),
|
|
74
|
-
handleTableRender()) : (prevOption.current = newOption,
|
|
75
|
-
tableContext.current.table.updateOption(parseOption(props)),
|
|
74
|
+
handleTableRender(), eventsBinded.current = props) : (prevOption.current = newOption,
|
|
75
|
+
optionFromChildren.current = newOptionFromChildren, tableContext.current.table.updateOption(parseOption(props)),
|
|
76
|
+
handleTableRender(), eventsBinded.current = props);
|
|
76
77
|
}), [ createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props ]),
|
|
77
78
|
useEffect((() => () => {
|
|
78
79
|
tableContext && tableContext.current && tableContext.current.table && (tableContext.current.table.release(),
|
|
@@ -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,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,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C,OAAO,GAAG,IAAI,CAAC;QAC3B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,CAAC,OAAO,IACnD,OAAO,CAAC,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,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,OAAO,IACzB,KAAK,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;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAkB,aAAqB,EAAE,IAAa,EAAE,QAA0B,EAAE,EAAE;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 eventsBinded.current = props;\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n eventsBinded.current = props;\n tableContext.current.table.setRecords(props.records as any[]);\n handleTableRender();\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 } 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 }\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,E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E,OAAO;SACrB,CAAC,CACa,CAClB,CAAC;IACJ,CAAC,CAAC,CACwB,CAC7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAkB,aAAqB,EAAE,IAAa,EAAE,QAA0B,EAAE,EAAE;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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/react-vtable",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.3",
|
|
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.23.2-alpha.0",
|
|
47
46
|
"@visactor/vutils": "~0.18.1",
|
|
48
|
-
"react-is": "^18.2.0"
|
|
47
|
+
"react-is": "^18.2.0",
|
|
48
|
+
"@visactor/vtable": "0.23.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@visactor/vchart": "1.10.0",
|
|
@@ -88,12 +88,15 @@
|
|
|
88
88
|
"form-data": "~4.0.0",
|
|
89
89
|
"axios": "^1.4.0",
|
|
90
90
|
"@types/react-is": "^17.0.3",
|
|
91
|
+
"@arco-design/web-react": "2.60.2",
|
|
91
92
|
"@internal/bundler": "0.0.1",
|
|
92
93
|
"@internal/eslint-config": "0.0.1",
|
|
93
94
|
"@internal/ts-config": "0.0.1"
|
|
94
95
|
},
|
|
95
96
|
"scripts": {
|
|
96
97
|
"start": "vite ./demo",
|
|
97
|
-
"build": "bundle --clean"
|
|
98
|
+
"build": "bundle --clean",
|
|
99
|
+
"compile": "tsc --noEmit",
|
|
100
|
+
"eslint": "eslint --debug --fix src/"
|
|
98
101
|
}
|
|
99
102
|
}
|