@visactor/vrender-components 0.16.0 → 0.17.0-alpha.8
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/checkbox/checkbox.d.ts +17 -0
- package/cjs/checkbox/checkbox.js +102 -0
- package/cjs/checkbox/checkbox.js.map +1 -0
- package/cjs/checkbox/index.d.ts +2 -0
- package/cjs/checkbox/index.js +21 -0
- package/cjs/checkbox/index.js.map +1 -0
- package/cjs/checkbox/type.d.ts +22 -0
- package/cjs/checkbox/type.js +5 -0
- package/cjs/checkbox/type.js.map +1 -0
- package/cjs/crosshair/base.js +2 -1
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +2 -2
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/index.js +1 -2
- package/cjs/jsx/component-type.js +2 -1
- package/cjs/legend/constant.js +1 -2
- package/cjs/link-path/index.js +2 -1
- package/cjs/marker/config.js +1 -1
- package/cjs/marker/index.js +1 -1
- package/cjs/marker/line.js +1 -1
- package/dist/index.js +145 -1
- package/dist/index.min.js +1 -1
- package/es/checkbox/checkbox.d.ts +17 -0
- package/es/checkbox/checkbox.js +99 -0
- package/es/checkbox/checkbox.js.map +1 -0
- package/es/checkbox/index.d.ts +2 -0
- package/es/checkbox/index.js +4 -0
- package/es/checkbox/index.js.map +1 -0
- package/es/checkbox/type.d.ts +22 -0
- package/es/checkbox/type.js +1 -0
- package/es/checkbox/type.js.map +1 -0
- package/es/crosshair/base.js +2 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +3 -1
- package/es/index.js.map +1 -1
- package/es/indicator/index.js +1 -2
- package/es/jsx/component-type.js +2 -1
- package/es/legend/constant.js +1 -2
- package/es/link-path/index.js +2 -1
- package/es/marker/config.js +1 -1
- package/es/marker/index.js +1 -1
- package/es/marker/line.js +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AbstractComponent } from '../core/base';
|
|
2
|
+
import type { CheckboxAttributes } from './type';
|
|
3
|
+
import { Image, Rect, WrapText } from '@visactor/vrender-core';
|
|
4
|
+
export declare class CheckBox extends AbstractComponent<Required<CheckboxAttributes>> {
|
|
5
|
+
static defaultAttributes: Partial<CheckboxAttributes>;
|
|
6
|
+
_box: Rect;
|
|
7
|
+
_icon: Image;
|
|
8
|
+
_text: WrapText;
|
|
9
|
+
constructor(attributes: CheckboxAttributes);
|
|
10
|
+
render(): void;
|
|
11
|
+
renderBox(): void;
|
|
12
|
+
renderIcon(): void;
|
|
13
|
+
renderText(): void;
|
|
14
|
+
renderGroup(): void;
|
|
15
|
+
layout(): void;
|
|
16
|
+
handleClick(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { merge } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
import { AbstractComponent } from "../core/base";
|
|
4
|
+
|
|
5
|
+
import { CustomEvent, Image, Rect, WrapText } from "@visactor/vrender-core";
|
|
6
|
+
|
|
7
|
+
const svg = '<svg width="200" height="200" viewBox="0 0 1024 1024" fill="#fff" xmlns="http://www.w3.org/2000/svg"><path d="M877.44815445 206.10060629a64.72691371 64.72691371 0 0 0-95.14856334 4.01306852L380.73381888 685.46812814 235.22771741 533.48933518a64.72691371 64.72691371 0 0 0-92.43003222-1.03563036l-45.82665557 45.82665443a64.72691371 64.72691371 0 0 0-0.90617629 90.61767965l239.61903446 250.10479331a64.72691371 64.72691371 0 0 0 71.19960405 15.14609778 64.33855261 64.33855261 0 0 0 35.08198741-21.23042702l36.24707186-42.71976334 40.5190474-40.77795556-3.36579926-3.49525333 411.40426297-486.74638962a64.72691371 64.72691371 0 0 0-3.88361443-87.64024149l-45.3088404-45.43829334z"></path></svg>';
|
|
8
|
+
|
|
9
|
+
export class CheckBox extends AbstractComponent {
|
|
10
|
+
constructor(attributes) {
|
|
11
|
+
super(merge({}, CheckBox.defaultAttributes, attributes)), this.renderGroup(), this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
12
|
+
"interactive" in val && this.setAttribute("pickable", val.interactive), "disabled" in val && this.setAttribute("cursor", val.disable ? this.attribute.disableCursor : this.attribute.cursor);
|
|
13
|
+
}, this.addEventListener("click", this.handleClick);
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
this.removeAllChild(), this.renderBox(), this.renderIcon(), this.renderText(), this.layout();
|
|
17
|
+
}
|
|
18
|
+
renderBox() {
|
|
19
|
+
this._box = new Rect(merge({}, this.attribute.box)), this.attribute.checked && this.attribute.disabled ? this._box.setAttributes({
|
|
20
|
+
fill: this.attribute.box.disableCheckedFill,
|
|
21
|
+
stroke: this.attribute.box.disableCheckedStroke
|
|
22
|
+
}) : this.attribute.checked && this._box.setAttributes({
|
|
23
|
+
fill: this.attribute.box.checkedFill,
|
|
24
|
+
stroke: this.attribute.box.checkedStroke
|
|
25
|
+
}), this.appendChild(this._box);
|
|
26
|
+
}
|
|
27
|
+
renderIcon() {
|
|
28
|
+
this._icon = new Image(merge({}, this.attribute.icon)), this.attribute.checked || this._icon.setAttribute("visible", !1),
|
|
29
|
+
this.appendChild(this._icon);
|
|
30
|
+
}
|
|
31
|
+
renderText() {
|
|
32
|
+
this._text = new WrapText(merge({}, this.attribute.text)), this.attribute.disabled && this._text.setAttribute("fill", this.attribute.text.disableFill),
|
|
33
|
+
this.appendChild(this._text);
|
|
34
|
+
}
|
|
35
|
+
renderGroup() {
|
|
36
|
+
this.attribute.interactive || this.setAttribute("pickable", !1), this.attribute.disabled && this.setAttribute("cursor", this.attribute.disableCursor);
|
|
37
|
+
}
|
|
38
|
+
layout() {
|
|
39
|
+
const boxHeight = this.attribute.box.height, iconHeight = this.attribute.icon.height, textHeight = this._text.AABBBounds.height(), maxHeight = Math.max(boxHeight, iconHeight, textHeight), boxY = maxHeight / 2 - boxHeight / 2, iconY = maxHeight / 2 - iconHeight / 2, textY = maxHeight / 2 - textHeight / 2, boxWidth = this.attribute.box.width, iconWidth = this.attribute.icon.width, maxWidth = Math.max(boxWidth, iconWidth), boxX = maxWidth / 2 - boxWidth / 2, iconX = maxWidth / 2 - iconWidth / 2, textX = maxWidth + this.attribute.spaceBetweenTextAndIcon;
|
|
40
|
+
this._box.setAttributes({
|
|
41
|
+
x: boxX,
|
|
42
|
+
y: boxY
|
|
43
|
+
}), this._icon.setAttributes({
|
|
44
|
+
x: iconX,
|
|
45
|
+
y: iconY
|
|
46
|
+
}), this._text.setAttributes({
|
|
47
|
+
x: textX,
|
|
48
|
+
y: textY
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
handleClick() {
|
|
52
|
+
var _a;
|
|
53
|
+
if (this.attribute.disabled) return;
|
|
54
|
+
this.attribute.checked ? this.setAttribute("checked", !1) : this.setAttribute("checked", !0);
|
|
55
|
+
const changeEvent = new CustomEvent("checkbox_state_change", {
|
|
56
|
+
eventType: "checkbox_state_change",
|
|
57
|
+
checked: this.attribute.checked
|
|
58
|
+
});
|
|
59
|
+
changeEvent.manager = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem.manager,
|
|
60
|
+
this.dispatchEvent(changeEvent);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
CheckBox.defaultAttributes = {
|
|
65
|
+
interactive: !0,
|
|
66
|
+
disabled: !1,
|
|
67
|
+
checked: !1,
|
|
68
|
+
cursor: "pointer",
|
|
69
|
+
disableCursor: "not-allowed",
|
|
70
|
+
spaceBetweenTextAndIcon: 8,
|
|
71
|
+
text: {
|
|
72
|
+
text: "text",
|
|
73
|
+
fontSize: 14,
|
|
74
|
+
fill: "#000",
|
|
75
|
+
disableFill: "rgb(201,205,212)",
|
|
76
|
+
textBaseline: "top",
|
|
77
|
+
pickable: !1
|
|
78
|
+
},
|
|
79
|
+
icon: {
|
|
80
|
+
image: svg,
|
|
81
|
+
width: 10,
|
|
82
|
+
height: 10,
|
|
83
|
+
pickable: !1
|
|
84
|
+
},
|
|
85
|
+
box: {
|
|
86
|
+
width: 14,
|
|
87
|
+
height: 14,
|
|
88
|
+
cornerRadius: 2,
|
|
89
|
+
fill: "#fff",
|
|
90
|
+
stroke: "rgb(229,230,235)",
|
|
91
|
+
disableFill: "rgb(242,243,245)",
|
|
92
|
+
checkedFill: "rgb(22, 93, 255)",
|
|
93
|
+
checkedStroke: "rgb(22, 93, 255)",
|
|
94
|
+
disableCheckedFill: "rgb(148, 191, 255)",
|
|
95
|
+
disableCheckedStroke: "rgb(148, 191, 255)",
|
|
96
|
+
pickable: !1
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +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,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE5E,MAAM,GAAG,GACP,wrBAAwrB,CAAC;AAE3rB,MAAM,OAAO,QAAS,SAAQ,iBAA+C;IAwC3E,YAAY,UAA8B;QACxC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,IAAI,CAAC,uBAAuB,GAAG,CAAC,GAAQ,EAAE,UAAe,EAAE,GAA6B,EAAE,EAAE;YAC1F,IAAI,aAAa,IAAI,GAAG,EAAE;gBACxB,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;aAChD;YACD,IAAI,UAAU,IAAI,GAAG,EAAE;gBACrB,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CA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,WAAW,GAAG,IAAI,WAAW,CAAC,uBAAuB,EAAE;YAC3D,SAAS,EAAE,uBAAuB;YAClC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO;SACrB,CAAQ,CAAC;QACrB,WAAW,CAAC,OAAO,GAAG,MAAC,IAAI,CAAC,KAAa,0CAAE,WAAW,CAAC,OAAO,CAAC;QAC/D,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;;AAtJM,0BAAiB,GAAgC;IACtD,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,IAAI,EAAE;QACJ,KAAK,EAAE,GAAG;QACV,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 { CustomEvent, Image, Rect, WrapText } from '@visactor/vrender-core';\n\nconst svg =\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\nexport class CheckBox extends AbstractComponent<Required<CheckboxAttributes>> {\n static defaultAttributes: Partial<CheckboxAttributes> = {\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 icon: {\n image: svg,\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 _icon: Image;\n _text: WrapText;\n\n constructor(attributes: CheckboxAttributes) {\n super(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('click', this.handleClick);\n }\n\n render() {\n this.removeAllChild();\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 if (this.attribute.checked && this.attribute.disabled) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill,\n stroke: this.attribute.box.disableCheckedStroke\n });\n } else if (this.attribute.checked) {\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._icon = new Image(merge({}, this.attribute.icon));\n if (!this.attribute.checked) {\n this._icon.setAttribute('visible', false);\n }\n this.appendChild(this._icon);\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 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._icon.setAttributes({\n x: iconX,\n y: iconY\n });\n this._text.setAttributes({\n x: textX,\n y: textY\n });\n }\n\n handleClick() {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n } else {\n this.setAttribute('checked', true);\n }\n const changeEvent = new CustomEvent('checkbox_state_change', {\n eventType: 'checkbox_state_change',\n checked: this.attribute.checked\n } as unknown) as any;\n changeEvent.manager = (this.stage as any)?.eventSystem.manager;\n this.dispatchEvent(changeEvent);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/checkbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["export * from './checkbox';\nexport * from './type';\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Cursor, IColor, IGroupGraphicAttribute, IImageGraphicAttribute, IRectGraphicAttribute, IWrapTextGraphicAttribute } from '@visactor/vrender-core';
|
|
2
|
+
export type CheckboxText = {
|
|
3
|
+
disableFill?: IColor;
|
|
4
|
+
} & IWrapTextGraphicAttribute;
|
|
5
|
+
export type CheckboxIcon = IImageGraphicAttribute;
|
|
6
|
+
export type CheckboxRect = {
|
|
7
|
+
disableFill?: IColor;
|
|
8
|
+
checkedFill?: IColor;
|
|
9
|
+
checkedStroke?: IColor;
|
|
10
|
+
disableCheckedFill?: IColor;
|
|
11
|
+
disableCheckedStroke?: IColor;
|
|
12
|
+
} & IRectGraphicAttribute;
|
|
13
|
+
export type CheckboxAttributes = IGroupGraphicAttribute & {
|
|
14
|
+
interactive?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
text?: CheckboxText;
|
|
18
|
+
icon?: CheckboxIcon;
|
|
19
|
+
box?: CheckboxRect;
|
|
20
|
+
disableCursor?: Cursor;
|
|
21
|
+
spaceBetweenTextAndIcon?: number;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/checkbox/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n Cursor,\n IColor,\n IGroupGraphicAttribute,\n IImageGraphicAttribute,\n IRectGraphicAttribute,\n IWrapTextGraphicAttribute\n} from '@visactor/vrender-core';\n\nexport type CheckboxText = {\n disableFill?: IColor;\n} & IWrapTextGraphicAttribute;\n\nexport type CheckboxIcon = IImageGraphicAttribute;\n\nexport type CheckboxRect = {\n disableFill?: IColor;\n checkedFill?: IColor;\n checkedStroke?: IColor;\n disableCheckedFill?: IColor;\n disableCheckedStroke?: IColor;\n} & IRectGraphicAttribute;\n\nexport type CheckboxAttributes = IGroupGraphicAttribute & {\n interactive?: boolean;\n disabled?: boolean;\n checked?: boolean;\n /**\n * 图例文字\n */\n text?: CheckboxText;\n /**\n * 图例选中图标\n */\n icon?: CheckboxIcon;\n /**\n * 图例选中图标\n */\n box?: CheckboxRect;\n disableCursor?: Cursor;\n spaceBetweenTextAndIcon?: number;\n};\n"]}
|
package/es/crosshair/base.js
CHANGED
package/es/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.17.0-alpha.8";
|
|
2
2
|
export * from './core/base';
|
|
3
3
|
export * from './scrollbar';
|
|
4
4
|
export * from './tag';
|
|
@@ -21,3 +21,4 @@ export * from './brush';
|
|
|
21
21
|
export * from './tooltip';
|
|
22
22
|
export * from './interface';
|
|
23
23
|
export * from './jsx';
|
|
24
|
+
export * from './checkbox';
|
package/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const version = "0.
|
|
1
|
+
export const version = "0.17.0-alpha.8";
|
|
2
2
|
|
|
3
3
|
export * from "./core/base";
|
|
4
4
|
|
|
@@ -43,4 +43,6 @@ export * from "./tooltip";
|
|
|
43
43
|
export * from "./interface";
|
|
44
44
|
|
|
45
45
|
export * from "./jsx";
|
|
46
|
+
|
|
47
|
+
export * from "./checkbox";
|
|
46
48
|
//# 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,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,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","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.17.0-alpha.8\";\n\nexport * from './core/base';\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';\n"]}
|
package/es/indicator/index.js
CHANGED
package/es/jsx/component-type.js
CHANGED
package/es/legend/constant.js
CHANGED
|
@@ -36,5 +36,4 @@ export var LEGEND_ELEMENT_NAME;
|
|
|
36
36
|
LEGEND_ELEMENT_NAME.item = "legendItem", LEGEND_ELEMENT_NAME.itemShape = "legendItemShape",
|
|
37
37
|
LEGEND_ELEMENT_NAME.itemLabel = "legendItemLabel", LEGEND_ELEMENT_NAME.itemValue = "legendItemValue",
|
|
38
38
|
LEGEND_ELEMENT_NAME.focus = "legendItemFocus";
|
|
39
|
-
}(LEGEND_ELEMENT_NAME || (LEGEND_ELEMENT_NAME = {}));
|
|
40
|
-
//# sourceMappingURL=constant.js.map
|
|
39
|
+
}(LEGEND_ELEMENT_NAME || (LEGEND_ELEMENT_NAME = {}));
|
package/es/link-path/index.js
CHANGED
package/es/marker/config.js
CHANGED
package/es/marker/index.js
CHANGED
package/es/marker/line.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vrender-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0-alpha.8",
|
|
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.
|
|
16
|
-
"@visactor/vrender-kits": "0.
|
|
15
|
+
"@visactor/vrender-core": "0.17.0-alpha.8",
|
|
16
|
+
"@visactor/vrender-kits": "0.17.0-alpha.8",
|
|
17
17
|
"@visactor/vutils": "~0.16.0",
|
|
18
18
|
"@visactor/vscale": "~0.16.0"
|
|
19
19
|
},
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"eslint": "~8.18.0",
|
|
29
29
|
"vite": "3.2.6",
|
|
30
30
|
"typescript": "4.9.5",
|
|
31
|
-
"@internal/ts-config": "0.0.1",
|
|
32
31
|
"@internal/bundler": "0.0.1",
|
|
33
|
-
"@internal/eslint-config": "0.0.1"
|
|
32
|
+
"@internal/eslint-config": "0.0.1",
|
|
33
|
+
"@internal/ts-config": "0.0.1"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"VisActor",
|