@visactor/vue-vtable 1.25.1-alpha.0 → 1.26.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.
Files changed (143) hide show
  1. package/cjs/components/component/menu.js +3 -3
  2. package/cjs/components/component/tooltip.js +3 -3
  3. package/cjs/components/custom/checkBox.js +3 -3
  4. package/cjs/components/custom/group.js +3 -3
  5. package/cjs/components/custom/image.js +3 -3
  6. package/cjs/components/custom/radio.js +3 -3
  7. package/cjs/components/custom/tag.js +3 -3
  8. package/cjs/components/custom/text.js +3 -3
  9. package/cjs/components/custom/vtable-vue-attribute-plugin.js +622 -408
  10. package/cjs/components/list/list-column.js +3 -3
  11. package/cjs/components/pivot/pivot-column-dimension.js +3 -3
  12. package/cjs/components/pivot/pivot-column-header-title.js +3 -3
  13. package/cjs/components/pivot/pivot-corner.js +3 -3
  14. package/cjs/components/pivot/pivot-indicator.js +3 -3
  15. package/cjs/components/pivot/pivot-row-dimension.js +3 -3
  16. package/cjs/components/pivot/pivot-row-header-title.js +3 -3
  17. package/cjs/constants.js +1 -0
  18. package/cjs/edit/editor.js +209 -194
  19. package/cjs/edit/util.js +51 -31
  20. package/cjs/eventsUtils.js +97 -60
  21. package/cjs/hooks/useCellRender.js +27 -20
  22. package/cjs/hooks/useEditorRender.js +75 -52
  23. package/cjs/index.js +5 -5
  24. package/cjs/tables/base-table.vue.js +266 -237
  25. package/cjs/tables/chartModule.js +2 -2
  26. package/cjs/tables/list-table.vue.js +41 -39
  27. package/cjs/tables/pivot-chart.vue.js +35 -37
  28. package/cjs/tables/pivot-table.vue.js +36 -38
  29. package/cjs/utils/customLayoutUtils.js +109 -96
  30. package/cjs/utils/slotUtils.js +85 -88
  31. package/cjs/utils/stringUtils.js +14 -12
  32. package/cjs/utils/vnodeUtils.js +3 -2
  33. package/dist/vue-vtable.js +1715 -1358
  34. package/dist/vue-vtable.min.js +1 -1
  35. package/es/components/component/menu.js +3 -3
  36. package/es/components/component/tooltip.js +3 -3
  37. package/es/components/custom/checkBox.js +3 -3
  38. package/es/components/custom/group.js +3 -3
  39. package/es/components/custom/image.js +3 -3
  40. package/es/components/custom/radio.js +3 -3
  41. package/es/components/custom/tag.js +3 -3
  42. package/es/components/custom/text.js +3 -3
  43. package/es/components/custom/vtable-vue-attribute-plugin.js +622 -408
  44. package/es/components/list/list-column.js +3 -3
  45. package/es/components/pivot/pivot-column-dimension.js +3 -3
  46. package/es/components/pivot/pivot-column-header-title.js +3 -3
  47. package/es/components/pivot/pivot-corner.js +3 -3
  48. package/es/components/pivot/pivot-indicator.js +3 -3
  49. package/es/components/pivot/pivot-row-dimension.js +3 -3
  50. package/es/components/pivot/pivot-row-header-title.js +3 -3
  51. package/es/constants.js +1 -0
  52. package/es/edit/editor.js +209 -194
  53. package/es/edit/util.js +51 -31
  54. package/es/eventsUtils.js +97 -60
  55. package/es/hooks/useCellRender.js +27 -20
  56. package/es/hooks/useEditorRender.js +75 -52
  57. package/es/index.js +3 -3
  58. package/es/tables/base-table.vue.js +266 -237
  59. package/es/tables/chartModule.js +2 -2
  60. package/es/tables/list-table.vue.js +41 -39
  61. package/es/tables/pivot-chart.vue.js +35 -37
  62. package/es/tables/pivot-table.vue.js +36 -38
  63. package/es/utils/customLayoutUtils.js +109 -96
  64. package/es/utils/slotUtils.js +85 -88
  65. package/es/utils/stringUtils.js +14 -12
  66. package/es/utils/vnodeUtils.js +3 -2
  67. package/package.json +5 -5
  68. package/cjs/components/component/menu.d.ts +0 -14
  69. package/cjs/components/component/tooltip.d.ts +0 -11
  70. package/cjs/components/custom/checkBox.d.ts +0 -20
  71. package/cjs/components/custom/custom-layout.d.ts +0 -20
  72. package/cjs/components/custom/group.d.ts +0 -6
  73. package/cjs/components/custom/image.d.ts +0 -6
  74. package/cjs/components/custom/radio.d.ts +0 -17
  75. package/cjs/components/custom/tag.d.ts +0 -16
  76. package/cjs/components/custom/text.d.ts +0 -6
  77. package/cjs/components/custom/vtable-vue-attribute-plugin.d.ts +0 -62
  78. package/cjs/components/index.d.ts +0 -15
  79. package/cjs/components/list/list-column.d.ts +0 -7
  80. package/cjs/components/pivot/pivot-column-dimension.d.ts +0 -11
  81. package/cjs/components/pivot/pivot-column-header-title.d.ts +0 -7
  82. package/cjs/components/pivot/pivot-corner.d.ts +0 -7
  83. package/cjs/components/pivot/pivot-indicator.d.ts +0 -7
  84. package/cjs/components/pivot/pivot-row-dimension.d.ts +0 -11
  85. package/cjs/components/pivot/pivot-row-header-title.d.ts +0 -7
  86. package/cjs/constants.d.ts +0 -1
  87. package/cjs/edit/editor.d.ts +0 -50
  88. package/cjs/edit/index.d.ts +0 -2
  89. package/cjs/edit/util.d.ts +0 -4
  90. package/cjs/eventsUtils.d.ts +0 -120
  91. package/cjs/hooks/index.d.ts +0 -2
  92. package/cjs/hooks/useCellRender.d.ts +0 -2
  93. package/cjs/hooks/useEditorRender.d.ts +0 -2
  94. package/cjs/index.d.ts +0 -6
  95. package/cjs/tables/base-table.vue.d.ts +0 -543
  96. package/cjs/tables/chartModule.d.ts +0 -1
  97. package/cjs/tables/index.d.ts +0 -5
  98. package/cjs/tables/list-table.vue.d.ts +0 -38
  99. package/cjs/tables/pivot-chart.vue.d.ts +0 -38
  100. package/cjs/tables/pivot-table.vue.d.ts +0 -38
  101. package/cjs/utils/customLayoutUtils.d.ts +0 -5
  102. package/cjs/utils/slotUtils.d.ts +0 -28
  103. package/cjs/utils/stringUtils.d.ts +0 -2
  104. package/cjs/utils/vnodeUtils.d.ts +0 -1
  105. package/cjs/utils.d.ts +0 -4
  106. package/es/components/component/menu.d.ts +0 -14
  107. package/es/components/component/tooltip.d.ts +0 -11
  108. package/es/components/custom/checkBox.d.ts +0 -20
  109. package/es/components/custom/custom-layout.d.ts +0 -20
  110. package/es/components/custom/group.d.ts +0 -6
  111. package/es/components/custom/image.d.ts +0 -6
  112. package/es/components/custom/radio.d.ts +0 -17
  113. package/es/components/custom/tag.d.ts +0 -16
  114. package/es/components/custom/text.d.ts +0 -6
  115. package/es/components/custom/vtable-vue-attribute-plugin.d.ts +0 -62
  116. package/es/components/index.d.ts +0 -15
  117. package/es/components/list/list-column.d.ts +0 -7
  118. package/es/components/pivot/pivot-column-dimension.d.ts +0 -11
  119. package/es/components/pivot/pivot-column-header-title.d.ts +0 -7
  120. package/es/components/pivot/pivot-corner.d.ts +0 -7
  121. package/es/components/pivot/pivot-indicator.d.ts +0 -7
  122. package/es/components/pivot/pivot-row-dimension.d.ts +0 -11
  123. package/es/components/pivot/pivot-row-header-title.d.ts +0 -7
  124. package/es/constants.d.ts +0 -1
  125. package/es/edit/editor.d.ts +0 -50
  126. package/es/edit/index.d.ts +0 -2
  127. package/es/edit/util.d.ts +0 -4
  128. package/es/eventsUtils.d.ts +0 -120
  129. package/es/hooks/index.d.ts +0 -2
  130. package/es/hooks/useCellRender.d.ts +0 -2
  131. package/es/hooks/useEditorRender.d.ts +0 -2
  132. package/es/index.d.ts +0 -6
  133. package/es/tables/base-table.vue.d.ts +0 -543
  134. package/es/tables/chartModule.d.ts +0 -1
  135. package/es/tables/index.d.ts +0 -5
  136. package/es/tables/list-table.vue.d.ts +0 -38
  137. package/es/tables/pivot-chart.vue.d.ts +0 -38
  138. package/es/tables/pivot-table.vue.d.ts +0 -38
  139. package/es/utils/customLayoutUtils.d.ts +0 -5
  140. package/es/utils/slotUtils.d.ts +0 -28
  141. package/es/utils/stringUtils.d.ts +0 -2
  142. package/es/utils/vnodeUtils.d.ts +0 -1
  143. package/es/utils.d.ts +0 -4
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@visactor/vtable"),require("vue"),require("@visactor/vutils"),require("@visactor/vtable/es/vrender")):"function"==typeof define&&define.amd?define(["exports","@visactor/vtable","vue","@visactor/vutils","@visactor/vtable/es/vrender"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueVTable={},e.VTable,e.Vue,e.VUtils,e.VTable.vrender)}(this,(function(e,t,n,o,r){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var l=i(t);function s(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}function a(e){const t={};for(const n in e)if(e.hasOwnProperty(n)){t[s(n)]=e[n]}return t}function u(e){return e.flatMap((e=>Array.isArray(e.children)?u(e.children):e))}function c(e,t,r){const i={Group:l.CustomLayout.Group,Image:l.CustomLayout.Image,Text:l.CustomLayout.Text,Tag:l.CustomLayout.Tag,Radio:l.CustomLayout.Radio,CheckBox:l.CustomLayout.CheckBox};return{rootComponent:function e(l){if(!l)return null;const{type:u,children:c}=l,d=a(l.props),p=i[u?.symbol||u?.name];if(!p)return null;const h=new p({...d});!function(e,t){Object.keys(t).forEach((n=>{if(function(e,t){return e.startsWith("on")&&o.isFunction(t[e])}(n,t)){let o;o=n.startsWith("on")?n.slice(2).toLowerCase():s(n.slice(2)).toLowerCase(),e.addEventListener(o,t[n])}}))}(h,d);const C=function(e){return e?.default?.()||e||[]}(c);if(o.isObject(d?.vue)){const{element:e}=d.vue;let o=e??C.find((e=>e?.type!==Symbol.for("v-cmt")));return o=n.isVNode(o)?o.key?o:n.cloneVNode(o,{key:`row_${r.row}_col_${r.col}`}):null,Object.assign(l.props.vue,{element:o,container:t?r?.table?.headerDomContainer:r?.table?.bodyDomContainer}),h}return C.forEach((t=>{const n=e(t);n?h.add(n):t.type===Symbol.for("v-fgt")&&t.children.forEach((t=>{const n=e(t);n&&h.add(n)}))})),h}(e)}}function d(e,t){return n=>{const{table:o,row:r,col:i,rect:l}=n,s=o.getCellOriginRecord(i,r),{height:a,width:u}=l??o.getCellRect(i,r),d=t?"headerCustomLayout":"customLayout";if(!e[d])return null;const p=e[d]({table:o,row:r,col:i,rect:l,record:s,height:a,width:u})[0],{rootComponent:h}=c(p,t,n);return{rootContainer:h,renderDefault:!1}}}class p{wrapContainer;tableContainer;currentValue;nodeMap;currentContext;constructor(e){this.currentContext=e,this.tableContainer=null,this.currentValue=null,this.wrapContainer=null,this.nodeMap=new Map}registerNode(e,t,n){o.isValid(e)&&o.isValid(t)&&"function"==typeof n&&(this.nodeMap.has(e)||this.nodeMap.set(e,new Map),this.nodeMap.get(e).set(t,n))}getNode(e,t){return this.nodeMap.get(e)?.get(t)}removeNode(e){this.nodeMap.delete(e)}release(e){o.isValid(e)?this.removeNode(e):this.nodeMap.clear()}async onStart(e){const{value:t}=e;this.setValue(t),await this.createElement(e)}async createElement(e){const{row:r,col:i,value:l,table:s,container:a,referencePosition:u}=e;if(!a)return!1;const c=s.getBodyColumnDefine(i,r),{editConfig:d}=c||{},{id:p}=s,h=this.getColumnKeyField(c);if(!o.isValid(h)||!o.isValid(p))return!1;if("function"==typeof d?.editBefore){if(!await d.editBefore(e))return s.showTooltip(i,r,{content:d.disablePrompt||"This field is not allowed to be edited",referencePosition:{rect:u?.rect,placement:t.TYPES.Placement.top},style:{bgColor:"black",color:"white",arrowMark:!0},disappearDelay:1e3}),!1}const C=s?.getCellOriginRecord(i,r),y=this.getNode(p,h);if(!y)return!1;const f=n.h(y,{row:r,col:i,value:l,refValue:n.customRef(((e,t)=>({get:()=>(e(),this.getValue()),set:e=>{this.setValue(e),t()}}))),record:C,table:s,onChange:e=>this.setValue(e)});if(!f||!n.isVNode(f))return!1;this.checkToPassAppContext(f,s);const m=document.createElement("div");m.style.position="absolute",m.style.width="100%",m.style.boxSizing="border-box";const{bgColor:g}=s.getCellStyle(i,r)||{};return m.style.backgroundColor=g||"#FFFFFF",this.wrapContainer=m,this.tableContainer=a,this.tableContainer.appendChild(m),n.render(f,m),u?.rect&&this.adjustPosition(u.rect),!0}checkToPassAppContext(e,t){try{const n=t.options?.customConfig?.getVueUserAppContext?.()??this.currentContext;n?.components&&n?.directives&&(e.appContext=n)}catch(e){}}getColumnKeyField(e){const{field:t,key:n}=e||{};return o.isValid(n)?n:t}getValue(){return this.currentValue}setValue(e){this.currentValue=e}adjustPosition(e){this.wrapContainer&&(this.wrapContainer.style.top=`${e.top}px`,this.wrapContainer.style.left=`${e.left}px`,this.wrapContainer.style.width=`${e.width}px`,this.wrapContainer.style.height=`${e.height}px`)}async validateValue(e,n,r,i){const{col:l,row:s}=r||{};if(!o.isValid(l)||!o.isValid(s))return!0;const a=i.getBodyColumnDefine(l,s),{editConfig:u}=a||{};if("function"==typeof u?.validateValue){const o=await u.validateValue({col:l,row:s,value:e,oldValue:n,table:i});if(!1===o){const e=i.getVisibleCellRangeRelativeRect({col:l,row:s});return i.showTooltip(l,s,{content:u.invalidPrompt||"invalid",referencePosition:{rect:e,placement:t.TYPES.Placement.top},style:{bgColor:"red",color:"white",arrowMark:!0},disappearDelay:1e3}),!1}return o}return!0}onEnd(){this.wrapContainer&&this.tableContainer&&(n.render(null,this.wrapContainer),this.tableContainer.removeChild(this.wrapContainer)),this.wrapContainer=null,this.tableContainer=null}isEditorElement(e){return this.wrapContainer?.contains(e)||this.isClickEditorElement(e)}isClickEditorElement(e){for(;e;){if(e.classList&&e.classList.contains("table-editor-element"))return!0;e=e.parentNode}return!1}}const h="dynamic-render-editor";function C(e,t){const{editor:n}=e||{},r=y(e);if(!o.isValid(r)||n!==h)return!1;if("function"==typeof t){if(e.getEditCustomNode=t,Array.isArray(e.columns)&&e.columns.length)for(const n of e.columns)C(n,t);return!0}return"function"==typeof e.getEditCustomNode}function y(e){const{field:t,key:n}=e||{};return o.isValid(n)?n:t}function f(e,n){const o=t.register.editor(h);let r=o||void 0;return!r&&e&&(r=new p(n),t.register.editor(h,r)),r}function m(e){const t={columns:[],columnHeaderTitle:[],rows:[],rowHeaderTitle:[],indicators:[],corner:{},tooltip:{},menu:{}},n={PivotColumnDimension:"columns",PivotColumnHeaderTitle:"columnHeaderTitle",PivotRowDimension:"rows",PivotRowHeaderTitle:"rowHeaderTitle",PivotCorner:"corner",PivotIndicator:"indicators",Tooltip:"tooltip",Menu:"menu"};return e.forEach((e=>{e.props=a(e.props);const o=e.type?.symbol||e.type?.name,r=n[o];r&&(Array.isArray(t[r])?e.props.hasOwnProperty("objectHandler")?t[r].push(e.props.objectHandler):t[r].push(e.props):t[r]=e.props)})),t}function g(e,t){return{...e,columns:t.columns&&t.columns.length?t.columns:e.columns,columnHeaderTitle:t.columnHeaderTitle&&t.columnHeaderTitle.length?t.columnHeaderTitle:e.columnHeaderTitle,rows:t.rows&&t.rows.length?t.rows:e.rows,rowHeaderTitle:t.rowHeaderTitle&&t.rowHeaderTitle.length?t.rowHeaderTitle:e.rowHeaderTitle,indicators:t.indicators&&t.indicators.length?t.indicators:e.indicators,corner:Object.keys(e.corner||{}).length?e.corner:t.corner,tooltip:Object.keys(t.tooltip||{}).length?t.tooltip:e.tooltip,menu:Object.keys(t.menu||{}).length?t.menu:e.menu}}const E={...t.ListTable.EVENT_TYPE,...t.PivotTable.EVENT_TYPE,...t.PivotChart.EVENT_TYPE},v={onClickCell:E.CLICK_CELL,onDblClickCell:E.DBLCLICK_CELL,onMouseDownCell:E.MOUSEDOWN_CELL,onMouseUpCell:E.MOUSEUP_CELL,onSelectedCell:E.SELECTED_CELL,onKeyDown:E.KEYDOWN,onMouseEnterTable:E.MOUSEENTER_TABLE,onMouseLeaveTable:E.MOUSELEAVE_TABLE,onMouseDownTable:E.MOUSEDOWN_TABLE,onMouseMoveCell:E.MOUSEMOVE_CELL,onMouseEnterCell:E.MOUSEENTER_CELL,onMouseLeaveCell:E.MOUSELEAVE_CELL,onContextMenuCell:E.CONTEXTMENU_CELL,onContextMenuCanvas:E.CONTEXTMENU_CANVAS,onResizeColumn:E.RESIZE_COLUMN,onResizeColumnEnd:E.RESIZE_COLUMN_END,onChangeHeaderPosition:E.CHANGE_HEADER_POSITION,onChangeHeaderPositionStart:E.CHANGE_HEADER_POSITION_START,onChangeHeaderPositionFail:E.CHANGE_HEADER_POSITION_FAIL,onSortClick:E.SORT_CLICK,onFreezeClick:E.FREEZE_CLICK,onScroll:E.SCROLL,onDropdownMenuClick:E.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:E.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:E.DRAG_SELECT_END,onDropdownIconClick:E.DROPDOWN_ICON_CLICK,onDropdownMenuClear:E.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:E.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:E.SHOW_MENU,onHideMenu:E.HIDE_MENU,onIconClick:E.ICON_CLICK,onLegendItemClick:E.LEGEND_ITEM_CLICK,onLegendItemHover:E.LEGEND_ITEM_HOVER,onLegendItemUnHover:E.LEGEND_ITEM_UNHOVER,onLegendChange:E.LEGEND_CHANGE,onMouseEnterAxis:E.MOUSEENTER_AXIS,onMouseLeaveAxis:E.MOUSELEAVE_AXIS,onCheckboxStateChange:E.CHECKBOX_STATE_CHANGE,onRadioStateChange:E.RADIO_STATE_CHANGE,onAfterRender:E.AFTER_RENDER,onInitialized:E.INITIALIZED,onPivotSortClick:E.PIVOT_SORT_CLICK,onDrillMenuClick:E.DRILLMENU_CLICK,onVChartEventType:E.VCHART_EVENT_TYPE,onChangeCellValue:E.CHANGE_CELL_VALUE,onMousedownFillHandle:E.MOUSEDOWN_FILL_HANDLE,onDragFillHandleEnd:E.DRAG_FILL_HANDLE_END,onDblclickFillHandle:E.DBLCLICK_FILL_HANDLE,onScrollVerticalEnd:E.SCROLL_VERTICAL_END,onScrollHorizontalEnd:E.SCROLL_HORIZONTAL_END,onChangCellValue:E.CHANGE_CELL_VALUE,onEmptyTipClick:E.EMPTY_TIP_CLICK,onEmptyTipDblClick:E.EMPTY_TIP_DBLCLICK,onButtonClick:E.BUTTON_CLICK,onBeforeCacheChartImage:E.BEFORE_CACHE_CHART_IMAGE,onPastedData:E.PASTED_DATA,onSelectedClear:E.SELECTED_CLEAR},b=Object.keys(v);function w(e,t){const r=n.getCurrentInstance(),i=n.computed((()=>{const t=T(e.options?.columns||[]);return o.isArray(t)?t.filter((e=>!!o.isObject(e)&&!!C(e))):[]}));function l(){return t.value?.id}n.watchEffect((()=>{!function(){const e=l();if(!o.isValid(e))return;let t=f();t?t.removeNode(e):i.value.length>0&&(t=f(!0,r?.appContext));i.value.forEach((n=>{const{getEditCustomNode:o}=n,r=y(n);t.registerNode(e,r,o),delete n.editCustomNode}))}()})),n.onBeforeUnmount((()=>{!function(){const e=l();if(!o.isValid(e))return;const t=f();t?.release(e)}()}))}function T(e){return e.flatMap((e=>Array.isArray(e.columns)?T(e.columns):e))}class L extends r.HtmlAttributePlugin{name="VTableVueAttributePlugin";renderQueue=new Set;isRendering=!1;MAX_CACHE_COUNT=100;accessQueue=[];VIEWPORT_BUFFER=100;BUFFER_ZONE=500;styleUpdateQueue=new Map;styleUpdateRequested=!1;eventHandlers=new WeakMap;currentContext;constructor(e){super(),this.currentContext=e}renderGraphicHTML(e){this.checkNeedRender(e)&&(this.renderQueue.add(e),this.scheduleRender())}scheduleRender(){this.isRendering||(this.isRendering=!0,r.vglobal.getRequestAnimationFrame()((()=>{this.renderQueue.forEach((e=>{try{this.doRenderGraphic(e)}catch(t){const{id:n}=this.getGraphicOptions(e)||{};this.removeElement(n,!0)}})),this.renderQueue.clear(),this.isRendering=!1})))}doRenderGraphic(e){const{id:t,options:o}=this.getGraphicOptions(e);if(!t)return;const r=e.stage,{element:i,container:l}=o,s=l?function(e){const{col:t,row:n,stage:o}=_(e);let r=e.attribute.vue?.container;const{table:i}=o;r===i.bodyDomContainer?t<i.frozenColCount&&n>=i.rowCount-i.bottomFrozenRowCount?r=i.bottomFrozenBodyDomContainer:t>=i.colCount-i.rightFrozenColCount&&n>=i.rowCount-i.bottomFrozenRowCount?r=i.rightFrozenBottomDomContainer:n>=i.rowCount-i.bottomFrozenRowCount?r=i.bottomFrozenBodyDomContainer:t<i.frozenColCount?r=i.frozenBodyDomContainer:t>=i.colCount-i.rightFrozenColCount&&(r=i.rightFrozenBodyDomContainer):r===i.headerDomContainer&&(t<i.frozenColCount?r=i.frozenHeaderDomContainer:t>=i.colCount-i.rightFrozenColCount&&(r=i.rightFrozenHeaderDomContainer));return r}(e):l;let a=this.htmlMap?.[t];if(a&&s&&s!==a.container&&(this.removeElement(t),a=null),this.checkToPassAppContext(i,e),!a||!this.checkDom(a.wrapContainer)){this.checkAndClearCache(e);const{wrapContainer:l,nativeContainer:u,reuse:c}=this.getWrapContainer(r,s,{id:t,options:o});if(l){const o=`${this.renderId}`;l.id=t,l.setAttribute("data-vue-renderId",o),l.style.display="none",c||n.render(i,l),a={wrapContainer:l,nativeContainer:u,container:s,renderId:this.renderId,graphic:e,isInViewport:!0,lastPosition:null,lastStyle:{}},this.htmlMap[t]=a}}a&&(a.renderId=this.renderId,a.lastAccessed=Date.now(),this.updateAccessQueue(t),this.updateStyleOfWrapContainer(e,r,a.wrapContainer,a.nativeContainer))}getGraphicOptions(e){const{vue:t}=e?.attribute||{};if(!t)return null;return{id:`vue_${o.isNil(t.id)?e.id??e._uid:t.id}`,options:t}}checkToPassAppContext(e,t){try{const n=this.getCustomConfig(t),o=n?.getVueUserAppContext?.()??this.currentContext;o?.components&&o?.directives&&(e.appContext=o)}catch(e){}}getCustomConfig(e){const t=_(e);return t?.stage?.table?.options?.customConfig}checkNeedRender(e){const{id:t,options:n}=this.getGraphicOptions(e)||{};if(!t)return!1;if(!e.stage)return!1;const{element:o}=n;if(!o)return!1;return this.checkInViewport(e)}checkInViewport(e){return this.checkInViewportByZone(e,this.VIEWPORT_BUFFER)}checkInBuffer(e){return this.checkInViewportByZone(e,this.BUFFER_ZONE)}checkInViewportByZone(e,t=0){const{stage:n,globalAABBBounds:o}=e;if(!n)return!1;const{AABBBounds:r}=n,i=r.x1-t,l=r.x2+t,s=r.y1-t,a=r.y2+t;return o.x1<l&&o.x2>i&&o.y1<a&&o.y2>s}updateAccessQueue(e){const t=this.accessQueue.indexOf(e);t>-1&&this.accessQueue.splice(t,1),this.accessQueue.unshift(e)}checkAndClearCache(e){const{viewportNodes:t,bufferNodes:n,cacheNodes:o}=this.classifyNodes(),r=t.length+n.length+o.length,i=this.getCustomConfig(e),l=i?.maxDomCacheCount??this.MAX_CACHE_COUNT;if(r<=l)return;const s=r-l;let a=o.slice(0,s);if(a.length<s){const e=n.sort(((e,t)=>this.htmlMap[e].lastAccessed-this.htmlMap[t].lastAccessed)).slice(0,s-a.length);a=a.concat(e)}a.forEach((e=>this.removeElement(e,!0)))}classifyNodes(){const e=[],t=[],n=[];return Object.keys(this.htmlMap).forEach((o=>{const r=this.htmlMap[o];r.isInViewport?e.push(o):this.checkInBuffer(r.graphic)?t.push(o):n.push(o)})),{viewportNodes:e,bufferNodes:t,cacheNodes:n}}checkDom(e){return!!e&&document.contains(e)}removeAllDom(e){this.htmlMap&&(Object.keys(this.htmlMap).forEach((e=>{this.removeElement(e,!0)})),this.htmlMap=null)}removeElement(e,t){const o=this.htmlMap?.[e];if(!o)return;const{wrapContainer:r}=o;if(r){if(t)n.render(null,r),this.checkDom(r)&&super.removeElement(e),delete this.htmlMap[e];else{r.remove(),o.isInViewport=!1;const t=this.accessQueue.indexOf(e);t>-1&&this.accessQueue.splice(t,1)}this.removeWrapContainerEventListener(r)}}getWrapContainer(e,t,n){let o;o=t?"string"==typeof t?r.application.global.getElementById(t):t:e.window.getContainer();const{id:i}=n||{},l=this.htmlMap?.[i];if(l&&!l.isInViewport){const{wrapContainer:e}=l;return this.checkDom(e)||o.appendChild(e),{reuse:!0,wrapContainer:e,nativeContainer:o}}return{wrapContainer:r.application.global.createDom({tagName:"div",parent:o}),nativeContainer:o}}updateStyleOfWrapContainer(e,t,n,r){const{attribute:i,type:l}=e,{vue:s,width:a,height:u,visible:c,display:d,...p}=i||{},{x:h,y:C}=this.calculatePosition(e,s.anchorType),{left:y,top:f}=this.calculateOffset(t,r,h,C),{id:m}=this.getGraphicOptions(e)||{},g=m?this.htmlMap[m]:null;if(!g)return;if(!(!g.lastPosition||g.lastPosition.x!==y||g.lastPosition.y!==f))return;const{pointerEvents:E}=s,v=this.parseDefaultStyleFromGraphic(e),b=this.convertCellStyle(e);Object.assign(v,{width:`${a}px`,height:`${u}px`,overflow:"hidden",...b||{},...p||{},transform:`translate(${y}px, ${f}px)`,boxSizing:"border-box",display:!1!==c?d||"block":"none",pointerEvents:!0===E?"all":E||"none",position:"absolute"}),"none"!==v.pointerEvents&&this.checkToAddEventListener(n),"text"===l&&"position"===s.anchorType&&Object.assign(v,this.getTransformOfText(e)),this.applyUserStyles(s,v,{offsetX:y,offsetTop:f,graphic:e,wrapContainer:n});!o.isEqual(g.lastStyle,v)&&(this.styleUpdateQueue.set(n.id,v),this.requestStyleUpdate(),g.lastStyle=v)}checkToAddEventListener(e){if(!this.eventHandlers.has(e)){const t=e=>{e.preventDefault(),this.onWheel(e)};e.addEventListener("wheel",t,{passive:!1}),this.eventHandlers.set(e,t)}}requestStyleUpdate(){this.styleUpdateRequested||(this.styleUpdateRequested=!0,r.vglobal.getRequestAnimationFrame()((()=>{this.styleUpdateQueue.forEach(((e,t)=>{const n=this.htmlMap?.[t]?.wrapContainer;n&&Object.assign(n.style,e)})),this.styleUpdateQueue.clear(),this.styleUpdateRequested=!1})))}convertCellStyle(e){const{col:t,row:n,stage:r}=_(e),i=r?.table?.getCellStyle(t,n);if(!o.isObject(i))return;const{lineHeight:l,padding:s,...a}=i;return{...a,padding:o.isArray(s)?s.map((e=>`${e}px`)).join(" "):s}}calculatePosition(e,t){const n=e.globalAABBBounds;if("position"===t||n.empty()){const t=e.globalTransMatrix;return{x:t.e,y:t.f}}return o.calculateAnchorOfBounds(n,t||"top-left")}calculateOffset(e,t,n,o){const i=r.application.global.getElementTopLeft(t,!1),l=e.window.getTopLeft(!1);return{left:n+l.left-i.left,top:o+l.top-i.top}}applyUserStyles(e,t,n){if(o.isFunction(e.style)){const o=e.style({top:n.offsetTop,left:n.offsetX,width:n.graphic.globalAABBBounds.width(),height:n.graphic.globalAABBBounds.height()},n.graphic,n.wrapContainer);Object.assign(t,o)}else o.isObject(e.style)?Object.assign(t,e.style):o.isString(e.style)&&Object.assign(t,o.styleStringToObject(e.style))}}function _(e){for(;e?.parent;){if(e.name===t.CUSTOM_CONTAINER_NAME||(e.name||"").startsWith(t.CUSTOM_MERGE_PRE_NAME))return e;e=e.parent}return{col:-1,row:-1,stage:null}}var M=n.defineComponent({__name:"base-table",props:{type:{type:String,required:!1},options:{type:null,required:!1},records:{type:Array,required:!1},width:{type:[Number,String],required:!1,default:"100%"},height:{type:[Number,String],required:!1,default:"100%"},onReady:{type:Function,required:!1},onError:{type:Function,required:!1},keepColumnWidthChange:{type:Boolean,required:!1},onClickCell:{type:Function,required:!1},onDblClickCell:{type:Function,required:!1},onMouseDownCell:{type:Function,required:!1},onMouseUpCell:{type:Function,required:!1},onSelectedCell:{type:Function,required:!1},onKeyDown:{type:Function,required:!1},onMouseEnterTable:{type:Function,required:!1},onMouseLeaveTable:{type:Function,required:!1},onMouseDownTable:{type:Function,required:!1},onMouseMoveCell:{type:Function,required:!1},onMouseEnterCell:{type:Function,required:!1},onMouseLeaveCell:{type:Function,required:!1},onContextMenuCell:{type:Function,required:!1},onContextMenuCanvas:{type:Function,required:!1},onResizeColumn:{type:Function,required:!1},onResizeColumnEnd:{type:Function,required:!1},onChangeHeaderPosition:{type:Function,required:!1},onChangeHeaderPositionStart:{type:Function,required:!1},onChangeHeaderPositionFail:{type:Function,required:!1},onSortClick:{type:Function,required:!1},onFreezeClick:{type:Function,required:!1},onScroll:{type:Function,required:!1},onDropdownMenuClick:{type:Function,required:!1},onMouseOverChartSymbol:{type:Function,required:!1},onDragSelectEnd:{type:Function,required:!1},onDropdownIconClick:{type:Function,required:!1},onDropdownMenuClear:{type:Function,required:!1},onTreeHierarchyStateChange:{type:Function,required:!1},onShowMenu:{type:Function,required:!1},onHideMenu:{type:Function,required:!1},onIconClick:{type:Function,required:!1},onLegendItemClick:{type:Function,required:!1},onLegendItemHover:{type:Function,required:!1},onLegendItemUnHover:{type:Function,required:!1},onLegendChange:{type:Function,required:!1},onMouseEnterAxis:{type:Function,required:!1},onMouseLeaveAxis:{type:Function,required:!1},onCheckboxStateChange:{type:Function,required:!1},onRadioStateChange:{type:Function,required:!1},onAfterRender:{type:Function,required:!1},onInitialized:{type:Function,required:!1},onPivotSortClick:{type:Function,required:!1},onDrillMenuClick:{type:Function,required:!1},onVChartEventType:{type:Function,required:!1},onChangeCellValue:{type:Function,required:!1},onMousedownFillHandle:{type:Function,required:!1},onDragFillHandleEnd:{type:Function,required:!1},onDblclickFillHandle:{type:Function,required:!1},onScrollVerticalEnd:{type:Function,required:!1},onScrollHorizontalEnd:{type:Function,required:!1},onChangCellValue:{type:Function,required:!1},onEmptyTipClick:{type:Function,required:!1},onEmptyTipDblClick:{type:Function,required:!1},onButtonClick:{type:Function,required:!1},onBeforeCacheChartImage:{type:Function,required:!1},onPastedData:{type:Function,required:!1}},emits:b,setup(e,{expose:r,emit:i}){const l=e,s=n.ref(null),a=n.shallowRef(null),u=n.ref(new Map),c=n.ref([]),d=n.ref([]);w(l,a),function(e,t){const r=n.getCurrentInstance(),i=e?.options?.customConfig?.createReactContainer;n.watchEffect((()=>{if(!i)return;const e=t.value?.scenegraph?.stage?.pluginService;if(!e)return;const n=e.findPluginsByName("VTableVueAttributePlugin");if(o.isArray(n)&&n.length)return;const l=new L(r?.appContext);e.register(l)}))}(l,a),r({vTableInstance:a});const p=n.computed((()=>"number"==typeof l.width?`${l.width}px`:l.width)),h=n.computed((()=>"number"==typeof l.height?`${l.height}px`:l.height)),C=i,y=(e,t)=>{const n=new e(s.value,t);a.value=n,u.value.clear(),c.value=[],d.value=[],n.on("resize_column_end",(e=>{if(!l.keepColumnWidthChange)return;const{col:t,colWidths:o}=e,r=o[t];if(n.isPivotTable()){const e=n.getCellHeaderPaths(t,n.columnHeaderLevelCount);let o=null;o="rowHeader"===e.cellLocation?e.rowHeaderPaths:e.colHeaderPaths;let i=!1;for(let e=0;e<c.value.length;e++){const t=c.value[e];JSON.stringify(t.dimensions)===JSON.stringify(o)&&(t.width=r,i=!0)}i||c.value.push({dimensions:o,width:r})}else{const e=n.getBodyColumnDefine(t,0);e?.key&&u.value.set(e.key,r)}}))},f=()=>{if(!s.value)return;a.value&&a.value.release();const e=()=>void 0!==l.records&&null!==l.records&&l.records.length>0?l.records:l.options.records;try{switch(l.type){case"list":y(t.ListTable,{...l.options,records:e()});break;case"pivot":y(t.PivotTable,{...l.options,records:e()});break;case"chart":y(t.PivotChart,{...l.options,records:e()})}n=a.value,b.forEach((e=>{n.on(v[e],(t=>{C(e,t)}))})),l.onReady?.(a.value,!0)}catch(e){l.onError?.(e)}var n},m=e=>{if(a.value)try{if(l.keepColumnWidthChange){const t=function(e,t,n){if(n.isPivotTable())return t;const o=[];return e.forEach(((e,t)=>{o.push({key:t,width:e})})),o}(u.value,c.value,a.value);e={...e,columnWidthConfig:t,columnWidthConfigForRowHeader:t}}switch(l.type){case"list":a.value instanceof t.ListTable&&a.value.updateOption(e);break;case"pivot":a.value instanceof t.PivotTable&&a.value.updateOption(e);break;case"chart":a.value instanceof t.PivotChart&&a.value.updateOption(e)}}catch(e){l.onError?.(e)}};return n.onMounted(f),n.onBeforeUnmount((()=>{a.value?.release()})),n.watch((()=>l.options),((e,t)=>{a.value?m(e):f()})),n.watch((()=>l.records),((e,t)=>{a.value?m({...l.options,records:e}):f()}),{deep:!0}),(e,t)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"vTableContainer",ref:s,style:n.normalizeStyle([{width:p.value,height:h.value},{position:"relative"}])},null,4))}}),O=n.defineComponent({__name:"list-table",props:{options:{type:Object,required:!0},records:{type:Array,required:!1},width:{type:[String,Number],required:!1},height:{type:[String,Number],required:!1}},setup(e,{expose:t}){const o=e,r=n.ref(null),i=n.useSlots(),l=n.computed((()=>{const e=function(e){const t={columns:[],tooltip:{},menu:{}},n={ListColumn:"columns",Tooltip:"tooltip",Menu:"menu"};return e.forEach((e=>{e.props=a(e.props);const o=e.type?.symbol||e.type?.name,r=n[o];r&&("columns"===r&&e.children&&(e.children.customLayout&&(e.props.customLayout=d(e.children)),e.children.headerCustomLayout&&(e.props.headerCustomLayout=d(e.children,!0)),C(e.props,e.children.edit)),Array.isArray(t[r])?t[r].push(e.props):t[r]=e.props)})),t}(u(i.default?.()||[]));return g(o.options,e)}));return t({vTableInstance:n.computed((()=>r.value?.vTableInstance||null))}),(t,o)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(M,n.mergeProps({type:"list",options:l.value,records:e.records,width:e.width,height:e.height,ref_key:"baseTableRef",ref:r},t.$attrs),null,16,["options","records","width","height"]),n.renderSlot(t.$slots,"default")],64))}}),A=n.defineComponent({__name:"pivot-table",props:{options:{type:Object,required:!0},records:{type:Array,required:!1},width:{type:[String,Number],required:!1},height:{type:[String,Number],required:!1}},setup(e,{expose:t}){const o=e,r=n.shallowRef(null),i=n.useSlots(),l=n.computed((()=>{const e=m(u(i.default?.()||[]));return g(o.options,e)}));return t({vTableInstance:n.computed((()=>r.value?.vTableInstance||null))}),(t,o)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(M,n.mergeProps({type:"pivot",options:l.value,records:e.records,width:e.width,height:e.height,ref_key:"baseTableRef",ref:r},t.$attrs),null,16,["options","records","width","height"]),n.renderSlot(t.$slots,"default")],64))}}),F=n.defineComponent({__name:"pivot-chart",props:{options:{type:Object,required:!0},records:{type:Array,required:!1},width:{type:[String,Number],required:!1},height:{type:[String,Number],required:!1}},setup(e,{expose:t}){const o=e,r=n.shallowRef(null),i=n.useSlots(),l=n.computed((()=>{const e=m(u(i.default?.()||[]));return g(o.options,e)}));return t({vTableInstance:n.computed((()=>r.value?.vTableInstance||null))}),(t,o)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(M,n.mergeProps({type:"chart",options:l.value,records:e.records,width:e.width,height:e.height,ref_key:"baseTableRef",ref:r},t.$attrs),null,16,["options","records","width","height"]),n.renderSlot(t.$slots,"default")],64))}});function N(e){return null}function S(e){return null}function R(e){return null}function D(e){return null}function I(e){return null}function k(e){return null}function P(e){return null}function q(e){return null}function H(e){return null}function V(){return null}function x(){return null}function B(){return null}function U(e){return null}function j(e){return null}function z(e){return null}N.symbol="ListColumn",S.symbol="PivotColumnDimension",R.symbol="PivotRowDimension",D.symbol="PivotColumnHeaderTitle",I.symbol="PivotRowHeaderTitle",k.symbol="PivotIndicator",P.symbol="PivotCorner",q.symbol="Menu",H.symbol="Tooltip",V.symbol="Group",x.symbol="Image",B.symbol="Text",U.symbol="Tag",j.symbol="Radio",z.symbol="CheckBox";e.VTable=l,Object.defineProperty(e,"register",{enumerable:!0,get:function(){return t.register}}),e.CheckBox=z,e.DYNAMIC_RENDER_EDITOR=h,e.Group=V,e.Image=x,e.ListColumn=N,e.ListTable=O,e.Menu=q,e.PivotChart=F,e.PivotColumnDimension=S,e.PivotColumnHeaderTitle=D,e.PivotCorner=P,e.PivotIndicator=k,e.PivotRowDimension=R,e.PivotRowHeaderTitle=I,e.PivotTable=A,e.Radio=j,e.Tag=U,e.Text=B,e.Tooltip=H,e.registerChartModule=(e,t)=>{l.register.chartModule(e,t)},e.version="1.25.1-alpha.0"}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@visactor/vtable"),require("vue"),require("@visactor/vutils"),require("@visactor/vtable/es/vrender")):"function"==typeof define&&define.amd?define(["exports","@visactor/vtable","vue","@visactor/vutils","@visactor/vtable/es/vrender"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueVTable={},e.VTable,e.Vue,e.VUtils,e.VTable.vrender)}(this,(function(e,t,n,o,i){"use strict";function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var l=r(t);function s(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}function a(e){const t={};for(const n in e)if(e.hasOwnProperty(n)){t[s(n)]=e[n]}return t}function u(e){return e.flatMap((e=>Array.isArray(e.children)?u(e.children):e))}function c(e,t,i){const r={Group:l.CustomLayout.Group,Image:l.CustomLayout.Image,Text:l.CustomLayout.Text,Tag:l.CustomLayout.Tag,Radio:l.CustomLayout.Radio,CheckBox:l.CustomLayout.CheckBox};return{rootComponent:function e(l){var u,c;if(!l)return null;const{type:d,children:p}=l,h=a(l.props),C=(null==d?void 0:d.symbol)||(null==d?void 0:d.name),v=r[C];if(!v)return null;const y=new v(Object.assign({},h));!function(e,t){Object.keys(t).forEach((n=>{if(function(e,t){return e.startsWith("on")&&o.isFunction(t[e])}(n,t)){let o;o=n.startsWith("on")?n.slice(2).toLowerCase():s(n.slice(2)).toLowerCase(),e.addEventListener(o,t[n])}}))}(y,h);const f=function(e){var t;return(null===(t=null==e?void 0:e.default)||void 0===t?void 0:t.call(e))||e||[]}(p);if(o.isObject(null==h?void 0:h.vue)){const{element:e}=h.vue;let o=null!=e?e:f.find((e=>(null==e?void 0:e.type)!==Symbol.for("v-cmt")));return o=n.isVNode(o)?o.key?o:n.cloneVNode(o,{key:`row_${i.row}_col_${i.col}`}):null,Object.assign(l.props.vue,{element:o,container:t?null===(u=null==i?void 0:i.table)||void 0===u?void 0:u.headerDomContainer:null===(c=null==i?void 0:i.table)||void 0===c?void 0:c.bodyDomContainer}),y}return f.forEach((t=>{const n=e(t);n?y.add(n):t.type===Symbol.for("v-fgt")&&t.children.forEach((t=>{const n=e(t);n&&y.add(n)}))})),y}(e)}}function d(e,t){return n=>{const{table:o,row:i,col:r,rect:l}=n,s=o.getCellOriginRecord(r,i),{height:a,width:u}=null!=l?l:o.getCellRect(r,i),d=t?"headerCustomLayout":"customLayout";if(!e[d])return null;const p=e[d]({table:o,row:i,col:r,rect:l,record:s,height:a,width:u})[0],{rootComponent:h}=c(p,t,n);return{rootContainer:h,renderDefault:!1}}}class p{constructor(e){this.currentContext=e,this.tableContainer=null,this.currentValue=null,this.wrapContainer=null,this.nodeMap=new Map}registerNode(e,t,n){o.isValid(e)&&o.isValid(t)&&"function"==typeof n&&(this.nodeMap.has(e)||this.nodeMap.set(e,new Map),this.nodeMap.get(e).set(t,n))}getNode(e,t){var n;return null===(n=this.nodeMap.get(e))||void 0===n?void 0:n.get(t)}removeNode(e){this.nodeMap.delete(e)}release(e){o.isValid(e)?this.removeNode(e):this.nodeMap.clear()}async onStart(e){const{value:t}=e;this.setValue(t),await this.createElement(e)}async createElement(e){const{row:i,col:r,value:l,table:s,container:a,referencePosition:u}=e;if(!a)return!1;const c=s.getBodyColumnDefine(r,i),{editConfig:d}=c||{},{id:p}=s,h=this.getColumnKeyField(c);if(!o.isValid(h)||!o.isValid(p))return!1;if("function"==typeof(null==d?void 0:d.editBefore)){if(!await d.editBefore(e))return s.showTooltip(r,i,{content:d.disablePrompt||"This field is not allowed to be edited",referencePosition:{rect:null==u?void 0:u.rect,placement:t.TYPES.Placement.top},style:{bgColor:"black",color:"white",arrowMark:!0},disappearDelay:1e3}),!1}const C=null==s?void 0:s.getCellOriginRecord(r,i),v=this.getNode(p,h);if(!v)return!1;const y=n.h(v,{row:i,col:r,value:l,refValue:n.customRef(((e,t)=>({get:()=>(e(),this.getValue()),set:e=>{this.setValue(e),t()}}))),record:C,table:s,onChange:e=>this.setValue(e)});if(!y||!n.isVNode(y))return!1;this.checkToPassAppContext(y,s);const f=document.createElement("div");f.style.position="absolute",f.style.width="100%",f.style.boxSizing="border-box";const{bgColor:m}=s.getCellStyle(r,i)||{};return f.style.backgroundColor=m||"#FFFFFF",this.wrapContainer=f,this.tableContainer=a,this.tableContainer.appendChild(f),n.render(y,f),(null==u?void 0:u.rect)&&this.adjustPosition(u.rect),!0}checkToPassAppContext(e,t){var n,o,i,r;try{const l=null!==(r=null===(i=null===(o=null===(n=t.options)||void 0===n?void 0:n.customConfig)||void 0===o?void 0:o.getVueUserAppContext)||void 0===i?void 0:i.call(o))&&void 0!==r?r:this.currentContext;(null==l?void 0:l.components)&&(null==l?void 0:l.directives)&&(e.appContext=l)}catch(e){}}getColumnKeyField(e){const{field:t,key:n}=e||{};return o.isValid(n)?n:t}getValue(){return this.currentValue}setValue(e){this.currentValue=e}adjustPosition(e){this.wrapContainer&&(this.wrapContainer.style.top=`${e.top}px`,this.wrapContainer.style.left=`${e.left}px`,this.wrapContainer.style.width=`${e.width}px`,this.wrapContainer.style.height=`${e.height}px`)}async validateValue(e,n,i,r){const{col:l,row:s}=i||{};if(!o.isValid(l)||!o.isValid(s))return!0;const a=r.getBodyColumnDefine(l,s),{editConfig:u}=a||{};if("function"==typeof(null==u?void 0:u.validateValue)){const o=await u.validateValue({col:l,row:s,value:e,oldValue:n,table:r});if(!1===o){const e=r.getVisibleCellRangeRelativeRect({col:l,row:s});return r.showTooltip(l,s,{content:u.invalidPrompt||"invalid",referencePosition:{rect:e,placement:t.TYPES.Placement.top},style:{bgColor:"red",color:"white",arrowMark:!0},disappearDelay:1e3}),!1}return o}return!0}onEnd(){this.wrapContainer&&this.tableContainer&&(n.render(null,this.wrapContainer),this.tableContainer.removeChild(this.wrapContainer)),this.wrapContainer=null,this.tableContainer=null}isEditorElement(e){var t;return(null===(t=this.wrapContainer)||void 0===t?void 0:t.contains(e))||this.isClickEditorElement(e)}isClickEditorElement(e){for(;e;){if(e.classList&&e.classList.contains("table-editor-element"))return!0;e=e.parentNode}return!1}}const h="dynamic-render-editor";function C(e,t){const{editor:n}=e||{},i=v(e);if(!o.isValid(i)||n!==h)return!1;if("function"==typeof t){if(e.getEditCustomNode=t,Array.isArray(e.columns)&&e.columns.length)for(const n of e.columns)C(n,t);return!0}return"function"==typeof e.getEditCustomNode}function v(e){const{field:t,key:n}=e||{};return o.isValid(n)?n:t}function y(e,n){const o=t.register.editor(h);let i=o||void 0;return!i&&e&&(i=new p(n),t.register.editor(h,i)),i}function f(e){const t={columns:[],columnHeaderTitle:[],rows:[],rowHeaderTitle:[],indicators:[],corner:{},tooltip:{},menu:{}},n={PivotColumnDimension:"columns",PivotColumnHeaderTitle:"columnHeaderTitle",PivotRowDimension:"rows",PivotRowHeaderTitle:"rowHeaderTitle",PivotCorner:"corner",PivotIndicator:"indicators",Tooltip:"tooltip",Menu:"menu"};return e.forEach((e=>{var o,i;e.props=a(e.props);const r=(null===(o=e.type)||void 0===o?void 0:o.symbol)||(null===(i=e.type)||void 0===i?void 0:i.name),l=n[r];l&&(Array.isArray(t[l])?e.props.hasOwnProperty("objectHandler")?t[l].push(e.props.objectHandler):t[l].push(e.props):t[l]=e.props)})),t}function m(e,t){return Object.assign(Object.assign({},e),{columns:t.columns&&t.columns.length?t.columns:e.columns,columnHeaderTitle:t.columnHeaderTitle&&t.columnHeaderTitle.length?t.columnHeaderTitle:e.columnHeaderTitle,rows:t.rows&&t.rows.length?t.rows:e.rows,rowHeaderTitle:t.rowHeaderTitle&&t.rowHeaderTitle.length?t.rowHeaderTitle:e.rowHeaderTitle,indicators:t.indicators&&t.indicators.length?t.indicators:e.indicators,corner:Object.keys(e.corner||{}).length?e.corner:t.corner,tooltip:Object.keys(t.tooltip||{}).length?t.tooltip:e.tooltip,menu:Object.keys(t.menu||{}).length?t.menu:e.menu})}const g=Object.assign(Object.assign(Object.assign({},t.ListTable.EVENT_TYPE),t.PivotTable.EVENT_TYPE),t.PivotChart.EVENT_TYPE),E={onClickCell:g.CLICK_CELL,onDblClickCell:g.DBLCLICK_CELL,onMouseDownCell:g.MOUSEDOWN_CELL,onMouseUpCell:g.MOUSEUP_CELL,onSelectedCell:g.SELECTED_CELL,onKeyDown:g.KEYDOWN,onMouseEnterTable:g.MOUSEENTER_TABLE,onMouseLeaveTable:g.MOUSELEAVE_TABLE,onMouseDownTable:g.MOUSEDOWN_TABLE,onMouseMoveCell:g.MOUSEMOVE_CELL,onMouseEnterCell:g.MOUSEENTER_CELL,onMouseLeaveCell:g.MOUSELEAVE_CELL,onContextMenuCell:g.CONTEXTMENU_CELL,onContextMenuCanvas:g.CONTEXTMENU_CANVAS,onResizeColumn:g.RESIZE_COLUMN,onResizeColumnEnd:g.RESIZE_COLUMN_END,onChangeHeaderPosition:g.CHANGE_HEADER_POSITION,onChangeHeaderPositionStart:g.CHANGE_HEADER_POSITION_START,onChangeHeaderPositionFail:g.CHANGE_HEADER_POSITION_FAIL,onSortClick:g.SORT_CLICK,onFreezeClick:g.FREEZE_CLICK,onScroll:g.SCROLL,onDropdownMenuClick:g.DROPDOWN_MENU_CLICK,onMouseOverChartSymbol:g.MOUSEOVER_CHART_SYMBOL,onDragSelectEnd:g.DRAG_SELECT_END,onDropdownIconClick:g.DROPDOWN_ICON_CLICK,onDropdownMenuClear:g.DROPDOWN_MENU_CLEAR,onTreeHierarchyStateChange:g.TREE_HIERARCHY_STATE_CHANGE,onShowMenu:g.SHOW_MENU,onHideMenu:g.HIDE_MENU,onIconClick:g.ICON_CLICK,onLegendItemClick:g.LEGEND_ITEM_CLICK,onLegendItemHover:g.LEGEND_ITEM_HOVER,onLegendItemUnHover:g.LEGEND_ITEM_UNHOVER,onLegendChange:g.LEGEND_CHANGE,onMouseEnterAxis:g.MOUSEENTER_AXIS,onMouseLeaveAxis:g.MOUSELEAVE_AXIS,onCheckboxStateChange:g.CHECKBOX_STATE_CHANGE,onRadioStateChange:g.RADIO_STATE_CHANGE,onAfterRender:g.AFTER_RENDER,onInitialized:g.INITIALIZED,onPivotSortClick:g.PIVOT_SORT_CLICK,onDrillMenuClick:g.DRILLMENU_CLICK,onVChartEventType:g.VCHART_EVENT_TYPE,onChangeCellValue:g.CHANGE_CELL_VALUE,onMousedownFillHandle:g.MOUSEDOWN_FILL_HANDLE,onDragFillHandleEnd:g.DRAG_FILL_HANDLE_END,onDblclickFillHandle:g.DBLCLICK_FILL_HANDLE,onScrollVerticalEnd:g.SCROLL_VERTICAL_END,onScrollHorizontalEnd:g.SCROLL_HORIZONTAL_END,onChangCellValue:g.CHANGE_CELL_VALUE,onEmptyTipClick:g.EMPTY_TIP_CLICK,onEmptyTipDblClick:g.EMPTY_TIP_DBLCLICK,onButtonClick:g.BUTTON_CLICK,onBeforeCacheChartImage:g.BEFORE_CACHE_CHART_IMAGE,onPastedData:g.PASTED_DATA,onSelectedClear:g.SELECTED_CLEAR},b=Object.keys(E);function w(e,t){const i=n.getCurrentInstance(),r=n.computed((()=>{var t;const n=T((null===(t=e.options)||void 0===t?void 0:t.columns)||[]);return o.isArray(n)?n.filter((e=>!!o.isObject(e)&&!!C(e))):[]}));function l(){var e;return null===(e=t.value)||void 0===e?void 0:e.id}n.watchEffect((()=>{!function(){const e=l();if(!o.isValid(e))return;let t=y();t?t.removeNode(e):r.value.length>0&&(t=y(!0,null==i?void 0:i.appContext));r.value.forEach((n=>{const{getEditCustomNode:o}=n,i=v(n);t.registerNode(e,i,o),delete n.editCustomNode}))}()})),n.onBeforeUnmount((()=>{!function(){const e=l();if(!o.isValid(e))return;const t=y();null==t||t.release(e)}()}))}function T(e){return e.flatMap((e=>Array.isArray(e.columns)?T(e.columns):e))}var O=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);i<o.length;i++)t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]])}return n};class L extends i.HtmlAttributePlugin{constructor(e){super(),this.name="VTableVueAttributePlugin",this.renderQueue=new Set,this.isRendering=!1,this.MAX_CACHE_COUNT=100,this.accessQueue=[],this.VIEWPORT_BUFFER=100,this.BUFFER_ZONE=500,this.styleUpdateQueue=new Map,this.styleUpdateRequested=!1,this.eventHandlers=new WeakMap,this.currentContext=e}renderGraphicHTML(e){this.checkNeedRender(e)&&(this.renderQueue.add(e),this.scheduleRender())}scheduleRender(){this.isRendering||(this.isRendering=!0,i.vglobal.getRequestAnimationFrame()((()=>{this.renderQueue.forEach((e=>{try{this.doRenderGraphic(e)}catch(t){const{id:n}=this.getGraphicOptions(e)||{};this.removeElement(n,!0)}})),this.renderQueue.clear(),this.isRendering=!1})))}doRenderGraphic(e){var t;const{id:o,options:i}=this.getGraphicOptions(e);if(!o)return;const r=e.stage,{element:l,container:s}=i,a=s?function(e){var t;const{col:n,row:o,stage:i}=_(e);let r=null===(t=e.attribute.vue)||void 0===t?void 0:t.container;const{table:l}=i;r===l.bodyDomContainer?n<l.frozenColCount&&o>=l.rowCount-l.bottomFrozenRowCount?r=l.bottomFrozenBodyDomContainer:n>=l.colCount-l.rightFrozenColCount&&o>=l.rowCount-l.bottomFrozenRowCount?r=l.rightFrozenBottomDomContainer:o>=l.rowCount-l.bottomFrozenRowCount?r=l.bottomFrozenBodyDomContainer:n<l.frozenColCount?r=l.frozenBodyDomContainer:n>=l.colCount-l.rightFrozenColCount&&(r=l.rightFrozenBodyDomContainer):r===l.headerDomContainer&&(n<l.frozenColCount?r=l.frozenHeaderDomContainer:n>=l.colCount-l.rightFrozenColCount&&(r=l.rightFrozenHeaderDomContainer));return r}(e):s;let u=null===(t=this.htmlMap)||void 0===t?void 0:t[o];if(u&&a&&a!==u.container&&(this.removeElement(o),u=null),this.checkToPassAppContext(l,e),!u||!this.checkDom(u.wrapContainer)){this.checkAndClearCache(e);const{wrapContainer:t,nativeContainer:s,reuse:c}=this.getWrapContainer(r,a,{id:o,options:i});if(t){const i=`${this.renderId}`;t.id=o,t.setAttribute("data-vue-renderId",i),t.style.display="none",c||n.render(l,t),u={wrapContainer:t,nativeContainer:s,container:a,renderId:this.renderId,graphic:e,isInViewport:!0,lastPosition:null,lastStyle:{}},this.htmlMap[o]=u}}u&&(u.renderId=this.renderId,u.lastAccessed=Date.now(),this.updateAccessQueue(o),this.updateStyleOfWrapContainer(e,r,u.wrapContainer,u.nativeContainer))}getGraphicOptions(e){var t;const{vue:n}=(null==e?void 0:e.attribute)||{};if(!n)return null;return{id:`vue_${o.isNil(n.id)?null!==(t=e.id)&&void 0!==t?t:e._uid:n.id}`,options:n}}checkToPassAppContext(e,t){var n,o;try{const i=this.getCustomConfig(t),r=null!==(o=null===(n=null==i?void 0:i.getVueUserAppContext)||void 0===n?void 0:n.call(i))&&void 0!==o?o:this.currentContext;(null==r?void 0:r.components)&&(null==r?void 0:r.directives)&&(e.appContext=r)}catch(e){}}getCustomConfig(e){var t,n,o;const i=_(e);return null===(o=null===(n=null===(t=null==i?void 0:i.stage)||void 0===t?void 0:t.table)||void 0===n?void 0:n.options)||void 0===o?void 0:o.customConfig}checkNeedRender(e){const{id:t,options:n}=this.getGraphicOptions(e)||{};if(!t)return!1;if(!e.stage)return!1;const{element:o}=n;if(!o)return!1;return this.checkInViewport(e)}checkInViewport(e){return this.checkInViewportByZone(e,this.VIEWPORT_BUFFER)}checkInBuffer(e){return this.checkInViewportByZone(e,this.BUFFER_ZONE)}checkInViewportByZone(e,t=0){const{stage:n,globalAABBBounds:o}=e;if(!n)return!1;const{AABBBounds:i}=n,r=i.x1-t,l=i.x2+t,s=i.y1-t,a=i.y2+t;return o.x1<l&&o.x2>r&&o.y1<a&&o.y2>s}updateAccessQueue(e){const t=this.accessQueue.indexOf(e);t>-1&&this.accessQueue.splice(t,1),this.accessQueue.unshift(e)}checkAndClearCache(e){var t;const{viewportNodes:n,bufferNodes:o,cacheNodes:i}=this.classifyNodes(),r=n.length+o.length+i.length,l=this.getCustomConfig(e),s=null!==(t=null==l?void 0:l.maxDomCacheCount)&&void 0!==t?t:this.MAX_CACHE_COUNT;if(r<=s)return;const a=r-s;let u=i.slice(0,a);if(u.length<a){const e=o.sort(((e,t)=>this.htmlMap[e].lastAccessed-this.htmlMap[t].lastAccessed)).slice(0,a-u.length);u=u.concat(e)}u.forEach((e=>this.removeElement(e,!0)))}classifyNodes(){const e=[],t=[],n=[];return Object.keys(this.htmlMap).forEach((o=>{const i=this.htmlMap[o];i.isInViewport?e.push(o):this.checkInBuffer(i.graphic)?t.push(o):n.push(o)})),{viewportNodes:e,bufferNodes:t,cacheNodes:n}}checkDom(e){return!!e&&document.contains(e)}removeAllDom(e){this.htmlMap&&(Object.keys(this.htmlMap).forEach((e=>{this.removeElement(e,!0)})),this.htmlMap=null)}removeElement(e,t){var o;const i=null===(o=this.htmlMap)||void 0===o?void 0:o[e];if(!i)return;const{wrapContainer:r}=i;if(r){if(t)n.render(null,r),this.checkDom(r)&&super.removeElement(e),delete this.htmlMap[e];else{r.remove(),i.isInViewport=!1;const t=this.accessQueue.indexOf(e);t>-1&&this.accessQueue.splice(t,1)}this.removeWrapContainerEventListener(r)}}getWrapContainer(e,t,n){var o;let r;r=t?"string"==typeof t?i.application.global.getElementById(t):t:e.window.getContainer();const{id:l}=n||{},s=null===(o=this.htmlMap)||void 0===o?void 0:o[l];if(s&&!s.isInViewport){const{wrapContainer:e}=s;return this.checkDom(e)||r.appendChild(e),{reuse:!0,wrapContainer:e,nativeContainer:r}}return{wrapContainer:i.application.global.createDom({tagName:"div",parent:r}),nativeContainer:r}}updateStyleOfWrapContainer(e,t,n,i){const{attribute:r,type:l}=e,s=r||{},{vue:a,width:u,height:c,visible:d,display:p}=s,h=O(s,["vue","width","height","visible","display"]),{x:C,y:v}=this.calculatePosition(e,a.anchorType),{left:y,top:f}=this.calculateOffset(t,i,C,v),{id:m}=this.getGraphicOptions(e)||{},g=m?this.htmlMap[m]:null;if(!g)return;if(!(!g.lastPosition||g.lastPosition.x!==y||g.lastPosition.y!==f))return;const{pointerEvents:E}=a,b=this.parseDefaultStyleFromGraphic(e),w=this.convertCellStyle(e);Object.assign(b,Object.assign(Object.assign(Object.assign({width:`${u}px`,height:`${c}px`,overflow:"hidden"},w||{}),h||{}),{transform:`translate(${y}px, ${f}px)`,boxSizing:"border-box",display:!1!==d?p||"block":"none",pointerEvents:!0===E?"all":E||"none",position:"absolute"})),"none"!==b.pointerEvents&&this.checkToAddEventListener(n),"text"===l&&"position"===a.anchorType&&Object.assign(b,this.getTransformOfText(e)),this.applyUserStyles(a,b,{offsetX:y,offsetTop:f,graphic:e,wrapContainer:n});!o.isEqual(g.lastStyle,b)&&(this.styleUpdateQueue.set(n.id,b),this.requestStyleUpdate(),g.lastStyle=b)}checkToAddEventListener(e){if(!this.eventHandlers.has(e)){const t=e=>{e.preventDefault(),this.onWheel(e)};e.addEventListener("wheel",t,{passive:!1}),this.eventHandlers.set(e,t)}}requestStyleUpdate(){this.styleUpdateRequested||(this.styleUpdateRequested=!0,i.vglobal.getRequestAnimationFrame()((()=>{this.styleUpdateQueue.forEach(((e,t)=>{var n,o;const i=null===(o=null===(n=this.htmlMap)||void 0===n?void 0:n[t])||void 0===o?void 0:o.wrapContainer;i&&Object.assign(i.style,e)})),this.styleUpdateQueue.clear(),this.styleUpdateRequested=!1})))}convertCellStyle(e){var t;const{col:n,row:i,stage:r}=_(e),l=null===(t=null==r?void 0:r.table)||void 0===t?void 0:t.getCellStyle(n,i);if(!o.isObject(l))return;const s=l,{lineHeight:a,padding:u}=s,c=O(s,["lineHeight","padding"]);return Object.assign(Object.assign({},c),{padding:o.isArray(u)?u.map((e=>`${e}px`)).join(" "):u})}calculatePosition(e,t){const n=e.globalAABBBounds;if("position"===t||n.empty()){const t=e.globalTransMatrix;return{x:t.e,y:t.f}}return o.calculateAnchorOfBounds(n,t||"top-left")}calculateOffset(e,t,n,o){const r=i.application.global.getElementTopLeft(t,!1),l=e.window.getTopLeft(!1);return{left:n+l.left-r.left,top:o+l.top-r.top}}applyUserStyles(e,t,n){if(o.isFunction(e.style)){const o=e.style({top:n.offsetTop,left:n.offsetX,width:n.graphic.globalAABBBounds.width(),height:n.graphic.globalAABBBounds.height()},n.graphic,n.wrapContainer);Object.assign(t,o)}else o.isObject(e.style)?Object.assign(t,e.style):o.isString(e.style)&&Object.assign(t,o.styleStringToObject(e.style))}}function _(e){for(;null==e?void 0:e.parent;){if(e.name===t.CUSTOM_CONTAINER_NAME||(e.name||"").startsWith(t.CUSTOM_MERGE_PRE_NAME))return e;e=e.parent}return{col:-1,row:-1,stage:null}}var M=n.defineComponent({__name:"base-table",props:{type:{type:String,required:!1},options:{type:null,required:!1},records:{type:Array,required:!1},width:{type:[Number,String],required:!1,default:"100%"},height:{type:[Number,String],required:!1,default:"100%"},onReady:{type:Function,required:!1},onError:{type:Function,required:!1},keepColumnWidthChange:{type:Boolean,required:!1},onClickCell:{type:Function,required:!1},onDblClickCell:{type:Function,required:!1},onMouseDownCell:{type:Function,required:!1},onMouseUpCell:{type:Function,required:!1},onSelectedCell:{type:Function,required:!1},onKeyDown:{type:Function,required:!1},onMouseEnterTable:{type:Function,required:!1},onMouseLeaveTable:{type:Function,required:!1},onMouseDownTable:{type:Function,required:!1},onMouseMoveCell:{type:Function,required:!1},onMouseEnterCell:{type:Function,required:!1},onMouseLeaveCell:{type:Function,required:!1},onContextMenuCell:{type:Function,required:!1},onContextMenuCanvas:{type:Function,required:!1},onResizeColumn:{type:Function,required:!1},onResizeColumnEnd:{type:Function,required:!1},onChangeHeaderPosition:{type:Function,required:!1},onChangeHeaderPositionStart:{type:Function,required:!1},onChangeHeaderPositionFail:{type:Function,required:!1},onSortClick:{type:Function,required:!1},onFreezeClick:{type:Function,required:!1},onScroll:{type:Function,required:!1},onDropdownMenuClick:{type:Function,required:!1},onMouseOverChartSymbol:{type:Function,required:!1},onDragSelectEnd:{type:Function,required:!1},onDropdownIconClick:{type:Function,required:!1},onDropdownMenuClear:{type:Function,required:!1},onTreeHierarchyStateChange:{type:Function,required:!1},onShowMenu:{type:Function,required:!1},onHideMenu:{type:Function,required:!1},onIconClick:{type:Function,required:!1},onLegendItemClick:{type:Function,required:!1},onLegendItemHover:{type:Function,required:!1},onLegendItemUnHover:{type:Function,required:!1},onLegendChange:{type:Function,required:!1},onMouseEnterAxis:{type:Function,required:!1},onMouseLeaveAxis:{type:Function,required:!1},onCheckboxStateChange:{type:Function,required:!1},onRadioStateChange:{type:Function,required:!1},onAfterRender:{type:Function,required:!1},onInitialized:{type:Function,required:!1},onPivotSortClick:{type:Function,required:!1},onDrillMenuClick:{type:Function,required:!1},onVChartEventType:{type:Function,required:!1},onChangeCellValue:{type:Function,required:!1},onMousedownFillHandle:{type:Function,required:!1},onDragFillHandleEnd:{type:Function,required:!1},onDblclickFillHandle:{type:Function,required:!1},onScrollVerticalEnd:{type:Function,required:!1},onScrollHorizontalEnd:{type:Function,required:!1},onChangCellValue:{type:Function,required:!1},onEmptyTipClick:{type:Function,required:!1},onEmptyTipDblClick:{type:Function,required:!1},onButtonClick:{type:Function,required:!1},onBeforeCacheChartImage:{type:Function,required:!1},onPastedData:{type:Function,required:!1}},emits:b,setup(e,{expose:i,emit:r}){const l=e,s=n.ref(null),a=n.shallowRef(null),u=n.ref(new Map),c=n.ref([]),d=n.ref([]);w(l,a),function(e,t){var i,r;const l=n.getCurrentInstance(),s=null===(r=null===(i=null==e?void 0:e.options)||void 0===i?void 0:i.customConfig)||void 0===r?void 0:r.createReactContainer;n.watchEffect((()=>{var e,n,i;if(!s)return;const r=null===(i=null===(n=null===(e=t.value)||void 0===e?void 0:e.scenegraph)||void 0===n?void 0:n.stage)||void 0===i?void 0:i.pluginService;if(!r)return;const a=r.findPluginsByName("VTableVueAttributePlugin");if(o.isArray(a)&&a.length)return;const u=new L(null==l?void 0:l.appContext);r.register(u)}))}(l,a),i({vTableInstance:a});const p=n.computed((()=>"number"==typeof l.width?`${l.width}px`:l.width)),h=n.computed((()=>"number"==typeof l.height?`${l.height}px`:l.height)),C=r,v=(e,t)=>{const n=new e(s.value,t);a.value=n,u.value.clear(),c.value=[],d.value=[],n.on("resize_column_end",(e=>{if(!l.keepColumnWidthChange)return;const{col:t,colWidths:o}=e,i=o[t];if(n.isPivotTable()){const e=n.getCellHeaderPaths(t,n.columnHeaderLevelCount);let o=null;o="rowHeader"===e.cellLocation?e.rowHeaderPaths:e.colHeaderPaths;let r=!1;for(let e=0;e<c.value.length;e++){const t=c.value[e];JSON.stringify(t.dimensions)===JSON.stringify(o)&&(t.width=i,r=!0)}r||c.value.push({dimensions:o,width:i})}else{const e=n.getBodyColumnDefine(t,0);(null==e?void 0:e.key)&&u.value.set(e.key,i)}}))},y=()=>{var e,n;if(!s.value)return;a.value&&a.value.release();const o=()=>void 0!==l.records&&null!==l.records&&l.records.length>0?l.records:l.options.records;try{switch(l.type){case"list":v(t.ListTable,Object.assign(Object.assign({},l.options),{records:o()}));break;case"pivot":v(t.PivotTable,Object.assign(Object.assign({},l.options),{records:o()}));break;case"chart":v(t.PivotChart,Object.assign(Object.assign({},l.options),{records:o()}))}i=a.value,b.forEach((e=>{i.on(E[e],(t=>{C(e,t)}))})),null===(e=l.onReady)||void 0===e||e.call(l,a.value,!0)}catch(e){null===(n=l.onError)||void 0===n||n.call(l,e)}var i},f=e=>{var n;if(a.value)try{if(l.keepColumnWidthChange){const t=function(e,t,n){if(n.isPivotTable())return t;const o=[];return e.forEach(((e,t)=>{o.push({key:t,width:e})})),o}(u.value,c.value,a.value);e=Object.assign(Object.assign({},e),{columnWidthConfig:t,columnWidthConfigForRowHeader:t})}switch(l.type){case"list":a.value instanceof t.ListTable&&a.value.updateOption(e);break;case"pivot":a.value instanceof t.PivotTable&&a.value.updateOption(e);break;case"chart":a.value instanceof t.PivotChart&&a.value.updateOption(e)}}catch(e){null===(n=l.onError)||void 0===n||n.call(l,e)}};return n.onMounted(y),n.onBeforeUnmount((()=>{var e;null===(e=a.value)||void 0===e||e.release()})),n.watch((()=>l.options),((e,t)=>{a.value?f(e):y()})),n.watch((()=>l.records),((e,t)=>{a.value?f(Object.assign(Object.assign({},l.options),{records:e})):y()}),{deep:!0}),(e,t)=>(n.openBlock(),n.createElementBlock("div",{ref_key:"vTableContainer",ref:s,style:n.normalizeStyle([{width:p.value,height:h.value},{position:"relative"}])},null,4))}}),A=n.defineComponent({__name:"list-table",props:{options:{type:Object,required:!0},records:{type:Array,required:!1},width:{type:[String,Number],required:!1},height:{type:[String,Number],required:!1}},setup(e,{expose:t}){const o=e,i=n.ref(null),r=n.useSlots(),l=n.computed((()=>{var e;const t=function(e){const t={columns:[],tooltip:{},menu:{}},n={ListColumn:"columns",Tooltip:"tooltip",Menu:"menu"};return e.forEach((e=>{var o,i;e.props=a(e.props);const r=(null===(o=e.type)||void 0===o?void 0:o.symbol)||(null===(i=e.type)||void 0===i?void 0:i.name),l=n[r];l&&("columns"===l&&e.children&&(e.children.customLayout&&(e.props.customLayout=d(e.children)),e.children.headerCustomLayout&&(e.props.headerCustomLayout=d(e.children,!0)),C(e.props,e.children.edit)),Array.isArray(t[l])?t[l].push(e.props):t[l]=e.props)})),t}(u((null===(e=r.default)||void 0===e?void 0:e.call(r))||[]));return m(o.options,t)}));return t({vTableInstance:n.computed((()=>{var e;return(null===(e=i.value)||void 0===e?void 0:e.vTableInstance)||null}))}),(t,o)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(M,n.mergeProps({type:"list",options:l.value,records:e.records,width:e.width,height:e.height,ref_key:"baseTableRef",ref:i},t.$attrs),null,16,["options","records","width","height"]),n.renderSlot(t.$slots,"default")],64))}}),F=n.defineComponent({__name:"pivot-table",props:{options:{type:Object,required:!0},records:{type:Array,required:!1},width:{type:[String,Number],required:!1},height:{type:[String,Number],required:!1}},setup(e,{expose:t}){const o=e,i=n.shallowRef(null),r=n.useSlots(),l=n.computed((()=>{var e;const t=f(u((null===(e=r.default)||void 0===e?void 0:e.call(r))||[]));return m(o.options,t)}));return t({vTableInstance:n.computed((()=>{var e;return(null===(e=i.value)||void 0===e?void 0:e.vTableInstance)||null}))}),(t,o)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(M,n.mergeProps({type:"pivot",options:l.value,records:e.records,width:e.width,height:e.height,ref_key:"baseTableRef",ref:i},t.$attrs),null,16,["options","records","width","height"]),n.renderSlot(t.$slots,"default")],64))}}),S=n.defineComponent({__name:"pivot-chart",props:{options:{type:Object,required:!0},records:{type:Array,required:!1},width:{type:[String,Number],required:!1},height:{type:[String,Number],required:!1}},setup(e,{expose:t}){const o=e,i=n.shallowRef(null),r=n.useSlots(),l=n.computed((()=>{var e;const t=f(u((null===(e=r.default)||void 0===e?void 0:e.call(r))||[]));return m(o.options,t)}));return t({vTableInstance:n.computed((()=>{var e;return(null===(e=i.value)||void 0===e?void 0:e.vTableInstance)||null}))}),(t,o)=>(n.openBlock(),n.createElementBlock(n.Fragment,null,[n.createVNode(M,n.mergeProps({type:"chart",options:l.value,records:e.records,width:e.width,height:e.height,ref_key:"baseTableRef",ref:i},t.$attrs),null,16,["options","records","width","height"]),n.renderSlot(t.$slots,"default")],64))}});function N(e){return null}function R(e){return null}function D(e){return null}function I(e){return null}function k(e){return null}function P(e){return null}function q(e){return null}function H(e){return null}function V(e){return null}function x(){return null}function B(){return null}function j(){return null}function U(e){return null}function z(e){return null}function G(e){return null}N.symbol="ListColumn",R.symbol="PivotColumnDimension",D.symbol="PivotRowDimension",I.symbol="PivotColumnHeaderTitle",k.symbol="PivotRowHeaderTitle",P.symbol="PivotIndicator",q.symbol="PivotCorner",H.symbol="Menu",V.symbol="Tooltip",x.symbol="Group",B.symbol="Image",j.symbol="Text",U.symbol="Tag",z.symbol="Radio",G.symbol="CheckBox";e.VTable=l,Object.defineProperty(e,"register",{enumerable:!0,get:function(){return t.register}}),e.CheckBox=G,e.DYNAMIC_RENDER_EDITOR=h,e.Group=x,e.Image=B,e.ListColumn=N,e.ListTable=A,e.Menu=H,e.PivotChart=S,e.PivotColumnDimension=R,e.PivotColumnHeaderTitle=I,e.PivotCorner=q,e.PivotIndicator=P,e.PivotRowDimension=D,e.PivotRowHeaderTitle=k,e.PivotTable=F,e.Radio=z,e.Tag=U,e.Text=j,e.Tooltip=V,e.registerChartModule=(e,t)=>{l.register.chartModule(e,t)},e.version="1.26.0"}));
@@ -1,6 +1,6 @@
1
- function Menu(props) {
2
- return null;
3
- }
1
+ function Menu(props) {
2
+ return null;
3
+ }
4
4
  Menu.symbol = 'Menu';
5
5
 
6
6
  export { Menu as default };
@@ -1,6 +1,6 @@
1
- function Tooltip(props) {
2
- return null;
3
- }
1
+ function Tooltip(props) {
2
+ return null;
3
+ }
4
4
  Tooltip.symbol = 'Tooltip';
5
5
 
6
6
  export { Tooltip as default };
@@ -1,6 +1,6 @@
1
- function CheckBox(props) {
2
- return null;
3
- }
1
+ function CheckBox(props) {
2
+ return null;
3
+ }
4
4
  CheckBox.symbol = 'CheckBox';
5
5
 
6
6
  export { CheckBox as default };
@@ -1,6 +1,6 @@
1
- function Group() {
2
- return null;
3
- }
1
+ function Group() {
2
+ return null;
3
+ }
4
4
  Group.symbol = 'Group';
5
5
 
6
6
  export { Group as default };
@@ -1,6 +1,6 @@
1
- function Image() {
2
- return null;
3
- }
1
+ function Image() {
2
+ return null;
3
+ }
4
4
  Image.symbol = 'Image';
5
5
 
6
6
  export { Image as default };
@@ -1,6 +1,6 @@
1
- function Radio(props) {
2
- return null;
3
- }
1
+ function Radio(props) {
2
+ return null;
3
+ }
4
4
  Radio.symbol = 'Radio';
5
5
 
6
6
  export { Radio as default };
@@ -1,6 +1,6 @@
1
- function Tag(props) {
2
- return null;
3
- }
1
+ function Tag(props) {
2
+ return null;
3
+ }
4
4
  Tag.symbol = 'Tag';
5
5
 
6
6
  export { Tag as default };
@@ -1,6 +1,6 @@
1
- function Text() {
2
- return null;
3
- }
1
+ function Text() {
2
+ return null;
3
+ }
4
4
  Text.symbol = 'Text';
5
5
 
6
6
  export { Text as default };