@visactor/vtable-calendar 1.11.6-alpha.4 → 1.11.6-alpha.6

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.
@@ -595,6 +595,12 @@
595
595
  get env() {
596
596
  return this._env;
597
597
  }
598
+ get isImageAnonymous() {
599
+ return this._isImageAnonymous;
600
+ }
601
+ set isImageAnonymous(isImageAnonymous) {
602
+ this._isImageAnonymous = isImageAnonymous;
603
+ }
598
604
  get devicePixelRatio() {
599
605
  return this._env || this.setEnv("browser"), this.envContribution.getDevicePixelRatio();
600
606
  }
@@ -629,7 +635,7 @@
629
635
  this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
630
636
  }
631
637
  constructor(contributions) {
632
- this.contributions = contributions, this.id = Generator.GenAutoIncrementId(), this.hooks = {
638
+ this.contributions = contributions, this._isImageAnonymous = !0, this.id = Generator.GenAutoIncrementId(), this.hooks = {
633
639
  onSetEnv: new SyncHook(["lastEnv", "env", "global"])
634
640
  }, this.measureTextMethod = "native", this.optimizeVisible = !1;
635
641
  }
@@ -18594,7 +18600,7 @@
18594
18600
  function createImageElement(src) {
18595
18601
  let isSvg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
18596
18602
  const img = document.createElement("img");
18597
- if (img.crossOrigin = "anonymous", isSvg) {
18603
+ if (application.global.isImageAnonymous && (img.crossOrigin = "anonymous"), isSvg) {
18598
18604
  const data = new Blob([src], {
18599
18605
  type: "image/svg+xml"
18600
18606
  });
@@ -45579,8 +45585,9 @@
45579
45585
  }
45580
45586
  constructor(container) {
45581
45587
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
45582
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
45583
- if (super(), this.showFrozenIcon = !0, this.version = "1.11.6-alpha.4", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
45588
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
45589
+ if (super(), this.showFrozenIcon = !0, this.version = "1.11.6-alpha.6", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
45590
+ !1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vglobal.isImageAnonymous = !1);
45584
45591
  const {
45585
45592
  frozenColCount = 0,
45586
45593
  frozenRowCount: frozenRowCount,
@@ -45624,15 +45631,15 @@
45624
45631
  right: 0,
45625
45632
  left: 0,
45626
45633
  bottom: 0
45627
- }, 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))), isValid$1(canvasHeight) && isValid$1(canvasWidth) && (this.canvasSizeSeted = !0), this.tableNoFrameWidth = 0, this.tableNoFrameHeight = 0, this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight, this.columnWidthComputeMode = null !== (_a = options.columnWidthComputeMode) && void 0 !== _a ? _a : "normal";
45634
+ }, 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))), isValid$1(canvasHeight) && isValid$1(canvasWidth) && (this.canvasSizeSeted = !0), this.tableNoFrameWidth = 0, this.tableNoFrameHeight = 0, this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight, this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal";
45628
45635
  const internalProps = this.internalProps = {};
45629
- if (void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1), this.options.canvas ? (internalProps.element = this.options.canvas.parentElement, internalProps.element.style.position = "relative", internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== Env.mode && (internalProps.element = createRootElement(this.padding), internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d"), (null === (_b = options.customConfig) || void 0 === _b ? void 0 : _b.createReactContainer) && createReactContainer(this)), internalProps.handler = new EventHandler(), isNumber$2(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime), internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount, internalProps.frozenRowCount = frozenRowCount, 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 = columnResizeMode, internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = null != dragHeaderMode ? dragHeaderMode : "none", internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto", 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.calcWidthContext = {
45636
+ if (void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1), this.options.canvas ? (internalProps.element = this.options.canvas.parentElement, internalProps.element.style.position = "relative", internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== Env.mode && (internalProps.element = createRootElement(this.padding), internalProps.focusControl = new FocusInput(this, internalProps.element), internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas), internalProps.context = internalProps.canvas.getContext("2d"), (null === (_c = options.customConfig) || void 0 === _c ? void 0 : _c.createReactContainer) && createReactContainer(this)), internalProps.handler = new EventHandler(), isNumber$2(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime), internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount, internalProps.frozenRowCount = frozenRowCount, 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 = columnResizeMode, internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = null != dragHeaderMode ? dragHeaderMode : "none", internalProps.renderChartAsync = renderChartAsync, setBatchRenderChartCount(renderChartAsyncBatchCount), internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto", 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.calcWidthContext = {
45630
45637
  _: internalProps,
45631
45638
  get full() {
45632
45639
  var _a;
45633
45640
  return "node" === Env.mode ? canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
45634
45641
  }
45635
- }, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (_c = options.theme) && void 0 !== _c ? _c : themes.DEFAULT), internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle), container ? (clearDOM && (container.innerHTML = ""), container.appendChild(internalProps.element), this._updateSize()) : this._updateSize(), internalProps.bodyHelper = new BodyHelper(this), internalProps.headerHelper = new HeaderHelper(this), internalProps.rowSeriesNumberHelper = new RowSeriesNumberHelper(this), internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_d = options.allowFrozenColCount) && void 0 !== _d ? _d : 0, internalProps.limitMaxAutoWidth = null !== (_e = options.limitMaxAutoWidth) && void 0 !== _e ? _e : 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, this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager(this), this.eventManager = new EventManager(this), this.animationManager = new TableAnimationManager(this), options.legends) {
45642
+ }, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (_d = options.theme) && void 0 !== _d ? _d : themes.DEFAULT), internalProps.theme.isPivot = this.isPivotTable(), setIconColor(internalProps.theme.functionalIconsStyle), container ? (clearDOM && (container.innerHTML = ""), container.appendChild(internalProps.element), this._updateSize()) : this._updateSize(), internalProps.bodyHelper = new BodyHelper(this), internalProps.headerHelper = new HeaderHelper(this), internalProps.rowSeriesNumberHelper = new RowSeriesNumberHelper(this), internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_e = options.allowFrozenColCount) && void 0 !== _e ? _e : 0, internalProps.limitMaxAutoWidth = null !== (_f = options.limitMaxAutoWidth) && void 0 !== _f ? _f : 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, this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager(this), this.eventManager = new EventManager(this), this.animationManager = new TableAnimationManager(this), options.legends) {
45636
45643
  internalProps.legends = [];
45637
45644
  const createLegend = Factory.getFunction("createLegend");
45638
45645
  if (Array.isArray(options.legends)) {
@@ -45658,7 +45665,7 @@
45658
45665
  }
45659
45666
  if (internalProps.menu = Object.assign({
45660
45667
  renderMode: "html"
45661
- }, options.menu), Array.isArray(null === (_f = options.menu) || void 0 === _f ? void 0 : _f.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_g = options.menu) || void 0 === _g ? void 0 : _g.dropDownMenuHighlight), Array.isArray(null === (_h = options.menu) || void 0 === _h ? void 0 : _h.defaultHeaderMenuItems) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems), "html" === internalProps.menu.renderMode) {
45668
+ }, options.menu), Array.isArray(null === (_g = options.menu) || void 0 === _g ? void 0 : _g.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_h = options.menu) || void 0 === _h ? void 0 : _h.dropDownMenuHighlight), Array.isArray(null === (_j = options.menu) || void 0 === _j ? void 0 : _j.defaultHeaderMenuItems) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems), "html" === internalProps.menu.renderMode) {
45662
45669
  const MenuHandler = Factory.getComponent("menuHandler");
45663
45670
  internalProps.menuHandler = new MenuHandler(this);
45664
45671
  }
@@ -45666,7 +45673,7 @@
45666
45673
  changedCells: new Map()
45667
45674
  }, internalProps.customMergeCell = options.customMergeCell;
45668
45675
  const CustomCellStylePlugin = Factory.getComponent("customCellStylePlugin");
45669
- CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_j = options.customCellStyle) && void 0 !== _j ? _j : [], null !== (_k = options.customCellStyleArrangement) && void 0 !== _k ? _k : []));
45676
+ CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_k = options.customCellStyle) && void 0 !== _k ? _k : [], null !== (_l = options.customCellStyleArrangement) && void 0 !== _l ? _l : []));
45670
45677
  }
45671
45678
  getContainer() {
45672
45679
  return this.container;
@@ -52693,22 +52700,42 @@
52693
52700
  }
52694
52701
 
52695
52702
  function createProgressBarCell(progressBarDefine, style, width, value, dataValue, col, row, padding, table, range) {
52696
- var _a, _b, _c, _d, _e, _f;
52697
- progressBarDefine.dependField && (dataValue = null !== (_b = null === (_a = table.getCellOriginRecord(col, row)) || void 0 === _a ? void 0 : _a[progressBarDefine.dependField]) && void 0 !== _b ? _b : dataValue), progressBarDefine.barType = null !== (_c = progressBarDefine.barType) && void 0 !== _c ? _c : "default", progressBarDefine.min = null !== (_d = getOrApply(progressBarDefine.min, {
52698
- col: col,
52699
- row: row,
52700
- table: table,
52701
- value: value,
52702
- dataValue: dataValue,
52703
- cellHeaderPaths: void 0
52704
- })) && void 0 !== _d ? _d : 0, progressBarDefine.max = null !== (_e = getOrApply(progressBarDefine.max, {
52705
- col: col,
52706
- row: row,
52707
- table: table,
52708
- value: value,
52709
- dataValue: dataValue,
52710
- cellHeaderPaths: void 0
52711
- })) && void 0 !== _e ? _e : progressBarDefine.min + 100;
52703
+ var _a, _b, _c, _d, _e;
52704
+ if (progressBarDefine.dependField) {
52705
+ const dependField = getOrApply(progressBarDefine.dependField, {
52706
+ col: col,
52707
+ row: row,
52708
+ table: table,
52709
+ value: value,
52710
+ dataValue: dataValue,
52711
+ cellHeaderPaths: void 0
52712
+ });
52713
+ dataValue = null !== (_b = null === (_a = table.getCellOriginRecord(col, row)) || void 0 === _a ? void 0 : _a[dependField]) && void 0 !== _b ? _b : dataValue;
52714
+ }
52715
+ const barType = null !== (_c = getOrApply(progressBarDefine.barType, {
52716
+ col: col,
52717
+ row: row,
52718
+ table: table,
52719
+ value: value,
52720
+ dataValue: dataValue,
52721
+ cellHeaderPaths: void 0
52722
+ })) && void 0 !== _c ? _c : "default",
52723
+ min = null !== (_d = getOrApply(progressBarDefine.min, {
52724
+ col: col,
52725
+ row: row,
52726
+ table: table,
52727
+ value: value,
52728
+ dataValue: dataValue,
52729
+ cellHeaderPaths: void 0
52730
+ })) && void 0 !== _d ? _d : 0,
52731
+ max = null !== (_e = getOrApply(progressBarDefine.max, {
52732
+ col: col,
52733
+ row: row,
52734
+ table: table,
52735
+ value: value,
52736
+ dataValue: dataValue,
52737
+ cellHeaderPaths: void 0
52738
+ })) && void 0 !== _e ? _e : min + 100;
52712
52739
  let height = 0;
52713
52740
  height = range ? table.getRowsHeight(range.start.row, range.end.row) : table.getRowHeight(row);
52714
52741
  let contentWidth = width,
@@ -52770,8 +52797,8 @@
52770
52797
  str.endsWith(svalue, "%") && (svalue = svalue.substr(0, svalue.length - 1));
52771
52798
  const num = Number(svalue);
52772
52799
  if (isNaN(num)) return percentCompleteBarGroup;
52773
- if ("default" === (null !== (_f = progressBarDefine.barType) && void 0 !== _f ? _f : "default")) {
52774
- const percentile = num < progressBarDefine.min ? 0 : num > progressBarDefine.max ? 1 : (num - progressBarDefine.min) / (progressBarDefine.max - progressBarDefine.min),
52800
+ if ("default" === (null != barType ? barType : "default")) {
52801
+ const percentile = num < min ? 0 : num > max ? 1 : (num - min) / (max - min),
52775
52802
  barMaxWidth = contentWidth,
52776
52803
  barTop = top + contentHeight - barHeight - barBottom;
52777
52804
  let barSize = Math.min(barMaxWidth * percentile, barMaxWidth);
@@ -52813,9 +52840,9 @@
52813
52840
  fill: fillColor
52814
52841
  });
52815
52842
  percentCompleteBarGroup.addChild(barMain);
52816
- } else if ("negative" === progressBarDefine.barType) {
52817
- const negativeRange = progressBarDefine.min < 0 ? -progressBarDefine.min : 0,
52818
- positiveRange = progressBarDefine.max > 0 ? progressBarDefine.max : 0,
52843
+ } else if ("negative" === barType) {
52844
+ const negativeRange = min < 0 ? -min : 0,
52845
+ positiveRange = max > 0 ? max : 0,
52819
52846
  negativeFactor = negativeRange / (negativeRange + positiveRange),
52820
52847
  positiveFactor = 1 - negativeFactor,
52821
52848
  positiveRate = num > 0 ? num / positiveRange : 0,
@@ -52988,9 +53015,9 @@
52988
53015
  });
52989
53016
  percentCompleteBarGroup.addChild(barMark);
52990
53017
  }
52991
- } else if ("negative_no_axis" === progressBarDefine.barType) {
52992
- const _negativeRange = progressBarDefine.min < 0 ? -progressBarDefine.min : 0,
52993
- _positiveRange = progressBarDefine.max > 0 ? progressBarDefine.max : 0,
53018
+ } else if ("negative_no_axis" === barType) {
53019
+ const _negativeRange = min < 0 ? -min : 0,
53020
+ _positiveRange = max > 0 ? max : 0,
52994
53021
  range = Math.max(_negativeRange, _positiveRange),
52995
53022
  percentile = 0 === range ? 0 : Math.abs(num) / range,
52996
53023
  barMaxWidth = contentWidth;