@visactor/vrender-components 1.0.9-alpha.2 → 1.0.9

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 (48) hide show
  1. package/cjs/axis/line.js +2 -1
  2. package/cjs/brush/config.js +1 -2
  3. package/cjs/index.d.ts +1 -2
  4. package/cjs/index.js +2 -3
  5. package/cjs/index.js.map +1 -1
  6. package/dist/index.es.js +6 -997
  7. package/es/axis/line.js +2 -1
  8. package/es/brush/config.js +1 -2
  9. package/es/index.d.ts +1 -2
  10. package/es/index.js +1 -3
  11. package/es/index.js.map +1 -1
  12. package/package.json +4 -4
  13. package/cjs/table-series-number/event-manager.d.ts +0 -16
  14. package/cjs/table-series-number/event-manager.js +0 -160
  15. package/cjs/table-series-number/event-manager.js.map +0 -1
  16. package/cjs/table-series-number/index.d.ts +0 -2
  17. package/cjs/table-series-number/index.js +0 -21
  18. package/cjs/table-series-number/index.js.map +0 -1
  19. package/cjs/table-series-number/register.d.ts +0 -1
  20. package/cjs/table-series-number/register.js +0 -14
  21. package/cjs/table-series-number/register.js.map +0 -1
  22. package/cjs/table-series-number/table-series-number.d.ts +0 -76
  23. package/cjs/table-series-number/table-series-number.js +0 -534
  24. package/cjs/table-series-number/table-series-number.js.map +0 -1
  25. package/cjs/table-series-number/tools.d.ts +0 -1
  26. package/cjs/table-series-number/tools.js +0 -14
  27. package/cjs/table-series-number/tools.js.map +0 -1
  28. package/cjs/table-series-number/type.d.ts +0 -80
  29. package/cjs/table-series-number/type.js +0 -17
  30. package/cjs/table-series-number/type.js.map +0 -1
  31. package/es/table-series-number/event-manager.d.ts +0 -16
  32. package/es/table-series-number/event-manager.js +0 -154
  33. package/es/table-series-number/event-manager.js.map +0 -1
  34. package/es/table-series-number/index.d.ts +0 -2
  35. package/es/table-series-number/index.js +0 -4
  36. package/es/table-series-number/index.js.map +0 -1
  37. package/es/table-series-number/register.d.ts +0 -1
  38. package/es/table-series-number/register.js +0 -6
  39. package/es/table-series-number/register.js.map +0 -1
  40. package/es/table-series-number/table-series-number.d.ts +0 -76
  41. package/es/table-series-number/table-series-number.js +0 -542
  42. package/es/table-series-number/table-series-number.js.map +0 -1
  43. package/es/table-series-number/tools.d.ts +0 -1
  44. package/es/table-series-number/tools.js +0 -8
  45. package/es/table-series-number/tools.js.map +0 -1
  46. package/es/table-series-number/type.d.ts +0 -80
  47. package/es/table-series-number/type.js +0 -16
  48. package/es/table-series-number/type.js.map +0 -1
@@ -1,76 +0,0 @@
1
- import { AbstractComponent } from '../core/base';
2
- import type { TableSeriesNumberAttributes } from './type';
3
- import { TableSeriesNumberEventManager } from './event-manager';
4
- import type { IGroup } from '@visactor/vrender-core';
5
- import type { ComponentOptions } from '../interface';
6
- export declare class TableSeriesNumber extends AbstractComponent<Required<TableSeriesNumberAttributes>> {
7
- static defaultAttributes: Partial<TableSeriesNumberAttributes>;
8
- name: string;
9
- protected _tableSeriesNumberContainer: IGroup;
10
- _cornerGroup: IGroup;
11
- _rowSeriesNumberGroup: IGroup;
12
- _colSeriesNumberGroup: IGroup;
13
- _frozenTopRowSeriesNumberGroup: IGroup;
14
- _frozenLeftColSeriesNumberGroup: IGroup;
15
- _frozenRightColSeriesNumberGroup: IGroup;
16
- _frozenBottomRowSeriesNumberGroup: IGroup;
17
- _firstRowSeriesNumberIndex: number;
18
- _firstColSeriesNumberIndex: number;
19
- _maxTextWidth: number;
20
- _changeRowSeriesNumberWidthTimer: number;
21
- interactionState: {
22
- _lastHoverItem: IGroup;
23
- _lastClickItem: IGroup;
24
- selectIndexs?: Set<string>;
25
- };
26
- _parsedRowSeriesNumberCellPadding: number[];
27
- _parsedColSeriesNumberCellPadding: number[];
28
- initRenderAll: boolean;
29
- _eventManager: TableSeriesNumberEventManager;
30
- constructor(attributes: TableSeriesNumberAttributes, options?: ComponentOptions & {
31
- initRenderAll?: boolean;
32
- });
33
- get rowSeriesNumberWidth(): number;
34
- get colSeriesNumberHeight(): number;
35
- get rowCount(): number;
36
- get colCount(): number;
37
- protected bindEvents(): void;
38
- dispatchTableSeriesNumberEvent(event: any, ...args: any): void;
39
- render(): void;
40
- _renderContent(): void;
41
- _renderCorner(): void;
42
- _renderRowSeriesNumber(): void;
43
- _renderColSeriesNumber(): void;
44
- _renderFrozenTopRowSeriesNumber(): void;
45
- _renderFrozenLeftColSeriesNumber(): void;
46
- recreateCellsToRowSeriesNumberGroup(startIndex: number, endIndex: number): void;
47
- recreateCellsToColSeriesNumberGroup(startIndex: number, endIndex: number): void;
48
- changeRowSeriesNumberWidth(newWidth: number): void;
49
- getRowSeriesNumberCellGroup(index: number): any;
50
- getColSeriesNumberCellGroup(index: number): any;
51
- getRowSeriesNumberCellAttributes(index: number): any;
52
- getColSeriesNumberCellAttributes(index: number): any;
53
- setRowSeriesNumberCellAttributes(index: number, attributes: TableSeriesNumberAttributes): void;
54
- setColSeriesNumberCellAttributes(index: number, attributes: TableSeriesNumberAttributes): void;
55
- setRowSeriesNumberGroupAttributes(attributes: TableSeriesNumberAttributes): void;
56
- setColSeriesNumberGroupAttributes(attributes: TableSeriesNumberAttributes): void;
57
- addSelectedIndex(isRow: boolean, index: number): void;
58
- addRowSelectedRanges(ranges: {
59
- startIndex: number;
60
- endIndex: number;
61
- }[]): void;
62
- addColSelectedRanges(ranges: {
63
- startIndex: number;
64
- endIndex: number;
65
- }[]): void;
66
- addCornderSelected(): void;
67
- resetAllSelectedIndexs({ rowIndexs, colIndexs }: {
68
- rowIndexs?: number[];
69
- colIndexs?: number[];
70
- }): void;
71
- removeSelectedIndex(isRow: boolean, index: number): void;
72
- removeAllSelectedIndexs(): void;
73
- removeOneGroupSelected(group: IGroup): void;
74
- addOneGroupSelected(group: IGroup): void;
75
- renderSelectedIndexsState(): void;
76
- }
@@ -1,542 +0,0 @@
1
- import { generateColField } from "./tools";
2
-
3
- import { merge } from "@visactor/vutils";
4
-
5
- import { AbstractComponent } from "../core/base";
6
-
7
- import { SeriesNumberCellStateValue, SeriesNumberEvent } from "./type";
8
-
9
- import { TableSeriesNumberEventManager } from "./event-manager";
10
-
11
- import { parsePadding } from "@visactor/vrender-core";
12
-
13
- import { loadTableSeriesNumberComponent } from "./register";
14
-
15
- const cornerSvg = '<svg t="1716726614852" class="icon" viewBox="0 0 1194 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2621" width="200" height="200"><path d="M1038.694079 367.237067c13.265507 23.342857-16.633865-40.004445-63.05621-40.004446H219.018794c-26.558738 0-46.46393 13.334815-63.05621 40.004446S0.006238 607.277601 0.006238 650.608819V940.647979a82.351494 82.351494 0 0 0 82.961402 83.349526H1111.702885a82.337632 82.337632 0 0 0 82.975264-83.349526V650.608819c0-43.331218-155.970208-283.371753-155.970208-283.371752zM730.066575 667.284269a136.328386 136.328386 0 0 1-132.738243 133.33429 133.417459 133.417459 0 0 1-132.738243-133.33429v-6.681269a40.6698 40.6698 0 0 0-36.497473-26.66963H73.015044l119.458874-220.02445s23.231965-40.004445 53.103614-40.004446h713.481918c26.544876 0 29.871649 10.008042 46.436207 40.004446L1128.33675 633.947231H769.904682c-26.184476 0-39.838107 7.623855-39.838107 33.337038zM338.505391 210.559919l-89.601086-86.69016a22.178487 22.178487 0 0 1 0-33.26773 21.984425 21.984425 0 0 1 33.170699 0l89.601087 86.676299a22.317102 22.317102 0 0 1 0 33.26773 24.950798 24.950798 0 0 1-33.1707 0z m252.197118-40.059891a25.532983 25.532983 0 0 1-6.639685-16.633865l-3.326773-126.694606A28.263709 28.263709 0 0 1 603.995739 0.515788c13.251646-3.326773 23.204242 10.021904 26.544877 23.342858V153.866163a28.249847 28.249847 0 0 1-23.259688 26.66963c-6.611961-3.312911-13.279369-3.312911-16.578419-10.035765z m235.646421 33.337038a22.372548 22.372548 0 0 1 0-33.337038l86.288175-90.030795a22.039871 22.039871 0 0 1 33.170699 0 22.289379 22.289379 0 0 1 0 33.364761l-82.961401 90.003072a25.962691 25.962691 0 0 1-36.483611 0z" fill="#8a8a8a" p-id="2622"></path></svg>';
16
-
17
- loadTableSeriesNumberComponent();
18
-
19
- export class TableSeriesNumber extends AbstractComponent {
20
- constructor(attributes, options) {
21
- if (super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, TableSeriesNumber.defaultAttributes, attributes)),
22
- this.name = "tableSeriesNumber", this._firstRowSeriesNumberIndex = 0, this._firstColSeriesNumberIndex = 0,
23
- this._maxTextWidth = 0, this._changeRowSeriesNumberWidthTimer = null, this.interactionState = {
24
- selectIndexs: new Set,
25
- _lastHoverItem: null,
26
- _lastClickItem: null
27
- }, this._parsedRowSeriesNumberCellPadding = [ 0, 0, 0, 0 ], this._parsedColSeriesNumberCellPadding = [ 0, 0, 0, 0 ],
28
- this.initRenderAll = !1, this.initRenderAll = (null == options ? void 0 : options.initRenderAll) || !1,
29
- this._skipRenderAttributes.push("frozenTopRow"), this._skipRenderAttributes.push("frozenLeftCol"),
30
- this._skipRenderAttributes.push("frozenRightCol"), this._skipRenderAttributes.push("frozenBottomRow"),
31
- this._skipRenderAttributes.push("rowCount"), this._skipRenderAttributes.push("colCount"),
32
- this._skipRenderAttributes.push("hover"), this._skipRenderAttributes.push("select"),
33
- this.attribute.rowSeriesNumberCellStyle.text.padding) {
34
- const padding = parsePadding(this.attribute.rowSeriesNumberCellStyle.text.padding);
35
- this._parsedRowSeriesNumberCellPadding = "number" == typeof padding ? [ padding, padding, padding, padding ] : padding;
36
- }
37
- if (this.attribute.colSeriesNumberCellStyle.text.padding) {
38
- const padding = parsePadding(this.attribute.colSeriesNumberCellStyle.text.padding);
39
- this._parsedColSeriesNumberCellPadding = "number" == typeof padding ? [ padding, padding, padding, padding ] : padding;
40
- }
41
- this._eventManager = new TableSeriesNumberEventManager(this);
42
- }
43
- get rowSeriesNumberWidth() {
44
- const {rowSeriesNumberWidth: rowSeriesNumberWidth} = this.attribute;
45
- return this._maxTextWidth ? Math.max(this._maxTextWidth + this._parsedRowSeriesNumberCellPadding[3] + this._parsedRowSeriesNumberCellPadding[1], "number" == typeof rowSeriesNumberWidth ? rowSeriesNumberWidth : 40) : "number" == typeof rowSeriesNumberWidth ? rowSeriesNumberWidth : 40;
46
- }
47
- get colSeriesNumberHeight() {
48
- const {colSeriesNumberHeight: colSeriesNumberHeight} = this.attribute;
49
- return "number" == typeof colSeriesNumberHeight ? colSeriesNumberHeight : 20;
50
- }
51
- get rowCount() {
52
- const {rowCount: rowCount} = this.attribute;
53
- return rowCount;
54
- }
55
- get colCount() {
56
- const {colCount: colCount} = this.attribute;
57
- return colCount;
58
- }
59
- bindEvents() {
60
- this._eventManager.bindEvents();
61
- }
62
- dispatchTableSeriesNumberEvent(event, ...args) {
63
- this._dispatchEvent(event, ...args);
64
- }
65
- render() {
66
- const {rowCount: rowCount, colCount: colCount, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute, innerView = this.createOrUpdateChild("tableSeriesNumberContainer", {
67
- x: 0,
68
- y: 0,
69
- fill: "rgba(1,1,1,0)",
70
- width: this.rowSeriesNumberWidth + colCount * ("number" == typeof colWidth ? colWidth : 20),
71
- height: this.colSeriesNumberHeight + rowCount * ("number" == typeof rowHeight ? rowHeight : 20),
72
- pickable: !1,
73
- childrenPickable: !0
74
- }, "group");
75
- this._tableSeriesNumberContainer = innerView, this._renderContent();
76
- }
77
- _renderContent() {
78
- if (this._renderRowSeriesNumber(), this._renderColSeriesNumber(), this._renderFrozenTopRowSeriesNumber(),
79
- this._renderFrozenLeftColSeriesNumber(), this._renderCorner(), this.initRenderAll) {
80
- this.recreateCellsToRowSeriesNumberGroup(0, this.attribute.rowCount - 1), this.recreateCellsToColSeriesNumberGroup(0, this.attribute.colCount - 1);
81
- let y = 0;
82
- for (let i = 0; i < this.attribute.rowCount; i++) this.setRowSeriesNumberCellAttributes(i, {
83
- y: y,
84
- height: "number" == typeof this.attribute.rowHeight ? this.attribute.rowHeight : 20
85
- }), y += "number" == typeof this.attribute.rowHeight ? this.attribute.rowHeight : 20;
86
- let x = 0;
87
- for (let i = 0; i < this.attribute.colCount; i++) this.setColSeriesNumberCellAttributes(i, {
88
- x: x,
89
- width: "number" == typeof this.attribute.colWidth ? this.attribute.colWidth : 20
90
- }), x += "number" == typeof this.attribute.colWidth ? this.attribute.colWidth : 20;
91
- }
92
- }
93
- _renderCorner() {
94
- const {rowCount: rowCount, colCount: colCount, cornerCellStyle: cornerSeriesNumberCellStyle, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute, cornerGroup = this._tableSeriesNumberContainer.createOrUpdateChild("cornerSeriesNumberCell", {
95
- x: 0,
96
- y: 0,
97
- fill: cornerSeriesNumberCellStyle.bgColor,
98
- stroke: cornerSeriesNumberCellStyle.borderLine.stroke,
99
- lineWidth: cornerSeriesNumberCellStyle.borderLine.lineWidth,
100
- pickable: !0,
101
- width: this.rowSeriesNumberWidth,
102
- height: this.colSeriesNumberHeight
103
- }, "group");
104
- cornerGroup.id = "0,0", cornerGroup.states = cornerSeriesNumberCellStyle.states,
105
- this._cornerGroup = cornerGroup;
106
- }
107
- _renderRowSeriesNumber() {
108
- const {frozenRowCount: frozenRowCount, rowCount: rowCount, colCount: colCount, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute, rowSeriesNumberGroup = this._tableSeriesNumberContainer.createOrUpdateChild("rowSeriesNumberCellGroup", {
109
- x: 0,
110
- y: this.colSeriesNumberHeight,
111
- pickable: !0,
112
- fill: rowSeriesNumberCellStyle.bgColor,
113
- width: this.rowSeriesNumberWidth,
114
- height: rowCount * ("number" == typeof rowHeight ? rowHeight : 20)
115
- }, "group");
116
- this._rowSeriesNumberGroup = rowSeriesNumberGroup;
117
- }
118
- _renderColSeriesNumber() {
119
- const {frozenColCount: frozenColCount, rowCount: rowCount, colCount: colCount, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute, colSeriesNumberGroup = this._tableSeriesNumberContainer.createOrUpdateChild("colSeriesNumberCellGroup", {
120
- x: this.rowSeriesNumberWidth + frozenColCount * ("number" == typeof colWidth ? colWidth : 20),
121
- y: 0,
122
- pickable: !0,
123
- fill: colSeriesNumberCellStyle.bgColor,
124
- width: colCount * ("number" == typeof colWidth ? colWidth : 20),
125
- height: this.colSeriesNumberHeight
126
- }, "group");
127
- this._colSeriesNumberGroup = colSeriesNumberGroup;
128
- }
129
- _renderFrozenTopRowSeriesNumber() {
130
- const {frozenRowCount: frozenRowCount, colCount: colCount, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute, frozenTopSeriesNumberGroup = this._tableSeriesNumberContainer.createOrUpdateChild("frozenTopSeriesNumberGroup", {
131
- x: 0,
132
- y: this.colSeriesNumberHeight,
133
- width: this.rowSeriesNumberWidth,
134
- height: frozenRowCount * ("number" == typeof rowHeight ? rowHeight : 20)
135
- }, "group");
136
- this._frozenTopRowSeriesNumberGroup = frozenTopSeriesNumberGroup;
137
- }
138
- _renderFrozenLeftColSeriesNumber() {
139
- const {frozenColCount: frozenColCount, rowCount: rowCount, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute, frozenLeftSeriesNumberGroup = this._tableSeriesNumberContainer.createOrUpdateChild("frozenLeftSeriesNumberGroup", {
140
- x: this.rowSeriesNumberWidth,
141
- y: 0,
142
- height: this.colSeriesNumberHeight,
143
- width: frozenColCount * ("number" == typeof colWidth ? colWidth : 20)
144
- }, "group");
145
- this._frozenLeftColSeriesNumberGroup = frozenLeftSeriesNumberGroup;
146
- }
147
- recreateCellsToRowSeriesNumberGroup(startIndex, endIndex) {
148
- var _a, _b;
149
- const {frozenRowCount: frozenRowCount, rowCount: rowCount, colCount: colCount, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute;
150
- this._frozenTopRowSeriesNumberGroup.removeAllChild(), this._rowSeriesNumberGroup.removeAllChild();
151
- let y = 0;
152
- const height = ("number" == typeof rowHeight ? rowHeight : 20) - this._parsedRowSeriesNumberCellPadding[0] - this._parsedRowSeriesNumberCellPadding[2];
153
- let x;
154
- y = "middle" === rowSeriesNumberCellStyle.text.textBaseline ? this._parsedRowSeriesNumberCellPadding[0] + (height - rowSeriesNumberCellStyle.text.fontSize) / 2 : "bottom" === rowSeriesNumberCellStyle.text.textBaseline ? this._parsedRowSeriesNumberCellPadding[0] + height - rowSeriesNumberCellStyle.text.fontSize : this._parsedRowSeriesNumberCellPadding[0];
155
- const width = this.rowSeriesNumberWidth - this._parsedRowSeriesNumberCellPadding[3] - this._parsedRowSeriesNumberCellPadding[1], textAlign = this.attribute.rowSeriesNumberCellStyle.text.textAlign, padding = this._parsedRowSeriesNumberCellPadding;
156
- x = "center" === textAlign ? padding[3] + +width / 2 : "right" === textAlign ? padding[3] + width : padding[3];
157
- for (let i = 0; i < frozenRowCount; i++) {
158
- const cellGroup = this._frozenTopRowSeriesNumberGroup.createOrUpdateChild(`rowSeriesNumberCell-${i}`, {
159
- x: 0,
160
- y: 0,
161
- pickable: !0,
162
- fill: rowSeriesNumberCellStyle.bgColor,
163
- stroke: rowSeriesNumberCellStyle.borderLine.stroke,
164
- lineWidth: rowSeriesNumberCellStyle.borderLine.lineWidth,
165
- width: this.rowSeriesNumberWidth,
166
- height: "number" == typeof rowHeight ? rowHeight : 20
167
- }, "group");
168
- cellGroup.id = i, cellGroup.states = rowSeriesNumberCellStyle.states, (null === (_a = this.interactionState.selectIndexs) || void 0 === _a ? void 0 : _a.has(cellGroup.name)) && cellGroup.useStates([ SeriesNumberCellStateValue.select ]);
169
- cellGroup.createOrUpdateChild(`rowSeriesNumberCellText-${i}`, Object.assign(Object.assign({
170
- x: x,
171
- y: y,
172
- text: `${i + 1}`,
173
- pickable: !1,
174
- dx: 0
175
- }, rowSeriesNumberCellStyle.text), {
176
- textBaseline: "top"
177
- }), "text");
178
- }
179
- this._firstRowSeriesNumberIndex = Math.max(startIndex, frozenRowCount) - frozenRowCount;
180
- let thisTextMaxWidth = 0;
181
- for (let i = this._firstRowSeriesNumberIndex; i <= endIndex - frozenRowCount; i++) {
182
- const cellGroup = this._rowSeriesNumberGroup.createOrUpdateChild(`rowSeriesNumberCell-${i + frozenRowCount}`, {
183
- x: 0,
184
- y: 0,
185
- pickable: !0,
186
- fill: rowSeriesNumberCellStyle.bgColor,
187
- stroke: rowSeriesNumberCellStyle.borderLine.stroke,
188
- lineWidth: rowSeriesNumberCellStyle.borderLine.lineWidth,
189
- width: this.rowSeriesNumberWidth,
190
- height: "number" == typeof rowHeight ? rowHeight : 20
191
- }, "group");
192
- cellGroup.id = i + frozenRowCount, cellGroup.states = rowSeriesNumberCellStyle.states,
193
- (null === (_b = this.interactionState.selectIndexs) || void 0 === _b ? void 0 : _b.has(cellGroup.name)) && cellGroup.useStates([ SeriesNumberCellStateValue.select ]);
194
- const text = cellGroup.createOrUpdateChild(`rowSeriesNumberCellText-${i + frozenRowCount}`, Object.assign(Object.assign({
195
- x: x,
196
- y: y,
197
- text: `${i + 1 + frozenRowCount}`,
198
- pickable: !1,
199
- dx: 0
200
- }, rowSeriesNumberCellStyle.text), {
201
- textBaseline: "top"
202
- }), "text");
203
- i === endIndex - frozenRowCount && (thisTextMaxWidth = text.clipedWidth);
204
- }
205
- clearTimeout(this._changeRowSeriesNumberWidthTimer), this._changeRowSeriesNumberWidthTimer = setTimeout((() => {
206
- if (Math.abs(thisTextMaxWidth - this._maxTextWidth) >= 6) {
207
- const oldWidth = this._maxTextWidth;
208
- this._maxTextWidth = thisTextMaxWidth, this.changeRowSeriesNumberWidth(Math.max(this.rowSeriesNumberWidth, 20)),
209
- this._dispatchEvent(SeriesNumberEvent.rowSeriesNumberWidthChange, {
210
- newWidth: this.rowSeriesNumberWidth,
211
- oldWidth: oldWidth
212
- });
213
- }
214
- }), 100);
215
- }
216
- recreateCellsToColSeriesNumberGroup(startIndex, endIndex) {
217
- var _a, _b;
218
- const {colCount: colCount, colSeriesNumberCellStyle: colSeriesNumberCellStyle, frozenColCount: frozenColCount, colWidth: colWidth} = this.attribute;
219
- this._frozenLeftColSeriesNumberGroup.removeAllChild(), this._colSeriesNumberGroup.removeAllChild();
220
- let y = 0;
221
- const height = this.colSeriesNumberHeight - this._parsedColSeriesNumberCellPadding[0] - this._parsedColSeriesNumberCellPadding[2];
222
- let x;
223
- y = "middle" === colSeriesNumberCellStyle.text.textBaseline ? this._parsedColSeriesNumberCellPadding[0] + (height - colSeriesNumberCellStyle.text.fontSize) / 2 : "bottom" === colSeriesNumberCellStyle.text.textBaseline ? this._parsedColSeriesNumberCellPadding[0] + height - colSeriesNumberCellStyle.text.fontSize : this._parsedColSeriesNumberCellPadding[0];
224
- const width = ("number" == typeof colWidth ? colWidth : 20) - this._parsedColSeriesNumberCellPadding[3] - this._parsedColSeriesNumberCellPadding[1], textAlign = this.attribute.colSeriesNumberCellStyle.text.textAlign, padding = this._parsedColSeriesNumberCellPadding;
225
- x = "center" === textAlign ? padding[3] + +width / 2 : "right" === textAlign ? padding[3] + width : padding[3];
226
- for (let i = 0; i < frozenColCount; i++) {
227
- const cellGroup = this._frozenLeftColSeriesNumberGroup.createOrUpdateChild(`colSeriesNumberCell-${i}`, {
228
- x: 0,
229
- y: 0,
230
- pickable: !0,
231
- fill: colSeriesNumberCellStyle.bgColor,
232
- stroke: colSeriesNumberCellStyle.borderLine.stroke,
233
- lineWidth: colSeriesNumberCellStyle.borderLine.lineWidth,
234
- width: "number" == typeof colWidth ? colWidth : 20,
235
- height: this.colSeriesNumberHeight
236
- }, "group");
237
- cellGroup.id = i, cellGroup.states = colSeriesNumberCellStyle.states, (null === (_a = this.interactionState.selectIndexs) || void 0 === _a ? void 0 : _a.has(cellGroup.name)) && cellGroup.useStates([ SeriesNumberCellStateValue.select ]);
238
- cellGroup.createOrUpdateChild(`colSeriesNumberCellText-${i}`, Object.assign(Object.assign({
239
- x: x,
240
- y: y,
241
- dx: 0,
242
- text: generateColField(i),
243
- pickable: !1
244
- }, colSeriesNumberCellStyle.text), {
245
- textBaseline: "top"
246
- }), "text");
247
- }
248
- this._firstColSeriesNumberIndex = Math.max(startIndex, frozenColCount) - frozenColCount;
249
- for (let i = this._firstColSeriesNumberIndex; i <= endIndex - frozenColCount; i++) {
250
- const cellGroup = this._colSeriesNumberGroup.createOrUpdateChild(`colSeriesNumberCell-${i + frozenColCount}`, {
251
- x: 0,
252
- y: 0,
253
- pickable: !0,
254
- fill: colSeriesNumberCellStyle.bgColor,
255
- stroke: colSeriesNumberCellStyle.borderLine.stroke,
256
- lineWidth: colSeriesNumberCellStyle.borderLine.lineWidth,
257
- width: "number" == typeof colWidth ? colWidth : 20,
258
- height: this.colSeriesNumberHeight
259
- }, "group");
260
- cellGroup.id = i + frozenColCount, cellGroup.states = colSeriesNumberCellStyle.states,
261
- (null === (_b = this.interactionState.selectIndexs) || void 0 === _b ? void 0 : _b.has(cellGroup.name)) && cellGroup.useStates([ SeriesNumberCellStateValue.select ]);
262
- cellGroup.createOrUpdateChild(`colSeriesNumberCellText-${i + frozenColCount}`, Object.assign(Object.assign({
263
- x: x,
264
- y: y,
265
- dx: 0,
266
- text: generateColField(i + frozenColCount),
267
- pickable: !1
268
- }, colSeriesNumberCellStyle.text), {
269
- textBaseline: "top"
270
- }), "text");
271
- }
272
- }
273
- changeRowSeriesNumberWidth(newWidth) {
274
- const {rowHeight: rowHeight, rowCount: oldRowCount, frozenRowCount: frozenRowCount, frozenColCount: frozenLeftCol, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle} = this.attribute;
275
- this._cornerGroup.setAttributes({
276
- width: newWidth
277
- }), this._frozenTopRowSeriesNumberGroup.setAttributes({
278
- width: newWidth
279
- });
280
- for (let i = 0; i < this._frozenTopRowSeriesNumberGroup.children.length; i++) this.setRowSeriesNumberCellAttributes(i, {
281
- width: newWidth
282
- });
283
- this._rowSeriesNumberGroup.setAttributes({
284
- width: newWidth
285
- });
286
- for (let i = 0; i < this._rowSeriesNumberGroup.children.length; i++) this.setRowSeriesNumberCellAttributes(i + this._firstRowSeriesNumberIndex + frozenRowCount, {
287
- width: newWidth
288
- });
289
- this._frozenLeftColSeriesNumberGroup.setAttributes({
290
- x: newWidth
291
- }), this._colSeriesNumberGroup.setAttributes({
292
- x: newWidth + this._frozenLeftColSeriesNumberGroup.getAttributes().width
293
- });
294
- }
295
- getRowSeriesNumberCellGroup(index) {
296
- const {frozenRowCount: frozenRowCount} = this.getAttributes();
297
- if (index >= 0 && index < frozenRowCount) return this._frozenTopRowSeriesNumberGroup.children[index];
298
- return this._rowSeriesNumberGroup.children[index - frozenRowCount - this._firstRowSeriesNumberIndex];
299
- }
300
- getColSeriesNumberCellGroup(index) {
301
- const {frozenColCount: frozenColCount} = this.getAttributes();
302
- if (index >= 0 && index < frozenColCount) return this._frozenLeftColSeriesNumberGroup.children[index];
303
- return this._colSeriesNumberGroup.children[index - frozenColCount - this._firstColSeriesNumberIndex];
304
- }
305
- getRowSeriesNumberCellAttributes(index) {
306
- const {frozenRowCount: frozenRowCount} = this.getAttributes();
307
- if (index >= 0 && index < frozenRowCount) return this._frozenTopRowSeriesNumberGroup.children[index].attribute;
308
- return this._rowSeriesNumberGroup.children[index - frozenRowCount - this._firstRowSeriesNumberIndex].attribute;
309
- }
310
- getColSeriesNumberCellAttributes(index) {
311
- const {frozenColCount: frozenColCount} = this.getAttributes();
312
- if (index >= 0 && index < frozenColCount) return this._frozenLeftColSeriesNumberGroup.children[index].attribute;
313
- return this._colSeriesNumberGroup.children[index - frozenColCount - this._firstColSeriesNumberIndex].attribute;
314
- }
315
- setRowSeriesNumberCellAttributes(index, attributes) {
316
- const {frozenRowCount: frozenRowCount} = this.getAttributes();
317
- let targetCellGroup;
318
- if (index >= 0 && index < frozenRowCount) {
319
- const {height: oldHeight, width: oldWidth, y: y} = this._frozenTopRowSeriesNumberGroup.getAttributes();
320
- targetCellGroup = this._frozenTopRowSeriesNumberGroup.children[index], targetCellGroup.setAttributes(attributes),
321
- attributes.height && this._frozenTopRowSeriesNumberGroup.setAttributes({
322
- height: this._frozenTopRowSeriesNumberGroup.getAttributes().height + (attributes.height - oldHeight)
323
- }), attributes.width && this._frozenTopRowSeriesNumberGroup.setAttributes({
324
- width: this._frozenTopRowSeriesNumberGroup.getAttributes().width + (attributes.width - oldWidth)
325
- }), attributes.height && this._rowSeriesNumberGroup.setAttributes({
326
- y: this._frozenTopRowSeriesNumberGroup.getAttributes().height + this._frozenTopRowSeriesNumberGroup.getAttributes().y
327
- });
328
- } else {
329
- targetCellGroup = this._rowSeriesNumberGroup.children[index - frozenRowCount - this._firstRowSeriesNumberIndex],
330
- targetCellGroup.setAttributes(attributes);
331
- }
332
- if (attributes.width) {
333
- let x;
334
- const width = attributes.width - this._parsedRowSeriesNumberCellPadding[3] - this._parsedRowSeriesNumberCellPadding[1], textAlign = this.attribute.rowSeriesNumberCellStyle.text.textAlign, padding = this._parsedRowSeriesNumberCellPadding;
335
- x = "center" === textAlign ? padding[3] + +width / 2 : "right" === textAlign ? padding[3] + width : padding[3],
336
- targetCellGroup.children[0].setAttributes({
337
- x: x
338
- });
339
- }
340
- if (attributes.height) {
341
- const height = attributes.height - this._parsedRowSeriesNumberCellPadding[0] - this._parsedRowSeriesNumberCellPadding[2], textBaseline = this.attribute.rowSeriesNumberCellStyle.text.textBaseline, padding = this._parsedRowSeriesNumberCellPadding;
342
- let y;
343
- y = "middle" === textBaseline ? padding[0] + (height - this.attribute.rowSeriesNumberCellStyle.text.fontSize) / 2 : "bottom" === textBaseline ? padding[0] + height - this.attribute.rowSeriesNumberCellStyle.text.fontSize : padding[0],
344
- targetCellGroup.children[0].setAttributes({
345
- y: y
346
- });
347
- }
348
- }
349
- setColSeriesNumberCellAttributes(index, attributes) {
350
- const {frozenColCount: frozenColCount} = this.getAttributes();
351
- let targetCellGroup;
352
- if (index >= 0 && index < frozenColCount) {
353
- targetCellGroup = this._frozenLeftColSeriesNumberGroup.children[index];
354
- const {height: oldHeight, width: oldWidth} = targetCellGroup.getAttributes();
355
- targetCellGroup.setAttributes(attributes), attributes.height && this._frozenLeftColSeriesNumberGroup.setAttributes({
356
- height: this._frozenLeftColSeriesNumberGroup.getAttributes().height + (attributes.height - oldHeight)
357
- }), attributes.width && this._frozenLeftColSeriesNumberGroup.setAttributes({
358
- width: this._frozenLeftColSeriesNumberGroup.getAttributes().width + (attributes.width - oldWidth)
359
- }), attributes.width && this._colSeriesNumberGroup.setAttributes({
360
- x: this._frozenLeftColSeriesNumberGroup.getAttributes().width + this._frozenLeftColSeriesNumberGroup.getAttributes().x
361
- });
362
- } else {
363
- targetCellGroup = this._colSeriesNumberGroup.children[index - frozenColCount - this._firstColSeriesNumberIndex],
364
- targetCellGroup.setAttributes(attributes);
365
- }
366
- if (attributes.width) {
367
- let x;
368
- const width = attributes.width - this._parsedColSeriesNumberCellPadding[3] - this._parsedColSeriesNumberCellPadding[1], textAlign = this.attribute.colSeriesNumberCellStyle.text.textAlign, padding = this._parsedColSeriesNumberCellPadding;
369
- x = "center" === textAlign ? padding[3] + +width / 2 : "right" === textAlign ? padding[3] + width : padding[3],
370
- targetCellGroup.children[0].setAttributes({
371
- x: x
372
- });
373
- }
374
- if (attributes.height) {
375
- const height = attributes.height - this._parsedColSeriesNumberCellPadding[0] - this._parsedColSeriesNumberCellPadding[2], textBaseline = this.attribute.colSeriesNumberCellStyle.text.textBaseline, padding = this._parsedColSeriesNumberCellPadding;
376
- let y;
377
- y = "middle" === textBaseline ? padding[0] + (height - this.attribute.colSeriesNumberCellStyle.text.fontSize) / 2 : "bottom" === textBaseline ? padding[0] + height - this.attribute.colSeriesNumberCellStyle.text.fontSize : padding[0],
378
- targetCellGroup.children[0].setAttributes({
379
- y: y
380
- });
381
- }
382
- }
383
- setRowSeriesNumberGroupAttributes(attributes) {
384
- this._rowSeriesNumberGroup.setAttributes(attributes);
385
- }
386
- setColSeriesNumberGroupAttributes(attributes) {
387
- this._colSeriesNumberGroup.setAttributes(attributes);
388
- }
389
- addSelectedIndex(isRow, index) {
390
- let name;
391
- name = isRow ? `rowSeriesNumberCell-${index}` : `colSeriesNumberCell-${index}`,
392
- this.interactionState.selectIndexs.add(name);
393
- }
394
- addRowSelectedRanges(ranges) {
395
- performance.now();
396
- for (let i = 0; i < ranges.length; i++) {
397
- const {startIndex: startIndex, endIndex: endIndex} = ranges[i];
398
- for (let j = startIndex; j <= endIndex; j++) {
399
- const name = `rowSeriesNumberCell-${j}`;
400
- this.interactionState.selectIndexs.add(name);
401
- }
402
- }
403
- performance.now();
404
- }
405
- addColSelectedRanges(ranges) {
406
- for (let i = 0; i < ranges.length; i++) {
407
- const {startIndex: startIndex, endIndex: endIndex} = ranges[i];
408
- for (let j = startIndex; j <= endIndex; j++) {
409
- const name = `colSeriesNumberCell-${j}`;
410
- this.interactionState.selectIndexs.add(name);
411
- }
412
- }
413
- }
414
- addCornderSelected() {
415
- this.interactionState.selectIndexs.add(this._cornerGroup.name);
416
- }
417
- resetAllSelectedIndexs({rowIndexs: rowIndexs, colIndexs: colIndexs}) {
418
- if (this.interactionState.selectIndexs = new Set, rowIndexs) for (let i = 0; i < rowIndexs.length; i++) {
419
- const name = `rowSeriesNumberCell-${rowIndexs[i]}`;
420
- this.interactionState.selectIndexs.add(name);
421
- }
422
- if (colIndexs) for (let i = 0; i < colIndexs.length; i++) {
423
- const name = `colSeriesNumberCell-${colIndexs[i]}`;
424
- this.interactionState.selectIndexs.add(name);
425
- }
426
- }
427
- removeSelectedIndex(isRow, index) {
428
- let name;
429
- name = isRow ? `rowSeriesNumberLeftCell-${index}` : `colSeriesNumberCell-${index}`,
430
- this.interactionState.selectIndexs.delete(name);
431
- }
432
- removeAllSelectedIndexs() {
433
- var _a, _b;
434
- for (const name of this.interactionState.selectIndexs) {
435
- const isRow = name.startsWith("row"), isCol = name.startsWith("col"), index = Number(name.split("-")[1]);
436
- isRow ? null === (_a = this.getRowSeriesNumberCellGroup(index)) || void 0 === _a || _a.removeState(SeriesNumberCellStateValue.select) : isCol ? null === (_b = this.getColSeriesNumberCellGroup(index)) || void 0 === _b || _b.removeState(SeriesNumberCellStateValue.select) : this._cornerGroup.removeState(SeriesNumberCellStateValue.select);
437
- }
438
- this.interactionState.selectIndexs.clear();
439
- }
440
- removeOneGroupSelected(group) {
441
- this.interactionState.selectIndexs.delete(group.name), group.removeState(SeriesNumberCellStateValue.select);
442
- }
443
- addOneGroupSelected(group) {
444
- this.interactionState.selectIndexs.add(group.name), group.useStates([ SeriesNumberCellStateValue.select ]);
445
- }
446
- renderSelectedIndexsState() {
447
- var _a, _b;
448
- const {rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle} = this.attribute;
449
- for (const name of this.interactionState.selectIndexs) {
450
- const isRow = name.startsWith("row"), isCol = name.startsWith("col"), index = Number(name.split("-")[1]);
451
- isRow ? null === (_a = this.getRowSeriesNumberCellGroup(index)) || void 0 === _a || _a.useStates([ SeriesNumberCellStateValue.select ]) : isCol ? null === (_b = this.getColSeriesNumberCellGroup(index)) || void 0 === _b || _b.useStates([ SeriesNumberCellStateValue.select ]) : this._cornerGroup.useStates([ SeriesNumberCellStateValue.select ]);
452
- }
453
- this.stage.render();
454
- }
455
- }
456
-
457
- TableSeriesNumber.defaultAttributes = {
458
- frozenRowCount: 0,
459
- frozenColCount: 0,
460
- rightFrozenColCount: 0,
461
- bottomFrozenRowCount: 0,
462
- pickable: !1,
463
- rowCount: 100,
464
- colCount: 100,
465
- rowHeight: 20,
466
- colWidth: 50,
467
- rowSeriesNumberWidth: 30,
468
- colSeriesNumberHeight: 30,
469
- rowSeriesNumberCellStyle: {
470
- text: {
471
- fontSize: 14,
472
- fill: "#7A7A7A",
473
- pickable: !1,
474
- textAlign: "left",
475
- textBaseline: "middle",
476
- padding: [ 2, 4, 2, 4 ]
477
- },
478
- borderLine: {
479
- stroke: "#D9D9D9",
480
- lineWidth: 1,
481
- pickable: !1
482
- },
483
- bgColor: "#F9F9F9",
484
- states: {
485
- hover: {
486
- fill: "#98C8A5",
487
- opacity: .7
488
- },
489
- select: {
490
- fill: "yellow",
491
- opacity: .7
492
- }
493
- }
494
- },
495
- colSeriesNumberCellStyle: {
496
- text: {
497
- fontSize: 14,
498
- fill: "#7A7A7A",
499
- pickable: !1,
500
- textAlign: "left",
501
- textBaseline: "middle",
502
- padding: [ 2, 4, 2, 4 ]
503
- },
504
- borderLine: {
505
- stroke: "#D9D9D9",
506
- lineWidth: 1,
507
- pickable: !1
508
- },
509
- bgColor: "#F9F9F9",
510
- states: {
511
- hover: {
512
- fill: "#98C8A5",
513
- opacity: .7
514
- },
515
- select: {
516
- fill: "orange",
517
- opacity: .7
518
- }
519
- }
520
- },
521
- cornerCellStyle: {
522
- borderLine: {
523
- stroke: "#D9D9D9",
524
- lineWidth: 1,
525
- pickable: !1
526
- },
527
- bgColor: "#F9F9F9",
528
- states: {
529
- hover: {
530
- fill: "#98C8A5",
531
- opacity: .7
532
- },
533
- select: {
534
- fill: "#98C8A5",
535
- opacity: .7
536
- }
537
- }
538
- },
539
- hover: !0,
540
- select: !0
541
- };
542
- //# sourceMappingURL=table-series-number.js.map