ngx-axis-appforge 0.0.81 → 0.0.83

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 (186) hide show
  1. package/axis-components/edit-table/index.d.ts +2 -5
  2. package/axis-components/table/index.d.ts +6 -8
  3. package/axis-components/table-helper/index.d.ts +24 -0
  4. package/axis-components/transfer/index.d.ts +2 -0
  5. package/core/index.d.ts +7 -3
  6. package/fesm2022/ngx-axis-appforge-axis-components-badge-design.mjs +4 -4
  7. package/fesm2022/ngx-axis-appforge-axis-components-badge-design.mjs.map +1 -1
  8. package/fesm2022/ngx-axis-appforge-axis-components-badge.mjs +3 -3
  9. package/fesm2022/ngx-axis-appforge-axis-components-badge.mjs.map +1 -1
  10. package/fesm2022/ngx-axis-appforge-axis-components-button-design.mjs +3 -3
  11. package/fesm2022/ngx-axis-appforge-axis-components-button-design.mjs.map +1 -1
  12. package/fesm2022/ngx-axis-appforge-axis-components-button.mjs +3 -3
  13. package/fesm2022/ngx-axis-appforge-axis-components-button.mjs.map +1 -1
  14. package/fesm2022/ngx-axis-appforge-axis-components-checkbox-design.mjs +3 -3
  15. package/fesm2022/ngx-axis-appforge-axis-components-checkbox-design.mjs.map +1 -1
  16. package/fesm2022/ngx-axis-appforge-axis-components-checkbox.mjs +4 -4
  17. package/fesm2022/ngx-axis-appforge-axis-components-checkbox.mjs.map +1 -1
  18. package/fesm2022/ngx-axis-appforge-axis-components-color-picker-design.mjs +3 -3
  19. package/fesm2022/ngx-axis-appforge-axis-components-color-picker-design.mjs.map +1 -1
  20. package/fesm2022/ngx-axis-appforge-axis-components-color-picker.mjs +3 -3
  21. package/fesm2022/ngx-axis-appforge-axis-components-color-picker.mjs.map +1 -1
  22. package/fesm2022/ngx-axis-appforge-axis-components-cytoscape-design.mjs +3 -3
  23. package/fesm2022/ngx-axis-appforge-axis-components-cytoscape-design.mjs.map +1 -1
  24. package/fesm2022/ngx-axis-appforge-axis-components-cytoscape.mjs +3 -3
  25. package/fesm2022/ngx-axis-appforge-axis-components-cytoscape.mjs.map +1 -1
  26. package/fesm2022/ngx-axis-appforge-axis-components-date-picker-design.mjs +3 -3
  27. package/fesm2022/ngx-axis-appforge-axis-components-date-picker-design.mjs.map +1 -1
  28. package/fesm2022/ngx-axis-appforge-axis-components-date-picker.mjs +4 -4
  29. package/fesm2022/ngx-axis-appforge-axis-components-date-picker.mjs.map +1 -1
  30. package/fesm2022/ngx-axis-appforge-axis-components-desc-design.mjs +9 -9
  31. package/fesm2022/ngx-axis-appforge-axis-components-desc-design.mjs.map +1 -1
  32. package/fesm2022/ngx-axis-appforge-axis-components-desc.mjs +3 -3
  33. package/fesm2022/ngx-axis-appforge-axis-components-desc.mjs.map +1 -1
  34. package/fesm2022/ngx-axis-appforge-axis-components-design-design.mjs +3 -3
  35. package/fesm2022/ngx-axis-appforge-axis-components-design-design.mjs.map +1 -1
  36. package/fesm2022/ngx-axis-appforge-axis-components-design.mjs +21 -21
  37. package/fesm2022/ngx-axis-appforge-axis-components-design.mjs.map +1 -1
  38. package/fesm2022/ngx-axis-appforge-axis-components-dropdown-design.mjs +4 -4
  39. package/fesm2022/ngx-axis-appforge-axis-components-dropdown-design.mjs.map +1 -1
  40. package/fesm2022/ngx-axis-appforge-axis-components-dropdown.mjs +4 -4
  41. package/fesm2022/ngx-axis-appforge-axis-components-dropdown.mjs.map +1 -1
  42. package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container-design.mjs +3 -3
  43. package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container-design.mjs.map +1 -1
  44. package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container.mjs +3 -3
  45. package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container.mjs.map +1 -1
  46. package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value-design.mjs +3 -3
  47. package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value-design.mjs.map +1 -1
  48. package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value.mjs +4 -4
  49. package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value.mjs.map +1 -1
  50. package/fesm2022/ngx-axis-appforge-axis-components-echarts-design.mjs +3 -3
  51. package/fesm2022/ngx-axis-appforge-axis-components-echarts-design.mjs.map +1 -1
  52. package/fesm2022/ngx-axis-appforge-axis-components-echarts.mjs +3 -3
  53. package/fesm2022/ngx-axis-appforge-axis-components-echarts.mjs.map +1 -1
  54. package/fesm2022/ngx-axis-appforge-axis-components-edit-table-design.mjs +10 -12
  55. package/fesm2022/ngx-axis-appforge-axis-components-edit-table-design.mjs.map +1 -1
  56. package/fesm2022/ngx-axis-appforge-axis-components-edit-table.mjs +7 -10
  57. package/fesm2022/ngx-axis-appforge-axis-components-edit-table.mjs.map +1 -1
  58. package/fesm2022/ngx-axis-appforge-axis-components-editor-design.mjs +3 -3
  59. package/fesm2022/ngx-axis-appforge-axis-components-editor-design.mjs.map +1 -1
  60. package/fesm2022/ngx-axis-appforge-axis-components-editor.mjs +3 -3
  61. package/fesm2022/ngx-axis-appforge-axis-components-editor.mjs.map +1 -1
  62. package/fesm2022/ngx-axis-appforge-axis-components-flex-design.mjs +3 -3
  63. package/fesm2022/ngx-axis-appforge-axis-components-flex-design.mjs.map +1 -1
  64. package/fesm2022/ngx-axis-appforge-axis-components-flex.mjs +3 -3
  65. package/fesm2022/ngx-axis-appforge-axis-components-flex.mjs.map +1 -1
  66. package/fesm2022/ngx-axis-appforge-axis-components-form-design.mjs +3 -3
  67. package/fesm2022/ngx-axis-appforge-axis-components-form-design.mjs.map +1 -1
  68. package/fesm2022/ngx-axis-appforge-axis-components-form-item-design.mjs +3 -3
  69. package/fesm2022/ngx-axis-appforge-axis-components-form-item-design.mjs.map +1 -1
  70. package/fesm2022/ngx-axis-appforge-axis-components-form-item.mjs +4 -4
  71. package/fesm2022/ngx-axis-appforge-axis-components-form-item.mjs.map +1 -1
  72. package/fesm2022/ngx-axis-appforge-axis-components-form.mjs +3 -3
  73. package/fesm2022/ngx-axis-appforge-axis-components-form.mjs.map +1 -1
  74. package/fesm2022/ngx-axis-appforge-axis-components-icon-design.mjs +3 -3
  75. package/fesm2022/ngx-axis-appforge-axis-components-icon-design.mjs.map +1 -1
  76. package/fesm2022/ngx-axis-appforge-axis-components-icon.mjs +3 -3
  77. package/fesm2022/ngx-axis-appforge-axis-components-icon.mjs.map +1 -1
  78. package/fesm2022/ngx-axis-appforge-axis-components-image-design.mjs +3 -3
  79. package/fesm2022/ngx-axis-appforge-axis-components-image-design.mjs.map +1 -1
  80. package/fesm2022/ngx-axis-appforge-axis-components-image.mjs +3 -3
  81. package/fesm2022/ngx-axis-appforge-axis-components-image.mjs.map +1 -1
  82. package/fesm2022/ngx-axis-appforge-axis-components-input-component-design.mjs +3 -3
  83. package/fesm2022/ngx-axis-appforge-axis-components-input-component-design.mjs.map +1 -1
  84. package/fesm2022/ngx-axis-appforge-axis-components-input-component.mjs +4 -4
  85. package/fesm2022/ngx-axis-appforge-axis-components-input-component.mjs.map +1 -1
  86. package/fesm2022/ngx-axis-appforge-axis-components-input-design.mjs +3 -3
  87. package/fesm2022/ngx-axis-appforge-axis-components-input-design.mjs.map +1 -1
  88. package/fesm2022/ngx-axis-appforge-axis-components-input-icon-design.mjs +3 -3
  89. package/fesm2022/ngx-axis-appforge-axis-components-input-icon-design.mjs.map +1 -1
  90. package/fesm2022/ngx-axis-appforge-axis-components-input-icon.mjs +4 -4
  91. package/fesm2022/ngx-axis-appforge-axis-components-input-icon.mjs.map +1 -1
  92. package/fesm2022/ngx-axis-appforge-axis-components-input-json-design.mjs +3 -3
  93. package/fesm2022/ngx-axis-appforge-axis-components-input-json-design.mjs.map +1 -1
  94. package/fesm2022/ngx-axis-appforge-axis-components-input-json.mjs +4 -4
  95. package/fesm2022/ngx-axis-appforge-axis-components-input-json.mjs.map +1 -1
  96. package/fesm2022/ngx-axis-appforge-axis-components-input-number-design.mjs +3 -3
  97. package/fesm2022/ngx-axis-appforge-axis-components-input-number-design.mjs.map +1 -1
  98. package/fesm2022/ngx-axis-appforge-axis-components-input-number.mjs +3 -3
  99. package/fesm2022/ngx-axis-appforge-axis-components-input-number.mjs.map +1 -1
  100. package/fesm2022/ngx-axis-appforge-axis-components-input.mjs +4 -4
  101. package/fesm2022/ngx-axis-appforge-axis-components-input.mjs.map +1 -1
  102. package/fesm2022/ngx-axis-appforge-axis-components-menu-design.mjs +13 -13
  103. package/fesm2022/ngx-axis-appforge-axis-components-menu-design.mjs.map +1 -1
  104. package/fesm2022/ngx-axis-appforge-axis-components-menu.mjs +3 -3
  105. package/fesm2022/ngx-axis-appforge-axis-components-menu.mjs.map +1 -1
  106. package/fesm2022/ngx-axis-appforge-axis-components-modal-design.mjs +7 -7
  107. package/fesm2022/ngx-axis-appforge-axis-components-modal-design.mjs.map +1 -1
  108. package/fesm2022/ngx-axis-appforge-axis-components-modal.mjs +4 -4
  109. package/fesm2022/ngx-axis-appforge-axis-components-modal.mjs.map +1 -1
  110. package/fesm2022/ngx-axis-appforge-axis-components-radio-design.mjs +3 -3
  111. package/fesm2022/ngx-axis-appforge-axis-components-radio-design.mjs.map +1 -1
  112. package/fesm2022/ngx-axis-appforge-axis-components-radio.mjs +4 -4
  113. package/fesm2022/ngx-axis-appforge-axis-components-radio.mjs.map +1 -1
  114. package/fesm2022/ngx-axis-appforge-axis-components-rate-design.mjs +3 -3
  115. package/fesm2022/ngx-axis-appforge-axis-components-rate-design.mjs.map +1 -1
  116. package/fesm2022/ngx-axis-appforge-axis-components-rate.mjs +3 -3
  117. package/fesm2022/ngx-axis-appforge-axis-components-rate.mjs.map +1 -1
  118. package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor-design.mjs +3 -3
  119. package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor-design.mjs.map +1 -1
  120. package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor.mjs +3 -3
  121. package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor.mjs.map +1 -1
  122. package/fesm2022/ngx-axis-appforge-axis-components-scope-design.mjs +12 -12
  123. package/fesm2022/ngx-axis-appforge-axis-components-scope-design.mjs.map +1 -1
  124. package/fesm2022/ngx-axis-appforge-axis-components-scope.mjs +3 -3
  125. package/fesm2022/ngx-axis-appforge-axis-components-scope.mjs.map +1 -1
  126. package/fesm2022/ngx-axis-appforge-axis-components-select-design.mjs +3 -3
  127. package/fesm2022/ngx-axis-appforge-axis-components-select-design.mjs.map +1 -1
  128. package/fesm2022/ngx-axis-appforge-axis-components-select.mjs +4 -4
  129. package/fesm2022/ngx-axis-appforge-axis-components-select.mjs.map +1 -1
  130. package/fesm2022/ngx-axis-appforge-axis-components-single-selector-design.mjs +3 -3
  131. package/fesm2022/ngx-axis-appforge-axis-components-single-selector-design.mjs.map +1 -1
  132. package/fesm2022/ngx-axis-appforge-axis-components-single-selector.mjs +4 -4
  133. package/fesm2022/ngx-axis-appforge-axis-components-single-selector.mjs.map +1 -1
  134. package/fesm2022/ngx-axis-appforge-axis-components-splitter-design.mjs +9 -9
  135. package/fesm2022/ngx-axis-appforge-axis-components-splitter-design.mjs.map +1 -1
  136. package/fesm2022/ngx-axis-appforge-axis-components-splitter.mjs +3 -3
  137. package/fesm2022/ngx-axis-appforge-axis-components-splitter.mjs.map +1 -1
  138. package/fesm2022/ngx-axis-appforge-axis-components-steps-design.mjs +9 -9
  139. package/fesm2022/ngx-axis-appforge-axis-components-steps-design.mjs.map +1 -1
  140. package/fesm2022/ngx-axis-appforge-axis-components-steps.mjs +3 -3
  141. package/fesm2022/ngx-axis-appforge-axis-components-steps.mjs.map +1 -1
  142. package/fesm2022/ngx-axis-appforge-axis-components-switch-design.mjs +3 -3
  143. package/fesm2022/ngx-axis-appforge-axis-components-switch-design.mjs.map +1 -1
  144. package/fesm2022/ngx-axis-appforge-axis-components-switch.mjs +4 -4
  145. package/fesm2022/ngx-axis-appforge-axis-components-switch.mjs.map +1 -1
  146. package/fesm2022/ngx-axis-appforge-axis-components-table-design.mjs +17 -29
  147. package/fesm2022/ngx-axis-appforge-axis-components-table-design.mjs.map +1 -1
  148. package/fesm2022/ngx-axis-appforge-axis-components-table-helper.mjs +235 -42
  149. package/fesm2022/ngx-axis-appforge-axis-components-table-helper.mjs.map +1 -1
  150. package/fesm2022/ngx-axis-appforge-axis-components-table.mjs +74 -36
  151. package/fesm2022/ngx-axis-appforge-axis-components-table.mjs.map +1 -1
  152. package/fesm2022/ngx-axis-appforge-axis-components-tabs-design.mjs +9 -9
  153. package/fesm2022/ngx-axis-appforge-axis-components-tabs-design.mjs.map +1 -1
  154. package/fesm2022/ngx-axis-appforge-axis-components-tabs.mjs +4 -4
  155. package/fesm2022/ngx-axis-appforge-axis-components-tabs.mjs.map +1 -1
  156. package/fesm2022/ngx-axis-appforge-axis-components-text-design.mjs +3 -3
  157. package/fesm2022/ngx-axis-appforge-axis-components-text-design.mjs.map +1 -1
  158. package/fesm2022/ngx-axis-appforge-axis-components-text.mjs +3 -3
  159. package/fesm2022/ngx-axis-appforge-axis-components-text.mjs.map +1 -1
  160. package/fesm2022/ngx-axis-appforge-axis-components-textarea-design.mjs +3 -3
  161. package/fesm2022/ngx-axis-appforge-axis-components-textarea-design.mjs.map +1 -1
  162. package/fesm2022/ngx-axis-appforge-axis-components-textarea.mjs +4 -4
  163. package/fesm2022/ngx-axis-appforge-axis-components-textarea.mjs.map +1 -1
  164. package/fesm2022/ngx-axis-appforge-axis-components-timer-design.mjs +3 -3
  165. package/fesm2022/ngx-axis-appforge-axis-components-timer-design.mjs.map +1 -1
  166. package/fesm2022/ngx-axis-appforge-axis-components-timer.mjs +3 -3
  167. package/fesm2022/ngx-axis-appforge-axis-components-timer.mjs.map +1 -1
  168. package/fesm2022/ngx-axis-appforge-axis-components-transfer-design.mjs +9 -9
  169. package/fesm2022/ngx-axis-appforge-axis-components-transfer-design.mjs.map +1 -1
  170. package/fesm2022/ngx-axis-appforge-axis-components-transfer.mjs +9 -7
  171. package/fesm2022/ngx-axis-appforge-axis-components-transfer.mjs.map +1 -1
  172. package/fesm2022/ngx-axis-appforge-axis-components-tree-selector-design.mjs +9 -9
  173. package/fesm2022/ngx-axis-appforge-axis-components-tree-selector-design.mjs.map +1 -1
  174. package/fesm2022/ngx-axis-appforge-axis-components-tree-selector.mjs +4 -4
  175. package/fesm2022/ngx-axis-appforge-axis-components-tree-selector.mjs.map +1 -1
  176. package/fesm2022/ngx-axis-appforge-axis-components-upload-design.mjs +3 -3
  177. package/fesm2022/ngx-axis-appforge-axis-components-upload-design.mjs.map +1 -1
  178. package/fesm2022/ngx-axis-appforge-axis-components-upload.mjs +4 -4
  179. package/fesm2022/ngx-axis-appforge-axis-components-upload.mjs.map +1 -1
  180. package/fesm2022/ngx-axis-appforge-axis-components.mjs +0 -4
  181. package/fesm2022/ngx-axis-appforge-axis-components.mjs.map +1 -1
  182. package/fesm2022/ngx-axis-appforge-core.mjs +263 -145
  183. package/fesm2022/ngx-axis-appforge-core.mjs.map +1 -1
  184. package/fesm2022/ngx-axis-appforge-providers.mjs +2 -0
  185. package/fesm2022/ngx-axis-appforge-providers.mjs.map +1 -1
  186. package/package.json +211 -209
@@ -86,10 +86,10 @@ class TableFieldDisplayService {
86
86
  }
87
87
  return options.data;
88
88
  }
89
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: TableFieldDisplayService, deps: [{ token: i1.DatePipe }, { token: i1.DecimalPipe }, { token: i1.PercentPipe }, { token: i1$1.ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
90
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: TableFieldDisplayService });
89
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TableFieldDisplayService, deps: [{ token: i1.DatePipe }, { token: i1.DecimalPipe }, { token: i1.PercentPipe }, { token: i1$1.ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
90
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TableFieldDisplayService });
91
91
  }
92
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: TableFieldDisplayService, decorators: [{
92
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TableFieldDisplayService, decorators: [{
93
93
  type: Injectable
94
94
  }], ctorParameters: () => [{ type: i1.DatePipe }, { type: i1.DecimalPipe }, { type: i1.PercentPipe }, { type: i1$1.ScopeDirective, decorators: [{
95
95
  type: Optional
@@ -121,6 +121,12 @@ class TableService {
121
121
  fields;
122
122
  getRow;
123
123
  cacheFilterItem;
124
+ groupAbleFields = computed(() => {
125
+ const fields = this.displayFields().filter(f => f.groupAble());
126
+ fields.sort((a, b) => (a.groupLevel() ?? 0) - (b.groupLevel() ?? 0));
127
+ return fields;
128
+ }, ...(ngDevMode ? [{ debugName: "groupAbleFields" }] : []));
129
+ rowsGroupMap = computed(() => this.buildRowsGroupMap(), ...(ngDevMode ? [{ debugName: "rowsGroupMap" }] : []));
124
130
  useBackEndPaging = computed(() => this.options.showPagination() && this.options.useBackEndPaging(), ...(ngDevMode ? [{ debugName: "useBackEndPaging" }] : []));
125
131
  rows = computed(() => this.useBackEndPaging() ? this.data()?.rows : this.data(), ...(ngDevMode ? [{ debugName: "rows" }] : []));
126
132
  pageIndex = signal(1, ...(ngDevMode ? [{ debugName: "pageIndex" }] : []));
@@ -133,6 +139,8 @@ class TableService {
133
139
  return this.fields().filter(f => f.inuse());
134
140
  }, ...(ngDevMode ? [{ debugName: "displayFields" }] : []));
135
141
  fieldsControlsMap = signal({}, ...(ngDevMode ? [{ debugName: "fieldsControlsMap" }] : []));
142
+ tableData = signal([], ...(ngDevMode ? [{ debugName: "tableData" }] : []));
143
+ fieldsFilterValueMap = new Map();
136
144
  filedsFilterItemsCache = new Map();
137
145
  leaderFieldWidth = computed(() => this.buildLeaderFieldWidth(), ...(ngDevMode ? [{ debugName: "leaderFieldWidth" }] : []));
138
146
  pageSizeOptions = computed(() => this.options.pageSizeOptions().split(",").map(size => +size), ...(ngDevMode ? [{ debugName: "pageSizeOptions" }] : []));
@@ -145,6 +153,150 @@ class TableService {
145
153
  this.getRow = opts.getRow;
146
154
  this.cacheFilterItem = opts.cacheFilterItem ?? true;
147
155
  this.ready.set(true);
156
+ this.refreshTableData();
157
+ }
158
+ refreshTableData() {
159
+ let data = [...(this.rows() ?? [])];
160
+ if (!this.useBackEndPaging()) {
161
+ if (this.fieldsFilterValueMap.size) {
162
+ data = data.filter(row => {
163
+ for (const [field, filterValue] of this.fieldsFilterValueMap.entries()) {
164
+ if (Array.isArray(filterValue)) {
165
+ if (!filterValue.includes(row[field])) {
166
+ return false;
167
+ }
168
+ }
169
+ else {
170
+ if (row[field] != filterValue) {
171
+ return false;
172
+ }
173
+ }
174
+ }
175
+ return true;
176
+ });
177
+ }
178
+ }
179
+ const sortFields = this.fields().filter(f => this.fieldSortAble(f) && f.sortOrder() != null);
180
+ if (sortFields.length) {
181
+ sortFields.sort((a, b) => {
182
+ let ap = this.fieldSortPriority(a);
183
+ let bp = this.fieldSortPriority(b);
184
+ if (ap === bp) {
185
+ return 0;
186
+ }
187
+ if (ap === false) {
188
+ return 1;
189
+ }
190
+ else if (bp === false) {
191
+ return -1;
192
+ }
193
+ else {
194
+ return bp - ap;
195
+ }
196
+ });
197
+ data.sort((a, b) => {
198
+ for (const f of sortFields) {
199
+ const sortFn = this.fieldsControlsMap()[f.field()]?.sortFn;
200
+ if (typeof sortFn == "function") {
201
+ const res = sortFn(a, b);
202
+ if (res != 0) {
203
+ return res * (f.sortOrder() == "descend" ? -1 : 1);
204
+ }
205
+ }
206
+ }
207
+ return 0;
208
+ });
209
+ }
210
+ this.tableData.set(data);
211
+ }
212
+ buildRowsGroupMap() {
213
+ const rowsGroupMap = new Map();
214
+ if (!this.useBackEndPaging()) {
215
+ if (this.groupAbleFields().length > 0) {
216
+ for (let i = 0; i < this.tableData().length; i++) {
217
+ let valuePerfix = "";
218
+ const row = this.tableData()[i];
219
+ for (const field of this.groupAbleFields()) {
220
+ if (!rowsGroupMap.has(field.field())) {
221
+ rowsGroupMap.set(field.field(), new Map());
222
+ }
223
+ const groups = rowsGroupMap.get(field.field());
224
+ const value = valuePerfix + row[field.field()];
225
+ const newGroup = !groups.has(value);
226
+ if (newGroup) {
227
+ groups.set(value, [i]);
228
+ }
229
+ else {
230
+ groups.get(value).push(i);
231
+ }
232
+ valuePerfix += value + "@";
233
+ }
234
+ }
235
+ }
236
+ }
237
+ for (let group of rowsGroupMap.values()) {
238
+ for (let [value, indexes] of group) {
239
+ if (indexes.length == 1) {
240
+ group.delete(value);
241
+ }
242
+ }
243
+ }
244
+ return rowsGroupMap;
245
+ }
246
+ fieldSortAble(f) {
247
+ return f.sortAble() || f.groupAble();
248
+ }
249
+ fieldSortDirections(f) {
250
+ return f.groupAble() ? ['ascend', 'descend'] : ['ascend', 'descend', null];
251
+ }
252
+ fieldSortPriority(f) {
253
+ if (f.groupAble()) {
254
+ return (f.groupLevel() ?? 0);
255
+ }
256
+ if (f.sortAble()) {
257
+ let p = 0;
258
+ if (this.groupAbleFields().length) {
259
+ p = this.groupAbleFields()[this.groupAbleFields().length - 1].groupLevel() ?? 0;
260
+ p *= -1;
261
+ }
262
+ return (p - 1 + (f.sortPriority() ?? 0));
263
+ }
264
+ return false;
265
+ }
266
+ getGroupValue(row) {
267
+ return row[this.groupAbleFields()[0].field()];
268
+ }
269
+ isGroupEnd(index, row) {
270
+ const topGroupField = this.groupAbleFields()[0];
271
+ if (!topGroupField) {
272
+ return false;
273
+ }
274
+ const indexs = this.rowsGroupMap().get(topGroupField.field())?.get(row[topGroupField.field()]?.toString());
275
+ if (indexs) {
276
+ return indexs[indexs.length - 1] == index;
277
+ }
278
+ return false;
279
+ }
280
+ rowspan(f, index, pageIndex, pageSize, row) {
281
+ if (f.groupAble()) {
282
+ const value = this.groupAbleFields().slice(0, this.groupAbleFields().findIndex(_f => _f.field() == f.field()) + 1).map(_f => row[_f.field()]).join("@");
283
+ const indexs = this.rowsGroupMap().get(f.field())?.get(value);
284
+ if (indexs) {
285
+ const i = indexs.indexOf(index + (pageIndex - 1) * pageSize);
286
+ if (i != -1) {
287
+ if (i == 0) {
288
+ return indexs.length;
289
+ }
290
+ else if (index == 0) {
291
+ return indexs.length - i;
292
+ }
293
+ else {
294
+ return 0;
295
+ }
296
+ }
297
+ }
298
+ }
299
+ return 1;
148
300
  }
149
301
  refreshFieldControls(f) {
150
302
  if (!this.cacheFilterItem) {
@@ -189,7 +341,7 @@ class TableService {
189
341
  }
190
342
  };
191
343
  }
192
- if (field.sortAble()) {
344
+ if (this.fieldSortAble(field)) {
193
345
  if (this.useBackEndPaging()) {
194
346
  res[field.field()].sortFn = true;
195
347
  }
@@ -225,10 +377,21 @@ class TableService {
225
377
  this.fieldsControlsMap.set(res);
226
378
  }
227
379
  }
380
+ sortChange() {
381
+ this.clearCursorMarks();
382
+ this.refreshTableData();
383
+ }
228
384
  filterChange(field, value) {
229
385
  for (const item of this.filedsFilterItemsCache.get(field).values()) {
230
386
  item.byDefault = value != null && (Array.isArray(value) ? value.includes(item.value) : item.value == value);
231
387
  }
388
+ if (value == null || Array.isArray(value) && value.length == 0) {
389
+ this.fieldsFilterValueMap.delete(field);
390
+ }
391
+ else {
392
+ this.fieldsFilterValueMap.set(field, value);
393
+ }
394
+ this.refreshTableData();
232
395
  }
233
396
  buildLeaderFieldWidth() {
234
397
  if (!this.ready()) {
@@ -311,10 +474,10 @@ class TableService {
311
474
  }))
312
475
  };
313
476
  }
314
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: TableService, deps: [{ token: TableFieldDisplayService }], target: i0.ɵɵFactoryTarget.Injectable });
315
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: TableService });
477
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TableService, deps: [{ token: TableFieldDisplayService }], target: i0.ɵɵFactoryTarget.Injectable });
478
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TableService });
316
479
  }
317
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: TableService, decorators: [{
480
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TableService, decorators: [{
318
481
  type: Injectable
319
482
  }], ctorParameters: () => [{ type: TableFieldDisplayService }] });
320
483
 
@@ -504,10 +667,10 @@ class SelectService {
504
667
  this.subs = [];
505
668
  this.subSelects.clear();
506
669
  }
507
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: SelectService, deps: [{ token: i1$1.ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
508
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: SelectService });
670
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: SelectService, deps: [{ token: i1$1.ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
671
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: SelectService });
509
672
  }
510
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: SelectService, decorators: [{
673
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: SelectService, decorators: [{
511
674
  type: Injectable
512
675
  }], ctorParameters: () => [{ type: i1$1.ScopeDirective, decorators: [{
513
676
  type: Optional
@@ -576,10 +739,10 @@ class ExpandService {
576
739
  }
577
740
  return res;
578
741
  }
579
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: ExpandService, deps: [{ token: i1$1.ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
580
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: ExpandService });
742
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ExpandService, deps: [{ token: i1$1.ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
743
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ExpandService });
581
744
  }
582
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: ExpandService, decorators: [{
745
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ExpandService, decorators: [{
583
746
  type: Injectable
584
747
  }], ctorParameters: () => [{ type: i1$1.ScopeDirective, decorators: [{
585
748
  type: Optional
@@ -595,13 +758,16 @@ class StatisticService {
595
758
  data;
596
759
  fields;
597
760
  getRow;
761
+ tableSvc;
598
762
  hasStatistic = false;
599
763
  statisticMap = computed(() => this.buildStatisticMap(), ...(ngDevMode ? [{ debugName: "statisticMap" }] : []));
764
+ statisticGroupMap = computed(() => this.buildStatisticGroupMap(), ...(ngDevMode ? [{ debugName: "statisticGroupMap" }] : []));
600
765
  init(opts) {
601
766
  this.options = opts.options;
602
767
  this.data = opts.data;
603
768
  this.fields = opts.fields;
604
769
  this.getRow = opts.getRow;
770
+ this.tableSvc = opts.tableSvc;
605
771
  this.ready.set(true);
606
772
  }
607
773
  buildStatisticMap() {
@@ -614,38 +780,65 @@ class StatisticService {
614
780
  res = this.data().statistic_result;
615
781
  }
616
782
  else {
617
- for (const f of this.fields().filter(r => r.statisticAble())) {
618
- let num;
619
- for (let i = 0; i < (this.data() ?? []).length; i++) {
620
- let row = this.data()[i];
621
- if (this.getRow) {
622
- row = this.getRow(row);
623
- }
624
- if (f.statisticType() == "sum" || f.statisticType() == "average") {
625
- num = (num ?? 0) + row[f.field()];
626
- }
627
- else if (f.statisticType() == "max") {
628
- num = Math.max(num ?? Number.MIN_SAFE_INTEGER, row[f.field()]);
629
- }
630
- else if (f.statisticType() == "min") {
631
- num = Math.min(num ?? Number.MAX_SAFE_INTEGER, row[f.field()]);
632
- }
633
- else if (f.statisticType() == "custom" && f.statisticFn()) {
634
- num = this.scope?.runFnWithSnapshot(f.statisticFn(), { result: num, index: i, row: row, value: row[f.field()] });
635
- }
636
- }
637
- if (f.statisticType() == "average" && this.data().length > 0) {
638
- num = (num ?? 0) / this.data().length;
639
- }
640
- if (f.statisticType() == "sum" && this.data().length == 0) {
641
- num = 0;
783
+ res = this.statisticCompute(this.data() ?? []);
784
+ }
785
+ }
786
+ return res;
787
+ }
788
+ buildStatisticGroupMap() {
789
+ if (!this.ready() || !this.tableSvc) {
790
+ return {};
791
+ }
792
+ let res = {};
793
+ const groupField = this.tableSvc.groupAbleFields()[0];
794
+ if (this.options.showStatistic() && groupField) {
795
+ if (this.options.showPagination() && this.options.useBackEndPaging()) {
796
+ res = this.data().statistic_result;
797
+ }
798
+ else {
799
+ this.tableSvc.tableData();
800
+ const group = this.tableSvc.rowsGroupMap().get(groupField.field());
801
+ if (group) {
802
+ for (const [value, indexs] of group) {
803
+ res[value] = this.statisticCompute(indexs.map(index => this.tableSvc?.tableData()[index]));
642
804
  }
643
- res[f.field()] = num;
644
805
  }
645
806
  }
646
807
  }
647
808
  return res;
648
809
  }
810
+ statisticCompute(data) {
811
+ const res = {};
812
+ for (const f of this.fields().filter(r => r.statisticAble())) {
813
+ let num;
814
+ for (let i = 0; i < data.length; i++) {
815
+ let row = data[i];
816
+ if (this.getRow) {
817
+ row = this.getRow(row);
818
+ }
819
+ if (f.statisticType() == "sum" || f.statisticType() == "average") {
820
+ num = (num ?? 0) + row[f.field()];
821
+ }
822
+ else if (f.statisticType() == "max") {
823
+ num = Math.max(num ?? Number.MIN_SAFE_INTEGER, row[f.field()]);
824
+ }
825
+ else if (f.statisticType() == "min") {
826
+ num = Math.min(num ?? Number.MAX_SAFE_INTEGER, row[f.field()]);
827
+ }
828
+ else if (f.statisticType() == "custom" && f.statisticFn()) {
829
+ num = this.scope?.runFnWithSnapshot(f.statisticFn(), { result: num, index: i, row: row, value: row[f.field()] });
830
+ }
831
+ }
832
+ if (f.statisticType() == "average" && data.length > 0) {
833
+ num = (num ?? 0) / data.length;
834
+ }
835
+ if (f.statisticType() == "sum" && data.length == 0) {
836
+ num = 0;
837
+ }
838
+ res[f.field()] = num;
839
+ }
840
+ return res;
841
+ }
649
842
  get backEndPageParams() {
650
843
  const res = {
651
844
  query_statistic: !this.hasStatistic && this.options.showStatistic() && this.options.showPagination() && this.options.useBackEndPaging()
@@ -658,10 +851,10 @@ class StatisticService {
658
851
  }
659
852
  return res;
660
853
  }
661
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: StatisticService, deps: [{ token: i1$1.ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
662
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: StatisticService });
854
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: StatisticService, deps: [{ token: i1$1.ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
855
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: StatisticService });
663
856
  }
664
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: StatisticService, decorators: [{
857
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: StatisticService, decorators: [{
665
858
  type: Injectable
666
859
  }], ctorParameters: () => [{ type: i1$1.ScopeDirective, decorators: [{
667
860
  type: Optional