@visactor/vtable-calendar 1.17.0-alpha.4 → 1.17.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.
@@ -26272,6 +26272,110 @@
26272
26272
  }
26273
26273
  };
26274
26274
 
26275
+ function loadSwitchComponent() {
26276
+ registerGroup(), registerRect(), registerText(), registerCircle();
26277
+ }
26278
+
26279
+ loadSwitchComponent();
26280
+ class Switch extends AbstractComponent {
26281
+ constructor(attributes, options) {
26282
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge$1({}, Switch.defaultAttributes, attributes)), this._handlePointerUp = () => {
26283
+ this.attribute.disabled || (this.attribute.checked ? this.setAttribute("checked", !1) : this.setAttribute("checked", !0), this._dispatchEvent("switch_state_change", {
26284
+ eventType: "switch_state_change",
26285
+ checked: this.attribute.checked
26286
+ }), this.stage.renderNextFrame());
26287
+ }, this.renderGroup(), this.onBeforeAttributeUpdate = (val, attributes, key) => {
26288
+ "interactive" in val && this.setAttribute("pickable", val.interactive), "disabled" in val && this.setAttribute("cursor", val.disable ? this.attribute.disableCursor : this.attribute.cursor);
26289
+ }, this.addEventListener("pointerup", this._handlePointerUp);
26290
+ }
26291
+ render() {
26292
+ this.removeAllChild(!0), this.renderBox(), this.renderCircle(), this.renderText(), this.layout();
26293
+ }
26294
+ renderBox() {
26295
+ this._box = new Rect$1(merge$1({}, this.attribute.box)), this.attribute.disabled && this.attribute.checked ? this._box.setAttributes({
26296
+ fill: this.attribute.box.disableCheckedFill
26297
+ }) : this.attribute.disabled && !this.attribute.checked ? this._box.setAttributes({
26298
+ fill: this.attribute.box.disableUncheckedFill
26299
+ }) : this.attribute.checked ? this._box.setAttributes({
26300
+ fill: this.attribute.box.checkedFill
26301
+ }) : this._box.setAttributes({
26302
+ fill: this.attribute.box.uncheckedFill
26303
+ }), this.appendChild(this._box);
26304
+ }
26305
+ renderCircle() {
26306
+ this._circle = new Circle(merge$1({}, this.attribute.circle)), this.appendChild(this._circle);
26307
+ }
26308
+ renderText() {
26309
+ var _a, _b, _c;
26310
+ this._text = new Text(merge$1({}, null !== (_a = this.attribute.text) && void 0 !== _a ? _a : {})), this.attribute.checked && (null === (_b = this.attribute.text) || void 0 === _b ? void 0 : _b.checkedText) ? this._text.setAttributes({
26311
+ text: this.attribute.text.checkedText
26312
+ }) : (null === (_c = this.attribute.text) || void 0 === _c ? void 0 : _c.uncheckedText) && this._text.setAttributes({
26313
+ text: this.attribute.text.uncheckedText
26314
+ }), this.appendChild(this._text);
26315
+ }
26316
+ renderGroup() {
26317
+ this.attribute.interactive || this.setAttribute("pickable", !1), this.attribute.disabled && this.setAttribute("cursor", this.attribute.disableCursor);
26318
+ }
26319
+ layout() {
26320
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
26321
+ const space = this.attribute.spaceBetweenTextAndCircle,
26322
+ radius = this.attribute.circle.radius,
26323
+ boxHeight = this.attribute.box.height,
26324
+ circleHeight = 2 * radius,
26325
+ textHeight = this._text.AABBBounds.height(),
26326
+ maxHeight = Math.max(boxHeight, circleHeight, textHeight),
26327
+ circleY = maxHeight / 2 - circleHeight / 2 + radius,
26328
+ textY = maxHeight / 2 - textHeight / 2,
26329
+ boxWidth = this.attribute.box.width,
26330
+ circleWidth = 2 * radius,
26331
+ textWidth = measureTextSize((null !== (_c = null === (_b = null === (_a = this.attribute.text) || void 0 === _a ? void 0 : _a.checkedText) || void 0 === _b ? void 0 : _b.length) && void 0 !== _c ? _c : 0) > (null !== (_f = null === (_e = null === (_d = this.attribute.text) || void 0 === _d ? void 0 : _d.uncheckedText) || void 0 === _e ? void 0 : _e.length) && void 0 !== _f ? _f : 0) ? null !== (_h = null === (_g = this.attribute.text) || void 0 === _g ? void 0 : _g.checkedText) && void 0 !== _h ? _h : "" : null !== (_k = null === (_j = this.attribute.text) || void 0 === _j ? void 0 : _j.uncheckedText) && void 0 !== _k ? _k : "", this._text.attribute).width,
26332
+ maxWidth = Math.max(boxWidth, circleWidth + textWidth + 3 * space),
26333
+ circleX = boxHeight / 2 - circleWidth / 2 + radius,
26334
+ textX = circleX + radius + space;
26335
+ this._box.setAttributes({
26336
+ width: maxWidth,
26337
+ height: maxHeight
26338
+ }), this._circle.setAttributes({
26339
+ y: circleY,
26340
+ x: this.attribute.checked ? circleX : maxWidth - circleX
26341
+ }), this._text.setAttributes({
26342
+ x: this.attribute.checked ? textX : maxWidth - textX - textWidth,
26343
+ y: textY
26344
+ });
26345
+ }
26346
+ initAttributes(params, options) {
26347
+ params = (null == options ? void 0 : options.skipDefault) ? params : merge$1({}, Switch.defaultAttributes, params), super.initAttributes(params), this.renderGroup(), this.render();
26348
+ }
26349
+ }
26350
+ Switch.defaultAttributes = {
26351
+ interactive: !0,
26352
+ disabled: !1,
26353
+ checked: !1,
26354
+ cursor: "pointer",
26355
+ disableCursor: "not-allowed",
26356
+ circle: {
26357
+ radius: 8,
26358
+ fill: "#FFF",
26359
+ pickable: !1
26360
+ },
26361
+ box: {
26362
+ width: 40,
26363
+ height: 24,
26364
+ cornerRadius: 12,
26365
+ uncheckedFill: "rgb(201,205,212)",
26366
+ checkedFill: "#165DFF",
26367
+ disableUncheckedFill: "rgb(242,243,245)",
26368
+ disableCheckedFill: "rgb(148,191,255)",
26369
+ pickable: !1
26370
+ },
26371
+ text: {
26372
+ textAlign: "left",
26373
+ textBaseline: "top",
26374
+ pickable: !1
26375
+ },
26376
+ spaceBetweenTextAndCircle: 6
26377
+ };
26378
+
26275
26379
  let registed = !1;
26276
26380
  function registerForVrender() {
26277
26381
  registed || (registed = !0, preLoadAllModule(), isBrowserEnv() ? loadBrowserEnv(container) : isNodeEnv() && loadNodeEnv(container), registerArc(), registerCircle(), registerGroup(), registerImage(), registerLine(), registerRect(), registerRichtext(), registerShadowRoot(), registerSymbol(), registerText(), registerFlexLayoutPlugin(), loadPoptip(), registerFlexLayoutPlugin());
@@ -26628,7 +26732,7 @@
26628
26732
  }
26629
26733
  };
26630
26734
 
26631
- let defaultStyle$9;
26735
+ let defaultStyle$b;
26632
26736
  const STYLE_EVENT_TYPE = {
26633
26737
  CHANGE_STYLE: "change_style"
26634
26738
  };
@@ -26637,7 +26741,7 @@
26637
26741
  return STYLE_EVENT_TYPE;
26638
26742
  }
26639
26743
  static get DEFAULT() {
26640
- return defaultStyle$9 || (defaultStyle$9 = new Style());
26744
+ return defaultStyle$b || (defaultStyle$b = new Style());
26641
26745
  }
26642
26746
  constructor() {
26643
26747
  let style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -26818,10 +26922,10 @@
26818
26922
  }
26819
26923
  };
26820
26924
 
26821
- let defaultStyle$8;
26925
+ let defaultStyle$a;
26822
26926
  let ImageStyle$1 = class ImageStyle extends Style$1 {
26823
26927
  static get DEFAULT() {
26824
- return defaultStyle$8 || (defaultStyle$8 = new ImageStyle());
26928
+ return defaultStyle$a || (defaultStyle$a = new ImageStyle());
26825
26929
  }
26826
26930
  constructor() {
26827
26931
  let style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -26833,10 +26937,10 @@
26833
26937
  }
26834
26938
  };
26835
26939
 
26836
- let defaultStyle$7;
26940
+ let defaultStyle$9;
26837
26941
  class TextStyle extends Style$1 {
26838
26942
  static get DEFAULT() {
26839
- return defaultStyle$7 || (defaultStyle$7 = new TextStyle());
26943
+ return defaultStyle$9 || (defaultStyle$9 = new TextStyle());
26840
26944
  }
26841
26945
  constructor() {
26842
26946
  let style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -26861,10 +26965,10 @@
26861
26965
  }
26862
26966
  }
26863
26967
 
26864
- let defaultStyle$6;
26968
+ let defaultStyle$8;
26865
26969
  let CheckboxStyle$1 = class CheckboxStyle extends Style$1 {
26866
26970
  static get DEFAULT() {
26867
- return defaultStyle$6 || (defaultStyle$6 = new CheckboxStyle());
26971
+ return defaultStyle$8 || (defaultStyle$8 = new CheckboxStyle());
26868
26972
  }
26869
26973
  constructor() {
26870
26974
  let style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -26947,10 +27051,10 @@
26947
27051
  }
26948
27052
  };
26949
27053
 
26950
- let defaultStyle$5;
27054
+ let defaultStyle$7;
26951
27055
  class RadioStyle extends Style$1 {
26952
27056
  static get DEFAULT() {
26953
- return defaultStyle$5 || (defaultStyle$5 = new RadioStyle());
27057
+ return defaultStyle$7 || (defaultStyle$7 = new RadioStyle());
26954
27058
  }
26955
27059
  constructor() {
26956
27060
  let style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -27039,12 +27143,178 @@
27039
27143
  }
27040
27144
  }
27041
27145
 
27146
+ let defaultStyle$6;
27147
+ class SwitchStyle extends Style$1 {
27148
+ static get DEFAULT() {
27149
+ return defaultStyle$6 || (defaultStyle$6 = new SwitchStyle());
27150
+ }
27151
+ constructor() {
27152
+ let style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27153
+ let headerStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
27154
+ let switchThemeStyle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
27155
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
27156
+ super(style, headerStyle), this._spaceBetweenTextAndCircle = (null !== (_b = null !== (_a = null == style ? void 0 : style.spaceBetweenTextAndCircle) && void 0 !== _a ? _a : null == headerStyle ? void 0 : headerStyle.spaceBetweenTextAndCircle) && void 0 !== _b ? _b : null == switchThemeStyle ? void 0 : switchThemeStyle.spaceBetweenTextAndCircle) || 6, this._circleRadius = (null !== (_d = null === (_c = null == style ? void 0 : style.switchStyle) || void 0 === _c ? void 0 : _c.circleRadius) && void 0 !== _d ? _d : null == switchThemeStyle ? void 0 : switchThemeStyle.circleRadius) || 8, this._boxWidth = (null !== (_f = null === (_e = null == style ? void 0 : style.switchStyle) || void 0 === _e ? void 0 : _e.boxWidth) && void 0 !== _f ? _f : null == switchThemeStyle ? void 0 : switchThemeStyle.boxWidth) || 40, this._boxHeight = (null !== (_h = null === (_g = null == style ? void 0 : style.switchStyle) || void 0 === _g ? void 0 : _g.boxHeight) && void 0 !== _h ? _h : null == switchThemeStyle ? void 0 : switchThemeStyle.boxHeight) || 24, this._checkedFill = (null !== (_k = null === (_j = null == style ? void 0 : style.switchStyle) || void 0 === _j ? void 0 : _j.checkedFill) && void 0 !== _k ? _k : null == switchThemeStyle ? void 0 : switchThemeStyle.checkedFill) || "#165DFF", this._uncheckedFill = (null !== (_m = null === (_l = null == style ? void 0 : style.switchStyle) || void 0 === _l ? void 0 : _l.uncheckedFill) && void 0 !== _m ? _m : null == switchThemeStyle ? void 0 : switchThemeStyle.uncheckedFill) || "#c9cdd4", this._disableCheckedFill = (null !== (_p = null === (_o = null == style ? void 0 : style.switchStyle) || void 0 === _o ? void 0 : _o.disableCheckedFill) && void 0 !== _p ? _p : null == switchThemeStyle ? void 0 : switchThemeStyle.disableCheckedFill) || "#94bfff", this._disableUncheckedFill = (null !== (_r = null === (_q = null == style ? void 0 : style.switchStyle) || void 0 === _q ? void 0 : _q.disableUncheckedFill) && void 0 !== _r ? _r : null == switchThemeStyle ? void 0 : switchThemeStyle.disableUncheckedFill) || "#f2f3f5", this._circleFill = (null !== (_t = null === (_s = null == style ? void 0 : style.switchStyle) || void 0 === _s ? void 0 : _s.circleFill) && void 0 !== _t ? _t : null == switchThemeStyle ? void 0 : switchThemeStyle.circleFill) || "#FFF";
27157
+ }
27158
+ get spaceBetweenTextAndCircle() {
27159
+ return this._spaceBetweenTextAndCircle;
27160
+ }
27161
+ set spaceBetweenTextAndCircle(spaceBetweenTextAndCircle) {
27162
+ this._spaceBetweenTextAndCircle = spaceBetweenTextAndCircle;
27163
+ }
27164
+ get circleRadius() {
27165
+ return this._circleRadius;
27166
+ }
27167
+ set circleRadius(circleRadius) {
27168
+ this._circleRadius = circleRadius;
27169
+ }
27170
+ get boxWidth() {
27171
+ return this._boxWidth;
27172
+ }
27173
+ set boxWidth(boxWidth) {
27174
+ this._boxWidth = boxWidth;
27175
+ }
27176
+ get boxHeight() {
27177
+ return this._boxHeight;
27178
+ }
27179
+ set boxHeight(boxHeight) {
27180
+ this._boxHeight = boxHeight;
27181
+ }
27182
+ get checkedFill() {
27183
+ return this._checkedFill;
27184
+ }
27185
+ set checkedFill(checkedFill) {
27186
+ this._checkedFill = checkedFill;
27187
+ }
27188
+ get uncheckedFill() {
27189
+ return this._uncheckedFill;
27190
+ }
27191
+ set uncheckedFill(uncheckedFill) {
27192
+ this._uncheckedFill = uncheckedFill;
27193
+ }
27194
+ get disableCheckedFill() {
27195
+ return this._disableCheckedFill;
27196
+ }
27197
+ set disableCheckedFill(disableCheckedFill) {
27198
+ this._disableCheckedFill = disableCheckedFill;
27199
+ }
27200
+ get disableUncheckedFill() {
27201
+ return this._disableUncheckedFill;
27202
+ }
27203
+ set disableUncheckedFill(disableUncheckedFill) {
27204
+ this._disableUncheckedFill = disableUncheckedFill;
27205
+ }
27206
+ get circleFill() {
27207
+ return this._circleFill;
27208
+ }
27209
+ set circleFill(circleFill) {
27210
+ this._circleFill = circleFill;
27211
+ }
27212
+ getStyle(style) {
27213
+ return new SwitchStyle(style, this);
27214
+ }
27215
+ clone() {
27216
+ return new SwitchStyle(this);
27217
+ }
27218
+ }
27219
+
27220
+ let defaultStyle$5;
27221
+ class ButtonStyle extends Style$1 {
27222
+ static get DEFAULT() {
27223
+ return defaultStyle$5 || (defaultStyle$5 = new ButtonStyle());
27224
+ }
27225
+ constructor() {
27226
+ let style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27227
+ let headerStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
27228
+ let buttonThemeStyle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
27229
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
27230
+ super(style, headerStyle), this._buttonColor = (null !== (_b = null === (_a = null == style ? void 0 : style.buttonStyle) || void 0 === _a ? void 0 : _a.buttonColor) && void 0 !== _b ? _b : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonColor) || "#165DFF", this._buttonBorderColor = (null !== (_d = null === (_c = null == style ? void 0 : style.buttonStyle) || void 0 === _c ? void 0 : _c.buttonBorderColor) && void 0 !== _d ? _d : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonBorderColor) || "#165DFF", this._buttonLineWidth = (null !== (_f = null === (_e = null == style ? void 0 : style.buttonStyle) || void 0 === _e ? void 0 : _e.buttonLineWidth) && void 0 !== _f ? _f : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonLineWidth) || 1, this._buttonBorderRadius = (null !== (_h = null === (_g = null == style ? void 0 : style.buttonStyle) || void 0 === _g ? void 0 : _g.buttonBorderRadius) && void 0 !== _h ? _h : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonBorderRadius) || 2, this._buttonHoverColor = (null !== (_k = null === (_j = null == style ? void 0 : style.buttonStyle) || void 0 === _j ? void 0 : _j.buttonHoverColor) && void 0 !== _k ? _k : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonHoverColor) || "#4080FF", this._buttonHoverBorderColor = (null !== (_m = null === (_l = null == style ? void 0 : style.buttonStyle) || void 0 === _l ? void 0 : _l.buttonHoverBorderColor) && void 0 !== _m ? _m : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonHoverBorderColor) || "#4080FF", this._buttonTextHoverColor = null !== (_p = null === (_o = null == style ? void 0 : style.buttonStyle) || void 0 === _o ? void 0 : _o.buttonTextHoverColor) && void 0 !== _p ? _p : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonTextHoverColor, this._buttonDisableColor = (null !== (_r = null === (_q = null == style ? void 0 : style.buttonStyle) || void 0 === _q ? void 0 : _q.buttonDisableColor) && void 0 !== _r ? _r : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonDisableColor) || "#94bfff", this._buttonDisableBorderColor = (null !== (_t = null === (_s = null == style ? void 0 : style.buttonStyle) || void 0 === _s ? void 0 : _s.buttonDisableBorderColor) && void 0 !== _t ? _t : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonDisableBorderColor) || "#94bfff", this._buttonTextDisableColor = null !== (_v = null === (_u = null == style ? void 0 : style.buttonStyle) || void 0 === _u ? void 0 : _u.buttonTextDisableColor) && void 0 !== _v ? _v : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonTextDisableColor, this._buttonPadding = (null !== (_x = null === (_w = null == style ? void 0 : style.buttonStyle) || void 0 === _w ? void 0 : _w.buttonPadding) && void 0 !== _x ? _x : null == buttonThemeStyle ? void 0 : buttonThemeStyle.buttonPadding) || 10;
27231
+ }
27232
+ get buttonColor() {
27233
+ return this._buttonColor;
27234
+ }
27235
+ set buttonColor(buttonColor) {
27236
+ this._buttonColor = buttonColor;
27237
+ }
27238
+ get buttonBorderColor() {
27239
+ return this._buttonBorderColor;
27240
+ }
27241
+ set buttonBorderColor(buttonBorderColor) {
27242
+ this._buttonBorderColor = buttonBorderColor;
27243
+ }
27244
+ get buttonLineWidth() {
27245
+ return this._buttonLineWidth;
27246
+ }
27247
+ set buttonLineWidth(buttonLineWidth) {
27248
+ this._buttonLineWidth = buttonLineWidth;
27249
+ }
27250
+ get buttonBorderRadius() {
27251
+ return this._buttonBorderRadius;
27252
+ }
27253
+ set buttonBorderRadius(buttonBorderRadius) {
27254
+ this._buttonBorderRadius = buttonBorderRadius;
27255
+ }
27256
+ get buttonHoverColor() {
27257
+ return this._buttonHoverColor;
27258
+ }
27259
+ set buttonHoverColor(buttonHoverColor) {
27260
+ this._buttonHoverColor = buttonHoverColor;
27261
+ }
27262
+ get buttonHoverBorderColor() {
27263
+ return this._buttonHoverBorderColor;
27264
+ }
27265
+ set buttonHoverBorderColor(buttonHoverBorderColor) {
27266
+ this._buttonHoverBorderColor = buttonHoverBorderColor;
27267
+ }
27268
+ get buttonTextHoverColor() {
27269
+ return this._buttonTextHoverColor;
27270
+ }
27271
+ set buttonTextHoverColor(buttonTextHoverColor) {
27272
+ this._buttonTextHoverColor = buttonTextHoverColor;
27273
+ }
27274
+ get buttonDisableColor() {
27275
+ return this._buttonDisableColor;
27276
+ }
27277
+ set buttonDisableColor(buttonDisableColor) {
27278
+ this._buttonDisableColor = buttonDisableColor;
27279
+ }
27280
+ get buttonDisableBorderColor() {
27281
+ return this._buttonDisableBorderColor;
27282
+ }
27283
+ set buttonDisableBorderColor(buttonDisableBorderColor) {
27284
+ this._buttonDisableBorderColor = buttonDisableBorderColor;
27285
+ }
27286
+ get buttonTextDisableColor() {
27287
+ return this._buttonTextDisableColor;
27288
+ }
27289
+ set buttonTextDisableColor(buttonTextDisableColor) {
27290
+ this._buttonTextDisableColor = buttonTextDisableColor;
27291
+ }
27292
+ get buttonTextHoverBorderColor() {
27293
+ return this._buttonTextHoverBorderColor;
27294
+ }
27295
+ set buttonTextHoverBorderColor(buttonTextHoverBorderColor) {
27296
+ this._buttonTextHoverBorderColor = buttonTextHoverBorderColor;
27297
+ }
27298
+ get buttonPadding() {
27299
+ return this._buttonPadding;
27300
+ }
27301
+ set buttonPadding(buttonPadding) {
27302
+ this._buttonPadding = buttonPadding;
27303
+ }
27304
+ getStyle(style) {
27305
+ return new ButtonStyle(style, this);
27306
+ }
27307
+ clone() {
27308
+ return new ButtonStyle(this);
27309
+ }
27310
+ }
27311
+
27042
27312
  function of$2(columnStyle, bodyStyle, styleArg) {
27043
27313
  let StyleClassDef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Style$1;
27044
27314
  let globalAutoWrapText = arguments.length > 4 ? arguments[4] : undefined;
27045
27315
  let theme = arguments.length > 5 ? arguments[5] : undefined;
27046
- var _a, _b;
27047
- return columnStyle || bodyStyle ? columnStyle instanceof Style$1 ? columnStyle : "function" == typeof columnStyle ? of$2(columnStyle(styleArg), bodyStyle, styleArg, StyleClassDef, globalAutoWrapText, theme) : (columnStyle || (columnStyle = {}), globalAutoWrapText && !isValid$3(columnStyle.autoWrapText) && (columnStyle.autoWrapText = !0), StyleClassDef === CheckboxStyle$1 ? new CheckboxStyle$1(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_a = theme.checkboxStyle) && void 0 !== _a ? _a : {}) : StyleClassDef === RadioStyle ? new RadioStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_b = theme.radioStyle) && void 0 !== _b ? _b : {}) : new StyleClassDef(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {})) : StyleClassDef.DEFAULT;
27316
+ var _a, _b, _c, _d;
27317
+ return columnStyle || bodyStyle ? columnStyle instanceof Style$1 ? columnStyle : "function" == typeof columnStyle ? of$2(columnStyle(styleArg), bodyStyle, styleArg, StyleClassDef, globalAutoWrapText, theme) : (columnStyle || (columnStyle = {}), globalAutoWrapText && !isValid$3(columnStyle.autoWrapText) && (columnStyle.autoWrapText = !0), StyleClassDef === CheckboxStyle$1 ? new CheckboxStyle$1(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_a = theme.checkboxStyle) && void 0 !== _a ? _a : {}) : StyleClassDef === RadioStyle ? new RadioStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_b = theme.radioStyle) && void 0 !== _b ? _b : {}) : StyleClassDef === SwitchStyle ? new SwitchStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_c = theme.switchStyle) && void 0 !== _c ? _c : {}) : StyleClassDef === ButtonStyle ? new ButtonStyle(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {}, null !== (_d = theme.buttonStyle) && void 0 !== _d ? _d : {}) : new StyleClassDef(null != columnStyle ? columnStyle : {}, null != bodyStyle ? bodyStyle : {})) : StyleClassDef.DEFAULT;
27048
27318
  }
27049
27319
 
27050
27320
  class Env {
@@ -27453,6 +27723,7 @@
27453
27723
  MOUSELEAVE_AXIS: "mouseleave_axis",
27454
27724
  CHECKBOX_STATE_CHANGE: "checkbox_state_change",
27455
27725
  RADIO_STATE_CHANGE: "radio_state_change",
27726
+ SWITCH_STATE_CHANGE: "switch_state_change",
27456
27727
  AFTER_RENDER: "after_render",
27457
27728
  INITIALIZED: "initialized",
27458
27729
  CHANGE_CELL_VALUE: "change_cell_value",
@@ -27460,7 +27731,8 @@
27460
27731
  MOUSEDOWN_FILL_HANDLE: "mousedown_fill_handle",
27461
27732
  DBLCLICK_FILL_HANDLE: "dblclick_fill_handle",
27462
27733
  EMPTY_TIP_CLICK: "empty_tip_click",
27463
- EMPTY_TIP_DBLCLICK: "empty_tip_dblclick"
27734
+ EMPTY_TIP_DBLCLICK: "empty_tip_dblclick",
27735
+ BUTTON_CLICK: "button_click"
27464
27736
  };
27465
27737
 
27466
27738
  const judgeType = value => {
@@ -28345,7 +28617,7 @@
28345
28617
  }
28346
28618
  class TableTheme {
28347
28619
  constructor(obj, superTheme) {
28348
- this._defaultStyle = null, this._header = null, this._cornerHeader = null, this._cornerRightTopCell = null, this._cornerLeftBottomCell = null, this._cornerRightBottomCell = null, this._rightFrozen = null, this._bottomFrozen = null, this._rowHeader = null, this._body = null, this._groupTitle = null, this._scroll = null, this._tooltip = null, this._frameStyle = null, this._columnResize = null, this._dragHeaderSplitLine = null, this._frozenColumnLine = null, this._selectionStyle = null, this._axisStyle = null, this._checkboxStyle = null, this._radioStyle = null, this._textPopTipStyle = null, this._internalIconsStyle = null, this.isPivot = !1, this.name = "", this.internalTheme = {
28620
+ this._defaultStyle = null, this._header = null, this._cornerHeader = null, this._cornerRightTopCell = null, this._cornerLeftBottomCell = null, this._cornerRightBottomCell = null, this._rightFrozen = null, this._bottomFrozen = null, this._rowHeader = null, this._body = null, this._groupTitle = null, this._scroll = null, this._tooltip = null, this._frameStyle = null, this._columnResize = null, this._dragHeaderSplitLine = null, this._frozenColumnLine = null, this._selectionStyle = null, this._axisStyle = null, this._checkboxStyle = null, this._radioStyle = null, this._switchStyle = null, this._buttonStyle = null, this._textPopTipStyle = null, this._internalIconsStyle = null, this.isPivot = !1, this.name = "", this.internalTheme = {
28349
28621
  obj: obj,
28350
28622
  superTheme: superTheme
28351
28623
  }, this.name = getProp$1(obj, superTheme, ["name"]);
@@ -28979,6 +29251,28 @@
28979
29251
  }
28980
29252
  return this._radioStyle;
28981
29253
  }
29254
+ get switchStyle() {
29255
+ if (!this._switchStyle) {
29256
+ const {
29257
+ obj: obj,
29258
+ superTheme: superTheme
29259
+ } = this.internalTheme,
29260
+ switchStyle = ingoreNoneValueMerge({}, superTheme.switchStyle, obj.switchStyle);
29261
+ this._switchStyle = switchStyle;
29262
+ }
29263
+ return this._switchStyle;
29264
+ }
29265
+ get buttonStyle() {
29266
+ if (!this._buttonStyle) {
29267
+ const {
29268
+ obj: obj,
29269
+ superTheme: superTheme
29270
+ } = this.internalTheme,
29271
+ buttonStyle = ingoreNoneValueMerge({}, superTheme.buttonStyle, obj.buttonStyle);
29272
+ this._buttonStyle = buttonStyle;
29273
+ }
29274
+ return this._buttonStyle;
29275
+ }
28982
29276
  get textPopTipStyle() {
28983
29277
  if (!this._textPopTipStyle) {
28984
29278
  const {
@@ -32019,6 +32313,12 @@
32019
32313
  super.setAttributes(params, forceUpdateTag, context), params.gif && this.loadGif();
32020
32314
  }
32021
32315
  }
32316
+ class TextIcon extends Text {
32317
+ constructor(params) {
32318
+ var _a, _b, _c, _d, _e;
32319
+ params.fill = null !== (_a = params.fill) && void 0 !== _a ? _a : "#00F", params.fontSize = null !== (_b = params.fontSize) && void 0 !== _b ? _b : 12, params.underline = null !== (_c = params.underline) && void 0 !== _c ? _c : 1, params.textBaseline = null !== (_d = params.textBaseline) && void 0 !== _d ? _d : "top", params.cursor = null !== (_e = params.cursor) && void 0 !== _e ? _e : "pointer", super(params);
32320
+ }
32321
+ }
32022
32322
 
32023
32323
  function emptyCustomLayout(args) {
32024
32324
  return {
@@ -33046,7 +33346,7 @@
33046
33346
  updateCenterLayout(contentWidth) {
33047
33347
  let textWidth = contentWidth;
33048
33348
  this._centerGroup.forEachChildren(child => {
33049
- child instanceof Icon && (textWidth -= child.AABBBounds.width());
33349
+ (child instanceof Icon || child instanceof TextIcon) && (textWidth -= child.AABBBounds.width());
33050
33350
  });
33051
33351
  const text = this._centerGroup.getChildByName("text");
33052
33352
  text instanceof RichText ? text.setAttribute("width", textWidth) : text instanceof Text && text.setAttribute("maxLineWidth", textWidth);
@@ -33231,10 +33531,9 @@
33231
33531
  var _a, _b, _c, _d, _e, _f;
33232
33532
  const iconAttribute = {};
33233
33533
  "image" === icon.type ? icon.isGif ? (iconAttribute.gif = icon.src, iconAttribute.image = icon.src) : iconAttribute.image = icon.src : ("svg" === icon.type || "svg" in icon) && (iconAttribute.image = icon.svg), iconAttribute.width = icon.width, iconAttribute.height = icon.height, iconAttribute.visibleTime = null !== (_a = icon.visibleTime) && void 0 !== _a ? _a : "always", iconAttribute.funcType = icon.funcType, iconAttribute.interactive = icon.interactive, iconAttribute.isGif = icon.isGif;
33234
- let hierarchyOffset = 0;
33235
- if (dealWithIconComputeVar && 0 !== (null == dealWithIconComputeVar ? void 0 : dealWithIconComputeVar.addedHierarchyOffset) || !isNumber$4(col) || !isNumber$4(row) || !table || icon.funcType !== IconFuncTypeEnum.collapse && icon.funcType !== IconFuncTypeEnum.expand && icon.positionType !== IconPosition.contentLeft && icon.positionType !== IconPosition.contentRight || (hierarchyOffset = range ? getHierarchyOffset(range.start.col, range.start.row, table) : getHierarchyOffset(col, row, table), dealWithIconComputeVar && (dealWithIconComputeVar.addedHierarchyOffset = 1)), iconAttribute.marginLeft = (null !== (_b = icon.marginLeft) && void 0 !== _b ? _b : 0) + hierarchyOffset, iconAttribute.marginRight = null !== (_c = icon.marginRight) && void 0 !== _c ? _c : 0, !1 === icon.interactive && (iconAttribute.pickable = !1), icon.hover && (iconAttribute.backgroundWidth = null !== (_d = icon.hover.width) && void 0 !== _d ? _d : icon.width, iconAttribute.backgroundHeight = null !== (_e = icon.hover.width) && void 0 !== _e ? _e : icon.width, iconAttribute.backgroundColor = null !== (_f = icon.hover.bgColor) && void 0 !== _f ? _f : "rgba(22,44,66,0.2)", iconAttribute.hoverImage = icon.hover.image), icon.cursor && (iconAttribute.cursor = icon.cursor), "shape" in icon && "circle" === icon.shape && (iconAttribute.shape = icon.shape), mark) return mark.setAttributes(iconAttribute), mark.loadImage(iconAttribute.image), mark.tooltip = icon.tooltip, mark.name = icon.name, mark;
33236
- const iconMark = new Icon(iconAttribute);
33237
- return iconMark.tooltip = icon.tooltip, iconMark.name = icon.name, iconMark;
33534
+ let iconMark,
33535
+ hierarchyOffset = 0;
33536
+ return dealWithIconComputeVar && 0 !== (null == dealWithIconComputeVar ? void 0 : dealWithIconComputeVar.addedHierarchyOffset) || !isNumber$4(col) || !isNumber$4(row) || !table || icon.funcType !== IconFuncTypeEnum.collapse && icon.funcType !== IconFuncTypeEnum.expand && icon.positionType !== IconPosition.contentLeft && icon.positionType !== IconPosition.contentRight || (hierarchyOffset = range ? getHierarchyOffset(range.start.col, range.start.row, table) : getHierarchyOffset(col, row, table), dealWithIconComputeVar && (dealWithIconComputeVar.addedHierarchyOffset = 1)), iconAttribute.marginLeft = (null !== (_b = icon.marginLeft) && void 0 !== _b ? _b : 0) + hierarchyOffset, iconAttribute.marginRight = null !== (_c = icon.marginRight) && void 0 !== _c ? _c : 0, !1 === icon.interactive && (iconAttribute.pickable = !1), icon.hover && (iconAttribute.backgroundWidth = null !== (_d = icon.hover.width) && void 0 !== _d ? _d : icon.width, iconAttribute.backgroundHeight = null !== (_e = icon.hover.width) && void 0 !== _e ? _e : icon.width, iconAttribute.backgroundColor = null !== (_f = icon.hover.bgColor) && void 0 !== _f ? _f : "rgba(22,44,66,0.2)", iconAttribute.hoverImage = icon.hover.image), icon.cursor && (iconAttribute.cursor = icon.cursor), "shape" in icon && "circle" === icon.shape && (iconAttribute.shape = icon.shape), mark ? (mark.setAttributes(iconAttribute), mark.loadImage(iconAttribute.image), mark.tooltip = icon.tooltip, mark.name = icon.name, mark) : ("text" === icon.type ? (iconAttribute.text = icon.content, merge$1(iconAttribute, icon.style), iconMark = new TextIcon(iconAttribute), iconMark.tooltip = icon.tooltip, iconMark.name = icon.name) : (iconMark = new Icon(iconAttribute), iconMark.tooltip = icon.tooltip, iconMark.name = icon.name), iconMark);
33238
33537
  }
33239
33538
  function dealWithRichTextIcon(icon) {
33240
33539
  var _a, _b, _c, _d, _e, _f;
@@ -33719,6 +34018,10 @@
33719
34018
  cellGroup = Factory.getFunction("createCheckboxCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync);
33720
34019
  } else if ("radio" === type) {
33721
34020
  cellGroup = Factory.getFunction("createRadioCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, table, cellTheme, define, range);
34021
+ } else if ("switch" === type) {
34022
+ cellGroup = Factory.getFunction("createSwitchCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync);
34023
+ } else if ("button" === type) {
34024
+ cellGroup = Factory.getFunction("createButtonCellGroup")(null, columnGroup, 0, y, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync);
33722
34025
  }
33723
34026
  return cellGroup.onBeforeAttributeUpdate = onBeforeAttributeUpdateForInvertHighlight, cellGroup;
33724
34027
  }
@@ -34011,7 +34314,8 @@
34011
34314
  }
34012
34315
 
34013
34316
  const utilCheckBoxMark = new CheckBox({}),
34014
- utilRadioMark = new Radio({});
34317
+ utilRadioMark = new Radio({}),
34318
+ utilButtonMark = new Tag({});
34015
34319
  function computeCheckboxCellHeight(cellValue, col, row, endCol, actStyle, autoWrapText, iconWidth, fontSize, fontStyle, fontWeight, fontFamily, lineHeight, lineClamp, padding, table) {
34016
34320
  const text = isObject$7(cellValue) ? cellValue.text : cellValue,
34017
34321
  lines = validToString(text).split("\n") || [],
@@ -34094,6 +34398,41 @@
34094
34398
  } else maxHeight = Math.max(size, lines.length * lineHeight);
34095
34399
  return maxHeight;
34096
34400
  }
34401
+ function computeSwitchCellHeight(cellValue, col, row, endCol, actStyle, autoWrapText, iconWidth, fontSize, fontStyle, fontWeight, fontFamily, lineHeight, lineClamp, padding, table) {
34402
+ return getProp("boxWidth", actStyle, col, row, table);
34403
+ }
34404
+ function computeButtonCellHeight(cellValue, col, row, endCol, actStyle, autoWrapText, iconWidth, fontSize, fontStyle, fontWeight, fontFamily, lineHeight, lineClamp, padding, table) {
34405
+ const text = isObject$7(cellValue) ? cellValue.text : cellValue,
34406
+ lines = validToString(text).split("\n") || [],
34407
+ cellWidth = table.getColsWidth(col, endCol),
34408
+ buttonPadding = getProp("buttonPadding", actStyle, col, row, table),
34409
+ buttonLineWidth = getProp("buttonLineWidth", actStyle, col, row, table);
34410
+ let maxHeight = 0;
34411
+ if (autoWrapText) {
34412
+ const maxLineWidth = cellWidth - (padding[1] + padding[3]);
34413
+ utilButtonMark.setAttributes({
34414
+ text: lines,
34415
+ textStyle: {
34416
+ maxLineWidth: maxLineWidth,
34417
+ fontSize: fontSize,
34418
+ fontStyle: fontStyle,
34419
+ fontWeight: fontWeight,
34420
+ fontFamily: fontFamily,
34421
+ lineHeight: lineHeight,
34422
+ wordBreak: "break-word",
34423
+ lineClamp: lineClamp
34424
+ },
34425
+ padding: buttonPadding,
34426
+ panel: {
34427
+ visible: !0,
34428
+ fill: "red",
34429
+ stroke: "red",
34430
+ lineWidth: buttonLineWidth
34431
+ }
34432
+ }), utilRadioMark.render(), maxHeight = utilRadioMark.AABBBounds.height();
34433
+ } else maxHeight = lines.length * lineHeight + 2 * buttonPadding;
34434
+ return maxHeight;
34435
+ }
34097
34436
 
34098
34437
  let customAlphabetCharSet = "",
34099
34438
  textMeasureMode = "quick";
@@ -34519,7 +34858,7 @@
34519
34858
  underline = getProp("underline", actStyle, col, row, table),
34520
34859
  underlineOffset = null !== (_c = getProp("underlineOffset", actStyle, col, row, table)) && void 0 !== _c ? _c : 0;
34521
34860
  let text;
34522
- if ("text" !== cellType && "link" !== cellType && "progressbar" !== cellType && "checkbox" !== cellType && "radio" !== cellType) maxHeight = lineHeight;else if ("checkbox" === cellType) maxHeight = computeCheckboxCellHeight(cellValue, col, row, endCol, actStyle, autoWrapText, iconWidth, fontSize, fontStyle, fontWeight, fontFamily, lineHeight, lineClamp, padding, table);else if ("radio" === cellType) maxHeight = computeRadioCellHeight(cellValue, col, row, endCol, actStyle, autoWrapText, iconWidth, fontSize, fontStyle, fontWeight, fontFamily, lineHeight, lineClamp, padding, table);else {
34861
+ if ("text" !== cellType && "link" !== cellType && "progressbar" !== cellType && "checkbox" !== cellType && "radio" !== cellType && "switch" !== cellType && "button" !== cellType) maxHeight = lineHeight;else if ("checkbox" === cellType) maxHeight = computeCheckboxCellHeight(cellValue, col, row, endCol, actStyle, autoWrapText, iconWidth, fontSize, fontStyle, fontWeight, fontFamily, lineHeight, lineClamp, padding, table);else if ("radio" === cellType) maxHeight = computeRadioCellHeight(cellValue, col, row, endCol, actStyle, autoWrapText, iconWidth, fontSize, fontStyle, fontWeight, fontFamily, lineHeight, lineClamp, padding, table);else if ("switch" === cellType) maxHeight = computeSwitchCellHeight(cellValue, col, row, endCol, actStyle, autoWrapText, iconWidth, fontSize, fontStyle, fontWeight, fontFamily, lineHeight, lineClamp, padding, table);else if ("button" === cellType) maxHeight = computeButtonCellHeight(cellValue, col, row, endCol, actStyle, autoWrapText, iconWidth, fontSize, fontStyle, fontWeight, fontFamily, lineHeight, lineClamp, padding, table);else {
34523
34862
  text = cellValue;
34524
34863
  const lines = breakString(text, table).text,
34525
34864
  cellWidth = table.getColsWidth(col, endCol);
@@ -35150,10 +35489,12 @@
35150
35489
  getMenuInfo(col, row, type) {
35151
35490
  var _a;
35152
35491
  if (type === MenuType.dropDown) {
35153
- const {
35154
- dropDownMenu = this._table.globalDropDownMenu,
35155
- pivotInfo: pivotInfo
35156
- } = this._table._getHeaderLayoutMap(col, row);
35492
+ let dropDownMenu = this._table.globalDropDownMenu;
35493
+ dropDownMenu = this._table._getHeaderLayoutMap(col, row).dropDownMenu, "function" == typeof dropDownMenu && (dropDownMenu = dropDownMenu({
35494
+ row: row,
35495
+ col: col,
35496
+ table: this._table
35497
+ }));
35157
35498
  let highlightIndex = -1;
35158
35499
  if (Array.isArray(dropDownMenu)) for (let i = 0; i < dropDownMenu.length; i++) if (this._table._dropDownMenuIsHighlight(col, row, i)) {
35159
35500
  highlightIndex = i;
@@ -36114,7 +36455,7 @@
36114
36455
  }
36115
36456
  }
36116
36457
  activate(table) {
36117
- var _a, _b, _c, _d;
36458
+ var _a, _b, _c, _d, _e;
36118
36459
  this.active = !0;
36119
36460
  const {
36120
36461
  col: col,
@@ -36132,7 +36473,7 @@
36132
36473
  y1: y1 - table.scrollTop,
36133
36474
  y2: y2 - table.scrollTop
36134
36475
  });
36135
- this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge$1({}, this.attribute.tableChartOption, {
36476
+ null === (_a = this.activeChartInstance) || void 0 === _a || _a.release(), this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, merge$1({}, this.attribute.tableChartOption, {
36136
36477
  renderCanvas: this.attribute.canvas,
36137
36478
  mode: "desktop-browser",
36138
36479
  canvasControled: !1,
@@ -36160,7 +36501,7 @@
36160
36501
  const chartStage = this.activeChartInstance.getStage(),
36161
36502
  matrix = this.globalTransMatrix.clone(),
36162
36503
  stageMatrix = this.stage.window.getViewBoxTransform();
36163
- matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f), chartStage.window.setViewBoxTransform && chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f), this.activeChartInstance.renderSync(), null === (_b = null === (_a = table.internalProps.layoutMap) || void 0 === _a ? void 0 : _a.updateDataStateToActiveChartInstance) || void 0 === _b || _b.call(_a, this.activeChartInstance), this.activeChartInstance.on("click", params => {
36504
+ matrix.multiply(stageMatrix.a, stageMatrix.b, stageMatrix.c, stageMatrix.d, stageMatrix.e, stageMatrix.f), chartStage.window.setViewBoxTransform && chartStage.window.setViewBoxTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f), this.activeChartInstance.renderSync(), null === (_c = null === (_b = table.internalProps.layoutMap) || void 0 === _b ? void 0 : _b.updateDataStateToActiveChartInstance) || void 0 === _c || _c.call(_b, this.activeChartInstance), this.activeChartInstance.on("click", params => {
36164
36505
  var _a;
36165
36506
  !1 === (null === (_a = this.attribute.spec.select) || void 0 === _a ? void 0 : _a.enable) ? table.scenegraph.updateChartState(null) : Chart.temp && table.scenegraph.updateChartState(null == params ? void 0 : params.datum);
36166
36507
  }), this.activeChartInstance.on("brushEnd", params => {
@@ -36168,7 +36509,7 @@
36168
36509
  table.scenegraph.updateChartState(null === (_a = null == params ? void 0 : params.value) || void 0 === _a ? void 0 : _a.inBrushData), Chart.temp = 0, setTimeout(() => {
36169
36510
  Chart.temp = 1;
36170
36511
  }, 0);
36171
- }), null === (_d = (_c = table)._bindChartEvent) || void 0 === _d || _d.call(_c, this.activeChartInstance);
36512
+ }), null === (_e = (_d = table)._bindChartEvent) || void 0 === _e || _e.call(_d, this.activeChartInstance);
36172
36513
  }
36173
36514
  deactivate() {
36174
36515
  var _a, _b;
@@ -36223,7 +36564,7 @@
36223
36564
  return isHandlingChartQueue;
36224
36565
  }
36225
36566
  function renderChart(chart) {
36226
- var _a, _b, _c, _d, _e, _f;
36567
+ var _a, _b, _c, _d, _e, _f, _g;
36227
36568
  const {
36228
36569
  axes: axes,
36229
36570
  dataId: dataId,
@@ -36270,10 +36611,10 @@
36270
36611
  } = chart.getRootNode();
36271
36612
  let updateSpec = !1;
36272
36613
  if (table.options.specFormat) {
36273
- const formatResult = table.options.specFormat(chart.attribute.spec);
36614
+ const formatResult = table.options.specFormat(chart.attribute.spec, chartInstance, chart);
36274
36615
  if (formatResult.needFormatSpec && formatResult.spec) {
36275
36616
  const spec = formatResult.spec;
36276
- chartInstance.updateSpecSync(spec), updateSpec = !0;
36617
+ chartInstance.updateSpecSync(spec), updateSpec = null === (_a = formatResult.updateSpec) || void 0 === _a || _a;
36277
36618
  }
36278
36619
  }
36279
36620
  if (!updateSpec) if (null == axes || axes.forEach((axis, index) => {
@@ -36293,7 +36634,7 @@
36293
36634
  tickMode: null === (_e = axis.tick) || void 0 === _e ? void 0 : _e.tickMode
36294
36635
  }
36295
36636
  }, !0);
36296
- }), null === (_b = null === (_a = table.internalProps.layoutMap) || void 0 === _a ? void 0 : _a.updateDataStateToActiveChartInstance) || void 0 === _b || _b.call(_a, chartInstance), "string" == typeof dataId) chartInstance.updateDataSync(dataId, null != data ? data : []);else {
36637
+ }), null === (_c = null === (_b = table.internalProps.layoutMap) || void 0 === _b ? void 0 : _b.updateDataStateToActiveChartInstance) || void 0 === _c || _c.call(_b, chartInstance), "string" == typeof dataId) chartInstance.updateDataSync(dataId, null != data ? data : []);else {
36297
36638
  const dataBatch = [];
36298
36639
  for (const dataIdStr in dataId) {
36299
36640
  const dataIdAndField = dataId[dataIdStr],
@@ -36303,11 +36644,11 @@
36303
36644
  });
36304
36645
  dataBatch.push({
36305
36646
  id: dataIdStr,
36306
- values: dataIdAndField ? null !== (_c = null == data ? void 0 : data.filter(item => item.hasOwnProperty(dataIdAndField))) && void 0 !== _c ? _c : [] : null != data ? data : [],
36307
- fields: null === (_d = null == series ? void 0 : series.data) || void 0 === _d ? void 0 : _d.fields
36308
- }), chartInstance.updateFullDataSync || chartInstance.updateDataSync(dataIdStr, dataIdAndField ? null !== (_e = null == data ? void 0 : data.filter(item => item.hasOwnProperty(dataIdAndField))) && void 0 !== _e ? _e : [] : null != data ? data : []);
36647
+ values: dataIdAndField ? null !== (_d = null == data ? void 0 : data.filter(item => item.hasOwnProperty(dataIdAndField))) && void 0 !== _d ? _d : [] : null != data ? data : [],
36648
+ fields: null === (_e = null == series ? void 0 : series.data) || void 0 === _e ? void 0 : _e.fields
36649
+ }), chartInstance.updateFullDataSync || chartInstance.updateDataSync(dataIdStr, dataIdAndField ? null !== (_f = null == data ? void 0 : data.filter(item => item.hasOwnProperty(dataIdAndField))) && void 0 !== _f ? _f : [] : null != data ? data : []);
36309
36650
  }
36310
- null === (_f = chartInstance.updateFullDataSync) || void 0 === _f || _f.call(chartInstance, dataBatch);
36651
+ null === (_g = chartInstance.updateFullDataSync) || void 0 === _g || _g.call(chartInstance, dataBatch);
36311
36652
  }
36312
36653
  cacheStageCanvas(chartInstance.getStage(), chart);
36313
36654
  }
@@ -36429,10 +36770,10 @@
36429
36770
  context.drawImage(canvas, x, y, width, height);
36430
36771
  }) : context.drawImage(cacheCanvas, x, y, width, height);else if (activeChartInstance) {
36431
36772
  if (table.options.specFormat) {
36432
- const formatResult = table.options.specFormat(chart.attribute.spec);
36773
+ const formatResult = table.options.specFormat(chart.attribute.spec, activeChartInstance, chart);
36433
36774
  if (formatResult.needFormatSpec && formatResult.spec) {
36434
36775
  const spec = formatResult.spec;
36435
- return void activeChartInstance.updateSpecSync(spec);
36776
+ activeChartInstance.updateSpecSync(spec);
36436
36777
  }
36437
36778
  }
36438
36779
  const viewBox = chart.getViewBox();
@@ -37272,10 +37613,10 @@
37272
37613
  actualWidth = 0;
37273
37614
  for (let col = 0; col < table.colCount; col++) {
37274
37615
  const colWidth = update && null !== (_f = newWidths[col]) && void 0 !== _f ? _f : table.getColWidth(col);
37275
- (col < table.rowHeaderLevelCount || table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount) && (actualHeaderWidth += colWidth), actualWidth += colWidth;
37616
+ (col < table.rowHeaderLevelCount + table.leftRowSeriesNumberCount || table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount) && (actualHeaderWidth += colWidth), actualWidth += colWidth;
37276
37617
  }
37277
37618
  if (actualWidth < canvasWidth && actualWidth > actualHeaderWidth) {
37278
- getAdaptiveWidth(canvasWidth - actualHeaderWidth, table.rowHeaderLevelCount, table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount, update, newWidths, table);
37619
+ getAdaptiveWidth(canvasWidth - actualHeaderWidth, table.rowHeaderLevelCount + table.leftRowSeriesNumberCount, table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount, update, newWidths, table);
37279
37620
  }
37280
37621
  }
37281
37622
  if (update) {
@@ -37329,7 +37670,7 @@
37329
37670
  continue;
37330
37671
  }
37331
37672
  const cellType = table.isHeader(col, row) ? null === (_a = table._getHeaderLayoutMap(col, row)) || void 0 === _a ? void 0 : _a.headerType : table.getBodyColumnType(col, row);
37332
- if (isValid$3(cellType) && "text" !== cellType && "link" !== cellType && "progressbar" !== cellType && "checkbox" !== cellType && "radio" !== cellType) {
37673
+ if (isValid$3(cellType) && "text" !== cellType && "link" !== cellType && "progressbar" !== cellType && "checkbox" !== cellType && "radio" !== cellType && "switch" !== cellType && "button" !== cellType) {
37333
37674
  maxWidth = Math.max(maxWidth, table.getColWidthDefinedNumber(col) || 0);
37334
37675
  continue;
37335
37676
  }
@@ -37398,7 +37739,7 @@
37398
37739
  }
37399
37740
  }
37400
37741
  function computeTextWidth(col, row, cellType, table) {
37401
- var _a, _b, _c;
37742
+ var _a, _b, _c, _d;
37402
37743
  let maxWidth = 0;
37403
37744
  const cellValue = table.getCellValue(col, row),
37404
37745
  actStyle = table._getCellStyle(col, row);
@@ -37437,6 +37778,17 @@
37437
37778
  text += (isObject$7(line) ? line.text : line).toString();
37438
37779
  });
37439
37780
  } else text = isObject$7(cellValue) ? cellValue.text : cellValue;
37781
+ } else if ("button" === cellType) {
37782
+ const define = table.getBodyColumnDefine(col, row),
37783
+ buttonTextValue = getOrApply(define.text, {
37784
+ col: col,
37785
+ row: row,
37786
+ table: table,
37787
+ context: null,
37788
+ value: cellValue,
37789
+ dataValue: table.getCellOriginValue(col, row)
37790
+ });
37791
+ text = null !== (_c = null != buttonTextValue ? buttonTextValue : cellValue) && void 0 !== _c ? _c : "";
37440
37792
  } else text = cellValue;
37441
37793
  const lines = breakString(text, table).text;
37442
37794
  if (lines.length >= 1 && (1 !== lines.length || "" !== lines[0]) ? lines.forEach(line => {
@@ -37460,9 +37812,15 @@
37460
37812
  if (isArray$7(cellValue)) {
37461
37813
  const define = table.getBodyColumnDefine(col, row),
37462
37814
  spaceBetweenRadio = getProp("spaceBetweenRadio", actStyle, col, row, table),
37463
- radioDirectionInCell = null !== (_c = null == define ? void 0 : define.radioDirectionInCell) && void 0 !== _c ? _c : "vertical";
37815
+ radioDirectionInCell = null !== (_d = null == define ? void 0 : define.radioDirectionInCell) && void 0 !== _d ? _d : "vertical";
37464
37816
  "vertical" === radioDirectionInCell ? (maxWidth += circleSize, maxWidth += spaceBetweenTextAndIcon) : "horizontal" === radioDirectionInCell && (maxWidth += (circleSize + spaceBetweenTextAndIcon) * cellValue.length, maxWidth += spaceBetweenRadio * (cellValue.length - 1));
37465
37817
  } else maxWidth += circleSize, text && (maxWidth += spaceBetweenTextAndIcon);
37818
+ } else if ("switch" === cellType) {
37819
+ const boxWidth = getProp("boxWidth", actStyle, col, row, table);
37820
+ maxWidth = boxWidth;
37821
+ } else if ("button" === cellType) {
37822
+ const buttonPadding = getProp("buttonPadding", actStyle, col, row, table);
37823
+ maxWidth += 2 * buttonPadding;
37466
37824
  }
37467
37825
  return maxWidth;
37468
37826
  }
@@ -40319,7 +40677,7 @@
40319
40677
  class Scenegraph {
40320
40678
  constructor(table) {
40321
40679
  let width, height;
40322
- this._needUpdateContainer = !1, this.table = table, this.hasFrozen = !1, this.clear = !0, this.mergeMap = new Map(), setPoptipTheme(this.table.theme.textPopTipStyle), table.options.canvas && table.options.viewBox ? (vglobal.setEnv("browser"), width = table.options.viewBox.x2 - table.options.viewBox.x1, height = table.options.viewBox.y2 - table.options.viewBox.y1) : "node" === Env.mode ? (vglobal.setEnv("node", table.options.modeParams), width = table.canvasWidth, height = table.canvasHeight) : (vglobal.setEnv("browser"), width = table.canvas.width, height = table.canvas.height), this.stage = createStage(Object.assign({
40680
+ this._needUpdateContainer = !1, this.table = table, this.hasFrozen = !1, this.clear = !0, this.mergeMap = new Map(), setPoptipTheme(this.table.theme.textPopTipStyle), "node" === Env.mode ? (vglobal.setEnv("node", table.options.modeParams), width = table.canvasWidth, height = table.canvasHeight) : table.options.canvas && table.options.viewBox ? (vglobal.setEnv("browser"), width = table.options.viewBox.x2 - table.options.viewBox.x1, height = table.options.viewBox.y2 - table.options.viewBox.y1) : (vglobal.setEnv("browser"), width = table.canvas.width, height = table.canvas.height), this.stage = createStage(Object.assign({
40323
40681
  canvas: table.canvas,
40324
40682
  width: width,
40325
40683
  height: height,
@@ -40571,10 +40929,10 @@
40571
40929
  null === (_b = null === (_a = null == cellGroup ? void 0 : cellGroup.firstChild) || void 0 === _a ? void 0 : _a.deactivate) || void 0 === _b || _b.call(_a);
40572
40930
  }
40573
40931
  activateChart(col, row) {
40574
- var _a, _b;
40932
+ var _a, _b, _c;
40575
40933
  if (-1 === col || -1 === row) return;
40576
40934
  const cellGroup = this.getCell(col, row);
40577
- null === (_b = null === (_a = null == cellGroup ? void 0 : cellGroup.firstChild) || void 0 === _a ? void 0 : _a.activate) || void 0 === _b || _b.call(_a, this.table);
40935
+ return null === (_b = null === (_a = null == cellGroup ? void 0 : cellGroup.firstChild) || void 0 === _a ? void 0 : _a.activate) || void 0 === _b || _b.call(_a, this.table), null === (_c = null == cellGroup ? void 0 : cellGroup.firstChild) || void 0 === _c ? void 0 : _c.activeChartInstance;
40578
40936
  }
40579
40937
  removeInteractionBorder(col, row) {
40580
40938
  const cellGroup = this.getCell(col, row);
@@ -41866,7 +42224,7 @@
41866
42224
  const define = table.getBodyColumnDefine(col, row),
41867
42225
  field = null == define ? void 0 : define.field,
41868
42226
  cellType = table.getCellType(col, row);
41869
- if (isValid$3(field) && "checkbox" === cellType) {
42227
+ if (isValid$3(field) && "radio" === cellType) {
41870
42228
  const dataIndex = table.dataSource.getIndexKey(table.getRecordShowIndexByCell(col, row)),
41871
42229
  columnState = null === (_a = table.stateManager.radioState) || void 0 === _a ? void 0 : _a[field];
41872
42230
  if (isNumber$4(columnState)) {
@@ -42733,8 +43091,12 @@
42733
43091
  col = cellAddress.col, row = cellAddress.row;
42734
43092
  }
42735
43093
  if (isValid$3(col) && isValid$3(row) && this.table.isCellRangeEqual(colNow, rowNow, col, row)) {
42736
- const dropDownMenu = this.table._getHeaderLayoutMap(null != col ? col : colNow, null != row ? row : rowNow).dropDownMenu || this.table.globalDropDownMenu;
42737
- if (dropDownMenu) for (let i = 0; i < dropDownMenu.length; i++) {
43094
+ let dropDownMenu = this.table._getHeaderLayoutMap(null != col ? col : colNow, null != row ? row : rowNow).dropDownMenu || this.table.globalDropDownMenu;
43095
+ if ("function" == typeof dropDownMenu && (dropDownMenu = dropDownMenu({
43096
+ row: row,
43097
+ col: col,
43098
+ table: this.table
43099
+ })), dropDownMenu) for (let i = 0; i < dropDownMenu.length; i++) {
42738
43100
  const item = dropDownMenu[i];
42739
43101
  if (isObject$7(item) && (item.menuKey || item.text) === (menuKey || "") && i === index) return !0;
42740
43102
  if (isString$4(item) && item === menuKey && i === index) return !0;
@@ -43528,6 +43890,30 @@
43528
43890
  radioIndexInCell: radioIndexInCell
43529
43891
  });
43530
43892
  table.fireListeners(TABLE_EVENT_TYPE.RADIO_STATE_CHANGE, cellsEvent), table.scenegraph.updateNextFrame();
43893
+ }), table.scenegraph.tableGroup.addEventListener("switch_state_change", e => {
43894
+ var _a, _b;
43895
+ const eventArgsSet = getCellEventArgsSet(e),
43896
+ {
43897
+ col: col,
43898
+ row: row,
43899
+ target: target
43900
+ } = eventArgsSet.eventArgs,
43901
+ cellInfo = table.getCellInfo(col, row),
43902
+ mergeRange = getCellMergeInfo(table, col, row);
43903
+ if (mergeRange) for (let col = mergeRange.start.col; col <= mergeRange.end.col; col++) for (let row = mergeRange.start.row; row <= mergeRange.end.row; row++) {
43904
+ table.scenegraph.getCell(col, row).forEachChildren(switchComponent => {
43905
+ "switch" === switchComponent.name && switchComponent.setAttributes({
43906
+ checked: e.target.attribute.checked
43907
+ });
43908
+ });
43909
+ }
43910
+ const cellsEvent = Object.assign(Object.assign({}, cellInfo), {
43911
+ event: e.nativeEvent,
43912
+ target: null === (_a = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.target,
43913
+ mergeCellInfo: null === (_b = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.mergeInfo,
43914
+ checked: e.detail.checked
43915
+ });
43916
+ table.stateManager.setCheckedState(col, row, cellInfo.field, e.detail.checked), table.fireListeners(TABLE_EVENT_TYPE.SWITCH_STATE_CHANGE, cellsEvent), table.scenegraph.updateNextFrame();
43531
43917
  }), table.scenegraph.stage.addEventListener("wheel", e => {
43532
43918
  var _a;
43533
43919
  e.path.find(node => "legend" === node.name) || (null === (_a = table.editorManager) || void 0 === _a || _a.completeEdit(), table.eventManager._enableTableScroll && handleWhell(e, stateManager));
@@ -43813,7 +44199,7 @@
43813
44199
  !1 !== (null === (_a = table.eventOptions) || void 0 === _a ? void 0 : _a.preventDefaultContextMenu) && e.preventDefault();
43814
44200
  }), table.options.canvas || handler.on(table.getContainer(), "resize", e => {
43815
44201
  var _a;
43816
- 0 === e.width && 0 === e.height || ((table.autoFillWidth || table.autoFillHeight) && (null === (_a = table.editorManager) || void 0 === _a || _a.completeEdit()), isValid$3(table.options.pixelRatio) || table.setPixelRatio(getPixelRatio()), e.windowSizeNotChange || table.resize());
44202
+ table.isReleased || 0 === e.width && 0 === e.height || ((table.autoFillWidth || table.autoFillHeight) && (null === (_a = table.editorManager) || void 0 === _a || _a.completeEdit()), isValid$3(table.options.pixelRatio) || table.setPixelRatio(getPixelRatio()), e.windowSizeNotChange || table.resize());
43817
44203
  });
43818
44204
  const regex = /<tr[^>]*>([\s\S]*?)<\/tr>/g,
43819
44205
  cellRegex = /<td[^>]*>([\s\S]*?)<\/td>/g;
@@ -44226,6 +44612,21 @@
44226
44612
  });
44227
44613
  }
44228
44614
 
44615
+ function bindButtonClickEvent(table) {
44616
+ table.on(TABLE_EVENT_TYPE.CLICK_CELL, e => {
44617
+ const {
44618
+ col: col,
44619
+ row: row,
44620
+ target: target
44621
+ } = e;
44622
+ "button" !== target.name || target.attribute.disable || table.hasListeners(TABLE_EVENT_TYPE.BUTTON_CLICK) && table.fireListeners(TABLE_EVENT_TYPE.BUTTON_CLICK, {
44623
+ col: col,
44624
+ row: row,
44625
+ event: e.event
44626
+ });
44627
+ });
44628
+ }
44629
+
44229
44630
  class EventManager {
44230
44631
  constructor(table) {
44231
44632
  this.isDown = !1, this.isDraging = !1, this.globalEventListeners = [], this._enableTableScroll = !0, this.table = table, this.handleTextStickBindId = [], this.inertiaScroll = new InertiaScroll(table.stateManager), "node" === Env.mode || table.options.disableInteraction || (this.bindOuterEvent(), setTimeout(() => {
@@ -44270,11 +44671,12 @@
44270
44671
  }), this.table.on(TABLE_EVENT_TYPE.DROPDOWN_MENU_CLICK, () => {
44271
44672
  stateManager.hideMenu();
44272
44673
  }), this.updateEventBinder(), bindMediaClick(this.table), this.table.on(TABLE_EVENT_TYPE.DBLCLICK_CELL, e => {
44273
- var _a;
44674
+ var _a, _b, _c;
44274
44675
  if (e.federatedEvent) {
44275
44676
  const eventArgsSet = getCellEventArgsSet(e.federatedEvent),
44276
- resizeCol = this.table.scenegraph.getResizeColAt(eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, null === (_a = eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.targetCell);
44277
- if (this.table.eventManager.checkCellFillhandle(eventArgsSet)) this.table.fireListeners(TABLE_EVENT_TYPE.DBLCLICK_FILL_HANDLE, {});else if (this.table._canResizeColumn(resizeCol.col, resizeCol.row) && resizeCol.col >= 0 && !this.table.options.disableDblclickAutoResizeColWidth) {
44677
+ resizeCol = this.table.scenegraph.getResizeColAt(eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, null === (_a = eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.targetCell),
44678
+ disableDblclickAutoResizeColWidth = null !== (_b = this.table.options.disableDblclickAutoResizeColWidth) && void 0 !== _b ? _b : null === (_c = this.table.options.resize) || void 0 === _c ? void 0 : _c.disableDblclickAutoResizeColWidth;
44679
+ if (this.table.eventManager.checkCellFillhandle(eventArgsSet)) this.table.fireListeners(TABLE_EVENT_TYPE.DBLCLICK_FILL_HANDLE, {});else if (this.table._canResizeColumn(resizeCol.col, resizeCol.row) && resizeCol.col >= 0 && !disableDblclickAutoResizeColWidth) {
44278
44680
  this.table.scenegraph.updateAutoColWidth(resizeCol.col), this.table.internalProps._widthResizedColMap.add(resizeCol.col), this.table.scenegraph.updateChartSizeForResizeColWidth(resizeCol.col);
44279
44681
  const state = this.table.stateManager;
44280
44682
  state.columnResize.col < state.table.frozenColCount && !state.table.isPivotTable() && !state.table.transpose && state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen);
@@ -44286,7 +44688,7 @@
44286
44688
  });
44287
44689
  }
44288
44690
  }
44289
- }), this.table.isPivotTable() && checkHaveDrill(this.table) && bindDrillEvent(this.table), bindSparklineHoverEvent(this.table), bindAxisClickEvent(this.table), bindAxisHoverEvent(this.table), bindGroupTitleCheckboxChange(this.table);
44691
+ }), this.table.isPivotTable() && checkHaveDrill(this.table) && bindDrillEvent(this.table), bindSparklineHoverEvent(this.table), bindAxisClickEvent(this.table), bindAxisHoverEvent(this.table), bindGroupTitleCheckboxChange(this.table), bindButtonClickEvent(this.table);
44290
44692
  }
44291
44693
  dealTableHover(eventArgsSet) {
44292
44694
  if (!eventArgsSet) return void this.table.stateManager.updateHoverPos(-1, -1);
@@ -44309,7 +44711,7 @@
44309
44711
  eventArgs: eventArgs
44310
44712
  } = eventArgsSet;
44311
44713
  if (eventArgs) {
44312
- if ("checkbox" === eventArgs.target.name || "radio" === eventArgs.target.name) return !1;
44714
+ if ("checkbox" === eventArgs.target.name || "radio" === eventArgs.target.name || "switch" === eventArgs.target.name || "button" === eventArgs.target.name) return !1;
44313
44715
  if (this.table.isHeader(eventArgs.col, eventArgs.row) && isCellDisableSelect(this.table, eventArgs.col, eventArgs.row)) return isSelectMoving || this.table.stateManager.updateSelectPos(-1, -1), !1;
44314
44716
  if (!this.table.isHeader(eventArgs.col, eventArgs.row) && isCellDisableSelect(this.table, eventArgs.col, eventArgs.row)) {
44315
44717
  if (!isSelectMoving) {
@@ -44566,7 +44968,7 @@
44566
44968
  }
44567
44969
  }
44568
44970
 
44569
- const ICON_PROP_KEYS = ["type", "content", "font", "color", "width", "height", "marginRight", "marginLeft", "src", "svg", "name", "path", "positionType", "tooltip", "hover", "cursor", "shape", "interactive", "isGif"];
44971
+ const ICON_PROP_KEYS = ["type", "content", "style", "color", "width", "height", "marginRight", "marginLeft", "src", "svg", "name", "path", "positionType", "tooltip", "hover", "cursor", "shape", "interactive", "isGif"];
44570
44972
  const iconPropKeys = ICON_PROP_KEYS;
44571
44973
 
44572
44974
  class BodyHelper {
@@ -44623,6 +45025,10 @@
44623
45025
  return CheckboxStyle$1;
44624
45026
  case "radio":
44625
45027
  return RadioStyle;
45028
+ case "switch":
45029
+ return SwitchStyle;
45030
+ case "button":
45031
+ return ButtonStyle;
44626
45032
  }
44627
45033
  return TextStyle;
44628
45034
  }
@@ -45442,13 +45848,24 @@
45442
45848
  getDropDownStateIcons(_table, col, row) {
45443
45849
  var _a, _b, _c;
45444
45850
  const headerC = _table.getHeaderDefine(col, row),
45445
- headerL = _table._getHeaderLayoutMap(col, row),
45446
- {
45447
- dropDownMenu: dropDownMenu
45448
- } = headerL,
45449
- results = [];
45450
- if (Array.isArray(dropDownMenu) && dropDownMenu.length || Array.isArray(_table.globalDropDownMenu) && _table.globalDropDownMenu.length && !(null === (_a = null == headerC ? void 0 : headerC.columns) || void 0 === _a ? void 0 : _a.length)) {
45451
- const menus = dropDownMenu || _table.globalDropDownMenu;
45851
+ headerL = _table._getHeaderLayoutMap(col, row);
45852
+ let {
45853
+ dropDownMenu: dropDownMenu
45854
+ } = headerL;
45855
+ "function" == typeof dropDownMenu && (dropDownMenu = dropDownMenu({
45856
+ row: row,
45857
+ col: col,
45858
+ table: _table
45859
+ }));
45860
+ let globalDropDownMenu = _table.globalDropDownMenu;
45861
+ "function" == typeof globalDropDownMenu && (globalDropDownMenu = globalDropDownMenu({
45862
+ row: row,
45863
+ col: col,
45864
+ table: _table
45865
+ }));
45866
+ const results = [];
45867
+ if (Array.isArray(dropDownMenu) && dropDownMenu.length || Array.isArray(globalDropDownMenu) && globalDropDownMenu.length && !(null === (_a = null == headerC ? void 0 : headerC.columns) || void 0 === _a ? void 0 : _a.length)) {
45868
+ const menus = dropDownMenu || globalDropDownMenu;
45452
45869
  let highlightIndex = -1,
45453
45870
  subHighlightIndex = -1;
45454
45871
  for (let i = 0; i < menus.length; i++) {
@@ -45467,7 +45884,7 @@
45467
45884
  }
45468
45885
  if (-1 !== highlightIndex) {
45469
45886
  let menu;
45470
- menu = -1 !== subHighlightIndex ? (dropDownMenu || _table.globalDropDownMenu)[highlightIndex].children[subHighlightIndex] : (dropDownMenu || _table.globalDropDownMenu)[highlightIndex], menu.stateIcon && (menu.stateIcon.svg ? results.push({
45887
+ menu = -1 !== subHighlightIndex ? menus[highlightIndex].children[subHighlightIndex] : menus[highlightIndex], menu.stateIcon && (menu.stateIcon.svg ? results.push({
45471
45888
  type: "svg",
45472
45889
  name: menu.stateIcon.src || menu.stateIcon.svg,
45473
45890
  width: menu.stateIcon.width || 22,
@@ -45525,11 +45942,21 @@
45525
45942
  checkDropDownIcon(_table, col, row) {
45526
45943
  var _a;
45527
45944
  if (_table.isPivotTable()) {
45528
- const headerC = _table._getHeaderLayoutMap(col, row);
45529
- if (Array.isArray(headerC.dropDownMenu) && headerC.dropDownMenu.length) return !0;
45945
+ let dropDownMenu = _table._getHeaderLayoutMap(col, row).dropDownMenu;
45946
+ if ("function" == typeof dropDownMenu && (dropDownMenu = dropDownMenu({
45947
+ row: row,
45948
+ col: col,
45949
+ table: _table
45950
+ })), Array.isArray(dropDownMenu) && dropDownMenu.length) return !0;
45530
45951
  } else {
45531
- const headerC = _table.getHeaderDefine(col, row);
45532
- if (Array.isArray(headerC.dropDownMenu) && headerC.dropDownMenu.length || (!Array.isArray(headerC.dropDownMenu) || 0 !== headerC.dropDownMenu.length) && Array.isArray(_table.globalDropDownMenu) && _table.globalDropDownMenu.length && !(null === (_a = null == headerC ? void 0 : headerC.columns) || void 0 === _a ? void 0 : _a.length)) return !0;
45952
+ const headerC = _table.getHeaderDefine(col, row),
45953
+ dropDownMenu = headerC.dropDownMenu;
45954
+ let globalDropDownMenu = _table.globalDropDownMenu;
45955
+ if ("function" == typeof globalDropDownMenu && (globalDropDownMenu = globalDropDownMenu({
45956
+ row: row,
45957
+ col: col,
45958
+ table: _table
45959
+ })), Array.isArray(dropDownMenu) && dropDownMenu.length || (!Array.isArray(headerC.dropDownMenu) || 0 !== headerC.dropDownMenu.length) && Array.isArray(globalDropDownMenu) && globalDropDownMenu.length && !(null === (_a = null == headerC ? void 0 : headerC.columns) || void 0 === _a ? void 0 : _a.length)) return !0;
45533
45960
  }
45534
45961
  return !1;
45535
45962
  }
@@ -46079,7 +46506,7 @@
46079
46506
  right: 0,
46080
46507
  width: 0
46081
46508
  };
46082
- if (isConsider && absoluteX > _this.tableNoFrameWidth - _this.getRightFrozenColsWidth() && absoluteX < _this.tableNoFrameWidth && absoluteX <= _this.getAllColsWidth()) for (let i = 0; i < _this.rightFrozenColCount; i++) if (absoluteX > _this.tableNoFrameWidth - _this.getColsWidth(_this.colCount - i - 1, _this.colCount - 1)) return {
46509
+ if (absoluteX -= _this.tableX, isConsider && absoluteX > _this.tableNoFrameWidth - _this.getRightFrozenColsWidth() && absoluteX < _this.tableNoFrameWidth && absoluteX <= _this.getAllColsWidth()) for (let i = 0; i < _this.rightFrozenColCount; i++) if (absoluteX > _this.tableNoFrameWidth - _this.getColsWidth(_this.colCount - i - 1, _this.colCount - 1)) return {
46083
46510
  col: _this.colCount - i - 1,
46084
46511
  left: void 0,
46085
46512
  right: void 0,
@@ -46131,8 +46558,8 @@
46131
46558
  y > _this.tableNoFrameHeight - _this.getBottomFrozenRowsHeight() && y < _this.tableNoFrameHeight && y <= _this.getAllRowsHeight() && (bottomFrozen = !0);
46132
46559
  let rightFrozen = !1;
46133
46560
  x > _this.tableNoFrameWidth - _this.getRightFrozenColsWidth() && x < _this.tableNoFrameWidth && x <= _this.getAllColsWidth() && (rightFrozen = !0);
46134
- const colInfo = getTargetColAtConsiderRightFrozen(leftFrozen || rightFrozen ? x : x + _this.scrollLeft, rightFrozen, _this),
46135
- rowInfo = getTargetRowAtConsiderBottomFrozen(topFrozen || bottomFrozen ? y : y + _this.scrollTop, bottomFrozen, _this);
46561
+ const colInfo = getTargetColAtConsiderRightFrozen((leftFrozen || rightFrozen ? x : x + _this.scrollLeft) + _this.tableX, rightFrozen, _this),
46562
+ rowInfo = getTargetRowAtConsiderBottomFrozen((topFrozen || bottomFrozen ? y : y + _this.scrollTop) + _this.tableY, bottomFrozen, _this);
46136
46563
  if (colInfo && rowInfo) {
46137
46564
  const {
46138
46565
  row: row,
@@ -46990,8 +47417,8 @@
46990
47417
  }
46991
47418
  constructor(container) {
46992
47419
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
46993
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
46994
- if (super(), this.showFrozenIcon = !0, this.version = "1.17.0-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");
47420
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
47421
+ if (super(), this.showFrozenIcon = !0, this.version = "1.17.0", 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");
46995
47422
  !1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vglobal.isImageAnonymous = !1);
46996
47423
  const {
46997
47424
  frozenColCount = 0,
@@ -47012,6 +47439,7 @@
47012
47439
  rowSeriesNumber: rowSeriesNumber,
47013
47440
  columnResizeMode: columnResizeMode,
47014
47441
  rowResizeMode = "none",
47442
+ resize: resize,
47015
47443
  dragHeaderMode: dragHeaderMode,
47016
47444
  showFrozenIcon: showFrozenIcon,
47017
47445
  allowFrozenColCount: allowFrozenColCount,
@@ -47039,7 +47467,7 @@
47039
47467
  bottom: 0
47040
47468
  }, 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$3(canvasHeight) && isValid$3(canvasWidth) && (this.canvasSizeSeted = !0), this.tableNoFrameWidth = 0, this.tableNoFrameHeight = 0, this.canvasWidth = isNumber$4(canvasWidth) ? canvasWidth : void 0, this.canvasHeight = isNumber$4(canvasHeight) ? canvasHeight : void 0, this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal";
47041
47469
  const internalProps = this.internalProps = {};
47042
- 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$4(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime), internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount, internalProps.frozenRowCount = frozenRowCount, 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 = 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 = {};
47470
+ void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1), this.options.canvas ? ("node" !== Env.mode && (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$4(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime), internalProps.pixelRatio = pixelRatio, internalProps.frozenColCount = frozenColCount, internalProps.frozenRowCount = frozenRowCount, 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 !== (_d = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _d ? _d : columnResizeMode, internalProps.rowResizeMode = null !== (_e = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _e ? _e : 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 = {};
47043
47471
  const that = this;
47044
47472
  if (internalProps.calcWidthContext = {
47045
47473
  _: internalProps,
@@ -47047,7 +47475,7 @@
47047
47475
  var _a;
47048
47476
  return "node" === Env.mode ? that.canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
47049
47477
  }
47050
- }, 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) {
47478
+ }, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (_f = options.theme) && void 0 !== _f ? _f : 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 !== (_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, this.scenegraph = new Scenegraph(this), this.stateManager = new StateManager(this), this.eventManager = new EventManager(this), this.animationManager = new TableAnimationManager(this), options.legends) {
47051
47479
  internalProps.legends = [];
47052
47480
  const createLegend = Factory.getFunction("createLegend");
47053
47481
  if (Array.isArray(options.legends)) {
@@ -47073,7 +47501,7 @@
47073
47501
  }
47074
47502
  if (internalProps.menu = Object.assign({
47075
47503
  renderMode: "html"
47076
- }, 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) {
47504
+ }, options.menu), Array.isArray(null === (_j = options.menu) || void 0 === _j ? void 0 : _j.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_k = options.menu) || void 0 === _k ? void 0 : _k.dropDownMenuHighlight), (Array.isArray(null === (_l = options.menu) || void 0 === _l ? void 0 : _l.defaultHeaderMenuItems) || "function" == typeof (null === (_m = options.menu) || void 0 === _m ? void 0 : _m.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems), "html" === internalProps.menu.renderMode) {
47077
47505
  const MenuHandler = Factory.getComponent("menuHandler");
47078
47506
  internalProps.menuHandler = new MenuHandler(this);
47079
47507
  }
@@ -47081,7 +47509,7 @@
47081
47509
  changedCells: new Map()
47082
47510
  }, internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell);
47083
47511
  const CustomCellStylePlugin = Factory.getComponent("customCellStylePlugin");
47084
- CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_k = options.customCellStyle) && void 0 !== _k ? _k : [], null !== (_l = options.customCellStyleArrangement) && void 0 !== _l ? _l : [])), this._adjustCanvasSizeByOption();
47512
+ CustomCellStylePlugin && (this.customCellStylePlugin = new CustomCellStylePlugin(this, null !== (_o = options.customCellStyle) && void 0 !== _o ? _o : [], null !== (_p = options.customCellStyleArrangement) && void 0 !== _p ? _p : [])), this._adjustCanvasSizeByOption();
47085
47513
  }
47086
47514
  _adjustCanvasSizeByOption() {
47087
47515
  "auto" !== this.options.canvasHeight && "auto" !== this.options.canvasWidth || setTimeout(() => {
@@ -47330,7 +47758,8 @@
47330
47758
  return this.internalProps.pixelRatio;
47331
47759
  }
47332
47760
  setPixelRatio(pixelRatio) {
47333
- if (pixelRatio !== this.internalProps.pixelRatio) {
47761
+ var _a;
47762
+ if (pixelRatio !== (null === (_a = this.internalProps) || void 0 === _a ? void 0 : _a.pixelRatio)) {
47334
47763
  this.internalProps.pixelRatio = pixelRatio;
47335
47764
  const canvasWidth = this.canvasWidth;
47336
47765
  this.internalProps.calcWidthContext = {
@@ -47817,7 +48246,7 @@
47817
48246
  return super.fireListeners(type, event);
47818
48247
  }
47819
48248
  updateOption(options) {
47820
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
48249
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
47821
48250
  this.options = options, this._hasAutoImageColumn = void 0;
47822
48251
  const {
47823
48252
  frozenColCount = 0,
@@ -47831,6 +48260,7 @@
47831
48260
  rowSeriesNumber: rowSeriesNumber,
47832
48261
  columnResizeMode: columnResizeMode,
47833
48262
  rowResizeMode = "none",
48263
+ resize: resize,
47834
48264
  dragHeaderMode: dragHeaderMode,
47835
48265
  showFrozenIcon: showFrozenIcon,
47836
48266
  allowFrozenColCount: allowFrozenColCount,
@@ -47856,9 +48286,9 @@
47856
48286
  } = options;
47857
48287
  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;
47858
48288
  const internalProps = this.internalProps;
47859
- 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 = columnResizeMode, internalProps.rowResizeMode = rowResizeMode, internalProps.dragHeaderMode = null != dragHeaderMode ? dragHeaderMode : "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 !== (_b = options.theme) && void 0 !== _b ? _b : 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 !== (_c = options.allowFrozenColCount) && void 0 !== _c ? _c : 0, internalProps.limitMaxAutoWidth = null !== (_d = options.limitMaxAutoWidth) && void 0 !== _d ? _d : 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 === (_e = internalProps.legends) || void 0 === _e || _e.forEach(legend => {
48289
+ 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 != dragHeaderMode ? dragHeaderMode : "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 !== (_d = options.theme) && void 0 !== _d ? _d : 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 !== (_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, null === (_g = internalProps.legends) || void 0 === _g || _g.forEach(legend => {
47860
48290
  null == legend || legend.release();
47861
- }), null === (_f = internalProps.title) || void 0 === _f || _f.release(), internalProps.title = null, null === (_g = internalProps.emptyTip) || void 0 === _g || _g.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
48291
+ }), null === (_h = internalProps.title) || void 0 === _h || _h.release(), internalProps.title = null, null === (_j = internalProps.emptyTip) || void 0 === _j || _j.release(), internalProps.emptyTip = null, internalProps.layoutMap.release(), this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(), this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
47862
48292
  internalProps.legends = [];
47863
48293
  const createLegend = Factory.getFunction("createLegend");
47864
48294
  if (Array.isArray(options.legends)) {
@@ -47884,11 +48314,11 @@
47884
48314
  }
47885
48315
  if (internalProps.menu = Object.assign({
47886
48316
  renderMode: "html"
47887
- }, options.menu), Array.isArray(null === (_h = options.menu) || void 0 === _h ? void 0 : _h.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_j = options.menu) || void 0 === _j ? void 0 : _j.dropDownMenuHighlight), Array.isArray(null === (_k = options.menu) || void 0 === _k ? void 0 : _k.defaultHeaderMenuItems) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems), "html" === internalProps.menu.renderMode && !internalProps.menuHandler) {
48317
+ }, options.menu), Array.isArray(null === (_k = options.menu) || void 0 === _k ? void 0 : _k.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_l = options.menu) || void 0 === _l ? void 0 : _l.dropDownMenuHighlight), (Array.isArray(null === (_m = options.menu) || void 0 === _m ? void 0 : _m.defaultHeaderMenuItems) || "function" == typeof (null === (_o = options.menu) || void 0 === _o ? void 0 : _o.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems), "html" === internalProps.menu.renderMode && !internalProps.menuHandler) {
47888
48318
  const MenuHandler = Factory.getComponent("menuHandler");
47889
48319
  internalProps.menuHandler = new MenuHandler(this);
47890
48320
  }
47891
- this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(), internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell), null === (_l = this.customCellStylePlugin) || void 0 === _l || _l.updateCustomCell(null !== (_m = options.customCellStyle) && void 0 !== _m ? _m : [], null !== (_o = options.customCellStyleArrangement) && void 0 !== _o ? _o : []), this._adjustCanvasSizeByOption();
48321
+ this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(), internalProps.customMergeCell = getCustomMergeCellFunc(options.customMergeCell), null === (_p = this.customCellStylePlugin) || void 0 === _p || _p.updateCustomCell(null !== (_q = options.customCellStyle) && void 0 !== _q ? _q : [], null !== (_r = options.customCellStyleArrangement) && void 0 !== _r ? _r : []), this._adjustCanvasSizeByOption();
47892
48322
  }
47893
48323
  renderWithRecreateCells() {
47894
48324
  this.internalProps.stick.changedCells.clear();
@@ -51046,32 +51476,37 @@
51046
51476
 
51047
51477
  class EditManager {
51048
51478
  constructor(table) {
51049
- this.isValidatingValue = !1, this.table = table, this.bindEvent();
51479
+ this.isValidatingValue = !1, this.listenersId = [], this.table = table, this.bindEvent();
51050
51480
  }
51051
51481
  bindEvent() {
51052
- this.table.internalProps.handler;
51053
- const editCellTrigger = this.table.options.editCellTrigger;
51054
- this.table.on(TABLE_EVENT_TYPE.DBLCLICK_CELL, e => {
51055
- var _a;
51056
- if (!editCellTrigger || "doubleclick" === editCellTrigger || Array.isArray(editCellTrigger) && editCellTrigger.includes("doubleclick")) {
51482
+ const table = this.table,
51483
+ doubleClickEventId = table.on(TABLE_EVENT_TYPE.DBLCLICK_CELL, e => {
51484
+ var _a;
51485
+ const {
51486
+ editCellTrigger = "doubleclick"
51487
+ } = table.options;
51488
+ if (!editCellTrigger.includes("doubleclick")) return;
51057
51489
  const {
51058
51490
  col: col,
51059
51491
  row: row
51060
51492
  } = e,
51061
51493
  eventArgsSet = getCellEventArgsSet(e.federatedEvent),
51062
- resizeCol = this.table.scenegraph.getResizeColAt(eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, null === (_a = eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.targetCell);
51063
- if (this.table._canResizeColumn(resizeCol.col, resizeCol.row) && resizeCol.col >= 0) return;
51064
- this.startEditCell(col, row);
51065
- }
51066
- }), this.table.on(TABLE_EVENT_TYPE.CLICK_CELL, e => {
51067
- if ("click" === editCellTrigger || Array.isArray(editCellTrigger) && editCellTrigger.includes("click")) {
51494
+ resizeCol = table.scenegraph.getResizeColAt(eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, null === (_a = eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.targetCell);
51495
+ table._canResizeColumn(resizeCol.col, resizeCol.row) && resizeCol.col >= 0 || this.startEditCell(col, row);
51496
+ }),
51497
+ clickEventId = table.on(TABLE_EVENT_TYPE.CLICK_CELL, e => {
51068
51498
  const {
51069
- col: col,
51070
- row: row
51071
- } = e;
51072
- this.startEditCell(col, row);
51073
- }
51074
- });
51499
+ editCellTrigger = "doubleclick"
51500
+ } = table.options;
51501
+ if ("click" === editCellTrigger || Array.isArray(editCellTrigger) && editCellTrigger.includes("click")) {
51502
+ const {
51503
+ col: col,
51504
+ row: row
51505
+ } = e;
51506
+ this.startEditCell(col, row);
51507
+ }
51508
+ });
51509
+ this.listenersId.push(doubleClickEventId, clickEventId);
51075
51510
  }
51076
51511
  startEditCell(col, row, value) {
51077
51512
  var _a, _b, _c, _d, _e;
@@ -51102,9 +51537,9 @@
51102
51537
  },
51103
51538
  referencePosition: referencePosition,
51104
51539
  container: this.table.getElement(),
51105
- table: this.table,
51106
51540
  col: col,
51107
- row: row
51541
+ row: row,
51542
+ table: this.table
51108
51543
  });
51109
51544
  }
51110
51545
  }
@@ -51150,6 +51585,11 @@
51150
51585
  var _a, _b, _c, _d;
51151
51586
  this.editingEditor && (null === (_b = (_a = this.editingEditor).exit) || void 0 === _b || _b.call(_a), null === (_d = (_c = this.editingEditor).onEnd) || void 0 === _d || _d.call(_c), this.editingEditor = null);
51152
51587
  }
51588
+ release() {
51589
+ this.listenersId.forEach(id => {
51590
+ this.table.off(id);
51591
+ });
51592
+ }
51153
51593
  }
51154
51594
  function dealWithValidateValue(validateValue, editManager, oldValue, resolve) {
51155
51595
  return editManager.isValidatingValue = !1, "validate-exit" === validateValue ? (editManager.doExit(), null == resolve || resolve(!0), !0) : "invalidate-exit" === validateValue ? (editManager.editingEditor.setValue(oldValue), editManager.doExit(), null == resolve || resolve(!0), !0) : "validate-not-exit" === validateValue || "invalidate-not-exit" === validateValue ? (null == resolve || resolve(!1), !1) : !0 === validateValue ? (editManager.doExit(), null == resolve || resolve(!0), !0) : (null == resolve || resolve(!1), !1);
@@ -52081,7 +52521,7 @@
52081
52521
  const define = this.getBodyColumnDefine(col, row),
52082
52522
  field = null == define ? void 0 : define.field,
52083
52523
  cellType = this.getCellType(col, row);
52084
- if (isValid$3(field) && "checkbox" === cellType) {
52524
+ if (isValid$3(field) && ("checkbox" === cellType || "switch" === cellType)) {
52085
52525
  const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row)).toString();
52086
52526
  return null === (_a = this.stateManager.checkedState.get(dataIndex)) || void 0 === _a ? void 0 : _a[field];
52087
52527
  }
@@ -52098,6 +52538,15 @@
52098
52538
  setCellRadioState(col, row, index) {
52099
52539
  setCellRadioState(col, row, index, this);
52100
52540
  }
52541
+ getSwitchState(field) {
52542
+ return this.getCheckboxState(field);
52543
+ }
52544
+ getCellSwitchState(col, row) {
52545
+ return this.getCellCheckboxState(col, row);
52546
+ }
52547
+ setCellSwitchState(col, row, checked) {
52548
+ this.setCellCheckboxState(col, row, checked);
52549
+ }
52101
52550
  setRecords(records, option) {
52102
52551
  var _a, _b, _c, _d;
52103
52552
  let sort;
@@ -52266,6 +52715,9 @@
52266
52715
  }
52267
52716
  }
52268
52717
  }
52718
+ release() {
52719
+ this.editorManager.release(), super.release();
52720
+ }
52269
52721
  }
52270
52722
 
52271
52723
  function isXAxis(orient) {
@@ -54505,7 +54957,7 @@
54505
54957
  container: table => new Container(table)
54506
54958
  };
54507
54959
  function getMenuInstanceInfo(table, col, row, type, dropDownMenuOptions) {
54508
- var _a;
54960
+ var _a, _b;
54509
54961
  const {
54510
54962
  lineHeight: lineHeight,
54511
54963
  textBaseline: textBaseline,
@@ -54547,11 +54999,15 @@
54547
54999
  content: dropDownMenuOptions.content
54548
55000
  };
54549
55001
  if ("dropdown-menu" === type) {
54550
- const {
54551
- dropDownMenu = table.globalDropDownMenu,
54552
- pivotInfo: pivotInfo
54553
- } = table._getHeaderLayoutMap(col, row);
54554
- return {
55002
+ let dropDownMenu = table.globalDropDownMenu;
55003
+ const headerData = table._getHeaderLayoutMap(col, row);
55004
+ dropDownMenu = null !== (_b = headerData.dropDownMenu) && void 0 !== _b ? _b : dropDownMenu;
55005
+ const pivotInfo = headerData.pivotInfo;
55006
+ return "function" == typeof dropDownMenu && (dropDownMenu = dropDownMenu({
55007
+ row: row,
55008
+ col: col,
55009
+ table: table
55010
+ })), {
54555
55011
  type: type,
54556
55012
  referencePosition: {
54557
55013
  rect: {
@@ -55336,7 +55792,7 @@
55336
55792
  canvas: null !== (_0 = table.canvas) && void 0 !== _0 ? _0 : table.scenegraph.stage.window.getContext().canvas,
55337
55793
  mode: table.options.mode,
55338
55794
  modeParams: table.options.modeParams,
55339
- spec: chartSpec,
55795
+ spec: table.options.specTransformInCell ? table.options.specTransformInCell(chartSpec, col, row) : chartSpec,
55340
55796
  ClassType: ClassType,
55341
55797
  width: width - padding[3] - padding[1],
55342
55798
  height: height - padding[2] - padding[0],
@@ -55346,7 +55802,9 @@
55346
55802
  cellPadding: padding,
55347
55803
  dpr: table.internalProps.pixelRatio,
55348
55804
  axes: table.isPivotChart() ? table.internalProps.layoutMap.getChartAxes(col, row) : [],
55349
- tableChartOption: table.options.chartOption
55805
+ tableChartOption: table.options.chartOption,
55806
+ col: col,
55807
+ row: row
55350
55808
  });
55351
55809
  cellGroup.appendChild(chartGroup), table.internalProps.layoutMap.setChartInstance(col, row, chartGroup.chartInstance);
55352
55810
  }
@@ -55638,6 +56096,167 @@
55638
56096
  return null !== (_a = null != isDisabled ? isDisabled : globalDisable) && void 0 !== _a && _a;
55639
56097
  }
55640
56098
 
56099
+ function createSwitchCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, colWidth, width, height, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync) {
56100
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
56101
+ if (!cellGroup) {
56102
+ const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table);
56103
+ isAsync && (cellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0)) && "cell" === cellGroup.role && cellGroup.setAttributes({
56104
+ x: xOrigin,
56105
+ y: yOrigin,
56106
+ width: width,
56107
+ height: height,
56108
+ lineWidth: null !== (_b = null === (_a = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _a ? void 0 : _a.lineWidth) && void 0 !== _b ? _b : void 0,
56109
+ fill: null !== (_d = null === (_c = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _c ? void 0 : _c.fill) && void 0 !== _d ? _d : void 0,
56110
+ stroke: null !== (_f = null === (_e = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _e ? void 0 : _e.stroke) && void 0 !== _f ? _f : void 0,
56111
+ strokeArrayWidth: strokeArrayWidth,
56112
+ strokeArrayColor: null !== (_h = null === (_g = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _g ? void 0 : _g.strokeArrayColor) && void 0 !== _h ? _h : void 0,
56113
+ cursor: null !== (_k = null === (_j = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _j ? void 0 : _j.cursor) && void 0 !== _k ? _k : void 0,
56114
+ lineDash: null !== (_m = null === (_l = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _l ? void 0 : _l.lineDash) && void 0 !== _m ? _m : void 0,
56115
+ lineCap: "butt",
56116
+ clip: !0,
56117
+ cornerRadius: cellTheme.group.cornerRadius
56118
+ }), cellGroup && "cell" === cellGroup.role || ((cellGroup = new Group({
56119
+ x: xOrigin,
56120
+ y: yOrigin,
56121
+ width: width,
56122
+ height: height,
56123
+ lineWidth: null !== (_p = null === (_o = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _o ? void 0 : _o.lineWidth) && void 0 !== _p ? _p : void 0,
56124
+ fill: null !== (_r = null === (_q = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _q ? void 0 : _q.fill) && void 0 !== _r ? _r : void 0,
56125
+ stroke: null !== (_t = null === (_s = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _s ? void 0 : _s.stroke) && void 0 !== _t ? _t : void 0,
56126
+ strokeArrayWidth: strokeArrayWidth,
56127
+ strokeArrayColor: null !== (_v = null === (_u = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _u ? void 0 : _u.strokeArrayColor) && void 0 !== _v ? _v : void 0,
56128
+ cursor: null !== (_x = null === (_w = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _w ? void 0 : _w.cursor) && void 0 !== _x ? _x : void 0,
56129
+ lineDash: null !== (_z = null === (_y = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _y ? void 0 : _y.lineDash) && void 0 !== _z ? _z : void 0,
56130
+ lineCap: "butt",
56131
+ clip: !0,
56132
+ cornerRadius: cellTheme.group.cornerRadius
56133
+ })).role = "cell", cellGroup.col = col, cellGroup.row = row, null == columnGroup || columnGroup.addCellGroup(cellGroup));
56134
+ }
56135
+ let icons;
56136
+ if (mayHaveIcon) {
56137
+ let iconCol = col,
56138
+ iconRow = row;
56139
+ range && (iconCol = range.start.col, iconRow = range.start.row), icons = table.getCellIcons(iconCol, iconRow);
56140
+ }
56141
+ let iconWidth = 0,
56142
+ cellLeftIconWidth = 0;
56143
+ if (Array.isArray(icons) && 0 !== icons.length) {
56144
+ const {
56145
+ leftIconWidth: leftIconWidth,
56146
+ rightIconWidth: rightIconWidth,
56147
+ absoluteLeftIconWidth: absoluteLeftIconWidth,
56148
+ absoluteRightIconWidth: absoluteRightIconWidth
56149
+ } = dealWithIconLayout(icons, cellGroup, range, table);
56150
+ iconWidth = leftIconWidth + rightIconWidth, cellLeftIconWidth = leftIconWidth, cellGroup.forEachChildren(child => {
56151
+ "icon-left" === child.role ? child.setAttribute("x", child.attribute.x + padding[3]) : "icon-right" === child.role ? child.setAttribute("x", child.attribute.x + width - rightIconWidth - padding[1]) : "icon-absolute-right" === child.role && child.setAttribute("x", child.attribute.x + width - absoluteRightIconWidth - padding[1]);
56152
+ }), cellGroup.forEachChildren(child => {
56153
+ "middle" === textBaseline ? child.setAttribute("y", (height - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", height - child.AABBBounds.height() - padding[2]) : child.setAttribute("y", padding[0]);
56154
+ });
56155
+ }
56156
+ const switchComponent = createSwitch(col, row, colWidth - iconWidth, width, height, padding, cellTheme, define, table);
56157
+ return switchComponent && cellGroup.appendChild(switchComponent), switchComponent.render(), width -= padding[1] + padding[3] + iconWidth, height -= padding[0] + padding[2], "center" === textAlign ? switchComponent.setAttribute("x", padding[3] + cellLeftIconWidth + (width - switchComponent.AABBBounds.width()) / 2) : "right" === textAlign ? switchComponent.setAttribute("x", padding[3] + cellLeftIconWidth + width - switchComponent.AABBBounds.width()) : switchComponent.setAttribute("x", padding[3] + cellLeftIconWidth), "middle" === textBaseline ? switchComponent.setAttribute("y", padding[0] + (height - switchComponent.AABBBounds.height()) / 2) : "bottom" === textBaseline ? switchComponent.setAttribute("y", padding[0] + height - switchComponent.AABBBounds.height()) : switchComponent.setAttribute("y", padding[0]), cellGroup;
56158
+ }
56159
+ function createSwitch(col, row, colWidth, cellWidth, cellHeight, padding, cellTheme, define, table) {
56160
+ var _a, _b, _c, _d;
56161
+ const style = table._getCellStyle(col, row),
56162
+ spaceBetweenTextAndCircle = getProp("spaceBetweenTextAndCircle", style, col, row, table),
56163
+ circleRadius = getProp("circleRadius", style, col, row, table),
56164
+ boxWidth = getProp("boxWidth", style, col, row, table),
56165
+ boxHeight = getProp("boxHeight", style, col, row, table),
56166
+ checkedFill = getProp("checkedFill", style, col, row, table),
56167
+ uncheckedFill = getProp("uncheckedFill", style, col, row, table),
56168
+ disableCheckedFill = getProp("disableCheckedFill", style, col, row, table),
56169
+ disableUncheckedFill = getProp("disableUncheckedFill", style, col, row, table),
56170
+ circleFill = getProp("circleFill", style, col, row, table),
56171
+ value = table.getCellValue(col, row),
56172
+ dataValue = table.getCellOriginValue(col, row);
56173
+ let isChecked,
56174
+ isDisabled,
56175
+ text = null !== (_a = value) && void 0 !== _a ? _a : "";
56176
+ isObject$7(value) ? (isChecked = value.checked, isDisabled = value.disable, text = null !== (_b = value.text) && void 0 !== _b ? _b : "") : "boolean" == typeof value && (isChecked = value, text = ""), isChecked = table.stateManager.syncCheckedState(col, row, define.field, isChecked);
56177
+ const hierarchyOffset = getHierarchyOffset(col, row, table),
56178
+ cellStyle = table._getCellStyle(col, row),
56179
+ autoWrapText = null !== (_c = cellStyle.autoWrapText) && void 0 !== _c ? _c : table.internalProps.autoWrapText,
56180
+ {
56181
+ lineClamp: lineClamp
56182
+ } = cellStyle,
56183
+ {
56184
+ checked: checked,
56185
+ disable: disable,
56186
+ uncheckedText: uncheckedText,
56187
+ checkedText: checkedText
56188
+ } = define;
56189
+ if (null == isChecked || "function" == typeof isChecked) {
56190
+ const globalChecked = getOrApply(checked, {
56191
+ col: col,
56192
+ row: row,
56193
+ table: table,
56194
+ context: null,
56195
+ value: value,
56196
+ dataValue: dataValue
56197
+ });
56198
+ isChecked = table.stateManager.syncCheckedState(col, row, define.field, globalChecked);
56199
+ }
56200
+ const globalDisable = getOrApply(disable, {
56201
+ col: col,
56202
+ row: row,
56203
+ table: table,
56204
+ context: null,
56205
+ value: value,
56206
+ dataValue: dataValue
56207
+ }),
56208
+ checkedTextString = getOrApply(checkedText, {
56209
+ col: col,
56210
+ row: row,
56211
+ table: table,
56212
+ context: null,
56213
+ value: value,
56214
+ dataValue: dataValue
56215
+ }),
56216
+ uncheckedTextString = getOrApply(uncheckedText, {
56217
+ col: col,
56218
+ row: row,
56219
+ table: table,
56220
+ context: null,
56221
+ value: value,
56222
+ dataValue: dataValue
56223
+ }),
56224
+ autoColWidth = "auto" === colWidth,
56225
+ autoRowHeight = table.isAutoRowHeight(row),
56226
+ attribute = {
56227
+ text: 1 === text.length ? text[0] : text,
56228
+ maxLineWidth: autoColWidth ? 1 / 0 : cellWidth - (padding[1] + padding[3] + hierarchyOffset) - 2 * circleRadius - spaceBetweenTextAndCircle,
56229
+ textAlign: "left",
56230
+ textBaseline: "top",
56231
+ autoWrapText: autoWrapText,
56232
+ lineClamp: lineClamp,
56233
+ wordBreak: "break-word",
56234
+ heightLimit: autoRowHeight ? -1 : cellHeight - Math.floor(padding[0] + padding[2]),
56235
+ pickable: !1,
56236
+ dx: hierarchyOffset,
56237
+ whiteSpace: 1 !== text.length || autoWrapText ? "normal" : "no-wrap",
56238
+ checkedText: checkedTextString,
56239
+ uncheckedText: uncheckedTextString
56240
+ },
56241
+ switchAttributes = {
56242
+ x: 0,
56243
+ y: 0,
56244
+ text: cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute,
56245
+ circle: {
56246
+ radius: circleRadius
56247
+ },
56248
+ box: {
56249
+ width: boxWidth,
56250
+ height: boxHeight
56251
+ },
56252
+ spaceBetweenTextAndCircle: spaceBetweenTextAndCircle,
56253
+ disabled: null !== (_d = null != isDisabled ? isDisabled : globalDisable) && void 0 !== _d && _d
56254
+ };
56255
+ switchAttributes.checked = isChecked, uncheckedFill && (switchAttributes.box.uncheckedFill = uncheckedFill), disableUncheckedFill && (switchAttributes.box.disableUncheckedFill = disableUncheckedFill), checkedFill && (switchAttributes.box.checkedFill = checkedFill), disableCheckedFill && (switchAttributes.box.disableCheckedFill = disableCheckedFill), circleFill && (switchAttributes.circle.fill = circleFill);
56256
+ const switchComponent = new Switch(switchAttributes);
56257
+ return switchComponent.name = "switch", switchComponent;
56258
+ }
56259
+
55641
56260
  const xScale = new PointScale(),
55642
56261
  yScale = new LinearScale();
55643
56262
  function createSparkLineCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, width, height, padding, table, cellTheme, isAsync) {
@@ -56476,6 +57095,159 @@
56476
57095
  scale.niceMax(target.targetTicks.length);
56477
57096
  }
56478
57097
 
57098
+ function createButtonCellGroup(cellGroup, columnGroup, xOrigin, yOrigin, col, row, colWidth, width, height, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, define, range, isAsync) {
57099
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
57100
+ if (!cellGroup) {
57101
+ const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table);
57102
+ isAsync && (cellGroup = table.scenegraph.highPerformanceGetCell(col, row, !0)) && "cell" === cellGroup.role && cellGroup.setAttributes({
57103
+ x: xOrigin,
57104
+ y: yOrigin,
57105
+ width: width,
57106
+ height: height,
57107
+ lineWidth: null !== (_b = null === (_a = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _a ? void 0 : _a.lineWidth) && void 0 !== _b ? _b : void 0,
57108
+ fill: null !== (_d = null === (_c = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _c ? void 0 : _c.fill) && void 0 !== _d ? _d : void 0,
57109
+ stroke: null !== (_f = null === (_e = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _e ? void 0 : _e.stroke) && void 0 !== _f ? _f : void 0,
57110
+ strokeArrayWidth: strokeArrayWidth,
57111
+ strokeArrayColor: null !== (_h = null === (_g = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _g ? void 0 : _g.strokeArrayColor) && void 0 !== _h ? _h : void 0,
57112
+ cursor: null !== (_k = null === (_j = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _j ? void 0 : _j.cursor) && void 0 !== _k ? _k : void 0,
57113
+ lineDash: null !== (_m = null === (_l = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _l ? void 0 : _l.lineDash) && void 0 !== _m ? _m : void 0,
57114
+ lineCap: "butt",
57115
+ clip: !0,
57116
+ cornerRadius: cellTheme.group.cornerRadius
57117
+ }), cellGroup && "cell" === cellGroup.role || ((cellGroup = new Group({
57118
+ x: xOrigin,
57119
+ y: yOrigin,
57120
+ width: width,
57121
+ height: height,
57122
+ lineWidth: null !== (_p = null === (_o = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _o ? void 0 : _o.lineWidth) && void 0 !== _p ? _p : void 0,
57123
+ fill: null !== (_r = null === (_q = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _q ? void 0 : _q.fill) && void 0 !== _r ? _r : void 0,
57124
+ stroke: null !== (_t = null === (_s = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _s ? void 0 : _s.stroke) && void 0 !== _t ? _t : void 0,
57125
+ strokeArrayWidth: strokeArrayWidth,
57126
+ strokeArrayColor: null !== (_v = null === (_u = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _u ? void 0 : _u.strokeArrayColor) && void 0 !== _v ? _v : void 0,
57127
+ cursor: null !== (_x = null === (_w = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _w ? void 0 : _w.cursor) && void 0 !== _x ? _x : void 0,
57128
+ lineDash: null !== (_z = null === (_y = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _y ? void 0 : _y.lineDash) && void 0 !== _z ? _z : void 0,
57129
+ lineCap: "butt",
57130
+ clip: !0,
57131
+ cornerRadius: cellTheme.group.cornerRadius
57132
+ })).role = "cell", cellGroup.col = col, cellGroup.row = row, null == columnGroup || columnGroup.addCellGroup(cellGroup));
57133
+ }
57134
+ let icons;
57135
+ if (mayHaveIcon) {
57136
+ let iconCol = col,
57137
+ iconRow = row;
57138
+ range && (iconCol = range.start.col, iconRow = range.start.row), icons = table.getCellIcons(iconCol, iconRow);
57139
+ }
57140
+ let iconWidth = 0,
57141
+ cellLeftIconWidth = 0;
57142
+ if (Array.isArray(icons) && 0 !== icons.length) {
57143
+ const {
57144
+ leftIconWidth: leftIconWidth,
57145
+ rightIconWidth: rightIconWidth,
57146
+ absoluteLeftIconWidth: absoluteLeftIconWidth,
57147
+ absoluteRightIconWidth: absoluteRightIconWidth
57148
+ } = dealWithIconLayout(icons, cellGroup, range, table);
57149
+ iconWidth = leftIconWidth + rightIconWidth, cellLeftIconWidth = leftIconWidth, cellGroup.forEachChildren(child => {
57150
+ "icon-left" === child.role ? child.setAttribute("x", child.attribute.x + padding[3]) : "icon-right" === child.role ? child.setAttribute("x", child.attribute.x + width - rightIconWidth - padding[1]) : "icon-absolute-right" === child.role && child.setAttribute("x", child.attribute.x + width - absoluteRightIconWidth - padding[1]);
57151
+ }), cellGroup.forEachChildren(child => {
57152
+ "middle" === textBaseline ? child.setAttribute("y", (height - child.AABBBounds.height()) / 2) : "bottom" === textBaseline ? child.setAttribute("y", height - child.AABBBounds.height() - padding[2]) : child.setAttribute("y", padding[0]);
57153
+ });
57154
+ }
57155
+ const buttonComponent = createButton(col, row, colWidth - iconWidth, width, height, padding, cellTheme, define, table);
57156
+ return buttonComponent && cellGroup.appendChild(buttonComponent), width -= padding[1] + padding[3] + iconWidth, height -= padding[0] + padding[2], "center" === textAlign ? buttonComponent.setAttribute("x", padding[3] + cellLeftIconWidth + (width - buttonComponent.AABBBounds.width()) / 2) : "right" === textAlign ? buttonComponent.setAttribute("x", padding[3] + cellLeftIconWidth + width - buttonComponent.AABBBounds.width()) : buttonComponent.setAttribute("x", padding[3] + cellLeftIconWidth), "middle" === textBaseline ? buttonComponent.setAttribute("y", padding[0] + (height - buttonComponent.AABBBounds.height()) / 2) : "bottom" === textBaseline ? buttonComponent.setAttribute("y", padding[0] + height - buttonComponent.AABBBounds.height()) : buttonComponent.setAttribute("y", padding[0]), cellGroup;
57157
+ }
57158
+ function createButton(col, row, colWidth, cellWidth, cellHeight, padding, cellTheme, define, table) {
57159
+ var _a, _b;
57160
+ const style = table._getCellStyle(col, row),
57161
+ buttonColor = getProp("buttonColor", style, col, row, table),
57162
+ buttonBorderColor = getProp("buttonBorderColor", style, col, row, table),
57163
+ buttonLineWidth = getProp("buttonLineWidth", style, col, row, table),
57164
+ buttonBorderRadius = getProp("buttonBorderRadius", style, col, row, table),
57165
+ buttonHoverColor = getProp("buttonHoverColor", style, col, row, table),
57166
+ buttonHoverBorderColor = getProp("buttonHoverBorderColor", style, col, row, table),
57167
+ buttonPadding = getProp("buttonPadding", style, col, row, table),
57168
+ buttonTextHoverColor = getProp("buttonTextHoverColor", style, col, row, table),
57169
+ buttonDisableColor = getProp("buttonDisableColor", style, col, row, table),
57170
+ buttonDisableBorderColor = getProp("buttonDisableBorderColor", style, col, row, table),
57171
+ buttonTextDisableColor = getProp("buttonTextDisableColor", style, col, row, table),
57172
+ value = table.getCellValue(col, row),
57173
+ dataValue = table.getCellOriginValue(col, row),
57174
+ hierarchyOffset = getHierarchyOffset(col, row, table),
57175
+ cellStyle = table._getCellStyle(col, row),
57176
+ autoWrapText = null !== (_a = cellStyle.autoWrapText) && void 0 !== _a ? _a : table.internalProps.autoWrapText,
57177
+ {
57178
+ lineClamp: lineClamp
57179
+ } = cellStyle,
57180
+ autoColWidth = "auto" === colWidth,
57181
+ autoRowHeight = table.isAutoRowHeight(row),
57182
+ {
57183
+ disable: disable,
57184
+ text: text
57185
+ } = define,
57186
+ isDisable = getOrApply(disable, {
57187
+ col: col,
57188
+ row: row,
57189
+ table: table,
57190
+ context: null,
57191
+ value: value,
57192
+ dataValue: dataValue
57193
+ }),
57194
+ buttonTextValue = getOrApply(text, {
57195
+ col: col,
57196
+ row: row,
57197
+ table: table,
57198
+ context: null,
57199
+ value: value,
57200
+ dataValue: dataValue
57201
+ }),
57202
+ buttonText = null !== (_b = null != buttonTextValue ? buttonTextValue : value) && void 0 !== _b ? _b : "",
57203
+ attribute = {
57204
+ maxLineWidth: autoColWidth ? 1 / 0 : cellWidth - (padding[1] + padding[3] + hierarchyOffset),
57205
+ textAlign: "left",
57206
+ textBaseline: "top",
57207
+ autoWrapText: autoWrapText,
57208
+ lineClamp: lineClamp,
57209
+ wordBreak: "break-word",
57210
+ heightLimit: autoRowHeight ? -1 : cellHeight - Math.floor(padding[0] + padding[2]),
57211
+ pickable: !1,
57212
+ dx: hierarchyOffset,
57213
+ whiteSpace: 1 !== buttonText.length || autoWrapText ? "normal" : "no-wrap"
57214
+ },
57215
+ testAttribute = cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute,
57216
+ buttonAttributes = {
57217
+ x: 0,
57218
+ y: 0,
57219
+ cursor: isDisable ? "not-allowed" : "pointer",
57220
+ disable: isDisable,
57221
+ childrenPickable: !1,
57222
+ text: 1 === buttonText.length ? buttonText[0] : buttonText,
57223
+ textStyle: testAttribute,
57224
+ padding: buttonPadding,
57225
+ panel: {
57226
+ visible: !0,
57227
+ fill: isDisable ? buttonDisableColor : buttonColor,
57228
+ stroke: isDisable ? buttonDisableBorderColor : buttonBorderColor,
57229
+ lineWidth: buttonLineWidth,
57230
+ cornerRadius: buttonBorderRadius
57231
+ },
57232
+ state: {
57233
+ text: {},
57234
+ panel: {
57235
+ hover: {
57236
+ fill: buttonHoverColor,
57237
+ stroke: buttonHoverBorderColor
57238
+ }
57239
+ }
57240
+ }
57241
+ };
57242
+ buttonTextDisableColor && (buttonAttributes.state.text.fill = buttonTextDisableColor), buttonTextHoverColor && (buttonAttributes.state.text.hover.fill = buttonTextHoverColor);
57243
+ const buttonComponent = new Tag(buttonAttributes);
57244
+ return buttonComponent.name = "button", isDisable || (buttonComponent.addEventListener("mouseenter", () => {
57245
+ buttonComponent.addState("hover", !0, !1), buttonComponent.stage.renderNextFrame();
57246
+ }), buttonComponent.addEventListener("mouseleave", () => {
57247
+ buttonComponent.removeState("hover", !1), buttonComponent.stage.renderNextFrame();
57248
+ })), buttonComponent;
57249
+ }
57250
+
56479
57251
  const registerChartCell = () => {
56480
57252
  Factory.registerFunction("createChartCellGroup", createChartCellGroup), Factory.registerFunction("getAxisDomainRangeAndLabels", getAxisDomainRangeAndLabels);
56481
57253
  };
@@ -56491,6 +57263,12 @@
56491
57263
  const registerRadioCell = () => {
56492
57264
  Factory.registerFunction("createRadioCellGroup", createRadioCellGroup);
56493
57265
  };
57266
+ const registerSwitchCell = () => {
57267
+ Factory.registerFunction("createSwitchCellGroup", createSwitchCellGroup);
57268
+ };
57269
+ const registerButtonCell = () => {
57270
+ Factory.registerFunction("createButtonCellGroup", createButtonCellGroup);
57271
+ };
56494
57272
  const registerSparkLineCell = () => {
56495
57273
  Factory.registerFunction("createSparkLineCellGroup", createSparkLineCellGroup);
56496
57274
  };
@@ -56501,7 +57279,7 @@
56501
57279
  Factory.registerFunction("createVideoCellGroup", createVideoCellGroup);
56502
57280
  };
56503
57281
 
56504
- registerAxis(), registerEmptyTip(), registerLegend(), registerMenu(), registerTitle(), registerTooltip(), registerListTreeStickCellPlugin(), registerCustomCellStylePlugin(), registerChartCell(), registerCheckboxCell(), registerImageCell(), registerProgressBarCell(), registerRadioCell(), registerSparkLineCell(), registerTextCell(), registerVideoCell();
57282
+ registerAxis(), registerEmptyTip(), registerLegend(), registerMenu(), registerTitle(), registerTooltip(), registerListTreeStickCellPlugin(), registerCustomCellStylePlugin(), registerChartCell(), registerCheckboxCell(), registerImageCell(), registerProgressBarCell(), registerRadioCell(), registerSwitchCell(), registerButtonCell(), registerSparkLineCell(), registerTextCell(), registerVideoCell();
56505
57283
  class ListTableAll extends ListTable {}
56506
57284
 
56507
57285
  registerForVrender();