@visactor/vrender-components 1.0.8-alpha.2 → 1.0.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.
Files changed (52) hide show
  1. package/cjs/animation/label-animate.js +2 -2
  2. package/cjs/animation/label-animate.js.map +1 -1
  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/cjs/label/base.js +5 -6
  7. package/cjs/label/base.js.map +1 -1
  8. package/dist/index.es.js +84 -1019
  9. package/es/animation/label-animate.js +2 -2
  10. package/es/animation/label-animate.js.map +1 -1
  11. package/es/index.d.ts +1 -2
  12. package/es/index.js +1 -3
  13. package/es/index.js.map +1 -1
  14. package/es/label/base.js +5 -6
  15. package/es/label/base.js.map +1 -1
  16. package/package.json +4 -4
  17. package/cjs/table-series-number/event-manager.d.ts +0 -15
  18. package/cjs/table-series-number/event-manager.js +0 -149
  19. package/cjs/table-series-number/event-manager.js.map +0 -1
  20. package/cjs/table-series-number/index.d.ts +0 -2
  21. package/cjs/table-series-number/index.js +0 -21
  22. package/cjs/table-series-number/index.js.map +0 -1
  23. package/cjs/table-series-number/register.d.ts +0 -1
  24. package/cjs/table-series-number/register.js +0 -14
  25. package/cjs/table-series-number/register.js.map +0 -1
  26. package/cjs/table-series-number/table-series-number.d.ts +0 -76
  27. package/cjs/table-series-number/table-series-number.js +0 -534
  28. package/cjs/table-series-number/table-series-number.js.map +0 -1
  29. package/cjs/table-series-number/tools.d.ts +0 -1
  30. package/cjs/table-series-number/tools.js +0 -14
  31. package/cjs/table-series-number/tools.js.map +0 -1
  32. package/cjs/table-series-number/type.d.ts +0 -79
  33. package/cjs/table-series-number/type.js +0 -16
  34. package/cjs/table-series-number/type.js.map +0 -1
  35. package/es/table-series-number/event-manager.d.ts +0 -15
  36. package/es/table-series-number/event-manager.js +0 -143
  37. package/es/table-series-number/event-manager.js.map +0 -1
  38. package/es/table-series-number/index.d.ts +0 -2
  39. package/es/table-series-number/index.js +0 -4
  40. package/es/table-series-number/index.js.map +0 -1
  41. package/es/table-series-number/register.d.ts +0 -1
  42. package/es/table-series-number/register.js +0 -6
  43. package/es/table-series-number/register.js.map +0 -1
  44. package/es/table-series-number/table-series-number.d.ts +0 -76
  45. package/es/table-series-number/table-series-number.js +0 -542
  46. package/es/table-series-number/table-series-number.js.map +0 -1
  47. package/es/table-series-number/tools.d.ts +0 -1
  48. package/es/table-series-number/tools.js +0 -8
  49. package/es/table-series-number/tools.js.map +0 -1
  50. package/es/table-series-number/type.d.ts +0 -79
  51. package/es/table-series-number/type.js +0 -15
  52. package/es/table-series-number/type.js.map +0 -1
@@ -1,534 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: !0
5
- }), exports.TableSeriesNumber = void 0;
6
-
7
- const tools_1 = require("./tools"), vutils_1 = require("@visactor/vutils"), base_1 = require("../core/base"), type_1 = require("./type"), event_manager_1 = require("./event-manager"), vrender_core_1 = require("@visactor/vrender-core"), register_1 = require("./register"), 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>';
8
-
9
- (0, register_1.loadTableSeriesNumberComponent)();
10
-
11
- class TableSeriesNumber extends base_1.AbstractComponent {
12
- constructor(attributes, options) {
13
- if (super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, TableSeriesNumber.defaultAttributes, attributes)),
14
- this.name = "tableSeriesNumber", this._firstRowSeriesNumberIndex = 0, this._firstColSeriesNumberIndex = 0,
15
- this._maxTextWidth = 0, this._changeRowSeriesNumberWidthTimer = null, this.interactionState = {
16
- selectIndexs: new Set,
17
- _lastHoverItem: null,
18
- _lastClickItem: null
19
- }, this._parsedRowSeriesNumberCellPadding = [ 0, 0, 0, 0 ], this._parsedColSeriesNumberCellPadding = [ 0, 0, 0, 0 ],
20
- this.initRenderAll = !1, this.initRenderAll = (null == options ? void 0 : options.initRenderAll) || !1,
21
- this._skipRenderAttributes.push("frozenTopRow"), this._skipRenderAttributes.push("frozenLeftCol"),
22
- this._skipRenderAttributes.push("frozenRightCol"), this._skipRenderAttributes.push("frozenBottomRow"),
23
- this._skipRenderAttributes.push("rowCount"), this._skipRenderAttributes.push("colCount"),
24
- this._skipRenderAttributes.push("hover"), this._skipRenderAttributes.push("select"),
25
- this.attribute.rowSeriesNumberCellStyle.text.padding) {
26
- const padding = (0, vrender_core_1.parsePadding)(this.attribute.rowSeriesNumberCellStyle.text.padding);
27
- this._parsedRowSeriesNumberCellPadding = "number" == typeof padding ? [ padding, padding, padding, padding ] : padding;
28
- }
29
- if (this.attribute.colSeriesNumberCellStyle.text.padding) {
30
- const padding = (0, vrender_core_1.parsePadding)(this.attribute.colSeriesNumberCellStyle.text.padding);
31
- this._parsedColSeriesNumberCellPadding = "number" == typeof padding ? [ padding, padding, padding, padding ] : padding;
32
- }
33
- this._eventManager = new event_manager_1.TableSeriesNumberEventManager(this);
34
- }
35
- get rowSeriesNumberWidth() {
36
- const {rowSeriesNumberWidth: rowSeriesNumberWidth} = this.attribute;
37
- return this._maxTextWidth ? Math.max(this._maxTextWidth + this._parsedRowSeriesNumberCellPadding[3] + this._parsedRowSeriesNumberCellPadding[1], "number" == typeof rowSeriesNumberWidth ? rowSeriesNumberWidth : 40) : "number" == typeof rowSeriesNumberWidth ? rowSeriesNumberWidth : 40;
38
- }
39
- get colSeriesNumberHeight() {
40
- const {colSeriesNumberHeight: colSeriesNumberHeight} = this.attribute;
41
- return "number" == typeof colSeriesNumberHeight ? colSeriesNumberHeight : 20;
42
- }
43
- get rowCount() {
44
- const {rowCount: rowCount} = this.attribute;
45
- return rowCount;
46
- }
47
- get colCount() {
48
- const {colCount: colCount} = this.attribute;
49
- return colCount;
50
- }
51
- bindEvents() {
52
- this._eventManager.bindEvents();
53
- }
54
- dispatchTableSeriesNumberEvent(event, ...args) {
55
- this._dispatchEvent(event, ...args);
56
- }
57
- render() {
58
- const {rowCount: rowCount, colCount: colCount, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute, innerView = this.createOrUpdateChild("tableSeriesNumberContainer", {
59
- x: 0,
60
- y: 0,
61
- fill: "rgba(1,1,1,0)",
62
- width: this.rowSeriesNumberWidth + colCount * ("number" == typeof colWidth ? colWidth : 20),
63
- height: this.colSeriesNumberHeight + rowCount * ("number" == typeof rowHeight ? rowHeight : 20),
64
- pickable: !1,
65
- childrenPickable: !0
66
- }, "group");
67
- this._tableSeriesNumberContainer = innerView, this._renderContent();
68
- }
69
- _renderContent() {
70
- if (this._renderRowSeriesNumber(), this._renderColSeriesNumber(), this._renderFrozenTopRowSeriesNumber(),
71
- this._renderFrozenLeftColSeriesNumber(), this._renderCorner(), this.initRenderAll) {
72
- this.recreateCellsToRowSeriesNumberGroup(0, this.attribute.rowCount - 1), this.recreateCellsToColSeriesNumberGroup(0, this.attribute.colCount - 1);
73
- let y = 0;
74
- for (let i = 0; i < this.attribute.rowCount; i++) this.setRowSeriesNumberCellAttributes(i, {
75
- y: y,
76
- height: "number" == typeof this.attribute.rowHeight ? this.attribute.rowHeight : 20
77
- }), y += "number" == typeof this.attribute.rowHeight ? this.attribute.rowHeight : 20;
78
- let x = 0;
79
- for (let i = 0; i < this.attribute.colCount; i++) this.setColSeriesNumberCellAttributes(i, {
80
- x: x,
81
- width: "number" == typeof this.attribute.colWidth ? this.attribute.colWidth : 20
82
- }), x += "number" == typeof this.attribute.colWidth ? this.attribute.colWidth : 20;
83
- }
84
- }
85
- _renderCorner() {
86
- 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", {
87
- x: 0,
88
- y: 0,
89
- fill: cornerSeriesNumberCellStyle.bgColor,
90
- stroke: cornerSeriesNumberCellStyle.borderLine.stroke,
91
- lineWidth: cornerSeriesNumberCellStyle.borderLine.lineWidth,
92
- pickable: !0,
93
- width: this.rowSeriesNumberWidth,
94
- height: this.colSeriesNumberHeight
95
- }, "group");
96
- cornerGroup.id = "0,0", cornerGroup.states = cornerSeriesNumberCellStyle.states,
97
- this._cornerGroup = cornerGroup;
98
- }
99
- _renderRowSeriesNumber() {
100
- 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", {
101
- x: 0,
102
- y: this.colSeriesNumberHeight,
103
- pickable: !0,
104
- fill: rowSeriesNumberCellStyle.bgColor,
105
- width: this.rowSeriesNumberWidth,
106
- height: rowCount * ("number" == typeof rowHeight ? rowHeight : 20)
107
- }, "group");
108
- this._rowSeriesNumberGroup = rowSeriesNumberGroup;
109
- }
110
- _renderColSeriesNumber() {
111
- 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", {
112
- x: this.rowSeriesNumberWidth + frozenColCount * ("number" == typeof colWidth ? colWidth : 20),
113
- y: 0,
114
- pickable: !0,
115
- fill: colSeriesNumberCellStyle.bgColor,
116
- width: colCount * ("number" == typeof colWidth ? colWidth : 20),
117
- height: this.colSeriesNumberHeight
118
- }, "group");
119
- this._colSeriesNumberGroup = colSeriesNumberGroup;
120
- }
121
- _renderFrozenTopRowSeriesNumber() {
122
- const {frozenRowCount: frozenRowCount, colCount: colCount, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute, frozenTopSeriesNumberGroup = this._tableSeriesNumberContainer.createOrUpdateChild("frozenTopSeriesNumberGroup", {
123
- x: 0,
124
- y: this.colSeriesNumberHeight,
125
- width: this.rowSeriesNumberWidth,
126
- height: frozenRowCount * ("number" == typeof rowHeight ? rowHeight : 20)
127
- }, "group");
128
- this._frozenTopRowSeriesNumberGroup = frozenTopSeriesNumberGroup;
129
- }
130
- _renderFrozenLeftColSeriesNumber() {
131
- const {frozenColCount: frozenColCount, rowCount: rowCount, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute, frozenLeftSeriesNumberGroup = this._tableSeriesNumberContainer.createOrUpdateChild("frozenLeftSeriesNumberGroup", {
132
- x: this.rowSeriesNumberWidth,
133
- y: 0,
134
- height: this.colSeriesNumberHeight,
135
- width: frozenColCount * ("number" == typeof colWidth ? colWidth : 20)
136
- }, "group");
137
- this._frozenLeftColSeriesNumberGroup = frozenLeftSeriesNumberGroup;
138
- }
139
- recreateCellsToRowSeriesNumberGroup(startIndex, endIndex) {
140
- var _a, _b;
141
- const {frozenRowCount: frozenRowCount, rowCount: rowCount, colCount: colCount, rowSeriesNumberWidth: rowSeriesNumberWidth, colSeriesNumberHeight: colSeriesNumberHeight, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle, rowHeight: rowHeight, colWidth: colWidth} = this.attribute;
142
- this._frozenTopRowSeriesNumberGroup.removeAllChild(), this._rowSeriesNumberGroup.removeAllChild();
143
- let y = 0;
144
- const height = ("number" == typeof rowHeight ? rowHeight : 20) - this._parsedRowSeriesNumberCellPadding[0] - this._parsedRowSeriesNumberCellPadding[2];
145
- let x;
146
- 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];
147
- const width = this.rowSeriesNumberWidth - this._parsedRowSeriesNumberCellPadding[3] - this._parsedRowSeriesNumberCellPadding[1], textAlign = this.attribute.rowSeriesNumberCellStyle.text.textAlign, padding = this._parsedRowSeriesNumberCellPadding;
148
- x = "center" === textAlign ? padding[3] + +width / 2 : "right" === textAlign ? padding[3] + width : padding[3];
149
- for (let i = 0; i < frozenRowCount; i++) {
150
- const cellGroup = this._frozenTopRowSeriesNumberGroup.createOrUpdateChild(`rowSeriesNumberCell-${i}`, {
151
- x: 0,
152
- y: 0,
153
- pickable: !0,
154
- fill: rowSeriesNumberCellStyle.bgColor,
155
- stroke: rowSeriesNumberCellStyle.borderLine.stroke,
156
- lineWidth: rowSeriesNumberCellStyle.borderLine.lineWidth,
157
- width: this.rowSeriesNumberWidth,
158
- height: "number" == typeof rowHeight ? rowHeight : 20
159
- }, "group");
160
- cellGroup.id = i, cellGroup.states = rowSeriesNumberCellStyle.states, (null === (_a = this.interactionState.selectIndexs) || void 0 === _a ? void 0 : _a.has(cellGroup.name)) && cellGroup.useStates([ type_1.SeriesNumberCellStateValue.select ]);
161
- cellGroup.createOrUpdateChild(`rowSeriesNumberCellText-${i}`, Object.assign(Object.assign({
162
- x: x,
163
- y: y,
164
- text: `${i + 1}`,
165
- pickable: !1,
166
- dx: 0
167
- }, rowSeriesNumberCellStyle.text), {
168
- textBaseline: "top"
169
- }), "text");
170
- }
171
- this._firstRowSeriesNumberIndex = Math.max(startIndex, frozenRowCount) - frozenRowCount;
172
- let thisTextMaxWidth = 0;
173
- for (let i = this._firstRowSeriesNumberIndex; i <= endIndex - frozenRowCount; i++) {
174
- const cellGroup = this._rowSeriesNumberGroup.createOrUpdateChild(`rowSeriesNumberCell-${i + frozenRowCount}`, {
175
- x: 0,
176
- y: 0,
177
- pickable: !0,
178
- fill: rowSeriesNumberCellStyle.bgColor,
179
- stroke: rowSeriesNumberCellStyle.borderLine.stroke,
180
- lineWidth: rowSeriesNumberCellStyle.borderLine.lineWidth,
181
- width: this.rowSeriesNumberWidth,
182
- height: "number" == typeof rowHeight ? rowHeight : 20
183
- }, "group");
184
- cellGroup.id = i + frozenRowCount, cellGroup.states = rowSeriesNumberCellStyle.states,
185
- (null === (_b = this.interactionState.selectIndexs) || void 0 === _b ? void 0 : _b.has(cellGroup.name)) && cellGroup.useStates([ type_1.SeriesNumberCellStateValue.select ]);
186
- const text = cellGroup.createOrUpdateChild(`rowSeriesNumberCellText-${i + frozenRowCount}`, Object.assign(Object.assign({
187
- x: x,
188
- y: y,
189
- text: `${i + 1 + frozenRowCount}`,
190
- pickable: !1,
191
- dx: 0
192
- }, rowSeriesNumberCellStyle.text), {
193
- textBaseline: "top"
194
- }), "text");
195
- i === endIndex - frozenRowCount && (thisTextMaxWidth = text.clipedWidth);
196
- }
197
- clearTimeout(this._changeRowSeriesNumberWidthTimer), this._changeRowSeriesNumberWidthTimer = setTimeout((() => {
198
- if (Math.abs(thisTextMaxWidth - this._maxTextWidth) >= 6) {
199
- const oldWidth = this._maxTextWidth;
200
- this._maxTextWidth = thisTextMaxWidth, this.changeRowSeriesNumberWidth(Math.max(this.rowSeriesNumberWidth, 20)),
201
- this._dispatchEvent(type_1.SeriesNumberEvent.rowSeriesNumberWidthChange, {
202
- newWidth: this.rowSeriesNumberWidth,
203
- oldWidth: oldWidth
204
- });
205
- }
206
- }), 100);
207
- }
208
- recreateCellsToColSeriesNumberGroup(startIndex, endIndex) {
209
- var _a, _b;
210
- const {colCount: colCount, colSeriesNumberCellStyle: colSeriesNumberCellStyle, frozenColCount: frozenColCount, colWidth: colWidth} = this.attribute;
211
- this._frozenLeftColSeriesNumberGroup.removeAllChild(), this._colSeriesNumberGroup.removeAllChild();
212
- let y = 0;
213
- const height = this.colSeriesNumberHeight - this._parsedColSeriesNumberCellPadding[0] - this._parsedColSeriesNumberCellPadding[2];
214
- let x;
215
- 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];
216
- const width = ("number" == typeof colWidth ? colWidth : 20) - this._parsedColSeriesNumberCellPadding[3] - this._parsedColSeriesNumberCellPadding[1], textAlign = this.attribute.colSeriesNumberCellStyle.text.textAlign, padding = this._parsedColSeriesNumberCellPadding;
217
- x = "center" === textAlign ? padding[3] + +width / 2 : "right" === textAlign ? padding[3] + width : padding[3];
218
- for (let i = 0; i < frozenColCount; i++) {
219
- const cellGroup = this._frozenLeftColSeriesNumberGroup.createOrUpdateChild(`colSeriesNumberCell-${i}`, {
220
- x: 0,
221
- y: 0,
222
- pickable: !0,
223
- fill: colSeriesNumberCellStyle.bgColor,
224
- stroke: colSeriesNumberCellStyle.borderLine.stroke,
225
- lineWidth: colSeriesNumberCellStyle.borderLine.lineWidth,
226
- width: "number" == typeof colWidth ? colWidth : 20,
227
- height: this.colSeriesNumberHeight
228
- }, "group");
229
- cellGroup.id = i, cellGroup.states = colSeriesNumberCellStyle.states, (null === (_a = this.interactionState.selectIndexs) || void 0 === _a ? void 0 : _a.has(cellGroup.name)) && cellGroup.useStates([ type_1.SeriesNumberCellStateValue.select ]);
230
- cellGroup.createOrUpdateChild(`colSeriesNumberCellText-${i}`, Object.assign(Object.assign({
231
- x: x,
232
- y: y,
233
- dx: 0,
234
- text: (0, tools_1.generateColField)(i),
235
- pickable: !1
236
- }, colSeriesNumberCellStyle.text), {
237
- textBaseline: "top"
238
- }), "text");
239
- }
240
- this._firstColSeriesNumberIndex = Math.max(startIndex, frozenColCount) - frozenColCount;
241
- for (let i = this._firstColSeriesNumberIndex; i <= endIndex - frozenColCount; i++) {
242
- const cellGroup = this._colSeriesNumberGroup.createOrUpdateChild(`colSeriesNumberCell-${i + frozenColCount}`, {
243
- x: 0,
244
- y: 0,
245
- pickable: !0,
246
- fill: colSeriesNumberCellStyle.bgColor,
247
- stroke: colSeriesNumberCellStyle.borderLine.stroke,
248
- lineWidth: colSeriesNumberCellStyle.borderLine.lineWidth,
249
- width: "number" == typeof colWidth ? colWidth : 20,
250
- height: this.colSeriesNumberHeight
251
- }, "group");
252
- cellGroup.id = i + frozenColCount, cellGroup.states = colSeriesNumberCellStyle.states,
253
- (null === (_b = this.interactionState.selectIndexs) || void 0 === _b ? void 0 : _b.has(cellGroup.name)) && cellGroup.useStates([ type_1.SeriesNumberCellStateValue.select ]);
254
- cellGroup.createOrUpdateChild(`colSeriesNumberCellText-${i + frozenColCount}`, Object.assign(Object.assign({
255
- x: x,
256
- y: y,
257
- dx: 0,
258
- text: (0, tools_1.generateColField)(i + frozenColCount),
259
- pickable: !1
260
- }, colSeriesNumberCellStyle.text), {
261
- textBaseline: "top"
262
- }), "text");
263
- }
264
- }
265
- changeRowSeriesNumberWidth(newWidth) {
266
- const {rowHeight: rowHeight, rowCount: oldRowCount, frozenRowCount: frozenRowCount, frozenColCount: frozenLeftCol, rowSeriesNumberCellStyle: rowSeriesNumberCellStyle} = this.attribute;
267
- this._cornerGroup.setAttributes({
268
- width: newWidth
269
- }), this._frozenTopRowSeriesNumberGroup.setAttributes({
270
- width: newWidth
271
- });
272
- for (let i = 0; i < this._frozenTopRowSeriesNumberGroup.children.length; i++) this.setRowSeriesNumberCellAttributes(i, {
273
- width: newWidth
274
- });
275
- this._rowSeriesNumberGroup.setAttributes({
276
- width: newWidth
277
- });
278
- for (let i = 0; i < this._rowSeriesNumberGroup.children.length; i++) this.setRowSeriesNumberCellAttributes(i + this._firstRowSeriesNumberIndex + frozenRowCount, {
279
- width: newWidth
280
- });
281
- this._frozenLeftColSeriesNumberGroup.setAttributes({
282
- x: newWidth
283
- }), this._colSeriesNumberGroup.setAttributes({
284
- x: newWidth + this._frozenLeftColSeriesNumberGroup.getAttributes().width
285
- });
286
- }
287
- getRowSeriesNumberCellGroup(index) {
288
- const {frozenRowCount: frozenRowCount} = this.getAttributes();
289
- if (index >= 0 && index < frozenRowCount) return this._frozenTopRowSeriesNumberGroup.children[index];
290
- return this._rowSeriesNumberGroup.children[index - frozenRowCount - this._firstRowSeriesNumberIndex];
291
- }
292
- getColSeriesNumberCellGroup(index) {
293
- const {frozenColCount: frozenColCount} = this.getAttributes();
294
- if (index >= 0 && index < frozenColCount) return this._frozenLeftColSeriesNumberGroup.children[index];
295
- return this._colSeriesNumberGroup.children[index - frozenColCount - this._firstColSeriesNumberIndex];
296
- }
297
- getRowSeriesNumberCellAttributes(index) {
298
- const {frozenRowCount: frozenRowCount} = this.getAttributes();
299
- if (index >= 0 && index < frozenRowCount) return this._frozenTopRowSeriesNumberGroup.children[index].attribute;
300
- return this._rowSeriesNumberGroup.children[index - frozenRowCount - this._firstRowSeriesNumberIndex].attribute;
301
- }
302
- getColSeriesNumberCellAttributes(index) {
303
- const {frozenColCount: frozenColCount} = this.getAttributes();
304
- if (index >= 0 && index < frozenColCount) return this._frozenLeftColSeriesNumberGroup.children[index].attribute;
305
- return this._colSeriesNumberGroup.children[index - frozenColCount - this._firstColSeriesNumberIndex].attribute;
306
- }
307
- setRowSeriesNumberCellAttributes(index, attributes) {
308
- const {frozenRowCount: frozenRowCount} = this.getAttributes();
309
- let targetCellGroup;
310
- if (index >= 0 && index < frozenRowCount) {
311
- const {height: oldHeight, width: oldWidth, y: y} = this._frozenTopRowSeriesNumberGroup.getAttributes();
312
- targetCellGroup = this._frozenTopRowSeriesNumberGroup.children[index], targetCellGroup.setAttributes(attributes),
313
- attributes.height && this._frozenTopRowSeriesNumberGroup.setAttributes({
314
- height: this._frozenTopRowSeriesNumberGroup.getAttributes().height + (attributes.height - oldHeight)
315
- }), attributes.width && this._frozenTopRowSeriesNumberGroup.setAttributes({
316
- width: this._frozenTopRowSeriesNumberGroup.getAttributes().width + (attributes.width - oldWidth)
317
- }), attributes.height && this._rowSeriesNumberGroup.setAttributes({
318
- y: this._frozenTopRowSeriesNumberGroup.getAttributes().height + this._frozenTopRowSeriesNumberGroup.getAttributes().y
319
- });
320
- } else {
321
- targetCellGroup = this._rowSeriesNumberGroup.children[index - frozenRowCount - this._firstRowSeriesNumberIndex],
322
- targetCellGroup.setAttributes(attributes);
323
- }
324
- if (attributes.width) {
325
- let x;
326
- const width = attributes.width - this._parsedRowSeriesNumberCellPadding[3] - this._parsedRowSeriesNumberCellPadding[1], textAlign = this.attribute.rowSeriesNumberCellStyle.text.textAlign, padding = this._parsedRowSeriesNumberCellPadding;
327
- x = "center" === textAlign ? padding[3] + +width / 2 : "right" === textAlign ? padding[3] + width : padding[3],
328
- targetCellGroup.children[0].setAttributes({
329
- x: x
330
- });
331
- }
332
- if (attributes.height) {
333
- const height = attributes.height - this._parsedRowSeriesNumberCellPadding[0] - this._parsedRowSeriesNumberCellPadding[2], textBaseline = this.attribute.rowSeriesNumberCellStyle.text.textBaseline, padding = this._parsedRowSeriesNumberCellPadding;
334
- let y;
335
- y = "middle" === textBaseline ? padding[0] + (height - this.attribute.rowSeriesNumberCellStyle.text.fontSize) / 2 : "bottom" === textBaseline ? padding[0] + height - this.attribute.rowSeriesNumberCellStyle.text.fontSize : padding[0],
336
- targetCellGroup.children[0].setAttributes({
337
- y: y
338
- });
339
- }
340
- }
341
- setColSeriesNumberCellAttributes(index, attributes) {
342
- const {frozenColCount: frozenColCount} = this.getAttributes();
343
- let targetCellGroup;
344
- if (index >= 0 && index < frozenColCount) {
345
- targetCellGroup = this._frozenLeftColSeriesNumberGroup.children[index];
346
- const {height: oldHeight, width: oldWidth} = targetCellGroup.getAttributes();
347
- targetCellGroup.setAttributes(attributes), attributes.height && this._frozenLeftColSeriesNumberGroup.setAttributes({
348
- height: this._frozenLeftColSeriesNumberGroup.getAttributes().height + (attributes.height - oldHeight)
349
- }), attributes.width && this._frozenLeftColSeriesNumberGroup.setAttributes({
350
- width: this._frozenLeftColSeriesNumberGroup.getAttributes().width + (attributes.width - oldWidth)
351
- }), attributes.width && this._colSeriesNumberGroup.setAttributes({
352
- x: this._frozenLeftColSeriesNumberGroup.getAttributes().width + this._frozenLeftColSeriesNumberGroup.getAttributes().x
353
- });
354
- } else {
355
- targetCellGroup = this._colSeriesNumberGroup.children[index - frozenColCount - this._firstColSeriesNumberIndex],
356
- targetCellGroup.setAttributes(attributes);
357
- }
358
- if (attributes.width) {
359
- let x;
360
- const width = attributes.width - this._parsedColSeriesNumberCellPadding[3] - this._parsedColSeriesNumberCellPadding[1], textAlign = this.attribute.colSeriesNumberCellStyle.text.textAlign, padding = this._parsedColSeriesNumberCellPadding;
361
- x = "center" === textAlign ? padding[3] + +width / 2 : "right" === textAlign ? padding[3] + width : padding[3],
362
- targetCellGroup.children[0].setAttributes({
363
- x: x
364
- });
365
- }
366
- if (attributes.height) {
367
- const height = attributes.height - this._parsedColSeriesNumberCellPadding[0] - this._parsedColSeriesNumberCellPadding[2], textBaseline = this.attribute.colSeriesNumberCellStyle.text.textBaseline, padding = this._parsedColSeriesNumberCellPadding;
368
- let y;
369
- y = "middle" === textBaseline ? padding[0] + (height - this.attribute.colSeriesNumberCellStyle.text.fontSize) / 2 : "bottom" === textBaseline ? padding[0] + height - this.attribute.colSeriesNumberCellStyle.text.fontSize : padding[0],
370
- targetCellGroup.children[0].setAttributes({
371
- y: y
372
- });
373
- }
374
- }
375
- setRowSeriesNumberGroupAttributes(attributes) {
376
- this._rowSeriesNumberGroup.setAttributes(attributes);
377
- }
378
- setColSeriesNumberGroupAttributes(attributes) {
379
- this._colSeriesNumberGroup.setAttributes(attributes);
380
- }
381
- addSelectedIndex(isRow, index) {
382
- let name;
383
- name = isRow ? `rowSeriesNumberCell-${index}` : `colSeriesNumberCell-${index}`,
384
- this.interactionState.selectIndexs.add(name);
385
- }
386
- addRowSelectedRanges(ranges) {
387
- performance.now();
388
- for (let i = 0; i < ranges.length; i++) {
389
- const {startIndex: startIndex, endIndex: endIndex} = ranges[i];
390
- for (let j = startIndex; j <= endIndex; j++) {
391
- const name = `rowSeriesNumberCell-${j}`;
392
- this.interactionState.selectIndexs.add(name);
393
- }
394
- }
395
- performance.now();
396
- }
397
- addColSelectedRanges(ranges) {
398
- for (let i = 0; i < ranges.length; i++) {
399
- const {startIndex: startIndex, endIndex: endIndex} = ranges[i];
400
- for (let j = startIndex; j <= endIndex; j++) {
401
- const name = `colSeriesNumberCell-${j}`;
402
- this.interactionState.selectIndexs.add(name);
403
- }
404
- }
405
- }
406
- addCornderSelected() {
407
- this.interactionState.selectIndexs.add(this._cornerGroup.name);
408
- }
409
- resetAllSelectedIndexs({rowIndexs: rowIndexs, colIndexs: colIndexs}) {
410
- if (this.interactionState.selectIndexs = new Set, rowIndexs) for (let i = 0; i < rowIndexs.length; i++) {
411
- const name = `rowSeriesNumberCell-${rowIndexs[i]}`;
412
- this.interactionState.selectIndexs.add(name);
413
- }
414
- if (colIndexs) for (let i = 0; i < colIndexs.length; i++) {
415
- const name = `colSeriesNumberCell-${colIndexs[i]}`;
416
- this.interactionState.selectIndexs.add(name);
417
- }
418
- }
419
- removeSelectedIndex(isRow, index) {
420
- let name;
421
- name = isRow ? `rowSeriesNumberLeftCell-${index}` : `colSeriesNumberCell-${index}`,
422
- this.interactionState.selectIndexs.delete(name);
423
- }
424
- removeAllSelectedIndexs() {
425
- var _a, _b;
426
- for (const name of this.interactionState.selectIndexs) {
427
- const isRow = name.startsWith("row"), isCol = name.startsWith("col"), index = Number(name.split("-")[1]);
428
- isRow ? null === (_a = this.getRowSeriesNumberCellGroup(index)) || void 0 === _a || _a.removeState(type_1.SeriesNumberCellStateValue.select) : isCol ? null === (_b = this.getColSeriesNumberCellGroup(index)) || void 0 === _b || _b.removeState(type_1.SeriesNumberCellStateValue.select) : this._cornerGroup.removeState(type_1.SeriesNumberCellStateValue.select);
429
- }
430
- this.interactionState.selectIndexs.clear();
431
- }
432
- removeOneGroupSelected(group) {
433
- this.interactionState.selectIndexs.delete(group.name), group.removeState(type_1.SeriesNumberCellStateValue.select);
434
- }
435
- addOneGroupSelected(group) {
436
- this.interactionState.selectIndexs.add(group.name), group.useStates([ type_1.SeriesNumberCellStateValue.select ]);
437
- }
438
- renderSelectedIndexsState() {
439
- var _a, _b;
440
- const {rowSeriesNumberCellStyle: rowSeriesNumberCellStyle, colSeriesNumberCellStyle: colSeriesNumberCellStyle} = this.attribute;
441
- for (const name of this.interactionState.selectIndexs) {
442
- const isRow = name.startsWith("row"), isCol = name.startsWith("col"), index = Number(name.split("-")[1]);
443
- isRow ? null === (_a = this.getRowSeriesNumberCellGroup(index)) || void 0 === _a || _a.useStates([ type_1.SeriesNumberCellStateValue.select ]) : isCol ? null === (_b = this.getColSeriesNumberCellGroup(index)) || void 0 === _b || _b.useStates([ type_1.SeriesNumberCellStateValue.select ]) : this._cornerGroup.useStates([ type_1.SeriesNumberCellStateValue.select ]);
444
- }
445
- this.stage.render();
446
- }
447
- }
448
-
449
- exports.TableSeriesNumber = TableSeriesNumber, TableSeriesNumber.defaultAttributes = {
450
- frozenRowCount: 0,
451
- frozenColCount: 0,
452
- rightFrozenColCount: 0,
453
- bottomFrozenRowCount: 0,
454
- pickable: !1,
455
- rowCount: 100,
456
- colCount: 100,
457
- rowHeight: 20,
458
- colWidth: 50,
459
- rowSeriesNumberWidth: 30,
460
- colSeriesNumberHeight: 30,
461
- rowSeriesNumberCellStyle: {
462
- text: {
463
- fontSize: 14,
464
- fill: "#7A7A7A",
465
- pickable: !1,
466
- textAlign: "left",
467
- textBaseline: "middle",
468
- padding: [ 2, 4, 2, 4 ]
469
- },
470
- borderLine: {
471
- stroke: "#D9D9D9",
472
- lineWidth: 1,
473
- pickable: !1
474
- },
475
- bgColor: "#F9F9F9",
476
- states: {
477
- hover: {
478
- fill: "#98C8A5",
479
- opacity: .7
480
- },
481
- select: {
482
- fill: "yellow",
483
- opacity: .7
484
- }
485
- }
486
- },
487
- colSeriesNumberCellStyle: {
488
- text: {
489
- fontSize: 14,
490
- fill: "#7A7A7A",
491
- pickable: !1,
492
- textAlign: "left",
493
- textBaseline: "middle",
494
- padding: [ 2, 4, 2, 4 ]
495
- },
496
- borderLine: {
497
- stroke: "#D9D9D9",
498
- lineWidth: 1,
499
- pickable: !1
500
- },
501
- bgColor: "#F9F9F9",
502
- states: {
503
- hover: {
504
- fill: "#98C8A5",
505
- opacity: .7
506
- },
507
- select: {
508
- fill: "orange",
509
- opacity: .7
510
- }
511
- }
512
- },
513
- cornerCellStyle: {
514
- borderLine: {
515
- stroke: "#D9D9D9",
516
- lineWidth: 1,
517
- pickable: !1
518
- },
519
- bgColor: "#F9F9F9",
520
- states: {
521
- hover: {
522
- fill: "#98C8A5",
523
- opacity: .7
524
- },
525
- select: {
526
- fill: "#98C8A5",
527
- opacity: .7
528
- }
529
- }
530
- },
531
- hover: !0,
532
- select: !0
533
- };
534
- //# sourceMappingURL=table-series-number.js.map