@mintplayer/ng-spark 22.23.0 → 22.25.0
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/README.md +196 -0
- package/fesm2022/mintplayer-ng-spark-attribute-description.mjs +100 -47
- package/fesm2022/mintplayer-ng-spark-attribute-description.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-client-operations.mjs +310 -329
- package/fesm2022/mintplayer-ng-spark-client-operations.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-column-filter.mjs +175 -135
- package/fesm2022/mintplayer-ng-spark-column-filter.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-contributions.mjs +721 -0
- package/fesm2022/mintplayer-ng-spark-contributions.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-spark-grid.mjs +2385 -1118
- package/fesm2022/mintplayer-ng-spark-grid.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-history.mjs +598 -0
- package/fesm2022/mintplayer-ng-spark-history.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-spark-icon.mjs +64 -27
- package/fesm2022/mintplayer-ng-spark-icon.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-models.mjs +405 -762
- package/fesm2022/mintplayer-ng-spark-models.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-moderation.mjs +1212 -0
- package/fesm2022/mintplayer-ng-spark-moderation.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-spark-panels.mjs +60 -0
- package/fesm2022/mintplayer-ng-spark-panels.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-spark-pipes.mjs +1158 -765
- package/fesm2022/mintplayer-ng-spark-pipes.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-po-create.mjs +273 -169
- package/fesm2022/mintplayer-ng-spark-po-create.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-po-detail.mjs +795 -410
- package/fesm2022/mintplayer-ng-spark-po-detail.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-po-edit.mjs +1196 -280
- package/fesm2022/mintplayer-ng-spark-po-edit.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-po-form.mjs +2244 -1224
- package/fesm2022/mintplayer-ng-spark-po-form.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-query-list.mjs +571 -303
- package/fesm2022/mintplayer-ng-spark-query-list.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-renderers.mjs +44 -55
- package/fesm2022/mintplayer-ng-spark-renderers.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs +216 -177
- package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-routes.mjs +24 -28
- package/fesm2022/mintplayer-ng-spark-routes.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-services.mjs +625 -640
- package/fesm2022/mintplayer-ng-spark-services.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-shell.mjs +1031 -397
- package/fesm2022/mintplayer-ng-spark-shell.mjs.map +1 -1
- package/fesm2022/mintplayer-ng-spark-soft-delete.mjs +294 -0
- package/fesm2022/mintplayer-ng-spark-soft-delete.mjs.map +1 -0
- package/fesm2022/mintplayer-ng-spark.mjs +14 -48
- package/fesm2022/mintplayer-ng-spark.mjs.map +1 -1
- package/package.json +23 -2
- package/types/mintplayer-ng-spark-attribute-description.d.ts +25 -18
- package/types/mintplayer-ng-spark-client-operations.d.ts +139 -160
- package/types/mintplayer-ng-spark-column-filter.d.ts +73 -55
- package/types/mintplayer-ng-spark-contributions.d.ts +231 -0
- package/types/mintplayer-ng-spark-grid.d.ts +917 -448
- package/types/mintplayer-ng-spark-history.d.ts +216 -0
- package/types/mintplayer-ng-spark-icon.d.ts +15 -13
- package/types/mintplayer-ng-spark-models.d.ts +681 -573
- package/types/mintplayer-ng-spark-moderation.d.ts +402 -0
- package/types/mintplayer-ng-spark-panels.d.ts +143 -0
- package/types/mintplayer-ng-spark-pipes.d.ts +131 -149
- package/types/mintplayer-ng-spark-po-create.d.ts +46 -37
- package/types/mintplayer-ng-spark-po-detail.d.ts +180 -117
- package/types/mintplayer-ng-spark-po-edit.d.ts +367 -64
- package/types/mintplayer-ng-spark-po-form.d.ts +558 -373
- package/types/mintplayer-ng-spark-query-list.d.ts +143 -82
- package/types/mintplayer-ng-spark-renderers.d.ts +121 -85
- package/types/mintplayer-ng-spark-retry-action-modal.d.ts +31 -34
- package/types/mintplayer-ng-spark-routes.d.ts +7 -11
- package/types/mintplayer-ng-spark-services.d.ts +377 -261
- package/types/mintplayer-ng-spark-shell.d.ts +228 -132
- package/types/mintplayer-ng-spark-soft-delete.d.ts +90 -0
- package/types/mintplayer-ng-spark.d.ts +19 -12
|
@@ -1,1133 +1,2400 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import * as i0 from
|
|
4
|
-
import {
|
|
5
|
-
import { SPARK_ATTRIBUTE_RENDERERS, cellValue, withDeclaredInputs } from
|
|
6
|
-
import {
|
|
7
|
-
import * as i1 from
|
|
8
|
-
import { CommonModule, NgComponentOutlet } from
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
import { BsDatatableColumnDirective, BsDatatableComponent, BsDatatableFilterPanelDirective, BsRowTemplateDirective, DatatableSettings } from "@mintplayer/ng-bootstrap/datatable";
|
|
2
|
+
import { ShowedOn, defaultQueryActions, filterQueryActions, hasShowedOnFlag, parseSelectionRule, selectionModeFor, valueFor } from "@mintplayer/ng-spark/models";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, Directive, Injectable, Injector, TemplateRef, computed, contentChildren, effect, inject, input, linkedSignal, model, output, runInInjectionContext, signal, untracked, viewChild } from "@angular/core";
|
|
5
|
+
import { SPARK_ATTRIBUTE_RENDERERS, cellValue, withDeclaredInputs } from "@mintplayer/ng-spark/renderers";
|
|
6
|
+
import { SPARK_RETURN_URL_STATE_KEY, SparkLanguageService, SparkService } from "@mintplayer/ng-spark/services";
|
|
7
|
+
import * as i1$1 from "@angular/common";
|
|
8
|
+
import { CommonModule, NgComponentOutlet } from "@angular/common";
|
|
9
|
+
import { toSignal } from "@angular/core/rxjs-interop";
|
|
10
|
+
import * as i2 from "@angular/router";
|
|
11
|
+
import { NavigationEnd, Router, RouterModule } from "@angular/router";
|
|
12
|
+
import { filter, map } from "rxjs";
|
|
13
|
+
import { Color } from "@mintplayer/ng-bootstrap";
|
|
14
|
+
import { BsAlertComponent } from "@mintplayer/ng-bootstrap/alert";
|
|
15
|
+
import { BsSpinnerComponent } from "@mintplayer/ng-bootstrap/spinner";
|
|
16
|
+
import { BsBadgeComponent } from "@mintplayer/ng-bootstrap/badge";
|
|
17
|
+
import { CdkConnectedOverlay, CdkOverlayOrigin } from "@angular/cdk/overlay";
|
|
18
|
+
import { BsDropdownItemDirective, BsDropdownMenuComponent } from "@mintplayer/ng-bootstrap/dropdown-menu";
|
|
19
|
+
import { SparkIconComponent } from "@mintplayer/ng-spark/icon";
|
|
20
|
+
import { SparkQueryRefreshService } from "@mintplayer/ng-spark/client-operations";
|
|
21
|
+
import { QueryCellValuePipe, QueryReferenceChipsPipe, ResolveTranslationPipe, TranslateKeyPipe } from "@mintplayer/ng-spark/pipes";
|
|
22
|
+
import { SparkAttributeDescriptionComponent } from "@mintplayer/ng-spark/attribute-description";
|
|
23
|
+
import { SparkColumnFilterPanelComponent } from "@mintplayer/ng-spark/column-filter";
|
|
24
|
+
import { SPARK_QUERY_ROW_ACTIONS, orderSparkExtensions } from "@mintplayer/ng-spark/panels";
|
|
25
|
+
import { BsCardComponent, BsCardHeaderComponent } from "@mintplayer/ng-bootstrap/card";
|
|
26
|
+
import { BsPriorityNavComponent, BsPriorityNavItemDirective } from "@mintplayer/ng-bootstrap/priority-nav";
|
|
27
|
+
import * as i1 from "@angular/forms";
|
|
28
|
+
import { FormsModule } from "@angular/forms";
|
|
29
|
+
import { BsFormComponent, BsFormControlDirective } from "@mintplayer/ng-bootstrap/form";
|
|
30
|
+
import { BsInputGroupComponent } from "@mintplayer/ng-bootstrap/input-group";
|
|
31
|
+
const SPARK_GRID_PAGE_SIZES = [
|
|
32
|
+
10,
|
|
33
|
+
25,
|
|
34
|
+
50
|
|
35
|
+
];
|
|
30
36
|
function visibleGridAttributes(entityType) {
|
|
31
|
-
|
|
32
|
-
.filter(a => a.isVisible && hasShowedOnFlag(a.showedOn, ShowedOn.Query))
|
|
33
|
-
.sort((a, b) => a.order - b.order) ?? [];
|
|
37
|
+
return entityType?.attributes.filter((a) => a.isVisible && hasShowedOnFlag(a.showedOn, ShowedOn.Query)).sort((a, b) => a.order - b.order) ?? [];
|
|
34
38
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Initial datatable settings for a query, seeded with the query's declared sort.
|
|
37
|
-
*
|
|
38
|
-
* The datatable owns paging and sorting from here on and calls the fetch callback per page; this
|
|
39
|
-
* only decides where it starts.
|
|
40
|
-
*/
|
|
41
39
|
function initialGridSettings(query) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
const sortColumns = (query?.sortColumns || []).map((sc) => ({
|
|
41
|
+
property: sc.property,
|
|
42
|
+
direction: sc.direction === "desc" ? "descending" : "ascending"
|
|
43
|
+
}));
|
|
44
|
+
return new DatatableSettings({
|
|
45
|
+
perPage: {
|
|
46
|
+
values: SPARK_GRID_PAGE_SIZES,
|
|
47
|
+
selected: SPARK_GRID_PAGE_SIZES[0]
|
|
48
|
+
},
|
|
49
|
+
page: {
|
|
50
|
+
values: [1],
|
|
51
|
+
selected: 1
|
|
52
|
+
},
|
|
53
|
+
sortColumns
|
|
54
|
+
});
|
|
53
55
|
}
|
|
54
|
-
/** Whether a query renders as a virtual-scrolling grid rather than a paged one. */
|
|
55
56
|
function isVirtualScrollingQuery(query) {
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Renderer lookup and lookup-reference loading for a Spark grid.
|
|
61
|
-
*
|
|
62
|
-
* This was extracted when `spark-query-list` and `spark-sub-query` were two components holding
|
|
63
|
-
* byte-identical copies of it — around 120 lines between them. That duplication was not a
|
|
64
|
-
* tidiness complaint: it produced drift. The two copies disagreed about `[indeterminate]`, about
|
|
65
|
-
* resetting permission state, about whether a fetch failure surfaces or is swallowed, and about
|
|
66
|
-
* virtual-scroll sizing — four user-visible bugs, each fixed on one side and not the other.
|
|
67
|
-
*
|
|
68
|
-
* There is now one grid, {@link SparkQueryGridComponent}, so the drift cannot recur. This stays
|
|
69
|
-
* separate because it is stateless service-shaped logic rather than view state, and because it is
|
|
70
|
-
* what a custom grid would need in order to render Spark cells at all.
|
|
71
|
-
*/
|
|
72
|
-
class SparkGridRenderers {
|
|
73
|
-
registry = inject(SPARK_ATTRIBUTE_RENDERERS);
|
|
74
|
-
sparkService = inject(SparkService);
|
|
75
|
-
/** The registered column component for a column, or null to fall back to the default cell. */
|
|
76
|
-
columnComponentFor(column) {
|
|
77
|
-
if (!column.renderer)
|
|
78
|
-
return null;
|
|
79
|
-
return this.registry.find(r => r.name === column.renderer)?.columnComponent ?? null;
|
|
80
|
-
}
|
|
81
|
-
/** The registered filter-label function for a column, or null to use the server-computed text. */
|
|
82
|
-
filterLabelFor(column) {
|
|
83
|
-
if (!column.renderer)
|
|
84
|
-
return null;
|
|
85
|
-
return this.registry.find(r => r.name === column.renderer)?.filterLabel ?? null;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Inputs for a query-grid cell renderer, filtered to what the component actually declares —
|
|
89
|
-
* `NgComponentOutlet` throws on an input the target does not have, which is what lets every
|
|
90
|
-
* member of the renderer contract be optional.
|
|
91
|
-
*/
|
|
92
|
-
columnInputsFor(component, item, column) {
|
|
93
|
-
return this.cellInputsFor(component, cellValue(valueFor(item, column.name)), column, item);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* The same contract for a row that is not a query result — an AsDetail sub-table row, which is
|
|
97
|
-
* a plain dictionary of embedded values with no id and no column metadata of its own, so its
|
|
98
|
-
* value cannot be read the way {@link columnInputsFor} reads one.
|
|
99
|
-
*
|
|
100
|
-
* Only the extraction differs; the renderer contract is identical, and stating it once is what
|
|
101
|
-
* stops the two from drifting the way the cell markup already had.
|
|
102
|
-
*/
|
|
103
|
-
cellInputsFor(component, value, column, item) {
|
|
104
|
-
return withDeclaredInputs(component, {
|
|
105
|
-
value,
|
|
106
|
-
column,
|
|
107
|
-
options: column.rendererOptions,
|
|
108
|
-
item,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Loads every lookup reference the visible columns need, in one pass.
|
|
113
|
-
*
|
|
114
|
-
* Returns an empty map rather than throwing when there are none, so callers never branch on it.
|
|
115
|
-
*/
|
|
116
|
-
async loadLookupOptions(columns) {
|
|
117
|
-
const lookupColumns = columns.filter(c => c.lookupReferenceType);
|
|
118
|
-
if (lookupColumns.length === 0)
|
|
119
|
-
return {};
|
|
120
|
-
const names = [...new Set(lookupColumns.map(c => c.lookupReferenceType))];
|
|
121
|
-
const entries = await Promise.all(names.map(async (name) => [name, await this.sparkService.getLookupReference(name)]));
|
|
122
|
-
return entries.reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {});
|
|
123
|
-
}
|
|
124
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SparkGridRenderers, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
125
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SparkGridRenderers, providedIn: 'root' });
|
|
57
|
+
return query?.renderMode === "VirtualScrolling";
|
|
126
58
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
59
|
+
var SparkGridRenderers = class SparkGridRenderers {
|
|
60
|
+
registry = inject(SPARK_ATTRIBUTE_RENDERERS);
|
|
61
|
+
sparkService = inject(SparkService);
|
|
62
|
+
columnComponentFor(column) {
|
|
63
|
+
if (!column.renderer) return null;
|
|
64
|
+
return this.registry.find((r) => r.name === column.renderer)?.columnComponent ?? null;
|
|
65
|
+
}
|
|
66
|
+
filterLabelFor(column) {
|
|
67
|
+
if (!column.renderer) return null;
|
|
68
|
+
return this.registry.find((r) => r.name === column.renderer)?.filterLabel ?? null;
|
|
69
|
+
}
|
|
70
|
+
columnInputsFor(component, item, column) {
|
|
71
|
+
return this.cellInputsFor(component, cellValue(valueFor(item, column.name)), column, item);
|
|
72
|
+
}
|
|
73
|
+
cellInputsFor(component, value, column, item) {
|
|
74
|
+
return withDeclaredInputs(component, {
|
|
75
|
+
value,
|
|
76
|
+
column,
|
|
77
|
+
options: column.rendererOptions,
|
|
78
|
+
item
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async loadLookupOptions(columns) {
|
|
82
|
+
const lookupColumns = columns.filter((c) => c.lookupReferenceType);
|
|
83
|
+
if (lookupColumns.length === 0) return {};
|
|
84
|
+
const names = [...new Set(lookupColumns.map((c) => c.lookupReferenceType))];
|
|
85
|
+
return (await Promise.all(names.map(async (name) => [name, await this.sparkService.getLookupReference(name)]))).reduce((acc, [k, v]) => ({
|
|
86
|
+
...acc,
|
|
87
|
+
[k]: v
|
|
88
|
+
}), {});
|
|
89
|
+
}
|
|
90
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
91
|
+
minVersion: "12.0.0",
|
|
92
|
+
version: "22.2.0",
|
|
93
|
+
ngImport: i0,
|
|
94
|
+
type: SparkGridRenderers,
|
|
95
|
+
deps: [],
|
|
96
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
97
|
+
});
|
|
98
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
99
|
+
minVersion: "12.0.0",
|
|
100
|
+
version: "22.2.0",
|
|
101
|
+
ngImport: i0,
|
|
102
|
+
type: SparkGridRenderers,
|
|
103
|
+
providedIn: "root"
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
107
|
+
minVersion: "12.0.0",
|
|
108
|
+
version: "22.2.0",
|
|
109
|
+
ngImport: i0,
|
|
110
|
+
type: SparkGridRenderers,
|
|
111
|
+
decorators: [{
|
|
112
|
+
type: Injectable,
|
|
113
|
+
args: [{ providedIn: "root" }]
|
|
114
|
+
}]
|
|
115
|
+
});
|
|
172
116
|
function slotFor(slots, query) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
target.localeCompare(query?.id ?? '', undefined, { sensitivity: 'accent' }) === 0);
|
|
177
|
-
// A targeted slot wins over the catch-all even when it is declared later: "this one query"
|
|
178
|
-
// is the more specific statement, and declaration order in a template is not a priority.
|
|
179
|
-
return slots.find(s => matches(s.forQuery())) ?? slots.find(s => !s.forQuery()) ?? null;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* The icon at the header's leading edge. No default: nothing in the model describes one.
|
|
183
|
-
*
|
|
184
|
-
* ```html
|
|
185
|
-
* <spark-query-card [queryId]="'cars'">
|
|
186
|
-
* <spark-icon *sparkQueryIcon name="car-front" />
|
|
187
|
-
* </spark-query-card>
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
class SparkQueryIconDirective {
|
|
191
|
-
templateRef = inject(TemplateRef);
|
|
192
|
-
/** Query alias or id this slot applies to. Empty targets every query on the page. */
|
|
193
|
-
forQuery = input('', { ...(ngDevMode ? { debugName: "forQuery" } : /* istanbul ignore next */ {}), alias: 'sparkQueryIcon' });
|
|
194
|
-
static ngTemplateContextGuard(_dir, ctx) {
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SparkQueryIconDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
198
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: SparkQueryIconDirective, isStandalone: true, selector: "[sparkQueryIcon]", inputs: { forQuery: { classPropertyName: "forQuery", publicName: "sparkQueryIcon", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
199
|
-
}
|
|
200
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SparkQueryIconDirective, decorators: [{
|
|
201
|
-
type: Directive,
|
|
202
|
-
args: [{ selector: '[sparkQueryIcon]' }]
|
|
203
|
-
}], propDecorators: { forQuery: [{ type: i0.Input, args: [{ isSignal: true, alias: "sparkQueryIcon", required: false }] }] } });
|
|
204
|
-
/**
|
|
205
|
-
* The header caption. Defaults to the query's translated description, falling back to its name.
|
|
206
|
-
*
|
|
207
|
-
* The context carries that resolved default as `$implicit`, so a host can decorate it — add a
|
|
208
|
-
* count, a badge — without re-resolving the translation itself.
|
|
209
|
-
*/
|
|
210
|
-
class SparkQueryCaptionDirective {
|
|
211
|
-
templateRef = inject(TemplateRef);
|
|
212
|
-
forQuery = input('', { ...(ngDevMode ? { debugName: "forQuery" } : /* istanbul ignore next */ {}), alias: 'sparkQueryCaption' });
|
|
213
|
-
static ngTemplateContextGuard(_dir, ctx) {
|
|
214
|
-
return true;
|
|
215
|
-
}
|
|
216
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SparkQueryCaptionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
217
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: SparkQueryCaptionDirective, isStandalone: true, selector: "[sparkQueryCaption]", inputs: { forQuery: { classPropertyName: "forQuery", publicName: "sparkQueryCaption", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
218
|
-
}
|
|
219
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SparkQueryCaptionDirective, decorators: [{
|
|
220
|
-
type: Directive,
|
|
221
|
-
args: [{ selector: '[sparkQueryCaption]' }]
|
|
222
|
-
}], propDecorators: { forQuery: [{ type: i0.Input, args: [{ isSignal: true, alias: "sparkQueryCaption", required: false }] }] } });
|
|
223
|
-
/**
|
|
224
|
-
* The buttons at the header's trailing edge. Defaults to the server-declared custom actions.
|
|
225
|
-
*
|
|
226
|
-
* The context carries those actions and the current selection, so a host that wants its own
|
|
227
|
-
* buttons ALONGSIDE the server's can render both rather than choosing. Without that, overriding
|
|
228
|
-
* this slot to add one button would silently drop every action the type declares — and the
|
|
229
|
-
* server's actions are the ones carrying `selectionRule` and the permission filter.
|
|
230
|
-
*
|
|
231
|
-
* ```html
|
|
232
|
-
* <ng-container *sparkQueryActions="let actions; selection as rows">
|
|
233
|
-
* <button (click)="export(rows)">Export</button>
|
|
234
|
-
* </ng-container>
|
|
235
|
-
* ```
|
|
236
|
-
*/
|
|
237
|
-
class SparkQueryActionsDirective {
|
|
238
|
-
templateRef = inject(TemplateRef);
|
|
239
|
-
forQuery = input('', { ...(ngDevMode ? { debugName: "forQuery" } : /* istanbul ignore next */ {}), alias: 'sparkQueryActions' });
|
|
240
|
-
static ngTemplateContextGuard(_dir, ctx) {
|
|
241
|
-
return true;
|
|
242
|
-
}
|
|
243
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SparkQueryActionsDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
244
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.3", type: SparkQueryActionsDirective, isStandalone: true, selector: "[sparkQueryActions]", inputs: { forQuery: { classPropertyName: "forQuery", publicName: "sparkQueryActions", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
117
|
+
if (!slots.length) return null;
|
|
118
|
+
const matches = (target) => !!target && (target.localeCompare(query?.alias ?? "", void 0, { sensitivity: "accent" }) === 0 || target.localeCompare(query?.id ?? "", void 0, { sensitivity: "accent" }) === 0);
|
|
119
|
+
return slots.find((s) => matches(s.forQuery())) ?? slots.find((s) => !s.forQuery()) ?? null;
|
|
245
120
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
* holding a component handle, and hosts wrap this grid in `@if`, where a `viewChild` is
|
|
446
|
-
* intermittently undefined.
|
|
447
|
-
*
|
|
448
|
-
* This drives the CHEAP refresh (see {@link reload}). It deliberately does not feed the main
|
|
449
|
-
* effect: re-running `loadData` would re-resolve the query, the entity types, the permissions
|
|
450
|
-
* and the lookups, and reset the user's page and sort on every button press.
|
|
451
|
-
*/
|
|
452
|
-
reloadToken = input(null, /* @ts-ignore */
|
|
453
|
-
...(ngDevMode ? [{ debugName: "reloadToken" }] : /* istanbul ignore next */ []));
|
|
454
|
-
/**
|
|
455
|
-
* Paging and sorting. Two-way, so a host driving `data` can sort those rows by whatever the
|
|
456
|
-
* user actually clicked — the datatable writes the new sort back through here.
|
|
457
|
-
*/
|
|
458
|
-
settings = model(new DatatableSettings({
|
|
459
|
-
perPage: { values: SPARK_GRID_PAGE_SIZES, selected: SPARK_GRID_PAGE_SIZES[0] },
|
|
460
|
-
page: { values: [1], selected: 1 },
|
|
461
|
-
sortColumns: [],
|
|
462
|
-
}), /* @ts-ignore */
|
|
463
|
-
...(ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []));
|
|
464
|
-
/** Rows the user has ticked. Two-way so chrome outside the grid can read and clear them. */
|
|
465
|
-
selection = model([], /* @ts-ignore */
|
|
466
|
-
...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
467
|
-
/**
|
|
468
|
-
* Replaces where the first column's link points, per row.
|
|
469
|
-
*
|
|
470
|
-
* Return `null` to suppress the link for that row — useful when a grid mixes rows that have a
|
|
471
|
-
* detail page with rows that do not.
|
|
472
|
-
*
|
|
473
|
-
* ⚠️ **It changes the destination, not the permission.** `canRead()` still gates whether any
|
|
474
|
-
* link is rendered at all, and this function is never consulted when that gate is closed. It
|
|
475
|
-
* cannot be used to reach a row the rights model withheld; it exists for the case where the
|
|
476
|
-
* row's natural destination is not `/po/{type}/{id}` — a composed row that maps to a page of
|
|
477
|
-
* its own, or a grid embedded in a route that owns its own child paths.
|
|
478
|
-
*/
|
|
479
|
-
rowRoute = input(null, /* @ts-ignore */
|
|
480
|
-
...(ngDevMode ? [{ debugName: "rowRoute" }] : /* istanbul ignore next */ []));
|
|
481
|
-
/** Emitted whenever a load or a page fetch fails, for a host in bespoke chrome. */
|
|
482
|
-
error = output();
|
|
483
|
-
rowClicked = output();
|
|
484
|
-
customActionExecuted = output();
|
|
485
|
-
colors = Color;
|
|
486
|
-
/**
|
|
487
|
-
* Where the first column's link points for this row: the host's `rowRoute` when it supplied one,
|
|
488
|
-
* otherwise the row's own detail page.
|
|
489
|
-
*
|
|
490
|
-
* A method rather than a computed because the answer is per row, and the template already
|
|
491
|
-
* iterates rows — a computed would have to be a map keyed by id, rebuilt on every page.
|
|
492
|
-
*/
|
|
493
|
-
rowRouteFor(row) {
|
|
494
|
-
const custom = this.rowRoute();
|
|
495
|
-
if (custom)
|
|
496
|
-
return custom(row);
|
|
497
|
-
const type = this.entityType();
|
|
498
|
-
// ⚠️ A composed type has no per-row detail page by construction: its rows are computed, and
|
|
499
|
-
// `{Name}Actions.OnLoadAsync` serves ONE page which is free to ignore the id it was given. So
|
|
500
|
-
// /po/{type}/{rowId} does not 404 — it silently renders that same page, which is worse, because
|
|
501
|
-
// nothing looks wrong. This branch is live in DemoApp today: Read/StartPage implies
|
|
502
|
-
// Query/StartPage, so the composed grid renders with canRead() true and every row linked.
|
|
503
|
-
//
|
|
504
|
-
// `clrType` is absent exactly for those types and is already on the wire; the grid simply never
|
|
505
|
-
// consulted it. A host whose composed rows DO have a page says so with `rowRoute`.
|
|
506
|
-
if (!type?.clrType)
|
|
507
|
-
return null;
|
|
508
|
-
return ['/po', type.alias || type.id, row.id];
|
|
509
|
-
}
|
|
510
|
-
query = signal(null, /* @ts-ignore */
|
|
511
|
-
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
512
|
-
entityType = signal(null, /* @ts-ignore */
|
|
513
|
-
...(ngDevMode ? [{ debugName: "entityType" }] : /* istanbul ignore next */ []));
|
|
514
|
-
allEntityTypes = signal([], /* @ts-ignore */
|
|
515
|
-
...(ngDevMode ? [{ debugName: "allEntityTypes" }] : /* istanbul ignore next */ []));
|
|
516
|
-
lookupReferenceOptions = signal({}, /* @ts-ignore */
|
|
517
|
-
...(ngDevMode ? [{ debugName: "lookupReferenceOptions" }] : /* istanbul ignore next */ []));
|
|
518
|
-
loading = signal(true, /* @ts-ignore */
|
|
519
|
-
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
520
|
-
canRead = signal(false, /* @ts-ignore */
|
|
521
|
-
...(ngDevMode ? [{ debugName: "canRead" }] : /* istanbul ignore next */ []));
|
|
522
|
-
canCreate = signal(false, /* @ts-ignore */
|
|
523
|
-
...(ngDevMode ? [{ debugName: "canCreate" }] : /* istanbul ignore next */ []));
|
|
524
|
-
resultCount = signal(null, /* @ts-ignore */
|
|
525
|
-
...(ngDevMode ? [{ debugName: "resultCount" }] : /* istanbul ignore next */ []));
|
|
526
|
-
customActions = signal([], /* @ts-ignore */
|
|
527
|
-
...(ngDevMode ? [{ debugName: "customActions" }] : /* istanbul ignore next */ []));
|
|
528
|
-
/** Names the server withheld for this RESULT; see QueryResult.disabledActions. */
|
|
529
|
-
disabledActions = signal([], /* @ts-ignore */
|
|
530
|
-
...(ngDevMode ? [{ debugName: "disabledActions" }] : /* istanbul ignore next */ []));
|
|
531
|
-
/**
|
|
532
|
-
* The actions actually offered for this result.
|
|
533
|
-
*
|
|
534
|
-
* The catalogue at `/spark/actions/{objectTypeId}` is per TYPE and is never told what an
|
|
535
|
-
* execution returned, so an action that applies to only some results cannot be filtered there.
|
|
536
|
-
* A custom query withholds what does not apply via `CustomQueryArgs.DisableActions(...)`, and
|
|
537
|
-
* the answer arrives on the result.
|
|
538
|
-
*
|
|
539
|
-
* An affordance, not a permission -- the action handler still refuses on its own terms.
|
|
540
|
-
*/
|
|
541
|
-
visibleCustomActions = computed(() => {
|
|
542
|
-
const withheld = this.disabledActions();
|
|
543
|
-
if (!withheld.length)
|
|
544
|
-
return this.customActions();
|
|
545
|
-
const lowered = new Set(withheld.map(name => name.toLowerCase()));
|
|
546
|
-
return this.customActions().filter(action => !lowered.has(action.name.toLowerCase()));
|
|
547
|
-
}, /* @ts-ignore */
|
|
548
|
-
...(ngDevMode ? [{ debugName: "visibleCustomActions" }] : /* istanbul ignore next */ []));
|
|
549
|
-
fetchFn = signal(null, /* @ts-ignore */
|
|
550
|
-
...(ngDevMode ? [{ debugName: "fetchFn" }] : /* istanbul ignore next */ []));
|
|
551
|
-
/**
|
|
552
|
-
* Why the component renders its own failure instead of only reporting one.
|
|
553
|
-
*
|
|
554
|
-
* `SparkService` is a bare `firstValueFrom` passthrough with no interceptor, so every failure
|
|
555
|
-
* surfaces here and nowhere else. A host embedding this grid cannot surface what it never sees,
|
|
556
|
-
* and the default has to be visible with no host cooperation — hence a rendered alert, not just
|
|
557
|
-
* an output.
|
|
558
|
-
*/
|
|
559
|
-
errorMessage = signal(null, /* @ts-ignore */
|
|
560
|
-
...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
561
|
-
/** 'none' unless an action is selection-gated, so unaffected grids gain no checkbox column. */
|
|
562
|
-
selectionMode = computed(() => selectionModeFor(this.customActions()), /* @ts-ignore */
|
|
563
|
-
...(ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []));
|
|
564
|
-
isVirtualScrolling = computed(() => isVirtualScrollingQuery(this.query()), /* @ts-ignore */
|
|
565
|
-
...(ngDevMode ? [{ debugName: "isVirtualScrolling" }] : /* istanbul ignore next */ []));
|
|
566
|
-
/**
|
|
567
|
-
* Columns as sent with the most recent fetched page.
|
|
568
|
-
*
|
|
569
|
-
* A host binding `data` (streaming) supplies its own via the `columns` input instead — the
|
|
570
|
-
* snapshot carries them once, exactly as a paged result does.
|
|
571
|
-
*/
|
|
572
|
-
fetchedColumns = signal([], /* @ts-ignore */
|
|
573
|
-
...(ngDevMode ? [{ debugName: "fetchedColumns" }] : /* istanbul ignore next */ []));
|
|
574
|
-
/** Every column on the wire, drawn or not — what renderers and lookups resolve against. */
|
|
575
|
-
allColumns = computed(() => this.columns() ?? this.fetchedColumns(), /* @ts-ignore */
|
|
576
|
-
...(ngDevMode ? [{ debugName: "allColumns" }] : /* istanbul ignore next */ []));
|
|
577
|
-
/**
|
|
578
|
-
* The columns the grid draws. `isVisible: false` ships a value without a column, so a renderer
|
|
579
|
-
* can read a sibling the grid does not show; undefined means visible, so a server that predates
|
|
580
|
-
* the field still draws everything.
|
|
581
|
-
*/
|
|
582
|
-
visibleColumns = computed(() => this.allColumns().filter(c => c.isVisible !== false), /* @ts-ignore */
|
|
583
|
-
...(ngDevMode ? [{ debugName: "visibleColumns" }] : /* istanbul ignore next */ []));
|
|
584
|
-
/**
|
|
585
|
-
* True when rows do not come from this component's own fetch.
|
|
586
|
-
*
|
|
587
|
-
* Either because the host bound `data`, or because the query streams — a streaming query's rows
|
|
588
|
-
* arrive over a socket and `/execute` is not a way to get them. The grid recognises the second
|
|
589
|
-
* case itself rather than waiting to be told, because it resolves the query before the host can
|
|
590
|
-
* see it: left to `data` alone, every streaming grid would fire one pointless fetch on mount,
|
|
591
|
-
* before the host had anything to bind.
|
|
592
|
-
*/
|
|
593
|
-
hasExternalData = computed(() => this.data() !== null || this.query()?.isStreamingQuery === true, /* @ts-ignore */
|
|
594
|
-
...(ngDevMode ? [{ debugName: "hasExternalData" }] : /* istanbul ignore next */ []));
|
|
595
|
-
/** Whether an action's selection rule is satisfied right now. The server checks it again. */
|
|
596
|
-
isActionEnabled(action) {
|
|
597
|
-
return parseSelectionRule(action.selectionRule)(this.selection().map(r => r.id).length);
|
|
598
|
-
}
|
|
599
|
-
constructor() {
|
|
600
|
-
effect(() => {
|
|
601
|
-
const qId = this.queryId();
|
|
602
|
-
const pId = this.parentId();
|
|
603
|
-
const pType = this.parentType();
|
|
604
|
-
// Only the query id is required. Requiring a parent here is what made a standalone grid
|
|
605
|
-
// silently render nothing.
|
|
606
|
-
if (qId) {
|
|
607
|
-
this.loadData(qId, pId, pType);
|
|
608
|
-
}
|
|
609
|
-
else {
|
|
610
|
-
// No query id at all. `loading` starts true, so without this the component would spin
|
|
611
|
-
// forever instead of saying anything.
|
|
612
|
-
this.loading.set(false);
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
// Separate effect, so the token drives the cheap refresh and never the full metadata reload.
|
|
616
|
-
// `first` skips the initial run: the effect above has already fetched, and reacting to the
|
|
617
|
-
// token's starting value would double-fetch on mount.
|
|
618
|
-
let first = true;
|
|
619
|
-
effect(() => {
|
|
620
|
-
// Both the host's token and the server's refreshQuery drive the same cheap refresh.
|
|
621
|
-
this.reloadToken();
|
|
622
|
-
this.queryRefresh.tokenFor(this.queryId());
|
|
623
|
-
if (first) {
|
|
624
|
-
first = false;
|
|
625
|
-
return;
|
|
626
|
-
}
|
|
627
|
-
untracked(() => this.reload());
|
|
628
|
-
});
|
|
629
|
-
// A new search term must refetch even when page, perPage and sort are unchanged — the
|
|
630
|
-
// datatable dedupes reloads by exactly that triple, and a new fetch identity is what resets
|
|
631
|
-
// its dedupe key. Skipping the first run keeps mount to a single request.
|
|
632
|
-
let firstSearch = true;
|
|
633
|
-
effect(() => {
|
|
634
|
-
this.search();
|
|
635
|
-
if (firstSearch) {
|
|
636
|
-
firstSearch = false;
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
untracked(() => this.onSearchChanged());
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Re-run the query, keeping the current page, sort and scroll position.
|
|
644
|
-
*
|
|
645
|
-
* Data-level on purpose: it re-seeds the fetch closure and nothing else. For a definition
|
|
646
|
-
* change — new columns, a renamed query — the inputs themselves must change; that is the
|
|
647
|
-
* expensive path. Inert when rows come from the host: there is nothing here to re-run.
|
|
648
|
-
*/
|
|
649
|
-
reload() {
|
|
650
|
-
if (this.hasExternalData())
|
|
651
|
-
return;
|
|
652
|
-
const q = this.query();
|
|
653
|
-
if (q)
|
|
654
|
-
this.fetchFn.set(this.makeFetch(q, this.parentId(), this.parentType()));
|
|
655
|
-
}
|
|
656
|
-
onSearchChanged() {
|
|
657
|
-
if (this.hasExternalData())
|
|
658
|
-
return;
|
|
659
|
-
const s = this.settings();
|
|
660
|
-
// Back to page 1: the old page number means nothing against a different result set.
|
|
661
|
-
this.settings.set(new DatatableSettings({
|
|
662
|
-
perPage: { values: s.perPage.values, selected: s.perPage.selected },
|
|
663
|
-
page: { values: [1], selected: 1 },
|
|
664
|
-
sortColumns: s.sortColumns,
|
|
665
|
-
}));
|
|
666
|
-
this.reload();
|
|
667
|
-
}
|
|
668
|
-
/**
|
|
669
|
-
* Replaces the fetched columns only when they actually differ.
|
|
670
|
-
*
|
|
671
|
-
* Columns ship **once per result**, so every page fetch returns an identical set. Assigning it
|
|
672
|
-
* unconditionally wrote a new array of new objects into the signal each time, re-rendering every
|
|
673
|
-
* header and re-evaluating every `*bsDatatableColumn` input for no change in content.
|
|
674
|
-
*
|
|
675
|
-
* Compared by serialized value rather than by reference: the objects are freshly deserialized from
|
|
676
|
-
* JSON on every response, so reference equality is always false and would defeat the check. A
|
|
677
|
-
* dozen small objects per fetch is nothing beside the request that produced them.
|
|
678
|
-
*
|
|
679
|
-
* ⚠️ This was written believing it fixed a panel-teardown bug (#431 F7). Measured in a browser: it
|
|
680
|
-
* does not. The columns were already identical on every fetch, so the guard hits every time and the
|
|
681
|
-
* teardown had another cause entirely. Kept because avoiding a pointless re-render of every header
|
|
682
|
-
* on every page is worth having on its own — but it is an optimization, not a fix, and the F7
|
|
683
|
-
* question remains open.
|
|
684
|
-
*/
|
|
685
|
-
setFetchedColumns(columns) {
|
|
686
|
-
const current = this.fetchedColumns();
|
|
687
|
-
if (current.length === columns.length && JSON.stringify(current) === JSON.stringify(columns))
|
|
688
|
-
return;
|
|
689
|
-
this.fetchedColumns.set(columns);
|
|
690
|
-
}
|
|
691
|
-
/**
|
|
692
|
-
* The per-column filters currently applied (#431).
|
|
693
|
-
*
|
|
694
|
-
* Read inside `makeFetch`'s closure, like `search`, so a change refetches by producing a new fetch
|
|
695
|
-
* identity rather than by being captured.
|
|
696
|
-
*/
|
|
697
|
-
filters = signal([], /* @ts-ignore */
|
|
698
|
-
...(ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []));
|
|
699
|
-
/**
|
|
700
|
-
* The value source behind every column's panel.
|
|
701
|
-
*
|
|
702
|
-
* ⚠️ **Referentially stable, and that is the whole point.** It reads `filters()` when the datatable
|
|
703
|
-
* *calls* it, not when it is built — so it always sees the current filters while never changing
|
|
704
|
-
* identity.
|
|
705
|
-
*
|
|
706
|
-
* This was a `computed` first, on the reasoning that it had to close over the current filters
|
|
707
|
-
* because `DistinctsRequest` carries only `{ column, search, signal }`. That was wrong, and the way
|
|
708
|
-
* it was wrong is worth keeping: a new identity reassigns `[distincts]` on the element, and the
|
|
709
|
-
* component aborts the in-flight request and bumps a generation counter — so a response already on
|
|
710
|
-
* its way is discarded as stale and the list renders empty over a perfectly good answer.
|
|
711
|
-
*
|
|
712
|
-
* Reading the signal at call time removes the race entirely and is simpler besides.
|
|
713
|
-
*
|
|
714
|
-
* The asked-for column's own filter is excluded: a panel must offer the values you could still
|
|
715
|
-
* pick, not only the ones you already picked.
|
|
716
|
-
*/
|
|
717
|
-
/**
|
|
718
|
-
* The last complete distinct list seen per column, for translating a `< none >` selection.
|
|
719
|
-
*
|
|
720
|
-
* ⚠️ Only stored when the server reported the list was NOT truncated (`hasMore === false`). The
|
|
721
|
-
* translation below is the complement of what is listed, so a partial list would exclude the wrong
|
|
722
|
-
* set — and silently, which is the failure mode this whole feature exists to remove.
|
|
723
|
-
*/
|
|
724
|
-
completeDistincts = new Map();
|
|
725
|
-
distinctsFn = async (request) => {
|
|
726
|
-
const queryId = this.query()?.id;
|
|
727
|
-
if (!queryId)
|
|
728
|
-
return null;
|
|
729
|
-
// Read at call time — never captured.
|
|
730
|
-
const others = this.filters().filter(f => f.name !== request.column);
|
|
731
|
-
// The server's shape IS the datatable's shape, so there is nothing to map.
|
|
732
|
-
const result = await this.sparkService.getDistinctValues(queryId, request.column, {
|
|
733
|
-
search: request.search,
|
|
734
|
-
columns: others,
|
|
735
|
-
parentId: this.parentId(),
|
|
736
|
-
parentType: this.parentType(),
|
|
737
|
-
});
|
|
738
|
-
// A searched list is a subset by construction, so it is never a basis for a complement.
|
|
739
|
-
if (result && !result.hasMore && !request.search)
|
|
740
|
-
this.completeDistincts.set(request.column, result.matching.map(v => v.value));
|
|
741
|
-
else
|
|
742
|
-
this.completeDistincts.delete(request.column);
|
|
743
|
-
return result;
|
|
744
|
-
};
|
|
745
|
-
/**
|
|
746
|
-
* Translates one filter change into the wire shape and refetches.
|
|
747
|
-
*
|
|
748
|
-
* The event always arrives as the `'values'` shape because the panel only ever calls
|
|
749
|
-
* `ctx.apply(...)`; comparison mode is never declared. `inverse` is a flag on the event and two
|
|
750
|
-
* arrays on the wire — the translation is this method's whole job.
|
|
751
|
-
*/
|
|
752
|
-
onFilterChange(detail) {
|
|
753
|
-
if (detail.mode !== 'values')
|
|
754
|
-
return;
|
|
755
|
-
const values = detail.selected.map(v => v.value);
|
|
756
|
-
const next = this.filters().filter(f => f.name !== detail.column);
|
|
757
|
-
if (values.length > 0) {
|
|
758
|
-
// ⚠️ `< none >` cannot be asked for directly. The server compares against the index term, and
|
|
759
|
-
// RavenDB gives a field the document never wrote NO term at all — so `Col == null` matches a
|
|
760
|
-
// field written as JSON null but NOT one that is absent, while `Col != null` puts the absent row
|
|
761
|
-
// with the rows that HAVE a value. Both rows render blank, the panel offers one entry for the
|
|
762
|
-
// pair, and no predicate selects that pair. Measured in AbsentVersusNullFieldTests.
|
|
763
|
-
//
|
|
764
|
-
// The complement is expressible, though: "none of the real values" catches absent and null
|
|
765
|
-
// alike. So a selection containing the null entry is sent as an exclusion of everything NOT
|
|
766
|
-
// selected, which is exactly the same set and needs no server change.
|
|
767
|
-
const complete = this.completeDistincts.get(detail.column);
|
|
768
|
-
const selectsNone = values.some(v => v === null || v === undefined);
|
|
769
|
-
if (selectsNone && !detail.inverse && complete) {
|
|
770
|
-
const unselected = complete.filter(v => v !== null && v !== undefined && !values.some(s => s === v));
|
|
771
|
-
// Everything is selected, so the filter narrows nothing — drop it rather than sending an
|
|
772
|
-
// empty exclusion, which would read as "exclude nothing" only by accident.
|
|
773
|
-
if (unselected.length > 0)
|
|
774
|
-
next.push({ name: detail.column, excludes: unselected });
|
|
775
|
-
}
|
|
776
|
-
else {
|
|
777
|
-
next.push(detail.inverse
|
|
778
|
-
? { name: detail.column, excludes: values }
|
|
779
|
-
: { name: detail.column, includes: values });
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
this.filters.set(next);
|
|
783
|
-
this.onFilterChanged();
|
|
784
|
-
}
|
|
785
|
-
/**
|
|
786
|
-
* Back to page 1 and a fresh fetch identity, exactly as a new search term does.
|
|
787
|
-
*
|
|
788
|
-
* Both halves matter: the old page number means nothing against a different result set, and the
|
|
789
|
-
* datatable dedupes reloads by `(page, perPage, sort)` — none of which a filter changes — so
|
|
790
|
-
* without a new fetch identity the request is silently never made.
|
|
791
|
-
*/
|
|
792
|
-
onFilterChanged() {
|
|
793
|
-
if (this.hasExternalData())
|
|
794
|
-
return;
|
|
795
|
-
const s = this.settings();
|
|
796
|
-
this.settings.set(new DatatableSettings({
|
|
797
|
-
perPage: { values: s.perPage.values, selected: s.perPage.selected },
|
|
798
|
-
page: { values: [1], selected: 1 },
|
|
799
|
-
sortColumns: s.sortColumns,
|
|
800
|
-
}));
|
|
801
|
-
this.reload();
|
|
802
|
-
}
|
|
803
|
-
async onCustomAction(action) {
|
|
804
|
-
if (action.confirmationMessageKey) {
|
|
805
|
-
const message = this.lang.t(action.confirmationMessageKey) || 'Are you sure?';
|
|
806
|
-
if (!confirm(message))
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
try {
|
|
810
|
-
// The sub-query's container travels with the action (#327). Without it an action invoked
|
|
811
|
-
// from a company's Cars tab could not tell it was on a company's page at all — the grid knew
|
|
812
|
-
// (it filters the rows by that parent) and simply dropped the fact on the way out.
|
|
813
|
-
//
|
|
814
|
-
// Sent as parentId/parentType, NOT as the `parent` argument: that one means an object of this
|
|
815
|
-
// action's OWN type and is loaded under it server-side, so handing it a Company id for a Car
|
|
816
|
-
// action refuses — correctly, and confusingly.
|
|
817
|
-
const pId = this.parentId();
|
|
818
|
-
const pType = this.parentType();
|
|
819
|
-
await this.sparkService.executeCustomAction(this.entityType().id, action.name, undefined, this.selection().map(r => r.id), pId && pType ? { id: pId, type: pType } : undefined,
|
|
820
|
-
// The query too: the server re-runs it narrowed to these ids, so the action receives the
|
|
821
|
-
// rows this grid rendered rather than a re-derivation from documents.
|
|
822
|
-
this.query()?.id);
|
|
823
|
-
this.customActionExecuted.emit({ action });
|
|
824
|
-
if (action.refreshOnCompleted)
|
|
825
|
-
this.reload();
|
|
826
|
-
}
|
|
827
|
-
catch (e) {
|
|
828
|
-
const err = e;
|
|
829
|
-
this.errorMessage.set(err.error?.error || err.message || this.lang.t('common.actionFailed') || 'Action failed');
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
reportError(err) {
|
|
833
|
-
this.errorMessage.set(this.describe(err));
|
|
834
|
-
this.error.emit(err);
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* A 404 is deliberately generic.
|
|
838
|
-
*
|
|
839
|
-
* `Endpoints/Queries/Get.cs` answers 404 with byte-identical bodies for "no such query" and
|
|
840
|
-
* "you may not see it", so existence is not disclosed (security audit M-3). The component
|
|
841
|
-
* therefore genuinely cannot tell them apart, and both "Not found" and "Access denied" would be
|
|
842
|
-
* a guess — one of them leaking, the other misleading.
|
|
843
|
-
*/
|
|
844
|
-
describe(err) {
|
|
845
|
-
if (err?.status === 404) {
|
|
846
|
-
return this.lang.t('spark.query.unavailable') || 'This list is not available.';
|
|
847
|
-
}
|
|
848
|
-
return err?.error?.error || err?.message
|
|
849
|
-
|| this.lang.t('common.unexpectedError') || 'An unexpected error occurred';
|
|
850
|
-
}
|
|
851
|
-
async loadData(queryId, parentId, parentType) {
|
|
852
|
-
this.loading.set(true);
|
|
853
|
-
this.errorMessage.set(null);
|
|
854
|
-
this.fetchFn.set(null);
|
|
855
|
-
// Reset everything derived from the previous query, not just the fetch. Leaving
|
|
856
|
-
// `entityType`/`canRead` behind let a failed reload build a row link out of the PREVIOUS type
|
|
857
|
-
// and the previous permission.
|
|
858
|
-
this.query.set(null);
|
|
859
|
-
this.entityType.set(null);
|
|
860
|
-
this.canRead.set(false);
|
|
861
|
-
this.canCreate.set(false);
|
|
862
|
-
this.customActions.set([]);
|
|
863
|
-
this.resultCount.set(null);
|
|
864
|
-
// Ids from the previous query are meaningless against the next one, and would be POSTed as
|
|
865
|
-
// though they belonged to it.
|
|
866
|
-
this.selection.set([]);
|
|
867
|
-
// A filter belongs to the query it was applied to. Surviving a query switch would POST it
|
|
868
|
-
// against the next query, where the column may not exist or may mean something else entirely.
|
|
869
|
-
this.filters.set([]);
|
|
870
|
-
try {
|
|
871
|
-
const [resolvedQuery, entityTypes] = await Promise.all([
|
|
872
|
-
this.sparkService.getQuery(queryId),
|
|
873
|
-
this.sparkService.getEntityTypes(),
|
|
874
|
-
]);
|
|
875
|
-
this.query.set(resolvedQuery);
|
|
876
|
-
this.allEntityTypes.set(entityTypes);
|
|
877
|
-
const et = this.resolveEntityType(resolvedQuery, entityTypes);
|
|
878
|
-
this.entityType.set(et);
|
|
879
|
-
if (et) {
|
|
880
|
-
const [permissions, actions] = await Promise.all([
|
|
881
|
-
this.sparkService.getPermissions(et.id),
|
|
882
|
-
this.sparkService.getCustomActions(et.id),
|
|
883
|
-
]);
|
|
884
|
-
this.canRead.set(permissions.canRead);
|
|
885
|
-
this.canCreate.set(permissions.canCreate);
|
|
886
|
-
// 'query', not 'list'. The server model has always documented "detail" | "query" |
|
|
887
|
-
// "both"; a filter testing for a value nothing emits renders the action NOWHERE.
|
|
888
|
-
this.customActions.set(filterQueryActions(actions));
|
|
889
|
-
}
|
|
890
|
-
this.settings.set(initialGridSettings(resolvedQuery));
|
|
891
|
-
// The datatable drives paging/sorting via [(settings)] and calls fetchFn per page. Virtual
|
|
892
|
-
// scrolling is just the [virtualScroll] template flag.
|
|
893
|
-
// `resolvedQuery`, not `hasExternalData()`: the query signal is set above, but reading the
|
|
894
|
-
// computed here would depend on signal-read ordering inside an async method. Ask the value
|
|
895
|
-
// directly.
|
|
896
|
-
if (this.data() === null && !resolvedQuery?.isStreamingQuery) {
|
|
897
|
-
this.fetchFn.set(this.makeFetch(resolvedQuery, parentId, parentType));
|
|
898
|
-
}
|
|
899
|
-
this.loadLookupReferenceOptions();
|
|
900
|
-
}
|
|
901
|
-
catch (e) {
|
|
902
|
-
this.fetchFn.set(null);
|
|
903
|
-
this.reportError(e);
|
|
904
|
-
}
|
|
905
|
-
finally {
|
|
906
|
-
this.loading.set(false);
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
/**
|
|
910
|
-
* The query's entity type.
|
|
911
|
-
*
|
|
912
|
-
* The source-name fallback is not optional garnish: a `Database.*` query need not declare
|
|
913
|
-
* `entityType`, and the sub-query grid — which matched on the declared name alone — rendered
|
|
914
|
-
* those as an empty card with no columns, no rows and no error, while the identical query
|
|
915
|
-
* rendered correctly as a page. Both grids are this one now, so there is one answer.
|
|
916
|
-
*/
|
|
917
|
-
resolveEntityType(query, entityTypes) {
|
|
918
|
-
if (!query)
|
|
919
|
-
return null;
|
|
920
|
-
if (query.entityType) {
|
|
921
|
-
return entityTypes.find(t => t.name === query.entityType || t.alias === query.entityType?.toLowerCase()) ?? null;
|
|
922
|
-
}
|
|
923
|
-
const sourceName = extractSourceName(query.source);
|
|
924
|
-
const singular = singularize(sourceName);
|
|
925
|
-
// `name + 's'` because the "-es" rule over-strips (Vehicles -> "Vehicl", Roles -> "Rol"); the
|
|
926
|
-
// page resolver in spark-query-list has always matched this way.
|
|
927
|
-
return entityTypes.find(t => t.name === sourceName || t.name === singular || t.name + 's' === sourceName || t.clrType?.endsWith(singular)) ?? null;
|
|
928
|
-
}
|
|
929
|
-
makeFetch(query, parentId, parentType) {
|
|
930
|
-
return (req) => this.sparkService.executeQuery(query.id, {
|
|
931
|
-
sortColumns: req.sortColumns,
|
|
932
|
-
skip: (req.page - 1) * req.perPage,
|
|
933
|
-
take: req.perPage,
|
|
934
|
-
search: this.search() || undefined,
|
|
935
|
-
// Read inside the closure, exactly as `search` is: what forces a refetch is the fetch
|
|
936
|
-
// identity `reload()` creates, not the value captured when this closure was built.
|
|
937
|
-
columns: this.filters(),
|
|
938
|
-
parentId, parentType,
|
|
939
|
-
}).then(r => {
|
|
940
|
-
this.errorMessage.set(null);
|
|
941
|
-
this.resultCount.set(r.totalItems);
|
|
942
|
-
// Columns come from the result now, not from the entity type: the server decides the query
|
|
943
|
-
// surface (ShowedOn.Query) and is the same place the sort-column allow-list is checked.
|
|
944
|
-
// ?? [] because a malformed or older response must render an empty grid, not throw inside a
|
|
945
|
-
// computed — where the stack points at the column filter and not at the response that lacked them.
|
|
946
|
-
this.setFetchedColumns(r.columns ?? []);
|
|
947
|
-
// Per-result, so it is re-read on every page rather than latched from the first.
|
|
948
|
-
this.disabledActions.set(r.disabledActions ?? []);
|
|
949
|
-
return {
|
|
950
|
-
data: r.items,
|
|
951
|
-
totalRecords: r.totalItems,
|
|
952
|
-
totalPages: Math.ceil(r.totalItems / req.perPage) || 1,
|
|
953
|
-
perPage: req.perPage,
|
|
954
|
-
page: req.page,
|
|
955
|
-
};
|
|
956
|
-
}).catch((e) => {
|
|
957
|
-
// Report before returning the empty page, or a failed fetch is indistinguishable from a
|
|
958
|
-
// query that legitimately has no rows.
|
|
959
|
-
this.reportError(e);
|
|
960
|
-
this.resultCount.set(0);
|
|
961
|
-
return { data: [], totalRecords: 0, totalPages: 1, perPage: req.perPage, page: req.page };
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
async loadLookupReferenceOptions() {
|
|
965
|
-
// Over ALL columns, not just the drawn ones: an undrawn column's value can still be rendered
|
|
966
|
-
// by a renderer reading it as a sibling, and it would resolve to a raw key without its options.
|
|
967
|
-
this.lookupReferenceOptions.set(await this.gridRenderers.loadLookupOptions(this.allColumns()));
|
|
968
|
-
}
|
|
969
|
-
/**
|
|
970
|
-
* The underlying value a custom renderer receives, which is not the printable one.
|
|
971
|
-
*
|
|
972
|
-
* A projection is flat, so this is the cell's own value rather than a display string. It is
|
|
973
|
-
* deliberately not the attribute-shaped `rendererValue`: a query row has no nested object to
|
|
974
|
-
* fall back to, and reaching for one would hand every renderer `undefined`.
|
|
975
|
-
*/
|
|
976
|
-
rendererValueFor(item, column) {
|
|
977
|
-
return cellValue(valueFor(item, column.name));
|
|
978
|
-
}
|
|
979
|
-
getColumnRendererComponent(column) {
|
|
980
|
-
return this.gridRenderers.columnComponentFor(column);
|
|
981
|
-
}
|
|
982
|
-
/** The renderer's optional filter-label override for this column, or null for the server text. */
|
|
983
|
-
filterLabelFor(column) {
|
|
984
|
-
return this.gridRenderers.filterLabelFor(column);
|
|
985
|
-
}
|
|
986
|
-
getColumnRendererInputs(component, item, column) {
|
|
987
|
-
return this.gridRenderers.columnInputsFor(component, item, column);
|
|
988
|
-
}
|
|
989
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SparkQueryGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
990
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: SparkQueryGridComponent, isStandalone: true, selector: "spark-query-grid", inputs: { queryId: { classPropertyName: "queryId", publicName: "queryId", isSignal: true, isRequired: true, transformFunction: null }, parentId: { classPropertyName: "parentId", publicName: "parentId", isSignal: true, isRequired: false, transformFunction: null }, parentType: { classPropertyName: "parentType", publicName: "parentType", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, reloadToken: { classPropertyName: "reloadToken", publicName: "reloadToken", isSignal: true, isRequired: false, transformFunction: null }, settings: { classPropertyName: "settings", publicName: "settings", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, rowRoute: { classPropertyName: "rowRoute", publicName: "rowRoute", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { settings: "settingsChange", selection: "selectionChange", error: "error", rowClicked: "rowClicked", customActionExecuted: "customActionExecuted" }, ngImport: i0, template: "<!--\n Three explicit states, in this order, and the order is load-bearing.\n\n This template used to open with `@if (query(); as q)` wrapping EVERYTHING, and `query()` is only\n set after loadData's awaits resolve. Three separate bugs fell out of that one line: the spinner\n was unreachable on a first load (it rendered inside the gate, while `loading` starts true and\n `query` starts null), a first-load failure rendered ZERO DOM \u2014 no card, no message, nothing to\n see or report \u2014 and a failed RELOAD left the previous query's rows on screen.\n\n So: `loading` is checked first and outside any dependency on `query`, and the final `@else`\n always renders something. Do not fold these back into one gate, and do not move the spinner\n inside the `query()` branch.\n-->\n@if (loading()) {\n <div class=\"text-center p-3\">\n <bs-spinner />\n </div>\n} @else if (query()) {\n <!-- A page-fetch failure while the grid is already resolved. Without this the catch returns an\n empty page and a failed query is indistinguishable from one that legitimately has no rows. -->\n @if (errorMessage(); as err) {\n <bs-alert [type]=\"colors.danger\" class=\"mb-3\">\n {{ err }}\n </bs-alert>\n }\n\n <!--\n One datatable, two row sources. `[data]` and `[fetch]` are mutually exclusive in\n ng-bootstrap \u2014 binding both makes `[fetch]` win silently \u2014 so exactly one is ever non-null\n here: `fetchFn` is left null whenever `data` is bound. See the class comment for why rows can\n arrive from outside at all (streaming must not put a websocket in every detail page's bundle).\n -->\n <bs-datatable\n [selectionMode]=\"selectionMode()\"\n [(selection)]=\"selection\"\n [virtualScroll]=\"isVirtualScrolling()\"\n [itemSize]=\"40\"\n [isResponsive]=\"isVirtualScrolling()\"\n [data]=\"data()\"\n [fetch]=\"fetchFn()\"\n [distincts]=\"distinctsFn\"\n (filterChange)=\"onFilterChange($event)\"\n [(settings)]=\"settings\">\n @for (col of visibleColumns(); track col.name) {\n <!--\n `canSort`/`canFilter` arrive already resolved by the server (query override \u2192 attribute \u2192\n true), so this only spells the polarity. `!== false` is needed for BOTH, for opposite\n reasons: absent means capable on our wire, while the datatable's own `filterable` defaults\n to false, unlike `sortable`.\n\n \u26A0\uFE0F `filterActive` and `filterSummary` are deliberately NOT bound. Any *bsDatatableColumn\n input change recomputes the column set, which retires the live filter view \u2014 while the web\n component's mount-once guard leaves the panel's nodes in place and never re-renders them.\n Binding them to state our own panel mutates would freeze the panel the instant a value is\n ticked, until it is closed and reopened. The cost is that a filtered column carries no\n visual marker yet, which is worth far less than a panel that dies on first use. See #431 F7.\n -->\n <div *bsDatatableColumn=\"col.name; sortable: col.canSort !== false; filterable: col.canFilter !== false\">\n {{ (col.label | resolveTranslation) || col.name }}\n <spark-attribute-description [description]=\"col.description\" />\n\n @if (col.canFilter !== false) {\n <ng-container *bsDatatableFilterPanel=\"let values; let ctx = ctx\">\n <spark-column-filter-panel\n [column]=\"col\"\n [values]=\"values()\"\n [ctx]=\"ctx\"\n [filterLabel]=\"filterLabelFor(col)\" />\n </ng-container>\n }\n </div>\n }\n\n <ng-container *bsRowTemplate=\"let item\">\n @let row = $any(item);\n @for (col of visibleColumns(); track col.name; let first = $first) {\n <td>\n @if (row) {\n <!-- The first column links to the row's detail page. Two things about this are\n routinely misread:\n\n 1. `cellContent` is projected INSIDE the anchor, so a custom `renderer` does NOT\n suppress this link \u2014 a renderer that emits its own <a> produces nested anchors\n (invalid HTML) rather than replacing this one.\n 2. `canRead()` is the whole gate, and it is the rights model: `Query` without\n `Read` lists the rows and withholds the link. Withhold `Read` for a query\n whose rows no detail page can load \u2014 a Custom.* query that fabricates rows in\n memory, say.\n 3. `rowRoute` replaces the DESTINATION only, never the gate: returning a route\n from it cannot make a row clickable that `canRead()` withheld, and returning\n null from it suppresses the link for that one row. -->\n @if (first && canRead() && rowRouteFor(row); as route) {\n <a [routerLink]=\"route\"\n (click)=\"rowClicked.emit(row)\">\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, col: col }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, col: col }\"></ng-container>\n }\n } @else {\n \n }\n </td>\n }\n </ng-container>\n </bs-datatable>\n} @else {\n <!-- The query could not be resolved. Rendering something keeps the host's layout intact and,\n crucially, makes the failure visible: this branch used to render nothing at all. -->\n <bs-alert [type]=\"colors.danger\" class=\"mb-0\">\n {{ errorMessage() || ('spark.query.unavailable' | t) }}\n </bs-alert>\n}\n\n<ng-template #cellContent let-item let-col=\"col\">\n <!--\n Presentation lives in <spark-grid-cell>, shared with the AsDetail table on the PO detail page.\n Value resolution stays here: a query row is a PersistentObject with an attribute list, and the\n AsDetail table's rows are plain dictionaries, so only the rendering is common.\n\n `link` is deliberately not passed. The first-column link is the grid's own rule and wraps this\n template from outside; setting both would nest anchors.\n -->\n <spark-grid-cell\n [column]=\"col\"\n [display]=\"(col | queryCellValue:item:lookupReferenceOptions())\"\n [rendererValue]=\"rendererValueFor(item, col)\"\n [item]=\"item\"\n [chips]=\"(col | queryReferenceChips:item)\" />\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }, { kind: "component", type: BsAlertComponent, selector: "bs-alert", inputs: ["type", "announce", "isVisible"], outputs: ["isVisibleChange", "afterOpenedOrClosed"] }, { kind: "component", type: BsDatatableComponent, selector: "bs-datatable", inputs: ["columns", "data", "fetch", "distincts", "labels", "settings", "selectionMode", "selectable", "selection", "rowKey", "resizableColumns", "pagination", "virtualScroll", "itemSize", "virtualBuffer", "isResponsive", "compareWith", "tree", "idKey", "childCountKey", "treeIndent", "expandedIds", "selectionStrategy"], outputs: ["settingsChange", "selectionChange", "rowClick", "rowDblClick", "rowContextMenu", "expandedIdsChange", "rowExpand", "rowCollapse", "filterChange"] }, { kind: "directive", type: BsDatatableColumnDirective, selector: "[bsDatatableColumn]", inputs: ["bsDatatableColumn", "bsDatatableColumnSortable", "bsDatatableColumnFilterable", "bsDatatableColumnFilterActive", "bsDatatableColumnFilterSummary", "bsDatatableColumnFilterSelection", "bsDatatableColumnFilterMode", "bsDatatableColumnFilterInputType", "bsDatatableColumnFilterOperators"] }, { kind: "directive", type: BsDatatableFilterPanelDirective, selector: "[bsDatatableFilterPanel]" }, { kind: "directive", type: BsRowTemplateDirective, selector: "[bsRowTemplate]" }, { kind: "component", type: BsSpinnerComponent, selector: "bs-spinner", inputs: ["type", "color"] }, { kind: "component", type: SparkGridCellComponent, selector: "spark-grid-cell", inputs: ["column", "display", "rendererValue", "item", "chips", "link"] }, { kind: "component", type: SparkAttributeDescriptionComponent, selector: "spark-attribute-description", inputs: ["description", "position"] }, { kind: "component", type: SparkColumnFilterPanelComponent, selector: "spark-column-filter-panel", inputs: ["column", "values", "ctx", "filterLabel"] }, { kind: "pipe", type: ResolveTranslationPipe, name: "resolveTranslation" }, { kind: "pipe", type: QueryCellValuePipe, name: "queryCellValue" }, { kind: "pipe", type: QueryReferenceChipsPipe, name: "queryReferenceChips" }, { kind: "pipe", type: TranslateKeyPipe, name: "t" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
121
|
+
var SparkQueryIconDirective = class SparkQueryIconDirective {
|
|
122
|
+
templateRef = inject(TemplateRef);
|
|
123
|
+
forQuery = input("", {
|
|
124
|
+
...ngDevMode ? { debugName: "forQuery" } : /* istanbul ignore next */ {},
|
|
125
|
+
alias: "sparkQueryIcon"
|
|
126
|
+
});
|
|
127
|
+
static ngTemplateContextGuard(_dir, ctx) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
131
|
+
minVersion: "12.0.0",
|
|
132
|
+
version: "22.2.0",
|
|
133
|
+
ngImport: i0,
|
|
134
|
+
type: SparkQueryIconDirective,
|
|
135
|
+
deps: [],
|
|
136
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
137
|
+
});
|
|
138
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
139
|
+
minVersion: "17.1.0",
|
|
140
|
+
version: "22.2.0",
|
|
141
|
+
type: SparkQueryIconDirective,
|
|
142
|
+
isStandalone: true,
|
|
143
|
+
selector: "[sparkQueryIcon]",
|
|
144
|
+
inputs: { forQuery: {
|
|
145
|
+
classPropertyName: "forQuery",
|
|
146
|
+
publicName: "sparkQueryIcon",
|
|
147
|
+
isSignal: true,
|
|
148
|
+
isRequired: false,
|
|
149
|
+
transformFunction: null
|
|
150
|
+
} },
|
|
151
|
+
ngImport: i0
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
155
|
+
minVersion: "12.0.0",
|
|
156
|
+
version: "22.2.0",
|
|
157
|
+
ngImport: i0,
|
|
158
|
+
type: SparkQueryIconDirective,
|
|
159
|
+
decorators: [{
|
|
160
|
+
type: Directive,
|
|
161
|
+
args: [{ selector: "[sparkQueryIcon]" }]
|
|
162
|
+
}],
|
|
163
|
+
propDecorators: { forQuery: [{
|
|
164
|
+
type: i0.Input,
|
|
165
|
+
args: [{
|
|
166
|
+
isSignal: true,
|
|
167
|
+
alias: "sparkQueryIcon",
|
|
168
|
+
required: false
|
|
169
|
+
}]
|
|
170
|
+
}] }
|
|
171
|
+
});
|
|
172
|
+
var SparkQueryCaptionDirective = class SparkQueryCaptionDirective {
|
|
173
|
+
templateRef = inject(TemplateRef);
|
|
174
|
+
forQuery = input("", {
|
|
175
|
+
...ngDevMode ? { debugName: "forQuery" } : /* istanbul ignore next */ {},
|
|
176
|
+
alias: "sparkQueryCaption"
|
|
177
|
+
});
|
|
178
|
+
static ngTemplateContextGuard(_dir, ctx) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
182
|
+
minVersion: "12.0.0",
|
|
183
|
+
version: "22.2.0",
|
|
184
|
+
ngImport: i0,
|
|
185
|
+
type: SparkQueryCaptionDirective,
|
|
186
|
+
deps: [],
|
|
187
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
188
|
+
});
|
|
189
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
190
|
+
minVersion: "17.1.0",
|
|
191
|
+
version: "22.2.0",
|
|
192
|
+
type: SparkQueryCaptionDirective,
|
|
193
|
+
isStandalone: true,
|
|
194
|
+
selector: "[sparkQueryCaption]",
|
|
195
|
+
inputs: { forQuery: {
|
|
196
|
+
classPropertyName: "forQuery",
|
|
197
|
+
publicName: "sparkQueryCaption",
|
|
198
|
+
isSignal: true,
|
|
199
|
+
isRequired: false,
|
|
200
|
+
transformFunction: null
|
|
201
|
+
} },
|
|
202
|
+
ngImport: i0
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
206
|
+
minVersion: "12.0.0",
|
|
207
|
+
version: "22.2.0",
|
|
208
|
+
ngImport: i0,
|
|
209
|
+
type: SparkQueryCaptionDirective,
|
|
210
|
+
decorators: [{
|
|
211
|
+
type: Directive,
|
|
212
|
+
args: [{ selector: "[sparkQueryCaption]" }]
|
|
213
|
+
}],
|
|
214
|
+
propDecorators: { forQuery: [{
|
|
215
|
+
type: i0.Input,
|
|
216
|
+
args: [{
|
|
217
|
+
isSignal: true,
|
|
218
|
+
alias: "sparkQueryCaption",
|
|
219
|
+
required: false
|
|
220
|
+
}]
|
|
221
|
+
}] }
|
|
222
|
+
});
|
|
223
|
+
var SparkQueryActionsDirective = class SparkQueryActionsDirective {
|
|
224
|
+
templateRef = inject(TemplateRef);
|
|
225
|
+
forQuery = input("", {
|
|
226
|
+
...ngDevMode ? { debugName: "forQuery" } : /* istanbul ignore next */ {},
|
|
227
|
+
alias: "sparkQueryActions"
|
|
228
|
+
});
|
|
229
|
+
static ngTemplateContextGuard(_dir, ctx) {
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
233
|
+
minVersion: "12.0.0",
|
|
234
|
+
version: "22.2.0",
|
|
235
|
+
ngImport: i0,
|
|
236
|
+
type: SparkQueryActionsDirective,
|
|
237
|
+
deps: [],
|
|
238
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
239
|
+
});
|
|
240
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
241
|
+
minVersion: "17.1.0",
|
|
242
|
+
version: "22.2.0",
|
|
243
|
+
type: SparkQueryActionsDirective,
|
|
244
|
+
isStandalone: true,
|
|
245
|
+
selector: "[sparkQueryActions]",
|
|
246
|
+
inputs: { forQuery: {
|
|
247
|
+
classPropertyName: "forQuery",
|
|
248
|
+
publicName: "sparkQueryActions",
|
|
249
|
+
isSignal: true,
|
|
250
|
+
isRequired: false,
|
|
251
|
+
transformFunction: null
|
|
252
|
+
} },
|
|
253
|
+
ngImport: i0
|
|
254
|
+
});
|
|
255
|
+
};
|
|
256
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
257
|
+
minVersion: "12.0.0",
|
|
258
|
+
version: "22.2.0",
|
|
259
|
+
ngImport: i0,
|
|
260
|
+
type: SparkQueryActionsDirective,
|
|
261
|
+
decorators: [{
|
|
262
|
+
type: Directive,
|
|
263
|
+
args: [{ selector: "[sparkQueryActions]" }]
|
|
264
|
+
}],
|
|
265
|
+
propDecorators: { forQuery: [{
|
|
266
|
+
type: i0.Input,
|
|
267
|
+
args: [{
|
|
268
|
+
isSignal: true,
|
|
269
|
+
alias: "sparkQueryActions",
|
|
270
|
+
required: false
|
|
271
|
+
}]
|
|
272
|
+
}] }
|
|
273
|
+
});
|
|
274
|
+
var SparkQuerySlotContext = class {
|
|
275
|
+
$implicit = null;
|
|
276
|
+
};
|
|
277
|
+
var SparkQueryCaptionContext = class {
|
|
278
|
+
$implicit = "";
|
|
279
|
+
query = null;
|
|
280
|
+
};
|
|
281
|
+
var SparkQueryActionsContext = class {
|
|
282
|
+
$implicit = [];
|
|
283
|
+
selection = [];
|
|
284
|
+
query = null;
|
|
285
|
+
};
|
|
286
|
+
const NUMERIC_TYPES = /* @__PURE__ */ new Set([
|
|
287
|
+
"number",
|
|
288
|
+
"int",
|
|
289
|
+
"integer",
|
|
290
|
+
"long",
|
|
291
|
+
"decimal",
|
|
292
|
+
"double",
|
|
293
|
+
"float"
|
|
294
|
+
]);
|
|
295
|
+
function applicablePresetFilters(filters, entityType) {
|
|
296
|
+
if (!filters?.length || !entityType) return [];
|
|
297
|
+
const result = [];
|
|
298
|
+
for (const filter of filters) {
|
|
299
|
+
const attribute = (entityType.attributes ?? []).find((a) => a.name === filter.name);
|
|
300
|
+
if (!attribute || attribute.isVisible === false) continue;
|
|
301
|
+
const coerce = (value) => {
|
|
302
|
+
if (typeof value !== "string") return value;
|
|
303
|
+
if (NUMERIC_TYPES.has(attribute.dataType)) {
|
|
304
|
+
const n = Number(value);
|
|
305
|
+
return value.trim() !== "" && Number.isFinite(n) ? n : value;
|
|
306
|
+
}
|
|
307
|
+
if (attribute.dataType === "boolean") return value === "true" ? true : value === "false" ? false : value;
|
|
308
|
+
return value;
|
|
309
|
+
};
|
|
310
|
+
const includes = filter.includes?.map(coerce);
|
|
311
|
+
const excludes = filter.excludes?.map(coerce);
|
|
312
|
+
if (!includes?.length && !excludes?.length) continue;
|
|
313
|
+
result.push({
|
|
314
|
+
name: filter.name,
|
|
315
|
+
...includes?.length ? { includes } : {},
|
|
316
|
+
...excludes?.length ? { excludes } : {}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
return result;
|
|
991
320
|
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
321
|
+
var SparkGridCellComponent = class SparkGridCellComponent {
|
|
322
|
+
renderers = inject(SparkGridRenderers);
|
|
323
|
+
column = input.required(...ngDevMode ? [{ debugName: "column" }] : /* istanbul ignore next */ []);
|
|
324
|
+
display = input(null, ...ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []);
|
|
325
|
+
rendererValue = input(null, ...ngDevMode ? [{ debugName: "rendererValue" }] : /* istanbul ignore next */ []);
|
|
326
|
+
item = input(null, ...ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []);
|
|
327
|
+
chips = input([], ...ngDevMode ? [{ debugName: "chips" }] : /* istanbul ignore next */ []);
|
|
328
|
+
link = input(null, ...ngDevMode ? [{ debugName: "link" }] : /* istanbul ignore next */ []);
|
|
329
|
+
rendererComponent = computed(() => this.renderers.columnComponentFor(this.column()), ...ngDevMode ? [{ debugName: "rendererComponent" }] : /* istanbul ignore next */ []);
|
|
330
|
+
rendererInputs = computed(() => {
|
|
331
|
+
const component = this.rendererComponent();
|
|
332
|
+
return component ? this.renderers.cellInputsFor(component, this.rendererValue(), this.column(), this.item()) : {};
|
|
333
|
+
}, ...ngDevMode ? [{ debugName: "rendererInputs" }] : /* istanbul ignore next */ []);
|
|
334
|
+
isUnsetBoolean = computed(() => this.display() == null, ...ngDevMode ? [{ debugName: "isUnsetBoolean" }] : /* istanbul ignore next */ []);
|
|
335
|
+
dateValue = computed(() => {
|
|
336
|
+
const value = this.display();
|
|
337
|
+
return value instanceof Date && !Number.isNaN(value.getTime()) ? value : null;
|
|
338
|
+
}, ...ngDevMode ? [{ debugName: "dateValue" }] : /* istanbul ignore next */ []);
|
|
339
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
340
|
+
minVersion: "12.0.0",
|
|
341
|
+
version: "22.2.0",
|
|
342
|
+
ngImport: i0,
|
|
343
|
+
type: SparkGridCellComponent,
|
|
344
|
+
deps: [],
|
|
345
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
346
|
+
});
|
|
347
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
348
|
+
minVersion: "17.0.0",
|
|
349
|
+
version: "22.2.0",
|
|
350
|
+
type: SparkGridCellComponent,
|
|
351
|
+
isStandalone: true,
|
|
352
|
+
selector: "spark-grid-cell",
|
|
353
|
+
inputs: {
|
|
354
|
+
column: {
|
|
355
|
+
classPropertyName: "column",
|
|
356
|
+
publicName: "column",
|
|
357
|
+
isSignal: true,
|
|
358
|
+
isRequired: true,
|
|
359
|
+
transformFunction: null
|
|
360
|
+
},
|
|
361
|
+
display: {
|
|
362
|
+
classPropertyName: "display",
|
|
363
|
+
publicName: "display",
|
|
364
|
+
isSignal: true,
|
|
365
|
+
isRequired: false,
|
|
366
|
+
transformFunction: null
|
|
367
|
+
},
|
|
368
|
+
rendererValue: {
|
|
369
|
+
classPropertyName: "rendererValue",
|
|
370
|
+
publicName: "rendererValue",
|
|
371
|
+
isSignal: true,
|
|
372
|
+
isRequired: false,
|
|
373
|
+
transformFunction: null
|
|
374
|
+
},
|
|
375
|
+
item: {
|
|
376
|
+
classPropertyName: "item",
|
|
377
|
+
publicName: "item",
|
|
378
|
+
isSignal: true,
|
|
379
|
+
isRequired: false,
|
|
380
|
+
transformFunction: null
|
|
381
|
+
},
|
|
382
|
+
chips: {
|
|
383
|
+
classPropertyName: "chips",
|
|
384
|
+
publicName: "chips",
|
|
385
|
+
isSignal: true,
|
|
386
|
+
isRequired: false,
|
|
387
|
+
transformFunction: null
|
|
388
|
+
},
|
|
389
|
+
link: {
|
|
390
|
+
classPropertyName: "link",
|
|
391
|
+
publicName: "link",
|
|
392
|
+
isSignal: true,
|
|
393
|
+
isRequired: false,
|
|
394
|
+
transformFunction: null
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
ngImport: i0,
|
|
398
|
+
template: "@if (rendererComponent(); as rendererType) {\n <ng-container *ngComponentOutlet=\"rendererType; inputs: rendererInputs()\"></ng-container>\n} @else if (column().dataType === 'boolean') {\n <!-- [indeterminate] matters: without it a null boolean renders as an unchecked box, which reads\n as an explicit `false`. One of the three copies of this cell bound it and the others had\n drifted, so the same column said different things on a detail page and in a grid. -->\n <input type=\"checkbox\"\n [checked]=\"display() === true\"\n [indeterminate]=\"isUnsetBoolean()\"\n disabled\n onclick=\"return false;\">\n} @else if (column().dataType === 'date' || column().dataType === 'datetime') {\n <!--\n Formatted in ONE place for both grids. Before this, a date column printed whatever its pipe\n produced, which was the raw ISO string — `2026-09-07T13:25:57.3119825Z` in a table cell. Both\n cell pipes now hand over a real Date, and `date:` accepts a string too, so an unparseable value\n that fell back to text still renders as that text rather than blank.\n -->\n @if (dateValue(); as when) {\n {{ when | date:(column().dataType === 'date' ? 'mediumDate' : 'short') }}\n } @else {\n {{ display() }}\n }\n} @else if (column().dataType === 'color') {\n @if (display(); as colorVal) {\n <!-- Shares `.spark-color-swatch` with the detail page, which is where the sizing already\n lived. It used to be inline here because the grid rendered inside <mp-datatable>'s\n shadow root, where neither this component's scoped rules nor Bootstrap's arrived;\n ng-bootstrap 22.18.0 moved the datatable to the light DOM, so the class reaches it. -->\n <span class=\"spark-color-swatch d-inline-block align-middle border rounded\"\n [style.background-color]=\"colorVal\"></span>\n }\n} @else if (column().dataType === 'image') {\n @if (display(); as src) {\n <!-- `alt` is empty on purpose — the cell is decorative next to the row's own labelled\n columns, and a filename read aloud is worse than nothing. -->\n <img [src]=\"src\" alt=\"\" loading=\"lazy\" class=\"spark-grid-image align-middle rounded\">\n }\n} @else if (column().dataType === 'url') {\n @if (display(); as href) {\n <!-- rel is not optional with target=_blank: without noopener the opened page gets a handle on\n this one through window.opener, and these hrefs are data. -->\n <a [href]=\"href\" target=\"_blank\" rel=\"noopener noreferrer\">{{ href }}</a>\n }\n} @else if (chips().length) {\n <span class=\"d-inline-flex flex-wrap gap-1\">\n @for (chip of chips(); track chip.id) {\n <span class=\"spark-chip\">{{ chip.label }}</span>\n }\n </span>\n} @else if (link(); as route) {\n <a [routerLink]=\"route\">{{ display() }}</a>\n} @else {\n {{ display() }}\n}\n",
|
|
399
|
+
styles: [".spark-chip{display:inline-block;padding:.35em .9em;font-size:.8125em;font-weight:600;line-height:1.4;white-space:nowrap;text-align:center;vertical-align:baseline;color:var(--bs-body-color);background-color:var(--bs-secondary-bg);border:1px solid var(--bs-border-color);border-radius:50rem;text-decoration:none}a.spark-chip:hover,a.spark-chip:focus-visible{background-color:var(--bs-tertiary-bg)}.spark-color-swatch{width:1.5em;height:1.5em}.spark-grid-image{max-height:2.5em;max-width:100%;object-fit:contain}\n"],
|
|
400
|
+
dependencies: [
|
|
401
|
+
{
|
|
402
|
+
kind: "ngmodule",
|
|
403
|
+
type: CommonModule
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
kind: "directive",
|
|
407
|
+
type: i1$1.NgComponentOutlet,
|
|
408
|
+
selector: "[ngComponentOutlet]",
|
|
409
|
+
inputs: [
|
|
410
|
+
"ngComponentOutlet",
|
|
411
|
+
"ngComponentOutletInputs",
|
|
412
|
+
"ngComponentOutletInjector",
|
|
413
|
+
"ngComponentOutletEnvironmentInjector",
|
|
414
|
+
"ngComponentOutletContent",
|
|
415
|
+
"ngComponentOutletNgModule"
|
|
416
|
+
],
|
|
417
|
+
exportAs: ["ngComponentOutlet"]
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
kind: "ngmodule",
|
|
421
|
+
type: RouterModule
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
kind: "directive",
|
|
425
|
+
type: i2.RouterLink,
|
|
426
|
+
selector: "[routerLink]",
|
|
427
|
+
inputs: [
|
|
428
|
+
"target",
|
|
429
|
+
"queryParams",
|
|
430
|
+
"fragment",
|
|
431
|
+
"queryParamsHandling",
|
|
432
|
+
"state",
|
|
433
|
+
"info",
|
|
434
|
+
"relativeTo",
|
|
435
|
+
"preserveFragment",
|
|
436
|
+
"skipLocationChange",
|
|
437
|
+
"replaceUrl",
|
|
438
|
+
"browserUrl",
|
|
439
|
+
"routerLink"
|
|
440
|
+
]
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
kind: "pipe",
|
|
444
|
+
type: i1$1.DatePipe,
|
|
445
|
+
name: "date"
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
452
|
+
minVersion: "12.0.0",
|
|
453
|
+
version: "22.2.0",
|
|
454
|
+
ngImport: i0,
|
|
455
|
+
type: SparkGridCellComponent,
|
|
456
|
+
decorators: [{
|
|
457
|
+
type: Component,
|
|
458
|
+
args: [{
|
|
459
|
+
selector: "spark-grid-cell",
|
|
460
|
+
imports: [
|
|
461
|
+
CommonModule,
|
|
462
|
+
NgComponentOutlet,
|
|
463
|
+
RouterModule
|
|
464
|
+
],
|
|
465
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
466
|
+
template: "@if (rendererComponent(); as rendererType) {\n <ng-container *ngComponentOutlet=\"rendererType; inputs: rendererInputs()\"></ng-container>\n} @else if (column().dataType === 'boolean') {\n <!-- [indeterminate] matters: without it a null boolean renders as an unchecked box, which reads\n as an explicit `false`. One of the three copies of this cell bound it and the others had\n drifted, so the same column said different things on a detail page and in a grid. -->\n <input type=\"checkbox\"\n [checked]=\"display() === true\"\n [indeterminate]=\"isUnsetBoolean()\"\n disabled\n onclick=\"return false;\">\n} @else if (column().dataType === 'date' || column().dataType === 'datetime') {\n <!--\n Formatted in ONE place for both grids. Before this, a date column printed whatever its pipe\n produced, which was the raw ISO string — `2026-09-07T13:25:57.3119825Z` in a table cell. Both\n cell pipes now hand over a real Date, and `date:` accepts a string too, so an unparseable value\n that fell back to text still renders as that text rather than blank.\n -->\n @if (dateValue(); as when) {\n {{ when | date:(column().dataType === 'date' ? 'mediumDate' : 'short') }}\n } @else {\n {{ display() }}\n }\n} @else if (column().dataType === 'color') {\n @if (display(); as colorVal) {\n <!-- Shares `.spark-color-swatch` with the detail page, which is where the sizing already\n lived. It used to be inline here because the grid rendered inside <mp-datatable>'s\n shadow root, where neither this component's scoped rules nor Bootstrap's arrived;\n ng-bootstrap 22.18.0 moved the datatable to the light DOM, so the class reaches it. -->\n <span class=\"spark-color-swatch d-inline-block align-middle border rounded\"\n [style.background-color]=\"colorVal\"></span>\n }\n} @else if (column().dataType === 'image') {\n @if (display(); as src) {\n <!-- `alt` is empty on purpose — the cell is decorative next to the row's own labelled\n columns, and a filename read aloud is worse than nothing. -->\n <img [src]=\"src\" alt=\"\" loading=\"lazy\" class=\"spark-grid-image align-middle rounded\">\n }\n} @else if (column().dataType === 'url') {\n @if (display(); as href) {\n <!-- rel is not optional with target=_blank: without noopener the opened page gets a handle on\n this one through window.opener, and these hrefs are data. -->\n <a [href]=\"href\" target=\"_blank\" rel=\"noopener noreferrer\">{{ href }}</a>\n }\n} @else if (chips().length) {\n <span class=\"d-inline-flex flex-wrap gap-1\">\n @for (chip of chips(); track chip.id) {\n <span class=\"spark-chip\">{{ chip.label }}</span>\n }\n </span>\n} @else if (link(); as route) {\n <a [routerLink]=\"route\">{{ display() }}</a>\n} @else {\n {{ display() }}\n}\n",
|
|
467
|
+
styles: [".spark-chip{display:inline-block;padding:.35em .9em;font-size:.8125em;font-weight:600;line-height:1.4;white-space:nowrap;text-align:center;vertical-align:baseline;color:var(--bs-body-color);background-color:var(--bs-secondary-bg);border:1px solid var(--bs-border-color);border-radius:50rem;text-decoration:none}a.spark-chip:hover,a.spark-chip:focus-visible{background-color:var(--bs-tertiary-bg)}.spark-color-swatch{width:1.5em;height:1.5em}.spark-grid-image{max-height:2.5em;max-width:100%;object-fit:contain}\n"]
|
|
468
|
+
}]
|
|
469
|
+
}],
|
|
470
|
+
propDecorators: {
|
|
471
|
+
column: [{
|
|
472
|
+
type: i0.Input,
|
|
473
|
+
args: [{
|
|
474
|
+
isSignal: true,
|
|
475
|
+
alias: "column",
|
|
476
|
+
required: true
|
|
477
|
+
}]
|
|
478
|
+
}],
|
|
479
|
+
display: [{
|
|
480
|
+
type: i0.Input,
|
|
481
|
+
args: [{
|
|
482
|
+
isSignal: true,
|
|
483
|
+
alias: "display",
|
|
484
|
+
required: false
|
|
485
|
+
}]
|
|
486
|
+
}],
|
|
487
|
+
rendererValue: [{
|
|
488
|
+
type: i0.Input,
|
|
489
|
+
args: [{
|
|
490
|
+
isSignal: true,
|
|
491
|
+
alias: "rendererValue",
|
|
492
|
+
required: false
|
|
493
|
+
}]
|
|
494
|
+
}],
|
|
495
|
+
item: [{
|
|
496
|
+
type: i0.Input,
|
|
497
|
+
args: [{
|
|
498
|
+
isSignal: true,
|
|
499
|
+
alias: "item",
|
|
500
|
+
required: false
|
|
501
|
+
}]
|
|
502
|
+
}],
|
|
503
|
+
chips: [{
|
|
504
|
+
type: i0.Input,
|
|
505
|
+
args: [{
|
|
506
|
+
isSignal: true,
|
|
507
|
+
alias: "chips",
|
|
508
|
+
required: false
|
|
509
|
+
}]
|
|
510
|
+
}],
|
|
511
|
+
link: [{
|
|
512
|
+
type: i0.Input,
|
|
513
|
+
args: [{
|
|
514
|
+
isSignal: true,
|
|
515
|
+
alias: "link",
|
|
516
|
+
required: false
|
|
517
|
+
}]
|
|
518
|
+
}]
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
var SparkQueryGridComponent = class SparkQueryGridComponent {
|
|
522
|
+
sparkService = inject(SparkService);
|
|
523
|
+
gridRenderers = inject(SparkGridRenderers);
|
|
524
|
+
queryRefresh = inject(SparkQueryRefreshService);
|
|
525
|
+
injector = inject(Injector);
|
|
526
|
+
addonRowActions = orderSparkExtensions(inject(SPARK_QUERY_ROW_ACTIONS, { optional: true }), (a) => a.priority ?? 50);
|
|
527
|
+
lang = inject(SparkLanguageService);
|
|
528
|
+
queryId = input.required(...ngDevMode ? [{ debugName: "queryId" }] : /* istanbul ignore next */ []);
|
|
529
|
+
parentId = input("", ...ngDevMode ? [{ debugName: "parentId" }] : /* istanbul ignore next */ []);
|
|
530
|
+
parentType = input("", ...ngDevMode ? [{ debugName: "parentType" }] : /* istanbul ignore next */ []);
|
|
531
|
+
presetFilters = input([], ...ngDevMode ? [{ debugName: "presetFilters" }] : /* istanbul ignore next */ []);
|
|
532
|
+
appliedPresetFilters = signal([], ...ngDevMode ? [{ debugName: "appliedPresetFilters" }] : /* istanbul ignore next */ []);
|
|
533
|
+
data = input(null, ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
534
|
+
search = input("", ...ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []);
|
|
535
|
+
columns = input(null, ...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
|
|
536
|
+
reloadToken = input(null, ...ngDevMode ? [{ debugName: "reloadToken" }] : /* istanbul ignore next */ []);
|
|
537
|
+
deleted = input(null, ...ngDevMode ? [{ debugName: "deleted" }] : /* istanbul ignore next */ []);
|
|
538
|
+
effectiveDeleted = computed(() => {
|
|
539
|
+
const mode = this.deleted();
|
|
540
|
+
return mode && mode !== "exclude" ? mode : void 0;
|
|
541
|
+
}, ...ngDevMode ? [{ debugName: "effectiveDeleted" }] : /* istanbul ignore next */ []);
|
|
542
|
+
parentDeleted = input(false, ...ngDevMode ? [{ debugName: "parentDeleted" }] : /* istanbul ignore next */ []);
|
|
543
|
+
recycleBin = computed(() => this.effectiveDeleted() === "only" || this.parentDeleted(), ...ngDevMode ? [{ debugName: "recycleBin" }] : /* istanbul ignore next */ []);
|
|
544
|
+
rowQueryParams = computed(() => {
|
|
545
|
+
const mode = this.effectiveDeleted();
|
|
546
|
+
return mode ? { deleted: mode } : null;
|
|
547
|
+
}, ...ngDevMode ? [{ debugName: "rowQueryParams" }] : /* istanbul ignore next */ []);
|
|
548
|
+
router = inject(Router);
|
|
549
|
+
currentUrl = toSignal(this.router.events.pipe(filter((e) => e instanceof NavigationEnd), map(() => this.router.url)), { initialValue: this.router.url });
|
|
550
|
+
rowLinkState = computed(() => ({ [SPARK_RETURN_URL_STATE_KEY]: this.currentUrl() }), ...ngDevMode ? [{ debugName: "rowLinkState" }] : /* istanbul ignore next */ []);
|
|
551
|
+
onRowClick(event) {
|
|
552
|
+
if (this.selectionMode() === "none") this.openRow(event);
|
|
553
|
+
}
|
|
554
|
+
onRowDblClick(event) {
|
|
555
|
+
if (this.selectionMode() !== "none") this.openRow(event);
|
|
556
|
+
}
|
|
557
|
+
openRow(event) {
|
|
558
|
+
const row = event.row;
|
|
559
|
+
const original = event.originalEvent;
|
|
560
|
+
if ((original?.target)?.closest?.("a, button, input, select, textarea, label, [role=\"button\"]")) return;
|
|
561
|
+
if (original && (original.ctrlKey || original.metaKey || original.shiftKey || original.button === 1)) return;
|
|
562
|
+
if (!row || !this.canRead()) return;
|
|
563
|
+
const route = this.rowRouteFor(row);
|
|
564
|
+
if (!route) return;
|
|
565
|
+
this.rowClicked.emit(row);
|
|
566
|
+
this.router.navigate(route, {
|
|
567
|
+
queryParams: this.rowQueryParams() ?? void 0,
|
|
568
|
+
state: this.rowLinkState()
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
settings = model(new DatatableSettings({
|
|
572
|
+
perPage: {
|
|
573
|
+
values: SPARK_GRID_PAGE_SIZES,
|
|
574
|
+
selected: SPARK_GRID_PAGE_SIZES[0]
|
|
575
|
+
},
|
|
576
|
+
page: {
|
|
577
|
+
values: [1],
|
|
578
|
+
selected: 1
|
|
579
|
+
},
|
|
580
|
+
sortColumns: []
|
|
581
|
+
}), ...ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []);
|
|
582
|
+
selection = model([], ...ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []);
|
|
583
|
+
rowRoute = input(null, ...ngDevMode ? [{ debugName: "rowRoute" }] : /* istanbul ignore next */ []);
|
|
584
|
+
selectionModeSetting = input(null, ...ngDevMode ? [{ debugName: "selectionModeSetting" }] : /* istanbul ignore next */ []);
|
|
585
|
+
error = output();
|
|
586
|
+
rowClicked = output();
|
|
587
|
+
customActionExecuted = output();
|
|
588
|
+
createClicked = output();
|
|
589
|
+
colors = Color;
|
|
590
|
+
rowRouteFor(row) {
|
|
591
|
+
const custom = this.rowRoute();
|
|
592
|
+
if (custom) return custom(row);
|
|
593
|
+
const type = this.entityType();
|
|
594
|
+
if (!type?.clrType) return null;
|
|
595
|
+
return [
|
|
596
|
+
"/po",
|
|
597
|
+
type.alias || type.id,
|
|
598
|
+
row.id
|
|
599
|
+
];
|
|
600
|
+
}
|
|
601
|
+
query = signal(null, ...ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []);
|
|
602
|
+
entityType = signal(null, ...ngDevMode ? [{ debugName: "entityType" }] : /* istanbul ignore next */ []);
|
|
603
|
+
allEntityTypes = signal([], ...ngDevMode ? [{ debugName: "allEntityTypes" }] : /* istanbul ignore next */ []);
|
|
604
|
+
lookupReferenceOptions = signal({}, ...ngDevMode ? [{ debugName: "lookupReferenceOptions" }] : /* istanbul ignore next */ []);
|
|
605
|
+
loading = signal(true, ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
|
|
606
|
+
canRead = signal(false, ...ngDevMode ? [{ debugName: "canRead" }] : /* istanbul ignore next */ []);
|
|
607
|
+
canCreate = signal(false, ...ngDevMode ? [{ debugName: "canCreate" }] : /* istanbul ignore next */ []);
|
|
608
|
+
permissions = signal(null, ...ngDevMode ? [{ debugName: "permissions" }] : /* istanbul ignore next */ []);
|
|
609
|
+
resultCount = signal(null, ...ngDevMode ? [{ debugName: "resultCount" }] : /* istanbul ignore next */ []);
|
|
610
|
+
customActions = signal([], ...ngDevMode ? [{ debugName: "customActions" }] : /* istanbul ignore next */ []);
|
|
611
|
+
defaultActions = signal([], ...ngDevMode ? [{ debugName: "defaultActions" }] : /* istanbul ignore next */ []);
|
|
612
|
+
disabledActions = signal([], ...ngDevMode ? [{ debugName: "disabledActions" }] : /* istanbul ignore next */ []);
|
|
613
|
+
offersCreate = computed(() => {
|
|
614
|
+
if (!this.canCreate() || this.recycleBin()) return false;
|
|
615
|
+
const withheld = this.disabledActions().map((name) => name.toLowerCase());
|
|
616
|
+
return !withheld.includes("new") && !withheld.includes("save");
|
|
617
|
+
}, ...ngDevMode ? [{ debugName: "offersCreate" }] : /* istanbul ignore next */ []);
|
|
618
|
+
visibleCustomActions = computed(() => {
|
|
619
|
+
if (this.recycleBin()) return [];
|
|
620
|
+
const withheld = this.disabledActions();
|
|
621
|
+
if (!withheld.length) return this.customActions();
|
|
622
|
+
const lowered = new Set(withheld.map((name) => name.toLowerCase()));
|
|
623
|
+
return this.customActions().filter((action) => !lowered.has(action.name.toLowerCase()));
|
|
624
|
+
}, ...ngDevMode ? [{ debugName: "visibleCustomActions" }] : /* istanbul ignore next */ []);
|
|
625
|
+
fetchFn = signal(null, ...ngDevMode ? [{ debugName: "fetchFn" }] : /* istanbul ignore next */ []);
|
|
626
|
+
errorMessage = signal(null, ...ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []);
|
|
627
|
+
selectionMode = computed(() => selectionModeFor(this.visibleCustomActions(), this.selectionModeSetting() ?? this.query()?.selectionMode ?? "auto"), ...ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []);
|
|
628
|
+
toolbarActions = computed(() => {
|
|
629
|
+
const actions = [];
|
|
630
|
+
const withheld = new Set(this.disabledActions().map((name) => name.toLowerCase()));
|
|
631
|
+
for (const definition of this.defaultActions()) {
|
|
632
|
+
const name = definition.name.toLowerCase();
|
|
633
|
+
if (name === "new" && this.offersCreate()) actions.push({
|
|
634
|
+
kind: "new",
|
|
635
|
+
name: definition.name,
|
|
636
|
+
definition,
|
|
637
|
+
priority: 1 + definition.offset
|
|
638
|
+
});
|
|
639
|
+
else if (name === "delete" && this.offersDelete(withheld) && this.selectionMode() !== "none") actions.push({
|
|
640
|
+
kind: "delete",
|
|
641
|
+
name: definition.name,
|
|
642
|
+
definition,
|
|
643
|
+
priority: 5 + definition.offset
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
for (const definition of this.visibleCustomActions()) actions.push({
|
|
647
|
+
kind: "custom",
|
|
648
|
+
name: definition.name,
|
|
649
|
+
definition,
|
|
650
|
+
priority: 10 + definition.offset
|
|
651
|
+
});
|
|
652
|
+
return actions;
|
|
653
|
+
}, ...ngDevMode ? [{ debugName: "toolbarActions" }] : /* istanbul ignore next */ []);
|
|
654
|
+
rowActions = computed(() => {
|
|
655
|
+
const withheld = new Set(this.disabledActions().map((name) => name.toLowerCase()));
|
|
656
|
+
const rowTaking = (definition) => !!definition.selectionRule?.trim() && parseSelectionRule(definition.selectionRule)(1);
|
|
657
|
+
const actions = [];
|
|
658
|
+
for (const definition of this.defaultActions()) if (definition.name.toLowerCase() === "delete" && this.offersDelete(withheld) && rowTaking(definition)) actions.push({
|
|
659
|
+
kind: "delete",
|
|
660
|
+
name: definition.name,
|
|
661
|
+
definition,
|
|
662
|
+
priority: 5 + definition.offset
|
|
663
|
+
});
|
|
664
|
+
for (const definition of this.visibleCustomActions()) if (rowTaking(definition)) actions.push({
|
|
665
|
+
kind: "custom",
|
|
666
|
+
name: definition.name,
|
|
667
|
+
definition,
|
|
668
|
+
priority: 10 + definition.offset
|
|
669
|
+
});
|
|
670
|
+
const scope = this.rowActionScope();
|
|
671
|
+
if (scope) for (const addon of this.addonRowActions) {
|
|
672
|
+
if (!addon.isOffered(scope)) continue;
|
|
673
|
+
const priority = addon.priority ?? 50;
|
|
674
|
+
actions.push({
|
|
675
|
+
kind: "addon",
|
|
676
|
+
name: addon.id,
|
|
677
|
+
addon,
|
|
678
|
+
priority,
|
|
679
|
+
definition: {
|
|
680
|
+
name: addon.id,
|
|
681
|
+
displayName: { en: this.lang.t(addon.labelKey) },
|
|
682
|
+
showedOn: "query",
|
|
683
|
+
refreshOnCompleted: true,
|
|
684
|
+
offset: priority
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
return actions;
|
|
689
|
+
}, ...ngDevMode ? [{ debugName: "rowActions" }] : /* istanbul ignore next */ []);
|
|
690
|
+
rowActionScope = computed(() => {
|
|
691
|
+
const query = this.query();
|
|
692
|
+
const entityType = this.entityType();
|
|
693
|
+
if (!query || !entityType) return null;
|
|
694
|
+
return {
|
|
695
|
+
query,
|
|
696
|
+
entityType,
|
|
697
|
+
permissions: this.permissions(),
|
|
698
|
+
deleted: this.effectiveDeleted() ?? null
|
|
699
|
+
};
|
|
700
|
+
}, ...ngDevMode ? [{ debugName: "rowActionScope" }] : /* istanbul ignore next */ []);
|
|
701
|
+
offersDelete(withheld) {
|
|
702
|
+
return !this.recycleBin() && !withheld.has("delete");
|
|
703
|
+
}
|
|
704
|
+
isToolbarActionEnabled(action) {
|
|
705
|
+
return this.isActionEnabled(action.definition);
|
|
706
|
+
}
|
|
707
|
+
async runToolbarAction(action) {
|
|
708
|
+
switch (action.kind) {
|
|
709
|
+
case "new":
|
|
710
|
+
this.startNew();
|
|
711
|
+
return;
|
|
712
|
+
case "delete":
|
|
713
|
+
await this.deleteRows(this.selection().map((r) => r.id), action.definition);
|
|
714
|
+
return;
|
|
715
|
+
default: await this.onCustomAction(action.definition);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
clearSelection() {
|
|
719
|
+
this.selection.set([]);
|
|
720
|
+
}
|
|
721
|
+
openRowMenu = signal(null, ...ngDevMode ? [{ debugName: "openRowMenu" }] : /* istanbul ignore next */ []);
|
|
722
|
+
rowMenuPositions = [{
|
|
723
|
+
originX: "end",
|
|
724
|
+
originY: "bottom",
|
|
725
|
+
overlayX: "end",
|
|
726
|
+
overlayY: "top"
|
|
727
|
+
}, {
|
|
728
|
+
originX: "end",
|
|
729
|
+
originY: "top",
|
|
730
|
+
overlayX: "end",
|
|
731
|
+
overlayY: "bottom"
|
|
732
|
+
}];
|
|
733
|
+
toggleRowMenu(row) {
|
|
734
|
+
this.openRowMenu.update((open) => open === row.id ? null : row.id);
|
|
735
|
+
}
|
|
736
|
+
closeRowMenu(rowId) {
|
|
737
|
+
if (rowId !== void 0 && this.openRowMenu() !== rowId) return;
|
|
738
|
+
this.openRowMenu.set(null);
|
|
739
|
+
}
|
|
740
|
+
onRowMenuOutsideClick(event, toggle, rowId) {
|
|
741
|
+
if (event.target instanceof Node && toggle.contains(event.target)) return;
|
|
742
|
+
this.closeRowMenu(rowId);
|
|
743
|
+
}
|
|
744
|
+
async chooseRowAction(action, row) {
|
|
745
|
+
this.closeRowMenu();
|
|
746
|
+
await this.runRowAction(action, row);
|
|
747
|
+
}
|
|
748
|
+
async runRowAction(action, row) {
|
|
749
|
+
if (action.kind === "delete") {
|
|
750
|
+
await this.deleteRows([row.id], action.definition);
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
if (action.kind === "addon" && action.addon) {
|
|
754
|
+
await this.runAddonRowAction(action.addon, row);
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
await this.onCustomAction(action.definition, [row.id]);
|
|
758
|
+
}
|
|
759
|
+
async runAddonRowAction(addon, row) {
|
|
760
|
+
const scope = this.rowActionScope();
|
|
761
|
+
if (!scope) return;
|
|
762
|
+
try {
|
|
763
|
+
this.errorMessage.set(null);
|
|
764
|
+
await runInInjectionContext(this.injector, () => addon.run({
|
|
765
|
+
...scope,
|
|
766
|
+
row,
|
|
767
|
+
reload: () => this.reload()
|
|
768
|
+
}));
|
|
769
|
+
} catch (e) {
|
|
770
|
+
const err = e;
|
|
771
|
+
const first = err?.error?.result?.errors?.[0];
|
|
772
|
+
const validation = typeof first?.errorMessage === "string" ? first.errorMessage : first?.errorMessage ? this.lang.resolve(first.errorMessage) : "";
|
|
773
|
+
this.errorMessage.set(validation || first?.message || err?.error?.result?.error || err?.error?.error || (err?.status === 404 ? this.lang.t("spark.query.unavailable") : "") || err?.message || this.lang.t("common.actionFailed") || "Action failed");
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
startNew() {
|
|
777
|
+
const type = this.entityType();
|
|
778
|
+
if (!type) return;
|
|
779
|
+
this.createClicked.emit();
|
|
780
|
+
const parentId = this.parentId();
|
|
781
|
+
const parentType = this.parentType();
|
|
782
|
+
const query = this.query();
|
|
783
|
+
const queryParams = parentId && parentType && query ? {
|
|
784
|
+
parentId,
|
|
785
|
+
parentType,
|
|
786
|
+
queryId: query.alias || query.id
|
|
787
|
+
} : void 0;
|
|
788
|
+
this.router.navigate([
|
|
789
|
+
"/po",
|
|
790
|
+
type.alias || type.id,
|
|
791
|
+
"new"
|
|
792
|
+
], {
|
|
793
|
+
queryParams,
|
|
794
|
+
state: this.rowLinkState()
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
async deleteRows(ids, definition) {
|
|
798
|
+
const type = this.entityType();
|
|
799
|
+
if (!type || !ids.length) return;
|
|
800
|
+
const key = definition?.confirmationMessageKey;
|
|
801
|
+
const message = ids.length === 1 ? this.lang.t("common.confirmDelete") : (key ? this.lang.t(key) : "") || this.lang.t("common.confirmDeleteSelected");
|
|
802
|
+
if (!confirm(`${message || "Are you sure?"}${ids.length > 1 ? ` (${ids.length})` : ""}`)) return;
|
|
803
|
+
const parentId = this.parentId();
|
|
804
|
+
const parentType = this.parentType();
|
|
805
|
+
try {
|
|
806
|
+
await this.sparkService.deleteMany(type.id, ids, {
|
|
807
|
+
queryId: this.query()?.id,
|
|
808
|
+
...parentId && parentType ? {
|
|
809
|
+
parentId,
|
|
810
|
+
parentType
|
|
811
|
+
} : {}
|
|
812
|
+
});
|
|
813
|
+
const removed = new Set(ids);
|
|
814
|
+
this.selection.set(this.selection().filter((r) => !removed.has(r.id)));
|
|
815
|
+
this.reload();
|
|
816
|
+
} catch (e) {
|
|
817
|
+
const err = e;
|
|
818
|
+
this.errorMessage.set(err.error?.result?.errors?.[0]?.message || err.error?.result?.error || err.error?.error || (err.status === 404 ? this.lang.t("common.deleteRefused") : "") || err.message || this.lang.t("common.actionFailed") || "Action failed");
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
isVirtualScrolling = computed(() => isVirtualScrollingQuery(this.query()), ...ngDevMode ? [{ debugName: "isVirtualScrolling" }] : /* istanbul ignore next */ []);
|
|
822
|
+
fetchedColumns = signal([], ...ngDevMode ? [{ debugName: "fetchedColumns" }] : /* istanbul ignore next */ []);
|
|
823
|
+
allColumns = computed(() => this.columns() ?? this.fetchedColumns(), ...ngDevMode ? [{ debugName: "allColumns" }] : /* istanbul ignore next */ []);
|
|
824
|
+
visibleColumns = computed(() => this.allColumns().filter((c) => c.isVisible !== false), ...ngDevMode ? [{ debugName: "visibleColumns" }] : /* istanbul ignore next */ []);
|
|
825
|
+
hasExternalData = computed(() => this.data() !== null || this.query()?.isStreamingQuery === true, ...ngDevMode ? [{ debugName: "hasExternalData" }] : /* istanbul ignore next */ []);
|
|
826
|
+
isActionEnabled(action) {
|
|
827
|
+
return parseSelectionRule(action.selectionRule)(this.selection().map((r) => r.id).length);
|
|
828
|
+
}
|
|
829
|
+
constructor() {
|
|
830
|
+
effect(() => {
|
|
831
|
+
const qId = this.queryId();
|
|
832
|
+
const pId = this.parentId();
|
|
833
|
+
const pType = this.parentType();
|
|
834
|
+
if (qId) this.loadData(qId, pId, pType);
|
|
835
|
+
else this.loading.set(false);
|
|
836
|
+
});
|
|
837
|
+
let first = true;
|
|
838
|
+
effect(() => {
|
|
839
|
+
this.reloadToken();
|
|
840
|
+
this.queryRefresh.tokenFor(this.queryId());
|
|
841
|
+
if (first) {
|
|
842
|
+
first = false;
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
untracked(() => this.reload());
|
|
846
|
+
});
|
|
847
|
+
let firstSearch = true;
|
|
848
|
+
effect(() => {
|
|
849
|
+
this.search();
|
|
850
|
+
if (firstSearch) {
|
|
851
|
+
firstSearch = false;
|
|
852
|
+
return;
|
|
853
|
+
}
|
|
854
|
+
untracked(() => {
|
|
855
|
+
this.selection.set([]);
|
|
856
|
+
this.onSearchChanged();
|
|
857
|
+
});
|
|
858
|
+
});
|
|
859
|
+
let firstPreset = true;
|
|
860
|
+
effect(() => {
|
|
861
|
+
const presetFilters = this.presetFilters();
|
|
862
|
+
if (firstPreset) {
|
|
863
|
+
firstPreset = false;
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
untracked(() => {
|
|
867
|
+
const next = applicablePresetFilters(presetFilters, this.entityType());
|
|
868
|
+
const previous = new Set(this.appliedPresetFilters().map((f) => f.name));
|
|
869
|
+
const replaced = new Set(next.map((f) => f.name));
|
|
870
|
+
this.appliedPresetFilters.set(next);
|
|
871
|
+
this.filters.set([...this.filters().filter((f) => !previous.has(f.name) && !replaced.has(f.name)), ...next]);
|
|
872
|
+
this.selection.set([]);
|
|
873
|
+
this.onFilterChanged();
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
let firstDeleted = true;
|
|
877
|
+
effect(() => {
|
|
878
|
+
this.effectiveDeleted();
|
|
879
|
+
if (firstDeleted) {
|
|
880
|
+
firstDeleted = false;
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
untracked(() => {
|
|
884
|
+
this.selection.set([]);
|
|
885
|
+
this.onFilterChanged();
|
|
886
|
+
});
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
reload() {
|
|
890
|
+
if (this.hasExternalData()) return;
|
|
891
|
+
const q = this.query();
|
|
892
|
+
if (q) this.fetchFn.set(this.makeFetch(q, this.parentId(), this.parentType()));
|
|
893
|
+
}
|
|
894
|
+
onSearchChanged() {
|
|
895
|
+
if (this.hasExternalData()) return;
|
|
896
|
+
const s = this.settings();
|
|
897
|
+
this.settings.set(new DatatableSettings({
|
|
898
|
+
perPage: {
|
|
899
|
+
values: s.perPage.values,
|
|
900
|
+
selected: s.perPage.selected
|
|
901
|
+
},
|
|
902
|
+
page: {
|
|
903
|
+
values: [1],
|
|
904
|
+
selected: 1
|
|
905
|
+
},
|
|
906
|
+
sortColumns: s.sortColumns
|
|
907
|
+
}));
|
|
908
|
+
this.reload();
|
|
909
|
+
}
|
|
910
|
+
setFetchedColumns(columns) {
|
|
911
|
+
const current = this.fetchedColumns();
|
|
912
|
+
if (current.length === columns.length && JSON.stringify(current) === JSON.stringify(columns)) return;
|
|
913
|
+
this.fetchedColumns.set(columns);
|
|
914
|
+
}
|
|
915
|
+
filters = signal([], ...ngDevMode ? [{ debugName: "filters" }] : /* istanbul ignore next */ []);
|
|
916
|
+
completeDistincts = /* @__PURE__ */ new Map();
|
|
917
|
+
distinctsFn = async (request) => {
|
|
918
|
+
const queryId = this.query()?.id;
|
|
919
|
+
if (!queryId) return null;
|
|
920
|
+
const others = this.filters().filter((f) => f.name !== request.column);
|
|
921
|
+
const querySearch = this.search() || void 0;
|
|
922
|
+
const parentId = this.parentId();
|
|
923
|
+
const parentType = this.parentType();
|
|
924
|
+
const result = await this.sparkService.getDistinctValues(queryId, request.column, {
|
|
925
|
+
search: request.search,
|
|
926
|
+
querySearch,
|
|
927
|
+
columns: others,
|
|
928
|
+
parentId,
|
|
929
|
+
parentType,
|
|
930
|
+
deleted: this.effectiveDeleted(),
|
|
931
|
+
parentDeleted: this.parentDeleted() && parentId && parentType ? "include" : void 0
|
|
932
|
+
});
|
|
933
|
+
if (result && !result.hasMore && !request.search && !querySearch) this.completeDistincts.set(request.column, result.matching.map((v) => v.value));
|
|
934
|
+
else this.completeDistincts.delete(request.column);
|
|
935
|
+
return result;
|
|
936
|
+
};
|
|
937
|
+
onFilterChange(detail) {
|
|
938
|
+
if (detail.mode !== "values") return;
|
|
939
|
+
const values = detail.selected.map((v) => v.value);
|
|
940
|
+
const next = this.filters().filter((f) => f.name !== detail.column);
|
|
941
|
+
if (values.length > 0) {
|
|
942
|
+
const complete = this.completeDistincts.get(detail.column);
|
|
943
|
+
if (values.some((v) => v === null || v === void 0) && !detail.inverse && complete) {
|
|
944
|
+
const unselected = complete.filter((v) => v !== null && v !== void 0 && !values.some((s) => s === v));
|
|
945
|
+
if (unselected.length > 0) next.push({
|
|
946
|
+
name: detail.column,
|
|
947
|
+
excludes: unselected
|
|
948
|
+
});
|
|
949
|
+
} else next.push(detail.inverse ? {
|
|
950
|
+
name: detail.column,
|
|
951
|
+
excludes: values
|
|
952
|
+
} : {
|
|
953
|
+
name: detail.column,
|
|
954
|
+
includes: values
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
this.filters.set(next);
|
|
958
|
+
this.onFilterChanged();
|
|
959
|
+
}
|
|
960
|
+
onFilterChanged() {
|
|
961
|
+
if (this.hasExternalData()) return;
|
|
962
|
+
const s = this.settings();
|
|
963
|
+
this.settings.set(new DatatableSettings({
|
|
964
|
+
perPage: {
|
|
965
|
+
values: s.perPage.values,
|
|
966
|
+
selected: s.perPage.selected
|
|
967
|
+
},
|
|
968
|
+
page: {
|
|
969
|
+
values: [1],
|
|
970
|
+
selected: 1
|
|
971
|
+
},
|
|
972
|
+
sortColumns: s.sortColumns
|
|
973
|
+
}));
|
|
974
|
+
this.reload();
|
|
975
|
+
}
|
|
976
|
+
async onCustomAction(action, rowIds) {
|
|
977
|
+
if (action.confirmationMessageKey) {
|
|
978
|
+
const message = this.lang.t(action.confirmationMessageKey) || "Are you sure?";
|
|
979
|
+
if (!confirm(message)) return;
|
|
980
|
+
}
|
|
981
|
+
try {
|
|
982
|
+
const pId = this.parentId();
|
|
983
|
+
const pType = this.parentType();
|
|
984
|
+
await this.sparkService.executeCustomAction(this.entityType().id, action.name, void 0, rowIds ?? this.selection().map((r) => r.id), pId && pType ? {
|
|
985
|
+
id: pId,
|
|
986
|
+
type: pType
|
|
987
|
+
} : void 0, this.query()?.id);
|
|
988
|
+
this.customActionExecuted.emit({ action });
|
|
989
|
+
if (action.refreshOnCompleted) this.reload();
|
|
990
|
+
} catch (e) {
|
|
991
|
+
const err = e;
|
|
992
|
+
this.errorMessage.set(err.error?.error || err.message || this.lang.t("common.actionFailed") || "Action failed");
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
reportError(err) {
|
|
996
|
+
this.errorMessage.set(this.describe(err));
|
|
997
|
+
this.error.emit(err);
|
|
998
|
+
}
|
|
999
|
+
describe(err) {
|
|
1000
|
+
if (err?.status === 404) return this.lang.t("spark.query.unavailable") || "This list is not available.";
|
|
1001
|
+
return err?.error?.error || err?.message || this.lang.t("common.unexpectedError") || "An unexpected error occurred";
|
|
1002
|
+
}
|
|
1003
|
+
async loadData(queryId, parentId, parentType) {
|
|
1004
|
+
this.loading.set(true);
|
|
1005
|
+
this.errorMessage.set(null);
|
|
1006
|
+
this.fetchFn.set(null);
|
|
1007
|
+
this.query.set(null);
|
|
1008
|
+
this.entityType.set(null);
|
|
1009
|
+
this.canRead.set(false);
|
|
1010
|
+
this.canCreate.set(false);
|
|
1011
|
+
this.permissions.set(null);
|
|
1012
|
+
this.customActions.set([]);
|
|
1013
|
+
this.defaultActions.set([]);
|
|
1014
|
+
this.resultCount.set(null);
|
|
1015
|
+
this.selection.set([]);
|
|
1016
|
+
this.filters.set([]);
|
|
1017
|
+
this.fetchedColumns.set([]);
|
|
1018
|
+
try {
|
|
1019
|
+
const [resolvedQuery, entityTypes] = await Promise.all([this.sparkService.getQuery(queryId), this.sparkService.getEntityTypes()]);
|
|
1020
|
+
this.query.set(resolvedQuery);
|
|
1021
|
+
this.allEntityTypes.set(entityTypes);
|
|
1022
|
+
const et = this.resolveEntityType(resolvedQuery, entityTypes);
|
|
1023
|
+
this.entityType.set(et);
|
|
1024
|
+
const preset = applicablePresetFilters(untracked(() => this.presetFilters()), et);
|
|
1025
|
+
this.appliedPresetFilters.set(preset);
|
|
1026
|
+
this.filters.set([...preset]);
|
|
1027
|
+
if (et) {
|
|
1028
|
+
const [permissions, actions] = await Promise.all([this.sparkService.getPermissions(et.id), this.sparkService.getCustomActions(et.id)]);
|
|
1029
|
+
this.canRead.set(permissions.canRead);
|
|
1030
|
+
this.canCreate.set(permissions.canCreate);
|
|
1031
|
+
this.permissions.set(permissions);
|
|
1032
|
+
this.customActions.set(filterQueryActions(actions));
|
|
1033
|
+
this.defaultActions.set(defaultQueryActions(actions));
|
|
1034
|
+
} else if (resolvedQuery) console.warn(`[spark] Query '${resolvedQuery.name}' names entity type '${resolvedQuery.entityType ?? resolvedQuery.source}', which resolves to no type in /spark/types; the grid offers no actions and no row links.`);
|
|
1035
|
+
this.settings.set(initialGridSettings(resolvedQuery));
|
|
1036
|
+
if (this.data() === null && !resolvedQuery?.isStreamingQuery) this.fetchFn.set(this.makeFetch(resolvedQuery, parentId, parentType));
|
|
1037
|
+
this.loadLookupReferenceOptions();
|
|
1038
|
+
} catch (e) {
|
|
1039
|
+
this.fetchFn.set(null);
|
|
1040
|
+
this.reportError(e);
|
|
1041
|
+
} finally {
|
|
1042
|
+
this.loading.set(false);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
resolveEntityType(query, entityTypes) {
|
|
1046
|
+
if (!query) return null;
|
|
1047
|
+
if (query.entityType) return entityTypes.find((t) => t.name === query.entityType || t.alias === query.entityType?.toLowerCase()) ?? null;
|
|
1048
|
+
const sourceName = extractSourceName(query.source);
|
|
1049
|
+
const singular = singularize(sourceName);
|
|
1050
|
+
return entityTypes.find((t) => t.name === sourceName || t.name === singular || t.name + "s" === sourceName || t.clrType?.endsWith(singular)) ?? null;
|
|
1051
|
+
}
|
|
1052
|
+
makeFetch(query, parentId, parentType) {
|
|
1053
|
+
return (req) => this.sparkService.executeQuery(query.id, {
|
|
1054
|
+
sortColumns: req.sortColumns,
|
|
1055
|
+
skip: (req.page - 1) * req.perPage,
|
|
1056
|
+
take: req.perPage,
|
|
1057
|
+
search: this.search() || void 0,
|
|
1058
|
+
columns: this.filters(),
|
|
1059
|
+
parentId,
|
|
1060
|
+
parentType,
|
|
1061
|
+
...this.effectiveDeleted() ? { deleted: this.effectiveDeleted() } : {},
|
|
1062
|
+
...this.parentDeleted() && parentId && parentType ? { parentDeleted: "include" } : {}
|
|
1063
|
+
}).then((r) => {
|
|
1064
|
+
this.errorMessage.set(null);
|
|
1065
|
+
this.resultCount.set(r.totalItems);
|
|
1066
|
+
this.setFetchedColumns(r.columns ?? []);
|
|
1067
|
+
this.disabledActions.set(r.disabledActions ?? []);
|
|
1068
|
+
return {
|
|
1069
|
+
data: r.items,
|
|
1070
|
+
totalRecords: r.totalItems,
|
|
1071
|
+
totalPages: Math.ceil(r.totalItems / req.perPage) || 1,
|
|
1072
|
+
perPage: req.perPage,
|
|
1073
|
+
page: req.page
|
|
1074
|
+
};
|
|
1075
|
+
}).catch((e) => {
|
|
1076
|
+
this.reportError(e);
|
|
1077
|
+
this.resultCount.set(0);
|
|
1078
|
+
return {
|
|
1079
|
+
data: [],
|
|
1080
|
+
totalRecords: 0,
|
|
1081
|
+
totalPages: 1,
|
|
1082
|
+
perPage: req.perPage,
|
|
1083
|
+
page: req.page
|
|
1084
|
+
};
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
async loadLookupReferenceOptions() {
|
|
1088
|
+
this.lookupReferenceOptions.set(await this.gridRenderers.loadLookupOptions(this.allColumns()));
|
|
1089
|
+
}
|
|
1090
|
+
rendererValueFor(item, column) {
|
|
1091
|
+
return cellValue(valueFor(item, column.name));
|
|
1092
|
+
}
|
|
1093
|
+
getColumnRendererComponent(column) {
|
|
1094
|
+
return this.gridRenderers.columnComponentFor(column);
|
|
1095
|
+
}
|
|
1096
|
+
filterLabelFor(column) {
|
|
1097
|
+
return this.gridRenderers.filterLabelFor(column);
|
|
1098
|
+
}
|
|
1099
|
+
getColumnRendererInputs(component, item, column) {
|
|
1100
|
+
return this.gridRenderers.columnInputsFor(component, item, column);
|
|
1101
|
+
}
|
|
1102
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1103
|
+
minVersion: "12.0.0",
|
|
1104
|
+
version: "22.2.0",
|
|
1105
|
+
ngImport: i0,
|
|
1106
|
+
type: SparkQueryGridComponent,
|
|
1107
|
+
deps: [],
|
|
1108
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1109
|
+
});
|
|
1110
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1111
|
+
minVersion: "17.0.0",
|
|
1112
|
+
version: "22.2.0",
|
|
1113
|
+
type: SparkQueryGridComponent,
|
|
1114
|
+
isStandalone: true,
|
|
1115
|
+
selector: "spark-query-grid",
|
|
1116
|
+
inputs: {
|
|
1117
|
+
queryId: {
|
|
1118
|
+
classPropertyName: "queryId",
|
|
1119
|
+
publicName: "queryId",
|
|
1120
|
+
isSignal: true,
|
|
1121
|
+
isRequired: true,
|
|
1122
|
+
transformFunction: null
|
|
1123
|
+
},
|
|
1124
|
+
parentId: {
|
|
1125
|
+
classPropertyName: "parentId",
|
|
1126
|
+
publicName: "parentId",
|
|
1127
|
+
isSignal: true,
|
|
1128
|
+
isRequired: false,
|
|
1129
|
+
transformFunction: null
|
|
1130
|
+
},
|
|
1131
|
+
parentType: {
|
|
1132
|
+
classPropertyName: "parentType",
|
|
1133
|
+
publicName: "parentType",
|
|
1134
|
+
isSignal: true,
|
|
1135
|
+
isRequired: false,
|
|
1136
|
+
transformFunction: null
|
|
1137
|
+
},
|
|
1138
|
+
presetFilters: {
|
|
1139
|
+
classPropertyName: "presetFilters",
|
|
1140
|
+
publicName: "presetFilters",
|
|
1141
|
+
isSignal: true,
|
|
1142
|
+
isRequired: false,
|
|
1143
|
+
transformFunction: null
|
|
1144
|
+
},
|
|
1145
|
+
data: {
|
|
1146
|
+
classPropertyName: "data",
|
|
1147
|
+
publicName: "data",
|
|
1148
|
+
isSignal: true,
|
|
1149
|
+
isRequired: false,
|
|
1150
|
+
transformFunction: null
|
|
1151
|
+
},
|
|
1152
|
+
search: {
|
|
1153
|
+
classPropertyName: "search",
|
|
1154
|
+
publicName: "search",
|
|
1155
|
+
isSignal: true,
|
|
1156
|
+
isRequired: false,
|
|
1157
|
+
transformFunction: null
|
|
1158
|
+
},
|
|
1159
|
+
columns: {
|
|
1160
|
+
classPropertyName: "columns",
|
|
1161
|
+
publicName: "columns",
|
|
1162
|
+
isSignal: true,
|
|
1163
|
+
isRequired: false,
|
|
1164
|
+
transformFunction: null
|
|
1165
|
+
},
|
|
1166
|
+
reloadToken: {
|
|
1167
|
+
classPropertyName: "reloadToken",
|
|
1168
|
+
publicName: "reloadToken",
|
|
1169
|
+
isSignal: true,
|
|
1170
|
+
isRequired: false,
|
|
1171
|
+
transformFunction: null
|
|
1172
|
+
},
|
|
1173
|
+
deleted: {
|
|
1174
|
+
classPropertyName: "deleted",
|
|
1175
|
+
publicName: "deleted",
|
|
1176
|
+
isSignal: true,
|
|
1177
|
+
isRequired: false,
|
|
1178
|
+
transformFunction: null
|
|
1179
|
+
},
|
|
1180
|
+
parentDeleted: {
|
|
1181
|
+
classPropertyName: "parentDeleted",
|
|
1182
|
+
publicName: "parentDeleted",
|
|
1183
|
+
isSignal: true,
|
|
1184
|
+
isRequired: false,
|
|
1185
|
+
transformFunction: null
|
|
1186
|
+
},
|
|
1187
|
+
settings: {
|
|
1188
|
+
classPropertyName: "settings",
|
|
1189
|
+
publicName: "settings",
|
|
1190
|
+
isSignal: true,
|
|
1191
|
+
isRequired: false,
|
|
1192
|
+
transformFunction: null
|
|
1193
|
+
},
|
|
1194
|
+
selection: {
|
|
1195
|
+
classPropertyName: "selection",
|
|
1196
|
+
publicName: "selection",
|
|
1197
|
+
isSignal: true,
|
|
1198
|
+
isRequired: false,
|
|
1199
|
+
transformFunction: null
|
|
1200
|
+
},
|
|
1201
|
+
rowRoute: {
|
|
1202
|
+
classPropertyName: "rowRoute",
|
|
1203
|
+
publicName: "rowRoute",
|
|
1204
|
+
isSignal: true,
|
|
1205
|
+
isRequired: false,
|
|
1206
|
+
transformFunction: null
|
|
1207
|
+
},
|
|
1208
|
+
selectionModeSetting: {
|
|
1209
|
+
classPropertyName: "selectionModeSetting",
|
|
1210
|
+
publicName: "selectionModeSetting",
|
|
1211
|
+
isSignal: true,
|
|
1212
|
+
isRequired: false,
|
|
1213
|
+
transformFunction: null
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
outputs: {
|
|
1217
|
+
settings: "settingsChange",
|
|
1218
|
+
selection: "selectionChange",
|
|
1219
|
+
error: "error",
|
|
1220
|
+
rowClicked: "rowClicked",
|
|
1221
|
+
customActionExecuted: "customActionExecuted",
|
|
1222
|
+
createClicked: "createClicked"
|
|
1223
|
+
},
|
|
1224
|
+
ngImport: i0,
|
|
1225
|
+
template: "<!--\n Three explicit states, in this order, and the order is load-bearing.\n\n This template used to open with `@if (query(); as q)` wrapping EVERYTHING, and `query()` is only\n set after loadData's awaits resolve. Three separate bugs fell out of that one line: the spinner\n was unreachable on a first load (it rendered inside the gate, while `loading` starts true and\n `query` starts null), a first-load failure rendered ZERO DOM — no card, no message, nothing to\n see or report — and a failed RELOAD left the previous query's rows on screen.\n\n So: `loading` is checked first and outside any dependency on `query`, and the final `@else`\n always renders something. Do not fold these back into one gate, and do not move the spinner\n inside the `query()` branch.\n-->\n@if (loading()) {\n <div class=\"text-center p-3\">\n <bs-spinner />\n </div>\n} @else if (query()) {\n <!-- A page-fetch failure while the grid is already resolved. Without this the catch returns an\n empty page and a failed query is indistinguishable from one that legitimately has no rows. -->\n @if (errorMessage(); as err) {\n <bs-alert [type]=\"colors.danger\" class=\"mb-3\">\n {{ err }}\n </bs-alert>\n }\n\n <!--\n One datatable, two row sources. `[data]` and `[fetch]` are mutually exclusive in\n ng-bootstrap — binding both makes `[fetch]` win silently — so exactly one is ever non-null\n here: `fetchFn` is left null whenever `data` is bound. See the class comment for why rows can\n arrive from outside at all (streaming must not put a websocket in every detail page's bundle).\n -->\n <!--\n The selection bar (#460, M15): the \"N selected\" chip, only while rows are selected, and part\n of the grid rather than of a host, so the query card and the query-list page show the same\n thing. There is deliberately no select-all (owner decision, 2026-09-29): with paged, lazy or\n virtual-scrolled rows it could only tick the rows loaded so far. Deselect-all is the\n datatable's own header checkbox, which it shows only while a row is selected; the chip does\n not repeat it. Single selection has no checkbox column, so no header checkbox either, and a\n row click only ever selects: there the chip's ⊗ is the deselect. The bar keeps its height\n while empty, so ticking the first row does not push the table down under the pointer.\n -->\n @if (selectionMode() !== 'none') {\n <div class=\"spark-selection-bar d-flex align-items-center gap-2 mb-2\" style=\"min-height: 1.5rem\">\n @if (selection().length) {\n <bs-badge [type]=\"colors.primary\" class=\"spark-selection-chip\">\n {{ selection().length }} {{ 'common.selected' | t }}\n @if (selectionMode() === 'single') {\n <button type=\"button\" class=\"spark-selection-clear\"\n [attr.aria-label]=\"'common.clearSelection' | t\" (click)=\"clearSelection()\">\n <spark-icon name=\"x-circle\" />\n </button>\n }\n </bs-badge>\n }\n </div>\n }\n\n <bs-datatable\n [selectionMode]=\"selectionMode()\"\n [(selection)]=\"selection\"\n [virtualScroll]=\"isVirtualScrolling()\"\n [itemSize]=\"40\"\n [isResponsive]=\"isVirtualScrolling()\"\n [data]=\"data()\"\n [fetch]=\"fetchFn()\"\n [distincts]=\"distinctsFn\"\n (filterChange)=\"onFilterChange($event)\"\n (rowClick)=\"onRowClick($event)\"\n (rowDblClick)=\"onRowDblClick($event)\"\n [(settings)]=\"settings\">\n @for (col of visibleColumns(); track col.name) {\n <!--\n `canSort`/`canFilter` arrive already resolved by the server (query override → attribute →\n true), so this only spells the polarity. `!== false` is needed for BOTH, for opposite\n reasons: absent means capable on our wire, while the datatable's own `filterable` defaults\n to false, unlike `sortable`.\n\n ⚠️ `filterActive` and `filterSummary` are deliberately NOT bound. Any *bsDatatableColumn\n input change recomputes the column set, which retires the live filter view — while the web\n component's mount-once guard leaves the panel's nodes in place and never re-renders them.\n Binding them to state our own panel mutates would freeze the panel the instant a value is\n ticked, until it is closed and reopened. The cost is that a filtered column carries no\n visual marker yet, which is worth far less than a panel that dies on first use. See #431 F7.\n -->\n <div *bsDatatableColumn=\"col.name; sortable: col.canSort !== false; filterable: col.canFilter !== false\">\n {{ (col.label | resolveTranslation) || col.name }}\n <spark-attribute-description [description]=\"col.description\" />\n\n @if (col.canFilter !== false) {\n <ng-container *bsDatatableFilterPanel=\"let values; let ctx = ctx\">\n <spark-column-filter-panel\n [column]=\"col\"\n [values]=\"values()\"\n [ctx]=\"ctx\"\n [filterLabel]=\"filterLabelFor(col)\" />\n </ng-container>\n }\n </div>\n }\n <!--\n The per-row ⋮ menu's column: no header, never sorted or filtered.\n\n ⚠️ Only once the data columns exist. Those ship WITH the first page, so the rows reach the\n datatable one render before the column templates do. The datatable sizes its columns ONCE,\n from the first render that has both columns and rows, then switches to `table-layout: fixed`\n and never measures again. If this column were already registered it would be the only one\n measured; the data columns would share what it left over equally, and at phone width their\n unclipped headers ran into each other. With no column at all the datatable waits.\n -->\n @if (rowActions().length && visibleColumns().length) {\n <div *bsDatatableColumn=\"'__sparkRowActions'; sortable: false; filterable: false\">\n <span class=\"visually-hidden\">{{ 'common.actions' | t }}</span>\n </div>\n }\n\n <ng-container *bsRowTemplate=\"let item\">\n @let row = $any(item);\n @for (col of visibleColumns(); track col.name; let first = $first) {\n <td>\n @if (row) {\n <!-- The first column links to the row's detail page. Two things about this are\n routinely misread:\n\n 1. `cellContent` is projected INSIDE the anchor, so a custom `renderer` does NOT\n suppress this link — a renderer that emits its own <a> produces nested anchors\n (invalid HTML) rather than replacing this one.\n 2. `canRead()` is the whole gate, and it is the rights model: `Query` without\n `Read` lists the rows and withholds the link. Withhold `Read` for a query\n whose rows no detail page can load — a Custom.* query that fabricates rows in\n memory, say.\n 3. `rowRoute` replaces the DESTINATION only, never the gate: returning a route\n from it cannot make a row clickable that `canRead()` withheld, and returning\n null from it suppresses the link for that one row. -->\n @if (first && canRead() && rowRouteFor(row); as route) {\n <a [routerLink]=\"route\" [queryParams]=\"rowQueryParams()\" [state]=\"rowLinkState()\"\n (click)=\"rowClicked.emit(row)\">\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, col: col }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, col: col }\"></ng-container>\n }\n } @else {\n \n }\n </td>\n }\n @if (rowActions().length) {\n <!-- The row menu: every action whose rule accepts one row, run on THIS row only. The\n checkbox selection is left alone (runRowAction never reads or writes it). -->\n <td class=\"spark-row-actions text-end\" (click)=\"$event.stopPropagation()\" (dblclick)=\"$event.stopPropagation()\">\n @if (row) {\n <button type=\"button\" cdkOverlayOrigin #rowMenuOrigin=\"cdkOverlayOrigin\" #rowMenuToggle\n class=\"btn btn-sm btn-link spark-row-menu-toggle\"\n aria-haspopup=\"menu\" [attr.aria-expanded]=\"openRowMenu() === row.id\"\n [attr.aria-label]=\"'common.actions' | t\" (click)=\"toggleRowMenu(row)\">\n <spark-icon name=\"three-dots-vertical\" />\n </button>\n <ng-template cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"rowMenuOrigin\"\n [cdkConnectedOverlayOpen]=\"openRowMenu() === row.id\"\n [cdkConnectedOverlayPositions]=\"rowMenuPositions\"\n (overlayOutsideClick)=\"onRowMenuOutsideClick($event, rowMenuToggle, row.id)\"\n (overlayKeydown)=\"$event.key === 'Escape' && closeRowMenu(row.id)\"\n (detach)=\"closeRowMenu(row.id)\">\n <bs-dropdown-menu class=\"spark-row-menu\">\n @for (action of rowActions(); track action.name) {\n <li bsDropdownItem class=\"spark-row-action\" [attr.data-action]=\"action.name\"\n (click)=\"chooseRowAction(action, row)\">\n {{ action.definition.displayName | resolveTranslation }}\n </li>\n }\n </bs-dropdown-menu>\n </ng-template>\n }\n </td>\n }\n </ng-container>\n </bs-datatable>\n} @else {\n <!-- The query could not be resolved. Rendering something keeps the host's layout intact and,\n crucially, makes the failure visible: this branch used to render nothing at all. -->\n <bs-alert [type]=\"colors.danger\" class=\"mb-0\">\n {{ errorMessage() || ('spark.query.unavailable' | t) }}\n </bs-alert>\n}\n\n<ng-template #cellContent let-item let-col=\"col\">\n <!--\n Presentation lives in <spark-grid-cell>, shared with the AsDetail table on the PO detail page.\n Value resolution stays here: a query row is a PersistentObject with an attribute list, and the\n AsDetail table's rows are plain dictionaries, so only the rendering is common.\n\n `link` is deliberately not passed. The first-column link is the grid's own rule and wraps this\n template from outside; setting both would nest anchors.\n -->\n <spark-grid-cell\n [column]=\"col\"\n [display]=\"(col | queryCellValue:item:lookupReferenceOptions())\"\n [rendererValue]=\"rendererValueFor(item, col)\"\n [item]=\"item\"\n [chips]=\"(col | queryReferenceChips:item)\" />\n</ng-template>\n",
|
|
1226
|
+
styles: [":host ::ng-deep tbody tr[data-selected=true] a:not(.btn),:host ::ng-deep tbody tr[data-selected=true] .spark-row-menu-toggle{color:var(--mp-datatable-row-selected-color)}:host ::ng-deep tbody tr[data-selected=true] .spark-row-menu-toggle{--bs-btn-color: var(--mp-datatable-row-selected-color);--bs-btn-hover-color: var(--mp-datatable-row-selected-color);--bs-btn-active-color: var(--mp-datatable-row-selected-color)}\n"],
|
|
1227
|
+
dependencies: [
|
|
1228
|
+
{
|
|
1229
|
+
kind: "ngmodule",
|
|
1230
|
+
type: CommonModule
|
|
1231
|
+
},
|
|
1232
|
+
{
|
|
1233
|
+
kind: "directive",
|
|
1234
|
+
type: i1$1.NgTemplateOutlet,
|
|
1235
|
+
selector: "[ngTemplateOutlet]",
|
|
1236
|
+
inputs: [
|
|
1237
|
+
"ngTemplateOutletContext",
|
|
1238
|
+
"ngTemplateOutlet",
|
|
1239
|
+
"ngTemplateOutletInjector"
|
|
1240
|
+
]
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
kind: "ngmodule",
|
|
1244
|
+
type: RouterModule
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
kind: "directive",
|
|
1248
|
+
type: i2.RouterLink,
|
|
1249
|
+
selector: "[routerLink]",
|
|
1250
|
+
inputs: [
|
|
1251
|
+
"target",
|
|
1252
|
+
"queryParams",
|
|
1253
|
+
"fragment",
|
|
1254
|
+
"queryParamsHandling",
|
|
1255
|
+
"state",
|
|
1256
|
+
"info",
|
|
1257
|
+
"relativeTo",
|
|
1258
|
+
"preserveFragment",
|
|
1259
|
+
"skipLocationChange",
|
|
1260
|
+
"replaceUrl",
|
|
1261
|
+
"browserUrl",
|
|
1262
|
+
"routerLink"
|
|
1263
|
+
]
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
kind: "component",
|
|
1267
|
+
type: BsAlertComponent,
|
|
1268
|
+
selector: "bs-alert",
|
|
1269
|
+
inputs: [
|
|
1270
|
+
"type",
|
|
1271
|
+
"announce",
|
|
1272
|
+
"isVisible"
|
|
1273
|
+
],
|
|
1274
|
+
outputs: ["isVisibleChange", "afterOpenedOrClosed"]
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
kind: "component",
|
|
1278
|
+
type: BsDatatableComponent,
|
|
1279
|
+
selector: "bs-datatable",
|
|
1280
|
+
inputs: [
|
|
1281
|
+
"columns",
|
|
1282
|
+
"data",
|
|
1283
|
+
"fetch",
|
|
1284
|
+
"distincts",
|
|
1285
|
+
"labels",
|
|
1286
|
+
"settings",
|
|
1287
|
+
"selectionMode",
|
|
1288
|
+
"selectable",
|
|
1289
|
+
"selection",
|
|
1290
|
+
"rowKey",
|
|
1291
|
+
"resizableColumns",
|
|
1292
|
+
"pagination",
|
|
1293
|
+
"virtualScroll",
|
|
1294
|
+
"itemSize",
|
|
1295
|
+
"virtualBuffer",
|
|
1296
|
+
"isResponsive",
|
|
1297
|
+
"compareWith",
|
|
1298
|
+
"tree",
|
|
1299
|
+
"idKey",
|
|
1300
|
+
"childCountKey",
|
|
1301
|
+
"treeIndent",
|
|
1302
|
+
"expandedIds",
|
|
1303
|
+
"selectionStrategy"
|
|
1304
|
+
],
|
|
1305
|
+
outputs: [
|
|
1306
|
+
"settingsChange",
|
|
1307
|
+
"selectionChange",
|
|
1308
|
+
"rowClick",
|
|
1309
|
+
"rowDblClick",
|
|
1310
|
+
"rowContextMenu",
|
|
1311
|
+
"expandedIdsChange",
|
|
1312
|
+
"rowExpand",
|
|
1313
|
+
"rowCollapse",
|
|
1314
|
+
"filterChange"
|
|
1315
|
+
]
|
|
1316
|
+
},
|
|
1317
|
+
{
|
|
1318
|
+
kind: "directive",
|
|
1319
|
+
type: BsDatatableColumnDirective,
|
|
1320
|
+
selector: "[bsDatatableColumn]",
|
|
1321
|
+
inputs: [
|
|
1322
|
+
"bsDatatableColumn",
|
|
1323
|
+
"bsDatatableColumnSortable",
|
|
1324
|
+
"bsDatatableColumnFilterable",
|
|
1325
|
+
"bsDatatableColumnFilterActive",
|
|
1326
|
+
"bsDatatableColumnFilterSummary",
|
|
1327
|
+
"bsDatatableColumnFilterSelection",
|
|
1328
|
+
"bsDatatableColumnFilterMode",
|
|
1329
|
+
"bsDatatableColumnFilterInputType",
|
|
1330
|
+
"bsDatatableColumnFilterOperators"
|
|
1331
|
+
]
|
|
1332
|
+
},
|
|
1333
|
+
{
|
|
1334
|
+
kind: "directive",
|
|
1335
|
+
type: BsDatatableFilterPanelDirective,
|
|
1336
|
+
selector: "[bsDatatableFilterPanel]"
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
kind: "directive",
|
|
1340
|
+
type: BsRowTemplateDirective,
|
|
1341
|
+
selector: "[bsRowTemplate]"
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
kind: "component",
|
|
1345
|
+
type: BsSpinnerComponent,
|
|
1346
|
+
selector: "bs-spinner",
|
|
1347
|
+
inputs: ["type", "color"]
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
kind: "component",
|
|
1351
|
+
type: SparkGridCellComponent,
|
|
1352
|
+
selector: "spark-grid-cell",
|
|
1353
|
+
inputs: [
|
|
1354
|
+
"column",
|
|
1355
|
+
"display",
|
|
1356
|
+
"rendererValue",
|
|
1357
|
+
"item",
|
|
1358
|
+
"chips",
|
|
1359
|
+
"link"
|
|
1360
|
+
]
|
|
1361
|
+
},
|
|
1362
|
+
{
|
|
1363
|
+
kind: "component",
|
|
1364
|
+
type: SparkAttributeDescriptionComponent,
|
|
1365
|
+
selector: "spark-attribute-description",
|
|
1366
|
+
inputs: ["description", "position"]
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
kind: "component",
|
|
1370
|
+
type: SparkColumnFilterPanelComponent,
|
|
1371
|
+
selector: "spark-column-filter-panel",
|
|
1372
|
+
inputs: [
|
|
1373
|
+
"column",
|
|
1374
|
+
"values",
|
|
1375
|
+
"ctx",
|
|
1376
|
+
"filterLabel"
|
|
1377
|
+
]
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
kind: "component",
|
|
1381
|
+
type: BsBadgeComponent,
|
|
1382
|
+
selector: "bs-badge",
|
|
1383
|
+
inputs: [
|
|
1384
|
+
"type",
|
|
1385
|
+
"unit",
|
|
1386
|
+
"decorative"
|
|
1387
|
+
]
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
kind: "directive",
|
|
1391
|
+
type: CdkOverlayOrigin,
|
|
1392
|
+
selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
|
|
1393
|
+
exportAs: ["cdkOverlayOrigin"]
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
kind: "directive",
|
|
1397
|
+
type: CdkConnectedOverlay,
|
|
1398
|
+
selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
|
|
1399
|
+
inputs: [
|
|
1400
|
+
"cdkConnectedOverlayOrigin",
|
|
1401
|
+
"cdkConnectedOverlayPositions",
|
|
1402
|
+
"cdkConnectedOverlayPositionStrategy",
|
|
1403
|
+
"cdkConnectedOverlayOffsetX",
|
|
1404
|
+
"cdkConnectedOverlayOffsetY",
|
|
1405
|
+
"cdkConnectedOverlayWidth",
|
|
1406
|
+
"cdkConnectedOverlayHeight",
|
|
1407
|
+
"cdkConnectedOverlayMinWidth",
|
|
1408
|
+
"cdkConnectedOverlayMinHeight",
|
|
1409
|
+
"cdkConnectedOverlayBackdropClass",
|
|
1410
|
+
"cdkConnectedOverlayPanelClass",
|
|
1411
|
+
"cdkConnectedOverlayViewportMargin",
|
|
1412
|
+
"cdkConnectedOverlayScrollStrategy",
|
|
1413
|
+
"cdkConnectedOverlayOpen",
|
|
1414
|
+
"cdkConnectedOverlayDisableClose",
|
|
1415
|
+
"cdkConnectedOverlayTransformOriginOn",
|
|
1416
|
+
"cdkConnectedOverlayHasBackdrop",
|
|
1417
|
+
"cdkConnectedOverlayLockPosition",
|
|
1418
|
+
"cdkConnectedOverlayFlexibleDimensions",
|
|
1419
|
+
"cdkConnectedOverlayGrowAfterOpen",
|
|
1420
|
+
"cdkConnectedOverlayPush",
|
|
1421
|
+
"cdkConnectedOverlayDisposeOnNavigation",
|
|
1422
|
+
"cdkConnectedOverlayUsePopover",
|
|
1423
|
+
"cdkConnectedOverlayMatchWidth",
|
|
1424
|
+
"cdkConnectedOverlay"
|
|
1425
|
+
],
|
|
1426
|
+
outputs: [
|
|
1427
|
+
"backdropClick",
|
|
1428
|
+
"positionChange",
|
|
1429
|
+
"attach",
|
|
1430
|
+
"detach",
|
|
1431
|
+
"overlayKeydown",
|
|
1432
|
+
"overlayOutsideClick"
|
|
1433
|
+
],
|
|
1434
|
+
exportAs: ["cdkConnectedOverlay"]
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
kind: "component",
|
|
1438
|
+
type: BsDropdownMenuComponent,
|
|
1439
|
+
selector: "bs-dropdown-menu",
|
|
1440
|
+
inputs: ["menuMode", "maxHeight"],
|
|
1441
|
+
outputs: ["select"]
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
kind: "directive",
|
|
1445
|
+
type: BsDropdownItemDirective,
|
|
1446
|
+
selector: "[bsDropdownItem]",
|
|
1447
|
+
inputs: [
|
|
1448
|
+
"active",
|
|
1449
|
+
"disabled",
|
|
1450
|
+
"value"
|
|
1451
|
+
]
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
kind: "component",
|
|
1455
|
+
type: SparkIconComponent,
|
|
1456
|
+
selector: "spark-icon",
|
|
1457
|
+
inputs: ["name"]
|
|
1458
|
+
},
|
|
1459
|
+
{
|
|
1460
|
+
kind: "pipe",
|
|
1461
|
+
type: ResolveTranslationPipe,
|
|
1462
|
+
name: "resolveTranslation"
|
|
1463
|
+
},
|
|
1464
|
+
{
|
|
1465
|
+
kind: "pipe",
|
|
1466
|
+
type: QueryCellValuePipe,
|
|
1467
|
+
name: "queryCellValue"
|
|
1468
|
+
},
|
|
1469
|
+
{
|
|
1470
|
+
kind: "pipe",
|
|
1471
|
+
type: QueryReferenceChipsPipe,
|
|
1472
|
+
name: "queryReferenceChips"
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
kind: "pipe",
|
|
1476
|
+
type: TranslateKeyPipe,
|
|
1477
|
+
name: "t"
|
|
1478
|
+
}
|
|
1479
|
+
],
|
|
1480
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1481
|
+
});
|
|
1482
|
+
};
|
|
1483
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1484
|
+
minVersion: "12.0.0",
|
|
1485
|
+
version: "22.2.0",
|
|
1486
|
+
ngImport: i0,
|
|
1487
|
+
type: SparkQueryGridComponent,
|
|
1488
|
+
decorators: [{
|
|
1489
|
+
type: Component,
|
|
1490
|
+
args: [{
|
|
1491
|
+
selector: "spark-query-grid",
|
|
1492
|
+
imports: [
|
|
1493
|
+
CommonModule,
|
|
1494
|
+
RouterModule,
|
|
1495
|
+
BsAlertComponent,
|
|
1496
|
+
BsDatatableComponent,
|
|
1497
|
+
BsDatatableColumnDirective,
|
|
1498
|
+
BsDatatableFilterPanelDirective,
|
|
1499
|
+
BsRowTemplateDirective,
|
|
1500
|
+
BsSpinnerComponent,
|
|
1501
|
+
SparkGridCellComponent,
|
|
1502
|
+
ResolveTranslationPipe,
|
|
1503
|
+
QueryCellValuePipe,
|
|
1504
|
+
QueryReferenceChipsPipe,
|
|
1505
|
+
TranslateKeyPipe,
|
|
1506
|
+
SparkAttributeDescriptionComponent,
|
|
1507
|
+
SparkColumnFilterPanelComponent,
|
|
1508
|
+
BsBadgeComponent,
|
|
1509
|
+
CdkOverlayOrigin,
|
|
1510
|
+
CdkConnectedOverlay,
|
|
1511
|
+
BsDropdownMenuComponent,
|
|
1512
|
+
BsDropdownItemDirective,
|
|
1513
|
+
SparkIconComponent
|
|
1514
|
+
],
|
|
1515
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1516
|
+
template: "<!--\n Three explicit states, in this order, and the order is load-bearing.\n\n This template used to open with `@if (query(); as q)` wrapping EVERYTHING, and `query()` is only\n set after loadData's awaits resolve. Three separate bugs fell out of that one line: the spinner\n was unreachable on a first load (it rendered inside the gate, while `loading` starts true and\n `query` starts null), a first-load failure rendered ZERO DOM — no card, no message, nothing to\n see or report — and a failed RELOAD left the previous query's rows on screen.\n\n So: `loading` is checked first and outside any dependency on `query`, and the final `@else`\n always renders something. Do not fold these back into one gate, and do not move the spinner\n inside the `query()` branch.\n-->\n@if (loading()) {\n <div class=\"text-center p-3\">\n <bs-spinner />\n </div>\n} @else if (query()) {\n <!-- A page-fetch failure while the grid is already resolved. Without this the catch returns an\n empty page and a failed query is indistinguishable from one that legitimately has no rows. -->\n @if (errorMessage(); as err) {\n <bs-alert [type]=\"colors.danger\" class=\"mb-3\">\n {{ err }}\n </bs-alert>\n }\n\n <!--\n One datatable, two row sources. `[data]` and `[fetch]` are mutually exclusive in\n ng-bootstrap — binding both makes `[fetch]` win silently — so exactly one is ever non-null\n here: `fetchFn` is left null whenever `data` is bound. See the class comment for why rows can\n arrive from outside at all (streaming must not put a websocket in every detail page's bundle).\n -->\n <!--\n The selection bar (#460, M15): the \"N selected\" chip, only while rows are selected, and part\n of the grid rather than of a host, so the query card and the query-list page show the same\n thing. There is deliberately no select-all (owner decision, 2026-09-29): with paged, lazy or\n virtual-scrolled rows it could only tick the rows loaded so far. Deselect-all is the\n datatable's own header checkbox, which it shows only while a row is selected; the chip does\n not repeat it. Single selection has no checkbox column, so no header checkbox either, and a\n row click only ever selects: there the chip's ⊗ is the deselect. The bar keeps its height\n while empty, so ticking the first row does not push the table down under the pointer.\n -->\n @if (selectionMode() !== 'none') {\n <div class=\"spark-selection-bar d-flex align-items-center gap-2 mb-2\" style=\"min-height: 1.5rem\">\n @if (selection().length) {\n <bs-badge [type]=\"colors.primary\" class=\"spark-selection-chip\">\n {{ selection().length }} {{ 'common.selected' | t }}\n @if (selectionMode() === 'single') {\n <button type=\"button\" class=\"spark-selection-clear\"\n [attr.aria-label]=\"'common.clearSelection' | t\" (click)=\"clearSelection()\">\n <spark-icon name=\"x-circle\" />\n </button>\n }\n </bs-badge>\n }\n </div>\n }\n\n <bs-datatable\n [selectionMode]=\"selectionMode()\"\n [(selection)]=\"selection\"\n [virtualScroll]=\"isVirtualScrolling()\"\n [itemSize]=\"40\"\n [isResponsive]=\"isVirtualScrolling()\"\n [data]=\"data()\"\n [fetch]=\"fetchFn()\"\n [distincts]=\"distinctsFn\"\n (filterChange)=\"onFilterChange($event)\"\n (rowClick)=\"onRowClick($event)\"\n (rowDblClick)=\"onRowDblClick($event)\"\n [(settings)]=\"settings\">\n @for (col of visibleColumns(); track col.name) {\n <!--\n `canSort`/`canFilter` arrive already resolved by the server (query override → attribute →\n true), so this only spells the polarity. `!== false` is needed for BOTH, for opposite\n reasons: absent means capable on our wire, while the datatable's own `filterable` defaults\n to false, unlike `sortable`.\n\n ⚠️ `filterActive` and `filterSummary` are deliberately NOT bound. Any *bsDatatableColumn\n input change recomputes the column set, which retires the live filter view — while the web\n component's mount-once guard leaves the panel's nodes in place and never re-renders them.\n Binding them to state our own panel mutates would freeze the panel the instant a value is\n ticked, until it is closed and reopened. The cost is that a filtered column carries no\n visual marker yet, which is worth far less than a panel that dies on first use. See #431 F7.\n -->\n <div *bsDatatableColumn=\"col.name; sortable: col.canSort !== false; filterable: col.canFilter !== false\">\n {{ (col.label | resolveTranslation) || col.name }}\n <spark-attribute-description [description]=\"col.description\" />\n\n @if (col.canFilter !== false) {\n <ng-container *bsDatatableFilterPanel=\"let values; let ctx = ctx\">\n <spark-column-filter-panel\n [column]=\"col\"\n [values]=\"values()\"\n [ctx]=\"ctx\"\n [filterLabel]=\"filterLabelFor(col)\" />\n </ng-container>\n }\n </div>\n }\n <!--\n The per-row ⋮ menu's column: no header, never sorted or filtered.\n\n ⚠️ Only once the data columns exist. Those ship WITH the first page, so the rows reach the\n datatable one render before the column templates do. The datatable sizes its columns ONCE,\n from the first render that has both columns and rows, then switches to `table-layout: fixed`\n and never measures again. If this column were already registered it would be the only one\n measured; the data columns would share what it left over equally, and at phone width their\n unclipped headers ran into each other. With no column at all the datatable waits.\n -->\n @if (rowActions().length && visibleColumns().length) {\n <div *bsDatatableColumn=\"'__sparkRowActions'; sortable: false; filterable: false\">\n <span class=\"visually-hidden\">{{ 'common.actions' | t }}</span>\n </div>\n }\n\n <ng-container *bsRowTemplate=\"let item\">\n @let row = $any(item);\n @for (col of visibleColumns(); track col.name; let first = $first) {\n <td>\n @if (row) {\n <!-- The first column links to the row's detail page. Two things about this are\n routinely misread:\n\n 1. `cellContent` is projected INSIDE the anchor, so a custom `renderer` does NOT\n suppress this link — a renderer that emits its own <a> produces nested anchors\n (invalid HTML) rather than replacing this one.\n 2. `canRead()` is the whole gate, and it is the rights model: `Query` without\n `Read` lists the rows and withholds the link. Withhold `Read` for a query\n whose rows no detail page can load — a Custom.* query that fabricates rows in\n memory, say.\n 3. `rowRoute` replaces the DESTINATION only, never the gate: returning a route\n from it cannot make a row clickable that `canRead()` withheld, and returning\n null from it suppresses the link for that one row. -->\n @if (first && canRead() && rowRouteFor(row); as route) {\n <a [routerLink]=\"route\" [queryParams]=\"rowQueryParams()\" [state]=\"rowLinkState()\"\n (click)=\"rowClicked.emit(row)\">\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, col: col }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, col: col }\"></ng-container>\n }\n } @else {\n \n }\n </td>\n }\n @if (rowActions().length) {\n <!-- The row menu: every action whose rule accepts one row, run on THIS row only. The\n checkbox selection is left alone (runRowAction never reads or writes it). -->\n <td class=\"spark-row-actions text-end\" (click)=\"$event.stopPropagation()\" (dblclick)=\"$event.stopPropagation()\">\n @if (row) {\n <button type=\"button\" cdkOverlayOrigin #rowMenuOrigin=\"cdkOverlayOrigin\" #rowMenuToggle\n class=\"btn btn-sm btn-link spark-row-menu-toggle\"\n aria-haspopup=\"menu\" [attr.aria-expanded]=\"openRowMenu() === row.id\"\n [attr.aria-label]=\"'common.actions' | t\" (click)=\"toggleRowMenu(row)\">\n <spark-icon name=\"three-dots-vertical\" />\n </button>\n <ng-template cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"rowMenuOrigin\"\n [cdkConnectedOverlayOpen]=\"openRowMenu() === row.id\"\n [cdkConnectedOverlayPositions]=\"rowMenuPositions\"\n (overlayOutsideClick)=\"onRowMenuOutsideClick($event, rowMenuToggle, row.id)\"\n (overlayKeydown)=\"$event.key === 'Escape' && closeRowMenu(row.id)\"\n (detach)=\"closeRowMenu(row.id)\">\n <bs-dropdown-menu class=\"spark-row-menu\">\n @for (action of rowActions(); track action.name) {\n <li bsDropdownItem class=\"spark-row-action\" [attr.data-action]=\"action.name\"\n (click)=\"chooseRowAction(action, row)\">\n {{ action.definition.displayName | resolveTranslation }}\n </li>\n }\n </bs-dropdown-menu>\n </ng-template>\n }\n </td>\n }\n </ng-container>\n </bs-datatable>\n} @else {\n <!-- The query could not be resolved. Rendering something keeps the host's layout intact and,\n crucially, makes the failure visible: this branch used to render nothing at all. -->\n <bs-alert [type]=\"colors.danger\" class=\"mb-0\">\n {{ errorMessage() || ('spark.query.unavailable' | t) }}\n </bs-alert>\n}\n\n<ng-template #cellContent let-item let-col=\"col\">\n <!--\n Presentation lives in <spark-grid-cell>, shared with the AsDetail table on the PO detail page.\n Value resolution stays here: a query row is a PersistentObject with an attribute list, and the\n AsDetail table's rows are plain dictionaries, so only the rendering is common.\n\n `link` is deliberately not passed. The first-column link is the grid's own rule and wraps this\n template from outside; setting both would nest anchors.\n -->\n <spark-grid-cell\n [column]=\"col\"\n [display]=\"(col | queryCellValue:item:lookupReferenceOptions())\"\n [rendererValue]=\"rendererValueFor(item, col)\"\n [item]=\"item\"\n [chips]=\"(col | queryReferenceChips:item)\" />\n</ng-template>\n",
|
|
1517
|
+
styles: [":host ::ng-deep tbody tr[data-selected=true] a:not(.btn),:host ::ng-deep tbody tr[data-selected=true] .spark-row-menu-toggle{color:var(--mp-datatable-row-selected-color)}:host ::ng-deep tbody tr[data-selected=true] .spark-row-menu-toggle{--bs-btn-color: var(--mp-datatable-row-selected-color);--bs-btn-hover-color: var(--mp-datatable-row-selected-color);--bs-btn-active-color: var(--mp-datatable-row-selected-color)}\n"]
|
|
1518
|
+
}]
|
|
1519
|
+
}],
|
|
1520
|
+
ctorParameters: () => [],
|
|
1521
|
+
propDecorators: {
|
|
1522
|
+
queryId: [{
|
|
1523
|
+
type: i0.Input,
|
|
1524
|
+
args: [{
|
|
1525
|
+
isSignal: true,
|
|
1526
|
+
alias: "queryId",
|
|
1527
|
+
required: true
|
|
1528
|
+
}]
|
|
1529
|
+
}],
|
|
1530
|
+
parentId: [{
|
|
1531
|
+
type: i0.Input,
|
|
1532
|
+
args: [{
|
|
1533
|
+
isSignal: true,
|
|
1534
|
+
alias: "parentId",
|
|
1535
|
+
required: false
|
|
1536
|
+
}]
|
|
1537
|
+
}],
|
|
1538
|
+
parentType: [{
|
|
1539
|
+
type: i0.Input,
|
|
1540
|
+
args: [{
|
|
1541
|
+
isSignal: true,
|
|
1542
|
+
alias: "parentType",
|
|
1543
|
+
required: false
|
|
1544
|
+
}]
|
|
1545
|
+
}],
|
|
1546
|
+
presetFilters: [{
|
|
1547
|
+
type: i0.Input,
|
|
1548
|
+
args: [{
|
|
1549
|
+
isSignal: true,
|
|
1550
|
+
alias: "presetFilters",
|
|
1551
|
+
required: false
|
|
1552
|
+
}]
|
|
1553
|
+
}],
|
|
1554
|
+
data: [{
|
|
1555
|
+
type: i0.Input,
|
|
1556
|
+
args: [{
|
|
1557
|
+
isSignal: true,
|
|
1558
|
+
alias: "data",
|
|
1559
|
+
required: false
|
|
1560
|
+
}]
|
|
1561
|
+
}],
|
|
1562
|
+
search: [{
|
|
1563
|
+
type: i0.Input,
|
|
1564
|
+
args: [{
|
|
1565
|
+
isSignal: true,
|
|
1566
|
+
alias: "search",
|
|
1567
|
+
required: false
|
|
1568
|
+
}]
|
|
1569
|
+
}],
|
|
1570
|
+
columns: [{
|
|
1571
|
+
type: i0.Input,
|
|
1572
|
+
args: [{
|
|
1573
|
+
isSignal: true,
|
|
1574
|
+
alias: "columns",
|
|
1575
|
+
required: false
|
|
1576
|
+
}]
|
|
1577
|
+
}],
|
|
1578
|
+
reloadToken: [{
|
|
1579
|
+
type: i0.Input,
|
|
1580
|
+
args: [{
|
|
1581
|
+
isSignal: true,
|
|
1582
|
+
alias: "reloadToken",
|
|
1583
|
+
required: false
|
|
1584
|
+
}]
|
|
1585
|
+
}],
|
|
1586
|
+
deleted: [{
|
|
1587
|
+
type: i0.Input,
|
|
1588
|
+
args: [{
|
|
1589
|
+
isSignal: true,
|
|
1590
|
+
alias: "deleted",
|
|
1591
|
+
required: false
|
|
1592
|
+
}]
|
|
1593
|
+
}],
|
|
1594
|
+
parentDeleted: [{
|
|
1595
|
+
type: i0.Input,
|
|
1596
|
+
args: [{
|
|
1597
|
+
isSignal: true,
|
|
1598
|
+
alias: "parentDeleted",
|
|
1599
|
+
required: false
|
|
1600
|
+
}]
|
|
1601
|
+
}],
|
|
1602
|
+
settings: [{
|
|
1603
|
+
type: i0.Input,
|
|
1604
|
+
args: [{
|
|
1605
|
+
isSignal: true,
|
|
1606
|
+
alias: "settings",
|
|
1607
|
+
required: false
|
|
1608
|
+
}]
|
|
1609
|
+
}, {
|
|
1610
|
+
type: i0.Output,
|
|
1611
|
+
args: ["settingsChange"]
|
|
1612
|
+
}],
|
|
1613
|
+
selection: [{
|
|
1614
|
+
type: i0.Input,
|
|
1615
|
+
args: [{
|
|
1616
|
+
isSignal: true,
|
|
1617
|
+
alias: "selection",
|
|
1618
|
+
required: false
|
|
1619
|
+
}]
|
|
1620
|
+
}, {
|
|
1621
|
+
type: i0.Output,
|
|
1622
|
+
args: ["selectionChange"]
|
|
1623
|
+
}],
|
|
1624
|
+
rowRoute: [{
|
|
1625
|
+
type: i0.Input,
|
|
1626
|
+
args: [{
|
|
1627
|
+
isSignal: true,
|
|
1628
|
+
alias: "rowRoute",
|
|
1629
|
+
required: false
|
|
1630
|
+
}]
|
|
1631
|
+
}],
|
|
1632
|
+
selectionModeSetting: [{
|
|
1633
|
+
type: i0.Input,
|
|
1634
|
+
args: [{
|
|
1635
|
+
isSignal: true,
|
|
1636
|
+
alias: "selectionModeSetting",
|
|
1637
|
+
required: false
|
|
1638
|
+
}]
|
|
1639
|
+
}],
|
|
1640
|
+
error: [{
|
|
1641
|
+
type: i0.Output,
|
|
1642
|
+
args: ["error"]
|
|
1643
|
+
}],
|
|
1644
|
+
rowClicked: [{
|
|
1645
|
+
type: i0.Output,
|
|
1646
|
+
args: ["rowClicked"]
|
|
1647
|
+
}],
|
|
1648
|
+
customActionExecuted: [{
|
|
1649
|
+
type: i0.Output,
|
|
1650
|
+
args: ["customActionExecuted"]
|
|
1651
|
+
}],
|
|
1652
|
+
createClicked: [{
|
|
1653
|
+
type: i0.Output,
|
|
1654
|
+
args: ["createClicked"]
|
|
1655
|
+
}]
|
|
1656
|
+
}
|
|
1657
|
+
});
|
|
996
1658
|
function extractSourceName(source) {
|
|
997
|
-
|
|
998
|
-
|
|
1659
|
+
const dotIndex = source.indexOf(".");
|
|
1660
|
+
return dotIndex >= 0 ? source.substring(dotIndex + 1) : source;
|
|
999
1661
|
}
|
|
1000
|
-
/**
|
|
1001
|
-
* Enough English to map a query source onto a type name — `Cars` to `Car`, `People` to `Person`.
|
|
1002
|
-
*
|
|
1003
|
-
* Deliberately a small table plus three suffix rules rather than a library: it runs against type
|
|
1004
|
-
* names the application itself chose, and a wrong guess costs nothing, since the caller falls
|
|
1005
|
-
* through to matching the plural and the CLR type name.
|
|
1006
|
-
*/
|
|
1007
1662
|
function singularize(plural) {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
return plural.slice(0, -2);
|
|
1020
|
-
if (plural.endsWith('s'))
|
|
1021
|
-
return plural.slice(0, -1);
|
|
1022
|
-
return plural;
|
|
1663
|
+
const irregulars = {
|
|
1664
|
+
"People": "Person",
|
|
1665
|
+
"Children": "Child",
|
|
1666
|
+
"Men": "Man",
|
|
1667
|
+
"Women": "Woman"
|
|
1668
|
+
};
|
|
1669
|
+
if (irregulars[plural]) return irregulars[plural];
|
|
1670
|
+
if (plural.endsWith("ies")) return plural.slice(0, -3) + "y";
|
|
1671
|
+
if (plural.endsWith("es")) return plural.slice(0, -2);
|
|
1672
|
+
if (plural.endsWith("s")) return plural.slice(0, -1);
|
|
1673
|
+
return plural;
|
|
1023
1674
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
* server. Overriding a default needs no host; replacing one does.
|
|
1036
|
-
*
|
|
1037
|
-
* ## Two ways in, one set of templates
|
|
1038
|
-
*
|
|
1039
|
-
* Hand-written markup uses the structural directives and is found with `contentChildren`.
|
|
1040
|
-
* The auto-rendered path cannot: `spark-po-detail` is created by the router, so in a default app
|
|
1041
|
-
* there is no tag to project into. It therefore forwards `TemplateRef`s as inputs instead — a
|
|
1042
|
-
* directive cannot cross a component boundary but its template can, and that forwarding is
|
|
1043
|
-
* already the idiom in `spark-po-detail` (`extraActionsTemplate`, `extraContentTemplate`).
|
|
1044
|
-
*
|
|
1045
|
-
* Content wins over a forwarded input: the closer declaration is the more specific one.
|
|
1046
|
-
*/
|
|
1047
|
-
class SparkQueryCardComponent {
|
|
1048
|
-
lang = inject(SparkLanguageService);
|
|
1049
|
-
queryId = input.required(/* @ts-ignore */
|
|
1050
|
-
...(ngDevMode ? [{ debugName: "queryId" }] : /* istanbul ignore next */ []));
|
|
1051
|
-
parentId = input('', /* @ts-ignore */
|
|
1052
|
-
...(ngDevMode ? [{ debugName: "parentId" }] : /* istanbul ignore next */ []));
|
|
1053
|
-
parentType = input('', /* @ts-ignore */
|
|
1054
|
-
...(ngDevMode ? [{ debugName: "parentType" }] : /* istanbul ignore next */ []));
|
|
1055
|
-
reloadToken = input(null, /* @ts-ignore */
|
|
1056
|
-
...(ngDevMode ? [{ debugName: "reloadToken" }] : /* istanbul ignore next */ []));
|
|
1057
|
-
data = input(null, /* @ts-ignore */
|
|
1058
|
-
...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
1059
|
-
search = input('', /* @ts-ignore */
|
|
1060
|
-
...(ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []));
|
|
1061
|
-
/**
|
|
1062
|
-
* Slots forwarded from a host that cannot project content — see the class comment. A card
|
|
1063
|
-
* reached through hand-written markup should use the structural directives instead.
|
|
1064
|
-
*/
|
|
1065
|
-
iconTemplate = input(null, /* @ts-ignore */
|
|
1066
|
-
...(ngDevMode ? [{ debugName: "iconTemplate" }] : /* istanbul ignore next */ []));
|
|
1067
|
-
captionTemplate = input(null, /* @ts-ignore */
|
|
1068
|
-
...(ngDevMode ? [{ debugName: "captionTemplate" }] : /* istanbul ignore next */ []));
|
|
1069
|
-
actionsTemplate = input(null, /* @ts-ignore */
|
|
1070
|
-
...(ngDevMode ? [{ debugName: "actionsTemplate" }] : /* istanbul ignore next */ []));
|
|
1071
|
-
error = output();
|
|
1072
|
-
rowClicked = output();
|
|
1073
|
-
customActionExecuted = output();
|
|
1074
|
-
/**
|
|
1075
|
-
* Forwarded to the grid. Without this the escape hatch was unreachable from a card — i.e. from
|
|
1076
|
-
* every auto-rendered sub-query and program-unit query page, which is most grids.
|
|
1077
|
-
*/
|
|
1078
|
-
rowRoute = input(null, /* @ts-ignore */
|
|
1079
|
-
...(ngDevMode ? [{ debugName: "rowRoute" }] : /* istanbul ignore next */ []));
|
|
1080
|
-
colors = Color;
|
|
1081
|
-
iconSlots = contentChildren(SparkQueryIconDirective, /* @ts-ignore */
|
|
1082
|
-
...(ngDevMode ? [{ debugName: "iconSlots" }] : /* istanbul ignore next */ []));
|
|
1083
|
-
captionSlots = contentChildren(SparkQueryCaptionDirective, /* @ts-ignore */
|
|
1084
|
-
...(ngDevMode ? [{ debugName: "captionSlots" }] : /* istanbul ignore next */ []));
|
|
1085
|
-
actionSlots = contentChildren(SparkQueryActionsDirective, /* @ts-ignore */
|
|
1086
|
-
...(ngDevMode ? [{ debugName: "actionSlots" }] : /* istanbul ignore next */ []));
|
|
1087
|
-
/**
|
|
1088
|
-
* The grid, read only to surface its state — the query, the actions, the selection — to this
|
|
1089
|
-
* component's own header.
|
|
1090
|
-
*
|
|
1091
|
-
* Optional rather than `required` on purpose. The header renders ABOVE the grid in this
|
|
1092
|
-
* template, so on the first change-detection pass the view query has not resolved yet and
|
|
1093
|
-
* `viewChild.required()` would throw where a plain one returns `undefined`. Everything below
|
|
1094
|
-
* therefore reads it defensively; the signal updates once the view initialises and the header
|
|
1095
|
-
* re-renders with the real query.
|
|
1096
|
-
*
|
|
1097
|
-
* A host reads grid state through a template reference variable instead, because a host may put
|
|
1098
|
-
* the grid behind an `@if`, where a view query genuinely is intermittently undefined.
|
|
1099
|
-
*/
|
|
1100
|
-
grid = viewChild(SparkQueryGridComponent, /* @ts-ignore */
|
|
1101
|
-
...(ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []));
|
|
1102
|
-
query = computed(() => this.grid()?.query() ?? null, /* @ts-ignore */
|
|
1103
|
-
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
1104
|
-
iconTpl = computed(() => slotFor(this.iconSlots(), this.query())?.templateRef ?? this.iconTemplate(), /* @ts-ignore */
|
|
1105
|
-
...(ngDevMode ? [{ debugName: "iconTpl" }] : /* istanbul ignore next */ []));
|
|
1106
|
-
captionTpl = computed(() => slotFor(this.captionSlots(), this.query())?.templateRef ?? this.captionTemplate(), /* @ts-ignore */
|
|
1107
|
-
...(ngDevMode ? [{ debugName: "captionTpl" }] : /* istanbul ignore next */ []));
|
|
1108
|
-
actionsTpl = computed(() => slotFor(this.actionSlots(), this.query())?.templateRef ?? this.actionsTemplate(), /* @ts-ignore */
|
|
1109
|
-
...(ngDevMode ? [{ debugName: "actionsTpl" }] : /* istanbul ignore next */ []));
|
|
1110
|
-
/** The caption the card renders unless a slot replaces it. */
|
|
1111
|
-
caption = computed(() => {
|
|
1112
|
-
const q = this.query();
|
|
1113
|
-
return (q?.description ? this.lang.resolve(q.description) : '') || q?.name || '';
|
|
1114
|
-
}, /* @ts-ignore */
|
|
1115
|
-
...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
1116
|
-
customActions = computed(() => this.grid()?.visibleCustomActions() ?? [], /* @ts-ignore */
|
|
1117
|
-
...(ngDevMode ? [{ debugName: "customActions" }] : /* istanbul ignore next */ []));
|
|
1118
|
-
selection = computed(() => this.grid()?.selection() ?? [], /* @ts-ignore */
|
|
1119
|
-
...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
1120
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SparkQueryCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1121
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: SparkQueryCardComponent, isStandalone: true, selector: "spark-query-card", inputs: { queryId: { classPropertyName: "queryId", publicName: "queryId", isSignal: true, isRequired: true, transformFunction: null }, parentId: { classPropertyName: "parentId", publicName: "parentId", isSignal: true, isRequired: false, transformFunction: null }, parentType: { classPropertyName: "parentType", publicName: "parentType", isSignal: true, isRequired: false, transformFunction: null }, reloadToken: { classPropertyName: "reloadToken", publicName: "reloadToken", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, search: { classPropertyName: "search", publicName: "search", isSignal: true, isRequired: false, transformFunction: null }, iconTemplate: { classPropertyName: "iconTemplate", publicName: "iconTemplate", isSignal: true, isRequired: false, transformFunction: null }, captionTemplate: { classPropertyName: "captionTemplate", publicName: "captionTemplate", isSignal: true, isRequired: false, transformFunction: null }, actionsTemplate: { classPropertyName: "actionsTemplate", publicName: "actionsTemplate", isSignal: true, isRequired: false, transformFunction: null }, rowRoute: { classPropertyName: "rowRoute", publicName: "rowRoute", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { error: "error", rowClicked: "rowClicked", customActionExecuted: "customActionExecuted" }, queries: [{ propertyName: "iconSlots", predicate: SparkQueryIconDirective, isSignal: true }, { propertyName: "captionSlots", predicate: SparkQueryCaptionDirective, isSignal: true }, { propertyName: "actionSlots", predicate: SparkQueryActionsDirective, isSignal: true }], viewQueries: [{ propertyName: "grid", first: true, predicate: SparkQueryGridComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<!--\n The card is always rendered. A host that wants no card uses <spark-query-grid> directly \u2014 which\n is what the old `showCard=\"false\"` meant, expressed as a component choice rather than a flag.\n-->\n<bs-card class=\"d-block my-3\">\n <bs-card-header>\n <div class=\"d-flex align-items-center gap-2\">\n @if (iconTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: query() }\"></ng-container>\n }\n\n @if (actionsTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: customActions(), selection: selection(), query: query() }\"></ng-container>\n } @else if (customActions().length) {\n <!-- The default: the actions the server declares for this type. The nav renders only when\n there are any, so a query without actions is pixel-identical to a plain caption.\n\n Disabled, not hidden: hiding makes the affordance undiscoverable and reflows the\n priority nav on every selection change. The server enforces the same rule. -->\n <bs-priority-nav [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n @for (action of customActions(); track action.name) {\n <button *bsPriorityNavItem=\"10 + action.offset\" class=\"btn btn-sm btn-outline-primary\"\n [disabled]=\"!grid()?.isActionEnabled(action)\" (click)=\"grid()?.onCustomAction(action)\">\n {{ action.displayName | resolveTranslation }}\n </button>\n }\n </bs-priority-nav>\n }\n\n <!--\n Caption last, actions first. The auto margin is conditional rather than fixed, and that is\n the point: with actions present `ms-auto` pushes the caption to the trailing edge, and with\n none it falls back to `me-auto` so a plain card looks exactly as it always did. A fixed\n `ms-auto` would have right-aligned the caption of every action-less query card in every app\n \u2014 a change nobody asked for, to fix a layout only some cards have.\n -->\n <span [class.ms-auto]=\"customActions().length\" [class.me-auto]=\"!customActions().length\">\n @if (captionTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: caption(), query: query() }\"></ng-container>\n } @else {\n {{ caption() }}\n }\n </span>\n </div>\n </bs-card-header>\n\n <div class=\"p-3\">\n <spark-query-grid\n [queryId]=\"queryId()\"\n [parentId]=\"parentId()\"\n [parentType]=\"parentType()\"\n [reloadToken]=\"reloadToken()\"\n [data]=\"data()\"\n [search]=\"search()\"\n [rowRoute]=\"rowRoute()\"\n (error)=\"error.emit($event)\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n </div>\n</bs-card>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: BsCardComponent, selector: "bs-card", inputs: ["color", "outline"] }, { kind: "component", type: BsCardHeaderComponent, selector: "bs-card-header", inputs: ["color", "navStyle"] }, { kind: "component", type: BsPriorityNavComponent, selector: "bs-priority-nav", inputs: ["moreLabel", "moreLabelTemplate", "collapseAt", "overflowFrom", "hideEmptyMore", "ariaLabel"], outputs: ["overflowChange"] }, { kind: "directive", type: BsPriorityNavItemDirective, selector: "[bsPriorityNavItem]", inputs: ["bsPriorityNavItem", "bsPriorityNavItemHideBelow"] }, { kind: "component", type: SparkQueryGridComponent, selector: "spark-query-grid", inputs: ["queryId", "parentId", "parentType", "data", "search", "columns", "reloadToken", "settings", "selection", "rowRoute"], outputs: ["settingsChange", "selectionChange", "error", "rowClicked", "customActionExecuted"] }, { kind: "pipe", type: ResolveTranslationPipe, name: "resolveTranslation" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1675
|
+
function sparkActionClass(definition, size) {
|
|
1676
|
+
const variant = definition.variant?.toLowerCase();
|
|
1677
|
+
const sizeClass = size ? ` btn-${size}` : "";
|
|
1678
|
+
switch (variant) {
|
|
1679
|
+
case "danger":
|
|
1680
|
+
case "warning":
|
|
1681
|
+
case "primary":
|
|
1682
|
+
case "secondary":
|
|
1683
|
+
case "success": return `btn btn-${variant}${sizeClass}`;
|
|
1684
|
+
default: return `btn btn-outline-primary${sizeClass}`;
|
|
1685
|
+
}
|
|
1122
1686
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1687
|
+
const SPARK_SEARCH_DEBOUNCE_MS = 300;
|
|
1688
|
+
var SparkSearchBoxComponent = class SparkSearchBoxComponent {
|
|
1689
|
+
term = model("", ...ngDevMode ? [{ debugName: "term" }] : /* istanbul ignore next */ []);
|
|
1690
|
+
size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
1691
|
+
debounce = input(300, ...ngDevMode ? [{ debugName: "debounce" }] : /* istanbul ignore next */ []);
|
|
1692
|
+
text = signal("", ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
1693
|
+
timer = null;
|
|
1694
|
+
constructor() {
|
|
1695
|
+
effect(() => {
|
|
1696
|
+
const term = this.term();
|
|
1697
|
+
untracked(() => {
|
|
1698
|
+
if (term !== this.text()) {
|
|
1699
|
+
this.cancelPending();
|
|
1700
|
+
this.text.set(term);
|
|
1701
|
+
}
|
|
1702
|
+
});
|
|
1703
|
+
});
|
|
1704
|
+
inject(DestroyRef).onDestroy(() => this.cancelPending());
|
|
1705
|
+
}
|
|
1706
|
+
onInput(value) {
|
|
1707
|
+
this.text.set(value ?? "");
|
|
1708
|
+
this.cancelPending();
|
|
1709
|
+
const delay = this.debounce();
|
|
1710
|
+
if (delay <= 0 || !value) {
|
|
1711
|
+
this.term.set(value ?? "");
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
this.timer = setTimeout(() => {
|
|
1715
|
+
this.timer = null;
|
|
1716
|
+
this.term.set(this.text());
|
|
1717
|
+
}, delay);
|
|
1718
|
+
}
|
|
1719
|
+
clear() {
|
|
1720
|
+
this.cancelPending();
|
|
1721
|
+
this.text.set("");
|
|
1722
|
+
this.term.set("");
|
|
1723
|
+
}
|
|
1724
|
+
cancelPending() {
|
|
1725
|
+
if (this.timer !== null) {
|
|
1726
|
+
clearTimeout(this.timer);
|
|
1727
|
+
this.timer = null;
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1731
|
+
minVersion: "12.0.0",
|
|
1732
|
+
version: "22.2.0",
|
|
1733
|
+
ngImport: i0,
|
|
1734
|
+
type: SparkSearchBoxComponent,
|
|
1735
|
+
deps: [],
|
|
1736
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1737
|
+
});
|
|
1738
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1739
|
+
minVersion: "17.0.0",
|
|
1740
|
+
version: "22.2.0",
|
|
1741
|
+
type: SparkSearchBoxComponent,
|
|
1742
|
+
isStandalone: true,
|
|
1743
|
+
selector: "spark-search-box",
|
|
1744
|
+
inputs: {
|
|
1745
|
+
term: {
|
|
1746
|
+
classPropertyName: "term",
|
|
1747
|
+
publicName: "term",
|
|
1748
|
+
isSignal: true,
|
|
1749
|
+
isRequired: false,
|
|
1750
|
+
transformFunction: null
|
|
1751
|
+
},
|
|
1752
|
+
size: {
|
|
1753
|
+
classPropertyName: "size",
|
|
1754
|
+
publicName: "size",
|
|
1755
|
+
isSignal: true,
|
|
1756
|
+
isRequired: false,
|
|
1757
|
+
transformFunction: null
|
|
1758
|
+
},
|
|
1759
|
+
debounce: {
|
|
1760
|
+
classPropertyName: "debounce",
|
|
1761
|
+
publicName: "debounce",
|
|
1762
|
+
isSignal: true,
|
|
1763
|
+
isRequired: false,
|
|
1764
|
+
transformFunction: null
|
|
1765
|
+
}
|
|
1766
|
+
},
|
|
1767
|
+
outputs: { term: "termChange" },
|
|
1768
|
+
ngImport: i0,
|
|
1769
|
+
template: `
|
|
1770
|
+
<bs-form>
|
|
1771
|
+
<bs-input-group [size]="size()">
|
|
1772
|
+
<span class="addon">
|
|
1773
|
+
<spark-icon name="search" />
|
|
1774
|
+
</span>
|
|
1775
|
+
<input
|
|
1776
|
+
type="text"
|
|
1777
|
+
class="spark-search-input"
|
|
1778
|
+
[attr.aria-label]="'common.search' | t"
|
|
1779
|
+
[placeholder]="'common.search' | t"
|
|
1780
|
+
[ngModel]="text()"
|
|
1781
|
+
(ngModelChange)="onInput($event)"
|
|
1782
|
+
(keydown.escape)="clear()">
|
|
1783
|
+
@if (text()) {
|
|
1784
|
+
<button
|
|
1785
|
+
type="button"
|
|
1786
|
+
class="btn btn-outline-secondary spark-search-clear"
|
|
1787
|
+
[attr.aria-label]="'common.clearSearch' | t"
|
|
1788
|
+
(click)="clear()">
|
|
1789
|
+
<spark-icon name="x-lg" />
|
|
1790
|
+
</button>
|
|
1791
|
+
}
|
|
1792
|
+
</bs-input-group>
|
|
1793
|
+
</bs-form>
|
|
1794
|
+
`,
|
|
1795
|
+
isInline: true,
|
|
1796
|
+
styles: [":host{display:block}:host ::ng-deep form{margin:0}\n"],
|
|
1797
|
+
dependencies: [
|
|
1798
|
+
{
|
|
1799
|
+
kind: "ngmodule",
|
|
1800
|
+
type: FormsModule
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
kind: "directive",
|
|
1804
|
+
type: i1.DefaultValueAccessor,
|
|
1805
|
+
selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
|
|
1806
|
+
},
|
|
1807
|
+
{
|
|
1808
|
+
kind: "directive",
|
|
1809
|
+
type: i1.NgControlStatus,
|
|
1810
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
1811
|
+
},
|
|
1812
|
+
{
|
|
1813
|
+
kind: "directive",
|
|
1814
|
+
type: i1.NgModel,
|
|
1815
|
+
selector: "[ngModel]:not([formControlName]):not([formControl])",
|
|
1816
|
+
inputs: [
|
|
1817
|
+
"name",
|
|
1818
|
+
"disabled",
|
|
1819
|
+
"ngModel",
|
|
1820
|
+
"ngModelOptions"
|
|
1821
|
+
],
|
|
1822
|
+
outputs: ["ngModelChange"],
|
|
1823
|
+
exportAs: ["ngModel"]
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
kind: "component",
|
|
1827
|
+
type: BsFormComponent,
|
|
1828
|
+
selector: "bs-form",
|
|
1829
|
+
inputs: ["action", "method"],
|
|
1830
|
+
outputs: ["submitted"]
|
|
1831
|
+
},
|
|
1832
|
+
{
|
|
1833
|
+
kind: "directive",
|
|
1834
|
+
type: BsFormControlDirective,
|
|
1835
|
+
selector: "bs-form input:not(.no-form-control), bs-form textarea:not(.no-form-control)"
|
|
1836
|
+
},
|
|
1837
|
+
{
|
|
1838
|
+
kind: "component",
|
|
1839
|
+
type: BsInputGroupComponent,
|
|
1840
|
+
selector: "bs-input-group",
|
|
1841
|
+
inputs: ["size"]
|
|
1842
|
+
},
|
|
1843
|
+
{
|
|
1844
|
+
kind: "component",
|
|
1845
|
+
type: SparkIconComponent,
|
|
1846
|
+
selector: "spark-icon",
|
|
1847
|
+
inputs: ["name"]
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
kind: "pipe",
|
|
1851
|
+
type: TranslateKeyPipe,
|
|
1852
|
+
name: "t"
|
|
1853
|
+
}
|
|
1854
|
+
],
|
|
1855
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1856
|
+
});
|
|
1857
|
+
};
|
|
1858
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1859
|
+
minVersion: "12.0.0",
|
|
1860
|
+
version: "22.2.0",
|
|
1861
|
+
ngImport: i0,
|
|
1862
|
+
type: SparkSearchBoxComponent,
|
|
1863
|
+
decorators: [{
|
|
1864
|
+
type: Component,
|
|
1865
|
+
args: [{
|
|
1866
|
+
selector: "spark-search-box",
|
|
1867
|
+
imports: [
|
|
1868
|
+
FormsModule,
|
|
1869
|
+
BsFormComponent,
|
|
1870
|
+
BsFormControlDirective,
|
|
1871
|
+
BsInputGroupComponent,
|
|
1872
|
+
SparkIconComponent,
|
|
1873
|
+
TranslateKeyPipe
|
|
1874
|
+
],
|
|
1875
|
+
template: `
|
|
1876
|
+
<bs-form>
|
|
1877
|
+
<bs-input-group [size]="size()">
|
|
1878
|
+
<span class="addon">
|
|
1879
|
+
<spark-icon name="search" />
|
|
1880
|
+
</span>
|
|
1881
|
+
<input
|
|
1882
|
+
type="text"
|
|
1883
|
+
class="spark-search-input"
|
|
1884
|
+
[attr.aria-label]="'common.search' | t"
|
|
1885
|
+
[placeholder]="'common.search' | t"
|
|
1886
|
+
[ngModel]="text()"
|
|
1887
|
+
(ngModelChange)="onInput($event)"
|
|
1888
|
+
(keydown.escape)="clear()">
|
|
1889
|
+
@if (text()) {
|
|
1890
|
+
<button
|
|
1891
|
+
type="button"
|
|
1892
|
+
class="btn btn-outline-secondary spark-search-clear"
|
|
1893
|
+
[attr.aria-label]="'common.clearSearch' | t"
|
|
1894
|
+
(click)="clear()">
|
|
1895
|
+
<spark-icon name="x-lg" />
|
|
1896
|
+
</button>
|
|
1897
|
+
}
|
|
1898
|
+
</bs-input-group>
|
|
1899
|
+
</bs-form>
|
|
1900
|
+
`,
|
|
1901
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1902
|
+
styles: [":host{display:block}:host ::ng-deep form{margin:0}\n"]
|
|
1903
|
+
}]
|
|
1904
|
+
}],
|
|
1905
|
+
ctorParameters: () => [],
|
|
1906
|
+
propDecorators: {
|
|
1907
|
+
term: [{
|
|
1908
|
+
type: i0.Input,
|
|
1909
|
+
args: [{
|
|
1910
|
+
isSignal: true,
|
|
1911
|
+
alias: "term",
|
|
1912
|
+
required: false
|
|
1913
|
+
}]
|
|
1914
|
+
}, {
|
|
1915
|
+
type: i0.Output,
|
|
1916
|
+
args: ["termChange"]
|
|
1917
|
+
}],
|
|
1918
|
+
size: [{
|
|
1919
|
+
type: i0.Input,
|
|
1920
|
+
args: [{
|
|
1921
|
+
isSignal: true,
|
|
1922
|
+
alias: "size",
|
|
1923
|
+
required: false
|
|
1924
|
+
}]
|
|
1925
|
+
}],
|
|
1926
|
+
debounce: [{
|
|
1927
|
+
type: i0.Input,
|
|
1928
|
+
args: [{
|
|
1929
|
+
isSignal: true,
|
|
1930
|
+
alias: "debounce",
|
|
1931
|
+
required: false
|
|
1932
|
+
}]
|
|
1933
|
+
}]
|
|
1934
|
+
}
|
|
1935
|
+
});
|
|
1936
|
+
var SparkQueryCardComponent = class SparkQueryCardComponent {
|
|
1937
|
+
lang = inject(SparkLanguageService);
|
|
1938
|
+
queryId = input.required(...ngDevMode ? [{ debugName: "queryId" }] : /* istanbul ignore next */ []);
|
|
1939
|
+
parentId = input("", ...ngDevMode ? [{ debugName: "parentId" }] : /* istanbul ignore next */ []);
|
|
1940
|
+
parentType = input("", ...ngDevMode ? [{ debugName: "parentType" }] : /* istanbul ignore next */ []);
|
|
1941
|
+
reloadToken = input(null, ...ngDevMode ? [{ debugName: "reloadToken" }] : /* istanbul ignore next */ []);
|
|
1942
|
+
data = input(null, ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
1943
|
+
search = input("", ...ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []);
|
|
1944
|
+
searchable = input(true, ...ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []);
|
|
1945
|
+
searchTerm = linkedSignal(() => this.search(), ...ngDevMode ? [{ debugName: "searchTerm" }] : /* istanbul ignore next */ []);
|
|
1946
|
+
showSearch = computed(() => this.searchable() && this.data() === null, ...ngDevMode ? [{ debugName: "showSearch" }] : /* istanbul ignore next */ []);
|
|
1947
|
+
selectionMode = input(null, ...ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []);
|
|
1948
|
+
deleted = input(null, ...ngDevMode ? [{ debugName: "deleted" }] : /* istanbul ignore next */ []);
|
|
1949
|
+
parentDeleted = input(false, ...ngDevMode ? [{ debugName: "parentDeleted" }] : /* istanbul ignore next */ []);
|
|
1950
|
+
iconTemplate = input(null, ...ngDevMode ? [{ debugName: "iconTemplate" }] : /* istanbul ignore next */ []);
|
|
1951
|
+
captionTemplate = input(null, ...ngDevMode ? [{ debugName: "captionTemplate" }] : /* istanbul ignore next */ []);
|
|
1952
|
+
actionsTemplate = input(null, ...ngDevMode ? [{ debugName: "actionsTemplate" }] : /* istanbul ignore next */ []);
|
|
1953
|
+
error = output();
|
|
1954
|
+
rowClicked = output();
|
|
1955
|
+
customActionExecuted = output();
|
|
1956
|
+
rowRoute = input(null, ...ngDevMode ? [{ debugName: "rowRoute" }] : /* istanbul ignore next */ []);
|
|
1957
|
+
colors = Color;
|
|
1958
|
+
iconSlots = contentChildren(SparkQueryIconDirective, ...ngDevMode ? [{ debugName: "iconSlots" }] : /* istanbul ignore next */ []);
|
|
1959
|
+
captionSlots = contentChildren(SparkQueryCaptionDirective, ...ngDevMode ? [{ debugName: "captionSlots" }] : /* istanbul ignore next */ []);
|
|
1960
|
+
actionSlots = contentChildren(SparkQueryActionsDirective, ...ngDevMode ? [{ debugName: "actionSlots" }] : /* istanbul ignore next */ []);
|
|
1961
|
+
grid = viewChild(SparkQueryGridComponent, ...ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []);
|
|
1962
|
+
query = computed(() => this.grid()?.query() ?? null, ...ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []);
|
|
1963
|
+
iconTpl = computed(() => slotFor(this.iconSlots(), this.query())?.templateRef ?? this.iconTemplate(), ...ngDevMode ? [{ debugName: "iconTpl" }] : /* istanbul ignore next */ []);
|
|
1964
|
+
captionTpl = computed(() => slotFor(this.captionSlots(), this.query())?.templateRef ?? this.captionTemplate(), ...ngDevMode ? [{ debugName: "captionTpl" }] : /* istanbul ignore next */ []);
|
|
1965
|
+
actionsTpl = computed(() => slotFor(this.actionSlots(), this.query())?.templateRef ?? this.actionsTemplate(), ...ngDevMode ? [{ debugName: "actionsTpl" }] : /* istanbul ignore next */ []);
|
|
1966
|
+
caption = computed(() => {
|
|
1967
|
+
const q = this.query();
|
|
1968
|
+
return (q?.description ? this.lang.resolve(q.description) : "") || q?.name || "";
|
|
1969
|
+
}, ...ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []);
|
|
1970
|
+
customActions = computed(() => this.grid()?.visibleCustomActions() ?? [], ...ngDevMode ? [{ debugName: "customActions" }] : /* istanbul ignore next */ []);
|
|
1971
|
+
toolbarActions = computed(() => this.grid()?.toolbarActions() ?? [], ...ngDevMode ? [{ debugName: "toolbarActions" }] : /* istanbul ignore next */ []);
|
|
1972
|
+
actionClass(action) {
|
|
1973
|
+
return `${sparkActionClass(action.definition, "sm")} rounded-0`;
|
|
1974
|
+
}
|
|
1975
|
+
isEnabled(action) {
|
|
1976
|
+
return this.grid()?.isToolbarActionEnabled(action) ?? false;
|
|
1977
|
+
}
|
|
1978
|
+
run(action) {
|
|
1979
|
+
this.grid()?.runToolbarAction(action);
|
|
1980
|
+
}
|
|
1981
|
+
selection = computed(() => this.grid()?.selection() ?? [], ...ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []);
|
|
1982
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1983
|
+
minVersion: "12.0.0",
|
|
1984
|
+
version: "22.2.0",
|
|
1985
|
+
ngImport: i0,
|
|
1986
|
+
type: SparkQueryCardComponent,
|
|
1987
|
+
deps: [],
|
|
1988
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1989
|
+
});
|
|
1990
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1991
|
+
minVersion: "17.0.0",
|
|
1992
|
+
version: "22.2.0",
|
|
1993
|
+
type: SparkQueryCardComponent,
|
|
1994
|
+
isStandalone: true,
|
|
1995
|
+
selector: "spark-query-card",
|
|
1996
|
+
inputs: {
|
|
1997
|
+
queryId: {
|
|
1998
|
+
classPropertyName: "queryId",
|
|
1999
|
+
publicName: "queryId",
|
|
2000
|
+
isSignal: true,
|
|
2001
|
+
isRequired: true,
|
|
2002
|
+
transformFunction: null
|
|
2003
|
+
},
|
|
2004
|
+
parentId: {
|
|
2005
|
+
classPropertyName: "parentId",
|
|
2006
|
+
publicName: "parentId",
|
|
2007
|
+
isSignal: true,
|
|
2008
|
+
isRequired: false,
|
|
2009
|
+
transformFunction: null
|
|
2010
|
+
},
|
|
2011
|
+
parentType: {
|
|
2012
|
+
classPropertyName: "parentType",
|
|
2013
|
+
publicName: "parentType",
|
|
2014
|
+
isSignal: true,
|
|
2015
|
+
isRequired: false,
|
|
2016
|
+
transformFunction: null
|
|
2017
|
+
},
|
|
2018
|
+
reloadToken: {
|
|
2019
|
+
classPropertyName: "reloadToken",
|
|
2020
|
+
publicName: "reloadToken",
|
|
2021
|
+
isSignal: true,
|
|
2022
|
+
isRequired: false,
|
|
2023
|
+
transformFunction: null
|
|
2024
|
+
},
|
|
2025
|
+
data: {
|
|
2026
|
+
classPropertyName: "data",
|
|
2027
|
+
publicName: "data",
|
|
2028
|
+
isSignal: true,
|
|
2029
|
+
isRequired: false,
|
|
2030
|
+
transformFunction: null
|
|
2031
|
+
},
|
|
2032
|
+
search: {
|
|
2033
|
+
classPropertyName: "search",
|
|
2034
|
+
publicName: "search",
|
|
2035
|
+
isSignal: true,
|
|
2036
|
+
isRequired: false,
|
|
2037
|
+
transformFunction: null
|
|
2038
|
+
},
|
|
2039
|
+
searchable: {
|
|
2040
|
+
classPropertyName: "searchable",
|
|
2041
|
+
publicName: "searchable",
|
|
2042
|
+
isSignal: true,
|
|
2043
|
+
isRequired: false,
|
|
2044
|
+
transformFunction: null
|
|
2045
|
+
},
|
|
2046
|
+
selectionMode: {
|
|
2047
|
+
classPropertyName: "selectionMode",
|
|
2048
|
+
publicName: "selectionMode",
|
|
2049
|
+
isSignal: true,
|
|
2050
|
+
isRequired: false,
|
|
2051
|
+
transformFunction: null
|
|
2052
|
+
},
|
|
2053
|
+
deleted: {
|
|
2054
|
+
classPropertyName: "deleted",
|
|
2055
|
+
publicName: "deleted",
|
|
2056
|
+
isSignal: true,
|
|
2057
|
+
isRequired: false,
|
|
2058
|
+
transformFunction: null
|
|
2059
|
+
},
|
|
2060
|
+
parentDeleted: {
|
|
2061
|
+
classPropertyName: "parentDeleted",
|
|
2062
|
+
publicName: "parentDeleted",
|
|
2063
|
+
isSignal: true,
|
|
2064
|
+
isRequired: false,
|
|
2065
|
+
transformFunction: null
|
|
2066
|
+
},
|
|
2067
|
+
iconTemplate: {
|
|
2068
|
+
classPropertyName: "iconTemplate",
|
|
2069
|
+
publicName: "iconTemplate",
|
|
2070
|
+
isSignal: true,
|
|
2071
|
+
isRequired: false,
|
|
2072
|
+
transformFunction: null
|
|
2073
|
+
},
|
|
2074
|
+
captionTemplate: {
|
|
2075
|
+
classPropertyName: "captionTemplate",
|
|
2076
|
+
publicName: "captionTemplate",
|
|
2077
|
+
isSignal: true,
|
|
2078
|
+
isRequired: false,
|
|
2079
|
+
transformFunction: null
|
|
2080
|
+
},
|
|
2081
|
+
actionsTemplate: {
|
|
2082
|
+
classPropertyName: "actionsTemplate",
|
|
2083
|
+
publicName: "actionsTemplate",
|
|
2084
|
+
isSignal: true,
|
|
2085
|
+
isRequired: false,
|
|
2086
|
+
transformFunction: null
|
|
2087
|
+
},
|
|
2088
|
+
rowRoute: {
|
|
2089
|
+
classPropertyName: "rowRoute",
|
|
2090
|
+
publicName: "rowRoute",
|
|
2091
|
+
isSignal: true,
|
|
2092
|
+
isRequired: false,
|
|
2093
|
+
transformFunction: null
|
|
2094
|
+
}
|
|
2095
|
+
},
|
|
2096
|
+
outputs: {
|
|
2097
|
+
error: "error",
|
|
2098
|
+
rowClicked: "rowClicked",
|
|
2099
|
+
customActionExecuted: "customActionExecuted"
|
|
2100
|
+
},
|
|
2101
|
+
queries: [
|
|
2102
|
+
{
|
|
2103
|
+
propertyName: "iconSlots",
|
|
2104
|
+
predicate: SparkQueryIconDirective,
|
|
2105
|
+
isSignal: true
|
|
2106
|
+
},
|
|
2107
|
+
{
|
|
2108
|
+
propertyName: "captionSlots",
|
|
2109
|
+
predicate: SparkQueryCaptionDirective,
|
|
2110
|
+
isSignal: true
|
|
2111
|
+
},
|
|
2112
|
+
{
|
|
2113
|
+
propertyName: "actionSlots",
|
|
2114
|
+
predicate: SparkQueryActionsDirective,
|
|
2115
|
+
isSignal: true
|
|
2116
|
+
}
|
|
2117
|
+
],
|
|
2118
|
+
viewQueries: [{
|
|
2119
|
+
propertyName: "grid",
|
|
2120
|
+
first: true,
|
|
2121
|
+
predicate: SparkQueryGridComponent,
|
|
2122
|
+
descendants: true,
|
|
2123
|
+
isSignal: true
|
|
2124
|
+
}],
|
|
2125
|
+
ngImport: i0,
|
|
2126
|
+
template: "<!--\n The card is always rendered. A host that wants no card uses <spark-query-grid> directly — which\n is what the old `showCard=\"false\"` meant, expressed as a component choice rather than a flag.\n-->\n<bs-card class=\"d-block my-3\">\n <bs-card-header>\n <div class=\"d-flex align-items-center gap-2\">\n @if (iconTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: query() }\"></ng-container>\n }\n\n <!--\n Caption first, actions on the trailing edge (#460 M15, as query-grid-card-PRD.md always said,\n and as Vidyano's sub-query tabs do). `me-auto` on the caption pushes the actions right; a card\n without actions looks exactly as a plain caption did.\n -->\n <span class=\"me-auto spark-query-card-caption\">\n @if (captionTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: caption(), query: query() }\"></ng-container>\n } @else {\n {{ caption() }}\n }\n </span>\n\n @if (actionsTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: customActions(), actions: toolbarActions(), selection: selection(), query: query() }\"></ng-container>\n } @else if (toolbarActions().length) {\n <!-- The default: New, Delete and the custom actions the server offers this caller, with the\n overflow in the priority nav under the translated \"More\" (common.more). The nav renders only when there are any.\n\n Disabled, not hidden: hiding makes the affordance undiscoverable and reflows the\n priority nav on every selection change. The server enforces the same rules. -->\n <bs-priority-nav class=\"spark-query-card-actions\" [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n @for (action of toolbarActions(); track action.name) {\n <button *bsPriorityNavItem=\"action.priority\" type=\"button\" [class]=\"actionClass(action)\"\n [attr.data-action]=\"action.name\"\n [disabled]=\"!isEnabled(action)\" (click)=\"run(action)\">\n @if (action.definition.icon && action.kind !== 'custom') {\n <spark-icon [name]=\"action.definition.icon\" />\n }\n {{ action.definition.displayName | resolveTranslation }}\n </button>\n }\n </bs-priority-nav>\n }\n\n <!-- The query search, on the trailing edge next to the actions, as Vidyano's sub-query tabs\n have it (#460 M15, D17 addendum). The same box as the query-list page; it feeds the\n grid's `search`, which the server applies together with the parent. Absent for bound\n `data`, which the grid never refetches. -->\n @if (showSearch()) {\n <spark-search-box class=\"spark-query-card-search\" size=\"sm\" [(term)]=\"searchTerm\" />\n }\n </div>\n </bs-card-header>\n\n <div class=\"p-3\">\n <spark-query-grid\n [queryId]=\"queryId()\"\n [parentId]=\"parentId()\"\n [parentType]=\"parentType()\"\n [reloadToken]=\"reloadToken()\"\n [data]=\"data()\"\n [search]=\"searchTerm()\"\n [rowRoute]=\"rowRoute()\"\n [selectionModeSetting]=\"selectionMode()\"\n [deleted]=\"deleted()\"\n [parentDeleted]=\"parentDeleted()\"\n (error)=\"error.emit($event)\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n </div>\n</bs-card>\n",
|
|
2127
|
+
styles: [".spark-query-card-search{flex:0 1 14rem;min-width:8rem}\n"],
|
|
2128
|
+
dependencies: [
|
|
2129
|
+
{
|
|
2130
|
+
kind: "ngmodule",
|
|
2131
|
+
type: CommonModule
|
|
2132
|
+
},
|
|
2133
|
+
{
|
|
2134
|
+
kind: "directive",
|
|
2135
|
+
type: i1$1.NgTemplateOutlet,
|
|
2136
|
+
selector: "[ngTemplateOutlet]",
|
|
2137
|
+
inputs: [
|
|
2138
|
+
"ngTemplateOutletContext",
|
|
2139
|
+
"ngTemplateOutlet",
|
|
2140
|
+
"ngTemplateOutletInjector"
|
|
2141
|
+
]
|
|
2142
|
+
},
|
|
2143
|
+
{
|
|
2144
|
+
kind: "component",
|
|
2145
|
+
type: BsCardComponent,
|
|
2146
|
+
selector: "bs-card",
|
|
2147
|
+
inputs: ["color", "outline"]
|
|
2148
|
+
},
|
|
2149
|
+
{
|
|
2150
|
+
kind: "component",
|
|
2151
|
+
type: BsCardHeaderComponent,
|
|
2152
|
+
selector: "bs-card-header",
|
|
2153
|
+
inputs: ["color", "navStyle"]
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
kind: "component",
|
|
2157
|
+
type: BsPriorityNavComponent,
|
|
2158
|
+
selector: "bs-priority-nav",
|
|
2159
|
+
inputs: [
|
|
2160
|
+
"moreLabel",
|
|
2161
|
+
"moreLabelTemplate",
|
|
2162
|
+
"collapseAt",
|
|
2163
|
+
"overflowFrom",
|
|
2164
|
+
"hideEmptyMore",
|
|
2165
|
+
"ariaLabel"
|
|
2166
|
+
],
|
|
2167
|
+
outputs: ["overflowChange"]
|
|
2168
|
+
},
|
|
2169
|
+
{
|
|
2170
|
+
kind: "directive",
|
|
2171
|
+
type: BsPriorityNavItemDirective,
|
|
2172
|
+
selector: "[bsPriorityNavItem]",
|
|
2173
|
+
inputs: ["bsPriorityNavItem", "bsPriorityNavItemHideBelow"]
|
|
2174
|
+
},
|
|
2175
|
+
{
|
|
2176
|
+
kind: "component",
|
|
2177
|
+
type: SparkQueryGridComponent,
|
|
2178
|
+
selector: "spark-query-grid",
|
|
2179
|
+
inputs: [
|
|
2180
|
+
"queryId",
|
|
2181
|
+
"parentId",
|
|
2182
|
+
"parentType",
|
|
2183
|
+
"presetFilters",
|
|
2184
|
+
"data",
|
|
2185
|
+
"search",
|
|
2186
|
+
"columns",
|
|
2187
|
+
"reloadToken",
|
|
2188
|
+
"deleted",
|
|
2189
|
+
"parentDeleted",
|
|
2190
|
+
"settings",
|
|
2191
|
+
"selection",
|
|
2192
|
+
"rowRoute",
|
|
2193
|
+
"selectionModeSetting"
|
|
2194
|
+
],
|
|
2195
|
+
outputs: [
|
|
2196
|
+
"settingsChange",
|
|
2197
|
+
"selectionChange",
|
|
2198
|
+
"error",
|
|
2199
|
+
"rowClicked",
|
|
2200
|
+
"customActionExecuted",
|
|
2201
|
+
"createClicked"
|
|
2202
|
+
]
|
|
2203
|
+
},
|
|
2204
|
+
{
|
|
2205
|
+
kind: "component",
|
|
2206
|
+
type: SparkSearchBoxComponent,
|
|
2207
|
+
selector: "spark-search-box",
|
|
2208
|
+
inputs: [
|
|
2209
|
+
"term",
|
|
2210
|
+
"size",
|
|
2211
|
+
"debounce"
|
|
2212
|
+
],
|
|
2213
|
+
outputs: ["termChange"]
|
|
2214
|
+
},
|
|
2215
|
+
{
|
|
2216
|
+
kind: "component",
|
|
2217
|
+
type: SparkIconComponent,
|
|
2218
|
+
selector: "spark-icon",
|
|
2219
|
+
inputs: ["name"]
|
|
2220
|
+
},
|
|
2221
|
+
{
|
|
2222
|
+
kind: "pipe",
|
|
2223
|
+
type: ResolveTranslationPipe,
|
|
2224
|
+
name: "resolveTranslation"
|
|
2225
|
+
}
|
|
2226
|
+
],
|
|
2227
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
2228
|
+
});
|
|
2229
|
+
};
|
|
2230
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
2231
|
+
minVersion: "12.0.0",
|
|
2232
|
+
version: "22.2.0",
|
|
2233
|
+
ngImport: i0,
|
|
2234
|
+
type: SparkQueryCardComponent,
|
|
2235
|
+
decorators: [{
|
|
2236
|
+
type: Component,
|
|
2237
|
+
args: [{
|
|
2238
|
+
selector: "spark-query-card",
|
|
2239
|
+
imports: [
|
|
2240
|
+
CommonModule,
|
|
2241
|
+
BsCardComponent,
|
|
2242
|
+
BsCardHeaderComponent,
|
|
2243
|
+
BsPriorityNavComponent,
|
|
2244
|
+
BsPriorityNavItemDirective,
|
|
2245
|
+
SparkQueryGridComponent,
|
|
2246
|
+
SparkSearchBoxComponent,
|
|
2247
|
+
ResolveTranslationPipe,
|
|
2248
|
+
SparkIconComponent
|
|
2249
|
+
],
|
|
2250
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2251
|
+
template: "<!--\n The card is always rendered. A host that wants no card uses <spark-query-grid> directly — which\n is what the old `showCard=\"false\"` meant, expressed as a component choice rather than a flag.\n-->\n<bs-card class=\"d-block my-3\">\n <bs-card-header>\n <div class=\"d-flex align-items-center gap-2\">\n @if (iconTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: query() }\"></ng-container>\n }\n\n <!--\n Caption first, actions on the trailing edge (#460 M15, as query-grid-card-PRD.md always said,\n and as Vidyano's sub-query tabs do). `me-auto` on the caption pushes the actions right; a card\n without actions looks exactly as a plain caption did.\n -->\n <span class=\"me-auto spark-query-card-caption\">\n @if (captionTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: caption(), query: query() }\"></ng-container>\n } @else {\n {{ caption() }}\n }\n </span>\n\n @if (actionsTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: customActions(), actions: toolbarActions(), selection: selection(), query: query() }\"></ng-container>\n } @else if (toolbarActions().length) {\n <!-- The default: New, Delete and the custom actions the server offers this caller, with the\n overflow in the priority nav under the translated \"More\" (common.more). The nav renders only when there are any.\n\n Disabled, not hidden: hiding makes the affordance undiscoverable and reflows the\n priority nav on every selection change. The server enforces the same rules. -->\n <bs-priority-nav class=\"spark-query-card-actions\" [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n @for (action of toolbarActions(); track action.name) {\n <button *bsPriorityNavItem=\"action.priority\" type=\"button\" [class]=\"actionClass(action)\"\n [attr.data-action]=\"action.name\"\n [disabled]=\"!isEnabled(action)\" (click)=\"run(action)\">\n @if (action.definition.icon && action.kind !== 'custom') {\n <spark-icon [name]=\"action.definition.icon\" />\n }\n {{ action.definition.displayName | resolveTranslation }}\n </button>\n }\n </bs-priority-nav>\n }\n\n <!-- The query search, on the trailing edge next to the actions, as Vidyano's sub-query tabs\n have it (#460 M15, D17 addendum). The same box as the query-list page; it feeds the\n grid's `search`, which the server applies together with the parent. Absent for bound\n `data`, which the grid never refetches. -->\n @if (showSearch()) {\n <spark-search-box class=\"spark-query-card-search\" size=\"sm\" [(term)]=\"searchTerm\" />\n }\n </div>\n </bs-card-header>\n\n <div class=\"p-3\">\n <spark-query-grid\n [queryId]=\"queryId()\"\n [parentId]=\"parentId()\"\n [parentType]=\"parentType()\"\n [reloadToken]=\"reloadToken()\"\n [data]=\"data()\"\n [search]=\"searchTerm()\"\n [rowRoute]=\"rowRoute()\"\n [selectionModeSetting]=\"selectionMode()\"\n [deleted]=\"deleted()\"\n [parentDeleted]=\"parentDeleted()\"\n (error)=\"error.emit($event)\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n </div>\n</bs-card>\n",
|
|
2252
|
+
styles: [".spark-query-card-search{flex:0 1 14rem;min-width:8rem}\n"]
|
|
2253
|
+
}]
|
|
2254
|
+
}],
|
|
2255
|
+
propDecorators: {
|
|
2256
|
+
queryId: [{
|
|
2257
|
+
type: i0.Input,
|
|
2258
|
+
args: [{
|
|
2259
|
+
isSignal: true,
|
|
2260
|
+
alias: "queryId",
|
|
2261
|
+
required: true
|
|
2262
|
+
}]
|
|
2263
|
+
}],
|
|
2264
|
+
parentId: [{
|
|
2265
|
+
type: i0.Input,
|
|
2266
|
+
args: [{
|
|
2267
|
+
isSignal: true,
|
|
2268
|
+
alias: "parentId",
|
|
2269
|
+
required: false
|
|
2270
|
+
}]
|
|
2271
|
+
}],
|
|
2272
|
+
parentType: [{
|
|
2273
|
+
type: i0.Input,
|
|
2274
|
+
args: [{
|
|
2275
|
+
isSignal: true,
|
|
2276
|
+
alias: "parentType",
|
|
2277
|
+
required: false
|
|
2278
|
+
}]
|
|
2279
|
+
}],
|
|
2280
|
+
reloadToken: [{
|
|
2281
|
+
type: i0.Input,
|
|
2282
|
+
args: [{
|
|
2283
|
+
isSignal: true,
|
|
2284
|
+
alias: "reloadToken",
|
|
2285
|
+
required: false
|
|
2286
|
+
}]
|
|
2287
|
+
}],
|
|
2288
|
+
data: [{
|
|
2289
|
+
type: i0.Input,
|
|
2290
|
+
args: [{
|
|
2291
|
+
isSignal: true,
|
|
2292
|
+
alias: "data",
|
|
2293
|
+
required: false
|
|
2294
|
+
}]
|
|
2295
|
+
}],
|
|
2296
|
+
search: [{
|
|
2297
|
+
type: i0.Input,
|
|
2298
|
+
args: [{
|
|
2299
|
+
isSignal: true,
|
|
2300
|
+
alias: "search",
|
|
2301
|
+
required: false
|
|
2302
|
+
}]
|
|
2303
|
+
}],
|
|
2304
|
+
searchable: [{
|
|
2305
|
+
type: i0.Input,
|
|
2306
|
+
args: [{
|
|
2307
|
+
isSignal: true,
|
|
2308
|
+
alias: "searchable",
|
|
2309
|
+
required: false
|
|
2310
|
+
}]
|
|
2311
|
+
}],
|
|
2312
|
+
selectionMode: [{
|
|
2313
|
+
type: i0.Input,
|
|
2314
|
+
args: [{
|
|
2315
|
+
isSignal: true,
|
|
2316
|
+
alias: "selectionMode",
|
|
2317
|
+
required: false
|
|
2318
|
+
}]
|
|
2319
|
+
}],
|
|
2320
|
+
deleted: [{
|
|
2321
|
+
type: i0.Input,
|
|
2322
|
+
args: [{
|
|
2323
|
+
isSignal: true,
|
|
2324
|
+
alias: "deleted",
|
|
2325
|
+
required: false
|
|
2326
|
+
}]
|
|
2327
|
+
}],
|
|
2328
|
+
parentDeleted: [{
|
|
2329
|
+
type: i0.Input,
|
|
2330
|
+
args: [{
|
|
2331
|
+
isSignal: true,
|
|
2332
|
+
alias: "parentDeleted",
|
|
2333
|
+
required: false
|
|
2334
|
+
}]
|
|
2335
|
+
}],
|
|
2336
|
+
iconTemplate: [{
|
|
2337
|
+
type: i0.Input,
|
|
2338
|
+
args: [{
|
|
2339
|
+
isSignal: true,
|
|
2340
|
+
alias: "iconTemplate",
|
|
2341
|
+
required: false
|
|
2342
|
+
}]
|
|
2343
|
+
}],
|
|
2344
|
+
captionTemplate: [{
|
|
2345
|
+
type: i0.Input,
|
|
2346
|
+
args: [{
|
|
2347
|
+
isSignal: true,
|
|
2348
|
+
alias: "captionTemplate",
|
|
2349
|
+
required: false
|
|
2350
|
+
}]
|
|
2351
|
+
}],
|
|
2352
|
+
actionsTemplate: [{
|
|
2353
|
+
type: i0.Input,
|
|
2354
|
+
args: [{
|
|
2355
|
+
isSignal: true,
|
|
2356
|
+
alias: "actionsTemplate",
|
|
2357
|
+
required: false
|
|
2358
|
+
}]
|
|
2359
|
+
}],
|
|
2360
|
+
error: [{
|
|
2361
|
+
type: i0.Output,
|
|
2362
|
+
args: ["error"]
|
|
2363
|
+
}],
|
|
2364
|
+
rowClicked: [{
|
|
2365
|
+
type: i0.Output,
|
|
2366
|
+
args: ["rowClicked"]
|
|
2367
|
+
}],
|
|
2368
|
+
customActionExecuted: [{
|
|
2369
|
+
type: i0.Output,
|
|
2370
|
+
args: ["customActionExecuted"]
|
|
2371
|
+
}],
|
|
2372
|
+
rowRoute: [{
|
|
2373
|
+
type: i0.Input,
|
|
2374
|
+
args: [{
|
|
2375
|
+
isSignal: true,
|
|
2376
|
+
alias: "rowRoute",
|
|
2377
|
+
required: false
|
|
2378
|
+
}]
|
|
2379
|
+
}],
|
|
2380
|
+
iconSlots: [{
|
|
2381
|
+
type: i0.ContentChildren,
|
|
2382
|
+
args: [i0.forwardRef(() => SparkQueryIconDirective), { isSignal: true }]
|
|
2383
|
+
}],
|
|
2384
|
+
captionSlots: [{
|
|
2385
|
+
type: i0.ContentChildren,
|
|
2386
|
+
args: [i0.forwardRef(() => SparkQueryCaptionDirective), { isSignal: true }]
|
|
2387
|
+
}],
|
|
2388
|
+
actionSlots: [{
|
|
2389
|
+
type: i0.ContentChildren,
|
|
2390
|
+
args: [i0.forwardRef(() => SparkQueryActionsDirective), { isSignal: true }]
|
|
2391
|
+
}],
|
|
2392
|
+
grid: [{
|
|
2393
|
+
type: i0.ViewChild,
|
|
2394
|
+
args: [i0.forwardRef(() => SparkQueryGridComponent), { isSignal: true }]
|
|
2395
|
+
}]
|
|
2396
|
+
}
|
|
2397
|
+
});
|
|
2398
|
+
export { SPARK_GRID_PAGE_SIZES, SPARK_SEARCH_DEBOUNCE_MS, SparkGridCellComponent, SparkGridRenderers, SparkQueryActionsContext, SparkQueryActionsDirective, SparkQueryCaptionContext, SparkQueryCaptionDirective, SparkQueryCardComponent, SparkQueryGridComponent, SparkQueryIconDirective, SparkQuerySlotContext, SparkSearchBoxComponent, applicablePresetFilters, initialGridSettings, isVirtualScrollingQuery, slotFor, sparkActionClass, visibleGridAttributes };
|
|
1131
2399
|
|
|
1132
|
-
|
|
1133
|
-
//# sourceMappingURL=mintplayer-ng-spark-grid.mjs.map
|
|
2400
|
+
//# sourceMappingURL=mintplayer-ng-spark-grid.mjs.map
|