@visactor/vtable-calendar 1.18.1 → 1.18.2-alpha.1

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.
@@ -45419,6 +45419,7 @@
45419
45419
  });
45420
45420
  const globalPointerupCallback = e => {
45421
45421
  var _a;
45422
+ if (table.isReleased) return;
45422
45423
  const target = e.target;
45423
45424
  if (!table.getElement().contains(target)) {
45424
45425
  const isCompleteEdit = null === (_a = table.editorManager) || void 0 === _a ? void 0 : _a.completeEdit(e);
@@ -45429,6 +45430,7 @@
45429
45430
  },
45430
45431
  globalPointerdownCallback = e => {
45431
45432
  var _a;
45433
+ if (table.isReleased) return;
45432
45434
  const target = e.target;
45433
45435
  if (!table.getElement().contains(target) && !table.internalProps.menuHandler.containElement(target)) {
45434
45436
  const isCompleteEdit = null === (_a = table.editorManager) || void 0 === _a ? void 0 : _a.completeEdit(e);
@@ -49381,8 +49383,8 @@
49381
49383
  constructor(table, options) {
49382
49384
  var _a;
49383
49385
  this.plugins = new Map(), this.table = table, null === (_a = options.plugins) || void 0 === _a || _a.map(plugin => {
49384
- this.register(plugin);
49385
- }), this.initPlugins(table);
49386
+ this.register(plugin), this._bindTableEventForPlugin(plugin);
49387
+ });
49386
49388
  }
49387
49389
  register(plugin) {
49388
49390
  this.plugins.set(plugin.id, plugin);
@@ -49393,23 +49395,28 @@
49393
49395
  getPlugin(id) {
49394
49396
  return this.plugins.get(id);
49395
49397
  }
49396
- initPlugins(table) {
49397
- this.plugins.forEach(plugin => {
49398
- var _a;
49399
- null === (_a = plugin.runTime) || void 0 === _a || _a.forEach(runTime => {
49400
- table.on(runTime, function () {
49401
- var _a;
49402
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
49403
- args[_key] = arguments[_key];
49404
- }
49405
- null === (_a = plugin.run) || void 0 === _a || _a.call(plugin, ...args, runTime, table);
49406
- });
49398
+ _bindTableEventForPlugin(plugin) {
49399
+ var _this = this;
49400
+ var _a;
49401
+ null === (_a = plugin.runTime) || void 0 === _a || _a.forEach(runTime => {
49402
+ this.table.on(runTime, function () {
49403
+ var _a;
49404
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
49405
+ args[_key] = arguments[_key];
49406
+ }
49407
+ null === (_a = plugin.run) || void 0 === _a || _a.call(plugin, ...args, runTime, _this.table);
49407
49408
  });
49408
49409
  });
49409
49410
  }
49410
- updatePlugins() {
49411
- this.plugins.forEach(plugin => {
49412
- plugin.update && plugin.update(this.table);
49411
+ updatePlugins(plugins) {
49412
+ Array.from(this.plugins.values()).filter(plugin => !(null == plugins ? void 0 : plugins.some(p => p.id === plugin.id))).forEach(plugin => {
49413
+ this.release(), this.plugins.delete(plugin.id);
49414
+ }), this.plugins.forEach(plugin => {
49415
+ plugin.update && plugin.update();
49416
+ });
49417
+ const addedPlugins = null == plugins ? void 0 : plugins.filter(plugin => !this.plugins.has(plugin.id));
49418
+ null == addedPlugins || addedPlugins.forEach(plugin => {
49419
+ this.register(plugin), this._bindTableEventForPlugin(plugin);
49413
49420
  });
49414
49421
  }
49415
49422
  release() {
@@ -49435,7 +49442,7 @@
49435
49442
  constructor(container) {
49436
49443
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
49437
49444
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
49438
- if (super(), this.showFrozenIcon = !0, this.version = "1.18.1", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
49445
+ if (super(), this.showFrozenIcon = !0, this.version = "1.18.2-alpha.1", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
49439
49446
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
49440
49447
  options: options,
49441
49448
  container: container
@@ -50273,8 +50280,8 @@
50273
50280
  return super.fireListeners(type, event);
50274
50281
  }
50275
50282
  updateOption(options) {
50276
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
50277
- this.options = options, this._hasAutoImageColumn = void 0;
50283
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
50284
+ null === (_a = this.editorManager) || void 0 === _a || _a.cancelEdit(), this.options = options, this._hasAutoImageColumn = void 0;
50278
50285
  const {
50279
50286
  frozenColCount = 0,
50280
50287
  unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth,
@@ -50314,9 +50321,9 @@
50314
50321
  } = options;
50315
50322
  pixelRatio && pixelRatio !== this.internalProps.pixelRatio && (this.internalProps.pixelRatio = pixelRatio), padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding, this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top), padding.bottom && (this.padding.bottom = padding.bottom), padding.left && (this.padding.left = padding.left), padding.right && (this.padding.right = padding.right))), this.showFrozenIcon = "boolean" != typeof showFrozenIcon || showFrozenIcon, "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1), this.widthMode = null != widthMode ? widthMode : "standard", this.heightMode = null != heightMode ? heightMode : "standard", this._widthAdaptiveMode = null != widthAdaptiveMode ? widthAdaptiveMode : "only-body", this._heightAdaptiveMode = null != heightAdaptiveMode ? heightAdaptiveMode : "only-body", this.autoFillWidth = null != autoFillWidth && autoFillWidth, this.autoFillHeight = null != autoFillHeight && autoFillHeight, this.customRender = customRender, this.canvasWidth = isNumber$4(canvasWidth) ? canvasWidth : void 0, this.canvasHeight = isNumber$4(canvasHeight) ? canvasHeight : void 0;
50316
50323
  const internalProps = this.internalProps;
50317
- if ("node" === Env.mode || options.canvas || updateRootElementPadding(internalProps.element, this.padding), this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal", internalProps.frozenColCount = frozenColCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth, internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight, internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth, internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions, internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.columnResizeMode = null !== (_b = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _b ? _b : columnResizeMode, internalProps.rowResizeMode = null !== (_c = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _c ? _c : rowResizeMode, internalProps.dragHeaderMode = null !== (_e = null !== (_d = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _d ? _d : dragHeaderMode) && void 0 !== _e ? _e : "none", internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto", internalProps.cellTextOverflows = {}, internalProps._rowHeightsMap = new NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map(), internalProps._colRangeWidthsMap = new Map(), internalProps._widthResizedColMap = new Set(), internalProps._heightResizedRowMap = new Set(), this.colWidthsMap = new NumberMap(), this.colContentWidthsMap = new NumberMap(), this.colWidthsLimit = {}, internalProps.stick.changedCells.clear(), internalProps.theme = themes.of(null !== (_f = options.theme) && void 0 !== _f ? _f : themes.DEFAULT), internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle), this.scenegraph.updateStageBackground(), internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_g = options.allowFrozenColCount) && void 0 !== _g ? _g : 0, internalProps.limitMaxAutoWidth = null !== (_h = options.limitMaxAutoWidth) && void 0 !== _h ? _h : 450, internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10, internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10, null === (_j = internalProps.legends) || void 0 === _j || _j.forEach(legend => {
50324
+ if ("node" === Env.mode || options.canvas || updateRootElementPadding(internalProps.element, this.padding), this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal", internalProps.frozenColCount = frozenColCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth, internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight, internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth, internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions, internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.columnResizeMode = null !== (_c = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _c ? _c : columnResizeMode, internalProps.rowResizeMode = null !== (_d = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _d ? _d : rowResizeMode, internalProps.dragHeaderMode = null !== (_f = null !== (_e = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _e ? _e : dragHeaderMode) && void 0 !== _f ? _f : "none", internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto", internalProps.cellTextOverflows = {}, internalProps._rowHeightsMap = new NumberRangeMap(this), internalProps._rowRangeHeightsMap = new Map(), internalProps._colRangeWidthsMap = new Map(), internalProps._widthResizedColMap = new Set(), internalProps._heightResizedRowMap = new Set(), this.colWidthsMap = new NumberMap(), this.colContentWidthsMap = new NumberMap(), this.colWidthsLimit = {}, internalProps.stick.changedCells.clear(), internalProps.theme = themes.of(null !== (_g = options.theme) && void 0 !== _g ? _g : themes.DEFAULT), internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle), this.scenegraph.updateStageBackground(), internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_h = options.allowFrozenColCount) && void 0 !== _h ? _h : 0, internalProps.limitMaxAutoWidth = null !== (_j = options.limitMaxAutoWidth) && void 0 !== _j ? _j : 450, internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10, internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10, null === (_k = internalProps.legends) || void 0 === _k || _k.forEach(legend => {
50318
50325
  null == legend || legend.release();
50319
- }), null === (_k = internalProps.title) || void 0 === _k || _k.release(), internalProps.title = null, null === (_l = internalProps.emptyTip) || void 0 === _l || _l.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), clearChartRenderQueue(), this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
50326
+ }), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.title = null, null === (_m = internalProps.emptyTip) || void 0 === _m || _m.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), clearChartRenderQueue(), this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
50320
50327
  internalProps.legends = [];
50321
50328
  const createLegend = Factory.getFunction("createLegend");
50322
50329
  if (Array.isArray(options.legends)) {
@@ -50342,11 +50349,11 @@
50342
50349
  }
50343
50350
  if (internalProps.menu = Object.assign({
50344
50351
  renderMode: "html"
50345
- }, options.menu), Array.isArray(null === (_m = options.menu) || void 0 === _m ? void 0 : _m.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_o = options.menu) || void 0 === _o ? void 0 : _o.dropDownMenuHighlight), (Array.isArray(null === (_p = options.menu) || void 0 === _p ? void 0 : _p.defaultHeaderMenuItems) || "function" == typeof (null === (_q = options.menu) || void 0 === _q ? void 0 : _q.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems), "html" === internalProps.menu.renderMode && !internalProps.menuHandler) {
50352
+ }, options.menu), Array.isArray(null === (_o = options.menu) || void 0 === _o ? void 0 : _o.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_p = options.menu) || void 0 === _p ? void 0 : _p.dropDownMenuHighlight), (Array.isArray(null === (_q = options.menu) || void 0 === _q ? void 0 : _q.defaultHeaderMenuItems) || "function" == typeof (null === (_r = options.menu) || void 0 === _r ? void 0 : _r.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems), "html" === internalProps.menu.renderMode && !internalProps.menuHandler) {
50346
50353
  const MenuHandler = Factory.getComponent("menuHandler");
50347
50354
  internalProps.menuHandler = new MenuHandler(this);
50348
50355
  }
50349
- this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(), internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell), null === (_r = this.customCellStylePlugin) || void 0 === _r || _r.updateCustomCell(null !== (_s = options.customCellStyle) && void 0 !== _s ? _s : [], null !== (_t = options.customCellStyleArrangement) && void 0 !== _t ? _t : []), this._adjustCanvasSizeByOption();
50356
+ this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(), internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell), null === (_s = this.customCellStylePlugin) || void 0 === _s || _s.updateCustomCell(null !== (_t = options.customCellStyle) && void 0 !== _t ? _t : [], null !== (_u = options.customCellStyleArrangement) && void 0 !== _u ? _u : []), this._adjustCanvasSizeByOption();
50350
50357
  }
50351
50358
  renderWithRecreateCells() {
50352
50359
  this.internalProps.stick.changedCells.clear();
@@ -54390,7 +54397,7 @@
54390
54397
  const EmptyTip = Factory.getComponent("emptyTip");
54391
54398
  this.internalProps.emptyTip = new EmptyTip(this.options.emptyTip, this), null === (_h = this.internalProps.emptyTip) || void 0 === _h || _h.resetVisible();
54392
54399
  }
54393
- return new Promise(resolve => {
54400
+ return this.pluginManager.updatePlugins(options.plugins), new Promise(resolve => {
54394
54401
  setTimeout(resolve, 0);
54395
54402
  });
54396
54403
  }