@visactor/react-vtable 1.3.0 → 1.4.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.d.ts CHANGED
@@ -2,4 +2,4 @@ import * as VTable from '@visactor/vtable';
2
2
  export * from './tables';
3
3
  export * from './components';
4
4
  export { VTable };
5
- export declare const version = "1.3.0";
5
+ export declare const version = "1.4.0-alpha.0";
package/cjs/index.js CHANGED
@@ -34,4 +34,4 @@ Object.defineProperty(exports, "__esModule", {
34
34
  const VTable = __importStar(require("@visactor/vtable"));
35
35
 
36
36
  exports.VTable = VTable, __exportStar(require("./tables"), exports), __exportStar(require("./components"), exports),
37
- exports.version = "1.3.0";
37
+ exports.version = "1.4.0-alpha.0";
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAIlC,wBAAM;AAFf,2CAAyB;AACzB,+CAA6B;AAGhB,QAAA,OAAO,GAAG,OAAO,CAAC","file":"index.js","sourcesContent":["import * as VTable from '@visactor/vtable';\n\nexport * from './tables';\nexport * from './components';\nexport { VTable };\n\nexport const version = \"1.3.0\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAIlC,wBAAM;AAFf,2CAAyB;AACzB,+CAA6B;AAGhB,QAAA,OAAO,GAAG,eAAe,CAAC","file":"index.js","sourcesContent":["import * as VTable from '@visactor/vtable';\n\nexport * from './tables';\nexport * from './components';\nexport { VTable };\n\nexport const version = \"1.4.0-alpha.0\";\n"]}
@@ -3755,7 +3755,7 @@
3755
3755
  return 0;
3756
3756
  }
3757
3757
 
3758
- const version = "1.3.0";
3758
+ const version = "1.4.0-alpha.0";
3759
3759
 
3760
3760
  exports.VTable = VTable__namespace;
3761
3761
  exports.CustomComponent = CustomComponent;
@@ -16,4 +16,4 @@
16
16
  *
17
17
  * This source code is licensed under the MIT license found in the
18
18
  * LICENSE file in the root directory of this source tree.
19
- */"production"===process.env.NODE_ENV?j.exports=function(){if(N)return x;N=1;var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var y=e.$$typeof;switch(y){case t:switch(e=e.type){case n:case a:case o:case l:case f:return e;default:switch(e=e&&e.$$typeof){case c:case i:case s:case d:case p:case u:return e;default:return y}}case r:return y}}}return e=Symbol.for("react.module.reference"),x.ContextConsumer=i,x.ContextProvider=u,x.Element=t,x.ForwardRef=s,x.Fragment=n,x.Lazy=d,x.Memo=p,x.Portal=r,x.Profiler=a,x.StrictMode=o,x.Suspense=l,x.SuspenseList=f,x.isAsyncMode=function(){return!1},x.isConcurrentMode=function(){return!1},x.isContextConsumer=function(e){return m(e)===i},x.isContextProvider=function(e){return m(e)===u},x.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},x.isForwardRef=function(e){return m(e)===s},x.isFragment=function(e){return m(e)===n},x.isLazy=function(e){return m(e)===d},x.isMemo=function(e){return m(e)===p},x.isPortal=function(e){return m(e)===r},x.isProfiler=function(e){return m(e)===a},x.isStrictMode=function(e){return m(e)===o},x.isSuspense=function(e){return m(e)===l},x.isSuspenseList=function(e){return m(e)===f},x.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===a||t===o||t===l||t===f||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===p||t.$$typeof===u||t.$$typeof===i||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},x.typeOf=m,x}():j.exports=($||($=1,"production"!==process.env.NODE_ENV&&function(){var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var y=e.$$typeof;switch(y){case t:var m=e.type;switch(m){case n:case a:case o:case l:case f:return m;default:var h=m&&m.$$typeof;switch(h){case c:case i:case s:case d:case p:case u:return h;default:return y}}case r:return y}}}e=Symbol.for("react.module.reference");var h=i,v=u,b=t,g=s,_=n,E=d,C=p,S=r,O=a,w=o,R=l,k=f,L=!1,T=!1;I.ContextConsumer=h,I.ContextProvider=v,I.Element=b,I.ForwardRef=g,I.Fragment=_,I.Lazy=E,I.Memo=C,I.Portal=S,I.Profiler=O,I.StrictMode=w,I.Suspense=R,I.SuspenseList=k,I.isAsyncMode=function(e){return L||(L=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},I.isConcurrentMode=function(e){return T||(T=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},I.isContextConsumer=function(e){return m(e)===i},I.isContextProvider=function(e){return m(e)===u},I.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},I.isForwardRef=function(e){return m(e)===s},I.isFragment=function(e){return m(e)===n},I.isLazy=function(e){return m(e)===d},I.isMemo=function(e){return m(e)===p},I.isPortal=function(e){return m(e)===r},I.isProfiler=function(e){return m(e)===a},I.isStrictMode=function(e){return m(e)===o},I.isSuspense=function(e){return m(e)===l},I.isSuspenseList=function(e){return m(e)===f},I.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===a||t===o||t===l||t===f||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===p||t.$$typeof===u||t.$$typeof===i||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},I.typeOf=m}()),I);var M=j.exports;const D=e=>{let t=[];return f.Children.forEach(e,(e=>{m(e)||(M.isFragment(e)?t=t.concat(D(e.props.children)):t.push(e))})),t},A={...t.ListTable.EVENT_TYPE,...t.PivotTable.EVENT_TYPE,...t.PivotChart.EVENT_TYPE},F={onClickCell:A.CLICK_CELL,onDblClickCell:A.DBLCLICK_CELL,onMouseDownCell:A.MOUSEDOWN_CELL,onMouseUpCell:A.MOUSEUP_CELL,onSelectedCell:A.SELECTED_CELL,onSelectedClear:A.SELECTED_CLEAR,onKeyDown:A.KEYDOWN,onMouseEnterTable:A.MOUSEENTER_TABLE,onMouseLeaveTable:A.MOUSELEAVE_TABLE,onMouseDownTable:A.MOUSEDOWN_TABLE,onMouseMoveCell:A.MOUSEMOVE_CELL,onMouseEnterCell:A.MOUSEENTER_CELL,onMouseLeaveCell:A.MOUSELEAVE_CELL,onContextMenuCell:A.CONTEXTMENU_CELL,onResizeColumn:A.RESIZE_COLUMN,onResizeColumnEnd:A.RESIZE_COLUMN_END,onChangeHeaderPosition:A.CHANGE_HEADER_POSITION,onSortClick:A.SORT_CLICK,onFreezeClick:A.FREEZE_CLICK,onScroll:A.SCROLL,onDropdownMenuClick:A.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:A.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:A.DRAG_SELECT_END,onDropdownIconClick:A.DROPDOWN_ICON_CLICK,onDropdownMenuClear:A.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:A.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:A.SHOW_MENU,onHideMenu:A.HIDE_MENU,onIconClick:A.ICON_CLICK,onLegendItemClick:A.LEGEND_ITEM_CLICK,onLegendItemHover:A.LEGEND_ITEM_HOVER,onLegendItemUnHover:A.LEGEND_ITEM_UNHOVER,onLegendChange:A.LEGEND_CHANGE,onMouseEnterAxis:A.MOUSEENTER_AXIS,onMouseLeaveAxis:A.MOUSELEAVE_AXIS,onCheckboxStateChange:A.CHECKBOX_STATE_CHANGE,onRadioStateChange:A.RADIO_STATE_CHANGE,onAfterRender:A.AFTER_RENDER,onInitialized:A.INITIALIZED,onPivotSortClick:A.PIVOT_SORT_CLICK,onDrillMenuClick:A.DRILLMENU_CLICK,onVChartEventType:A.VCHART_EVENT_TYPE,onChangCellValue:A.CHANGE_CELL_VALUE,onMousedownFillHandle:A.MOUSEDOWN_FILL_HANDLE,onDragFillHandleEnd:A.DRAG_FILL_HANDLE_END,onDblclickFillHandle:A.DBLCLICK_FILL_HANDLE,onScrollVerticalEnd:A.SCROLL_VERTICAL_END,onScrollHorizontalEnd:A.SCROLL_HORIZONTAL_END},V=Object.keys(F),H=(e,t=F)=>{const r={};return Object.keys(e).forEach((n=>{t[n]&&e[n]&&(r[n]=e[n])})),r},U=(e,t,r,n=F)=>{if(!t&&!r||!e)return!1;const o=r?H(r,n):null,a=t?H(t,n):null;return o&&Object.keys(o).forEach((t=>{a&&a[t]&&a[t]===o[t]||e.off(n[t],r[t])})),a&&Object.keys(a).forEach((t=>{o&&o[t]&&o[t]===a[t]||e.on(n[t],a[t])})),!0},z=["children","hooks","ref",...V,"skipFunctionDiff","onError","onReady","option","records","container"],B=(e,t)=>`${e&&e.type&&(e.type.displayName||e.type.name)}-${t}`,W=f.forwardRef(((e,t)=>{const[r,o]=l.useState(0),a=l.useRef({});l.useImperativeHandle(t,(()=>a.current?.table));const u=!!e.option,i=!!e.records,c=l.useRef(!1),s=l.useRef(k(e,z)),d=l.useRef(null),y=l.useRef(e.records),h=f.useRef(null),v=!!e.skipFunctionDiff,b=l.useCallback((e=>u&&e.option?i&&e.records?{...e.option,clearDOM:!1,records:e.records}:{...e.option,clearDOM:!1}:{records:e.records,...s.current,...d.current,clearDOM:!1}),[u,i]),g=l.useCallback((e=>{let t;t="pivot-table"===e.type?new n.PivotTable(e.container,b(e)):"pivot-chart"===e.type?new n.PivotChart(e.container,b(e)):new n.ListTable(e.container,b(e)),a.current={...a.current,table:t},c.current=!1}),[b]),_=l.useCallback((()=>{if(!c.current){if(!a.current||!a.current.table)return;U(a.current.table,e,h.current,F),o(r+1),e.onReady&&e.onReady(a.current.table,0===r)}}),[r,o,e]),E=l.useCallback((()=>{a.current.table&&(a.current.table.render(),_())}),[_]);return l.useEffect((()=>{const t=u?null:(e=>{const t={};return D(e.children).map(((e,r)=>{const n=e&&e.type&&e.type.parseOption;if(n&&e.props){const o=n(m(e.props.componentId)?{...e.props,componentId:B(e,r)}:e.props);o.isSingle?t[o.optionName]=o.option:(t[o.optionName]||(t[o.optionName]=[]),t[o.optionName].push(o.option))}})),t})(e);if(!a.current?.table)return u||(d.current=t),g(e),E(),void(h.current=e);if(u)return void(P(h.current.option,e.option,{skipFunction:v})?i&&!P(h.current.records,e.records,{skipFunction:v})&&(a.current.table.setRecords(e.records),_(),h.current=e):(a.current.table.updateOption(b(e)),_(),h.current=e));const r=k(e,z);P(r,s.current,{skipFunction:v})&&P(t,d.current,{skipFunction:v})?i&&!P(e.records,y.current,{skipFunction:v})&&(y.current=e.records,a.current.table.setRecords(e.records),_(),h.current=e):(s.current=r,d.current=t,a.current.table.updateOption(b(e)),_(),h.current=e)}),[g,u,i,b,_,E,v,e]),l.useEffect((()=>()=>{a&&a.current&&a.current.table&&(a.current.table.release(),a.current=null),h.current=null,c.current=!0}),[]),f.createElement(p.Provider,{value:a.current},D(e.children).map(((e,t)=>{if("string"==typeof e)return;const n=B(e,t);return f.createElement(f.Fragment,{key:n},f.cloneElement(e,{updateId:r,componentId:n}))})))})),Y=(e,t,r)=>{const n=function(e,t="TableContainer",r){const n=f.forwardRef(((t,n)=>{const o=l.useRef(),[a,u]=l.useState(!1),{className:i,style:c,width:s,...p}=t;return l.useLayoutEffect((()=>{u(!0)}),[]),f.createElement("div",{ref:o,className:i,style:{position:"relative",height:t.height||"100%",width:t.width||"100%",...c}},a?f.createElement(e,{ref:n,container:o.current,...r?r(p):p}):f.createElement(f.Fragment,null))}));return n.displayName=t||e.name,n}(W,e,(e=>(e.type=t,r?r(e):t?{...e,type:t}:e)));return n.displayName=e,n},K=Y("ListTable","list-table"),q=Y("PivotTable","pivot-table"),G=Y("PivotChart","pivot-chart");const X=(e,t,r,n)=>{const o=["id","updateId","componentId"],a=r?Object.keys(r).concat(o):o,u=e=>{const t=l.useContext(p),n=f.useRef(null),o=f.useRef(e.updateId);if(e.updateId!==o.current){o.current=e.updateId;!!r&&U(t.table,e,n.current,r)&&(n.current=e)}return l.useEffect((()=>()=>{r&&U(t.table,null,n.current,r)}),[]),null};return u.displayName=e,u.parseOption=e=>({option:k(e,a),optionName:t,isSingle:n}),u},Z=X("ListColumn","columns"),J=X("PivotColumnDimension","columns"),Q=X("PivotRowDimension","rows"),ee=X("PivotIndicator","indicators"),te=X("PivotColumnHeaderTitle","columnHeaderTitle",void 0,!0),re=X("PivotRowHeaderTitle","rowHeaderTitle",void 0,!0),ne=X("PivotCorner","corner",void 0,!0),oe=X("Menu","menu",void 0,!0),ae=X("Tooltip","tooltip",void 0,!0);function ue(e,t){return C(e)?e:"string"==typeof e&&e.endsWith("%")?Number(e.slice(0,-1))/100*t:0}e.VTable=n,e.CustomComponent=e=>{const t=l.useContext(p),{table:r}=t,n=function(e,t){const r=l.useMemo((()=>({...t})),[t]),n=l.useMemo((()=>{const t=R({},e);for(const e in r)void 0===t[e]&&(t[e]=r[e]);return t}),[e,r]);return n}(e,{style:{left:0,top:0},className:"vtable-custom-component",displayMode:"position",x:0,y:0,width:0,height:0,row:0,col:0,anchor:"top-left",dx:0,dy:0}),{displayMode:o,x:a,y:u,width:i,height:c,row:s,col:d,anchor:y,dx:m,dy:h,className:v,children:b,style:g}=n;let _,E,C,S;if("position"===o)_=a+m+"px",E=u+h+"px",C=i+"px",S=c+"px";else if("cell"===o){const e=r&&d>=0&&s>=0?r?.getCellRelativeRect(d,s):{width:0,height:0,left:-9999,top:-9999};C=ue(i,e.width)+"px",S=ue(c,e.height)+"px","top-left"===y?(_=e.left+ue(m,e.width)+"px",E=e.top+ue(h,e.height)+"px"):"top-right"===y?(_=e.left+ue(m,e.width)+e.width+"px",E=e.top+ue(h,e.height)+"px"):"bottom-left"===y?(_=e.left+ue(m,e.width)+"px",E=e.top+ue(h,e.height)+e.height+"px"):"bottom-right"===y&&(_=e.left+ue(m,e.width)+e.width+"px",E=e.top+ue(h,e.height)+e.height+"px")}const O=R({},g,{position:"absolute",zIndex:1e3,width:C,height:S,left:_,top:E});return f.createElement("div",{className:v,style:O},f.Children.map(b,(e=>e?f.cloneElement(e,{}):e)))},e.ListColumn=Z,e.ListTable=K,e.Menu=oe,e.PivotChart=G,e.PivotColumnDimension=J,e.PivotColumnHeaderTitle=te,e.PivotCorner=ne,e.PivotIndicator=ee,e.PivotRowDimension=Q,e.PivotRowHeaderTitle=re,e.PivotTable=q,e.Tooltip=ae,e.registerChartModule=function(e,t){n.register.chartModule(e,t)},e.version="1.3.0"}));
19
+ */"production"===process.env.NODE_ENV?j.exports=function(){if(N)return x;N=1;var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var y=e.$$typeof;switch(y){case t:switch(e=e.type){case n:case a:case o:case l:case f:return e;default:switch(e=e&&e.$$typeof){case c:case i:case s:case d:case p:case u:return e;default:return y}}case r:return y}}}return e=Symbol.for("react.module.reference"),x.ContextConsumer=i,x.ContextProvider=u,x.Element=t,x.ForwardRef=s,x.Fragment=n,x.Lazy=d,x.Memo=p,x.Portal=r,x.Profiler=a,x.StrictMode=o,x.Suspense=l,x.SuspenseList=f,x.isAsyncMode=function(){return!1},x.isConcurrentMode=function(){return!1},x.isContextConsumer=function(e){return m(e)===i},x.isContextProvider=function(e){return m(e)===u},x.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},x.isForwardRef=function(e){return m(e)===s},x.isFragment=function(e){return m(e)===n},x.isLazy=function(e){return m(e)===d},x.isMemo=function(e){return m(e)===p},x.isPortal=function(e){return m(e)===r},x.isProfiler=function(e){return m(e)===a},x.isStrictMode=function(e){return m(e)===o},x.isSuspense=function(e){return m(e)===l},x.isSuspenseList=function(e){return m(e)===f},x.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===a||t===o||t===l||t===f||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===p||t.$$typeof===u||t.$$typeof===i||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},x.typeOf=m,x}():j.exports=($||($=1,"production"!==process.env.NODE_ENV&&function(){var e,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.server_context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),y=Symbol.for("react.offscreen");function m(e){if("object"==typeof e&&null!==e){var y=e.$$typeof;switch(y){case t:var m=e.type;switch(m){case n:case a:case o:case l:case f:return m;default:var h=m&&m.$$typeof;switch(h){case c:case i:case s:case d:case p:case u:return h;default:return y}}case r:return y}}}e=Symbol.for("react.module.reference");var h=i,v=u,b=t,g=s,_=n,E=d,C=p,S=r,O=a,w=o,R=l,k=f,L=!1,T=!1;I.ContextConsumer=h,I.ContextProvider=v,I.Element=b,I.ForwardRef=g,I.Fragment=_,I.Lazy=E,I.Memo=C,I.Portal=S,I.Profiler=O,I.StrictMode=w,I.Suspense=R,I.SuspenseList=k,I.isAsyncMode=function(e){return L||(L=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},I.isConcurrentMode=function(e){return T||(T=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},I.isContextConsumer=function(e){return m(e)===i},I.isContextProvider=function(e){return m(e)===u},I.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},I.isForwardRef=function(e){return m(e)===s},I.isFragment=function(e){return m(e)===n},I.isLazy=function(e){return m(e)===d},I.isMemo=function(e){return m(e)===p},I.isPortal=function(e){return m(e)===r},I.isProfiler=function(e){return m(e)===a},I.isStrictMode=function(e){return m(e)===o},I.isSuspense=function(e){return m(e)===l},I.isSuspenseList=function(e){return m(e)===f},I.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===n||t===a||t===o||t===l||t===f||t===y||"object"==typeof t&&null!==t&&(t.$$typeof===d||t.$$typeof===p||t.$$typeof===u||t.$$typeof===i||t.$$typeof===s||t.$$typeof===e||void 0!==t.getModuleId)},I.typeOf=m}()),I);var M=j.exports;const D=e=>{let t=[];return f.Children.forEach(e,(e=>{m(e)||(M.isFragment(e)?t=t.concat(D(e.props.children)):t.push(e))})),t},A={...t.ListTable.EVENT_TYPE,...t.PivotTable.EVENT_TYPE,...t.PivotChart.EVENT_TYPE},F={onClickCell:A.CLICK_CELL,onDblClickCell:A.DBLCLICK_CELL,onMouseDownCell:A.MOUSEDOWN_CELL,onMouseUpCell:A.MOUSEUP_CELL,onSelectedCell:A.SELECTED_CELL,onSelectedClear:A.SELECTED_CLEAR,onKeyDown:A.KEYDOWN,onMouseEnterTable:A.MOUSEENTER_TABLE,onMouseLeaveTable:A.MOUSELEAVE_TABLE,onMouseDownTable:A.MOUSEDOWN_TABLE,onMouseMoveCell:A.MOUSEMOVE_CELL,onMouseEnterCell:A.MOUSEENTER_CELL,onMouseLeaveCell:A.MOUSELEAVE_CELL,onContextMenuCell:A.CONTEXTMENU_CELL,onResizeColumn:A.RESIZE_COLUMN,onResizeColumnEnd:A.RESIZE_COLUMN_END,onChangeHeaderPosition:A.CHANGE_HEADER_POSITION,onSortClick:A.SORT_CLICK,onFreezeClick:A.FREEZE_CLICK,onScroll:A.SCROLL,onDropdownMenuClick:A.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:A.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:A.DRAG_SELECT_END,onDropdownIconClick:A.DROPDOWN_ICON_CLICK,onDropdownMenuClear:A.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:A.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:A.SHOW_MENU,onHideMenu:A.HIDE_MENU,onIconClick:A.ICON_CLICK,onLegendItemClick:A.LEGEND_ITEM_CLICK,onLegendItemHover:A.LEGEND_ITEM_HOVER,onLegendItemUnHover:A.LEGEND_ITEM_UNHOVER,onLegendChange:A.LEGEND_CHANGE,onMouseEnterAxis:A.MOUSEENTER_AXIS,onMouseLeaveAxis:A.MOUSELEAVE_AXIS,onCheckboxStateChange:A.CHECKBOX_STATE_CHANGE,onRadioStateChange:A.RADIO_STATE_CHANGE,onAfterRender:A.AFTER_RENDER,onInitialized:A.INITIALIZED,onPivotSortClick:A.PIVOT_SORT_CLICK,onDrillMenuClick:A.DRILLMENU_CLICK,onVChartEventType:A.VCHART_EVENT_TYPE,onChangCellValue:A.CHANGE_CELL_VALUE,onMousedownFillHandle:A.MOUSEDOWN_FILL_HANDLE,onDragFillHandleEnd:A.DRAG_FILL_HANDLE_END,onDblclickFillHandle:A.DBLCLICK_FILL_HANDLE,onScrollVerticalEnd:A.SCROLL_VERTICAL_END,onScrollHorizontalEnd:A.SCROLL_HORIZONTAL_END},V=Object.keys(F),H=(e,t=F)=>{const r={};return Object.keys(e).forEach((n=>{t[n]&&e[n]&&(r[n]=e[n])})),r},U=(e,t,r,n=F)=>{if(!t&&!r||!e)return!1;const o=r?H(r,n):null,a=t?H(t,n):null;return o&&Object.keys(o).forEach((t=>{a&&a[t]&&a[t]===o[t]||e.off(n[t],r[t])})),a&&Object.keys(a).forEach((t=>{o&&o[t]&&o[t]===a[t]||e.on(n[t],a[t])})),!0},z=["children","hooks","ref",...V,"skipFunctionDiff","onError","onReady","option","records","container"],B=(e,t)=>`${e&&e.type&&(e.type.displayName||e.type.name)}-${t}`,W=f.forwardRef(((e,t)=>{const[r,o]=l.useState(0),a=l.useRef({});l.useImperativeHandle(t,(()=>a.current?.table));const u=!!e.option,i=!!e.records,c=l.useRef(!1),s=l.useRef(k(e,z)),d=l.useRef(null),y=l.useRef(e.records),h=f.useRef(null),v=!!e.skipFunctionDiff,b=l.useCallback((e=>u&&e.option?i&&e.records?{...e.option,clearDOM:!1,records:e.records}:{...e.option,clearDOM:!1}:{records:e.records,...s.current,...d.current,clearDOM:!1}),[u,i]),g=l.useCallback((e=>{let t;t="pivot-table"===e.type?new n.PivotTable(e.container,b(e)):"pivot-chart"===e.type?new n.PivotChart(e.container,b(e)):new n.ListTable(e.container,b(e)),a.current={...a.current,table:t},c.current=!1}),[b]),_=l.useCallback((()=>{if(!c.current){if(!a.current||!a.current.table)return;U(a.current.table,e,h.current,F),o(r+1),e.onReady&&e.onReady(a.current.table,0===r)}}),[r,o,e]),E=l.useCallback((()=>{a.current.table&&(a.current.table.render(),_())}),[_]);return l.useEffect((()=>{const t=u?null:(e=>{const t={};return D(e.children).map(((e,r)=>{const n=e&&e.type&&e.type.parseOption;if(n&&e.props){const o=n(m(e.props.componentId)?{...e.props,componentId:B(e,r)}:e.props);o.isSingle?t[o.optionName]=o.option:(t[o.optionName]||(t[o.optionName]=[]),t[o.optionName].push(o.option))}})),t})(e);if(!a.current?.table)return u||(d.current=t),g(e),E(),void(h.current=e);if(u)return void(P(h.current.option,e.option,{skipFunction:v})?i&&!P(h.current.records,e.records,{skipFunction:v})&&(a.current.table.setRecords(e.records),_(),h.current=e):(a.current.table.updateOption(b(e)),_(),h.current=e));const r=k(e,z);P(r,s.current,{skipFunction:v})&&P(t,d.current,{skipFunction:v})?i&&!P(e.records,y.current,{skipFunction:v})&&(y.current=e.records,a.current.table.setRecords(e.records),_(),h.current=e):(s.current=r,d.current=t,a.current.table.updateOption(b(e)),_(),h.current=e)}),[g,u,i,b,_,E,v,e]),l.useEffect((()=>()=>{a&&a.current&&a.current.table&&(a.current.table.release(),a.current=null),h.current=null,c.current=!0}),[]),f.createElement(p.Provider,{value:a.current},D(e.children).map(((e,t)=>{if("string"==typeof e)return;const n=B(e,t);return f.createElement(f.Fragment,{key:n},f.cloneElement(e,{updateId:r,componentId:n}))})))})),Y=(e,t,r)=>{const n=function(e,t="TableContainer",r){const n=f.forwardRef(((t,n)=>{const o=l.useRef(),[a,u]=l.useState(!1),{className:i,style:c,width:s,...p}=t;return l.useLayoutEffect((()=>{u(!0)}),[]),f.createElement("div",{ref:o,className:i,style:{position:"relative",height:t.height||"100%",width:t.width||"100%",...c}},a?f.createElement(e,{ref:n,container:o.current,...r?r(p):p}):f.createElement(f.Fragment,null))}));return n.displayName=t||e.name,n}(W,e,(e=>(e.type=t,r?r(e):t?{...e,type:t}:e)));return n.displayName=e,n},K=Y("ListTable","list-table"),q=Y("PivotTable","pivot-table"),G=Y("PivotChart","pivot-chart");const X=(e,t,r,n)=>{const o=["id","updateId","componentId"],a=r?Object.keys(r).concat(o):o,u=e=>{const t=l.useContext(p),n=f.useRef(null),o=f.useRef(e.updateId);if(e.updateId!==o.current){o.current=e.updateId;!!r&&U(t.table,e,n.current,r)&&(n.current=e)}return l.useEffect((()=>()=>{r&&U(t.table,null,n.current,r)}),[]),null};return u.displayName=e,u.parseOption=e=>({option:k(e,a),optionName:t,isSingle:n}),u},Z=X("ListColumn","columns"),J=X("PivotColumnDimension","columns"),Q=X("PivotRowDimension","rows"),ee=X("PivotIndicator","indicators"),te=X("PivotColumnHeaderTitle","columnHeaderTitle",void 0,!0),re=X("PivotRowHeaderTitle","rowHeaderTitle",void 0,!0),ne=X("PivotCorner","corner",void 0,!0),oe=X("Menu","menu",void 0,!0),ae=X("Tooltip","tooltip",void 0,!0);function ue(e,t){return C(e)?e:"string"==typeof e&&e.endsWith("%")?Number(e.slice(0,-1))/100*t:0}e.VTable=n,e.CustomComponent=e=>{const t=l.useContext(p),{table:r}=t,n=function(e,t){const r=l.useMemo((()=>({...t})),[t]),n=l.useMemo((()=>{const t=R({},e);for(const e in r)void 0===t[e]&&(t[e]=r[e]);return t}),[e,r]);return n}(e,{style:{left:0,top:0},className:"vtable-custom-component",displayMode:"position",x:0,y:0,width:0,height:0,row:0,col:0,anchor:"top-left",dx:0,dy:0}),{displayMode:o,x:a,y:u,width:i,height:c,row:s,col:d,anchor:y,dx:m,dy:h,className:v,children:b,style:g}=n;let _,E,C,S;if("position"===o)_=a+m+"px",E=u+h+"px",C=i+"px",S=c+"px";else if("cell"===o){const e=r&&d>=0&&s>=0?r?.getCellRelativeRect(d,s):{width:0,height:0,left:-9999,top:-9999};C=ue(i,e.width)+"px",S=ue(c,e.height)+"px","top-left"===y?(_=e.left+ue(m,e.width)+"px",E=e.top+ue(h,e.height)+"px"):"top-right"===y?(_=e.left+ue(m,e.width)+e.width+"px",E=e.top+ue(h,e.height)+"px"):"bottom-left"===y?(_=e.left+ue(m,e.width)+"px",E=e.top+ue(h,e.height)+e.height+"px"):"bottom-right"===y&&(_=e.left+ue(m,e.width)+e.width+"px",E=e.top+ue(h,e.height)+e.height+"px")}const O=R({},g,{position:"absolute",zIndex:1e3,width:C,height:S,left:_,top:E});return f.createElement("div",{className:v,style:O},f.Children.map(b,(e=>e?f.cloneElement(e,{}):e)))},e.ListColumn=Z,e.ListTable=K,e.Menu=oe,e.PivotChart=G,e.PivotColumnDimension=J,e.PivotColumnHeaderTitle=te,e.PivotCorner=ne,e.PivotIndicator=ee,e.PivotRowDimension=Q,e.PivotRowHeaderTitle=re,e.PivotTable=q,e.Tooltip=ae,e.registerChartModule=function(e,t){n.register.chartModule(e,t)},e.version="1.4.0-alpha.0"}));
package/es/index.d.ts CHANGED
@@ -2,4 +2,4 @@ import * as VTable from '@visactor/vtable';
2
2
  export * from './tables';
3
3
  export * from './components';
4
4
  export { VTable };
5
- export declare const version = "1.3.0";
5
+ export declare const version = "1.4.0-alpha.0";
package/es/index.js CHANGED
@@ -6,4 +6,4 @@ export * from "./components";
6
6
 
7
7
  export { VTable };
8
8
 
9
- export const version = "1.3.0";
9
+ export const version = "1.4.0-alpha.0";
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,OAAO,CAAC","file":"index.js","sourcesContent":["import * as VTable from '@visactor/vtable';\n\nexport * from './tables';\nexport * from './components';\nexport { VTable };\n\nexport const version = \"1.3.0\";\n"]}
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,eAAe,CAAC","file":"index.js","sourcesContent":["import * as VTable from '@visactor/vtable';\n\nexport * from './tables';\nexport * from './components';\nexport { VTable };\n\nexport const version = \"1.4.0-alpha.0\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/react-vtable",
3
- "version": "1.3.0",
3
+ "version": "1.4.0-alpha.0",
4
4
  "description": "The react version of VTable",
5
5
  "keywords": [
6
6
  "react",
@@ -43,9 +43,9 @@
43
43
  "access": "public"
44
44
  },
45
45
  "dependencies": {
46
+ "@visactor/vtable": "1.4.0-alpha.0",
46
47
  "@visactor/vutils": "~0.18.9",
47
- "react-is": "^18.2.0",
48
- "@visactor/vtable": "1.3.0"
48
+ "react-is": "^18.2.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@visactor/vchart": "1.11.0",
@@ -89,8 +89,8 @@
89
89
  "axios": "^1.4.0",
90
90
  "@types/react-is": "^17.0.3",
91
91
  "@arco-design/web-react": "2.60.2",
92
- "@internal/eslint-config": "0.0.1",
93
92
  "@internal/ts-config": "0.0.1",
93
+ "@internal/eslint-config": "0.0.1",
94
94
  "@internal/bundler": "0.0.1"
95
95
  },
96
96
  "scripts": {