@visactor/react-vtable 0.15.0-alpha.2 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -82
- package/cjs/components/component/menu.d.ts +1 -1
- package/cjs/components/component/menu.js.map +1 -1
- package/cjs/components/list/list-column.d.ts +2 -2
- package/cjs/components/list/list-column.js.map +1 -1
- package/cjs/components/pivot/pivot-corner.d.ts +2 -2
- package/cjs/components/pivot/pivot-corner.js.map +1 -1
- package/cjs/components/pivot/pivot-dimension.d.ts +3 -3
- package/cjs/components/pivot/pivot-dimension.js.map +1 -1
- package/cjs/components/pivot/pivot-header-title.d.ts +3 -3
- package/cjs/components/pivot/pivot-header-title.js.map +1 -1
- package/cjs/components/pivot/pivot-indicator.d.ts +2 -2
- package/cjs/components/pivot/pivot-indicator.js.map +1 -1
- package/cjs/context/table.d.ts +1 -1
- package/cjs/context/table.js.map +1 -1
- package/cjs/eventsUtils.d.ts +40 -40
- package/cjs/eventsUtils.js +1 -1
- package/cjs/eventsUtils.js.map +1 -1
- package/cjs/index_old.js +2 -2
- package/cjs/index_old.js.map +1 -1
- package/cjs/tables/base-table.d.ts +1 -1
- package/cjs/tables/base-table.js +4 -2
- package/cjs/tables/base-table.js.map +1 -1
- package/cjs/tables/list-table.d.ts +3 -3
- package/cjs/tables/list-table.js.map +1 -1
- package/cjs/tables/pivot-chart.d.ts +3 -3
- package/cjs/tables/pivot-chart.js +1 -1
- package/cjs/tables/pivot-chart.js.map +1 -1
- package/cjs/tables/pivot-table.d.ts +3 -3
- package/cjs/tables/pivot-table.js.map +1 -1
- package/dist/react-vtable.js +1 -1
- package/dist/react-vtable.min.js +1 -1
- package/es/components/component/menu.d.ts +1 -1
- package/es/components/component/menu.js.map +1 -1
- package/es/components/list/list-column.d.ts +2 -2
- package/es/components/list/list-column.js.map +1 -1
- package/es/components/pivot/pivot-corner.d.ts +2 -2
- package/es/components/pivot/pivot-corner.js.map +1 -1
- package/es/components/pivot/pivot-dimension.d.ts +3 -3
- package/es/components/pivot/pivot-dimension.js.map +1 -1
- package/es/components/pivot/pivot-header-title.d.ts +3 -3
- package/es/components/pivot/pivot-header-title.js.map +1 -1
- package/es/components/pivot/pivot-indicator.d.ts +2 -2
- package/es/components/pivot/pivot-indicator.js.map +1 -1
- package/es/context/table.d.ts +1 -1
- package/es/context/table.js.map +1 -1
- package/es/eventsUtils.d.ts +40 -40
- package/es/eventsUtils.js +1 -1
- package/es/eventsUtils.js.map +1 -1
- package/es/index_old.js +1 -1
- package/es/index_old.js.map +1 -1
- package/es/tables/base-table.d.ts +1 -1
- package/es/tables/base-table.js +4 -2
- package/es/tables/base-table.js.map +1 -1
- package/es/tables/list-table.d.ts +3 -3
- package/es/tables/list-table.js.map +1 -1
- package/es/tables/pivot-chart.d.ts +3 -3
- package/es/tables/pivot-chart.js +1 -1
- package/es/tables/pivot-chart.js.map +1 -1
- package/es/tables/pivot-table.d.ts +3 -3
- package/es/tables/pivot-table.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { PivotTableConstructorOptions } from '
|
|
2
|
+
import type { PivotTableConstructorOptions } from '@visactor/vtable';
|
|
3
3
|
import type { BaseTableProps } from './base-table';
|
|
4
4
|
export interface PivotTableProps extends Omit<BaseTableProps, 'option' | 'records' | 'type'>, Omit<PivotTableConstructorOptions, 'container'> {
|
|
5
5
|
}
|
|
6
|
-
export declare const PivotTable: React.ForwardRefExoticComponent<
|
|
6
|
+
export declare const PivotTable: React.ForwardRefExoticComponent<PivotTableProps & {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
-
} & import("../containers/withContainer").ContainerProps
|
|
8
|
+
} & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tables/pivot-table.tsx"],"names":[],"mappings":";;;AAGA,6CAA2C;AAM9B,QAAA,UAAU,GAAG,IAAA,wBAAW,EAA2C,YAAY,EAAE,aAAa,CAAC,CAAC","file":"pivot-table.js","sourcesContent":["import type React from 'react';\nimport type { PivotTableConstructorOptions } from '
|
|
1
|
+
{"version":3,"sources":["tables/pivot-table.tsx"],"names":[],"mappings":";;;AAGA,6CAA2C;AAM9B,QAAA,UAAU,GAAG,IAAA,wBAAW,EAA2C,YAAY,EAAE,aAAa,CAAC,CAAC","file":"pivot-table.js","sourcesContent":["import type React from 'react';\nimport type { PivotTableConstructorOptions } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface PivotTableProps\n extends Omit<BaseTableProps, 'option' | 'records' | 'type'>,\n Omit<PivotTableConstructorOptions, 'container'> {}\n\nexport const PivotTable = createTable<React.PropsWithChildren<PivotTableProps>>('PivotTable', 'pivot-table');\n"]}
|
package/dist/react-vtable.js
CHANGED
|
@@ -3416,7 +3416,7 @@
|
|
|
3416
3416
|
}
|
|
3417
3417
|
}, [handleTableRender, props]);
|
|
3418
3418
|
reactExports.useEffect(() => {
|
|
3419
|
-
if (!tableContext.current
|
|
3419
|
+
if (!tableContext.current?.table) {
|
|
3420
3420
|
createTable(props);
|
|
3421
3421
|
renderTable();
|
|
3422
3422
|
bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS);
|
package/dist/react-vtable.min.js
CHANGED
|
@@ -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?w.exports=function(){if(O)return R;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"),R.ContextConsumer=i,R.ContextProvider=u,R.Element=t,R.ForwardRef=s,R.Fragment=n,R.Lazy=d,R.Memo=p,R.Portal=r,R.Profiler=a,R.StrictMode=o,R.Suspense=l,R.SuspenseList=f,R.isAsyncMode=function(){return!1},R.isConcurrentMode=function(){return!1},R.isContextConsumer=function(e){return m(e)===i},R.isContextProvider=function(e){return m(e)===u},R.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},R.isForwardRef=function(e){return m(e)===s},R.isFragment=function(e){return m(e)===n},R.isLazy=function(e){return m(e)===d},R.isMemo=function(e){return m(e)===p},R.isPortal=function(e){return m(e)===r},R.isProfiler=function(e){return m(e)===a},R.isStrictMode=function(e){return m(e)===o},R.isSuspense=function(e){return m(e)===l},R.isSuspenseList=function(e){return m(e)===f},R.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)},R.typeOf=m,R}():w.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 h=m&&m.$$typeof;switch(h){case c:case i:case s:case d:case p:case u:return h;default:return y}}case r:return y}}}e=Symbol.for("react.module.reference");var h=i,v=u,b=t,_=s,g=n,E=d,C=p,S=r,O=a,w=o,R=l,k=f,T=!1,L=!1;P.ContextConsumer=h,P.ContextProvider=v,P.Element=b,P.ForwardRef=_,P.Fragment=g,P.Lazy=E,P.Memo=C,P.Portal=S,P.Profiler=O,P.StrictMode=w,P.Suspense=R,P.SuspenseList=k,P.isAsyncMode=function(e){return T||(T=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},P.isConcurrentMode=function(e){return L||(L=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},P.isContextConsumer=function(e){return m(e)===i},P.isContextProvider=function(e){return m(e)===u},P.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},P.isForwardRef=function(e){return m(e)===s},P.isFragment=function(e){return m(e)===n},P.isLazy=function(e){return m(e)===d},P.isMemo=function(e){return m(e)===p},P.isPortal=function(e){return m(e)===r},P.isProfiler=function(e){return m(e)===a},P.isStrictMode=function(e){return m(e)===o},P.isSuspense=function(e){return m(e)===l},P.isSuspenseList=function(e){return m(e)===f},P.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)},P.typeOf=m}()),P);var T=w.exports;let L=0;const j=e=>e?`${e}-${L++}`:""+L++,$=e=>{let t=[];return f.Children.forEach(e,(e=>{m(e)||(T.isFragment(e)?t=t.concat($(e.props.children)):t.push(e))})),t},x={...t.ListTable.EVENT_TYPE,...t.PivotTable.EVENT_TYPE,...t.PivotChart.EVENT_TYPE},I={onClickCell:x.CLICK_CELL,onDblClickCell:x.DBLCLICK_CELL,onMouseDownCell:x.MOUSEDOWN_CELL,onMouseUpCell:x.MOUSEUP_CELL,onSelectedCell:x.SELECTED_CELL,onKeyDown:x.KEYDOWN,onMouseEnterTable:x.MOUSEENTER_TABLE,onMouseLeaveTable:x.MOUSELEAVE_TABLE,onMouseMoveCell:x.MOUSEMOVE_CELL,onMouseEnterCell:x.MOUSEENTER_CELL,onMouseLeaveCell:x.MOUSELEAVE_CELL,onContextMenuCell:x.CONTEXTMENU_CELL,onResizeColumn:x.RESIZE_COLUMN,onResizeColumnEnd:x.RESIZE_COLUMN_END,onChangeHeaderPosition:x.CHANGE_HEADER_POSITION,onSortClick:x.SORT_CLICK,onFreezeClick:x.FREEZE_CLICK,onScroll:x.SCROLL,onDropdownMenuClick:x.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:x.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:x.DRAG_SELECT_END,onDropdownIconClick:x.DROPDOWN_ICON_CLICK,onDropdownMenuClear:x.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:x.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:x.SHOW_MENU,onHideMenu:x.HIDE_MENU,onIconClick:x.ICON_CLICK,onLegendItemClick:x.LEGEND_ITEM_CLICK,onLegendItemHover:x.LEGEND_ITEM_HOVER,onLegendItemUnHover:x.LEGEND_ITEM_UNHOVER,onLegendChange:x.LEGEND_CHANGE,onMouseEnterAxis:x.MOUSEENTER_AXIS,onMouseLeaveAxis:x.MOUSELEAVE_AXIS,onCheckboxStateChange:x.CHECKBOX_STATE_CHANGE,onAfterRender:x.AFTER_RENDER,onInitialized:x.INITIALIZED,onPivotSortClick:x.PIVOT_SORT_CLICK,onDrillMenuClick:x.DRILLMENU_CLICK,onVChartEventType:x.VCHART_EVENT_TYPE},M=Object.keys(I),N=(e,t=I)=>{const r={};return Object.keys(e).forEach((n=>{t[n]&&(r[n]=e[n])})),r},D=(e,t,r,n=I)=>{if(!t&&!r||!e)return!1;const o=r?N(r,n):null,a=t?N(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},A=["children","hooks","ref",...M,"skipFunctionDiff","onError","onReady","option","records","container"],F=f.forwardRef(((e,t)=>{const[r,o]=l.useState(0),a=l.useRef({optionFromChildren:{}});l.useImperativeHandle(t,(()=>a.current.table));const u=!!e.option,i=!!e.records,c=l.useRef(!1),s=l.useRef(g(e,A)),d=l.useRef(e.records),y=f.useRef(null),m=!!e.skipFunctionDiff,h=l.useCallback((e=>u&&e.option?i&&e.records?{...e.option,records:e.records}:e.option:{records:e.records,...s.current,...a.current.optionFromChildren}),[u,i]),v=l.useCallback((e=>{let t;t="pivot-table"===e.type?new n.PivotTable(e.container,h(e)):"pivot-chart"===e.type?new n.PivotChart(e.container,h(e)):new n.ListTable(e.container,h(e)),a.current={...a.current,table:t}}),[h]),b=l.useCallback((()=>{D(a.current.table,e,y.current,I),c.current||(o(r+1),e.onReady&&e.onReady(a.current.table,0===r))}),[r,o,e]),_=l.useCallback((()=>{if(a.current.table){const t=a.current.table.renderAsync().then(b);e.onError&&t.catch(e.onError)}}),[b,e]);return l.useEffect((()=>{if(!a.current.table)return v(e),_(),D(a.current.table,e,null,I),a.current={...a.current,isChildrenUpdated:!1},void(y.current=e);if(u){if(S(y.current.option,e.option,{skipFunction:m})){if(i&&!S(y.current.records,e.records,{skipFunction:m})){y.current=e,a.current.table.setRecords(e.records);const t=a.current.table.renderAsync().then(b);e.onError&&t.catch(e.onError)}}else{y.current=e,a.current.table.updateOption(h(e));const t=a.current.table.renderAsync().then(b);e.onError&&t.catch(e.onError)}return}const t=g(e,A);if(!S(t,s.current,{skipFunction:m})||a.current.isChildrenUpdated){s.current=t,a.current.table.updateOption(h(e));const r=a.current.table.renderAsync().then(b);e.onError&&r.catch(e.onError)}else if(i&&!S(e.records,d.current,{skipFunction:m})){d.current=e.records,a.current.table.setRecords(e.records);const t=a.current.table.renderAsync().then(b);e.onError&&t.catch(e.onError)}a.current={...a.current,isChildrenUpdated:!1}}),[v,u,i,h,b,_,m,e]),l.useEffect((()=>()=>{a&&(a.current.table&&a.current.table.release(),a.current=null),c.current=!0}),[]),f.createElement(p.Provider,{value:a.current},$(e.children).map(((e,t)=>f.createElement(f.Fragment,{key:e?.props?.id??e?.id??`child-${t}`},f.cloneElement(e,{updateId:r})))))})),U=(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}(F,e,(e=>(e.type=t,r?r(e):t?{...e,type:t}:e)));return n.displayName=e,n},V=U("ListTable","list-table"),H=U("PivotTable","pivot-table"),z=U("PivotChart","pivot-chart");const B=(e,t,r,n)=>{const o=["id","updateId"],a=r?Object.keys(r).concat(o):o,u=e=>{const o=l.useContext(p),u=f.useRef(m(e.id)?j(t):e.id),i=f.useRef(null),c=f.useRef(e.updateId),s=f.useRef();if(e.updateId!==c.current){c.current=e.updateId;!!r&&D(o.table,e,i.current,r)&&(i.current=e)}else{const r=g(e,a);S(r,s.current)||(s.current=r,Y(o,u.current,t,n,r))}return l.useEffect((()=>()=>{r&&D(o.table,null,i.current,r),K(o,u.current,t,n)}),[]),null};return u.displayName=e,u},Y=(e,t,r,n,o)=>{if(e.optionFromChildren){if(n)e.optionFromChildren[r]={...o};else{e.optionFromChildren[r]||(e.optionFromChildren[r]=[]);const n=e.optionFromChildren[r],a=n.findIndex((e=>e.id===t));a>=0?n[a]={id:t,...o}:e.optionFromChildren[r].push({id:t,...o})}e.isChildrenUpdated=!0}},K=(e,t,r,n)=>{if(e.optionFromChildren)if(n)e.optionFromChildren[r]=null;else{const n=e.optionFromChildren[r]??[],o=n.findIndex((e=>e.id===t));if(o>=0){const t=n.slice(0,o-1).concat(n.slice(o+1));e.optionFromChildren[r]=t,e.isChildrenUpdated=!0}}},q=B("ListColumn","columns"),W=B("PivotColumnDimension","columns"),G=B("PivotRowDimension","rows"),X=B("PivotIndicator","indicators"),Z=B("PivotColumnHeaderTitle","columnHeaderTitle",void 0,!0),J=B("PivotRowHeaderTitle","rowHeaderTitle",void 0,!0),Q=B("PivotCorner","corner",void 0,!0),ee=B("Menu","menu",void 0,!0),te=B("Tooltip","tooltip",void 0,!0);e.ListColumn=q,e.ListTable=V,e.Menu=ee,e.PivotChart=z,e.PivotColumnDimension=W,e.PivotColumnHeaderTitle=Z,e.PivotCorner=Q,e.PivotIndicator=X,e.PivotRowDimension=G,e.PivotRowHeaderTitle=J,e.PivotTable=H,e.Tooltip=te,e.registerChartModule=function(e,t){n.register.chartModule(e,t)}}));
|
|
19
|
+
*/"production"===process.env.NODE_ENV?w.exports=function(){if(O)return R;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"),R.ContextConsumer=i,R.ContextProvider=u,R.Element=t,R.ForwardRef=s,R.Fragment=n,R.Lazy=d,R.Memo=p,R.Portal=r,R.Profiler=a,R.StrictMode=o,R.Suspense=l,R.SuspenseList=f,R.isAsyncMode=function(){return!1},R.isConcurrentMode=function(){return!1},R.isContextConsumer=function(e){return m(e)===i},R.isContextProvider=function(e){return m(e)===u},R.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},R.isForwardRef=function(e){return m(e)===s},R.isFragment=function(e){return m(e)===n},R.isLazy=function(e){return m(e)===d},R.isMemo=function(e){return m(e)===p},R.isPortal=function(e){return m(e)===r},R.isProfiler=function(e){return m(e)===a},R.isStrictMode=function(e){return m(e)===o},R.isSuspense=function(e){return m(e)===l},R.isSuspenseList=function(e){return m(e)===f},R.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)},R.typeOf=m,R}():w.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 h=m&&m.$$typeof;switch(h){case c:case i:case s:case d:case p:case u:return h;default:return y}}case r:return y}}}e=Symbol.for("react.module.reference");var h=i,v=u,b=t,_=s,g=n,E=d,C=p,S=r,O=a,w=o,R=l,k=f,T=!1,L=!1;P.ContextConsumer=h,P.ContextProvider=v,P.Element=b,P.ForwardRef=_,P.Fragment=g,P.Lazy=E,P.Memo=C,P.Portal=S,P.Profiler=O,P.StrictMode=w,P.Suspense=R,P.SuspenseList=k,P.isAsyncMode=function(e){return T||(T=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},P.isConcurrentMode=function(e){return L||(L=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},P.isContextConsumer=function(e){return m(e)===i},P.isContextProvider=function(e){return m(e)===u},P.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},P.isForwardRef=function(e){return m(e)===s},P.isFragment=function(e){return m(e)===n},P.isLazy=function(e){return m(e)===d},P.isMemo=function(e){return m(e)===p},P.isPortal=function(e){return m(e)===r},P.isProfiler=function(e){return m(e)===a},P.isStrictMode=function(e){return m(e)===o},P.isSuspense=function(e){return m(e)===l},P.isSuspenseList=function(e){return m(e)===f},P.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)},P.typeOf=m}()),P);var T=w.exports;let L=0;const j=e=>e?`${e}-${L++}`:""+L++,$=e=>{let t=[];return f.Children.forEach(e,(e=>{m(e)||(T.isFragment(e)?t=t.concat($(e.props.children)):t.push(e))})),t},x={...t.ListTable.EVENT_TYPE,...t.PivotTable.EVENT_TYPE,...t.PivotChart.EVENT_TYPE},I={onClickCell:x.CLICK_CELL,onDblClickCell:x.DBLCLICK_CELL,onMouseDownCell:x.MOUSEDOWN_CELL,onMouseUpCell:x.MOUSEUP_CELL,onSelectedCell:x.SELECTED_CELL,onKeyDown:x.KEYDOWN,onMouseEnterTable:x.MOUSEENTER_TABLE,onMouseLeaveTable:x.MOUSELEAVE_TABLE,onMouseMoveCell:x.MOUSEMOVE_CELL,onMouseEnterCell:x.MOUSEENTER_CELL,onMouseLeaveCell:x.MOUSELEAVE_CELL,onContextMenuCell:x.CONTEXTMENU_CELL,onResizeColumn:x.RESIZE_COLUMN,onResizeColumnEnd:x.RESIZE_COLUMN_END,onChangeHeaderPosition:x.CHANGE_HEADER_POSITION,onSortClick:x.SORT_CLICK,onFreezeClick:x.FREEZE_CLICK,onScroll:x.SCROLL,onDropdownMenuClick:x.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:x.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:x.DRAG_SELECT_END,onDropdownIconClick:x.DROPDOWN_ICON_CLICK,onDropdownMenuClear:x.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:x.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:x.SHOW_MENU,onHideMenu:x.HIDE_MENU,onIconClick:x.ICON_CLICK,onLegendItemClick:x.LEGEND_ITEM_CLICK,onLegendItemHover:x.LEGEND_ITEM_HOVER,onLegendItemUnHover:x.LEGEND_ITEM_UNHOVER,onLegendChange:x.LEGEND_CHANGE,onMouseEnterAxis:x.MOUSEENTER_AXIS,onMouseLeaveAxis:x.MOUSELEAVE_AXIS,onCheckboxStateChange:x.CHECKBOX_STATE_CHANGE,onAfterRender:x.AFTER_RENDER,onInitialized:x.INITIALIZED,onPivotSortClick:x.PIVOT_SORT_CLICK,onDrillMenuClick:x.DRILLMENU_CLICK,onVChartEventType:x.VCHART_EVENT_TYPE},M=Object.keys(I),N=(e,t=I)=>{const r={};return Object.keys(e).forEach((n=>{t[n]&&(r[n]=e[n])})),r},D=(e,t,r,n=I)=>{if(!t&&!r||!e)return!1;const o=r?N(r,n):null,a=t?N(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},A=["children","hooks","ref",...M,"skipFunctionDiff","onError","onReady","option","records","container"],F=f.forwardRef(((e,t)=>{const[r,o]=l.useState(0),a=l.useRef({optionFromChildren:{}});l.useImperativeHandle(t,(()=>a.current.table));const u=!!e.option,i=!!e.records,c=l.useRef(!1),s=l.useRef(g(e,A)),d=l.useRef(e.records),y=f.useRef(null),m=!!e.skipFunctionDiff,h=l.useCallback((e=>u&&e.option?i&&e.records?{...e.option,records:e.records}:e.option:{records:e.records,...s.current,...a.current.optionFromChildren}),[u,i]),v=l.useCallback((e=>{let t;t="pivot-table"===e.type?new n.PivotTable(e.container,h(e)):"pivot-chart"===e.type?new n.PivotChart(e.container,h(e)):new n.ListTable(e.container,h(e)),a.current={...a.current,table:t}}),[h]),b=l.useCallback((()=>{D(a.current.table,e,y.current,I),c.current||(o(r+1),e.onReady&&e.onReady(a.current.table,0===r))}),[r,o,e]),_=l.useCallback((()=>{if(a.current.table){const t=a.current.table.renderAsync().then(b);e.onError&&t.catch(e.onError)}}),[b,e]);return l.useEffect((()=>{if(!a.current?.table)return v(e),_(),D(a.current.table,e,null,I),a.current={...a.current,isChildrenUpdated:!1},void(y.current=e);if(u){if(S(y.current.option,e.option,{skipFunction:m})){if(i&&!S(y.current.records,e.records,{skipFunction:m})){y.current=e,a.current.table.setRecords(e.records);const t=a.current.table.renderAsync().then(b);e.onError&&t.catch(e.onError)}}else{y.current=e,a.current.table.updateOption(h(e));const t=a.current.table.renderAsync().then(b);e.onError&&t.catch(e.onError)}return}const t=g(e,A);if(!S(t,s.current,{skipFunction:m})||a.current.isChildrenUpdated){s.current=t,a.current.table.updateOption(h(e));const r=a.current.table.renderAsync().then(b);e.onError&&r.catch(e.onError)}else if(i&&!S(e.records,d.current,{skipFunction:m})){d.current=e.records,a.current.table.setRecords(e.records);const t=a.current.table.renderAsync().then(b);e.onError&&t.catch(e.onError)}a.current={...a.current,isChildrenUpdated:!1}}),[v,u,i,h,b,_,m,e]),l.useEffect((()=>()=>{a&&(a.current.table&&a.current.table.release(),a.current=null),c.current=!0}),[]),f.createElement(p.Provider,{value:a.current},$(e.children).map(((e,t)=>f.createElement(f.Fragment,{key:e?.props?.id??e?.id??`child-${t}`},f.cloneElement(e,{updateId:r})))))})),U=(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}(F,e,(e=>(e.type=t,r?r(e):t?{...e,type:t}:e)));return n.displayName=e,n},V=U("ListTable","list-table"),H=U("PivotTable","pivot-table"),z=U("PivotChart","pivot-chart");const B=(e,t,r,n)=>{const o=["id","updateId"],a=r?Object.keys(r).concat(o):o,u=e=>{const o=l.useContext(p),u=f.useRef(m(e.id)?j(t):e.id),i=f.useRef(null),c=f.useRef(e.updateId),s=f.useRef();if(e.updateId!==c.current){c.current=e.updateId;!!r&&D(o.table,e,i.current,r)&&(i.current=e)}else{const r=g(e,a);S(r,s.current)||(s.current=r,Y(o,u.current,t,n,r))}return l.useEffect((()=>()=>{r&&D(o.table,null,i.current,r),K(o,u.current,t,n)}),[]),null};return u.displayName=e,u},Y=(e,t,r,n,o)=>{if(e.optionFromChildren){if(n)e.optionFromChildren[r]={...o};else{e.optionFromChildren[r]||(e.optionFromChildren[r]=[]);const n=e.optionFromChildren[r],a=n.findIndex((e=>e.id===t));a>=0?n[a]={id:t,...o}:e.optionFromChildren[r].push({id:t,...o})}e.isChildrenUpdated=!0}},K=(e,t,r,n)=>{if(e.optionFromChildren)if(n)e.optionFromChildren[r]=null;else{const n=e.optionFromChildren[r]??[],o=n.findIndex((e=>e.id===t));if(o>=0){const t=n.slice(0,o-1).concat(n.slice(o+1));e.optionFromChildren[r]=t,e.isChildrenUpdated=!0}}},q=B("ListColumn","columns"),W=B("PivotColumnDimension","columns"),G=B("PivotRowDimension","rows"),X=B("PivotIndicator","indicators"),Z=B("PivotColumnHeaderTitle","columnHeaderTitle",void 0,!0),J=B("PivotRowHeaderTitle","rowHeaderTitle",void 0,!0),Q=B("PivotCorner","corner",void 0,!0),ee=B("Menu","menu",void 0,!0),te=B("Tooltip","tooltip",void 0,!0);e.ListColumn=q,e.ListTable=V,e.Menu=ee,e.PivotChart=z,e.PivotColumnDimension=W,e.PivotColumnHeaderTitle=Z,e.PivotCorner=Q,e.PivotIndicator=X,e.PivotRowDimension=G,e.PivotRowHeaderTitle=J,e.PivotTable=H,e.Tooltip=te,e.registerChartModule=function(e,t){n.register.chartModule(e,t)}}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseComponentProps } from '../base-component';
|
|
2
|
-
import type { TYPES } from '
|
|
2
|
+
import type { TYPES } from '@visactor/vtable';
|
|
3
3
|
export type MenuProps = {
|
|
4
4
|
renderMode?: 'canvas' | 'html';
|
|
5
5
|
defaultHeaderMenuItems?: TYPES.MenuListItem[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/component/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAcpD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAY,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"menu.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { TYPES } from '
|
|
1
|
+
{"version":3,"sources":["components/component/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAcpD,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAY,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"menu.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type MenuProps = {\n /** 代替原来的option.menuType html目前实现较完整 先默认html渲染方式*/\n renderMode?: 'canvas' | 'html';\n /** 内置下拉菜单的全局设置项 目前只针对基本表格有效 会对每个表头单元格开启默认的下拉菜单功能。代替原来的option.dropDownMenu*/\n defaultHeaderMenuItems?: TYPES.MenuListItem[];\n /** 右键菜单。代替原来的option.contextmenu */\n contextMenuItems?: TYPES.MenuListItem[] | ((field: string, row: number) => TYPES.MenuListItem[]);\n /** 设置选中状态的菜单。代替原来的option.dropDownMenuHighlight */\n dropDownMenuHighlight?: TYPES.DropDownMenuHighlightInfo[];\n} & BaseComponentProps;\n\nexport const Menu = createComponent<MenuProps>('Menu', 'menu', undefined, true);\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { BaseComponentProps } from '../base-component';
|
|
2
|
-
import type { ColumnDefine } from '
|
|
2
|
+
import type { ColumnDefine } from '@visactor/vtable';
|
|
3
3
|
export type ListColumnProps = ColumnDefine & BaseComponentProps;
|
|
4
|
-
export declare const ListColumn: import("react").FC<
|
|
4
|
+
export declare const ListColumn: import("react").FC<ListColumnProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/list/list-column.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAkB,YAAY,EAAE,SAAS,CAAC,CAAC","file":"list-column.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ColumnDefine } from '
|
|
1
|
+
{"version":3,"sources":["components/list/list-column.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAkB,YAAY,EAAE,SAAS,CAAC,CAAC","file":"list-column.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ColumnDefine } from '@visactor/vtable';\n\nexport type ListColumnProps = ColumnDefine & BaseComponentProps;\n\nexport const ListColumn = createComponent<ListColumnProps>('ListColumn', 'columns');\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { BaseComponentProps } from '../base-component';
|
|
2
|
-
import type { ICornerDefine } from '
|
|
2
|
+
import type { ICornerDefine } from '@visactor/vtable';
|
|
3
3
|
export type PivotCornerProps = ICornerDefine & BaseComponentProps;
|
|
4
|
-
export declare const PivotCorner: import("react").FC<
|
|
4
|
+
export declare const PivotCorner: import("react").FC<PivotCornerProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/pivot/pivot-corner.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAmB,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"pivot-corner.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ICornerDefine } from '
|
|
1
|
+
{"version":3,"sources":["components/pivot/pivot-corner.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAmB,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"pivot-corner.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ICornerDefine } from '@visactor/vtable';\n\nexport type PivotCornerProps = ICornerDefine & BaseComponentProps;\n\nexport const PivotCorner = createComponent<PivotCornerProps>('PivotCorner', 'corner', undefined, true);\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseComponentProps } from '../base-component';
|
|
2
|
-
import type { IDimension } from '
|
|
2
|
+
import type { IDimension } from '@visactor/vtable';
|
|
3
3
|
export type PivotDimensionProps = IDimension & BaseComponentProps;
|
|
4
|
-
export declare const PivotColumnDimension: import("react").FC<
|
|
5
|
-
export declare const PivotRowDimension: import("react").FC<
|
|
4
|
+
export declare const PivotColumnDimension: import("react").FC<PivotDimensionProps>;
|
|
5
|
+
export declare const PivotRowDimension: import("react").FC<PivotDimensionProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/pivot/pivot-dimension.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAsB,sBAAsB,EAAE,SAAS,CAAC,CAAC;AAC5G,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAsB,mBAAmB,EAAE,MAAM,CAAC,CAAC","file":"pivot-dimension.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IDimension } from '
|
|
1
|
+
{"version":3,"sources":["components/pivot/pivot-dimension.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAsB,sBAAsB,EAAE,SAAS,CAAC,CAAC;AAC5G,MAAM,CAAC,MAAM,iBAAiB,GAAG,eAAe,CAAsB,mBAAmB,EAAE,MAAM,CAAC,CAAC","file":"pivot-dimension.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IDimension } from '@visactor/vtable';\n\nexport type PivotDimensionProps = IDimension & BaseComponentProps;\n\nexport const PivotColumnDimension = createComponent<PivotDimensionProps>('PivotColumnDimension', 'columns');\nexport const PivotRowDimension = createComponent<PivotDimensionProps>('PivotRowDimension', 'rows');\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BaseComponentProps } from '../base-component';
|
|
2
|
-
import type { ITitleDefine } from '
|
|
2
|
+
import type { ITitleDefine } from '@visactor/vtable';
|
|
3
3
|
export type PivotHeaderTitleProps = ITitleDefine & BaseComponentProps;
|
|
4
|
-
export declare const PivotColumnHeaderTitle: import("react").FC<
|
|
5
|
-
export declare const PivotRowHeaderTitle: import("react").FC<
|
|
4
|
+
export declare const PivotColumnHeaderTitle: import("react").FC<PivotHeaderTitleProps>;
|
|
5
|
+
export declare const PivotRowHeaderTitle: import("react").FC<PivotHeaderTitleProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/pivot/pivot-header-title.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,eAAe,CACnD,wBAAwB,EACxB,mBAAmB,EACnB,SAAS,EACT,IAAI,CACL,CAAC;AACF,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAChD,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,IAAI,CACL,CAAC","file":"pivot-header-title.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ITitleDefine } from '
|
|
1
|
+
{"version":3,"sources":["components/pivot/pivot-header-title.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,eAAe,CACnD,wBAAwB,EACxB,mBAAmB,EACnB,SAAS,EACT,IAAI,CACL,CAAC;AACF,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAChD,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,IAAI,CACL,CAAC","file":"pivot-header-title.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ITitleDefine } from '@visactor/vtable';\n\nexport type PivotHeaderTitleProps = ITitleDefine & BaseComponentProps;\n\nexport const PivotColumnHeaderTitle = createComponent<PivotHeaderTitleProps>(\n 'PivotColumnHeaderTitle',\n 'columnHeaderTitle',\n undefined,\n true\n);\nexport const PivotRowHeaderTitle = createComponent<PivotHeaderTitleProps>(\n 'PivotRowHeaderTitle',\n 'rowHeaderTitle',\n undefined,\n true\n);\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { BaseComponentProps } from '../base-component';
|
|
2
|
-
import type { IIndicator } from '
|
|
2
|
+
import type { IIndicator } from '@visactor/vtable';
|
|
3
3
|
export type PivotIndicatorProps = IIndicator & BaseComponentProps;
|
|
4
|
-
export declare const PivotIndicator: import("react").FC<
|
|
4
|
+
export declare const PivotIndicator: import("react").FC<PivotIndicatorProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/pivot/pivot-indicator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAsB,gBAAgB,EAAE,YAAY,CAAC,CAAC","file":"pivot-indicator.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IIndicator } from '
|
|
1
|
+
{"version":3,"sources":["components/pivot/pivot-indicator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKpD,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAsB,gBAAgB,EAAE,YAAY,CAAC,CAAC","file":"pivot-indicator.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IIndicator } from '@visactor/vtable';\n\nexport type PivotIndicatorProps = IIndicator & BaseComponentProps;\n\nexport const PivotIndicator = createComponent<PivotIndicatorProps>('PivotIndicator', 'indicators');\n"]}
|
package/es/context/table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ListTable, PivotTable, PivotChart } from '
|
|
2
|
+
import type { ListTable, PivotTable, PivotChart } from '@visactor/vtable';
|
|
3
3
|
export interface TableContextType {
|
|
4
4
|
table?: ListTable | PivotTable | PivotChart;
|
|
5
5
|
optionFromChildren: any;
|
package/es/context/table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["context/table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AACjE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,MAAM,UAAU,iBAAiB,CAAI,SAAiC;IACpE,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAS,CAAC,KAAQ,EAAE,GAAG,EAAE,EAAE;QACrD,OAAO,CACL,oBAAC,YAAY,CAAC,QAAQ,QACnB,CAAC,GAAqB,EAAE,EAAE,CAAC,oBAAC,SAAS,kBAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAM,KAAK,EAAI,CAC1D,CACzB,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,eAAe,YAAY,CAAC","file":"table.js","sourcesContent":["import React from 'react';\nimport type { ListTable, PivotTable, PivotChart } from '
|
|
1
|
+
{"version":3,"sources":["context/table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AACjE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,MAAM,UAAU,iBAAiB,CAAI,SAAiC;IACpE,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAS,CAAC,KAAQ,EAAE,GAAG,EAAE,EAAE;QACrD,OAAO,CACL,oBAAC,YAAY,CAAC,QAAQ,QACnB,CAAC,GAAqB,EAAE,EAAE,CAAC,oBAAC,SAAS,kBAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAM,KAAK,EAAI,CAC1D,CACzB,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,eAAe,YAAY,CAAC","file":"table.js","sourcesContent":["import React from 'react';\nimport type { ListTable, PivotTable, PivotChart } from '@visactor/vtable';\n\nexport interface TableContextType {\n table?: ListTable | PivotTable | PivotChart;\n optionFromChildren: any;\n isChildrenUpdated?: boolean;\n}\n\nconst TableContext = React.createContext<TableContextType>(null);\nTableContext.displayName = 'TableContext';\n\nexport function withTableInstance<T>(Component: typeof React.Component) {\n const Com = React.forwardRef<any, T>((props: T, ref) => {\n return (\n <TableContext.Consumer>\n {(ctx: TableContextType) => <Component ref={ref} table={ctx.table} {...props} />}\n </TableContext.Consumer>\n );\n });\n Com.displayName = Component.name;\n return Com;\n}\n\nexport default TableContext;\n"]}
|
package/es/eventsUtils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IVTable } from './tables/base-table';
|
|
2
|
-
import type { TableEventHandlersEventArgumentMap } from '
|
|
2
|
+
import type { TableEventHandlersEventArgumentMap } from '@visactor/vtable/src/ts-types';
|
|
3
3
|
export type EventCallback<Params> = (params: Params) => void;
|
|
4
4
|
export interface EventsProps {
|
|
5
5
|
onClickCell?: EventCallback<TableEventHandlersEventArgumentMap['click_cell']>;
|
|
@@ -43,45 +43,45 @@ export interface EventsProps {
|
|
|
43
43
|
onVChartEventType?: EventCallback<TableEventHandlersEventArgumentMap['vchart_event_type']>;
|
|
44
44
|
}
|
|
45
45
|
export declare const TABLE_EVENTS: {
|
|
46
|
-
onClickCell:
|
|
47
|
-
onDblClickCell:
|
|
48
|
-
onMouseDownCell:
|
|
49
|
-
onMouseUpCell:
|
|
50
|
-
onSelectedCell:
|
|
51
|
-
onKeyDown:
|
|
52
|
-
onMouseEnterTable:
|
|
53
|
-
onMouseLeaveTable:
|
|
54
|
-
onMouseMoveCell:
|
|
55
|
-
onMouseEnterCell:
|
|
56
|
-
onMouseLeaveCell:
|
|
57
|
-
onContextMenuCell:
|
|
58
|
-
onResizeColumn:
|
|
59
|
-
onResizeColumnEnd:
|
|
60
|
-
onChangeHeaderPosition:
|
|
61
|
-
onSortClick:
|
|
62
|
-
onFreezeClick:
|
|
63
|
-
onScroll:
|
|
64
|
-
onDropdownMenuClick:
|
|
65
|
-
onMouseOverChartSymbol:
|
|
66
|
-
onDragSelectEnd:
|
|
67
|
-
onDropdownIconClick:
|
|
68
|
-
onDropdownMenuClear:
|
|
69
|
-
onTreeHierarchyStateChange:
|
|
70
|
-
onShowMenu:
|
|
71
|
-
onHideMenu:
|
|
72
|
-
onIconClick:
|
|
73
|
-
onLegendItemClick:
|
|
74
|
-
onLegendItemHover:
|
|
75
|
-
onLegendItemUnHover:
|
|
76
|
-
onLegendChange:
|
|
77
|
-
onMouseEnterAxis:
|
|
78
|
-
onMouseLeaveAxis:
|
|
79
|
-
onCheckboxStateChange:
|
|
80
|
-
onAfterRender:
|
|
81
|
-
onInitialized:
|
|
82
|
-
onPivotSortClick:
|
|
83
|
-
onDrillMenuClick:
|
|
84
|
-
onVChartEventType:
|
|
46
|
+
onClickCell: "click_cell";
|
|
47
|
+
onDblClickCell: "dblclick_cell";
|
|
48
|
+
onMouseDownCell: "mousedown_cell";
|
|
49
|
+
onMouseUpCell: "mouseup_cell";
|
|
50
|
+
onSelectedCell: "selected_cell";
|
|
51
|
+
onKeyDown: "keydown";
|
|
52
|
+
onMouseEnterTable: "mouseenter_table";
|
|
53
|
+
onMouseLeaveTable: "mouseleave_table";
|
|
54
|
+
onMouseMoveCell: "mousemove_cell";
|
|
55
|
+
onMouseEnterCell: "mouseenter_cell";
|
|
56
|
+
onMouseLeaveCell: "mouseleave_cell";
|
|
57
|
+
onContextMenuCell: "contextmenu_cell";
|
|
58
|
+
onResizeColumn: "resize_column";
|
|
59
|
+
onResizeColumnEnd: "resize_column_end";
|
|
60
|
+
onChangeHeaderPosition: "change_header_position";
|
|
61
|
+
onSortClick: "sort_click";
|
|
62
|
+
onFreezeClick: "freeze_click";
|
|
63
|
+
onScroll: "scroll";
|
|
64
|
+
onDropdownMenuClick: "dropdown_menu_click";
|
|
65
|
+
onMouseOverChartSymbol: "mouseover_chart_symbol";
|
|
66
|
+
onDragSelectEnd: "drag_select_end";
|
|
67
|
+
onDropdownIconClick: "dropdown_icon_click";
|
|
68
|
+
onDropdownMenuClear: "dropdown_menu_clear";
|
|
69
|
+
onTreeHierarchyStateChange: "tree_hierarchy_state_change";
|
|
70
|
+
onShowMenu: "show_menu";
|
|
71
|
+
onHideMenu: "hide_menu";
|
|
72
|
+
onIconClick: "icon_click";
|
|
73
|
+
onLegendItemClick: "legend_item_click";
|
|
74
|
+
onLegendItemHover: "legend_item_hover";
|
|
75
|
+
onLegendItemUnHover: "legend_item_unHover";
|
|
76
|
+
onLegendChange: "legend_change";
|
|
77
|
+
onMouseEnterAxis: "mouseenter_axis";
|
|
78
|
+
onMouseLeaveAxis: "mouseleave_axis";
|
|
79
|
+
onCheckboxStateChange: "checkbox_state_change";
|
|
80
|
+
onAfterRender: "after_render";
|
|
81
|
+
onInitialized: "initialized";
|
|
82
|
+
onPivotSortClick: "pivot_sort_click";
|
|
83
|
+
onDrillMenuClick: "drillmenu_click";
|
|
84
|
+
onVChartEventType: "vchart_event_type";
|
|
85
85
|
};
|
|
86
86
|
export declare const TABLE_EVENTS_KEYS: string[];
|
|
87
87
|
export declare const findEventProps: <T extends EventsProps>(props: T, supportedEvents?: Record<string, string>) => EventsProps;
|
package/es/eventsUtils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ListTable, PivotTable, PivotChart } from "
|
|
1
|
+
import { ListTable, PivotTable, PivotChart } from "@visactor/vtable";
|
|
2
2
|
|
|
3
3
|
const EVENT_TYPE = Object.assign(Object.assign(Object.assign({}, ListTable.EVENT_TYPE), PivotTable.EVENT_TYPE), PivotChart.EVENT_TYPE);
|
|
4
4
|
|
package/es/eventsUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAMhF,MAAM,UAAU,iDACX,SAAS,CAAC,UAAU,GACpB,UAAU,CAAC,UAAU,GACrB,UAAU,CAAC,UAAU,CACzB,CAAC;AAuDF,MAAM,CAAC,MAAM,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,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;IAClC,aAAa,EAAE,UAAU,CAAC,YAAY;IACtC,QAAQ,EAAE,UAAU,CAAC,MAAM;IAC3B,mBAAmB,EAAE,UAAU,CAAC,mBAAmB;IACnD,sBAAsB,EAAE,UAAU,CAAC,sBA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.js","sourcesContent":["import { ListTable, PivotTable, PivotChart } from './../../vtable/src/index.ts';\nimport type { IVTable } from './tables/base-table';\nimport type { TableEventHandlersEventArgumentMap } from './../../vtable/src/index.ts/src/ts-types';\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<TableEventHandlersEventArgumentMap['click_cell']>;\n onDblClickCell?: EventCallback<TableEventHandlersEventArgumentMap['dblclick_cell']>;\n onMouseDownCell?: EventCallback<TableEventHandlersEventArgumentMap['mousedown_cell']>;\n onMouseUpCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseup_cell']>;\n onSelectedCell?: EventCallback<TableEventHandlersEventArgumentMap['selected_cell']>;\n onKeyDown?: EventCallback<TableEventHandlersEventArgumentMap['keydown']>;\n onMouseEnterTable?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_table']>;\n onMouseLeaveTable?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_table']>;\n onMouseMoveCell?: EventCallback<TableEventHandlersEventArgumentMap['mousemove_cell']>;\n onMouseEnterCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_cell']>;\n onMouseLeaveCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_cell']>;\n onContextMenuCell?: EventCallback<TableEventHandlersEventArgumentMap['contextmenu_cell']>;\n onResizeColumn?: EventCallback<TableEventHandlersEventArgumentMap['resize_column']>;\n onResizeColumnEnd?: EventCallback<TableEventHandlersEventArgumentMap['resize_column_end']>;\n onChangeHeaderPosition?: EventCallback<TableEventHandlersEventArgumentMap['change_header_position']>;\n onSortClick?: EventCallback<TableEventHandlersEventArgumentMap['sort_click']>;\n onFreezeClick?: EventCallback<TableEventHandlersEventArgumentMap['freeze_click']>;\n onScroll?: EventCallback<TableEventHandlersEventArgumentMap['scroll']>;\n onDropdownMenuClick?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_menu_click']>;\n onMouseOverChartSymbol?: EventCallback<TableEventHandlersEventArgumentMap['mouseover_chart_symbol']>;\n onDragSelectEnd?: EventCallback<TableEventHandlersEventArgumentMap['drag_select_end']>;\n\n onDropdownIconClick?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_icon_click']>;\n onDropdownMenuClear?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_menu_clear']>;\n\n onTreeHierarchyStateChange?: EventCallback<TableEventHandlersEventArgumentMap['tree_hierarchy_state_change']>;\n\n onShowMenu?: EventCallback<TableEventHandlersEventArgumentMap['show_menu']>;\n onHideMenu?: EventCallback<TableEventHandlersEventArgumentMap['hide_menu']>;\n\n onIconClick?: EventCallback<TableEventHandlersEventArgumentMap['icon_click']>;\n\n onLegendItemClick?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_click']>;\n onLegendItemHover?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_hover']>;\n onLegendItemUnHover?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_unHover']>;\n onLegendChange?: EventCallback<TableEventHandlersEventArgumentMap['legend_change']>;\n\n onMouseEnterAxis?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_axis']>;\n onMouseLeaveAxis?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_axis']>;\n\n onCheckboxStateChange?: EventCallback<TableEventHandlersEventArgumentMap['checkbox_state_change']>;\n onAfterRender?: EventCallback<TableEventHandlersEventArgumentMap['after_render']>;\n onInitialized?: EventCallback<TableEventHandlersEventArgumentMap['initialized']>;\n\n // pivot table only\n onPivotSortClick?: EventCallback<TableEventHandlersEventArgumentMap['pivot_sort_click']>;\n onDrillMenuClick?: EventCallback<TableEventHandlersEventArgumentMap['drillmenu_click']>;\n\n // pivot chart only\n onVChartEventType?: EventCallback<TableEventHandlersEventArgumentMap['vchart_event_type']>;\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\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]) {\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 TableEventHandlersEventArgumentMap, newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["eventsUtils.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AAG,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACrF,MAAM,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAElF,IAAI,cAAc,EAAE;QAClB,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,QAAQ,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,CAA6C,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC1G;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 { TableEventHandlersEventArgumentMap } from '@visactor/vtable/src/ts-types';\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<TableEventHandlersEventArgumentMap['click_cell']>;\n onDblClickCell?: EventCallback<TableEventHandlersEventArgumentMap['dblclick_cell']>;\n onMouseDownCell?: EventCallback<TableEventHandlersEventArgumentMap['mousedown_cell']>;\n onMouseUpCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseup_cell']>;\n onSelectedCell?: EventCallback<TableEventHandlersEventArgumentMap['selected_cell']>;\n onKeyDown?: EventCallback<TableEventHandlersEventArgumentMap['keydown']>;\n onMouseEnterTable?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_table']>;\n onMouseLeaveTable?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_table']>;\n onMouseMoveCell?: EventCallback<TableEventHandlersEventArgumentMap['mousemove_cell']>;\n onMouseEnterCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_cell']>;\n onMouseLeaveCell?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_cell']>;\n onContextMenuCell?: EventCallback<TableEventHandlersEventArgumentMap['contextmenu_cell']>;\n onResizeColumn?: EventCallback<TableEventHandlersEventArgumentMap['resize_column']>;\n onResizeColumnEnd?: EventCallback<TableEventHandlersEventArgumentMap['resize_column_end']>;\n onChangeHeaderPosition?: EventCallback<TableEventHandlersEventArgumentMap['change_header_position']>;\n onSortClick?: EventCallback<TableEventHandlersEventArgumentMap['sort_click']>;\n onFreezeClick?: EventCallback<TableEventHandlersEventArgumentMap['freeze_click']>;\n onScroll?: EventCallback<TableEventHandlersEventArgumentMap['scroll']>;\n onDropdownMenuClick?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_menu_click']>;\n onMouseOverChartSymbol?: EventCallback<TableEventHandlersEventArgumentMap['mouseover_chart_symbol']>;\n onDragSelectEnd?: EventCallback<TableEventHandlersEventArgumentMap['drag_select_end']>;\n\n onDropdownIconClick?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_icon_click']>;\n onDropdownMenuClear?: EventCallback<TableEventHandlersEventArgumentMap['dropdown_menu_clear']>;\n\n onTreeHierarchyStateChange?: EventCallback<TableEventHandlersEventArgumentMap['tree_hierarchy_state_change']>;\n\n onShowMenu?: EventCallback<TableEventHandlersEventArgumentMap['show_menu']>;\n onHideMenu?: EventCallback<TableEventHandlersEventArgumentMap['hide_menu']>;\n\n onIconClick?: EventCallback<TableEventHandlersEventArgumentMap['icon_click']>;\n\n onLegendItemClick?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_click']>;\n onLegendItemHover?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_hover']>;\n onLegendItemUnHover?: EventCallback<TableEventHandlersEventArgumentMap['legend_item_unHover']>;\n onLegendChange?: EventCallback<TableEventHandlersEventArgumentMap['legend_change']>;\n\n onMouseEnterAxis?: EventCallback<TableEventHandlersEventArgumentMap['mouseenter_axis']>;\n onMouseLeaveAxis?: EventCallback<TableEventHandlersEventArgumentMap['mouseleave_axis']>;\n\n onCheckboxStateChange?: EventCallback<TableEventHandlersEventArgumentMap['checkbox_state_change']>;\n onAfterRender?: EventCallback<TableEventHandlersEventArgumentMap['after_render']>;\n onInitialized?: EventCallback<TableEventHandlersEventArgumentMap['initialized']>;\n\n // pivot table only\n onPivotSortClick?: EventCallback<TableEventHandlersEventArgumentMap['pivot_sort_click']>;\n onDrillMenuClick?: EventCallback<TableEventHandlersEventArgumentMap['drillmenu_click']>;\n\n // pivot chart only\n onVChartEventType?: EventCallback<TableEventHandlersEventArgumentMap['vchart_event_type']>;\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\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]) {\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 TableEventHandlersEventArgumentMap, newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
|
package/es/index_old.js
CHANGED
package/es/index_old.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index_old.tsx"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"sources":["index_old.tsx"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAI1C,MAAM,CAAC,MAAM,WAAW,GAAc,KAAK,CAAC,EAAE;IAC5C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,KAAmB,KAAK,EAAnB,SAAS,UAAK,KAAK,EAA9D,qCAAsD,CAAQ,CAAC;IACrE,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,YAAY,CAAC,OAAO,EAAE;YACxB,MAAM,CAAC,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;YACxC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;SACvB;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,2CACE,KAAK,kCACA,KAAK,KACR,MAAM,OAEJ,SAAS,IACb,GAAG,EAAE,YAAY,EACjB,EAAE,EAAC,cAAc,IACjB,CACH,CAAC;AACJ,CAAC,CAAC","file":"index_old.js","sourcesContent":["/* eslint-disable @typescript-eslint/no-duplicate-imports */\n/* eslint-disable @typescript-eslint/consistent-type-imports */\nimport { ListTable } from '@visactor/vtable';\nimport type { FC } from 'react';\nimport React from 'react';\nimport { useEffect, useRef } from 'react';\n\ntype Props = React.PropsWithChildren<any>;\n\nexport const ReactVTable: FC<Props> = props => {\n const { type, option, height = '100%', style, ...restProps } = props;\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (containerRef.current) {\n option.container = containerRef.current;\n new ListTable(option);\n }\n }, [option, type]);\n\n return (\n <div\n style={{\n ...style,\n height\n }}\n {...restProps}\n ref={containerRef}\n id=\"react-VTable\"\n />\n );\n};\n"]}
|
package/es/tables/base-table.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as VTable from "
|
|
1
|
+
import * as VTable from "@visactor/vtable";
|
|
2
2
|
|
|
3
3
|
import React, { useState, useEffect, useRef, useImperativeHandle, useCallback } from "react";
|
|
4
4
|
|
|
@@ -39,7 +39,9 @@ const notOptionKeys = [ ...REACT_PRIVATE_PROPS, ...TABLE_EVENTS_KEYS, "skipFunct
|
|
|
39
39
|
}
|
|
40
40
|
}), [ handleTableRender, props ]);
|
|
41
41
|
return useEffect((() => {
|
|
42
|
-
|
|
42
|
+
var _a;
|
|
43
|
+
if (!(null === (_a = tableContext.current) || void 0 === _a ? void 0 : _a.table)) return createTable(props),
|
|
44
|
+
renderTable(), bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS),
|
|
43
45
|
tableContext.current = Object.assign(Object.assign({}, tableContext.current), {
|
|
44
46
|
isChildrenUpdated: !1
|
|
45
47
|
}), void (eventsBinded.current = props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAC;AACzD,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,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxD,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;AA0BpF,MAAM,aAAa,GAAG;IACpB,GAAG,mBAAmB;IACtB,GAAG,iBAAiB;IACpB,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,WAA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b,KAAK,uBAAL,KAAK,CAAU,EAAE,mCAAI,SAAS,KAAK,EAAE,IACrF,KAAK,CAAC,YAAY,CAAC,KAAqB,EAAE;YACzC,QAAQ,EAAE,QAAQ;SACnB,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 */\n// import type { IData, IInitOption, ISpec } from '@visactor/vchart';\n// import VChart from '@visactor/vchart';\nimport * as VTable from './../../../vtable/src/index.ts';\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, 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;\n\nexport interface BaseTableProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: any;\n /** 数据 */\n records?: any;\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 BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const tableContext = useRef<TableContextType>({\n optionFromChildren: {}\n });\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 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\n return {\n records: props.records,\n ...prevOption.current,\n ...tableContext.current.optionFromChildren\n };\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 },\n [parseOption]\n );\n\n const handleTableRender = useCallback(() => {\n // rebind events after render\n bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS);\n\n if (!isUnmount.current) {\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 const renderPromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n renderPromise.catch(props.onError);\n }\n }\n }, [handleTableRender, props]);\n\n useEffect(() => {\n if (!tableContext.current.table) {\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 const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\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);\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\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 ) {\n prevOption.current = newOption;\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n tableContext.current.table.setRecords(props.records);\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\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.table) {\n tableContext.current.table.release();\n }\n tableContext.current = null;\n }\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 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 );\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,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM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C,QAAQ,IAAC,KAAK,EAAE,YAAY,CAAC,OAAO,IACnD,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAsB,EAAE,KAAa,EAAE,EAAE;;QACrE,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,MAAA,MAAA,MAAC,KAAa,aAAb,KAAK,uBAAL,KAAK,CAAU,KAAK,0CAAE,EAAE,mCAAK,KAAa,aAAb,KAAK,uBAAL,KAAK,CAAU,EAAE,mCAAI,SAAS,KAAK,EAAE,IACrF,KAAK,CAAC,YAAY,CAAC,KAAqB,EAAE;YACzC,QAAQ,EAAE,QAAQ;SACnB,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, 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;\n\nexport interface BaseTableProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: any;\n /** 数据 */\n records?: any;\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 BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const tableContext = useRef<TableContextType>({\n optionFromChildren: {}\n });\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 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\n return {\n records: props.records,\n ...prevOption.current,\n ...tableContext.current.optionFromChildren\n };\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 },\n [parseOption]\n );\n\n const handleTableRender = useCallback(() => {\n // rebind events after render\n bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS);\n\n if (!isUnmount.current) {\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 const renderPromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n renderPromise.catch(props.onError);\n }\n }\n }, [handleTableRender, props]);\n\n useEffect(() => {\n if (!tableContext.current?.table) {\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 const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\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);\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\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 ) {\n prevOption.current = newOption;\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n tableContext.current.table.setRecords(props.records);\n const updatePromise = tableContext.current.table.renderAsync().then(handleTableRender);\n\n if (props.onError) {\n updatePromise.catch(props.onError);\n }\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.table) {\n tableContext.current.table.release();\n }\n tableContext.current = null;\n }\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 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 );\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,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { ListTableConstructorOptions } from '
|
|
2
|
+
import type { ListTableConstructorOptions } from '@visactor/vtable';
|
|
3
3
|
import type { BaseTableProps } from './base-table';
|
|
4
4
|
export interface ListTableProps extends Omit<BaseTableProps, 'option' | 'records' | 'type'>, Omit<ListTableConstructorOptions, 'container'> {
|
|
5
5
|
}
|
|
6
|
-
export declare const ListTable: React.ForwardRefExoticComponent<
|
|
6
|
+
export declare const ListTable: React.ForwardRefExoticComponent<ListTableProps & {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
-
} & import("../containers/withContainer").ContainerProps
|
|
8
|
+
} & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tables/list-table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAA0C,WAAW,EAAE,YAAY,CAAC,CAAC","file":"list-table.js","sourcesContent":["import type React from 'react';\nimport type { ListTableConstructorOptions } from '
|
|
1
|
+
{"version":3,"sources":["tables/list-table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAA0C,WAAW,EAAE,YAAY,CAAC,CAAC","file":"list-table.js","sourcesContent":["import type React from 'react';\nimport type { ListTableConstructorOptions } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface ListTableProps\n extends Omit<BaseTableProps, 'option' | 'records' | 'type'>,\n Omit<ListTableConstructorOptions, 'container'> {}\n\nexport const ListTable = createTable<React.PropsWithChildren<ListTableProps>>('ListTable', 'list-table');\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { PivotChartConstructorOptions } from '
|
|
2
|
+
import type { PivotChartConstructorOptions } from '@visactor/vtable';
|
|
3
3
|
import type { BaseTableProps } from './base-table';
|
|
4
4
|
export interface PivotChartProps extends Omit<BaseTableProps, 'option' | 'records' | 'type'>, Omit<PivotChartConstructorOptions, 'container'> {
|
|
5
5
|
}
|
|
6
|
-
export declare const PivotChart: React.ForwardRefExoticComponent<
|
|
6
|
+
export declare const PivotChart: React.ForwardRefExoticComponent<PivotChartProps & {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
-
} & import("../containers/withContainer").ContainerProps
|
|
8
|
+
} & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
|
|
9
9
|
export declare function registerChartModule(name: string, chart: any): void;
|
package/es/tables/pivot-chart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tables/pivot-chart.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,
|
|
1
|
+
{"version":3,"sources":["tables/pivot-chart.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAA2C,YAAY,EAAE,aAAa,CAAC,CAAC;AAE7G,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,KAAU;IAC1D,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC","file":"pivot-chart.js","sourcesContent":["import type React from 'react';\nimport * as VTable from '@visactor/vtable';\nimport type { PivotChartConstructorOptions } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface PivotChartProps\n extends Omit<BaseTableProps, 'option' | 'records' | 'type'>,\n Omit<PivotChartConstructorOptions, 'container'> {}\n\nexport const PivotChart = createTable<React.PropsWithChildren<PivotChartProps>>('PivotChart', 'pivot-chart');\n\nexport function registerChartModule(name: string, chart: any) {\n VTable.register.chartModule(name, chart);\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
import type { PivotTableConstructorOptions } from '
|
|
2
|
+
import type { PivotTableConstructorOptions } from '@visactor/vtable';
|
|
3
3
|
import type { BaseTableProps } from './base-table';
|
|
4
4
|
export interface PivotTableProps extends Omit<BaseTableProps, 'option' | 'records' | 'type'>, Omit<PivotTableConstructorOptions, 'container'> {
|
|
5
5
|
}
|
|
6
|
-
export declare const PivotTable: React.ForwardRefExoticComponent<
|
|
6
|
+
export declare const PivotTable: React.ForwardRefExoticComponent<PivotTableProps & {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
-
} & import("../containers/withContainer").ContainerProps
|
|
8
|
+
} & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tables/pivot-table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAA2C,YAAY,EAAE,aAAa,CAAC,CAAC","file":"pivot-table.js","sourcesContent":["import type React from 'react';\nimport type { PivotTableConstructorOptions } from '
|
|
1
|
+
{"version":3,"sources":["tables/pivot-table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAA2C,YAAY,EAAE,aAAa,CAAC,CAAC","file":"pivot-table.js","sourcesContent":["import type React from 'react';\nimport type { PivotTableConstructorOptions } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface PivotTableProps\n extends Omit<BaseTableProps, 'option' | 'records' | 'type'>,\n Omit<PivotTableConstructorOptions, 'container'> {}\n\nexport const PivotTable = createTable<React.PropsWithChildren<PivotTableProps>>('PivotTable', 'pivot-table');\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/react-vtable",
|
|
3
|
-
"version": "0.15.0
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "The react version of VTable",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@visactor/vtable": "0.15.0-alpha.2",
|
|
47
46
|
"@visactor/vutils": "~0.16.10",
|
|
48
|
-
"react-is": "^18.2.0"
|
|
47
|
+
"react-is": "^18.2.0",
|
|
48
|
+
"@visactor/vtable": "0.15.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@visactor/vchart": "1.6.0",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"axios": "^1.4.0",
|
|
90
90
|
"@types/react-is": "^17.0.3",
|
|
91
91
|
"@internal/bundler": "0.0.1",
|
|
92
|
-
"@internal/
|
|
93
|
-
"@internal/
|
|
92
|
+
"@internal/ts-config": "0.0.1",
|
|
93
|
+
"@internal/eslint-config": "0.0.1"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"start": "vite ./demo",
|