@visactor/vrender-components 0.19.25-alpha.1 → 0.19.25-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/cjs/checkbox/checkbox.js +1 -1
  2. package/cjs/checkbox/checkbox.js.map +1 -1
  3. package/cjs/data-zoom/config.js +2 -1
  4. package/cjs/empty-tip/empty-tip.js +1 -2
  5. package/cjs/index.d.ts +1 -1
  6. package/cjs/index.js +1 -1
  7. package/cjs/index.js.map +1 -1
  8. package/cjs/label/arc.js +2 -1
  9. package/cjs/label/area.js +1 -1
  10. package/cjs/label/base.js +1 -1
  11. package/cjs/label/dataLabel.js +1 -1
  12. package/cjs/label/index.js +1 -1
  13. package/cjs/label/line-data.js +1 -1
  14. package/cjs/label/line.js +1 -1
  15. package/cjs/label/polygon.js +1 -1
  16. package/cjs/legend/base.js +1 -2
  17. package/cjs/legend/constant.js +1 -1
  18. package/cjs/legend/index.js +1 -1
  19. package/cjs/legend/register.js +1 -1
  20. package/cjs/legend/type.js +1 -1
  21. package/cjs/legend/util.js +1 -1
  22. package/cjs/link-path/index.js +1 -1
  23. package/cjs/link-path/link-path.js +1 -1
  24. package/cjs/radio/radio.js +1 -1
  25. package/cjs/radio/radio.js.map +1 -1
  26. package/dist/index.es.js +3 -1
  27. package/es/checkbox/checkbox.js +1 -1
  28. package/es/checkbox/checkbox.js.map +1 -1
  29. package/es/data-zoom/config.js +2 -1
  30. package/es/empty-tip/empty-tip.js +1 -2
  31. package/es/index.d.ts +1 -1
  32. package/es/index.js +1 -1
  33. package/es/index.js.map +1 -1
  34. package/es/label/arc.js +2 -1
  35. package/es/label/area.js +1 -1
  36. package/es/label/base.js +1 -1
  37. package/es/label/dataLabel.js +1 -1
  38. package/es/label/index.js +1 -1
  39. package/es/label/line-data.js +1 -1
  40. package/es/label/line.js +1 -1
  41. package/es/label/polygon.js +1 -1
  42. package/es/legend/base.js +1 -2
  43. package/es/legend/constant.js +1 -1
  44. package/es/legend/index.js +1 -1
  45. package/es/legend/register.js +1 -1
  46. package/es/legend/type.js +1 -1
  47. package/es/legend/util.js +1 -1
  48. package/es/link-path/index.js +1 -1
  49. package/es/link-path/link-path.js +1 -1
  50. package/es/radio/radio.js +1 -1
  51. package/es/radio/radio.js.map +1 -1
  52. package/package.json +5 -5
@@ -75,7 +75,7 @@ class CheckBox extends base_1.AbstractComponent {
75
75
  }
76
76
  initAttributes(params, options) {
77
77
  params = (null == options ? void 0 : options.skipDefault) ? params : (0, vutils_1.merge)({}, CheckBox.defaultAttributes, params),
78
- super.initAttributes(params), this.render();
78
+ super.initAttributes(params), this.renderGroup(), this.render();
79
79
  }
80
80
  }
81
81
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/checkbox/checkbox.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,uCAAiD;AAEjD,yDAA2D;AAE3D,yCAAmD;AAEnD,MAAM,QAAQ,GACZ,wrBAAwrB,CAAC;AAE3rB,MAAM,gBAAgB,GACpB,2MAA2M,CAAC;AAE9M,IAAA,gCAAqB,GAAE,CAAC;AACxB,MAAa,QAAS,SAAQ,wBAA+C;IA6C3E,YAAY,UAA8B,EAAE,OAA0B;QACpE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAsHvF,qBAAgB,GAAG,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;gBAC3B,OAAO;aACR;iBAAM,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;gBACjC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;gBACpC,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;a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AAW,EAAE,kBAAkB;QAC/B,aAAa,EAAE,kBAAkB;QACjC,kBAAkB,EAAE,oBAAoB;QACxC,oBAAoB,EAAE,oBAAoB;QAC1C,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","file":"checkbox.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { CheckboxAttributes } from './type';\nimport { Image, Rect, Text } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadCheckBoxComponent } from './register';\n\nconst checkSvg =\n '<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>';\n\nconst indeterminateSvg =\n '<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>';\n\nloadCheckBoxComponent();\nexport class CheckBox extends AbstractComponent<Required<CheckboxAttributes>> {\n static defaultAttributes: Partial<CheckboxAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n indeterminate: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n icon: {\n checkIconImage: checkSvg,\n indeterminateIconImage: indeterminateSvg,\n width: 10,\n height: 10,\n pickable: false\n },\n box: {\n width: 14,\n height: 14,\n cornerRadius: 2,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _box: Rect;\n _checkIcon: Image;\n _indeterminateIcon: Image;\n _text: Text;\n\n name: 'checkbox';\n\n constructor(attributes: CheckboxAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CheckBox.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderBox();\n this.renderIcon();\n this.renderText();\n this.layout();\n }\n\n renderBox() {\n this._box = new Rect(merge({}, this.attribute.box));\n const isCheckedOrIndeterminate = this.attribute.checked || this.attribute.indeterminate;\n if (isCheckedOrIndeterminate && this.attribute.disabled) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill,\n stroke: this.attribute.box.disableCheckedStroke\n });\n } else if (isCheckedOrIndeterminate) {\n this._box.setAttributes({\n fill: this.attribute.box.checkedFill,\n stroke: this.attribute.box.checkedStroke\n });\n }\n this.appendChild(this._box);\n }\n\n renderIcon() {\n this._checkIcon = new Image(merge({ image: this.attribute.icon.checkIconImage }, this.attribute.icon));\n this.appendChild(this._checkIcon);\n this._indeterminateIcon = new Image(\n merge(\n {\n image: this.attribute.icon.indeterminateIconImage\n },\n this.attribute.icon\n )\n );\n this.appendChild(this._indeterminateIcon);\n\n if (this.attribute.checked) {\n this._checkIcon.setAttribute('visible', true);\n this._indeterminateIcon.setAttribute('visible', false);\n } else if (this.attribute.indeterminate) {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', true);\n } else {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', false);\n }\n }\n\n renderText() {\n this._text = new Text(merge({ wrap: true }, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const boxHeight = this.attribute.box.height;\n const iconHeight = this.attribute.icon.height;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(boxHeight, iconHeight, textHeight);\n const boxY = maxHeight / 2 - boxHeight / 2;\n const iconY = maxHeight / 2 - iconHeight / 2;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const boxWidth = this.attribute.box.width;\n const iconWidth = this.attribute.icon.width;\n const maxWidth = Math.max(boxWidth, iconWidth);\n const boxX = maxWidth / 2 - boxWidth / 2;\n const iconX = maxWidth / 2 - iconWidth / 2;\n const textX = maxWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._box.setAttributes({\n x: boxX,\n y: boxY\n });\n this._checkIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._indeterminateIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n this.setAttribute('indeterminate', false);\n } else {\n this.setAttribute('checked', true);\n this.setAttribute('indeterminate', false);\n }\n\n this._dispatchEvent('checkbox_state_change', {\n eventType: 'checkbox_state_change',\n checked: this.attribute.checked\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: CheckboxAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, CheckBox.defaultAttributes, params);\n super.initAttributes(params);\n this.render();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/checkbox/checkbox.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,uCAAiD;AAEjD,yDAA2D;AAE3D,yCAAmD;AAEnD,MAAM,QAAQ,GACZ,wrBAAwrB,CAAC;AAE3rB,MAAM,gBAAgB,GACpB,2MAA2M,CAAC;AAE9M,IAAA,gCAAqB,GAAE,CAAC;AACxB,MAAa,QAAS,SAAQ,wBAA+C;IA6C3E,YAAY,UAA8B,EAAE,OAA0B;QACpE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAsHvF,qBAAgB,GAAG,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;gBAC3B,OAAO;aACR;iBAAM,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;gBACjC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;gBACpC,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;aAC3C;iBAAM;gBACL,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;gBACnC,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;aAC3C;YAED,IAAI,CAAC,cAAc,CAAC,uBAAuB,EAAE;gBAC3C,SAAS,EAAE,uBAAuB;gBAClC,OAAO,EAAE,IAAI,CAAC,SAAS,CAA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GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QACvF,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;;AA5LH,4BA6LC;AA5LQ,0BAAiB,GAAgC;IACtD,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,aAAa,EAAE,KAAK;IACpB,MAAM,EAAE,SAAS;IACjB,aAAa,EAAE,aAAa;IAC5B,uBAAuB,EAAE,CAAC;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,kBAAkB;QAC/B,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,IAAI,EAAE;QACJ,cAAc,EAAE,QAAQ;QACxB,sBAAsB,EAAE,gBAAgB;QACxC,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,KAAK;KAChB;IACD,GAAG,EAAE;QACH,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,aAAa,EAAE,kBAAkB;QACjC,kBAAkB,EAAE,oBAAoB;QACxC,oBAAoB,EAAE,oBAAoB;QAC1C,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","file":"checkbox.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { CheckboxAttributes } from './type';\nimport { Image, Rect, Text } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadCheckBoxComponent } from './register';\n\nconst checkSvg =\n '<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>';\n\nconst indeterminateSvg =\n '<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>';\n\nloadCheckBoxComponent();\nexport class CheckBox extends AbstractComponent<Required<CheckboxAttributes>> {\n static defaultAttributes: Partial<CheckboxAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n indeterminate: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n icon: {\n checkIconImage: checkSvg,\n indeterminateIconImage: indeterminateSvg,\n width: 10,\n height: 10,\n pickable: false\n },\n box: {\n width: 14,\n height: 14,\n cornerRadius: 2,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _box: Rect;\n _checkIcon: Image;\n _indeterminateIcon: Image;\n _text: Text;\n\n name: 'checkbox';\n\n constructor(attributes: CheckboxAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CheckBox.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderBox();\n this.renderIcon();\n this.renderText();\n this.layout();\n }\n\n renderBox() {\n this._box = new Rect(merge({}, this.attribute.box));\n const isCheckedOrIndeterminate = this.attribute.checked || this.attribute.indeterminate;\n if (isCheckedOrIndeterminate && this.attribute.disabled) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill,\n stroke: this.attribute.box.disableCheckedStroke\n });\n } else if (isCheckedOrIndeterminate) {\n this._box.setAttributes({\n fill: this.attribute.box.checkedFill,\n stroke: this.attribute.box.checkedStroke\n });\n }\n this.appendChild(this._box);\n }\n\n renderIcon() {\n this._checkIcon = new Image(merge({ image: this.attribute.icon.checkIconImage }, this.attribute.icon));\n this.appendChild(this._checkIcon);\n this._indeterminateIcon = new Image(\n merge(\n {\n image: this.attribute.icon.indeterminateIconImage\n },\n this.attribute.icon\n )\n );\n this.appendChild(this._indeterminateIcon);\n\n if (this.attribute.checked) {\n this._checkIcon.setAttribute('visible', true);\n this._indeterminateIcon.setAttribute('visible', false);\n } else if (this.attribute.indeterminate) {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', true);\n } else {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', false);\n }\n }\n\n renderText() {\n this._text = new Text(merge({ wrap: true }, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const boxHeight = this.attribute.box.height;\n const iconHeight = this.attribute.icon.height;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(boxHeight, iconHeight, textHeight);\n const boxY = maxHeight / 2 - boxHeight / 2;\n const iconY = maxHeight / 2 - iconHeight / 2;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const boxWidth = this.attribute.box.width;\n const iconWidth = this.attribute.icon.width;\n const maxWidth = Math.max(boxWidth, iconWidth);\n const boxX = maxWidth / 2 - boxWidth / 2;\n const iconX = maxWidth / 2 - iconWidth / 2;\n const textX = maxWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._box.setAttributes({\n x: boxX,\n y: boxY\n });\n this._checkIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._indeterminateIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n this.setAttribute('indeterminate', false);\n } else {\n this.setAttribute('checked', true);\n this.setAttribute('indeterminate', false);\n }\n\n this._dispatchEvent('checkbox_state_change', {\n eventType: 'checkbox_state_change',\n checked: this.attribute.checked\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: CheckboxAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, CheckBox.defaultAttributes, params);\n super.initAttributes(params);\n this.renderGroup();\n this.render();\n }\n}\n"]}
@@ -117,4 +117,5 @@ exports.DEFAULT_DATA_ZOOM_ATTRIBUTES = {
117
117
  pickMode: "imprecise",
118
118
  strokeBoundsBuffer: 0
119
119
  }
120
- };
120
+ };
121
+ //# sourceMappingURL=config.js.map
@@ -49,5 +49,4 @@ exports.EmptyTip = EmptyTip, EmptyTip.defaultAttributes = {
49
49
  height: 100,
50
50
  pickable: !1
51
51
  }
52
- };
53
- //# sourceMappingURL=empty-tip.js.map
52
+ };
package/cjs/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.19.25-alpha.1";
1
+ export declare const version = "0.19.25-alpha.2";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
package/cjs/index.js CHANGED
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
17
17
 
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
- }), exports.version = void 0, exports.version = "0.19.25-alpha.1", __exportStar(require("./core/base"), exports),
20
+ }), exports.version = void 0, exports.version = "0.19.25-alpha.2", __exportStar(require("./core/base"), exports),
21
21
  __exportStar(require("./core/type"), exports), __exportStar(require("./scrollbar"), exports),
22
22
  __exportStar(require("./tag"), exports), __exportStar(require("./poptip"), exports),
23
23
  __exportStar(require("./crosshair"), exports), __exportStar(require("./label"), exports),
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,8CAA4B;AAC5B,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B;AAC3B,0CAAwB;AACxB,8CAA4B;AAC5B,yCAAuB","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.19.25-alpha.1\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,8CAA4B;AAC5B,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B;AAC3B,0CAAwB;AACxB,8CAA4B;AAC5B,yCAAuB","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.19.25-alpha.2\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
package/cjs/label/arc.js CHANGED
@@ -485,4 +485,5 @@ exports.ArcLabel = ArcLabel, ArcLabel.defaultAttributes = {
485
485
  strategy: "priority",
486
486
  tangentConstraint: !0
487
487
  }
488
- };
488
+ };
489
+ //# sourceMappingURL=arc.js.map
package/cjs/label/area.js CHANGED
@@ -33,4 +33,4 @@ exports.AreaLabel = AreaLabel, AreaLabel.defaultAttributes = {
33
33
  position: "end",
34
34
  offset: 6
35
35
  };
36
- //# sourceMappingURL=area.js.map
36
+ //# sourceMappingURL=area.js.map
package/cjs/label/base.js CHANGED
@@ -462,4 +462,4 @@ exports.LabelBase = LabelBase, LabelBase.defaultAttributes = {
462
462
  offset: 0,
463
463
  pickable: !1
464
464
  };
465
- //# sourceMappingURL=base.js.map
465
+ //# sourceMappingURL=base.js.map
@@ -59,4 +59,4 @@ class DataLabel extends base_1.AbstractComponent {
59
59
  exports.DataLabel = DataLabel, DataLabel.defaultAttributes = {
60
60
  pickable: !1
61
61
  };
62
- //# sourceMappingURL=dataLabel.js.map
62
+ //# sourceMappingURL=dataLabel.js.map
@@ -22,4 +22,4 @@ __exportStar(require("./rect"), exports), __exportStar(require("./line"), export
22
22
  __exportStar(require("./base"), exports), __exportStar(require("./arc"), exports),
23
23
  __exportStar(require("./area"), exports), __exportStar(require("./line-data"), exports),
24
24
  __exportStar(require("./dataLabel"), exports);
25
- //# sourceMappingURL=index.js.map
25
+ //# sourceMappingURL=index.js.map
@@ -23,4 +23,4 @@ exports.LineDataLabel = LineDataLabel, LineDataLabel.defaultAttributes = {
23
23
  position: "top",
24
24
  offset: 5
25
25
  };
26
- //# sourceMappingURL=line-data.js.map
26
+ //# sourceMappingURL=line-data.js.map
package/cjs/label/line.js CHANGED
@@ -33,4 +33,4 @@ exports.LineLabel = LineLabel, LineLabel.defaultAttributes = {
33
33
  position: "end",
34
34
  offset: 6
35
35
  };
36
- //# sourceMappingURL=line.js.map
36
+ //# sourceMappingURL=line.js.map
@@ -28,4 +28,4 @@ exports.PolygonLabel = PolygonLabel, PolygonLabel.defaultAttributes = {
28
28
  position: "center",
29
29
  offset: 6
30
30
  };
31
- //# sourceMappingURL=polygon.js.map
31
+ //# sourceMappingURL=polygon.js.map
@@ -54,5 +54,4 @@ class LegendBase extends base_1.AbstractComponent {
54
54
  }
55
55
  }
56
56
 
57
- exports.LegendBase = LegendBase;
58
- //# sourceMappingURL=base.js.map
57
+ exports.LegendBase = LegendBase;
@@ -21,4 +21,4 @@ function(LegendEvent) {
21
21
  LEGEND_ELEMENT_NAME.itemLabel = "legendItemLabel", LEGEND_ELEMENT_NAME.itemValue = "legendItemValue",
22
22
  LEGEND_ELEMENT_NAME.focus = "legendItemFocus";
23
23
  }(LEGEND_ELEMENT_NAME = exports.LEGEND_ELEMENT_NAME || (exports.LEGEND_ELEMENT_NAME = {}));
24
- //# sourceMappingURL=constant.js.map
24
+ //# sourceMappingURL=constant.js.map
@@ -22,4 +22,4 @@ __exportStar(require("./color/color"), exports), __exportStar(require("./color/t
22
22
  __exportStar(require("./size/size"), exports), __exportStar(require("./size/type"), exports),
23
23
  __exportStar(require("./type"), exports), __exportStar(require("./constant"), exports),
24
24
  __exportStar(require("./util"), exports);
25
- //# sourceMappingURL=index.js.map
25
+ //# sourceMappingURL=index.js.map
@@ -24,4 +24,4 @@ function loadSizeContinuousLegendComponent() {
24
24
 
25
25
  exports.loadDiscreteLegendComponent = loadDiscreteLegendComponent, exports.loadColorContinuousLegendComponent = loadColorContinuousLegendComponent,
26
26
  exports.loadSizeContinuousLegendComponent = loadSizeContinuousLegendComponent;
27
- //# sourceMappingURL=register.js.map
27
+ //# sourceMappingURL=register.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=type.js.map
6
+ //# sourceMappingURL=type.js.map
@@ -10,4 +10,4 @@ function getSizeHandlerPath(align = "bottom") {
10
10
  Object.defineProperty(exports, "__esModule", {
11
11
  value: !0
12
12
  }), exports.getSizeHandlerPath = void 0, exports.getSizeHandlerPath = getSizeHandlerPath;
13
- //# sourceMappingURL=util.js.map
13
+ //# sourceMappingURL=util.js.map
@@ -18,4 +18,4 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), __exportStar(require("./link-path"), exports), __exportStar(require("./type"), exports);
21
- //# sourceMappingURL=index.js.map
21
+ //# sourceMappingURL=index.js.map
@@ -62,4 +62,4 @@ exports.LinkPath = LinkPath, LinkPath.defaultAttributes = {
62
62
  direction: "horizontal",
63
63
  align: "start"
64
64
  };
65
- //# sourceMappingURL=link-path.js.map
65
+ //# sourceMappingURL=link-path.js.map
@@ -55,7 +55,7 @@ class Radio extends base_1.AbstractComponent {
55
55
  }
56
56
  initAttributes(params, options) {
57
57
  params = (null == options ? void 0 : options.skipDefault) ? params : (0, vutils_1.merge)({}, Radio.defaultAttributes, params),
58
- super.initAttributes(params), this.render();
58
+ super.initAttributes(params), this.renderGroup(), this.render();
59
59
  }
60
60
  }
61
61
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/radio/radio.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,uCAAiD;AAEjD,yDAAuD;AAEvD,yCAAgD;AAEhD,IAAA,6BAAkB,GAAE,CAAC;AACrB,MAAa,KAAM,SAAQ,wBAA4C;IAqCrE,YAAY,UAA2B,EAAE,OAA0B;QACjE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,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,CAAC;YACvB,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,KAAK;SACT,CAAC,CAAC;IACL,CAAC;IAiBD,cAAc,CAAC,MAAuB,EAAE,OAA0B;QAChE,MAAM,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,KAAK,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;QACpF,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;;AAzIH,sBA0IC;AAzIQ,uBAAiB,GAA6B;IACnD,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,SAAS;IACjB,aAAa,EAAE,aAAa;IAC5B,uBAAuB,EAAE,CAAC;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,kBAAkB;QAC/B,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,MAAM,EAAE;QACN,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;QACrB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,aAAa,EAAE,kBAAkB;QACjC,kBAAkB,EAAE,oBAAoB;QACxC,oBAAoB,EAAE,oBAAoB;QAC1C,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","file":"radio.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { RadioAttributes } from './type';\nimport { Arc, WrapText } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadRadioComponent } from './register';\n\nloadRadioComponent();\nexport class Radio extends AbstractComponent<Required<RadioAttributes>> {\n static defaultAttributes: Partial<RadioAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n circle: {\n outerRadius: 7,\n innerRadius: 3,\n startAngle: 0,\n endAngle: 2 * Math.PI,\n lineWidth: 1,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _circle: Arc;\n _text: WrapText;\n\n name: 'radio';\n\n constructor(attributes: RadioAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Radio.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderCircle();\n this.renderText();\n this.layout();\n }\n\n renderCircle() {\n this._circle = new Arc(merge({}, this.attribute.circle));\n const isChecked = this.attribute.checked;\n if (isChecked && this.attribute.disabled) {\n this._circle.setAttributes({\n fill: this.attribute.circle.disableCheckedFill,\n stroke: this.attribute.circle.disableCheckedStroke\n });\n } else if (isChecked) {\n this._circle.setAttributes({\n fill: this.attribute.circle.checkedFill,\n stroke: this.attribute.circle.checkedStroke\n });\n }\n this.appendChild(this._circle);\n }\n\n renderText() {\n this._text = new WrapText(merge({}, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const circleHeight = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(circleHeight, textHeight);\n const circleY =\n maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const circleWidth = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const circleX = this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textX = circleWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._circle.setAttributes({\n x: circleX,\n y: circleY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled || this.attribute.checked) {\n // checked do nothing\n return;\n }\n this.setAttribute('checked', true);\n\n this._dispatchEvent('radio_checked', {\n eventType: 'radio_checked',\n target: this\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: RadioAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, Radio.defaultAttributes, params);\n super.initAttributes(params);\n this.render();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/radio/radio.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,uCAAiD;AAEjD,yDAAuD;AAEvD,yCAAgD;AAEhD,IAAA,6BAAkB,GAAE,CAAC;AACrB,MAAa,KAAM,SAAQ,wBAA4C;IAqCrE,YAAY,UAA2B,EAAE,OAA0B;QACjE,KAAK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K;KAChB;CACF,CAAC","file":"radio.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { RadioAttributes } from './type';\nimport { Arc, WrapText } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadRadioComponent } from './register';\n\nloadRadioComponent();\nexport class Radio extends AbstractComponent<Required<RadioAttributes>> {\n static defaultAttributes: Partial<RadioAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n circle: {\n outerRadius: 7,\n innerRadius: 3,\n startAngle: 0,\n endAngle: 2 * Math.PI,\n lineWidth: 1,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _circle: Arc;\n _text: WrapText;\n\n name: 'radio';\n\n constructor(attributes: RadioAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Radio.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderCircle();\n this.renderText();\n this.layout();\n }\n\n renderCircle() {\n this._circle = new Arc(merge({}, this.attribute.circle));\n const isChecked = this.attribute.checked;\n if (isChecked && this.attribute.disabled) {\n this._circle.setAttributes({\n fill: this.attribute.circle.disableCheckedFill,\n stroke: this.attribute.circle.disableCheckedStroke\n });\n } else if (isChecked) {\n this._circle.setAttributes({\n fill: this.attribute.circle.checkedFill,\n stroke: this.attribute.circle.checkedStroke\n });\n }\n this.appendChild(this._circle);\n }\n\n renderText() {\n this._text = new WrapText(merge({}, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const circleHeight = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(circleHeight, textHeight);\n const circleY =\n maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const circleWidth = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const circleX = this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textX = circleWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._circle.setAttributes({\n x: circleX,\n y: circleY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled || this.attribute.checked) {\n // checked do nothing\n return;\n }\n this.setAttribute('checked', true);\n\n this._dispatchEvent('radio_checked', {\n eventType: 'radio_checked',\n target: this\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: RadioAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, Radio.defaultAttributes, params);\n super.initAttributes(params);\n this.renderGroup();\n this.render();\n }\n}\n"]}
package/dist/index.es.js CHANGED
@@ -29470,6 +29470,7 @@ class CheckBox extends AbstractComponent {
29470
29470
  initAttributes(params, options) {
29471
29471
  params = (options === null || options === void 0 ? void 0 : options.skipDefault) ? params : merge({}, CheckBox.defaultAttributes, params);
29472
29472
  super.initAttributes(params);
29473
+ this.renderGroup();
29473
29474
  this.render();
29474
29475
  }
29475
29476
  }
@@ -29604,6 +29605,7 @@ class Radio extends AbstractComponent {
29604
29605
  initAttributes(params, options) {
29605
29606
  params = (options === null || options === void 0 ? void 0 : options.skipDefault) ? params : merge({}, Radio.defaultAttributes, params);
29606
29607
  super.initAttributes(params);
29608
+ this.renderGroup();
29607
29609
  this.render();
29608
29610
  }
29609
29611
  }
@@ -29695,6 +29697,6 @@ EmptyTip.defaultAttributes = {
29695
29697
  }
29696
29698
  };
29697
29699
 
29698
- const version = "0.19.25-alpha.1";
29700
+ const version = "0.19.25-alpha.2";
29699
29701
 
29700
29702
  export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AreaLabel, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupFadeIn, GroupFadeOut, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineDataLabel, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, VTag, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, clampRadian, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, direction, fuzzyEqualNumber, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, loadPoptip, measureTextSize, normalize, reactAttributeTransform, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, ticks, traverseGroup, version };
@@ -76,7 +76,7 @@ export class CheckBox extends AbstractComponent {
76
76
  }
77
77
  initAttributes(params, options) {
78
78
  params = (null == options ? void 0 : options.skipDefault) ? params : merge({}, CheckBox.defaultAttributes, params),
79
- super.initAttributes(params), this.render();
79
+ super.initAttributes(params), this.renderGroup(), this.render();
80
80
  }
81
81
  }
82
82
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/checkbox/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,QAAQ,GACZ,wrBAAwrB,CAAC;AAE3rB,MAAM,gBAAgB,GACpB,2MAA2M,CAAC;AAE9M,qBAAqB,EAAE,CAAC;AACxB,MAAM,O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J,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,kBAAkB;QAC/B,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,IAAI,EAAE;QACJ,cAAc,EAAE,QAAQ;QACxB,sBAAsB,EAAE,gBAAgB;QACxC,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,KAAK;KAChB;IACD,GAAG,EAAE;QACH,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,aAAa,EAAE,kBAAkB;QACjC,kBAAkB,EAAE,oBAAoB;QACxC,oBAAoB,EAAE,oBAAoB;QAC1C,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","file":"checkbox.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { CheckboxAttributes } from './type';\nimport { Image, Rect, Text } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadCheckBoxComponent } from './register';\n\nconst checkSvg =\n '<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>';\n\nconst indeterminateSvg =\n '<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>';\n\nloadCheckBoxComponent();\nexport class CheckBox extends AbstractComponent<Required<CheckboxAttributes>> {\n static defaultAttributes: Partial<CheckboxAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n indeterminate: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n icon: {\n checkIconImage: checkSvg,\n indeterminateIconImage: indeterminateSvg,\n width: 10,\n height: 10,\n pickable: false\n },\n box: {\n width: 14,\n height: 14,\n cornerRadius: 2,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _box: Rect;\n _checkIcon: Image;\n _indeterminateIcon: Image;\n _text: Text;\n\n name: 'checkbox';\n\n constructor(attributes: CheckboxAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CheckBox.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderBox();\n this.renderIcon();\n this.renderText();\n this.layout();\n }\n\n renderBox() {\n this._box = new Rect(merge({}, this.attribute.box));\n const isCheckedOrIndeterminate = this.attribute.checked || this.attribute.indeterminate;\n if (isCheckedOrIndeterminate && this.attribute.disabled) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill,\n stroke: this.attribute.box.disableCheckedStroke\n });\n } else if (isCheckedOrIndeterminate) {\n this._box.setAttributes({\n fill: this.attribute.box.checkedFill,\n stroke: this.attribute.box.checkedStroke\n });\n }\n this.appendChild(this._box);\n }\n\n renderIcon() {\n this._checkIcon = new Image(merge({ image: this.attribute.icon.checkIconImage }, this.attribute.icon));\n this.appendChild(this._checkIcon);\n this._indeterminateIcon = new Image(\n merge(\n {\n image: this.attribute.icon.indeterminateIconImage\n },\n this.attribute.icon\n )\n );\n this.appendChild(this._indeterminateIcon);\n\n if (this.attribute.checked) {\n this._checkIcon.setAttribute('visible', true);\n this._indeterminateIcon.setAttribute('visible', false);\n } else if (this.attribute.indeterminate) {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', true);\n } else {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', false);\n }\n }\n\n renderText() {\n this._text = new Text(merge({ wrap: true }, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const boxHeight = this.attribute.box.height;\n const iconHeight = this.attribute.icon.height;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(boxHeight, iconHeight, textHeight);\n const boxY = maxHeight / 2 - boxHeight / 2;\n const iconY = maxHeight / 2 - iconHeight / 2;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const boxWidth = this.attribute.box.width;\n const iconWidth = this.attribute.icon.width;\n const maxWidth = Math.max(boxWidth, iconWidth);\n const boxX = maxWidth / 2 - boxWidth / 2;\n const iconX = maxWidth / 2 - iconWidth / 2;\n const textX = maxWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._box.setAttributes({\n x: boxX,\n y: boxY\n });\n this._checkIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._indeterminateIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n this.setAttribute('indeterminate', false);\n } else {\n this.setAttribute('checked', true);\n this.setAttribute('indeterminate', false);\n }\n\n this._dispatchEvent('checkbox_state_change', {\n eventType: 'checkbox_state_change',\n checked: this.attribute.checked\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: CheckboxAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, CheckBox.defaultAttributes, params);\n super.initAttributes(params);\n this.render();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/checkbox/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,QAAQ,GACZ,wrBAAwrB,CAAC;AAE3rB,MAAM,gBAAgB,GACpB,2MAA2M,CAAC;AAE9M,qBAAqB,EAAE,CAAC;AACxB,MAAM,OAAO,QAAS,SAAQ,iBAA+C;IA6C3E,YAAY,UAA8B,EAAE,OAA0B;QACpE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,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EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,IAAI,EAAE;QACJ,cAAc,EAAE,QAAQ;QACxB,sBAAsB,EAAE,gBAAgB;QACxC,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE,KAAK;KAChB;IACD,GAAG,EAAE;QACH,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,CAAC;QACf,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,aAAa,EAAE,kBAAkB;QACjC,kBAAkB,EAAE,oBAAoB;QACxC,oBAAoB,EAAE,oBAAoB;QAC1C,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","file":"checkbox.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { CheckboxAttributes } from './type';\nimport { Image, Rect, Text } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadCheckBoxComponent } from './register';\n\nconst checkSvg =\n '<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>';\n\nconst indeterminateSvg =\n '<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>';\n\nloadCheckBoxComponent();\nexport class CheckBox extends AbstractComponent<Required<CheckboxAttributes>> {\n static defaultAttributes: Partial<CheckboxAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n indeterminate: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n icon: {\n checkIconImage: checkSvg,\n indeterminateIconImage: indeterminateSvg,\n width: 10,\n height: 10,\n pickable: false\n },\n box: {\n width: 14,\n height: 14,\n cornerRadius: 2,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _box: Rect;\n _checkIcon: Image;\n _indeterminateIcon: Image;\n _text: Text;\n\n name: 'checkbox';\n\n constructor(attributes: CheckboxAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, CheckBox.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderBox();\n this.renderIcon();\n this.renderText();\n this.layout();\n }\n\n renderBox() {\n this._box = new Rect(merge({}, this.attribute.box));\n const isCheckedOrIndeterminate = this.attribute.checked || this.attribute.indeterminate;\n if (isCheckedOrIndeterminate && this.attribute.disabled) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill,\n stroke: this.attribute.box.disableCheckedStroke\n });\n } else if (isCheckedOrIndeterminate) {\n this._box.setAttributes({\n fill: this.attribute.box.checkedFill,\n stroke: this.attribute.box.checkedStroke\n });\n }\n this.appendChild(this._box);\n }\n\n renderIcon() {\n this._checkIcon = new Image(merge({ image: this.attribute.icon.checkIconImage }, this.attribute.icon));\n this.appendChild(this._checkIcon);\n this._indeterminateIcon = new Image(\n merge(\n {\n image: this.attribute.icon.indeterminateIconImage\n },\n this.attribute.icon\n )\n );\n this.appendChild(this._indeterminateIcon);\n\n if (this.attribute.checked) {\n this._checkIcon.setAttribute('visible', true);\n this._indeterminateIcon.setAttribute('visible', false);\n } else if (this.attribute.indeterminate) {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', true);\n } else {\n this._checkIcon.setAttribute('visible', false);\n this._indeterminateIcon.setAttribute('visible', false);\n }\n }\n\n renderText() {\n this._text = new Text(merge({ wrap: true }, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const boxHeight = this.attribute.box.height;\n const iconHeight = this.attribute.icon.height;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(boxHeight, iconHeight, textHeight);\n const boxY = maxHeight / 2 - boxHeight / 2;\n const iconY = maxHeight / 2 - iconHeight / 2;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const boxWidth = this.attribute.box.width;\n const iconWidth = this.attribute.icon.width;\n const maxWidth = Math.max(boxWidth, iconWidth);\n const boxX = maxWidth / 2 - boxWidth / 2;\n const iconX = maxWidth / 2 - iconWidth / 2;\n const textX = maxWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._box.setAttributes({\n x: boxX,\n y: boxY\n });\n this._checkIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._indeterminateIcon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n this.setAttribute('indeterminate', false);\n } else {\n this.setAttribute('checked', true);\n this.setAttribute('indeterminate', false);\n }\n\n this._dispatchEvent('checkbox_state_change', {\n eventType: 'checkbox_state_change',\n checked: this.attribute.checked\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: CheckboxAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, CheckBox.defaultAttributes, params);\n super.initAttributes(params);\n this.renderGroup();\n this.render();\n }\n}\n"]}
@@ -115,4 +115,5 @@ export const DEFAULT_HANDLER_ATTR_MAP = {
115
115
  pickMode: "imprecise",
116
116
  strokeBoundsBuffer: 0
117
117
  }
118
- };
118
+ };
119
+ //# sourceMappingURL=config.js.map
@@ -51,5 +51,4 @@ EmptyTip.defaultAttributes = {
51
51
  height: 100,
52
52
  pickable: !1
53
53
  }
54
- };
55
- //# sourceMappingURL=empty-tip.js.map
54
+ };
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.19.25-alpha.1";
1
+ export declare const version = "0.19.25-alpha.2";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.19.25-alpha.1";
1
+ export const version = "0.19.25-alpha.2";
2
2
 
3
3
  export * from "./core/base";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAEzC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.19.25-alpha.1\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAEzC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.19.25-alpha.2\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
package/es/label/arc.js CHANGED
@@ -470,4 +470,5 @@ ArcLabel.defaultAttributes = {
470
470
  strategy: "priority",
471
471
  tangentConstraint: !0
472
472
  }
473
- };
473
+ };
474
+ //# sourceMappingURL=arc.js.map
package/es/label/area.js CHANGED
@@ -31,4 +31,4 @@ AreaLabel.defaultAttributes = {
31
31
  position: "end",
32
32
  offset: 6
33
33
  };
34
- //# sourceMappingURL=area.js.map
34
+ //# sourceMappingURL=area.js.map
package/es/label/base.js CHANGED
@@ -465,4 +465,4 @@ LabelBase.defaultAttributes = {
465
465
  offset: 0,
466
466
  pickable: !1
467
467
  };
468
- //# sourceMappingURL=base.js.map
468
+ //# sourceMappingURL=base.js.map
@@ -73,4 +73,4 @@ export class DataLabel extends AbstractComponent {
73
73
  DataLabel.defaultAttributes = {
74
74
  pickable: !1
75
75
  };
76
- //# sourceMappingURL=dataLabel.js.map
76
+ //# sourceMappingURL=dataLabel.js.map
package/es/label/index.js CHANGED
@@ -15,4 +15,4 @@ export * from "./area";
15
15
  export * from "./line-data";
16
16
 
17
17
  export * from "./dataLabel";
18
- //# sourceMappingURL=index.js.map
18
+ //# sourceMappingURL=index.js.map
@@ -21,4 +21,4 @@ LineDataLabel.defaultAttributes = {
21
21
  position: "top",
22
22
  offset: 5
23
23
  };
24
- //# sourceMappingURL=line-data.js.map
24
+ //# sourceMappingURL=line-data.js.map
package/es/label/line.js CHANGED
@@ -31,4 +31,4 @@ LineLabel.defaultAttributes = {
31
31
  position: "end",
32
32
  offset: 6
33
33
  };
34
- //# sourceMappingURL=line.js.map
34
+ //# sourceMappingURL=line.js.map
@@ -24,4 +24,4 @@ PolygonLabel.defaultAttributes = {
24
24
  position: "center",
25
25
  offset: 6
26
26
  };
27
- //# sourceMappingURL=polygon.js.map
27
+ //# sourceMappingURL=polygon.js.map
package/es/legend/base.js CHANGED
@@ -52,5 +52,4 @@ export class LegendBase extends AbstractComponent {
52
52
  "center" === align ? this._title.setAttribute("x", (innerViewWidth - titleWidth) / 2) : "end" === align && this._title.setAttribute("x", innerViewWidth - titleWidth);
53
53
  }
54
54
  }
55
- }
56
- //# sourceMappingURL=base.js.map
55
+ }
@@ -37,4 +37,4 @@ export var LEGEND_ELEMENT_NAME;
37
37
  LEGEND_ELEMENT_NAME.itemLabel = "legendItemLabel", LEGEND_ELEMENT_NAME.itemValue = "legendItemValue",
38
38
  LEGEND_ELEMENT_NAME.focus = "legendItemFocus";
39
39
  }(LEGEND_ELEMENT_NAME || (LEGEND_ELEMENT_NAME = {}));
40
- //# sourceMappingURL=constant.js.map
40
+ //# sourceMappingURL=constant.js.map
@@ -15,4 +15,4 @@ export * from "./type";
15
15
  export * from "./constant";
16
16
 
17
17
  export * from "./util";
18
- //# sourceMappingURL=index.js.map
18
+ //# sourceMappingURL=index.js.map
@@ -23,4 +23,4 @@ export function loadColorContinuousLegendComponent() {
23
23
  export function loadSizeContinuousLegendComponent() {
24
24
  loadBaseLegend(), loadSliderComponent(), registerPath();
25
25
  }
26
- //# sourceMappingURL=register.js.map
26
+ //# sourceMappingURL=register.js.map
package/es/legend/type.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export { };
2
- //# sourceMappingURL=type.js.map
2
+ //# sourceMappingURL=type.js.map
package/es/legend/util.js CHANGED
@@ -4,4 +4,4 @@ export function getSizeHandlerPath(align = "bottom") {
4
4
  `\n M${centerX - 6},0L${centerX - 6 + 2.5},-3.5\n h5\n v7\n h-5\n Z\n`) : "right" === align ? (centerX = -1,
5
5
  `\n M${centerX + 6},0L${centerX + 6 - 2.5},-3.5\n h-5\n v7\n h5\n Z\n `) : `\n M${centerX},6L${centerX - 3.5},2.5\n v-5\n h7\n v5\n Z\n`;
6
6
  }
7
- //# sourceMappingURL=util.js.map
7
+ //# sourceMappingURL=util.js.map
@@ -1,4 +1,4 @@
1
1
  export * from "./link-path";
2
2
 
3
3
  export * from "./type";
4
- //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -60,4 +60,4 @@ LinkPath.defaultAttributes = {
60
60
  direction: "horizontal",
61
61
  align: "start"
62
62
  };
63
- //# sourceMappingURL=link-path.js.map
63
+ //# sourceMappingURL=link-path.js.map
package/es/radio/radio.js CHANGED
@@ -54,7 +54,7 @@ export class Radio extends AbstractComponent {
54
54
  }
55
55
  initAttributes(params, options) {
56
56
  params = (null == options ? void 0 : options.skipDefault) ? params : merge({}, Radio.defaultAttributes, params),
57
- super.initAttributes(params), this.render();
57
+ super.initAttributes(params), this.renderGroup(), this.render();
58
58
  }
59
59
  }
60
60
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/radio/radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,kBAAkB,EAAE,CAAC;AACrB,MAAM,OAAO,KAAM,SAAQ,iBAA4C;IAqCrE,YAAY,UAA2B,EAAE,OAA0B;QACjE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAgFpF,qBAAgB,GAAG,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;gBAErD,OAAO;aACR;YACD,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAEnC,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE;gBACnC,SAAS,EAAE,eAAe;gBAC1B,MAAM,EAAE,IAAI;aACb,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QAC/B,CAAC,CAAC;QA5FA,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,IAAI,CAAC,uBAAuB,GAAG,CAAC,GAAQ,EAAE,UAAe,EAA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,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,kBAAkB;QAC/B,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,MAAM,EAAE;QACN,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;QACrB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,aAAa,EAAE,kBAAkB;QACjC,kBAAkB,EAAE,oBAAoB;QACxC,oBAAoB,EAAE,oBAAoB;QAC1C,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","file":"radio.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { RadioAttributes } from './type';\nimport { Arc, WrapText } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadRadioComponent } from './register';\n\nloadRadioComponent();\nexport class Radio extends AbstractComponent<Required<RadioAttributes>> {\n static defaultAttributes: Partial<RadioAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n circle: {\n outerRadius: 7,\n innerRadius: 3,\n startAngle: 0,\n endAngle: 2 * Math.PI,\n lineWidth: 1,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _circle: Arc;\n _text: WrapText;\n\n name: 'radio';\n\n constructor(attributes: RadioAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Radio.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderCircle();\n this.renderText();\n this.layout();\n }\n\n renderCircle() {\n this._circle = new Arc(merge({}, this.attribute.circle));\n const isChecked = this.attribute.checked;\n if (isChecked && this.attribute.disabled) {\n this._circle.setAttributes({\n fill: this.attribute.circle.disableCheckedFill,\n stroke: this.attribute.circle.disableCheckedStroke\n });\n } else if (isChecked) {\n this._circle.setAttributes({\n fill: this.attribute.circle.checkedFill,\n stroke: this.attribute.circle.checkedStroke\n });\n }\n this.appendChild(this._circle);\n }\n\n renderText() {\n this._text = new WrapText(merge({}, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const circleHeight = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(circleHeight, textHeight);\n const circleY =\n maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const circleWidth = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const circleX = this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textX = circleWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._circle.setAttributes({\n x: circleX,\n y: circleY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled || this.attribute.checked) {\n // checked do nothing\n return;\n }\n this.setAttribute('checked', true);\n\n this._dispatchEvent('radio_checked', {\n eventType: 'radio_checked',\n target: this\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: RadioAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, Radio.defaultAttributes, params);\n super.initAttributes(params);\n this.render();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/radio/radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,kBAAkB,EAAE,CAAC;AACrB,MAAM,OAAO,KAAM,SAAQ,iBAA4C;IAqCrE,YAAY,UAA2B,EAAE,OAA0B;QACjE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAgFpF,qBAAgB,GAAG,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;gBAErD,OAAO;aACR;YACD,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAEnC,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE;gBACnC,SAAS,EAAE,eAAe;gBAC1B,MAAM,EAAE,IAAI;aACb,CAAC,CAAC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iB,GAA6B;IACnD,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,SAAS;IACjB,aAAa,EAAE,aAAa;IAC5B,uBAAuB,EAAE,CAAC;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,kBAAkB;QAC/B,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,MAAM,EAAE;QACN,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;QACrB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,kBAAkB;QAC1B,WAAW,EAAE,kBAAkB;QAC/B,WAAW,EAAE,kBAAkB;QAC/B,aAAa,EAAE,kBAAkB;QACjC,kBAAkB,EAAE,oBAAoB;QACxC,oBAAoB,EAAE,oBAAoB;QAC1C,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","file":"radio.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { RadioAttributes } from './type';\nimport { Arc, WrapText } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadRadioComponent } from './register';\n\nloadRadioComponent();\nexport class Radio extends AbstractComponent<Required<RadioAttributes>> {\n static defaultAttributes: Partial<RadioAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n spaceBetweenTextAndIcon: 8,\n text: {\n text: 'text',\n fontSize: 14,\n fill: '#000',\n disableFill: 'rgb(201,205,212)',\n textBaseline: 'top',\n pickable: false\n },\n circle: {\n outerRadius: 7,\n innerRadius: 3,\n startAngle: 0,\n endAngle: 2 * Math.PI,\n lineWidth: 1,\n fill: '#fff',\n stroke: 'rgb(229,230,235)',\n disableFill: 'rgb(242,243,245)',\n checkedFill: 'rgb(22, 93, 255)',\n checkedStroke: 'rgb(22, 93, 255)',\n disableCheckedFill: 'rgb(148, 191, 255)',\n disableCheckedStroke: 'rgb(148, 191, 255)',\n pickable: false\n }\n };\n _circle: Arc;\n _text: WrapText;\n\n name: 'radio';\n\n constructor(attributes: RadioAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Radio.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderCircle();\n this.renderText();\n this.layout();\n }\n\n renderCircle() {\n this._circle = new Arc(merge({}, this.attribute.circle));\n const isChecked = this.attribute.checked;\n if (isChecked && this.attribute.disabled) {\n this._circle.setAttributes({\n fill: this.attribute.circle.disableCheckedFill,\n stroke: this.attribute.circle.disableCheckedStroke\n });\n } else if (isChecked) {\n this._circle.setAttributes({\n fill: this.attribute.circle.checkedFill,\n stroke: this.attribute.circle.checkedStroke\n });\n }\n this.appendChild(this._circle);\n }\n\n renderText() {\n this._text = new WrapText(merge({}, this.attribute.text));\n if (this.attribute.disabled) {\n this._text.setAttribute('fill', this.attribute.text.disableFill);\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const circleHeight = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(circleHeight, textHeight);\n const circleY =\n maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const circleWidth = (this.attribute.circle.outerRadius + this.attribute.circle.lineWidth) * 2;\n const circleX = this.attribute.circle.outerRadius + this.attribute.circle.lineWidth;\n const textX = circleWidth + this.attribute.spaceBetweenTextAndIcon;\n\n this._circle.setAttributes({\n x: circleX,\n y: circleY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled || this.attribute.checked) {\n // checked do nothing\n return;\n }\n this.setAttribute('checked', true);\n\n this._dispatchEvent('radio_checked', {\n eventType: 'radio_checked',\n target: this\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: RadioAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, Radio.defaultAttributes, params);\n super.initAttributes(params);\n this.renderGroup();\n this.render();\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-components",
3
- "version": "0.19.25-alpha.1",
3
+ "version": "0.19.25-alpha.2",
4
4
  "description": "components library for dp visualization",
5
5
  "sideEffects": false,
6
6
  "main": "cjs/index.js",
@@ -12,8 +12,8 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@visactor/vrender-core": "0.19.25-alpha.1",
16
- "@visactor/vrender-kits": "0.19.25-alpha.1",
15
+ "@visactor/vrender-core": "0.19.25-alpha.2",
16
+ "@visactor/vrender-kits": "0.19.25-alpha.2",
17
17
  "@visactor/vutils": "~0.18.10",
18
18
  "@visactor/vscale": "~0.18.9"
19
19
  },
@@ -30,8 +30,8 @@
30
30
  "typescript": "4.9.5",
31
31
  "cross-env": "^7.0.3",
32
32
  "@internal/bundler": "0.0.1",
33
- "@internal/ts-config": "0.0.1",
34
- "@internal/eslint-config": "0.0.1"
33
+ "@internal/eslint-config": "0.0.1",
34
+ "@internal/ts-config": "0.0.1"
35
35
  },
36
36
  "keywords": [
37
37
  "VisActor",