@visactor/vrender-components 0.18.11-alpha.0 → 0.18.11-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/cjs/index.d.ts +1 -2
- package/cjs/index.js +2 -3
- package/cjs/index.js.map +1 -1
- package/cjs/jsx/component-type.js +1 -1
- package/cjs/jsx/index.js +1 -1
- package/cjs/label/index.js +2 -1
- package/cjs/label/line.js +1 -2
- package/cjs/label/util.js +2 -2
- package/cjs/link-path/index.js +1 -1
- package/cjs/player/controller/controller.js +4 -4
- package/cjs/player/controller/controller.js.map +1 -1
- package/es/index.d.ts +1 -2
- package/es/index.js +1 -3
- package/es/index.js.map +1 -1
- package/es/jsx/component-type.js +1 -1
- package/es/jsx/index.js +1 -1
- package/es/label/index.js +2 -1
- package/es/label/line.js +1 -2
- package/es/label/util.js +1 -1
- package/es/link-path/index.js +1 -1
- package/es/player/controller/controller.js +5 -5
- package/es/player/controller/controller.js.map +1 -1
- package/package.json +3 -3
- package/cjs/radio/index.d.ts +0 -2
- package/cjs/radio/index.js +0 -21
- package/cjs/radio/index.js.map +0 -1
- package/cjs/radio/radio.d.ts +0 -16
- package/cjs/radio/radio.js +0 -88
- package/cjs/radio/radio.js.map +0 -1
- package/cjs/radio/register.d.ts +0 -1
- package/cjs/radio/register.js +0 -15
- package/cjs/radio/register.js.map +0 -1
- package/cjs/radio/type.d.ts +0 -21
- package/cjs/radio/type.js +0 -6
- package/cjs/radio/type.js.map +0 -1
- package/es/radio/index.d.ts +0 -2
- package/es/radio/index.js +0 -4
- package/es/radio/index.js.map +0 -1
- package/es/radio/radio.d.ts +0 -16
- package/es/radio/radio.js +0 -87
- package/es/radio/radio.js.map +0 -1
- package/es/radio/register.d.ts +0 -1
- package/es/radio/register.js +0 -6
- package/es/radio/register.js.map +0 -1
- package/es/radio/type.d.ts +0 -21
- package/es/radio/type.js +0 -2
- package/es/radio/type.js.map +0 -1
package/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const version = "0.18.11-alpha.
|
|
1
|
+
export declare const version = "0.18.11-alpha.1";
|
|
2
2
|
export * from './core/base';
|
|
3
3
|
export * from './core/type';
|
|
4
4
|
export * from './scrollbar';
|
|
@@ -23,5 +23,4 @@ export * from './tooltip';
|
|
|
23
23
|
export * from './interface';
|
|
24
24
|
export * from './jsx';
|
|
25
25
|
export * from './checkbox';
|
|
26
|
-
export * from './radio';
|
|
27
26
|
export * from './util';
|
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.18.11-alpha.
|
|
20
|
+
}), exports.version = void 0, exports.version = "0.18.11-alpha.1", __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),
|
|
@@ -29,6 +29,5 @@ __exportStar(require("./indicator"), exports), __exportStar(require("./slider"),
|
|
|
29
29
|
__exportStar(require("./link-path"), exports), __exportStar(require("./player"), exports),
|
|
30
30
|
__exportStar(require("./brush"), exports), __exportStar(require("./tooltip"), exports),
|
|
31
31
|
__exportStar(require("./interface"), exports), __exportStar(require("./jsx"), exports),
|
|
32
|
-
__exportStar(require("./checkbox"), exports), __exportStar(require("./
|
|
33
|
-
__exportStar(require("./util"), exports);
|
|
32
|
+
__exportStar(require("./checkbox"), exports), __exportStar(require("./util"), exports);
|
|
34
33
|
//# sourceMappingURL=index.js.map
|
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,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B;AAC3B,
|
|
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,8CAA4B;AAC5B,wCAAsB;AACtB,6CAA2B;AAC3B,yCAAuB","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.18.11-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 './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './util';\n"]}
|
package/cjs/jsx/index.js
CHANGED
|
@@ -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("./component-type"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/label/index.js
CHANGED
|
@@ -21,4 +21,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
21
|
__exportStar(require("./rect"), exports), __exportStar(require("./line"), exports),
|
|
22
22
|
__exportStar(require("./base"), exports), __exportStar(require("./arc"), exports),
|
|
23
23
|
__exportStar(require("./area"), exports), __exportStar(require("./line-data"), exports),
|
|
24
|
-
__exportStar(require("./dataLabel"), exports);
|
|
24
|
+
__exportStar(require("./dataLabel"), exports);
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/label/line.js
CHANGED
package/cjs/label/util.js
CHANGED
|
@@ -202,6 +202,6 @@ function getIntersection(dx, dy, cx, cy, w, h) {
|
|
|
202
202
|
};
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
exports.getPointsOfLineArea = getPointsOfLineArea, exports.labelingLineOrArea = labelingLineOrArea,
|
|
206
|
-
exports.connectLineBetweenBounds = connectLineBetweenBounds;
|
|
207
205
|
//# sourceMappingURL=util.js.map
|
|
206
|
+
exports.getPointsOfLineArea = getPointsOfLineArea, exports.labelingLineOrArea = labelingLineOrArea,
|
|
207
|
+
exports.connectLineBetweenBounds = connectLineBetweenBounds;
|
package/cjs/link-path/index.js
CHANGED
|
@@ -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
|
|
@@ -64,13 +64,13 @@ class Controller extends base_1.AbstractComponent {
|
|
|
64
64
|
}, this.renderForward = () => {
|
|
65
65
|
this._forwardController.setAttributes(this._forwardAttr.style);
|
|
66
66
|
}, this.play = () => {
|
|
67
|
-
this._dispatchEvent(
|
|
67
|
+
this._dispatchEvent(constant_1.ControllerEventEnum.OnPlay);
|
|
68
68
|
}, this.pause = () => {
|
|
69
|
-
this._dispatchEvent(
|
|
69
|
+
this._dispatchEvent(constant_1.ControllerEventEnum.OnPause);
|
|
70
70
|
}, this.forward = () => {
|
|
71
|
-
this._dispatchEvent(
|
|
71
|
+
this._dispatchEvent(constant_1.ControllerEventEnum.OnForward);
|
|
72
72
|
}, this.backward = () => {
|
|
73
|
-
this._dispatchEvent(
|
|
73
|
+
this._dispatchEvent(constant_1.ControllerEventEnum.OnBackward);
|
|
74
74
|
}, this.togglePlay = () => {
|
|
75
75
|
this._playController.setAttributes(this._startAttr.style), this._isPaused = !0;
|
|
76
76
|
}, this.togglePause = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/player/controller/controller.ts"],"names":[],"mappings":";;;AAAA,6CAAgD;AAEhD,0CAAoD;AAGpD,qCAAsF;AACtF,iCAAoC;AACpC,yCAAgD;AAGhD,MAAa,UAAW,SAAQ,wBAAiD;IA4B/E,YAAY,UAAgC,EAAE,OAA0B;QACtE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAZzF,cAAS,GAAG,IAAI,CAAC;QAoBzB,qBAAgB,GAAG,GAAG,EAAE;YACtB,IAAI,CAAC,UAAU,GAAG;gBAChB,KAAK,8CACH,UAAU,EAAE,iBAAQ,IACjB,UAAU,CAAC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AArMQ,gCAAqB,GAA4B;IACtD,OAAO,EAAE,IAAI;IACb,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,WAAW;IACrB,MAAM,EAAE,SAAS;CAClB,CAAC;AACK,4BAAiB,GAAyB;IAC/C,CAAC,6BAAkB,CAAC,KAAK,CAAC,EAAE,EAAE;IAC9B,CAAC,6BAAkB,CAAC,KAAK,CAAC,EAAE,EAAE;IAC9B,CAAC,6BAAkB,CAAC,QAAQ,CAAC,EAAE,EAAE;IACjC,CAAC,6BAAkB,CAAC,OAAO,CAAC,EAAE,EAAE;CACjC,CAAC","file":"controller.js","sourcesContent":["import { isNil, merge } from '@visactor/vutils';\nimport type { FederatedPointerEvent, ISymbolGraphicAttribute } from '@visactor/vrender-core';\nimport { AbstractComponent } from '../../core/base';\nimport type { BaseGraphicAttributes } from '../../core/type';\nimport type { ControllerAttributes, LayoutType } from './type';\nimport { iconRight, iconPause, iconPlay, iconLeft, iconUp, iconDown } from './assets';\nimport { PlayerIcon } from './icon';\nimport { ControllerTypeEnum } from './constant';\nimport type { ComponentOptions } from '../../interface';\n\nexport class Controller extends AbstractComponent<Required<ControllerAttributes>> {\n static defaultControllerAttr: ISymbolGraphicAttribute = {\n visible: true,\n x: 0,\n y: 0,\n size: 20,\n fill: '#91caff',\n pickMode: 'imprecise',\n cursor: 'pointer'\n };\n static defaultAttributes: ControllerAttributes = {\n [ControllerTypeEnum.Start]: {},\n [ControllerTypeEnum.Pause]: {},\n [ControllerTypeEnum.Backward]: {},\n [ControllerTypeEnum.Forward]: {}\n };\n\n private _isPaused = true;\n private _playController: PlayerIcon;\n private _forwardController: PlayerIcon;\n private _backwardController: PlayerIcon;\n\n private _layout: LayoutType;\n private _startAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _pauseAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _forwardAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _backwardAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n\n constructor(attributes: ControllerAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Controller.defaultAttributes, attributes));\n this.updateAttributes();\n this._initPlay();\n this._initBackward();\n this._initForward();\n this._initEvents();\n }\n\n updateAttributes = () => {\n this._startAttr = {\n style: {\n symbolType: iconPlay,\n ...Controller.defaultControllerAttr,\n visible: this.attribute.start.visible,\n ...this.attribute.start.style\n }\n };\n this._pauseAttr = {\n style: {\n symbolType: iconPause,\n ...Controller.defaultControllerAttr,\n visible: this.attribute.pause.visible,\n ...this.attribute.pause.style\n }\n };\n this._forwardAttr = {\n style: {\n ...Controller.defaultControllerAttr,\n visible: this.attribute.forward.visible,\n ...this.attribute.forward.style\n }\n };\n this._backwardAttr = {\n style: {\n ...Controller.defaultControllerAttr,\n visible: this.attribute.backward.visible,\n ...this.attribute.backward.style\n }\n };\n this.updateLayout();\n };\n\n private updateLayout = () => {\n this._layout = this.attribute.layout;\n // 若水平布局\n if (this._layout === 'horizontal') {\n this._backwardAttr.style.symbolType = this._backwardAttr.style.symbolType ?? iconLeft;\n this._forwardAttr.style.symbolType = this._forwardAttr.style.symbolType ?? iconRight;\n }\n // 若垂直布局\n else if (this._layout === 'vertical') {\n this._backwardAttr.style.symbolType = this._backwardAttr.style.symbolType ?? iconUp;\n this._forwardAttr.style.symbolType = this._forwardAttr.style.symbolType ?? iconDown;\n }\n };\n\n private _initPlay = () => {\n if (isNil(this._playController)) {\n this._playController = new PlayerIcon({\n ...this._startAttr.style\n });\n\n this.add(this._playController);\n }\n };\n\n private _initBackward = () => {\n if (isNil(this._backwardController)) {\n this._backwardController = new PlayerIcon({\n ...this._backwardAttr.style\n });\n\n this.add(this._backwardController);\n }\n };\n\n private _initForward = () => {\n if (isNil(this._forwardController)) {\n this._forwardController = new PlayerIcon({\n ...this._forwardAttr.style\n });\n\n this.add(this._forwardController);\n }\n };\n\n /**\n * 初始化事件\n * 1. 注册\n */\n private _initEvents = () => {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n this._playController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n\n if (this._isPaused === true) {\n this.play();\n } else {\n this.pause();\n }\n });\n\n this._backwardController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.backward();\n });\n\n this._forwardController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.forward();\n });\n };\n\n render(): void {\n this.updateAttributes();\n this.renderPlay();\n this.renderBackward();\n this.renderForward();\n }\n\n renderPlay = () => {\n if (this._isPaused) {\n this._playController.setAttributes({\n symbolType: this._playController.getComputedAttribute('symbolType'),\n ...this._startAttr.style\n });\n } else {\n this._playController.setAttributes({\n symbolType: this._playController.getComputedAttribute('symbolType'),\n ...this._pauseAttr.style\n });\n }\n };\n\n renderBackward = () => {\n this._backwardController.setAttributes(this._backwardAttr.style);\n };\n\n renderForward = () => {\n this._forwardController.setAttributes(this._forwardAttr.style);\n };\n\n play = () => {\n this._dispatchEvent('ControllerEventEnum.OnPlay');\n };\n\n pause = () => {\n this._dispatchEvent('ControllerEventEnum.OnPause');\n };\n\n forward = () => {\n this._dispatchEvent('ControllerEventEnum.OnForward');\n };\n\n backward = () => {\n this._dispatchEvent('ControllerEventEnum.OnBackward');\n };\n\n togglePlay = () => {\n this._playController.setAttributes(this._startAttr.style);\n this._isPaused = true;\n };\n\n togglePause = () => {\n this._playController.setAttributes(this._pauseAttr.style);\n this._isPaused = false;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/player/controller/controller.ts"],"names":[],"mappings":";;;AAAA,6CAAgD;AAEhD,0CAAoD;AAGpD,qCAAsF;AACtF,iCAAoC;AACpC,yCAAqE;AAGrE,MAAa,UAAW,SAAQ,wBAAiD;IA4B/E,YAAY,UAAgC,EAAE,OAA0B;QACtE,KAAK,CAAC,CAAA,OAAO,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AgB,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IA6GD,MAAM;QACJ,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;;AArJH,gCAsMC;AArMQ,gCAAqB,GAA4B;IACtD,OAAO,EAAE,IAAI;IACb,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,WAAW;IACrB,MAAM,EAAE,SAAS;CAClB,CAAC;AACK,4BAAiB,GAAyB;IAC/C,CAAC,6BAAkB,CAAC,KAAK,CAAC,EAAE,EAAE;IAC9B,CAAC,6BAAkB,CAAC,KAAK,CAAC,EAAE,EAAE;IAC9B,CAAC,6BAAkB,CAAC,QAAQ,CAAC,EAAE,EAAE;IACjC,CAAC,6BAAkB,CAAC,OAAO,CAAC,EAAE,EAAE;CACjC,CAAC","file":"controller.js","sourcesContent":["import { isNil, merge } from '@visactor/vutils';\nimport type { FederatedPointerEvent, ISymbolGraphicAttribute } from '@visactor/vrender-core';\nimport { AbstractComponent } from '../../core/base';\nimport type { BaseGraphicAttributes } from '../../core/type';\nimport type { ControllerAttributes, LayoutType } from './type';\nimport { iconRight, iconPause, iconPlay, iconLeft, iconUp, iconDown } from './assets';\nimport { PlayerIcon } from './icon';\nimport { ControllerEventEnum, ControllerTypeEnum } from './constant';\nimport type { ComponentOptions } from '../../interface';\n\nexport class Controller extends AbstractComponent<Required<ControllerAttributes>> {\n static defaultControllerAttr: ISymbolGraphicAttribute = {\n visible: true,\n x: 0,\n y: 0,\n size: 20,\n fill: '#91caff',\n pickMode: 'imprecise',\n cursor: 'pointer'\n };\n static defaultAttributes: ControllerAttributes = {\n [ControllerTypeEnum.Start]: {},\n [ControllerTypeEnum.Pause]: {},\n [ControllerTypeEnum.Backward]: {},\n [ControllerTypeEnum.Forward]: {}\n };\n\n private _isPaused = true;\n private _playController: PlayerIcon;\n private _forwardController: PlayerIcon;\n private _backwardController: PlayerIcon;\n\n private _layout: LayoutType;\n private _startAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _pauseAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _forwardAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _backwardAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n\n constructor(attributes: ControllerAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Controller.defaultAttributes, attributes));\n this.updateAttributes();\n this._initPlay();\n this._initBackward();\n this._initForward();\n this._initEvents();\n }\n\n updateAttributes = () => {\n this._startAttr = {\n style: {\n symbolType: iconPlay,\n ...Controller.defaultControllerAttr,\n visible: this.attribute.start.visible,\n ...this.attribute.start.style\n }\n };\n this._pauseAttr = {\n style: {\n symbolType: iconPause,\n ...Controller.defaultControllerAttr,\n visible: this.attribute.pause.visible,\n ...this.attribute.pause.style\n }\n };\n this._forwardAttr = {\n style: {\n ...Controller.defaultControllerAttr,\n visible: this.attribute.forward.visible,\n ...this.attribute.forward.style\n }\n };\n this._backwardAttr = {\n style: {\n ...Controller.defaultControllerAttr,\n visible: this.attribute.backward.visible,\n ...this.attribute.backward.style\n }\n };\n this.updateLayout();\n };\n\n private updateLayout = () => {\n this._layout = this.attribute.layout;\n // 若水平布局\n if (this._layout === 'horizontal') {\n this._backwardAttr.style.symbolType = this._backwardAttr.style.symbolType ?? iconLeft;\n this._forwardAttr.style.symbolType = this._forwardAttr.style.symbolType ?? iconRight;\n }\n // 若垂直布局\n else if (this._layout === 'vertical') {\n this._backwardAttr.style.symbolType = this._backwardAttr.style.symbolType ?? iconUp;\n this._forwardAttr.style.symbolType = this._forwardAttr.style.symbolType ?? iconDown;\n }\n };\n\n private _initPlay = () => {\n if (isNil(this._playController)) {\n this._playController = new PlayerIcon({\n ...this._startAttr.style\n });\n\n this.add(this._playController);\n }\n };\n\n private _initBackward = () => {\n if (isNil(this._backwardController)) {\n this._backwardController = new PlayerIcon({\n ...this._backwardAttr.style\n });\n\n this.add(this._backwardController);\n }\n };\n\n private _initForward = () => {\n if (isNil(this._forwardController)) {\n this._forwardController = new PlayerIcon({\n ...this._forwardAttr.style\n });\n\n this.add(this._forwardController);\n }\n };\n\n /**\n * 初始化事件\n * 1. 注册\n */\n private _initEvents = () => {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n this._playController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n\n if (this._isPaused === true) {\n this.play();\n } else {\n this.pause();\n }\n });\n\n this._backwardController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.backward();\n });\n\n this._forwardController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.forward();\n });\n };\n\n render(): void {\n this.updateAttributes();\n this.renderPlay();\n this.renderBackward();\n this.renderForward();\n }\n\n renderPlay = () => {\n if (this._isPaused) {\n this._playController.setAttributes({\n symbolType: this._playController.getComputedAttribute('symbolType'),\n ...this._startAttr.style\n });\n } else {\n this._playController.setAttributes({\n symbolType: this._playController.getComputedAttribute('symbolType'),\n ...this._pauseAttr.style\n });\n }\n };\n\n renderBackward = () => {\n this._backwardController.setAttributes(this._backwardAttr.style);\n };\n\n renderForward = () => {\n this._forwardController.setAttributes(this._forwardAttr.style);\n };\n\n play = () => {\n this._dispatchEvent(ControllerEventEnum.OnPlay);\n };\n\n pause = () => {\n this._dispatchEvent(ControllerEventEnum.OnPause);\n };\n\n forward = () => {\n this._dispatchEvent(ControllerEventEnum.OnForward);\n };\n\n backward = () => {\n this._dispatchEvent(ControllerEventEnum.OnBackward);\n };\n\n togglePlay = () => {\n this._playController.setAttributes(this._startAttr.style);\n this._isPaused = true;\n };\n\n togglePause = () => {\n this._playController.setAttributes(this._pauseAttr.style);\n this._isPaused = false;\n };\n}\n"]}
|
package/es/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const version = "0.18.11-alpha.
|
|
1
|
+
export declare const version = "0.18.11-alpha.1";
|
|
2
2
|
export * from './core/base';
|
|
3
3
|
export * from './core/type';
|
|
4
4
|
export * from './scrollbar';
|
|
@@ -23,5 +23,4 @@ export * from './tooltip';
|
|
|
23
23
|
export * from './interface';
|
|
24
24
|
export * from './jsx';
|
|
25
25
|
export * from './checkbox';
|
|
26
|
-
export * from './radio';
|
|
27
26
|
export * from './util';
|
package/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const version = "0.18.11-alpha.
|
|
1
|
+
export const version = "0.18.11-alpha.1";
|
|
2
2
|
|
|
3
3
|
export * from "./core/base";
|
|
4
4
|
|
|
@@ -48,7 +48,5 @@ export * from "./jsx";
|
|
|
48
48
|
|
|
49
49
|
export * from "./checkbox";
|
|
50
50
|
|
|
51
|
-
export * from "./radio";
|
|
52
|
-
|
|
53
51
|
export * from "./util";
|
|
54
52
|
//# sourceMappingURL=index.js.map
|
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,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
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,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.18.11-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 './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './util';\n"]}
|
package/es/jsx/component-type.js
CHANGED
package/es/jsx/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./component-type";
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/es/label/index.js
CHANGED
package/es/label/line.js
CHANGED
package/es/label/util.js
CHANGED
package/es/link-path/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { iconRight, iconPause, iconPlay, iconLeft, iconUp, iconDown } from "./as
|
|
|
6
6
|
|
|
7
7
|
import { PlayerIcon } from "./icon";
|
|
8
8
|
|
|
9
|
-
import { ControllerTypeEnum } from "./constant";
|
|
9
|
+
import { ControllerEventEnum, ControllerTypeEnum } from "./constant";
|
|
10
10
|
|
|
11
11
|
export class Controller extends AbstractComponent {
|
|
12
12
|
constructor(attributes, options) {
|
|
@@ -66,13 +66,13 @@ export class Controller extends AbstractComponent {
|
|
|
66
66
|
}, this.renderForward = () => {
|
|
67
67
|
this._forwardController.setAttributes(this._forwardAttr.style);
|
|
68
68
|
}, this.play = () => {
|
|
69
|
-
this._dispatchEvent(
|
|
69
|
+
this._dispatchEvent(ControllerEventEnum.OnPlay);
|
|
70
70
|
}, this.pause = () => {
|
|
71
|
-
this._dispatchEvent(
|
|
71
|
+
this._dispatchEvent(ControllerEventEnum.OnPause);
|
|
72
72
|
}, this.forward = () => {
|
|
73
|
-
this._dispatchEvent(
|
|
73
|
+
this._dispatchEvent(ControllerEventEnum.OnForward);
|
|
74
74
|
}, this.backward = () => {
|
|
75
|
-
this._dispatchEvent(
|
|
75
|
+
this._dispatchEvent(ControllerEventEnum.OnBackward);
|
|
76
76
|
}, this.togglePlay = () => {
|
|
77
77
|
this._playController.setAttributes(this._startAttr.style), this._isPaused = !0;
|
|
78
78
|
}, this.togglePause = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/player/controller/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGhD,MAAM,OAAO,UAAW,SAAQ,iBAAiD;IA4B/E,YAAY,UAAgC,EAAE,OAA0B;QACtE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,UAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAZzF,cAAS,GAAG,IAAI,CAAC;QAoBzB,qBAAgB,GAAG,GAAG,EAAE;YACtB,IAAI,CAAC,UAAU,GAAG;gBAChB,KAAK,8CACH,UAAU,EAAE,QAAQ,IACjB,UAAU,CAAC,qBAAqB,KACnC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,KAClC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAC9B;aACF,CAAC;YACF,IAAI,CAAC,UAAU,GAAG;gBAChB,KAAK,8CACH,UAAU,EAAE,SAAS,IAClB,UAAU,CAAC,qBAAqB,KACnC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,KAClC,IAAI,CAAC,SAAS,CAAC,KAAK,CA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E,EAAE;IACjC,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAAE;CACjC,CAAC","file":"controller.js","sourcesContent":["import { isNil, merge } from '@visactor/vutils';\nimport type { FederatedPointerEvent, ISymbolGraphicAttribute } from '@visactor/vrender-core';\nimport { AbstractComponent } from '../../core/base';\nimport type { BaseGraphicAttributes } from '../../core/type';\nimport type { ControllerAttributes, LayoutType } from './type';\nimport { iconRight, iconPause, iconPlay, iconLeft, iconUp, iconDown } from './assets';\nimport { PlayerIcon } from './icon';\nimport { ControllerTypeEnum } from './constant';\nimport type { ComponentOptions } from '../../interface';\n\nexport class Controller extends AbstractComponent<Required<ControllerAttributes>> {\n static defaultControllerAttr: ISymbolGraphicAttribute = {\n visible: true,\n x: 0,\n y: 0,\n size: 20,\n fill: '#91caff',\n pickMode: 'imprecise',\n cursor: 'pointer'\n };\n static defaultAttributes: ControllerAttributes = {\n [ControllerTypeEnum.Start]: {},\n [ControllerTypeEnum.Pause]: {},\n [ControllerTypeEnum.Backward]: {},\n [ControllerTypeEnum.Forward]: {}\n };\n\n private _isPaused = true;\n private _playController: PlayerIcon;\n private _forwardController: PlayerIcon;\n private _backwardController: PlayerIcon;\n\n private _layout: LayoutType;\n private _startAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _pauseAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _forwardAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _backwardAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n\n constructor(attributes: ControllerAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Controller.defaultAttributes, attributes));\n this.updateAttributes();\n this._initPlay();\n this._initBackward();\n this._initForward();\n this._initEvents();\n }\n\n updateAttributes = () => {\n this._startAttr = {\n style: {\n symbolType: iconPlay,\n ...Controller.defaultControllerAttr,\n visible: this.attribute.start.visible,\n ...this.attribute.start.style\n }\n };\n this._pauseAttr = {\n style: {\n symbolType: iconPause,\n ...Controller.defaultControllerAttr,\n visible: this.attribute.pause.visible,\n ...this.attribute.pause.style\n }\n };\n this._forwardAttr = {\n style: {\n ...Controller.defaultControllerAttr,\n visible: this.attribute.forward.visible,\n ...this.attribute.forward.style\n }\n };\n this._backwardAttr = {\n style: {\n ...Controller.defaultControllerAttr,\n visible: this.attribute.backward.visible,\n ...this.attribute.backward.style\n }\n };\n this.updateLayout();\n };\n\n private updateLayout = () => {\n this._layout = this.attribute.layout;\n // 若水平布局\n if (this._layout === 'horizontal') {\n this._backwardAttr.style.symbolType = this._backwardAttr.style.symbolType ?? iconLeft;\n this._forwardAttr.style.symbolType = this._forwardAttr.style.symbolType ?? iconRight;\n }\n // 若垂直布局\n else if (this._layout === 'vertical') {\n this._backwardAttr.style.symbolType = this._backwardAttr.style.symbolType ?? iconUp;\n this._forwardAttr.style.symbolType = this._forwardAttr.style.symbolType ?? iconDown;\n }\n };\n\n private _initPlay = () => {\n if (isNil(this._playController)) {\n this._playController = new PlayerIcon({\n ...this._startAttr.style\n });\n\n this.add(this._playController);\n }\n };\n\n private _initBackward = () => {\n if (isNil(this._backwardController)) {\n this._backwardController = new PlayerIcon({\n ...this._backwardAttr.style\n });\n\n this.add(this._backwardController);\n }\n };\n\n private _initForward = () => {\n if (isNil(this._forwardController)) {\n this._forwardController = new PlayerIcon({\n ...this._forwardAttr.style\n });\n\n this.add(this._forwardController);\n }\n };\n\n /**\n * 初始化事件\n * 1. 注册\n */\n private _initEvents = () => {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n this._playController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n\n if (this._isPaused === true) {\n this.play();\n } else {\n this.pause();\n }\n });\n\n this._backwardController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.backward();\n });\n\n this._forwardController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.forward();\n });\n };\n\n render(): void {\n this.updateAttributes();\n this.renderPlay();\n this.renderBackward();\n this.renderForward();\n }\n\n renderPlay = () => {\n if (this._isPaused) {\n this._playController.setAttributes({\n symbolType: this._playController.getComputedAttribute('symbolType'),\n ...this._startAttr.style\n });\n } else {\n this._playController.setAttributes({\n symbolType: this._playController.getComputedAttribute('symbolType'),\n ...this._pauseAttr.style\n });\n }\n };\n\n renderBackward = () => {\n this._backwardController.setAttributes(this._backwardAttr.style);\n };\n\n renderForward = () => {\n this._forwardController.setAttributes(this._forwardAttr.style);\n };\n\n play = () => {\n this._dispatchEvent('ControllerEventEnum.OnPlay');\n };\n\n pause = () => {\n this._dispatchEvent('ControllerEventEnum.OnPause');\n };\n\n forward = () => {\n this._dispatchEvent('ControllerEventEnum.OnForward');\n };\n\n backward = () => {\n this._dispatchEvent('ControllerEventEnum.OnBackward');\n };\n\n togglePlay = () => {\n this._playController.setAttributes(this._startAttr.style);\n this._isPaused = true;\n };\n\n togglePause = () => {\n this._playController.setAttributes(this._pauseAttr.style);\n this._isPaused = false;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/player/controller/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrE,MAAM,OAAO,UAAW,SAAQ,iBAAiD;IA4B/E,YAAY,UAAgC,EAAE,OAA0B;QACtE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE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,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IA6GD,MAAM;QACJ,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;;AApJM,gCAAqB,GAA4B;IACtD,OAAO,EAAE,IAAI;IACb,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,SAAS;IACf,QAAQ,EAAE,WAAW;IACrB,MAAM,EAAE,SAAS;CAClB,CAAC;AACK,4BAAiB,GAAyB;IAC/C,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE;IAC9B,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,EAAE;IAC9B,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,EAAE;IACjC,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAAE;CACjC,CAAC","file":"controller.js","sourcesContent":["import { isNil, merge } from '@visactor/vutils';\nimport type { FederatedPointerEvent, ISymbolGraphicAttribute } from '@visactor/vrender-core';\nimport { AbstractComponent } from '../../core/base';\nimport type { BaseGraphicAttributes } from '../../core/type';\nimport type { ControllerAttributes, LayoutType } from './type';\nimport { iconRight, iconPause, iconPlay, iconLeft, iconUp, iconDown } from './assets';\nimport { PlayerIcon } from './icon';\nimport { ControllerEventEnum, ControllerTypeEnum } from './constant';\nimport type { ComponentOptions } from '../../interface';\n\nexport class Controller extends AbstractComponent<Required<ControllerAttributes>> {\n static defaultControllerAttr: ISymbolGraphicAttribute = {\n visible: true,\n x: 0,\n y: 0,\n size: 20,\n fill: '#91caff',\n pickMode: 'imprecise',\n cursor: 'pointer'\n };\n static defaultAttributes: ControllerAttributes = {\n [ControllerTypeEnum.Start]: {},\n [ControllerTypeEnum.Pause]: {},\n [ControllerTypeEnum.Backward]: {},\n [ControllerTypeEnum.Forward]: {}\n };\n\n private _isPaused = true;\n private _playController: PlayerIcon;\n private _forwardController: PlayerIcon;\n private _backwardController: PlayerIcon;\n\n private _layout: LayoutType;\n private _startAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _pauseAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _forwardAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n private _backwardAttr: BaseGraphicAttributes<ISymbolGraphicAttribute>;\n\n constructor(attributes: ControllerAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Controller.defaultAttributes, attributes));\n this.updateAttributes();\n this._initPlay();\n this._initBackward();\n this._initForward();\n this._initEvents();\n }\n\n updateAttributes = () => {\n this._startAttr = {\n style: {\n symbolType: iconPlay,\n ...Controller.defaultControllerAttr,\n visible: this.attribute.start.visible,\n ...this.attribute.start.style\n }\n };\n this._pauseAttr = {\n style: {\n symbolType: iconPause,\n ...Controller.defaultControllerAttr,\n visible: this.attribute.pause.visible,\n ...this.attribute.pause.style\n }\n };\n this._forwardAttr = {\n style: {\n ...Controller.defaultControllerAttr,\n visible: this.attribute.forward.visible,\n ...this.attribute.forward.style\n }\n };\n this._backwardAttr = {\n style: {\n ...Controller.defaultControllerAttr,\n visible: this.attribute.backward.visible,\n ...this.attribute.backward.style\n }\n };\n this.updateLayout();\n };\n\n private updateLayout = () => {\n this._layout = this.attribute.layout;\n // 若水平布局\n if (this._layout === 'horizontal') {\n this._backwardAttr.style.symbolType = this._backwardAttr.style.symbolType ?? iconLeft;\n this._forwardAttr.style.symbolType = this._forwardAttr.style.symbolType ?? iconRight;\n }\n // 若垂直布局\n else if (this._layout === 'vertical') {\n this._backwardAttr.style.symbolType = this._backwardAttr.style.symbolType ?? iconUp;\n this._forwardAttr.style.symbolType = this._forwardAttr.style.symbolType ?? iconDown;\n }\n };\n\n private _initPlay = () => {\n if (isNil(this._playController)) {\n this._playController = new PlayerIcon({\n ...this._startAttr.style\n });\n\n this.add(this._playController);\n }\n };\n\n private _initBackward = () => {\n if (isNil(this._backwardController)) {\n this._backwardController = new PlayerIcon({\n ...this._backwardAttr.style\n });\n\n this.add(this._backwardController);\n }\n };\n\n private _initForward = () => {\n if (isNil(this._forwardController)) {\n this._forwardController = new PlayerIcon({\n ...this._forwardAttr.style\n });\n\n this.add(this._forwardController);\n }\n };\n\n /**\n * 初始化事件\n * 1. 注册\n */\n private _initEvents = () => {\n if (this.attribute.disableTriggerEvent) {\n return;\n }\n this._playController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n\n if (this._isPaused === true) {\n this.play();\n } else {\n this.pause();\n }\n });\n\n this._backwardController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.backward();\n });\n\n this._forwardController.addEventListener('pointerdown', (e: FederatedPointerEvent) => {\n e.stopPropagation();\n this.forward();\n });\n };\n\n render(): void {\n this.updateAttributes();\n this.renderPlay();\n this.renderBackward();\n this.renderForward();\n }\n\n renderPlay = () => {\n if (this._isPaused) {\n this._playController.setAttributes({\n symbolType: this._playController.getComputedAttribute('symbolType'),\n ...this._startAttr.style\n });\n } else {\n this._playController.setAttributes({\n symbolType: this._playController.getComputedAttribute('symbolType'),\n ...this._pauseAttr.style\n });\n }\n };\n\n renderBackward = () => {\n this._backwardController.setAttributes(this._backwardAttr.style);\n };\n\n renderForward = () => {\n this._forwardController.setAttributes(this._forwardAttr.style);\n };\n\n play = () => {\n this._dispatchEvent(ControllerEventEnum.OnPlay);\n };\n\n pause = () => {\n this._dispatchEvent(ControllerEventEnum.OnPause);\n };\n\n forward = () => {\n this._dispatchEvent(ControllerEventEnum.OnForward);\n };\n\n backward = () => {\n this._dispatchEvent(ControllerEventEnum.OnBackward);\n };\n\n togglePlay = () => {\n this._playController.setAttributes(this._startAttr.style);\n this._isPaused = true;\n };\n\n togglePause = () => {\n this._playController.setAttributes(this._pauseAttr.style);\n this._isPaused = false;\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-components",
|
|
3
|
-
"version": "0.18.11-alpha.
|
|
3
|
+
"version": "0.18.11-alpha.1",
|
|
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.18.11-alpha.
|
|
16
|
-
"@visactor/vrender-kits": "0.18.11-alpha.
|
|
15
|
+
"@visactor/vrender-core": "0.18.11-alpha.1",
|
|
16
|
+
"@visactor/vrender-kits": "0.18.11-alpha.1",
|
|
17
17
|
"@visactor/vutils": "~0.18.1",
|
|
18
18
|
"@visactor/vscale": "~0.17.3"
|
|
19
19
|
},
|
package/cjs/radio/index.d.ts
DELETED
package/cjs/radio/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
4
|
-
void 0 === k2 && (k2 = k);
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = {
|
|
7
|
-
enumerable: !0,
|
|
8
|
-
get: function() {
|
|
9
|
-
return m[k];
|
|
10
|
-
}
|
|
11
|
-
}), Object.defineProperty(o, k2, desc);
|
|
12
|
-
} : function(o, m, k, k2) {
|
|
13
|
-
void 0 === k2 && (k2 = k), o[k2] = m[k];
|
|
14
|
-
}), __exportStar = this && this.__exportStar || function(m, exports) {
|
|
15
|
-
for (var p in m) "default" === p || Object.prototype.hasOwnProperty.call(exports, p) || __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
Object.defineProperty(exports, "__esModule", {
|
|
19
|
-
value: !0
|
|
20
|
-
}), __exportStar(require("./radio"), exports), __exportStar(require("./type"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
package/cjs/radio/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/radio/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,yCAAuB","file":"index.js","sourcesContent":["export * from './radio';\nexport * from './type';\n"]}
|
package/cjs/radio/radio.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AbstractComponent } from '../core/base';
|
|
2
|
-
import type { RadioAttributes } from './type';
|
|
3
|
-
import { Arc, WrapText } from '@visactor/vrender-core';
|
|
4
|
-
import type { ComponentOptions } from '../interface';
|
|
5
|
-
export declare class Radio extends AbstractComponent<Required<RadioAttributes>> {
|
|
6
|
-
static defaultAttributes: Partial<RadioAttributes>;
|
|
7
|
-
_circle: Arc;
|
|
8
|
-
_text: WrapText;
|
|
9
|
-
constructor(attributes: RadioAttributes, options?: ComponentOptions);
|
|
10
|
-
render(): void;
|
|
11
|
-
renderCircle(): void;
|
|
12
|
-
renderText(): void;
|
|
13
|
-
renderGroup(): void;
|
|
14
|
-
layout(): void;
|
|
15
|
-
private _handlePointerUp;
|
|
16
|
-
}
|
package/cjs/radio/radio.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.Radio = void 0;
|
|
6
|
-
|
|
7
|
-
const vutils_1 = require("@visactor/vutils"), base_1 = require("../core/base"), vrender_core_1 = require("@visactor/vrender-core"), register_1 = require("./register");
|
|
8
|
-
|
|
9
|
-
(0, register_1.loadRadioComponent)();
|
|
10
|
-
|
|
11
|
-
class Radio extends base_1.AbstractComponent {
|
|
12
|
-
constructor(attributes, options) {
|
|
13
|
-
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, Radio.defaultAttributes, attributes)),
|
|
14
|
-
this._handlePointerUp = () => {
|
|
15
|
-
this.attribute.disabled || this.attribute.checked || (this.setAttribute("checked", !0),
|
|
16
|
-
this._dispatchEvent("radio_checked", {
|
|
17
|
-
eventType: "radio_checked",
|
|
18
|
-
target: this
|
|
19
|
-
}));
|
|
20
|
-
}, this.renderGroup(), this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
21
|
-
"interactive" in val && this.setAttribute("pickable", val.interactive), "disabled" in val && this.setAttribute("cursor", val.disable ? this.attribute.disableCursor : this.attribute.cursor);
|
|
22
|
-
}, this.addEventListener("pointerup", this._handlePointerUp);
|
|
23
|
-
}
|
|
24
|
-
render() {
|
|
25
|
-
this.removeAllChild(!0), this.renderCircle(), this.renderText(), this.layout();
|
|
26
|
-
}
|
|
27
|
-
renderCircle() {
|
|
28
|
-
this._circle = new vrender_core_1.Arc((0, vutils_1.merge)({}, this.attribute.circle));
|
|
29
|
-
const isChecked = this.attribute.checked;
|
|
30
|
-
isChecked && this.attribute.disabled ? this._circle.setAttributes({
|
|
31
|
-
fill: this.attribute.circle.disableCheckedFill,
|
|
32
|
-
stroke: this.attribute.circle.disableCheckedStroke
|
|
33
|
-
}) : isChecked && this._circle.setAttributes({
|
|
34
|
-
fill: this.attribute.circle.checkedFill,
|
|
35
|
-
stroke: this.attribute.circle.checkedStroke
|
|
36
|
-
}), this.appendChild(this._circle);
|
|
37
|
-
}
|
|
38
|
-
renderText() {
|
|
39
|
-
this._text = new vrender_core_1.WrapText((0, vutils_1.merge)({}, this.attribute.text)),
|
|
40
|
-
this.attribute.disabled && this._text.setAttribute("fill", this.attribute.text.disableFill),
|
|
41
|
-
this.appendChild(this._text);
|
|
42
|
-
}
|
|
43
|
-
renderGroup() {
|
|
44
|
-
this.attribute.interactive || this.setAttribute("pickable", !1), this.attribute.disabled && this.setAttribute("cursor", this.attribute.disableCursor);
|
|
45
|
-
}
|
|
46
|
-
layout() {
|
|
47
|
-
const circleHeight = 2 * this.attribute.circle.outerRadius, textHeight = this._text.AABBBounds.height(), maxHeight = Math.max(circleHeight, textHeight), circleY = maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius, textY = maxHeight / 2 - textHeight / 2, circleWidth = 2 * this.attribute.circle.outerRadius, circleX = this.attribute.circle.outerRadius, textX = circleWidth + this.attribute.spaceBetweenTextAndIcon;
|
|
48
|
-
this._circle.setAttributes({
|
|
49
|
-
x: circleX,
|
|
50
|
-
y: circleY
|
|
51
|
-
}), this._text.setAttributes({
|
|
52
|
-
x: textX,
|
|
53
|
-
y: textY
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
exports.Radio = Radio, Radio.defaultAttributes = {
|
|
59
|
-
interactive: !0,
|
|
60
|
-
disabled: !1,
|
|
61
|
-
checked: !1,
|
|
62
|
-
cursor: "pointer",
|
|
63
|
-
disableCursor: "not-allowed",
|
|
64
|
-
spaceBetweenTextAndIcon: 8,
|
|
65
|
-
text: {
|
|
66
|
-
text: "text",
|
|
67
|
-
fontSize: 14,
|
|
68
|
-
fill: "#000",
|
|
69
|
-
disableFill: "rgb(201,205,212)",
|
|
70
|
-
textBaseline: "top",
|
|
71
|
-
pickable: !1
|
|
72
|
-
},
|
|
73
|
-
circle: {
|
|
74
|
-
outerRadius: 7,
|
|
75
|
-
innerRadius: 3,
|
|
76
|
-
startAngle: 0,
|
|
77
|
-
endAngle: 2 * Math.PI,
|
|
78
|
-
fill: "#fff",
|
|
79
|
-
stroke: "rgb(229,230,235)",
|
|
80
|
-
disableFill: "rgb(242,243,245)",
|
|
81
|
-
checkedFill: "rgb(22, 93, 255)",
|
|
82
|
-
checkedStroke: "rgb(22, 93, 255)",
|
|
83
|
-
disableCheckedFill: "rgb(148, 191, 255)",
|
|
84
|
-
disableCheckedStroke: "rgb(148, 191, 255)",
|
|
85
|
-
pickable: !1
|
|
86
|
-
}
|
|
87
|
-
};
|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AAC;YACzB,CAAC,EAAE,OAAO;YACV,CAAC,EAAE,OAAO;SACX,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;YACvB,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,KAAK;SACT,CAAC,CAAC;IACL,CAAC;;AAhHH,sBA8HC;AA7HQ,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,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 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 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 * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(circleHeight, textHeight);\n const circleY = maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const circleWidth = this.attribute.circle.outerRadius * 2;\n const circleX = this.attribute.circle.outerRadius;\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}\n"]}
|
package/cjs/radio/register.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function loadRadioComponent(): void;
|
package/cjs/radio/register.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: !0
|
|
5
|
-
}), exports.loadRadioComponent = void 0;
|
|
6
|
-
|
|
7
|
-
const vrender_kits_1 = require("@visactor/vrender-kits");
|
|
8
|
-
|
|
9
|
-
function loadRadioComponent() {
|
|
10
|
-
(0, vrender_kits_1.registerGroup)(), (0, vrender_kits_1.registerRect)(), (0, vrender_kits_1.registerWrapText)(),
|
|
11
|
-
(0, vrender_kits_1.registerImage)();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
exports.loadRadioComponent = loadRadioComponent;
|
|
15
|
-
//# sourceMappingURL=register.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/radio/register.ts"],"names":[],"mappings":";;;AAAA,yDAAsG;AAEtG,SAAgB,kBAAkB;IAChC,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,+BAAgB,GAAE,CAAC;IACnB,IAAA,4BAAa,GAAE,CAAC;AAClB,CAAC;AALD,gDAKC","file":"register.js","sourcesContent":["import { registerGroup, registerImage, registerRect, registerWrapText } from '@visactor/vrender-kits';\n\nexport function loadRadioComponent() {\n registerGroup();\n registerRect();\n registerWrapText();\n registerImage();\n}\n"]}
|
package/cjs/radio/type.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Cursor, IArcGraphicAttribute, IColor, IGroupGraphicAttribute, IWrapTextGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
-
export type RadioText = {
|
|
3
|
-
disableFill?: IColor;
|
|
4
|
-
} & IWrapTextGraphicAttribute;
|
|
5
|
-
export type CircleStyle = {
|
|
6
|
-
disableFill?: IColor;
|
|
7
|
-
checkedFill?: IColor;
|
|
8
|
-
checkedStroke?: IColor;
|
|
9
|
-
disableCheckedFill?: IColor;
|
|
10
|
-
disableCheckedStroke?: IColor;
|
|
11
|
-
} & IArcGraphicAttribute;
|
|
12
|
-
export type RadioAttributes = IGroupGraphicAttribute & {
|
|
13
|
-
id?: string;
|
|
14
|
-
interactive?: boolean;
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
checked?: boolean;
|
|
17
|
-
text?: RadioText;
|
|
18
|
-
circle?: CircleStyle;
|
|
19
|
-
disableCursor?: Cursor;
|
|
20
|
-
spaceBetweenTextAndIcon?: number;
|
|
21
|
-
};
|
package/cjs/radio/type.js
DELETED
package/cjs/radio/type.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/radio/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n Cursor,\n IArcGraphicAttribute,\n IColor,\n IGroupGraphicAttribute,\n IWrapTextGraphicAttribute\n} from '@visactor/vrender-core';\n\nexport type RadioText = {\n disableFill?: IColor;\n} & IWrapTextGraphicAttribute;\n\nexport type CircleStyle = {\n disableFill?: IColor;\n checkedFill?: IColor;\n checkedStroke?: IColor;\n disableCheckedFill?: IColor;\n disableCheckedStroke?: IColor;\n} & IArcGraphicAttribute;\n\nexport type RadioAttributes = IGroupGraphicAttribute & {\n id?: string;\n\n interactive?: boolean;\n disabled?: boolean;\n checked?: boolean;\n\n /**\n * 图例文字\n */\n text?: RadioText;\n /**\n * 图例选中图标\n */\n circle?: CircleStyle;\n /**\n * 图例选中图标\n */\n disableCursor?: Cursor;\n spaceBetweenTextAndIcon?: number;\n};\n"]}
|
package/es/radio/index.d.ts
DELETED
package/es/radio/index.js
DELETED
package/es/radio/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/radio/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["export * from './radio';\nexport * from './type';\n"]}
|
package/es/radio/radio.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AbstractComponent } from '../core/base';
|
|
2
|
-
import type { RadioAttributes } from './type';
|
|
3
|
-
import { Arc, WrapText } from '@visactor/vrender-core';
|
|
4
|
-
import type { ComponentOptions } from '../interface';
|
|
5
|
-
export declare class Radio extends AbstractComponent<Required<RadioAttributes>> {
|
|
6
|
-
static defaultAttributes: Partial<RadioAttributes>;
|
|
7
|
-
_circle: Arc;
|
|
8
|
-
_text: WrapText;
|
|
9
|
-
constructor(attributes: RadioAttributes, options?: ComponentOptions);
|
|
10
|
-
render(): void;
|
|
11
|
-
renderCircle(): void;
|
|
12
|
-
renderText(): void;
|
|
13
|
-
renderGroup(): void;
|
|
14
|
-
layout(): void;
|
|
15
|
-
private _handlePointerUp;
|
|
16
|
-
}
|
package/es/radio/radio.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { merge } from "@visactor/vutils";
|
|
2
|
-
|
|
3
|
-
import { AbstractComponent } from "../core/base";
|
|
4
|
-
|
|
5
|
-
import { Arc, WrapText } from "@visactor/vrender-core";
|
|
6
|
-
|
|
7
|
-
import { loadRadioComponent } from "./register";
|
|
8
|
-
|
|
9
|
-
loadRadioComponent();
|
|
10
|
-
|
|
11
|
-
export class Radio extends AbstractComponent {
|
|
12
|
-
constructor(attributes, options) {
|
|
13
|
-
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, Radio.defaultAttributes, attributes)),
|
|
14
|
-
this._handlePointerUp = () => {
|
|
15
|
-
this.attribute.disabled || this.attribute.checked || (this.setAttribute("checked", !0),
|
|
16
|
-
this._dispatchEvent("radio_checked", {
|
|
17
|
-
eventType: "radio_checked",
|
|
18
|
-
target: this
|
|
19
|
-
}));
|
|
20
|
-
}, this.renderGroup(), this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
21
|
-
"interactive" in val && this.setAttribute("pickable", val.interactive), "disabled" in val && this.setAttribute("cursor", val.disable ? this.attribute.disableCursor : this.attribute.cursor);
|
|
22
|
-
}, this.addEventListener("pointerup", this._handlePointerUp);
|
|
23
|
-
}
|
|
24
|
-
render() {
|
|
25
|
-
this.removeAllChild(!0), this.renderCircle(), this.renderText(), this.layout();
|
|
26
|
-
}
|
|
27
|
-
renderCircle() {
|
|
28
|
-
this._circle = new Arc(merge({}, this.attribute.circle));
|
|
29
|
-
const isChecked = this.attribute.checked;
|
|
30
|
-
isChecked && this.attribute.disabled ? this._circle.setAttributes({
|
|
31
|
-
fill: this.attribute.circle.disableCheckedFill,
|
|
32
|
-
stroke: this.attribute.circle.disableCheckedStroke
|
|
33
|
-
}) : isChecked && this._circle.setAttributes({
|
|
34
|
-
fill: this.attribute.circle.checkedFill,
|
|
35
|
-
stroke: this.attribute.circle.checkedStroke
|
|
36
|
-
}), this.appendChild(this._circle);
|
|
37
|
-
}
|
|
38
|
-
renderText() {
|
|
39
|
-
this._text = new WrapText(merge({}, this.attribute.text)), this.attribute.disabled && this._text.setAttribute("fill", this.attribute.text.disableFill),
|
|
40
|
-
this.appendChild(this._text);
|
|
41
|
-
}
|
|
42
|
-
renderGroup() {
|
|
43
|
-
this.attribute.interactive || this.setAttribute("pickable", !1), this.attribute.disabled && this.setAttribute("cursor", this.attribute.disableCursor);
|
|
44
|
-
}
|
|
45
|
-
layout() {
|
|
46
|
-
const circleHeight = 2 * this.attribute.circle.outerRadius, textHeight = this._text.AABBBounds.height(), maxHeight = Math.max(circleHeight, textHeight), circleY = maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius, textY = maxHeight / 2 - textHeight / 2, circleWidth = 2 * this.attribute.circle.outerRadius, circleX = this.attribute.circle.outerRadius, textX = circleWidth + this.attribute.spaceBetweenTextAndIcon;
|
|
47
|
-
this._circle.setAttributes({
|
|
48
|
-
x: circleX,
|
|
49
|
-
y: circleY
|
|
50
|
-
}), this._text.setAttributes({
|
|
51
|
-
x: textX,
|
|
52
|
-
y: textY
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
Radio.defaultAttributes = {
|
|
58
|
-
interactive: !0,
|
|
59
|
-
disabled: !1,
|
|
60
|
-
checked: !1,
|
|
61
|
-
cursor: "pointer",
|
|
62
|
-
disableCursor: "not-allowed",
|
|
63
|
-
spaceBetweenTextAndIcon: 8,
|
|
64
|
-
text: {
|
|
65
|
-
text: "text",
|
|
66
|
-
fontSize: 14,
|
|
67
|
-
fill: "#000",
|
|
68
|
-
disableFill: "rgb(201,205,212)",
|
|
69
|
-
textBaseline: "top",
|
|
70
|
-
pickable: !1
|
|
71
|
-
},
|
|
72
|
-
circle: {
|
|
73
|
-
outerRadius: 7,
|
|
74
|
-
innerRadius: 3,
|
|
75
|
-
startAngle: 0,
|
|
76
|
-
endAngle: 2 * Math.PI,
|
|
77
|
-
fill: "#fff",
|
|
78
|
-
stroke: "rgb(229,230,235)",
|
|
79
|
-
disableFill: "rgb(242,243,245)",
|
|
80
|
-
checkedFill: "rgb(22, 93, 255)",
|
|
81
|
-
checkedStroke: "rgb(22, 93, 255)",
|
|
82
|
-
disableCheckedFill: "rgb(148, 191, 255)",
|
|
83
|
-
disableCheckedStroke: "rgb(148, 191, 255)",
|
|
84
|
-
pickable: !1
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
//# sourceMappingURL=radio.js.map
|
package/es/radio/radio.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;IAkCrE,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;QA+EpF,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;QACL,CAAC,CAAC;QAzFA,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,IAAI,CAAC,uBAAuB,GAAG,CAAC,GAAQ,EAAE,UAAe,EAAE,GAA6B,EA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bstractComponent } 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 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 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 * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(circleHeight, textHeight);\n const circleY = maxHeight / 2 - circleHeight / 2 + this.attribute.circle.outerRadius;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const circleWidth = this.attribute.circle.outerRadius * 2;\n const circleX = this.attribute.circle.outerRadius;\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}\n"]}
|
package/es/radio/register.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function loadRadioComponent(): void;
|
package/es/radio/register.js
DELETED
package/es/radio/register.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/radio/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEtG,MAAM,UAAU,kBAAkB;IAChC,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,CAAC;IACf,gBAAgB,EAAE,CAAC;IACnB,aAAa,EAAE,CAAC;AAClB,CAAC","file":"register.js","sourcesContent":["import { registerGroup, registerImage, registerRect, registerWrapText } from '@visactor/vrender-kits';\n\nexport function loadRadioComponent() {\n registerGroup();\n registerRect();\n registerWrapText();\n registerImage();\n}\n"]}
|
package/es/radio/type.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Cursor, IArcGraphicAttribute, IColor, IGroupGraphicAttribute, IWrapTextGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
-
export type RadioText = {
|
|
3
|
-
disableFill?: IColor;
|
|
4
|
-
} & IWrapTextGraphicAttribute;
|
|
5
|
-
export type CircleStyle = {
|
|
6
|
-
disableFill?: IColor;
|
|
7
|
-
checkedFill?: IColor;
|
|
8
|
-
checkedStroke?: IColor;
|
|
9
|
-
disableCheckedFill?: IColor;
|
|
10
|
-
disableCheckedStroke?: IColor;
|
|
11
|
-
} & IArcGraphicAttribute;
|
|
12
|
-
export type RadioAttributes = IGroupGraphicAttribute & {
|
|
13
|
-
id?: string;
|
|
14
|
-
interactive?: boolean;
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
checked?: boolean;
|
|
17
|
-
text?: RadioText;
|
|
18
|
-
circle?: CircleStyle;
|
|
19
|
-
disableCursor?: Cursor;
|
|
20
|
-
spaceBetweenTextAndIcon?: number;
|
|
21
|
-
};
|
package/es/radio/type.js
DELETED
package/es/radio/type.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/radio/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n Cursor,\n IArcGraphicAttribute,\n IColor,\n IGroupGraphicAttribute,\n IWrapTextGraphicAttribute\n} from '@visactor/vrender-core';\n\nexport type RadioText = {\n disableFill?: IColor;\n} & IWrapTextGraphicAttribute;\n\nexport type CircleStyle = {\n disableFill?: IColor;\n checkedFill?: IColor;\n checkedStroke?: IColor;\n disableCheckedFill?: IColor;\n disableCheckedStroke?: IColor;\n} & IArcGraphicAttribute;\n\nexport type RadioAttributes = IGroupGraphicAttribute & {\n id?: string;\n\n interactive?: boolean;\n disabled?: boolean;\n checked?: boolean;\n\n /**\n * 图例文字\n */\n text?: RadioText;\n /**\n * 图例选中图标\n */\n circle?: CircleStyle;\n /**\n * 图例选中图标\n */\n disableCursor?: Cursor;\n spaceBetweenTextAndIcon?: number;\n};\n"]}
|