ngx-axis-appforge 0.0.80 → 0.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/axis-components/edit-table/index.d.ts +2 -5
- package/axis-components/table/index.d.ts +4 -8
- package/axis-components/table-helper/index.d.ts +25 -1
- package/axis-components/transfer/index.d.ts +2 -0
- package/core/index.d.ts +7 -3
- package/fesm2022/ngx-axis-appforge-axis-components-badge-design.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-badge-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-badge.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-badge.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-button-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-button-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-button.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-button.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-checkbox-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-checkbox-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-checkbox.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-color-picker-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-color-picker-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-color-picker.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-cytoscape-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-cytoscape-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-cytoscape.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-cytoscape.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-date-picker-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-date-picker-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-date-picker.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-desc-design.mjs +9 -9
- package/fesm2022/ngx-axis-appforge-axis-components-desc-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-desc.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-desc.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-design-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-design-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-design.mjs +21 -21
- package/fesm2022/ngx-axis-appforge-axis-components-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-dropdown-design.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-dropdown-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-dropdown.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-container.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-dynamic-value.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-echarts-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-echarts-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-echarts.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-echarts.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-edit-table-design.mjs +10 -12
- package/fesm2022/ngx-axis-appforge-axis-components-edit-table-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-edit-table.mjs +7 -10
- package/fesm2022/ngx-axis-appforge-axis-components-edit-table.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-editor-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-editor-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-editor.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-editor.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-flex-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-flex-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-flex.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-flex.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-form-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-form-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-form-item-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-form-item-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-form-item.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-form-item.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-form.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-form.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-icon-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-icon-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-icon.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-icon.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-image-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-image-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-image.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-image.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input-component-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-input-component-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input-component.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-input-component.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-input-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input-icon-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-input-icon-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input-icon.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-input-icon.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input-json-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-input-json-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input-json.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-input-json.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input-number-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-input-number-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input-number.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-input-number.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-input.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-input.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-menu-design.mjs +13 -13
- package/fesm2022/ngx-axis-appforge-axis-components-menu-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-menu.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-menu.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-modal-design.mjs +7 -7
- package/fesm2022/ngx-axis-appforge-axis-components-modal-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-modal.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-modal.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-radio-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-radio-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-radio.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-radio.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-rate-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-rate-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-rate.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-rate.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-scope-design.mjs +12 -12
- package/fesm2022/ngx-axis-appforge-axis-components-scope-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-scope.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-scope.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-select-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-select-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-select.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-select.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-single-selector-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-single-selector-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-single-selector.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-single-selector.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-splitter-design.mjs +9 -9
- package/fesm2022/ngx-axis-appforge-axis-components-splitter-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-splitter.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-splitter.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-steps-design.mjs +9 -9
- package/fesm2022/ngx-axis-appforge-axis-components-steps-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-steps.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-steps.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-switch-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-switch-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-switch.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-switch.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-table-design.mjs +49 -46
- package/fesm2022/ngx-axis-appforge-axis-components-table-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-table-helper.mjs +234 -44
- package/fesm2022/ngx-axis-appforge-axis-components-table-helper.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-table.mjs +64 -26
- package/fesm2022/ngx-axis-appforge-axis-components-table.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-tabs-design.mjs +9 -9
- package/fesm2022/ngx-axis-appforge-axis-components-tabs-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-tabs.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-tabs.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-text-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-text-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-text.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-text.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-textarea-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-textarea-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-textarea.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-textarea.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-timer-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-timer-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-timer.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-timer.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-transfer-design.mjs +9 -9
- package/fesm2022/ngx-axis-appforge-axis-components-transfer-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-transfer.mjs +9 -7
- package/fesm2022/ngx-axis-appforge-axis-components-transfer.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-tree-selector-design.mjs +9 -9
- package/fesm2022/ngx-axis-appforge-axis-components-tree-selector-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-tree-selector.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-tree-selector.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-upload-design.mjs +3 -3
- package/fesm2022/ngx-axis-appforge-axis-components-upload-design.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-upload.mjs +4 -4
- package/fesm2022/ngx-axis-appforge-axis-components-upload.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components.mjs +0 -4
- package/fesm2022/ngx-axis-appforge-axis-components.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-core.mjs +264 -146
- package/fesm2022/ngx-axis-appforge-core.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-providers.mjs +2 -0
- package/fesm2022/ngx-axis-appforge-providers.mjs.map +1 -1
- package/package.json +233 -231
|
@@ -24,13 +24,13 @@ class TableFieldDisplayService {
|
|
|
24
24
|
this.fieldDisplayCache.delete(field);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
getFieldDisplayText(field, row) {
|
|
27
|
+
getFieldDisplayText(field, row, loopRow) {
|
|
28
28
|
if (["axis-components/text", "axis-components/badge"].includes(field.child()?.component)) {
|
|
29
29
|
if (!this.fieldDisplayCache.has(field.field())) {
|
|
30
30
|
this.fieldDisplayCache.set(field.field(), new Map());
|
|
31
31
|
}
|
|
32
32
|
if (!this.fieldDisplayCache.get(field.field()).has(row[field.field()])) {
|
|
33
|
-
const child = this.scope?.snapshotOptions(field.child(), { row });
|
|
33
|
+
const child = this.scope?.snapshotOptions(field.child(), { row, loopRow });
|
|
34
34
|
let text;
|
|
35
35
|
switch (child.component) {
|
|
36
36
|
case "axis-components/text":
|
|
@@ -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.
|
|
90
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
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.
|
|
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.fields().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,147 @@ 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 res = this.fieldsControlsMap()[f.field()]?.sortFn(a, b);
|
|
200
|
+
if (res != 0) {
|
|
201
|
+
return res * (f.sortOrder() == "descend" ? -1 : 1);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return 0;
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
this.tableData.set(data);
|
|
208
|
+
}
|
|
209
|
+
buildRowsGroupMap() {
|
|
210
|
+
const rowsGroupMap = new Map();
|
|
211
|
+
if (!this.useBackEndPaging()) {
|
|
212
|
+
if (this.groupAbleFields().length > 0) {
|
|
213
|
+
for (let i = 0; i < this.tableData().length; i++) {
|
|
214
|
+
let valuePerfix = "";
|
|
215
|
+
const row = this.tableData()[i];
|
|
216
|
+
for (const field of this.groupAbleFields()) {
|
|
217
|
+
if (!rowsGroupMap.has(field.field())) {
|
|
218
|
+
rowsGroupMap.set(field.field(), new Map());
|
|
219
|
+
}
|
|
220
|
+
const groups = rowsGroupMap.get(field.field());
|
|
221
|
+
const value = valuePerfix + row[field.field()];
|
|
222
|
+
const newGroup = !groups.has(value);
|
|
223
|
+
if (newGroup) {
|
|
224
|
+
groups.set(value, [i]);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
groups.get(value).push(i);
|
|
228
|
+
}
|
|
229
|
+
valuePerfix += value + "@";
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
for (let group of rowsGroupMap.values()) {
|
|
235
|
+
for (let [value, indexes] of group) {
|
|
236
|
+
if (indexes.length == 1) {
|
|
237
|
+
group.delete(value);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return rowsGroupMap;
|
|
242
|
+
}
|
|
243
|
+
fieldSortAble(f) {
|
|
244
|
+
return f.sortAble() || f.groupAble();
|
|
245
|
+
}
|
|
246
|
+
fieldSortDirections(f) {
|
|
247
|
+
return f.groupAble() ? ['ascend', 'descend'] : ['ascend', 'descend', null];
|
|
248
|
+
}
|
|
249
|
+
fieldSortPriority(f) {
|
|
250
|
+
if (f.groupAble()) {
|
|
251
|
+
return (f.groupLevel() ?? 0);
|
|
252
|
+
}
|
|
253
|
+
if (f.sortAble()) {
|
|
254
|
+
let p = 0;
|
|
255
|
+
if (this.groupAbleFields().length) {
|
|
256
|
+
p = this.groupAbleFields()[this.groupAbleFields().length - 1].groupLevel() ?? 0;
|
|
257
|
+
p *= -1;
|
|
258
|
+
}
|
|
259
|
+
return (p - 1 + (f.sortPriority() ?? 0));
|
|
260
|
+
}
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
getGroupValue(row) {
|
|
264
|
+
return row[this.groupAbleFields()[0].field()];
|
|
265
|
+
}
|
|
266
|
+
isGroupEnd(index, row) {
|
|
267
|
+
const topGroupField = this.groupAbleFields()[0];
|
|
268
|
+
if (!topGroupField) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
const indexs = this.rowsGroupMap().get(topGroupField.field())?.get(row[topGroupField.field()]);
|
|
272
|
+
if (indexs) {
|
|
273
|
+
return indexs[indexs.length - 1] == index;
|
|
274
|
+
}
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
rowspan(f, index, pageIndex, pageSize, row) {
|
|
278
|
+
if (f.groupAble()) {
|
|
279
|
+
const value = this.groupAbleFields().slice(0, this.groupAbleFields().findIndex(f => f.field() == f.field()) + 1).map(f => row[f.field()]).join("@");
|
|
280
|
+
const indexs = this.rowsGroupMap().get(f.field())?.get(value);
|
|
281
|
+
if (indexs) {
|
|
282
|
+
const i = indexs.indexOf(index + (pageIndex - 1) * pageSize);
|
|
283
|
+
if (i != -1) {
|
|
284
|
+
if (i == 0) {
|
|
285
|
+
return indexs.length;
|
|
286
|
+
}
|
|
287
|
+
else if (index == 0) {
|
|
288
|
+
return indexs.length - i;
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
return 0;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return 1;
|
|
148
297
|
}
|
|
149
298
|
refreshFieldControls(f) {
|
|
150
299
|
if (!this.cacheFilterItem) {
|
|
@@ -189,7 +338,7 @@ class TableService {
|
|
|
189
338
|
}
|
|
190
339
|
};
|
|
191
340
|
}
|
|
192
|
-
if (
|
|
341
|
+
if (this.fieldSortAble(field)) {
|
|
193
342
|
if (this.useBackEndPaging()) {
|
|
194
343
|
res[field.field()].sortFn = true;
|
|
195
344
|
}
|
|
@@ -225,10 +374,21 @@ class TableService {
|
|
|
225
374
|
this.fieldsControlsMap.set(res);
|
|
226
375
|
}
|
|
227
376
|
}
|
|
377
|
+
sortChange() {
|
|
378
|
+
this.clearCursorMarks();
|
|
379
|
+
this.refreshTableData();
|
|
380
|
+
}
|
|
228
381
|
filterChange(field, value) {
|
|
229
382
|
for (const item of this.filedsFilterItemsCache.get(field).values()) {
|
|
230
383
|
item.byDefault = value != null && (Array.isArray(value) ? value.includes(item.value) : item.value == value);
|
|
231
384
|
}
|
|
385
|
+
if (value == null || Array.isArray(value) && value.length == 0) {
|
|
386
|
+
this.fieldsFilterValueMap.delete(field);
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
this.fieldsFilterValueMap.set(field, value);
|
|
390
|
+
}
|
|
391
|
+
this.refreshTableData();
|
|
232
392
|
}
|
|
233
393
|
buildLeaderFieldWidth() {
|
|
234
394
|
if (!this.ready()) {
|
|
@@ -311,10 +471,10 @@ class TableService {
|
|
|
311
471
|
}))
|
|
312
472
|
};
|
|
313
473
|
}
|
|
314
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
315
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
474
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TableService, deps: [{ token: TableFieldDisplayService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
475
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TableService });
|
|
316
476
|
}
|
|
317
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
477
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: TableService, decorators: [{
|
|
318
478
|
type: Injectable
|
|
319
479
|
}], ctorParameters: () => [{ type: TableFieldDisplayService }] });
|
|
320
480
|
|
|
@@ -504,10 +664,10 @@ class SelectService {
|
|
|
504
664
|
this.subs = [];
|
|
505
665
|
this.subSelects.clear();
|
|
506
666
|
}
|
|
507
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
508
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
667
|
+
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 });
|
|
668
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: SelectService });
|
|
509
669
|
}
|
|
510
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
670
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: SelectService, decorators: [{
|
|
511
671
|
type: Injectable
|
|
512
672
|
}], ctorParameters: () => [{ type: i1$1.ScopeDirective, decorators: [{
|
|
513
673
|
type: Optional
|
|
@@ -576,10 +736,10 @@ class ExpandService {
|
|
|
576
736
|
}
|
|
577
737
|
return res;
|
|
578
738
|
}
|
|
579
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
580
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
739
|
+
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 });
|
|
740
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ExpandService });
|
|
581
741
|
}
|
|
582
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
742
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: ExpandService, decorators: [{
|
|
583
743
|
type: Injectable
|
|
584
744
|
}], ctorParameters: () => [{ type: i1$1.ScopeDirective, decorators: [{
|
|
585
745
|
type: Optional
|
|
@@ -595,13 +755,16 @@ class StatisticService {
|
|
|
595
755
|
data;
|
|
596
756
|
fields;
|
|
597
757
|
getRow;
|
|
758
|
+
tableSvc;
|
|
598
759
|
hasStatistic = false;
|
|
599
760
|
statisticMap = computed(() => this.buildStatisticMap(), ...(ngDevMode ? [{ debugName: "statisticMap" }] : []));
|
|
761
|
+
statisticGroupMap = computed(() => this.buildStatisticGroupMap(), ...(ngDevMode ? [{ debugName: "statisticGroupMap" }] : []));
|
|
600
762
|
init(opts) {
|
|
601
763
|
this.options = opts.options;
|
|
602
764
|
this.data = opts.data;
|
|
603
765
|
this.fields = opts.fields;
|
|
604
766
|
this.getRow = opts.getRow;
|
|
767
|
+
this.tableSvc = opts.tableSvc;
|
|
605
768
|
this.ready.set(true);
|
|
606
769
|
}
|
|
607
770
|
buildStatisticMap() {
|
|
@@ -614,38 +777,65 @@ class StatisticService {
|
|
|
614
777
|
res = this.data().statistic_result;
|
|
615
778
|
}
|
|
616
779
|
else {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
num = (num ?? 0) / this.data().length;
|
|
639
|
-
}
|
|
640
|
-
if (f.statisticType() == "sum" && this.data().length == 0) {
|
|
641
|
-
num = 0;
|
|
780
|
+
res = this.statisticCompute(this.data() ?? []);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
return res;
|
|
784
|
+
}
|
|
785
|
+
buildStatisticGroupMap() {
|
|
786
|
+
if (!this.ready() || !this.tableSvc) {
|
|
787
|
+
return {};
|
|
788
|
+
}
|
|
789
|
+
let res = {};
|
|
790
|
+
const groupField = this.tableSvc.groupAbleFields()[0];
|
|
791
|
+
if (this.options.showStatistic() && groupField) {
|
|
792
|
+
if (this.options.showPagination() && this.options.useBackEndPaging()) {
|
|
793
|
+
res = this.data().statistic_result;
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
this.tableSvc.tableData();
|
|
797
|
+
const group = this.tableSvc.rowsGroupMap().get(groupField.field());
|
|
798
|
+
if (group) {
|
|
799
|
+
for (const [value, indexs] of group) {
|
|
800
|
+
res[value] = this.statisticCompute(indexs.map(index => this.tableSvc?.tableData()[index]));
|
|
642
801
|
}
|
|
643
|
-
res[f.field()] = num;
|
|
644
802
|
}
|
|
645
803
|
}
|
|
646
804
|
}
|
|
647
805
|
return res;
|
|
648
806
|
}
|
|
807
|
+
statisticCompute(data) {
|
|
808
|
+
const res = {};
|
|
809
|
+
for (const f of this.fields().filter(r => r.statisticAble())) {
|
|
810
|
+
let num;
|
|
811
|
+
for (let i = 0; i < data.length; i++) {
|
|
812
|
+
let row = data[i];
|
|
813
|
+
if (this.getRow) {
|
|
814
|
+
row = this.getRow(row);
|
|
815
|
+
}
|
|
816
|
+
if (f.statisticType() == "sum" || f.statisticType() == "average") {
|
|
817
|
+
num = (num ?? 0) + row[f.field()];
|
|
818
|
+
}
|
|
819
|
+
else if (f.statisticType() == "max") {
|
|
820
|
+
num = Math.max(num ?? Number.MIN_SAFE_INTEGER, row[f.field()]);
|
|
821
|
+
}
|
|
822
|
+
else if (f.statisticType() == "min") {
|
|
823
|
+
num = Math.min(num ?? Number.MAX_SAFE_INTEGER, row[f.field()]);
|
|
824
|
+
}
|
|
825
|
+
else if (f.statisticType() == "custom" && f.statisticFn()) {
|
|
826
|
+
num = this.scope?.runFnWithSnapshot(f.statisticFn(), { result: num, index: i, row: row, value: row[f.field()] });
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
if (f.statisticType() == "average" && data.length > 0) {
|
|
830
|
+
num = (num ?? 0) / data.length;
|
|
831
|
+
}
|
|
832
|
+
if (f.statisticType() == "sum" && data.length == 0) {
|
|
833
|
+
num = 0;
|
|
834
|
+
}
|
|
835
|
+
res[f.field()] = num;
|
|
836
|
+
}
|
|
837
|
+
return res;
|
|
838
|
+
}
|
|
649
839
|
get backEndPageParams() {
|
|
650
840
|
const res = {
|
|
651
841
|
query_statistic: !this.hasStatistic && this.options.showStatistic() && this.options.showPagination() && this.options.useBackEndPaging()
|
|
@@ -658,10 +848,10 @@ class StatisticService {
|
|
|
658
848
|
}
|
|
659
849
|
return res;
|
|
660
850
|
}
|
|
661
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
662
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
851
|
+
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 });
|
|
852
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: StatisticService });
|
|
663
853
|
}
|
|
664
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
854
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: StatisticService, decorators: [{
|
|
665
855
|
type: Injectable
|
|
666
856
|
}], ctorParameters: () => [{ type: i1$1.ScopeDirective, decorators: [{
|
|
667
857
|
type: Optional
|