k-vtable 1.0.3 → 1.0.5

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 (231) hide show
  1. package/cjs/ListTable-all.js +5 -5
  2. package/cjs/ListTable-all.js.map +1 -1
  3. package/cjs/ListTable.d.ts +7 -2
  4. package/cjs/ListTable.js +44 -5
  5. package/cjs/ListTable.js.map +1 -1
  6. package/cjs/PivotChart.js +4 -4
  7. package/cjs/PivotChart.js.map +1 -1
  8. package/cjs/PivotTable-all.js +4 -4
  9. package/cjs/PivotTable-all.js.map +1 -1
  10. package/cjs/PivotTable.d.ts +4 -0
  11. package/cjs/PivotTable.js +44 -0
  12. package/cjs/PivotTable.js.map +1 -1
  13. package/cjs/body-helper/style/ButtonStyle.d.ts +1 -1
  14. package/cjs/body-helper/style/ButtonStyle.js +2 -2
  15. package/cjs/body-helper/style/ButtonStyle.js.map +1 -1
  16. package/cjs/body-helper/style/SwitchStyle.d.ts +1 -1
  17. package/cjs/body-helper/style/SwitchStyle.js +2 -2
  18. package/cjs/body-helper/style/SwitchStyle.js.map +1 -1
  19. package/cjs/body-helper/style.js +2 -1
  20. package/cjs/components/index.d.ts +1 -0
  21. package/cjs/components/index.js +8 -2
  22. package/cjs/components/index.js.map +1 -1
  23. package/cjs/components/menu/dom/logic/MenuElement.js +7 -3
  24. package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
  25. package/cjs/core/BaseTable.d.ts +13 -0
  26. package/cjs/core/BaseTable.js +113 -42
  27. package/cjs/core/BaseTable.js.map +1 -1
  28. package/cjs/core/animation.js +1 -1
  29. package/cjs/core/animation.js.map +1 -1
  30. package/cjs/core/record-helper.d.ts +1 -1
  31. package/cjs/core/record-helper.js +99 -65
  32. package/cjs/core/record-helper.js.map +1 -1
  33. package/cjs/data/DataSource.d.ts +3 -0
  34. package/cjs/data/DataSource.js +36 -7
  35. package/cjs/data/DataSource.js.map +1 -1
  36. package/cjs/dataset/dataset.d.ts +1 -0
  37. package/cjs/dataset/dataset.js +66 -2
  38. package/cjs/dataset/dataset.js.map +1 -1
  39. package/cjs/edit/edit-manager.js +8 -5
  40. package/cjs/edit/edit-manager.js.map +1 -1
  41. package/cjs/event/event.js +2 -2
  42. package/cjs/event/event.js.map +1 -1
  43. package/cjs/event/listener/container-dom.js +36 -33
  44. package/cjs/event/listener/container-dom.js.map +1 -1
  45. package/cjs/event/listener/table-group.js +36 -32
  46. package/cjs/event/listener/table-group.js.map +1 -1
  47. package/cjs/event/scroll.js +6 -5
  48. package/cjs/event/scroll.js.map +1 -1
  49. package/cjs/event/self-event-listener/base-table/right-button-click.js +2 -2
  50. package/cjs/event/self-event-listener/base-table/right-button-click.js.map +1 -1
  51. package/cjs/index.d.ts +2 -1
  52. package/cjs/index.js +11 -2
  53. package/cjs/index.js.map +1 -1
  54. package/cjs/layout/index.js +2 -1
  55. package/cjs/layout/layout-helper.js +1 -1
  56. package/cjs/layout/pivot-header-layout.d.ts +7 -0
  57. package/cjs/layout/pivot-header-layout.js +93 -8
  58. package/cjs/layout/pivot-header-layout.js.map +1 -1
  59. package/cjs/layout/pivot-layout.js +2 -0
  60. package/cjs/layout/row-height-map.js +11 -4
  61. package/cjs/layout/row-height-map.js.map +1 -1
  62. package/cjs/layout/simple-header-layout.d.ts +2 -0
  63. package/cjs/layout/simple-header-layout.js +28 -12
  64. package/cjs/layout/simple-header-layout.js.map +1 -1
  65. package/cjs/layout/tree-helper.d.ts +2 -0
  66. package/cjs/layout/tree-helper.js +10 -1
  67. package/cjs/layout/tree-helper.js.map +1 -1
  68. package/cjs/plugins/index.js +1 -1
  69. package/cjs/plugins/interface.js +1 -2
  70. package/cjs/plugins/invert-highlight.js +1 -1
  71. package/cjs/plugins/list-tree-stick-cell.js +1 -1
  72. package/cjs/plugins/plugin-manager.js +1 -1
  73. package/cjs/scenegraph/component/custom.js.map +1 -1
  74. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +4 -2
  75. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  76. package/cjs/scenegraph/graphic/icon.d.ts +1 -0
  77. package/cjs/scenegraph/graphic/icon.js +30 -2
  78. package/cjs/scenegraph/graphic/icon.js.map +1 -1
  79. package/cjs/scenegraph/group-creater/cell-helper.js +5 -5
  80. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  81. package/cjs/scenegraph/group-creater/column-helper.js +1 -1
  82. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  83. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +4 -4
  84. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  85. package/cjs/scenegraph/group-creater/progress/proxy.js +3 -3
  86. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  87. package/cjs/scenegraph/layout/compute-col-width.js +11 -1
  88. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  89. package/cjs/scenegraph/scenegraph.js +23 -18
  90. package/cjs/scenegraph/scenegraph.js.map +1 -1
  91. package/cjs/state/select/update-position.js +5 -2
  92. package/cjs/state/select/update-position.js.map +1 -1
  93. package/cjs/state/state.d.ts +2 -0
  94. package/cjs/state/state.js +18 -6
  95. package/cjs/state/state.js.map +1 -1
  96. package/cjs/tools/env.d.ts +1 -0
  97. package/cjs/tools/env.js +13 -2
  98. package/cjs/tools/env.js.map +1 -1
  99. package/cjs/ts-types/base-table.d.ts +10 -0
  100. package/cjs/ts-types/base-table.js.map +1 -1
  101. package/cjs/ts-types/dataset/aggregation.d.ts +8 -6
  102. package/cjs/ts-types/dataset/aggregation.js +109 -54
  103. package/cjs/ts-types/dataset/aggregation.js.map +1 -1
  104. package/cjs/ts-types/events.d.ts +1 -0
  105. package/cjs/ts-types/events.js.map +1 -1
  106. package/cjs/ts-types/list-table/define/basic-define.d.ts +1 -0
  107. package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
  108. package/cjs/ts-types/new-data-set.d.ts +1 -0
  109. package/cjs/ts-types/new-data-set.js.map +1 -1
  110. package/cjs/ts-types/table-engine.d.ts +2 -1
  111. package/cjs/ts-types/table-engine.js.map +1 -1
  112. package/cjs/vrender.d.ts +3 -3
  113. package/cjs/vrender.js +4 -21
  114. package/cjs/vrender.js.map +1 -1
  115. package/dist/vtable.js +8848 -3947
  116. package/dist/vtable.min.js +2 -2
  117. package/es/ListTable-all.js +4 -4
  118. package/es/ListTable-all.js.map +1 -1
  119. package/es/ListTable.d.ts +7 -2
  120. package/es/ListTable.js +42 -2
  121. package/es/ListTable.js.map +1 -1
  122. package/es/PivotChart.js +4 -4
  123. package/es/PivotChart.js.map +1 -1
  124. package/es/PivotTable-all.js +3 -3
  125. package/es/PivotTable-all.js.map +1 -1
  126. package/es/PivotTable.d.ts +4 -0
  127. package/es/PivotTable.js +44 -0
  128. package/es/PivotTable.js.map +1 -1
  129. package/es/body-helper/style/ButtonStyle.d.ts +1 -1
  130. package/es/body-helper/style/ButtonStyle.js +1 -1
  131. package/es/body-helper/style/ButtonStyle.js.map +1 -1
  132. package/es/body-helper/style/SwitchStyle.d.ts +1 -1
  133. package/es/body-helper/style/SwitchStyle.js +1 -1
  134. package/es/body-helper/style/SwitchStyle.js.map +1 -1
  135. package/es/body-helper/style.js +2 -1
  136. package/es/components/index.d.ts +1 -0
  137. package/es/components/index.js +6 -0
  138. package/es/components/index.js.map +1 -1
  139. package/es/components/menu/dom/logic/MenuElement.js +7 -3
  140. package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
  141. package/es/core/BaseTable.d.ts +13 -0
  142. package/es/core/BaseTable.js +113 -42
  143. package/es/core/BaseTable.js.map +1 -1
  144. package/es/core/animation.js +1 -1
  145. package/es/core/animation.js.map +1 -1
  146. package/es/core/record-helper.d.ts +1 -1
  147. package/es/core/record-helper.js +99 -65
  148. package/es/core/record-helper.js.map +1 -1
  149. package/es/data/DataSource.d.ts +3 -0
  150. package/es/data/DataSource.js +36 -7
  151. package/es/data/DataSource.js.map +1 -1
  152. package/es/dataset/dataset.d.ts +1 -0
  153. package/es/dataset/dataset.js +66 -2
  154. package/es/dataset/dataset.js.map +1 -1
  155. package/es/edit/edit-manager.js +8 -5
  156. package/es/edit/edit-manager.js.map +1 -1
  157. package/es/event/event.js +1 -3
  158. package/es/event/event.js.map +1 -1
  159. package/es/event/listener/container-dom.js +35 -32
  160. package/es/event/listener/container-dom.js.map +1 -1
  161. package/es/event/listener/table-group.js +36 -31
  162. package/es/event/listener/table-group.js.map +1 -1
  163. package/es/event/scroll.js +6 -5
  164. package/es/event/scroll.js.map +1 -1
  165. package/es/event/self-event-listener/base-table/right-button-click.js +2 -2
  166. package/es/event/self-event-listener/base-table/right-button-click.js.map +1 -1
  167. package/es/index.d.ts +2 -1
  168. package/es/index.js +3 -1
  169. package/es/index.js.map +1 -1
  170. package/es/layout/index.js +2 -1
  171. package/es/layout/layout-helper.js +1 -1
  172. package/es/layout/pivot-header-layout.d.ts +7 -0
  173. package/es/layout/pivot-header-layout.js +93 -8
  174. package/es/layout/pivot-header-layout.js.map +1 -1
  175. package/es/layout/pivot-layout.js +2 -0
  176. package/es/layout/row-height-map.js +11 -4
  177. package/es/layout/row-height-map.js.map +1 -1
  178. package/es/layout/simple-header-layout.d.ts +2 -0
  179. package/es/layout/simple-header-layout.js +28 -12
  180. package/es/layout/simple-header-layout.js.map +1 -1
  181. package/es/layout/tree-helper.d.ts +2 -0
  182. package/es/layout/tree-helper.js +10 -1
  183. package/es/layout/tree-helper.js.map +1 -1
  184. package/es/plugins/index.js +1 -1
  185. package/es/plugins/interface.js +1 -2
  186. package/es/plugins/invert-highlight.js +1 -1
  187. package/es/plugins/list-tree-stick-cell.js +1 -1
  188. package/es/plugins/plugin-manager.js +1 -1
  189. package/es/scenegraph/component/custom.js.map +1 -1
  190. package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -2
  191. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  192. package/es/scenegraph/graphic/icon.d.ts +1 -0
  193. package/es/scenegraph/graphic/icon.js +6 -1
  194. package/es/scenegraph/graphic/icon.js.map +1 -1
  195. package/es/scenegraph/group-creater/cell-helper.js +5 -5
  196. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  197. package/es/scenegraph/group-creater/column-helper.js +1 -1
  198. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  199. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +4 -4
  200. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  201. package/es/scenegraph/group-creater/progress/proxy.js +3 -3
  202. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  203. package/es/scenegraph/layout/compute-col-width.js +11 -1
  204. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  205. package/es/scenegraph/scenegraph.js +23 -18
  206. package/es/scenegraph/scenegraph.js.map +1 -1
  207. package/es/state/select/update-position.js +5 -2
  208. package/es/state/select/update-position.js.map +1 -1
  209. package/es/state/state.d.ts +2 -0
  210. package/es/state/state.js +18 -6
  211. package/es/state/state.js.map +1 -1
  212. package/es/tools/env.d.ts +1 -0
  213. package/es/tools/env.js +11 -0
  214. package/es/tools/env.js.map +1 -1
  215. package/es/ts-types/base-table.d.ts +10 -0
  216. package/es/ts-types/base-table.js.map +1 -1
  217. package/es/ts-types/dataset/aggregation.d.ts +8 -6
  218. package/es/ts-types/dataset/aggregation.js +109 -54
  219. package/es/ts-types/dataset/aggregation.js.map +1 -1
  220. package/es/ts-types/events.d.ts +1 -0
  221. package/es/ts-types/events.js.map +1 -1
  222. package/es/ts-types/list-table/define/basic-define.d.ts +1 -0
  223. package/es/ts-types/list-table/define/basic-define.js.map +1 -1
  224. package/es/ts-types/new-data-set.d.ts +1 -0
  225. package/es/ts-types/new-data-set.js.map +1 -1
  226. package/es/ts-types/table-engine.d.ts +2 -1
  227. package/es/ts-types/table-engine.js.map +1 -1
  228. package/es/vrender.d.ts +3 -3
  229. package/es/vrender.js +2 -4
  230. package/es/vrender.js.map +1 -1
  231. package/package.json +7 -6
@@ -11,8 +11,9 @@ exports.registeredAggregators = {};
11
11
  class Aggregator {
12
12
  constructor(config) {
13
13
  var _a;
14
- this.isAggregator = !0, this.isRecord = !0, this.records = [], this.key = config.key,
15
- this.field = config.field, this.formatFun = config.formatFun, this.isRecord = null !== (_a = config.isRecord) && void 0 !== _a ? _a : this.isRecord;
14
+ this.isAggregator = !0, this.isRecord = !0, this.records = [], this.children = [],
15
+ this.key = config.key, this.field = config.field, this.formatFun = config.formatFun,
16
+ this.isRecord = null !== (_a = config.isRecord) && void 0 !== _a ? _a : this.isRecord;
16
17
  }
17
18
  clearCacheValue() {
18
19
  this._formatedValue = void 0;
@@ -22,7 +23,7 @@ class Aggregator {
22
23
  this._formatedValue;
23
24
  }
24
25
  reset() {
25
- this.records = [], this.clearCacheValue();
26
+ this.records = [], this.changedValue = void 0, this.children = [], this.clearCacheValue();
26
27
  }
27
28
  }
28
29
 
@@ -34,21 +35,24 @@ class RecordAggregator extends Aggregator {
34
35
  }
35
36
  push(record) {
36
37
  record && this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)),
37
- this.clearCacheValue();
38
+ record.isAggregator && this.children && this.children.push(record), this.clearCacheValue();
38
39
  }
39
40
  deleteRecord(record) {
40
- record && this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
41
+ record && (this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
42
+ record.isAggregator && this.children && (this.children = this.children.filter((item => item !== record)))),
41
43
  this.clearCacheValue();
42
44
  }
43
45
  updateRecord(oldRecord, newRecord) {
44
46
  oldRecord && newRecord && (this.isRecord && this.records && (this.records = this.records.map((item => item === oldRecord ? newRecord : item))),
47
+ oldRecord.isAggregator && newRecord.isAggregator && this.children && (this.children = this.children.map((item => item === oldRecord ? newRecord : item))),
45
48
  this.clearCacheValue());
46
49
  }
47
50
  value() {
48
- return this.records;
51
+ var _a;
52
+ return null !== (_a = this.changedValue) && void 0 !== _a ? _a : this.records;
49
53
  }
50
54
  reset() {
51
- this.records = [];
55
+ this.children = [], this.changedValue = void 0, this.records = [];
52
56
  }
53
57
  recalculate() {}
54
58
  }
@@ -60,24 +64,27 @@ class NoneAggregator extends Aggregator {
60
64
  super(...arguments), this.type = __1.AggregationType.NONE, this.isRecord = !0;
61
65
  }
62
66
  push(record) {
63
- record && (this.isRecord && (this.records = [ record ]), this.field && (this.fieldValue = record[this.field])),
64
- this.clearCacheValue();
67
+ record && (this.isRecord && (this.records = [ record ]), record.isAggregator && this.children && (this.children = [ record ]),
68
+ this.field && (this.fieldValue = record[this.field])), this.clearCacheValue();
65
69
  }
66
70
  deleteRecord(record) {
67
71
  record && (this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
72
+ record.isAggregator && this.children && (this.children = this.children.filter((item => item !== record))),
68
73
  this.field && this.records.length && (this.fieldValue = this.records[this.records.length - 1][this.field])),
69
74
  this.clearCacheValue();
70
75
  }
71
76
  updateRecord(oldRecord, newRecord) {
72
77
  oldRecord && newRecord && (this.isRecord && this.records && (this.records = this.records.map((item => item === oldRecord ? newRecord : item))),
78
+ oldRecord.isAggregator && newRecord.isAggregator && this.children && (this.children = this.children.map((item => item === oldRecord ? newRecord : item))),
73
79
  this.field && this.records.length && (this.fieldValue = this.records[this.records.length - 1][this.field]),
74
80
  this.clearCacheValue());
75
81
  }
76
82
  value() {
77
- return this.fieldValue;
83
+ var _a;
84
+ return null !== (_a = this.changedValue) && void 0 !== _a ? _a : this.fieldValue;
78
85
  }
79
86
  reset() {
80
- this.records = [], this.fieldValue = void 0;
87
+ this.children = [], this.changedValue = void 0, this.records = [], this.fieldValue = void 0;
81
88
  }
82
89
  recalculate() {}
83
90
  }
@@ -91,25 +98,28 @@ class CustomAggregator extends Aggregator {
91
98
  }
92
99
  push(record) {
93
100
  record && (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)),
94
- this.field && this.values.push(record[this.field])), this.clearCacheValue();
101
+ record.isAggregator && this.children && this.children.push(record), this.field && this.values.push(record[this.field])),
102
+ this.clearCacheValue();
95
103
  }
96
104
  updateRecord(oldRecord, newRecord) {
97
105
  oldRecord && newRecord && (this.isRecord && this.records && (this.records = this.records.map((item => item === oldRecord ? newRecord : item))),
106
+ oldRecord.isAggregator && newRecord.isAggregator && this.children && (this.children = this.children.map((item => item === oldRecord ? newRecord : item))),
98
107
  this.field && this.records.length && (this.values = this.records.map((item => item[this.field]))),
99
108
  this.clearCacheValue());
100
109
  }
101
110
  deleteRecord(record) {
102
111
  record && (this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
112
+ record.isAggregator && this.children && (this.children = this.children.filter((item => item !== record))),
103
113
  this.field && this.records.length && (this.values = this.records.map((item => item[this.field])))),
104
114
  this.clearCacheValue();
105
115
  }
106
116
  value() {
107
- var _a;
117
+ var _a, _b;
108
118
  return this.fieldValue || (this.fieldValue = null === (_a = this.aggregationFun) || void 0 === _a ? void 0 : _a.call(this, this.values, this.records, this.field)),
109
- this.fieldValue;
119
+ null !== (_b = this.changedValue) && void 0 !== _b ? _b : this.fieldValue;
110
120
  }
111
121
  reset() {
112
- this.records = [], this.fieldValue = void 0;
122
+ this.records = [], this.children = [], this.changedValue = void 0, this.fieldValue = void 0;
113
123
  }
114
124
  recalculate() {
115
125
  this.fieldValue = void 0, this._formatedValue = void 0;
@@ -126,26 +136,28 @@ class RecalculateAggregator extends Aggregator {
126
136
  }
127
137
  push(record) {
128
138
  record && this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)),
129
- this.clearCacheValue();
139
+ this.children && record.isAggregator && this.children.push(record), this.clearCacheValue();
130
140
  }
131
141
  deleteRecord(record) {
132
- record && this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
142
+ record && (this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
143
+ record.isAggregator && this.children && (this.children = this.children.filter((item => item !== record)))),
133
144
  this.clearCacheValue();
134
145
  }
135
146
  updateRecord(oldRecord, newRecord) {
136
147
  oldRecord && newRecord && (this.isRecord && this.records && (this.records = this.records.map((item => item === oldRecord ? newRecord : item))),
148
+ oldRecord.isAggregator && newRecord.isAggregator && this.children && (this.children = this.children.map((item => item === oldRecord ? newRecord : item))),
137
149
  this.clearCacheValue());
138
150
  }
139
151
  value() {
140
- var _a;
152
+ var _a, _b;
141
153
  if (!this.fieldValue) {
142
154
  const aggregatorValue = _getDependAggregatorValues(this.dependAggregators, this.dependIndicatorKeys);
143
155
  this.fieldValue = null === (_a = this.calculateFun) || void 0 === _a ? void 0 : _a.call(this, aggregatorValue, this.records, this.field);
144
156
  }
145
- return this.fieldValue;
157
+ return null !== (_b = this.changedValue) && void 0 !== _b ? _b : this.fieldValue;
146
158
  }
147
159
  reset() {
148
- this.records = [], this.fieldValue = void 0;
160
+ this.records = [], this.children = [], this.changedValue = void 0, this.fieldValue = void 0;
149
161
  }
150
162
  recalculate() {}
151
163
  }
@@ -160,7 +172,8 @@ class SumAggregator extends Aggregator {
160
172
  }
161
173
  push(record) {
162
174
  if (record) if (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)),
163
- record.isAggregator) {
175
+ record.isAggregator && this.children) {
176
+ this.children.push(record);
164
177
  const value = record.value();
165
178
  this.sum += null != value ? value : 0, this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum += value : value < 0 && (this.nagetiveSum += value));
166
179
  } else if (this.field && !isNaN(parseFloat(record[this.field]))) {
@@ -171,7 +184,8 @@ class SumAggregator extends Aggregator {
171
184
  }
172
185
  deleteRecord(record) {
173
186
  if (record) if (this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
174
- record.isAggregator) {
187
+ record.isAggregator && this.children) {
188
+ this.children = this.children.filter((item => item !== record));
175
189
  const value = record.value();
176
190
  this.sum -= null != value ? value : 0, this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum -= value : value < 0 && (this.nagetiveSum -= value));
177
191
  } else if (this.field && !isNaN(parseFloat(record[this.field]))) {
@@ -183,9 +197,11 @@ class SumAggregator extends Aggregator {
183
197
  updateRecord(oldRecord, newRecord) {
184
198
  if (oldRecord && newRecord) {
185
199
  if (this.isRecord && this.records && (this.records = this.records.map((item => item === oldRecord ? newRecord : item))),
186
- oldRecord.isAggregator) {
187
- const oldValue = oldRecord.value(), newValue = newRecord.value();
188
- this.sum += newValue - oldValue, this.needSplitPositiveAndNegativeForSum && (oldValue > 0 ? this.positiveSum -= oldValue : oldValue < 0 && (this.nagetiveSum -= oldValue),
200
+ oldRecord.isAggregator && this.children) {
201
+ const oldValue = oldRecord.value();
202
+ this.children = this.children.filter((item => item !== oldRecord));
203
+ const newValue = newRecord.value();
204
+ this.children.push(newRecord), this.sum += newValue - oldValue, this.needSplitPositiveAndNegativeForSum && (oldValue > 0 ? this.positiveSum -= oldValue : oldValue < 0 && (this.nagetiveSum -= oldValue),
189
205
  newValue > 0 ? this.positiveSum += newValue : newValue < 0 && (this.nagetiveSum += newValue));
190
206
  } else if (this.field && !isNaN(parseFloat(oldRecord[this.field]))) {
191
207
  const oldValue = parseFloat(oldRecord[this.field]), newValue = parseFloat(newRecord[this.field]);
@@ -196,8 +212,8 @@ class SumAggregator extends Aggregator {
196
212
  }
197
213
  }
198
214
  value() {
199
- var _a;
200
- return (null === (_a = this.records) || void 0 === _a ? void 0 : _a.length) >= 1 ? this.sum : void 0;
215
+ var _a, _b;
216
+ return null !== (_a = this.changedValue) && void 0 !== _a ? _a : (null === (_b = this.records) || void 0 === _b ? void 0 : _b.length) >= 1 ? this.sum : void 0;
201
217
  }
202
218
  positiveValue() {
203
219
  return this.positiveSum;
@@ -209,7 +225,13 @@ class SumAggregator extends Aggregator {
209
225
  super.reset(), this.records = [], this.sum = 0;
210
226
  }
211
227
  recalculate() {
212
- if (this.sum = 0, this._formatedValue = void 0, this.records) for (let i = 0; i < this.records.length; i++) {
228
+ if (this.sum = 0, this._formatedValue = void 0, this.children && this.children.length > 0) for (let i = 0; i < this.children.length; i++) {
229
+ const child = this.children[i];
230
+ if (child.isAggregator) {
231
+ const value = child.value();
232
+ this.sum += null != value ? value : 0, this.needSplitPositiveAndNegativeForSum && (value > 0 ? this.positiveSum += value : value < 0 && (this.nagetiveSum += value));
233
+ }
234
+ } else if (this.records) for (let i = 0; i < this.records.length; i++) {
213
235
  const record = this.records[i];
214
236
  if (record.isAggregator) {
215
237
  const value = record.value();
@@ -230,24 +252,34 @@ class CountAggregator extends Aggregator {
230
252
  }
231
253
  push(record) {
232
254
  record && (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)),
233
- record.isAggregator ? this.count += record.value() : this.count++), this.clearCacheValue();
255
+ record.isAggregator ? (this.children && this.children.push(record), this.count += record.value()) : this.count++),
256
+ this.clearCacheValue();
234
257
  }
235
258
  deleteRecord(record) {
236
259
  record && (this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
237
- record.isAggregator ? this.count -= record.value() : this.count--), this.clearCacheValue();
260
+ record.isAggregator ? (this.children && (this.children = this.children.filter((item => item !== record))),
261
+ this.count -= record.value()) : this.count--), this.clearCacheValue();
238
262
  }
239
263
  updateRecord(oldRecord, newRecord) {
240
264
  oldRecord && newRecord && (this.isRecord && this.records && (this.records = this.records.map((item => item === oldRecord ? newRecord : item))),
241
- oldRecord.isAggregator && (this.count += newRecord.value() - oldRecord.value()));
265
+ oldRecord.isAggregator && (this.count += newRecord.value() - oldRecord.value()),
266
+ oldRecord.isAggregator && newRecord.isAggregator && this.children && (this.children = this.children.map((item => item === oldRecord ? newRecord : item))));
242
267
  }
243
268
  value() {
244
- return this.count;
269
+ var _a;
270
+ return null !== (_a = this.changedValue) && void 0 !== _a ? _a : this.count;
245
271
  }
246
272
  reset() {
247
- this.records = [], this.count = 0;
273
+ this.changedValue = void 0, this.children = [], this.records = [], this.count = 0;
248
274
  }
249
275
  recalculate() {
250
- if (this.count = 0, this._formatedValue = void 0, this.records) for (let i = 0; i < this.records.length; i++) {
276
+ if (this.count = 0, this._formatedValue = void 0, this.children && this.children.length > 0) for (let i = 0; i < this.children.length; i++) {
277
+ const child = this.children[i];
278
+ if (child.isAggregator) {
279
+ const value = child.value();
280
+ this.count += null != value ? value : 0;
281
+ } else this.count++;
282
+ } else if (this.records) for (let i = 0; i < this.records.length; i++) {
251
283
  const record = this.records[i];
252
284
  record.isAggregator ? this.count += record.value() : this.count++;
253
285
  }
@@ -262,31 +294,38 @@ class AvgAggregator extends Aggregator {
262
294
  }
263
295
  push(record) {
264
296
  record && (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)),
265
- record.isAggregator && record.type === __1.AggregationType.AVG ? (this.sum += record.sum,
266
- this.count += record.count) : this.field && !isNaN(parseFloat(record[this.field])) && (this.sum += parseFloat(record[this.field]),
297
+ record.isAggregator && record.type === __1.AggregationType.AVG ? (this.children && this.children.push(record),
298
+ this.sum += record.sum, this.count += record.count) : this.field && !isNaN(parseFloat(record[this.field])) && (this.sum += parseFloat(record[this.field]),
267
299
  this.count++)), this.clearCacheValue();
268
300
  }
269
301
  deleteRecord(record) {
270
302
  record && (this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
271
- record.isAggregator && record.type === __1.AggregationType.AVG ? (this.sum -= record.sum,
272
- this.count -= record.count) : this.field && !isNaN(parseFloat(record[this.field])) && (this.sum -= parseFloat(record[this.field]),
303
+ record.isAggregator && record.type === __1.AggregationType.AVG ? (this.children && (this.children = this.children.filter((item => item !== record))),
304
+ this.sum -= record.sum, this.count -= record.count) : this.field && !isNaN(parseFloat(record[this.field])) && (this.sum -= parseFloat(record[this.field]),
273
305
  this.count--)), this.clearCacheValue();
274
306
  }
275
307
  updateRecord(oldRecord, newRecord) {
276
308
  oldRecord && newRecord && (this.isRecord && this.records && (this.records = this.records.map((item => item === oldRecord ? newRecord : item))),
277
- oldRecord.isAggregator && oldRecord.type === __1.AggregationType.AVG ? (this.sum += newRecord.sum - oldRecord.sum,
278
- this.count += newRecord.count - oldRecord.count) : this.field && !isNaN(parseFloat(oldRecord[this.field])) && (this.sum += parseFloat(newRecord[this.field]) - parseFloat(oldRecord[this.field])),
309
+ oldRecord.isAggregator && oldRecord.type === __1.AggregationType.AVG ? (this.children && newRecord.isAggregator && (this.children = this.children.map((item => item === oldRecord ? newRecord : item))),
310
+ this.sum += newRecord.sum - oldRecord.sum, this.count += newRecord.count - oldRecord.count) : this.field && !isNaN(parseFloat(oldRecord[this.field])) && (this.sum += parseFloat(newRecord[this.field]) - parseFloat(oldRecord[this.field])),
279
311
  this.clearCacheValue());
280
312
  }
281
313
  value() {
282
- var _a;
283
- return (null === (_a = this.records) || void 0 === _a ? void 0 : _a.length) >= 1 ? this.sum / this.count : void 0;
314
+ var _a, _b;
315
+ return null !== (_a = this.changedValue) && void 0 !== _a ? _a : (null === (_b = this.records) || void 0 === _b ? void 0 : _b.length) >= 1 ? this.sum / this.count : void 0;
284
316
  }
285
317
  reset() {
286
- this.records = [], this.sum = 0, this.count = 0;
318
+ this.changedValue = void 0, this.children = [], this.records = [], this.sum = 0,
319
+ this.count = 0;
287
320
  }
288
321
  recalculate() {
289
- if (this.sum = 0, this.count = 0, this._formatedValue = void 0, this.records) for (let i = 0; i < this.records.length; i++) {
322
+ if (this.sum = 0, this.count = 0, this._formatedValue = void 0, this.children && this.children.length > 0) for (let i = 0; i < this.children.length; i++) {
323
+ const child = this.children[i];
324
+ if (child.isAggregator && child.type === __1.AggregationType.AVG) {
325
+ const childValue = child.value();
326
+ this.sum += childValue * child.count, this.count += child.count;
327
+ }
328
+ } else if (this.records) for (let i = 0; i < this.records.length; i++) {
290
329
  const record = this.records[i];
291
330
  record.isAggregator && record.type === __1.AggregationType.AVG ? (this.sum += record.sum,
292
331
  this.count += record.count) : this.field && !isNaN(parseFloat(record[this.field])) && (this.sum += parseFloat(record[this.field]),
@@ -303,26 +342,34 @@ class MaxAggregator extends Aggregator {
303
342
  }
304
343
  push(record) {
305
344
  record && (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)),
306
- record.isAggregator ? this.max = record.max > this.max ? record.max : this.max : "number" == typeof record ? this.max = record > this.max ? record : this.max : this.field && "number" == typeof record[this.field] ? this.max = record[this.field] > this.max ? record[this.field] : this.max : this.field && !isNaN(record[this.field]) && (this.max = parseFloat(record[this.field]) > this.max ? parseFloat(record[this.field]) : this.max)),
345
+ record.isAggregator ? (this.children && this.children.push(record), this.max = record.max > this.max ? record.max : this.max) : "number" == typeof record ? this.max = record > this.max ? record : this.max : this.field && "number" == typeof record[this.field] ? this.max = record[this.field] > this.max ? record[this.field] : this.max : this.field && !isNaN(record[this.field]) && (this.max = parseFloat(record[this.field]) > this.max ? parseFloat(record[this.field]) : this.max)),
307
346
  this.clearCacheValue();
308
347
  }
309
348
  deleteRecord(record) {
310
349
  record && (this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
350
+ record.isAggregator && this.children && (this.children = this.children.filter((item => item !== record))),
311
351
  this.recalculate());
312
352
  }
313
353
  updateRecord(oldRecord, newRecord) {
314
354
  oldRecord && newRecord && (this.isRecord && this.records && (this.records = this.records.map((item => item === oldRecord ? newRecord : item))),
355
+ oldRecord.isAggregator && newRecord.isAggregator && this.children && (this.children = this.children.map((item => item === oldRecord ? newRecord : item))),
315
356
  this.recalculate());
316
357
  }
317
358
  value() {
318
- var _a;
319
- return (null === (_a = this.records) || void 0 === _a ? void 0 : _a.length) >= 1 ? this.max : void 0;
359
+ var _a, _b;
360
+ return null !== (_a = this.changedValue) && void 0 !== _a ? _a : (null === (_b = this.records) || void 0 === _b ? void 0 : _b.length) >= 1 ? this.max : void 0;
320
361
  }
321
362
  reset() {
322
- this.records = [], this.max = Number.MIN_SAFE_INTEGER;
363
+ this.records = [], this.changedValue = void 0, this.children = [], this.max = Number.MIN_SAFE_INTEGER;
323
364
  }
324
365
  recalculate() {
325
- if (this.max = Number.MIN_SAFE_INTEGER, this._formatedValue = void 0, this.records) for (let i = 0; i < this.records.length; i++) {
366
+ if (this.max = Number.MIN_SAFE_INTEGER, this._formatedValue = void 0, this.children && this.children.length > 0) for (let i = 0; i < this.children.length; i++) {
367
+ const child = this.children[i];
368
+ if (child.isAggregator) {
369
+ const childValue = child.value();
370
+ this.max = Math.max(this.max, childValue);
371
+ }
372
+ } else if (this.records) for (let i = 0; i < this.records.length; i++) {
326
373
  const record = this.records[i];
327
374
  record.isAggregator ? this.max = record.max > this.max ? record.max : this.max : "number" == typeof record ? this.max = record > this.max ? record : this.max : this.field && "number" == typeof record[this.field] ? this.max = record[this.field] > this.max ? record[this.field] : this.max : this.field && !isNaN(record[this.field]) && (this.max = parseFloat(record[this.field]) > this.max ? parseFloat(record[this.field]) : this.max);
328
375
  }
@@ -337,26 +384,34 @@ class MinAggregator extends Aggregator {
337
384
  }
338
385
  push(record) {
339
386
  record && (this.isRecord && this.records && (record.isAggregator ? this.records.push(...record.records) : this.records.push(record)),
340
- record.isAggregator ? this.min = record.min < this.min ? record.min : this.min : "number" == typeof record ? this.min = record < this.min ? record : this.min : this.field && "number" == typeof record[this.field] ? this.min = record[this.field] < this.min ? record[this.field] : this.min : this.field && !isNaN(record[this.field]) && (this.min = parseFloat(record[this.field]) < this.min ? parseFloat(record[this.field]) : this.min)),
387
+ record.isAggregator ? (this.children && this.children.push(record), this.min = record.min < this.min ? record.min : this.min) : "number" == typeof record ? this.min = record < this.min ? record : this.min : this.field && "number" == typeof record[this.field] ? this.min = record[this.field] < this.min ? record[this.field] : this.min : this.field && !isNaN(record[this.field]) && (this.min = parseFloat(record[this.field]) < this.min ? parseFloat(record[this.field]) : this.min)),
341
388
  this.clearCacheValue();
342
389
  }
343
390
  deleteRecord(record) {
344
391
  record && (this.isRecord && this.records && (this.records = this.records.filter((item => item !== record))),
392
+ record.isAggregator && this.children && (this.children = this.children.filter((item => item !== record))),
345
393
  this.recalculate());
346
394
  }
347
395
  updateRecord(oldRecord, newRecord) {
348
396
  oldRecord && newRecord && (this.isRecord && this.records && (this.records = this.records.map((item => item === oldRecord ? newRecord : item))),
397
+ oldRecord.isAggregator && newRecord.isAggregator && this.children && (this.children = this.children.map((item => item === oldRecord ? newRecord : item))),
349
398
  this.recalculate());
350
399
  }
351
400
  value() {
352
- var _a;
353
- return (null === (_a = this.records) || void 0 === _a ? void 0 : _a.length) >= 1 ? this.min : void 0;
401
+ var _a, _b;
402
+ return null !== (_a = this.changedValue) && void 0 !== _a ? _a : (null === (_b = this.records) || void 0 === _b ? void 0 : _b.length) >= 1 ? this.min : void 0;
354
403
  }
355
404
  reset() {
356
- this.records = [], this.min = Number.MAX_SAFE_INTEGER;
405
+ this.records = [], this.changedValue = void 0, this.children = [], this.min = Number.MAX_SAFE_INTEGER;
357
406
  }
358
407
  recalculate() {
359
- if (this.min = Number.MAX_SAFE_INTEGER, this._formatedValue = void 0, this.records) for (let i = 0; i < this.records.length; i++) {
408
+ if (this.min = Number.MAX_SAFE_INTEGER, this._formatedValue = void 0, this.children && this.children.length > 0) for (let i = 0; i < this.children.length; i++) {
409
+ const child = this.children[i];
410
+ if (child.isAggregator) {
411
+ const childValue = child.value();
412
+ this.min = Math.min(this.min, childValue);
413
+ }
414
+ } else if (this.records) for (let i = 0; i < this.records.length; i++) {
360
415
  const record = this.records[i];
361
416
  record.isAggregator ? this.min = record.min < this.min ? record.min : this.min : "number" == typeof record ? this.min = record < this.min ? record : this.min : this.field && "number" == typeof record[this.field] ? this.min = record[this.field] < this.min ? record[this.field] : this.min : this.field && !isNaN(record[this.field]) && (this.min = parseFloat(record[this.field]) < this.min ? parseFloat(record[this.field]) : this.min);
362
417
  }