@visactor/vrender-components 0.16.8 → 0.16.9-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -26303,7 +26303,9 @@
26303
26303
  }
26304
26304
  ((_c = selectedBackgroundChartStyle === null || selectedBackgroundChartStyle === void 0 ? void 0 : selectedBackgroundChartStyle.line) === null || _c === void 0 ? void 0 : _c.visible) && this.setSelectedPreviewAttributes('line', group);
26305
26305
  ((_d = selectedBackgroundChartStyle === null || selectedBackgroundChartStyle === void 0 ? void 0 : selectedBackgroundChartStyle.area) === null || _d === void 0 ? void 0 : _d.visible) && this.setSelectedPreviewAttributes('area', group);
26306
- this.renderText();
26306
+ if (this._showText) {
26307
+ this.renderText();
26308
+ }
26307
26309
  if (this._isHorizontal) {
26308
26310
  this._startHandler = group.createOrUpdateChild('startHandler', Object.assign({ x: position.x + start * width, y: position.y + height / 2, size: height, angle: 0, symbolType: (_e = startHandlerStyle === null || startHandlerStyle === void 0 ? void 0 : startHandlerStyle.symbolType) !== null && _e !== void 0 ? _e : 'square', cursor: 'ew-resize', strokeBoundsBuffer: 0, boundsPadding: 2, pickMode: 'imprecise' }, startHandlerStyle), 'symbol');
26309
26311
  this._endHandler = group.createOrUpdateChild('endHandler', Object.assign({ x: position.x + end * width, y: position.y + height / 2, size: height, angle: 0, symbolType: (_f = endHandlerStyle === null || endHandlerStyle === void 0 ? void 0 : endHandlerStyle.symbolType) !== null && _f !== void 0 ? _f : 'square', cursor: 'ew-resize', strokeBoundsBuffer: 0, boundsPadding: 2, pickMode: 'imprecise' }, endHandlerStyle), 'symbol');
@@ -31044,7 +31046,8 @@
31044
31046
  return new Tag(params ? params.attribute : {});
31045
31047
  }
31046
31048
 
31047
- const svg = '<svg width="200" height="200" viewBox="0 0 1024 1024" fill="#fff" xmlns="http://www.w3.org/2000/svg"><path d="M877.44815445 206.10060629a64.72691371 64.72691371 0 0 0-95.14856334 4.01306852L380.73381888 685.46812814 235.22771741 533.48933518a64.72691371 64.72691371 0 0 0-92.43003222-1.03563036l-45.82665557 45.82665443a64.72691371 64.72691371 0 0 0-0.90617629 90.61767965l239.61903446 250.10479331a64.72691371 64.72691371 0 0 0 71.19960405 15.14609778 64.33855261 64.33855261 0 0 0 35.08198741-21.23042702l36.24707186-42.71976334 40.5190474-40.77795556-3.36579926-3.49525333 411.40426297-486.74638962a64.72691371 64.72691371 0 0 0-3.88361443-87.64024149l-45.3088404-45.43829334z"></path></svg>';
31049
+ const checkSvg = '<svg width="200" height="200" viewBox="0 0 1024 1024" fill="#fff" xmlns="http://www.w3.org/2000/svg"><path d="M877.44815445 206.10060629a64.72691371 64.72691371 0 0 0-95.14856334 4.01306852L380.73381888 685.46812814 235.22771741 533.48933518a64.72691371 64.72691371 0 0 0-92.43003222-1.03563036l-45.82665557 45.82665443a64.72691371 64.72691371 0 0 0-0.90617629 90.61767965l239.61903446 250.10479331a64.72691371 64.72691371 0 0 0 71.19960405 15.14609778 64.33855261 64.33855261 0 0 0 35.08198741-21.23042702l36.24707186-42.71976334 40.5190474-40.77795556-3.36579926-3.49525333 411.40426297-486.74638962a64.72691371 64.72691371 0 0 0-3.88361443-87.64024149l-45.3088404-45.43829334z"></path></svg>';
31050
+ const indeterminateSvg = '<svg width="200" height="200" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="none"><path stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="5" d="M5 12h14"/></svg>';
31048
31051
  class CheckBox extends AbstractComponent {
31049
31052
  constructor(attributes) {
31050
31053
  super(vutils.merge({}, CheckBox.defaultAttributes, attributes));
@@ -31069,13 +31072,14 @@
31069
31072
  }
31070
31073
  renderBox() {
31071
31074
  this._box = new Rect(vutils.merge({}, this.attribute.box));
31072
- if (this.attribute.checked && this.attribute.disabled) {
31075
+ const isCheckedOrIndeterminate = this.attribute.checked || this.attribute.indeterminate;
31076
+ if (isCheckedOrIndeterminate && this.attribute.disabled) {
31073
31077
  this._box.setAttributes({
31074
31078
  fill: this.attribute.box.disableCheckedFill,
31075
31079
  stroke: this.attribute.box.disableCheckedStroke
31076
31080
  });
31077
31081
  }
31078
- else if (this.attribute.checked) {
31082
+ else if (isCheckedOrIndeterminate) {
31079
31083
  this._box.setAttributes({
31080
31084
  fill: this.attribute.box.checkedFill,
31081
31085
  stroke: this.attribute.box.checkedStroke
@@ -31084,11 +31088,24 @@
31084
31088
  this.appendChild(this._box);
31085
31089
  }
31086
31090
  renderIcon() {
31087
- this._icon = new Image(vutils.merge({}, this.attribute.icon));
31088
- if (!this.attribute.checked) {
31089
- this._icon.setAttribute('visible', false);
31091
+ this._checkIcon = new Image(vutils.merge({ image: this.attribute.icon.checkIconImage }, this.attribute.icon));
31092
+ this.appendChild(this._checkIcon);
31093
+ this._indeterminateIcon = new Image(vutils.merge({
31094
+ image: this.attribute.icon.indeterminateIconImage
31095
+ }, this.attribute.icon));
31096
+ this.appendChild(this._indeterminateIcon);
31097
+ if (this.attribute.checked) {
31098
+ this._checkIcon.setAttribute('visible', true);
31099
+ this._indeterminateIcon.setAttribute('visible', false);
31100
+ }
31101
+ else if (this.attribute.indeterminate) {
31102
+ this._checkIcon.setAttribute('visible', false);
31103
+ this._indeterminateIcon.setAttribute('visible', true);
31104
+ }
31105
+ else {
31106
+ this._checkIcon.setAttribute('visible', false);
31107
+ this._indeterminateIcon.setAttribute('visible', false);
31090
31108
  }
31091
- this.appendChild(this._icon);
31092
31109
  }
31093
31110
  renderText() {
31094
31111
  this._text = new WrapText(vutils.merge({}, this.attribute.text));
@@ -31123,7 +31140,11 @@
31123
31140
  x: boxX,
31124
31141
  y: boxY
31125
31142
  });
31126
- this._icon.setAttributes({
31143
+ this._checkIcon.setAttributes({
31144
+ x: iconX,
31145
+ y: iconY
31146
+ });
31147
+ this._indeterminateIcon.setAttributes({
31127
31148
  x: iconX,
31128
31149
  y: iconY
31129
31150
  });
@@ -31139,9 +31160,11 @@
31139
31160
  }
31140
31161
  else if (this.attribute.checked) {
31141
31162
  this.setAttribute('checked', false);
31163
+ this.setAttribute('indeterminate', false);
31142
31164
  }
31143
31165
  else {
31144
31166
  this.setAttribute('checked', true);
31167
+ this.setAttribute('indeterminate', false);
31145
31168
  }
31146
31169
  const changeEvent = new CustomEvent('checkbox_state_change', {
31147
31170
  eventType: 'checkbox_state_change',
@@ -31155,6 +31178,7 @@
31155
31178
  interactive: true,
31156
31179
  disabled: false,
31157
31180
  checked: false,
31181
+ indeterminate: false,
31158
31182
  cursor: 'pointer',
31159
31183
  disableCursor: 'not-allowed',
31160
31184
  spaceBetweenTextAndIcon: 8,
@@ -31167,7 +31191,8 @@
31167
31191
  pickable: false
31168
31192
  },
31169
31193
  icon: {
31170
- image: svg,
31194
+ checkIconImage: checkSvg,
31195
+ indeterminateIconImage: indeterminateSvg,
31171
31196
  width: 10,
31172
31197
  height: 10,
31173
31198
  pickable: false
@@ -31187,7 +31212,7 @@
31187
31212
  }
31188
31213
  };
31189
31214
 
31190
- const version = "0.16.8";
31215
+ const version = "0.16.9-alpha.1";
31191
31216
 
31192
31217
  exports.AbstractComponent = AbstractComponent;
31193
31218
  exports.ArcInfo = ArcInfo;