@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,231 @@
|
|
|
1
|
+
import { EntityAttributeDefinition, PersistentObject, SparkQuery } from "@mintplayer/ng-spark/models";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Provider } from "@angular/core";
|
|
4
|
+
import { SparkService } from "@mintplayer/ng-spark/services";
|
|
5
|
+
import { SparkDetailContext, SparkQueryRowAction } from "@mintplayer/ng-spark/panels";
|
|
6
|
+
import { SparkAttributeRendererRegistration } from "@mintplayer/ng-spark/renderers";
|
|
7
|
+
/** One line of a line diff: unchanged, only in the new text, or only in the old one. */
|
|
8
|
+
export interface SparkDiffLine {
|
|
9
|
+
kind: 'same' | 'added' | 'removed';
|
|
10
|
+
text: string;
|
|
11
|
+
}
|
|
12
|
+
/** Splits a text into lines (`\r\n`, `\r` and `\n` alike); an empty or absent text has none. */
|
|
13
|
+
export declare function splitLines(text: string | null | undefined): string[];
|
|
14
|
+
/**
|
|
15
|
+
* A line diff of `newText` against `oldText`: the longest common subsequence of their lines kept as
|
|
16
|
+
* `same`, everything else `removed` (old) or `added` (new), in reading order — at a change, the old
|
|
17
|
+
* lines come before the new ones. Pure, no dependency.
|
|
18
|
+
*
|
|
19
|
+
* Beyond {@link MAX_CELLS} cells (thousands of lines on both sides) the common prefix and suffix are
|
|
20
|
+
* still matched, and the middle is reported as removed-then-added rather than building a huge table.
|
|
21
|
+
*/
|
|
22
|
+
export declare function lineDiff(oldText: string | null | undefined, newText: string | null | undefined): SparkDiffLine[];
|
|
23
|
+
/** Whether a diff changes anything. */
|
|
24
|
+
export declare function diffHasChanges(lines: readonly SparkDiffLine[]): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Where the `lineDiff` renderer finds the text to compare with — its `rendererOptions`:
|
|
27
|
+
*
|
|
28
|
+
* - `compareType`: the model name (or alias, or id) of the object to load;
|
|
29
|
+
* - its id: `compareIdAttribute` (an attribute of this object holding it), or
|
|
30
|
+
* `compareIdPattern` + `compareIdReplacement` (a regular expression and replacement applied to this
|
|
31
|
+
* object's id);
|
|
32
|
+
* - `compareAttribute`: the attribute of that object holding the text — or, for an AsDetail list, the
|
|
33
|
+
* list, with `compareRowKeyPattern` + `compareRowKeyReplacement` (deriving the row key from this
|
|
34
|
+
* object's id) and `compareRowAttribute` (the text on the row); for a single AsDetail object,
|
|
35
|
+
* `compareRowAttribute` alone.
|
|
36
|
+
*
|
|
37
|
+
* Contributions seeds these on a generated contribution type's text values, comparing against the
|
|
38
|
+
* target's row of the same slot (the current version).
|
|
39
|
+
*/
|
|
40
|
+
export interface SparkLineDiffSource {
|
|
41
|
+
type: string;
|
|
42
|
+
id: string;
|
|
43
|
+
attribute: string;
|
|
44
|
+
rowKey?: string;
|
|
45
|
+
rowAttribute?: string;
|
|
46
|
+
}
|
|
47
|
+
/** The comparison source for `item`, or null when the options do not describe one. */
|
|
48
|
+
export declare function lineDiffSourceOf(options: Record<string, any> | null | undefined, item: PersistentObject | null | undefined): SparkLineDiffSource | null;
|
|
49
|
+
/** The text at `source` in the loaded object, or null when it is not there (or not readable). */
|
|
50
|
+
export declare function lineDiffTextOf(po: PersistentObject | null | undefined, source: SparkLineDiffSource): string | null;
|
|
51
|
+
/**
|
|
52
|
+
* The generic `lineDiff` detail renderer: this attribute's text, diffed line by line against a text
|
|
53
|
+
* elsewhere ({@link SparkLineDiffSource}) — added lines marked `+`, removed ones `−`. When the other
|
|
54
|
+
* object cannot be read (no right, gone), the text is shown as it is, with a note.
|
|
55
|
+
*
|
|
56
|
+
* Register through `sparkContributionRenderers` (or on its own: `{ name: 'lineDiff', detailComponent:
|
|
57
|
+
* SparkLineDiffComponent }`).
|
|
58
|
+
*/
|
|
59
|
+
export declare class SparkLineDiffComponent {
|
|
60
|
+
private readonly spark;
|
|
61
|
+
value: import("@angular/core").InputSignal<any>;
|
|
62
|
+
attribute: import("@angular/core").InputSignal<EntityAttributeDefinition | undefined>;
|
|
63
|
+
options: import("@angular/core").InputSignal<Record<string, any> | undefined>;
|
|
64
|
+
item: import("@angular/core").InputSignal<PersistentObject | undefined>;
|
|
65
|
+
protected readonly text: import("@angular/core").Signal<string>;
|
|
66
|
+
/** The compared text: undefined while loading, null when it could not be read. */
|
|
67
|
+
private readonly compared;
|
|
68
|
+
protected readonly state: import("@angular/core").Signal<"loading" | "diff" | "unavailable">;
|
|
69
|
+
protected readonly lines: import("@angular/core").Signal<SparkDiffLine[]>;
|
|
70
|
+
protected readonly changed: import("@angular/core").Signal<boolean>;
|
|
71
|
+
private generation;
|
|
72
|
+
constructor();
|
|
73
|
+
protected marker(line: SparkDiffLine): string;
|
|
74
|
+
private load;
|
|
75
|
+
/** The entity type id for a model name or alias (the load endpoint is keyed by the type's id). */
|
|
76
|
+
private typeIdOf;
|
|
77
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SparkLineDiffComponent, never>;
|
|
78
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SparkLineDiffComponent, "spark-line-diff", never, {
|
|
79
|
+
"value": {
|
|
80
|
+
"alias": "value";
|
|
81
|
+
"required": false;
|
|
82
|
+
"isSignal": true;
|
|
83
|
+
};
|
|
84
|
+
"attribute": {
|
|
85
|
+
"alias": "attribute";
|
|
86
|
+
"required": false;
|
|
87
|
+
"isSignal": true;
|
|
88
|
+
};
|
|
89
|
+
"options": {
|
|
90
|
+
"alias": "options";
|
|
91
|
+
"required": false;
|
|
92
|
+
"isSignal": true;
|
|
93
|
+
};
|
|
94
|
+
"item": {
|
|
95
|
+
"alias": "item";
|
|
96
|
+
"required": false;
|
|
97
|
+
"isSignal": true;
|
|
98
|
+
};
|
|
99
|
+
}, {}, never, never, true, never>;
|
|
100
|
+
}
|
|
101
|
+
/** The `rendererOptions` Contributions writes on each attribution attribute (library README, "Client contract"). */
|
|
102
|
+
export interface SparkContributionAttributionOptions {
|
|
103
|
+
/** The generated contributions query's alias (`songlyricscontributions`). */
|
|
104
|
+
contributionsQuery: string;
|
|
105
|
+
/** The target's model name: the query's `parentType` (`Song`). */
|
|
106
|
+
targetType: string;
|
|
107
|
+
/** The `[Contribution]` property (`Lyrics`). */
|
|
108
|
+
property: string;
|
|
109
|
+
/** The slot attributes, in id order: one column filter each (`Language`, `Script`). */
|
|
110
|
+
slots: string[];
|
|
111
|
+
/** The attribution attributes the row carries: `ContributorName`, `UpdatedAt`, `ContributionCount`. */
|
|
112
|
+
attribution: string[];
|
|
113
|
+
}
|
|
114
|
+
/** The History link of a row: `/query/{contributionsQuery}?parentId=…&parentType=…&{slot}=…`. */
|
|
115
|
+
export interface SparkContributionHistoryLink {
|
|
116
|
+
commands: string[];
|
|
117
|
+
queryParams: Record<string, string>;
|
|
118
|
+
}
|
|
119
|
+
/** The History link for `row` of the object `ownerId`, or null when either is missing. */
|
|
120
|
+
export declare function contributionHistoryLink(options: Partial<SparkContributionAttributionOptions> | null | undefined, row: Record<string, any> | null | undefined, ownerId: string | null | undefined): SparkContributionHistoryLink | null;
|
|
121
|
+
/** "3 days ago" in `language`, from an ISO instant; null when it does not parse. */
|
|
122
|
+
export declare function relativeTime(value: unknown, language: string, now?: number): string | null;
|
|
123
|
+
/**
|
|
124
|
+
* The `contributionAttribution` AsDetail **row** renderer (contributions PRD Q6): one line under a
|
|
125
|
+
* row — "by Alice · 3 days ago · History (4)" — instead of three columns. Only the parts the
|
|
126
|
+
* declaration asked for (`rendererOptions.attribution`) and that the row has; History links to the
|
|
127
|
+
* slot's contributions query (`/query/{contributionsQuery}` with the parent and one filter per slot).
|
|
128
|
+
*/
|
|
129
|
+
export declare class SparkContributionAttributionComponent {
|
|
130
|
+
private readonly lang;
|
|
131
|
+
row: import("@angular/core").InputSignal<Record<string, any>>;
|
|
132
|
+
options: import("@angular/core").InputSignal<Record<string, any> | undefined>;
|
|
133
|
+
ownerId: import("@angular/core").InputSignal<string | undefined>;
|
|
134
|
+
private readonly asked;
|
|
135
|
+
protected readonly historyLink: import("@angular/core").Signal<SparkContributionHistoryLink | null>;
|
|
136
|
+
protected readonly parts: import("@angular/core").Signal<{
|
|
137
|
+
kind: "by" | "at" | "history";
|
|
138
|
+
text: string;
|
|
139
|
+
iso?: string;
|
|
140
|
+
title?: string;
|
|
141
|
+
}[]>;
|
|
142
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SparkContributionAttributionComponent, never>;
|
|
143
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SparkContributionAttributionComponent, "spark-contribution-attribution", never, {
|
|
144
|
+
"row": {
|
|
145
|
+
"alias": "row";
|
|
146
|
+
"required": false;
|
|
147
|
+
"isSignal": true;
|
|
148
|
+
};
|
|
149
|
+
"options": {
|
|
150
|
+
"alias": "options";
|
|
151
|
+
"required": false;
|
|
152
|
+
"isSignal": true;
|
|
153
|
+
};
|
|
154
|
+
"ownerId": {
|
|
155
|
+
"alias": "ownerId";
|
|
156
|
+
"required": false;
|
|
157
|
+
"isSignal": true;
|
|
158
|
+
};
|
|
159
|
+
}, {}, never, never, true, never>;
|
|
160
|
+
}
|
|
161
|
+
/** The source of every generated `{Target}{Property}Contributions` query (`ContributionDescriptor.ContributionsQueryMethod`). */
|
|
162
|
+
export declare const SPARK_CONTRIBUTIONS_QUERY_SOURCE = "Custom.SparkContributionsOfTarget";
|
|
163
|
+
/** `POST /spark/po/revert-contribution` (the Contributions server package). */
|
|
164
|
+
export declare const SPARK_REVERT_CONTRIBUTION_PATH = "/po/revert-contribution";
|
|
165
|
+
/** Whether `query` is a generated contributions query (its rows are contributions). */
|
|
166
|
+
export declare function isContributionsQuery(query: Pick<SparkQuery, 'source'> | null | undefined): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Makes a contribution current again: every newer visible version of its slot is hidden (reason
|
|
169
|
+
* `reverted`), atomically, by the server. The response's notice ("…newer version(s) were hidden") is
|
|
170
|
+
* dispatched like every operation. Rejects with the server's error (400 "restore it first" for a
|
|
171
|
+
* hidden one, 404 without the right).
|
|
172
|
+
*/
|
|
173
|
+
export declare function revertContribution(spark: SparkService, objectTypeId: string, id: string): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* "Revert to this version" in the row menu of a contributions query — for holders of
|
|
176
|
+
* `RevertContribution/{type}`, outside the recycle bin. Asks first; refreshes the list afterwards.
|
|
177
|
+
*/
|
|
178
|
+
export declare const sparkRevertContributionRowAction: SparkQueryRowAction;
|
|
179
|
+
/**
|
|
180
|
+
* "Revert to this version" on a contribution's detail page (a `SPARK_DETAIL_ACTIONS` entry): shown for
|
|
181
|
+
* `RevertContribution/{type}` holders on a generated contribution type (one that has the generated
|
|
182
|
+
* contributions query), outside the recycle bin. Reloads the page afterwards.
|
|
183
|
+
*/
|
|
184
|
+
export declare class SparkRevertContributionComponent {
|
|
185
|
+
private readonly spark;
|
|
186
|
+
private readonly lang;
|
|
187
|
+
context: import("@angular/core").InputSignal<SparkDetailContext>;
|
|
188
|
+
/** Whether the type is a generated contribution type: it has the generated contributions query. */
|
|
189
|
+
private readonly isContributionType;
|
|
190
|
+
protected readonly offered: import("@angular/core").Signal<boolean>;
|
|
191
|
+
protected readonly busy: import("@angular/core").WritableSignal<boolean>;
|
|
192
|
+
protected readonly error: import("@angular/core").WritableSignal<string | null>;
|
|
193
|
+
constructor();
|
|
194
|
+
revert(): Promise<void>;
|
|
195
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SparkRevertContributionComponent, never>;
|
|
196
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SparkRevertContributionComponent, "spark-revert-contribution", never, {
|
|
197
|
+
"context": {
|
|
198
|
+
"alias": "context";
|
|
199
|
+
"required": true;
|
|
200
|
+
"isSignal": true;
|
|
201
|
+
};
|
|
202
|
+
}, {}, never, never, true, never>;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Adds the Contributions UI to the pages `sparkRoutes()` routes to — no routes of its own (PRD Q7):
|
|
206
|
+
* "Revert to this version" in the contributions query's row menu and on a contribution's detail page.
|
|
207
|
+
* Needs the server package `MintPlayer.Spark.Contributions`.
|
|
208
|
+
*
|
|
209
|
+
* ```ts
|
|
210
|
+
* providers: [
|
|
211
|
+
* provideSpark(...),
|
|
212
|
+
* provideSparkContributions(),
|
|
213
|
+
* provideSparkAttributeRenderers([...sparkContributionRenderers, ...yourRenderers]),
|
|
214
|
+
* ]
|
|
215
|
+
* ```
|
|
216
|
+
*
|
|
217
|
+
* The renderers are registered with the app's own, because `provideSparkAttributeRenderers` takes one
|
|
218
|
+
* list: see {@link sparkContributionRenderers}.
|
|
219
|
+
*/
|
|
220
|
+
export declare function provideSparkContributions(options?: {
|
|
221
|
+
detailActionPriority?: number;
|
|
222
|
+
}): Provider[];
|
|
223
|
+
/**
|
|
224
|
+
* The two renderers the Contributions model names:
|
|
225
|
+
*
|
|
226
|
+
* - `contributionAttribution` — an AsDetail **row** renderer: "by Alice · 3 days ago · History (4)"
|
|
227
|
+
* once per row, in place of the `ContributorName`/`UpdatedAt`/`ContributionCount` columns;
|
|
228
|
+
* - `lineDiff` — a detail renderer, generic: a text diffed line by line against a text of another
|
|
229
|
+
* object (Contributions seeds it on a contribution's text values, against the current version).
|
|
230
|
+
*/
|
|
231
|
+
export declare const sparkContributionRenderers: SparkAttributeRendererRegistration[];
|