@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
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, Injectable, computed, effect, inject, input, output, signal, untracked } from "@angular/core";
|
|
3
|
+
import { SparkLanguageService, SparkService } from "@mintplayer/ng-spark/services";
|
|
4
|
+
import { ShowedOn, comparableValue, hasShowedOnFlag, valueFor } from "@mintplayer/ng-spark/models";
|
|
5
|
+
import { DatePipe } from "@angular/common";
|
|
6
|
+
import { Color } from "@mintplayer/ng-bootstrap";
|
|
7
|
+
import { BsAlertComponent } from "@mintplayer/ng-bootstrap/alert";
|
|
8
|
+
import { BsBadgeComponent } from "@mintplayer/ng-bootstrap/badge";
|
|
9
|
+
import { BsSpinnerComponent } from "@mintplayer/ng-bootstrap/spinner";
|
|
10
|
+
import { BsTableComponent } from "@mintplayer/ng-bootstrap/table";
|
|
11
|
+
import { SparkGridCellComponent, SparkGridRenderers } from "@mintplayer/ng-spark/grid";
|
|
12
|
+
import { QueryCellValuePipe, QueryReferenceChipsPipe, ResolveTranslationPipe, TranslateKeyPipe } from "@mintplayer/ng-spark/pipes";
|
|
13
|
+
import { cellValue } from "@mintplayer/ng-spark/renderers";
|
|
14
|
+
import { BsCardComponent, BsCardHeaderComponent } from "@mintplayer/ng-bootstrap/card";
|
|
15
|
+
import { provideSparkDetailPanels } from "@mintplayer/ng-spark/panels";
|
|
16
|
+
var SparkHistoryService = class SparkHistoryService {
|
|
17
|
+
spark = inject(SparkService);
|
|
18
|
+
list(type, id, options) {
|
|
19
|
+
return this.spark.postEnvelope("/po/revisions", {
|
|
20
|
+
objectTypeId: type,
|
|
21
|
+
id,
|
|
22
|
+
...options?.skip ? { skip: options.skip } : {},
|
|
23
|
+
...options?.take ? { take: options.take } : {},
|
|
24
|
+
...options?.deleted && options.deleted !== "exclude" ? { deleted: options.deleted } : {}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
get(type, id, changeVector, options) {
|
|
28
|
+
return this.spark.postEnvelope("/po/revision", {
|
|
29
|
+
objectTypeId: type,
|
|
30
|
+
id,
|
|
31
|
+
changeVector,
|
|
32
|
+
...options?.deleted && options.deleted !== "exclude" ? { deleted: options.deleted } : {}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
revert(type, id, changeVector) {
|
|
36
|
+
return this.spark.postEnvelope("/po/revert", {
|
|
37
|
+
objectTypeId: type,
|
|
38
|
+
id,
|
|
39
|
+
changeVector
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
43
|
+
minVersion: "12.0.0",
|
|
44
|
+
version: "22.2.0",
|
|
45
|
+
ngImport: i0,
|
|
46
|
+
type: SparkHistoryService,
|
|
47
|
+
deps: [],
|
|
48
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
49
|
+
});
|
|
50
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
51
|
+
minVersion: "12.0.0",
|
|
52
|
+
version: "22.2.0",
|
|
53
|
+
ngImport: i0,
|
|
54
|
+
type: SparkHistoryService,
|
|
55
|
+
providedIn: "root"
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
59
|
+
minVersion: "12.0.0",
|
|
60
|
+
version: "22.2.0",
|
|
61
|
+
ngImport: i0,
|
|
62
|
+
type: SparkHistoryService,
|
|
63
|
+
decorators: [{
|
|
64
|
+
type: Injectable,
|
|
65
|
+
args: [{ providedIn: "root" }]
|
|
66
|
+
}]
|
|
67
|
+
});
|
|
68
|
+
function revisionAttributes(entityType) {
|
|
69
|
+
return (entityType?.attributes ?? []).filter((a) => a.isVisible && hasShowedOnFlag(a.showedOn, ShowedOn.PersistentObject)).sort((a, b) => a.order - b.order);
|
|
70
|
+
}
|
|
71
|
+
function diffRevision(entityType, revision, current) {
|
|
72
|
+
if (!revision || !current) return [];
|
|
73
|
+
const changes = [];
|
|
74
|
+
for (const attribute of revisionAttributes(entityType)) {
|
|
75
|
+
const r = revision.attributes.find((a) => a.name === attribute.name);
|
|
76
|
+
const c = current.attributes.find((a) => a.name === attribute.name);
|
|
77
|
+
if (comparableValue(r) !== comparableValue(c)) changes.push({
|
|
78
|
+
attribute,
|
|
79
|
+
revision: r,
|
|
80
|
+
current: c
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return changes;
|
|
84
|
+
}
|
|
85
|
+
const cellValuePipe = new QueryCellValuePipe();
|
|
86
|
+
const chipsPipe = new QueryReferenceChipsPipe();
|
|
87
|
+
var SparkPoHistoryComponent = class SparkPoHistoryComponent {
|
|
88
|
+
history = inject(SparkHistoryService);
|
|
89
|
+
lang = inject(SparkLanguageService);
|
|
90
|
+
type = input.required(...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
|
|
91
|
+
id = input.required(...ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []);
|
|
92
|
+
entityType = input.required(...ngDevMode ? [{ debugName: "entityType" }] : /* istanbul ignore next */ []);
|
|
93
|
+
current = input(null, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
|
|
94
|
+
permissions = input(null, ...ngDevMode ? [{ debugName: "permissions" }] : /* istanbul ignore next */ []);
|
|
95
|
+
deleted = input(null, ...ngDevMode ? [{ debugName: "deleted" }] : /* istanbul ignore next */ []);
|
|
96
|
+
pageSize = input(50, ...ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []);
|
|
97
|
+
reverted = output();
|
|
98
|
+
colors = Color;
|
|
99
|
+
revisions = signal([], ...ngDevMode ? [{ debugName: "revisions" }] : /* istanbul ignore next */ []);
|
|
100
|
+
loading = signal(false, ...ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []);
|
|
101
|
+
hasMore = signal(false, ...ngDevMode ? [{ debugName: "hasMore" }] : /* istanbul ignore next */ []);
|
|
102
|
+
error = signal(null, ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
|
|
103
|
+
selected = signal(null, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
104
|
+
selectedObject = signal(null, ...ngDevMode ? [{ debugName: "selectedObject" }] : /* istanbul ignore next */ []);
|
|
105
|
+
selectedLoading = signal(false, ...ngDevMode ? [{ debugName: "selectedLoading" }] : /* istanbul ignore next */ []);
|
|
106
|
+
view = signal("diff", ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
|
|
107
|
+
reverting = signal(false, ...ngDevMode ? [{ debugName: "reverting" }] : /* istanbul ignore next */ []);
|
|
108
|
+
canView = computed(() => this.permissions()?.canViewHistory === true, ...ngDevMode ? [{ debugName: "canView" }] : /* istanbul ignore next */ []);
|
|
109
|
+
attributes = computed(() => revisionAttributes(this.entityType()), ...ngDevMode ? [{ debugName: "attributes" }] : /* istanbul ignore next */ []);
|
|
110
|
+
changes = computed(() => diffRevision(this.entityType(), this.selectedObject(), this.current()), ...ngDevMode ? [{ debugName: "changes" }] : /* istanbul ignore next */ []);
|
|
111
|
+
gridRenderers = inject(SparkGridRenderers);
|
|
112
|
+
lookupOptions = signal({}, ...ngDevMode ? [{ debugName: "lookupOptions" }] : /* istanbul ignore next */ []);
|
|
113
|
+
viewCells = computed(() => {
|
|
114
|
+
const revision = this.selectedObject();
|
|
115
|
+
return revision ? this.attributes().map((a) => ({
|
|
116
|
+
attribute: a,
|
|
117
|
+
cell: this.cell(a, revision)
|
|
118
|
+
})) : [];
|
|
119
|
+
}, ...ngDevMode ? [{ debugName: "viewCells" }] : /* istanbul ignore next */ []);
|
|
120
|
+
changeCells = computed(() => {
|
|
121
|
+
const revision = this.selectedObject();
|
|
122
|
+
const current = this.current();
|
|
123
|
+
return this.changes().map((change) => ({
|
|
124
|
+
change,
|
|
125
|
+
old: this.cell(change.attribute, revision),
|
|
126
|
+
now: this.cell(change.attribute, current)
|
|
127
|
+
}));
|
|
128
|
+
}, ...ngDevMode ? [{ debugName: "changeCells" }] : /* istanbul ignore next */ []);
|
|
129
|
+
canRevertSelected = computed(() => {
|
|
130
|
+
const revision = this.selected();
|
|
131
|
+
return !!revision && this.permissions()?.canRevert === true && this.deleted() !== "only" && !revision.isCurrent && !revision.isDeleteRevision && !!this.selectedObject();
|
|
132
|
+
}, ...ngDevMode ? [{ debugName: "canRevertSelected" }] : /* istanbul ignore next */ []);
|
|
133
|
+
constructor() {
|
|
134
|
+
effect(() => {
|
|
135
|
+
const attributes = this.attributes();
|
|
136
|
+
untracked(() => {
|
|
137
|
+
this.gridRenderers.loadLookupOptions(attributes).then((o) => this.lookupOptions.set(o), () => this.lookupOptions.set({}));
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
effect(() => {
|
|
141
|
+
const type = this.type();
|
|
142
|
+
const id = this.id();
|
|
143
|
+
const deleted = this.deleted();
|
|
144
|
+
const allowed = this.canView();
|
|
145
|
+
untracked(() => {
|
|
146
|
+
this.clearSelection();
|
|
147
|
+
this.revisions.set([]);
|
|
148
|
+
if (allowed && type && id) this.loadPage(type, id, deleted, 0);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async refresh() {
|
|
153
|
+
this.clearSelection();
|
|
154
|
+
this.revisions.set([]);
|
|
155
|
+
await this.loadPage(this.type(), this.id(), this.deleted(), 0);
|
|
156
|
+
}
|
|
157
|
+
async loadMore() {
|
|
158
|
+
await this.loadPage(this.type(), this.id(), this.deleted(), this.revisions().length);
|
|
159
|
+
}
|
|
160
|
+
async loadPage(type, id, deleted, skip) {
|
|
161
|
+
this.loading.set(true);
|
|
162
|
+
this.error.set(null);
|
|
163
|
+
try {
|
|
164
|
+
const take = this.pageSize();
|
|
165
|
+
const page = await this.history.list(type, id, {
|
|
166
|
+
skip,
|
|
167
|
+
take,
|
|
168
|
+
deleted
|
|
169
|
+
});
|
|
170
|
+
if (type !== this.type() || id !== this.id()) return;
|
|
171
|
+
this.revisions.update((existing) => skip === 0 ? page : [...existing, ...page]);
|
|
172
|
+
this.hasMore.set(page.length >= take);
|
|
173
|
+
} catch (e) {
|
|
174
|
+
this.error.set(this.describe(e));
|
|
175
|
+
} finally {
|
|
176
|
+
this.loading.set(false);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
async select(revision) {
|
|
180
|
+
if (this.selected()?.changeVector === revision.changeVector) {
|
|
181
|
+
this.clearSelection();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.selected.set(revision);
|
|
185
|
+
this.selectedObject.set(null);
|
|
186
|
+
this.error.set(null);
|
|
187
|
+
this.selectedLoading.set(true);
|
|
188
|
+
try {
|
|
189
|
+
const po = await this.history.get(this.type(), this.id(), revision.changeVector, { deleted: this.deleted() });
|
|
190
|
+
if (this.selected()?.changeVector === revision.changeVector) this.selectedObject.set(po);
|
|
191
|
+
} catch (e) {
|
|
192
|
+
this.error.set(this.describe(e));
|
|
193
|
+
} finally {
|
|
194
|
+
this.selectedLoading.set(false);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
clearSelection() {
|
|
198
|
+
this.selected.set(null);
|
|
199
|
+
this.selectedObject.set(null);
|
|
200
|
+
}
|
|
201
|
+
async revert() {
|
|
202
|
+
const revision = this.selected();
|
|
203
|
+
if (!revision || !this.canRevertSelected() || this.reverting()) return;
|
|
204
|
+
if (!confirm(this.lang.t("history.confirmRevert"))) return;
|
|
205
|
+
this.reverting.set(true);
|
|
206
|
+
this.error.set(null);
|
|
207
|
+
try {
|
|
208
|
+
const saved = await this.history.revert(this.type(), this.id(), revision.changeVector);
|
|
209
|
+
this.reverted.emit(saved);
|
|
210
|
+
await this.refresh();
|
|
211
|
+
} catch (e) {
|
|
212
|
+
this.error.set(this.describe(e));
|
|
213
|
+
} finally {
|
|
214
|
+
this.reverting.set(false);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
cell(attribute, po) {
|
|
218
|
+
const column = attribute;
|
|
219
|
+
const row = po;
|
|
220
|
+
const display = cellValuePipe.transform(column, row, this.lookupOptions());
|
|
221
|
+
return {
|
|
222
|
+
column,
|
|
223
|
+
display: attribute.dataType !== "boolean" && (display == null || display === "") ? "-" : display,
|
|
224
|
+
rendererValue: cellValue(valueFor(row, attribute.name)),
|
|
225
|
+
chips: chipsPipe.transform(column, row)
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
who(revision) {
|
|
229
|
+
return revision.userName || revision.userId || this.lang.t("history.unknownUser");
|
|
230
|
+
}
|
|
231
|
+
describe(err) {
|
|
232
|
+
switch (err?.status) {
|
|
233
|
+
case 404: return this.lang.t("history.unavailable");
|
|
234
|
+
case 409: return this.lang.t("history.conflict");
|
|
235
|
+
default: return err?.error?.error || err?.message || this.lang.t("common.actionFailed");
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
239
|
+
minVersion: "12.0.0",
|
|
240
|
+
version: "22.2.0",
|
|
241
|
+
ngImport: i0,
|
|
242
|
+
type: SparkPoHistoryComponent,
|
|
243
|
+
deps: [],
|
|
244
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
245
|
+
});
|
|
246
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
247
|
+
minVersion: "17.0.0",
|
|
248
|
+
version: "22.2.0",
|
|
249
|
+
type: SparkPoHistoryComponent,
|
|
250
|
+
isStandalone: true,
|
|
251
|
+
selector: "spark-po-history",
|
|
252
|
+
inputs: {
|
|
253
|
+
type: {
|
|
254
|
+
classPropertyName: "type",
|
|
255
|
+
publicName: "type",
|
|
256
|
+
isSignal: true,
|
|
257
|
+
isRequired: true,
|
|
258
|
+
transformFunction: null
|
|
259
|
+
},
|
|
260
|
+
id: {
|
|
261
|
+
classPropertyName: "id",
|
|
262
|
+
publicName: "id",
|
|
263
|
+
isSignal: true,
|
|
264
|
+
isRequired: true,
|
|
265
|
+
transformFunction: null
|
|
266
|
+
},
|
|
267
|
+
entityType: {
|
|
268
|
+
classPropertyName: "entityType",
|
|
269
|
+
publicName: "entityType",
|
|
270
|
+
isSignal: true,
|
|
271
|
+
isRequired: true,
|
|
272
|
+
transformFunction: null
|
|
273
|
+
},
|
|
274
|
+
current: {
|
|
275
|
+
classPropertyName: "current",
|
|
276
|
+
publicName: "current",
|
|
277
|
+
isSignal: true,
|
|
278
|
+
isRequired: false,
|
|
279
|
+
transformFunction: null
|
|
280
|
+
},
|
|
281
|
+
permissions: {
|
|
282
|
+
classPropertyName: "permissions",
|
|
283
|
+
publicName: "permissions",
|
|
284
|
+
isSignal: true,
|
|
285
|
+
isRequired: false,
|
|
286
|
+
transformFunction: null
|
|
287
|
+
},
|
|
288
|
+
deleted: {
|
|
289
|
+
classPropertyName: "deleted",
|
|
290
|
+
publicName: "deleted",
|
|
291
|
+
isSignal: true,
|
|
292
|
+
isRequired: false,
|
|
293
|
+
transformFunction: null
|
|
294
|
+
},
|
|
295
|
+
pageSize: {
|
|
296
|
+
classPropertyName: "pageSize",
|
|
297
|
+
publicName: "pageSize",
|
|
298
|
+
isSignal: true,
|
|
299
|
+
isRequired: false,
|
|
300
|
+
transformFunction: null
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
outputs: { reverted: "reverted" },
|
|
304
|
+
ngImport: i0,
|
|
305
|
+
template: "@if (canView()) {\n <div class=\"spark-po-history\">\n @if (error(); as message) {\n <bs-alert [type]=\"colors.danger\" class=\"d-block mb-3\">{{ message }}</bs-alert>\n }\n\n @if (revisions().length === 0 && !loading()) {\n <p class=\"text-muted mb-0 spark-history-empty\">{{ 'history.noRevisions' | t }}</p>\n } @else {\n <bs-table [isResponsive]=\"true\">\n <thead>\n <tr>\n <th>{{ 'history.modifiedAt' | t }}</th>\n <th>{{ 'history.modifiedBy' | t }}</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n @for (revision of revisions(); track revision.changeVector) {\n <tr class=\"spark-history-row\" [class.table-active]=\"selected()?.changeVector === revision.changeVector\">\n <td>\n <button type=\"button\" class=\"btn btn-link p-0 spark-history-select\" (click)=\"select(revision)\">\n {{ revision.lastModified ? (revision.lastModified | date:'medium') : '—' }}\n </button>\n </td>\n <td>{{ who(revision) }}</td>\n <td class=\"text-end\">\n @if (revision.isCurrent) {\n <bs-badge [type]=\"colors.primary\" class=\"spark-history-current\">{{ 'history.current' | t }}</bs-badge>\n }\n @if (revision.isDeleteRevision) {\n <bs-badge [type]=\"colors.secondary\" class=\"ms-1\">{{ 'history.deleteRevision' | t }}</bs-badge>\n }\n </td>\n </tr>\n }\n </tbody>\n </bs-table>\n }\n\n @if (loading()) {\n <div class=\"text-center p-2\"><bs-spinner /></div>\n } @else if (hasMore()) {\n <button type=\"button\" class=\"btn btn-outline-secondary btn-sm spark-history-more\" (click)=\"loadMore()\">\n {{ 'history.loadMore' | t }}\n </button>\n }\n\n @if (selected(); as revision) {\n <div class=\"mt-3 spark-history-selected\">\n <div class=\"d-flex flex-wrap gap-2 align-items-center mb-2\">\n <div class=\"btn-group\" role=\"group\">\n <button type=\"button\" class=\"btn btn-sm spark-history-diff-tab\"\n [class.btn-secondary]=\"view() === 'diff'\" [class.btn-outline-secondary]=\"view() !== 'diff'\"\n (click)=\"view.set('diff')\">{{ 'history.changes' | t }}</button>\n <button type=\"button\" class=\"btn btn-sm spark-history-view-tab\"\n [class.btn-secondary]=\"view() === 'view'\" [class.btn-outline-secondary]=\"view() !== 'view'\"\n (click)=\"view.set('view')\">{{ 'history.revision' | t }}</button>\n </div>\n @if (canRevertSelected()) {\n <button type=\"button\" class=\"btn btn-warning btn-sm spark-history-revert\" [disabled]=\"reverting()\" (click)=\"revert()\">\n {{ 'history.revert' | t }}\n </button>\n }\n <button type=\"button\" class=\"btn btn-outline-secondary btn-sm ms-auto\" (click)=\"clearSelection()\">\n {{ 'history.close' | t }}\n </button>\n </div>\n\n @if (selectedLoading()) {\n <div class=\"text-center p-2\"><bs-spinner /></div>\n } @else if (selectedObject()) {\n @if (view() === 'diff') {\n @if (changes().length === 0) {\n <p class=\"text-muted spark-history-nochanges\">{{ 'history.noChanges' | t }}</p>\n } @else {\n <bs-table [isResponsive]=\"true\">\n <thead>\n <tr>\n <th>{{ 'history.field' | t }}</th>\n <th>{{ 'history.revisionValue' | t }}</th>\n <th>{{ 'history.currentValue' | t }}</th>\n </tr>\n </thead>\n <tbody>\n @for (row of changeCells(); track row.change.attribute.name) {\n <tr class=\"spark-history-change\">\n <th scope=\"row\">{{ row.change.attribute.label | resolveTranslation:row.change.attribute.name }}</th>\n <td class=\"spark-history-old\">\n <spark-grid-cell [column]=\"row.old.column\" [display]=\"row.old.display\" [rendererValue]=\"row.old.rendererValue\"\n [item]=\"selectedObject()\" [chips]=\"row.old.chips\" />\n </td>\n <td class=\"spark-history-new\">\n <spark-grid-cell [column]=\"row.now.column\" [display]=\"row.now.display\" [rendererValue]=\"row.now.rendererValue\"\n [item]=\"current()\" [chips]=\"row.now.chips\" />\n </td>\n </tr>\n }\n </tbody>\n </bs-table>\n }\n } @else {\n <dl class=\"spark-history-view\">\n @for (entry of viewCells(); track entry.attribute.name) {\n <dt>{{ entry.attribute.label | resolveTranslation:entry.attribute.name }}</dt>\n <dd>\n <spark-grid-cell [column]=\"entry.cell.column\" [display]=\"entry.cell.display\" [rendererValue]=\"entry.cell.rendererValue\"\n [item]=\"selectedObject()\" [chips]=\"entry.cell.chips\" />\n </dd>\n }\n </dl>\n }\n }\n </div>\n }\n </div>\n}\n",
|
|
306
|
+
dependencies: [
|
|
307
|
+
{
|
|
308
|
+
kind: "component",
|
|
309
|
+
type: BsAlertComponent,
|
|
310
|
+
selector: "bs-alert",
|
|
311
|
+
inputs: [
|
|
312
|
+
"type",
|
|
313
|
+
"announce",
|
|
314
|
+
"isVisible"
|
|
315
|
+
],
|
|
316
|
+
outputs: ["isVisibleChange", "afterOpenedOrClosed"]
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
kind: "component",
|
|
320
|
+
type: BsBadgeComponent,
|
|
321
|
+
selector: "bs-badge",
|
|
322
|
+
inputs: [
|
|
323
|
+
"type",
|
|
324
|
+
"unit",
|
|
325
|
+
"decorative"
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
kind: "component",
|
|
330
|
+
type: BsSpinnerComponent,
|
|
331
|
+
selector: "bs-spinner",
|
|
332
|
+
inputs: ["type", "color"]
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
kind: "component",
|
|
336
|
+
type: BsTableComponent,
|
|
337
|
+
selector: "bs-table",
|
|
338
|
+
inputs: [
|
|
339
|
+
"isResponsive",
|
|
340
|
+
"striped",
|
|
341
|
+
"hover",
|
|
342
|
+
"border",
|
|
343
|
+
"ariaRowCount"
|
|
344
|
+
]
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
kind: "component",
|
|
348
|
+
type: SparkGridCellComponent,
|
|
349
|
+
selector: "spark-grid-cell",
|
|
350
|
+
inputs: [
|
|
351
|
+
"column",
|
|
352
|
+
"display",
|
|
353
|
+
"rendererValue",
|
|
354
|
+
"item",
|
|
355
|
+
"chips",
|
|
356
|
+
"link"
|
|
357
|
+
]
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
kind: "pipe",
|
|
361
|
+
type: DatePipe,
|
|
362
|
+
name: "date"
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
kind: "pipe",
|
|
366
|
+
type: ResolveTranslationPipe,
|
|
367
|
+
name: "resolveTranslation"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
kind: "pipe",
|
|
371
|
+
type: TranslateKeyPipe,
|
|
372
|
+
name: "t"
|
|
373
|
+
}
|
|
374
|
+
],
|
|
375
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
379
|
+
minVersion: "12.0.0",
|
|
380
|
+
version: "22.2.0",
|
|
381
|
+
ngImport: i0,
|
|
382
|
+
type: SparkPoHistoryComponent,
|
|
383
|
+
decorators: [{
|
|
384
|
+
type: Component,
|
|
385
|
+
args: [{
|
|
386
|
+
selector: "spark-po-history",
|
|
387
|
+
imports: [
|
|
388
|
+
DatePipe,
|
|
389
|
+
BsAlertComponent,
|
|
390
|
+
BsBadgeComponent,
|
|
391
|
+
BsSpinnerComponent,
|
|
392
|
+
BsTableComponent,
|
|
393
|
+
SparkGridCellComponent,
|
|
394
|
+
ResolveTranslationPipe,
|
|
395
|
+
TranslateKeyPipe
|
|
396
|
+
],
|
|
397
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
398
|
+
template: "@if (canView()) {\n <div class=\"spark-po-history\">\n @if (error(); as message) {\n <bs-alert [type]=\"colors.danger\" class=\"d-block mb-3\">{{ message }}</bs-alert>\n }\n\n @if (revisions().length === 0 && !loading()) {\n <p class=\"text-muted mb-0 spark-history-empty\">{{ 'history.noRevisions' | t }}</p>\n } @else {\n <bs-table [isResponsive]=\"true\">\n <thead>\n <tr>\n <th>{{ 'history.modifiedAt' | t }}</th>\n <th>{{ 'history.modifiedBy' | t }}</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n @for (revision of revisions(); track revision.changeVector) {\n <tr class=\"spark-history-row\" [class.table-active]=\"selected()?.changeVector === revision.changeVector\">\n <td>\n <button type=\"button\" class=\"btn btn-link p-0 spark-history-select\" (click)=\"select(revision)\">\n {{ revision.lastModified ? (revision.lastModified | date:'medium') : '—' }}\n </button>\n </td>\n <td>{{ who(revision) }}</td>\n <td class=\"text-end\">\n @if (revision.isCurrent) {\n <bs-badge [type]=\"colors.primary\" class=\"spark-history-current\">{{ 'history.current' | t }}</bs-badge>\n }\n @if (revision.isDeleteRevision) {\n <bs-badge [type]=\"colors.secondary\" class=\"ms-1\">{{ 'history.deleteRevision' | t }}</bs-badge>\n }\n </td>\n </tr>\n }\n </tbody>\n </bs-table>\n }\n\n @if (loading()) {\n <div class=\"text-center p-2\"><bs-spinner /></div>\n } @else if (hasMore()) {\n <button type=\"button\" class=\"btn btn-outline-secondary btn-sm spark-history-more\" (click)=\"loadMore()\">\n {{ 'history.loadMore' | t }}\n </button>\n }\n\n @if (selected(); as revision) {\n <div class=\"mt-3 spark-history-selected\">\n <div class=\"d-flex flex-wrap gap-2 align-items-center mb-2\">\n <div class=\"btn-group\" role=\"group\">\n <button type=\"button\" class=\"btn btn-sm spark-history-diff-tab\"\n [class.btn-secondary]=\"view() === 'diff'\" [class.btn-outline-secondary]=\"view() !== 'diff'\"\n (click)=\"view.set('diff')\">{{ 'history.changes' | t }}</button>\n <button type=\"button\" class=\"btn btn-sm spark-history-view-tab\"\n [class.btn-secondary]=\"view() === 'view'\" [class.btn-outline-secondary]=\"view() !== 'view'\"\n (click)=\"view.set('view')\">{{ 'history.revision' | t }}</button>\n </div>\n @if (canRevertSelected()) {\n <button type=\"button\" class=\"btn btn-warning btn-sm spark-history-revert\" [disabled]=\"reverting()\" (click)=\"revert()\">\n {{ 'history.revert' | t }}\n </button>\n }\n <button type=\"button\" class=\"btn btn-outline-secondary btn-sm ms-auto\" (click)=\"clearSelection()\">\n {{ 'history.close' | t }}\n </button>\n </div>\n\n @if (selectedLoading()) {\n <div class=\"text-center p-2\"><bs-spinner /></div>\n } @else if (selectedObject()) {\n @if (view() === 'diff') {\n @if (changes().length === 0) {\n <p class=\"text-muted spark-history-nochanges\">{{ 'history.noChanges' | t }}</p>\n } @else {\n <bs-table [isResponsive]=\"true\">\n <thead>\n <tr>\n <th>{{ 'history.field' | t }}</th>\n <th>{{ 'history.revisionValue' | t }}</th>\n <th>{{ 'history.currentValue' | t }}</th>\n </tr>\n </thead>\n <tbody>\n @for (row of changeCells(); track row.change.attribute.name) {\n <tr class=\"spark-history-change\">\n <th scope=\"row\">{{ row.change.attribute.label | resolveTranslation:row.change.attribute.name }}</th>\n <td class=\"spark-history-old\">\n <spark-grid-cell [column]=\"row.old.column\" [display]=\"row.old.display\" [rendererValue]=\"row.old.rendererValue\"\n [item]=\"selectedObject()\" [chips]=\"row.old.chips\" />\n </td>\n <td class=\"spark-history-new\">\n <spark-grid-cell [column]=\"row.now.column\" [display]=\"row.now.display\" [rendererValue]=\"row.now.rendererValue\"\n [item]=\"current()\" [chips]=\"row.now.chips\" />\n </td>\n </tr>\n }\n </tbody>\n </bs-table>\n }\n } @else {\n <dl class=\"spark-history-view\">\n @for (entry of viewCells(); track entry.attribute.name) {\n <dt>{{ entry.attribute.label | resolveTranslation:entry.attribute.name }}</dt>\n <dd>\n <spark-grid-cell [column]=\"entry.cell.column\" [display]=\"entry.cell.display\" [rendererValue]=\"entry.cell.rendererValue\"\n [item]=\"selectedObject()\" [chips]=\"entry.cell.chips\" />\n </dd>\n }\n </dl>\n }\n }\n </div>\n }\n </div>\n}\n"
|
|
399
|
+
}]
|
|
400
|
+
}],
|
|
401
|
+
ctorParameters: () => [],
|
|
402
|
+
propDecorators: {
|
|
403
|
+
type: [{
|
|
404
|
+
type: i0.Input,
|
|
405
|
+
args: [{
|
|
406
|
+
isSignal: true,
|
|
407
|
+
alias: "type",
|
|
408
|
+
required: true
|
|
409
|
+
}]
|
|
410
|
+
}],
|
|
411
|
+
id: [{
|
|
412
|
+
type: i0.Input,
|
|
413
|
+
args: [{
|
|
414
|
+
isSignal: true,
|
|
415
|
+
alias: "id",
|
|
416
|
+
required: true
|
|
417
|
+
}]
|
|
418
|
+
}],
|
|
419
|
+
entityType: [{
|
|
420
|
+
type: i0.Input,
|
|
421
|
+
args: [{
|
|
422
|
+
isSignal: true,
|
|
423
|
+
alias: "entityType",
|
|
424
|
+
required: true
|
|
425
|
+
}]
|
|
426
|
+
}],
|
|
427
|
+
current: [{
|
|
428
|
+
type: i0.Input,
|
|
429
|
+
args: [{
|
|
430
|
+
isSignal: true,
|
|
431
|
+
alias: "current",
|
|
432
|
+
required: false
|
|
433
|
+
}]
|
|
434
|
+
}],
|
|
435
|
+
permissions: [{
|
|
436
|
+
type: i0.Input,
|
|
437
|
+
args: [{
|
|
438
|
+
isSignal: true,
|
|
439
|
+
alias: "permissions",
|
|
440
|
+
required: false
|
|
441
|
+
}]
|
|
442
|
+
}],
|
|
443
|
+
deleted: [{
|
|
444
|
+
type: i0.Input,
|
|
445
|
+
args: [{
|
|
446
|
+
isSignal: true,
|
|
447
|
+
alias: "deleted",
|
|
448
|
+
required: false
|
|
449
|
+
}]
|
|
450
|
+
}],
|
|
451
|
+
pageSize: [{
|
|
452
|
+
type: i0.Input,
|
|
453
|
+
args: [{
|
|
454
|
+
isSignal: true,
|
|
455
|
+
alias: "pageSize",
|
|
456
|
+
required: false
|
|
457
|
+
}]
|
|
458
|
+
}],
|
|
459
|
+
reverted: [{
|
|
460
|
+
type: i0.Output,
|
|
461
|
+
args: ["reverted"]
|
|
462
|
+
}]
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
var SparkHistoryPanelComponent = class SparkHistoryPanelComponent {
|
|
466
|
+
context = input.required(...ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []);
|
|
467
|
+
visible = computed(() => this.context().permissions?.canViewHistory === true, ...ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []);
|
|
468
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
469
|
+
minVersion: "12.0.0",
|
|
470
|
+
version: "22.2.0",
|
|
471
|
+
ngImport: i0,
|
|
472
|
+
type: SparkHistoryPanelComponent,
|
|
473
|
+
deps: [],
|
|
474
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
475
|
+
});
|
|
476
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
477
|
+
minVersion: "17.0.0",
|
|
478
|
+
version: "22.2.0",
|
|
479
|
+
type: SparkHistoryPanelComponent,
|
|
480
|
+
isStandalone: true,
|
|
481
|
+
selector: "spark-history-panel",
|
|
482
|
+
inputs: { context: {
|
|
483
|
+
classPropertyName: "context",
|
|
484
|
+
publicName: "context",
|
|
485
|
+
isSignal: true,
|
|
486
|
+
isRequired: true,
|
|
487
|
+
transformFunction: null
|
|
488
|
+
} },
|
|
489
|
+
ngImport: i0,
|
|
490
|
+
template: `
|
|
491
|
+
@if (visible()) {
|
|
492
|
+
<bs-card class="d-block spark-history-panel">
|
|
493
|
+
<bs-card-header>{{ 'history.title' | t }}</bs-card-header>
|
|
494
|
+
<div class="p-3">
|
|
495
|
+
<spark-po-history
|
|
496
|
+
[type]="context().type"
|
|
497
|
+
[id]="context().id"
|
|
498
|
+
[entityType]="context().entityType"
|
|
499
|
+
[current]="context().item"
|
|
500
|
+
[permissions]="context().permissions"
|
|
501
|
+
[deleted]="context().deleted"
|
|
502
|
+
(reverted)="context().reload()" />
|
|
503
|
+
</div>
|
|
504
|
+
</bs-card>
|
|
505
|
+
}
|
|
506
|
+
`,
|
|
507
|
+
isInline: true,
|
|
508
|
+
dependencies: [
|
|
509
|
+
{
|
|
510
|
+
kind: "component",
|
|
511
|
+
type: BsCardComponent,
|
|
512
|
+
selector: "bs-card",
|
|
513
|
+
inputs: ["color", "outline"]
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
kind: "component",
|
|
517
|
+
type: BsCardHeaderComponent,
|
|
518
|
+
selector: "bs-card-header",
|
|
519
|
+
inputs: ["color", "navStyle"]
|
|
520
|
+
},
|
|
521
|
+
{
|
|
522
|
+
kind: "component",
|
|
523
|
+
type: SparkPoHistoryComponent,
|
|
524
|
+
selector: "spark-po-history",
|
|
525
|
+
inputs: [
|
|
526
|
+
"type",
|
|
527
|
+
"id",
|
|
528
|
+
"entityType",
|
|
529
|
+
"current",
|
|
530
|
+
"permissions",
|
|
531
|
+
"deleted",
|
|
532
|
+
"pageSize"
|
|
533
|
+
],
|
|
534
|
+
outputs: ["reverted"]
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
kind: "pipe",
|
|
538
|
+
type: TranslateKeyPipe,
|
|
539
|
+
name: "t"
|
|
540
|
+
}
|
|
541
|
+
],
|
|
542
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
543
|
+
});
|
|
544
|
+
};
|
|
545
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
546
|
+
minVersion: "12.0.0",
|
|
547
|
+
version: "22.2.0",
|
|
548
|
+
ngImport: i0,
|
|
549
|
+
type: SparkHistoryPanelComponent,
|
|
550
|
+
decorators: [{
|
|
551
|
+
type: Component,
|
|
552
|
+
args: [{
|
|
553
|
+
selector: "spark-history-panel",
|
|
554
|
+
imports: [
|
|
555
|
+
BsCardComponent,
|
|
556
|
+
BsCardHeaderComponent,
|
|
557
|
+
TranslateKeyPipe,
|
|
558
|
+
SparkPoHistoryComponent
|
|
559
|
+
],
|
|
560
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
561
|
+
template: `
|
|
562
|
+
@if (visible()) {
|
|
563
|
+
<bs-card class="d-block spark-history-panel">
|
|
564
|
+
<bs-card-header>{{ 'history.title' | t }}</bs-card-header>
|
|
565
|
+
<div class="p-3">
|
|
566
|
+
<spark-po-history
|
|
567
|
+
[type]="context().type"
|
|
568
|
+
[id]="context().id"
|
|
569
|
+
[entityType]="context().entityType"
|
|
570
|
+
[current]="context().item"
|
|
571
|
+
[permissions]="context().permissions"
|
|
572
|
+
[deleted]="context().deleted"
|
|
573
|
+
(reverted)="context().reload()" />
|
|
574
|
+
</div>
|
|
575
|
+
</bs-card>
|
|
576
|
+
}
|
|
577
|
+
`
|
|
578
|
+
}]
|
|
579
|
+
}],
|
|
580
|
+
propDecorators: { context: [{
|
|
581
|
+
type: i0.Input,
|
|
582
|
+
args: [{
|
|
583
|
+
isSignal: true,
|
|
584
|
+
alias: "context",
|
|
585
|
+
required: true
|
|
586
|
+
}]
|
|
587
|
+
}] }
|
|
588
|
+
});
|
|
589
|
+
function provideSparkHistory(options) {
|
|
590
|
+
return provideSparkDetailPanels({
|
|
591
|
+
id: "spark-history",
|
|
592
|
+
component: SparkHistoryPanelComponent,
|
|
593
|
+
order: options?.order ?? 100
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
export { SparkHistoryPanelComponent, SparkHistoryService, SparkPoHistoryComponent, comparableValue, diffRevision, provideSparkHistory, revisionAttributes };
|
|
597
|
+
|
|
598
|
+
//# sourceMappingURL=mintplayer-ng-spark-history.mjs.map
|