@yuuvis/client-framework 2.19.0 → 2.20.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/breadcrumb/index.d.ts +2 -0
- package/breadcrumb/lib/breadcrumb/breadcrumb.component.d.ts +94 -0
- package/breadcrumb/lib/models/breadcrumb-item.model.d.ts +14 -0
- package/breadcrumb/lib/models/index.d.ts +1 -0
- package/fesm2022/yuuvis-client-framework-breadcrumb.mjs +117 -0
- package/fesm2022/yuuvis-client-framework-breadcrumb.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-list.mjs +365 -121
- package/fesm2022/yuuvis-client-framework-list.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-object-details.mjs +28 -26
- package/fesm2022/yuuvis-client-framework-object-details.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-object-form.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-object-versions.mjs +1 -1
- package/fesm2022/yuuvis-client-framework-object-versions.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-query-list.mjs +462 -127
- package/fesm2022/yuuvis-client-framework-query-list.mjs.map +1 -1
- package/fesm2022/yuuvis-client-framework-tile-list.mjs +695 -178
- package/fesm2022/yuuvis-client-framework-tile-list.mjs.map +1 -1
- package/lib/assets/i18n/ar.json +2 -1
- package/lib/assets/i18n/de.json +2 -1
- package/lib/assets/i18n/en.json +2 -1
- package/list/lib/list.component.d.ts +256 -44
- package/object-details/lib/object-details-header/object-details-header.component.d.ts +5 -2
- package/object-details/lib/object-details-shell/object-details-shell.component.d.ts +5 -2
- package/object-details/lib/object-details.component.d.ts +3 -1
- package/package.json +8 -4
- package/query-list/lib/query-list.component.d.ts +381 -86
- package/tile-list/lib/tile-list/tile-list.component.d.ts +527 -72
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, output, viewChild, ChangeDetectionStrategy, Component, Injectable, inject, ViewContainerRef, effect, Directive, DestroyRef, ElementRef, contentChild,
|
|
2
|
+
import { input, output, viewChild, ChangeDetectionStrategy, Component, Injectable, inject, ViewContainerRef, effect, Directive, DestroyRef, ElementRef, contentChild, viewChildren, computed, signal, linkedSignal, untracked } from '@angular/core';
|
|
3
3
|
import * as i1 from '@yuuvis/client-core';
|
|
4
|
-
import { ObjectConfigService, DmsService,
|
|
4
|
+
import { ObjectConfigService, DmsService, SearchService, DmsObject, BaseObjectTypeField, TranslateModule, SystemService, ContentStreamField, Utils, Sort } from '@yuuvis/client-core';
|
|
5
5
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
6
6
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
7
|
import * as i1$2 from '@angular/forms';
|
|
@@ -149,151 +149,413 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
149
149
|
}]
|
|
150
150
|
}] });
|
|
151
151
|
|
|
152
|
+
const MATERIAL_IMPORTS = [MatIconModule, MatPaginatorModule, MatTooltipModule, MatMenuTrigger];
|
|
152
153
|
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
154
|
+
* Query-driven tile list that renders `DmsObject` search results as rich, configurable
|
|
155
|
+
* tiles based on `ObjectConfig` definitions.
|
|
156
|
+
*
|
|
157
|
+
* The component wraps `yuv-query-list` and adds DMS-specific concerns: it resolves the
|
|
158
|
+
* `ObjectConfigRecord` for each result item (via `ObjectConfigService`), maps raw
|
|
159
|
+
* `SearchResultItem` data to the `TileData` view model, and supports per-object-type
|
|
160
|
+
* flavors, inline actions, context menus, and keyboard shortcuts for copy/cut.
|
|
161
|
+
*
|
|
162
|
+
* **Key Features:**
|
|
163
|
+
* - Automatic object config resolution (title, description, icon, meta, aside, actions)
|
|
164
|
+
* - Per-tile action buttons rendered from the resolved `ObjectConfigRecord`
|
|
165
|
+
* - Optional `ObjectFlavor` overlay to switch the visual representation of specific SOTs
|
|
166
|
+
* - Server-side pagination forwarded from the inner `yuv-query-list`
|
|
167
|
+
* - Multi-selection with Shift/Ctrl modifier keys and mouse drag-to-select
|
|
168
|
+
* - Programmatic pre-selection by object ID (`preselect` input, `selectById()` method)
|
|
169
|
+
* - Per-item CSS highlight styles via the `highlights` input
|
|
170
|
+
* - Optimistic list updates without a full re-fetch (`updateListItems`, `updateTileList`, `dropItems`)
|
|
171
|
+
* - Keyboard shortcuts: **Ctrl+C** emits `tileCopy`, **Ctrl+X** emits `tileCut`
|
|
172
|
+
* - Optional custom context menu via projected `TileActionsMenuComponent`
|
|
173
|
+
* - Isolated tile config bucket so multiple instances can have different column layouts
|
|
174
|
+
*
|
|
175
|
+
* **Content Projection Slots:**
|
|
176
|
+
* - `TileActionsMenuComponent` — optional; project a `<yuv-tile-actions-menu>` to attach
|
|
177
|
+
* a context menu to every tile's action trigger.
|
|
178
|
+
* - `#empty` — optional template reference; shown when the query returns no results.
|
|
179
|
+
*
|
|
180
|
+
* **Basic usage:**
|
|
181
|
+
* ```html
|
|
182
|
+
* <yuv-tile-list [query]="query" (itemSelect)="onSelect($event)" />
|
|
183
|
+
* ```
|
|
155
184
|
*
|
|
185
|
+
* **Multi-select with custom bucket and highlights:**
|
|
186
|
+
* ```html
|
|
187
|
+
* <yuv-tile-list
|
|
188
|
+
* bucket="my-feature"
|
|
189
|
+
* [query]="query"
|
|
190
|
+
* [multiselect]="true"
|
|
191
|
+
* [highlights]="highlights"
|
|
192
|
+
* (selectionChange)="onSelectionChange($event)"
|
|
193
|
+
* />
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* **With context menu:**
|
|
197
|
+
* ```html
|
|
198
|
+
* <yuv-tile-list [query]="query" (ctxMenu)="onCtxMenu($event)">
|
|
199
|
+
* <yuv-tile-actions-menu>
|
|
200
|
+
* <button mat-menu-item (click)="openDetails()">Open</button>
|
|
201
|
+
* </yuv-tile-actions-menu>
|
|
202
|
+
* </yuv-tile-list>
|
|
203
|
+
* ```
|
|
156
204
|
*/
|
|
157
|
-
const MATERIAL_IMPORTS = [MatIconModule, MatPaginatorModule, MatTooltipModule, MatMenuTrigger];
|
|
158
205
|
class TileListComponent {
|
|
206
|
+
//#region Dependencies
|
|
159
207
|
#objectConfigService;
|
|
160
208
|
#destroyRef;
|
|
161
209
|
#elRef;
|
|
162
210
|
#actionService;
|
|
163
211
|
#dmsService;
|
|
164
|
-
onCopy(event) {
|
|
165
|
-
event.preventDefault();
|
|
166
|
-
if (this._selection.length)
|
|
167
|
-
this.tileCopy.emit(this._selectionToTileData(this._selection));
|
|
168
|
-
}
|
|
169
|
-
onCut(event) {
|
|
170
|
-
event.preventDefault();
|
|
171
|
-
if (this._selection.length)
|
|
172
|
-
this.tileCut.emit(this._selectionToTileData(this._selection));
|
|
173
|
-
}
|
|
174
212
|
#busy;
|
|
175
213
|
#preselect;
|
|
176
214
|
#rawResultItems;
|
|
215
|
+
//#endregion
|
|
177
216
|
constructor() {
|
|
217
|
+
//#region Dependencies
|
|
178
218
|
this.#objectConfigService = inject(ObjectConfigService);
|
|
179
219
|
this.#destroyRef = inject(DestroyRef);
|
|
180
220
|
this.#elRef = inject(ElementRef);
|
|
181
221
|
this.#actionService = inject(ActionsService);
|
|
182
222
|
this.#dmsService = inject(DmsService);
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region Angular stuff
|
|
225
|
+
/**
|
|
226
|
+
* Optional projected `TileActionsMenuComponent` instance.
|
|
227
|
+
*
|
|
228
|
+
* When present, its `matMenu()` is wired as the context menu for every tile's
|
|
229
|
+
* action trigger button. The menu closes automatically whenever the user selects
|
|
230
|
+
* a menu item (managed by `#closeMenuEffect`).
|
|
231
|
+
*
|
|
232
|
+
* Project it into the component:
|
|
233
|
+
* ```html
|
|
234
|
+
* <yuv-tile-list ...>
|
|
235
|
+
* <yuv-tile-actions-menu>
|
|
236
|
+
* <button mat-menu-item>Open</button>
|
|
237
|
+
* </yuv-tile-actions-menu>
|
|
238
|
+
* </yuv-tile-list>
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
183
241
|
this.menuComponent = contentChild(TileActionsMenuComponent);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
242
|
+
/**
|
|
243
|
+
* Optional projected element shown when the query returns an empty result set.
|
|
244
|
+
*
|
|
245
|
+
* Reference the element with the `#empty` template variable:
|
|
246
|
+
* ```html
|
|
247
|
+
* <yuv-tile-list ...>
|
|
248
|
+
* <div #empty>No items found.</div>
|
|
249
|
+
* </yuv-tile-list>
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
188
252
|
this.emptyContent = contentChild('empty');
|
|
253
|
+
/**
|
|
254
|
+
* Reference to the inner `QueryListComponent` instance.
|
|
255
|
+
*
|
|
256
|
+
* Used internally to delegate imperative operations (select, multiSelect, refresh, …).
|
|
257
|
+
* Prefer the public API methods on this component over accessing `list()` directly from
|
|
258
|
+
* the parent, as the inner list's API may change independently.
|
|
259
|
+
*/
|
|
189
260
|
this.list = viewChild.required('list');
|
|
190
|
-
this.menuTriggers = viewChildren(MatMenuTrigger);
|
|
191
|
-
this.transformer = (res) => {
|
|
192
|
-
this.#rawResultItems = res;
|
|
193
|
-
const mappedItems = this.#mapToTileData(res.map((i) => new DmsObject(i)));
|
|
194
|
-
const items = mappedItems.map((item) => ({
|
|
195
|
-
...item,
|
|
196
|
-
actions: (item.actions || [])
|
|
197
|
-
.map((a) => this.#actionService.getActionById(a.id, this.options()?.actionContext))
|
|
198
|
-
.filter((a) => a !== undefined)
|
|
199
|
-
}));
|
|
200
|
-
// untracked(() => this.items.set(items));
|
|
201
|
-
return items;
|
|
202
|
-
};
|
|
203
|
-
this.#busy = computed(() => this.list().busy());
|
|
204
|
-
this._selection = [];
|
|
205
|
-
this.selectedTile = signal([]);
|
|
206
261
|
/**
|
|
207
|
-
*
|
|
262
|
+
* All `MatMenuTrigger` instances rendered inside the tile list.
|
|
263
|
+
*
|
|
264
|
+
* Used by `#closeMenuEffect` to close every open context/action menu when the user
|
|
265
|
+
* selects a menu item, ensuring only one menu is open at a time.
|
|
208
266
|
*/
|
|
209
|
-
this.
|
|
267
|
+
this.menuTriggers = viewChildren(MatMenuTrigger);
|
|
210
268
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
269
|
+
* Namespace key for storing and retrieving this instance's tile configuration.
|
|
270
|
+
*
|
|
271
|
+
* Tile column/field layout is persisted globally via `ObjectConfigService`. Providing
|
|
272
|
+
* a bucket isolates this instance's configuration from the global default, so two
|
|
273
|
+
* tile lists with different purposes (e.g. inbox vs. archive) can each remember their
|
|
274
|
+
* own preferred layout independently.
|
|
275
|
+
*
|
|
276
|
+
* Use a unique, stable string — e.g. `"my-app.inbox-list"`. If omitted, the global
|
|
277
|
+
* default configuration is used.
|
|
215
278
|
*/
|
|
216
279
|
this.bucket = input();
|
|
217
280
|
/**
|
|
218
|
-
*
|
|
281
|
+
* Number of result items to request per page from the search service.
|
|
282
|
+
*
|
|
283
|
+
* Forwarded to the inner `QueryListComponent`. When the total result count exceeds
|
|
284
|
+
* this value, pagination controls appear. Reducing this number improves initial load
|
|
285
|
+
* time; increasing it reduces the need for pagination.
|
|
286
|
+
*
|
|
287
|
+
* @default SearchService.DEFAULT_QUERY_SIZE
|
|
219
288
|
*/
|
|
220
289
|
this.pageSize = input(SearchService.DEFAULT_QUERY_SIZE);
|
|
221
290
|
/**
|
|
222
|
-
*
|
|
291
|
+
* Enables multi-selection mode.
|
|
292
|
+
*
|
|
293
|
+
* When `true`, the user can hold **Shift** to range-select or **Ctrl** to toggle
|
|
294
|
+
* individual tiles, and mouse drag-to-select becomes available. `selectionChange`
|
|
295
|
+
* then emits the full selection array; `itemSelect` still emits only the most
|
|
296
|
+
* recently added single tile.
|
|
297
|
+
*
|
|
223
298
|
* @default false
|
|
224
299
|
*/
|
|
225
300
|
this.multiselect = input(false);
|
|
226
301
|
/**
|
|
227
|
-
*
|
|
302
|
+
* Renders tiles in a compact, reduced-height style.
|
|
303
|
+
*
|
|
304
|
+
* Drives the `[class.dense]` host binding. Use this when vertical space is limited
|
|
305
|
+
* or when many items need to be visible at once without scrolling.
|
|
306
|
+
*
|
|
228
307
|
* @default false
|
|
229
308
|
*/
|
|
230
309
|
this.dense = input(false);
|
|
231
310
|
/**
|
|
232
|
-
*
|
|
311
|
+
* Extended configuration options for the tile list.
|
|
312
|
+
*
|
|
313
|
+
* See `TileListConfigOptions` for the full set of options, including:
|
|
314
|
+
* - `actionContext` — passed to `ActionsService.getActionById()` when resolving inline
|
|
315
|
+
* tile actions, so actions can behave differently per context.
|
|
316
|
+
* - `configTypes` — virtual config type overrides that let you map specific
|
|
317
|
+
* object-type / SOT combinations to a different `ObjectConfigRecord` entry.
|
|
233
318
|
*/
|
|
234
319
|
this.options = input(undefined);
|
|
235
320
|
/**
|
|
236
|
-
*
|
|
321
|
+
* Object flavor to overlay on matching tiles.
|
|
322
|
+
*
|
|
323
|
+
* An `ObjectFlavor` defines an alternative visual representation for objects that carry
|
|
324
|
+
* a specific SOT. When set, tiles whose `DmsObject.sots` array includes
|
|
325
|
+
* `flavor.sot` are rendered using the config entry identified by `flavor.id` instead
|
|
326
|
+
* of their own object-type config.
|
|
327
|
+
*
|
|
328
|
+
* Changes are applied reactively via `#flavorEffect` and re-evaluated against the
|
|
329
|
+
* last raw result set via `applyFlavor()`.
|
|
237
330
|
*/
|
|
238
331
|
this.flavor = input();
|
|
239
332
|
/**
|
|
240
|
-
* The search query to
|
|
241
|
-
*
|
|
333
|
+
* The search query to execute.
|
|
334
|
+
*
|
|
335
|
+
* Accepts a structured `SearchQuery` object or a raw CMIS query string. The query is
|
|
336
|
+
* re-executed reactively every time this input changes. The result set must include the
|
|
337
|
+
* `system:objectTypeId` field — tiles without a resolved object type will throw at
|
|
338
|
+
* mapping time.
|
|
242
339
|
*/
|
|
243
340
|
this.query = input();
|
|
341
|
+
/**
|
|
342
|
+
* Object IDs to select as soon as the list finishes loading.
|
|
343
|
+
*
|
|
344
|
+
* If the list is still busy when this input is set, the IDs are stored internally and
|
|
345
|
+
* applied once the query completes (via `#preselectEffect`). Items whose IDs are not
|
|
346
|
+
* found in the current result set are silently ignored.
|
|
347
|
+
*
|
|
348
|
+
* For programmatic selection after the list is loaded, prefer `selectById()`.
|
|
349
|
+
*
|
|
350
|
+
* @default []
|
|
351
|
+
*/
|
|
244
352
|
this.preselect = input([]);
|
|
245
|
-
|
|
353
|
+
/**
|
|
354
|
+
* Per-item CSS style overrides rendered as inline styles on matching tiles.
|
|
355
|
+
*
|
|
356
|
+
* Each `TileListHighlight` entry specifies an array of object IDs and a
|
|
357
|
+
* `cssStyles` record. All styles for the same ID are merged, with later entries in
|
|
358
|
+
* the array taking precedence. Used to visually call out specific items (e.g. newly
|
|
359
|
+
* created, recently modified, flagged).
|
|
360
|
+
*
|
|
361
|
+
* @default []
|
|
362
|
+
*/
|
|
246
363
|
this.highlights = input([]);
|
|
247
|
-
this.highlightStyles = computed(() => {
|
|
248
|
-
const x = {};
|
|
249
|
-
(this.highlights() || []).forEach((highlight) => {
|
|
250
|
-
highlight.ids.forEach((id) => {
|
|
251
|
-
if (!x[id])
|
|
252
|
-
x[id] = {};
|
|
253
|
-
x[id] = { ...x[id], ...highlight.cssStyles };
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
return x;
|
|
257
|
-
});
|
|
258
364
|
/**
|
|
259
|
-
*
|
|
365
|
+
* Guard function that temporarily blocks all selection changes.
|
|
366
|
+
*
|
|
367
|
+
* Forwarded to the inner `ListComponent`. As long as the returned predicate evaluates
|
|
368
|
+
* to `true`, any attempt to change the selection is silently ignored. Useful when the
|
|
369
|
+
* parent has unsaved changes tied to the current selection.
|
|
370
|
+
*
|
|
371
|
+
* @default () => false (never prevents)
|
|
260
372
|
*/
|
|
261
373
|
this.preventChangeUntil = input(() => false);
|
|
262
374
|
/**
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
375
|
+
* Automatically selects an item when the list is first rendered.
|
|
376
|
+
*
|
|
377
|
+
* Follows the same priority as `ListComponent.autoSelect`: first non-disabled item
|
|
378
|
+
* with the `selected` attribute, then index 0. Accepts any truthy string so it can
|
|
379
|
+
* be set as a plain HTML attribute: `<yuv-tile-list autoSelect>`.
|
|
380
|
+
*
|
|
381
|
+
* @default false
|
|
382
|
+
*/
|
|
383
|
+
this.autoSelect = input(false, {
|
|
384
|
+
transform: (value) => coerceBooleanProperty(value)
|
|
385
|
+
});
|
|
386
|
+
/**
|
|
387
|
+
* Suppresses the component's built-in context menu handling.
|
|
388
|
+
*
|
|
389
|
+
* When `true`, right-clicking a tile does not call `event.preventDefault()`, does not
|
|
390
|
+
* auto-select the right-clicked tile, and does not emit `ctxMenu`. Use this when the
|
|
391
|
+
* parent wants to handle `contextmenu` events itself.
|
|
392
|
+
*
|
|
266
393
|
* @default false
|
|
267
394
|
*/
|
|
268
|
-
this.autoSelect = input(false, { transform: (value) => coerceBooleanProperty(value) });
|
|
269
395
|
this.disableCustomContextMenu = input(false);
|
|
270
396
|
/**
|
|
271
|
-
*
|
|
397
|
+
* Emits the `TileData` of the most recently selected tile.
|
|
398
|
+
*
|
|
399
|
+
* In single-select mode this fires for every selection change. In multi-select mode
|
|
400
|
+
* it fires only when exactly one tile ends up selected (i.e. a plain click with no
|
|
401
|
+
* modifier keys). For the full multi-selection result, listen to `selectionChange`.
|
|
272
402
|
*/
|
|
273
403
|
this.itemSelect = output();
|
|
404
|
+
/**
|
|
405
|
+
* Emits the currently selected tiles when the user presses **Ctrl+C**.
|
|
406
|
+
*
|
|
407
|
+
* The parent is responsible for handling the actual copy operation (e.g. writing to
|
|
408
|
+
* the clipboard or storing the objects for a subsequent paste action). The default
|
|
409
|
+
* browser copy behavior is suppressed.
|
|
410
|
+
*/
|
|
274
411
|
this.tileCopy = output();
|
|
412
|
+
/**
|
|
413
|
+
* Emits the currently selected tiles when the user presses **Ctrl+X**.
|
|
414
|
+
*
|
|
415
|
+
* The parent is responsible for handling the cut operation. The default browser cut
|
|
416
|
+
* behavior is suppressed. Typically used together with `dropItems()` on a target list
|
|
417
|
+
* to implement a move-via-clipboard interaction.
|
|
418
|
+
*/
|
|
275
419
|
this.tileCut = output();
|
|
420
|
+
/**
|
|
421
|
+
* Mirrors the inner `QueryListComponent.busy` signal as an output event.
|
|
422
|
+
*
|
|
423
|
+
* Emits `true` when a query request starts and `false` when it completes (or errors).
|
|
424
|
+
* Useful when the parent needs to react to loading state changes without holding a
|
|
425
|
+
* `@ViewChild` reference to this component.
|
|
426
|
+
*/
|
|
276
427
|
this.busy = output();
|
|
428
|
+
/**
|
|
429
|
+
* Emits once per query execution when the search result arrives.
|
|
430
|
+
*
|
|
431
|
+
* Provides the server-side total item count and the raw `SearchResultItem[]` for the
|
|
432
|
+
* current page. Forwarded directly from the inner `QueryListComponent`.
|
|
433
|
+
*/
|
|
277
434
|
this.queryResult = output();
|
|
278
435
|
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
436
|
+
* Emits the full current selection as `TileData[]` on every selection change.
|
|
437
|
+
*
|
|
438
|
+
* Unlike `itemSelect` — which emits a single tile — this output always reflects the
|
|
439
|
+
* complete selection. In single-select mode the array contains at most one element.
|
|
440
|
+
* Emits an empty array when the selection is cleared.
|
|
282
441
|
*/
|
|
283
442
|
this.selectionChange = output();
|
|
284
443
|
/**
|
|
285
|
-
*
|
|
444
|
+
* Emits the `TileData` of a tile when it is double-clicked.
|
|
445
|
+
*
|
|
446
|
+
* The primary single-click selection is handled separately via `itemSelect`. Use this
|
|
447
|
+
* output to trigger a secondary action such as opening a detail view or navigating
|
|
448
|
+
* to a route.
|
|
286
449
|
*/
|
|
287
450
|
this.itemDblClick = output();
|
|
451
|
+
/**
|
|
452
|
+
* Emits when the user right-clicks a tile and `disableCustomContextMenu` is `false`.
|
|
453
|
+
*
|
|
454
|
+
* Provides the originating mouse event (for positioning a custom menu overlay) and
|
|
455
|
+
* the current selection as an array of object IDs. The right-clicked tile is
|
|
456
|
+
* auto-selected before the event fires if it was not already part of the selection.
|
|
457
|
+
*/
|
|
458
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
288
459
|
this.ctxMenu = output();
|
|
289
|
-
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region Properties
|
|
462
|
+
/**
|
|
463
|
+
* The `MatMenu` instance resolved from the projected `TileActionsMenuComponent`.
|
|
464
|
+
*
|
|
465
|
+
* `null` when no `TileActionsMenuComponent` is projected. Used in the template to
|
|
466
|
+
* conditionally bind `[matMenuTriggerFor]` on tile action buttons.
|
|
467
|
+
*/
|
|
468
|
+
this.menu = computed(() => {
|
|
469
|
+
const comp = this.menuComponent();
|
|
470
|
+
return comp?.matMenu() ?? null;
|
|
471
|
+
});
|
|
472
|
+
/**
|
|
473
|
+
* The full `TileData` objects for all currently selected tiles.
|
|
474
|
+
*
|
|
475
|
+
* Updated on every selection change alongside `selection`. Prefer this signal when
|
|
476
|
+
* the parent needs rich tile data (fields, DMS object reference, actions) rather than
|
|
477
|
+
* just IDs.
|
|
478
|
+
*/
|
|
479
|
+
this.selectedTile = signal([]);
|
|
480
|
+
/**
|
|
481
|
+
* Object IDs of the currently selected tiles.
|
|
482
|
+
*
|
|
483
|
+
* A flat `string[]` signal — convenient for ID comparisons, permission checks, or
|
|
484
|
+
* passing to services that work with IDs. For the full tile data, use `selectedTile`.
|
|
485
|
+
*/
|
|
486
|
+
this.selection = signal([]);
|
|
487
|
+
this.#busy = computed(() => this.list().busy());
|
|
488
|
+
this.#preselect = linkedSignal(this.preselect);
|
|
489
|
+
/**
|
|
490
|
+
* Computed map of per-object-ID inline CSS styles derived from the `highlights` input.
|
|
491
|
+
*
|
|
492
|
+
* Merges all `TileListHighlight` entries that reference the same ID so the template
|
|
493
|
+
* only needs a single lookup: `highlightStyles()[item.id]`. Returns an empty object
|
|
494
|
+
* for IDs with no highlight rules.
|
|
495
|
+
*/
|
|
496
|
+
this.highlightStyles = computed(() => {
|
|
497
|
+
const x = {};
|
|
498
|
+
(this.highlights() || []).forEach((highlight) => {
|
|
499
|
+
highlight.ids.forEach((id) => {
|
|
500
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
501
|
+
if (!x[id])
|
|
502
|
+
x[id] = {};
|
|
503
|
+
x[id] = { ...x[id], ...highlight.cssStyles };
|
|
504
|
+
});
|
|
505
|
+
});
|
|
506
|
+
return x;
|
|
507
|
+
});
|
|
508
|
+
/**
|
|
509
|
+
* The `TileData` view models currently rendered in the list.
|
|
510
|
+
*
|
|
511
|
+
* Populated by `onQueryResult()` after each successful search response and also
|
|
512
|
+
* prepended by `dropItems()`. The template iterates over this signal directly.
|
|
513
|
+
* Read this from the parent to access displayed tile data without an extra query.
|
|
514
|
+
*/
|
|
290
515
|
this.items = signal([]);
|
|
516
|
+
/**
|
|
517
|
+
* Indicates whether at least one search has been executed successfully.
|
|
518
|
+
*
|
|
519
|
+
* Remains `false` until the first `onQueryResult()` call. Use this in the template
|
|
520
|
+
* to distinguish between "initial loading" (show a spinner) and "empty result"
|
|
521
|
+
* (show the empty-state slot) without relying on `items().length` alone.
|
|
522
|
+
*/
|
|
291
523
|
this.searchExecuted = signal(false);
|
|
524
|
+
this._selection = [];
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region Public methods
|
|
527
|
+
/**
|
|
528
|
+
* Transformer function passed to the inner `QueryListComponent`.
|
|
529
|
+
*
|
|
530
|
+
* Maps raw `SearchResultItem[]` to the `InnerTileData` view model by:
|
|
531
|
+
* 1. Storing the raw items in `#rawResultItems` so `applyFlavor()` can re-map them
|
|
532
|
+
* without a new server request.
|
|
533
|
+
* 2. Calling `#mapToTileData()` to resolve `ObjectConfig` fields (title, icon, …).
|
|
534
|
+
* 3. Resolving each tile's action IDs to full `Action` objects via `ActionsService`,
|
|
535
|
+
* filtering out any IDs that are not registered.
|
|
536
|
+
*
|
|
537
|
+
* Re-runs automatically whenever the query result or the `ObjectConfigRecord` changes
|
|
538
|
+
* (the latter is triggered by calling `list().runTransformerAgain()` from
|
|
539
|
+
* `#getObjectConfig()`).
|
|
540
|
+
*/
|
|
541
|
+
this.transformer = (res) => {
|
|
542
|
+
this.#rawResultItems = res;
|
|
543
|
+
const mappedItems = this.#mapToTileData(res.map((i) => new DmsObject(i)));
|
|
544
|
+
const items = mappedItems.map((item) => ({
|
|
545
|
+
...item,
|
|
546
|
+
actions: (item.actions || [])
|
|
547
|
+
.map((action) => this.#actionService.getActionById(action.id, this.options()?.actionContext))
|
|
548
|
+
.filter((action) => action !== undefined)
|
|
549
|
+
}));
|
|
550
|
+
// untracked(() => this.items.set(items));
|
|
551
|
+
return items;
|
|
552
|
+
};
|
|
553
|
+
//#endregion
|
|
292
554
|
// #region Effect Methods
|
|
293
555
|
this.#flavorEffect = () => {
|
|
294
|
-
const
|
|
295
|
-
if (
|
|
296
|
-
this.applyFlavor(
|
|
556
|
+
const flavor = this.flavor();
|
|
557
|
+
if (flavor)
|
|
558
|
+
this.applyFlavor(flavor);
|
|
297
559
|
};
|
|
298
560
|
this.#preselectEffect = () => {
|
|
299
561
|
const preselect = this.#preselect();
|
|
@@ -319,12 +581,152 @@ class TileListComponent {
|
|
|
319
581
|
effect(this.#preselectEffect);
|
|
320
582
|
effect(this.#closeMenuEffect);
|
|
321
583
|
}
|
|
584
|
+
//#region Lifecycle hooks
|
|
585
|
+
ngOnInit() {
|
|
586
|
+
this.#getObjectConfig();
|
|
587
|
+
}
|
|
588
|
+
//#endregion
|
|
589
|
+
//#region UI Methods
|
|
590
|
+
/**
|
|
591
|
+
* Host **Ctrl+C** handler — emits the current selection via `tileCopy`.
|
|
592
|
+
*
|
|
593
|
+
* Suppresses the default browser copy behavior. Fires only when at least one tile
|
|
594
|
+
* is selected. Bound via the `host` metadata as `(keydown.control.c)`.
|
|
595
|
+
*
|
|
596
|
+
* @param event The keyboard event (used to call `preventDefault`).
|
|
597
|
+
*/
|
|
598
|
+
onCopy(event) {
|
|
599
|
+
event.preventDefault();
|
|
600
|
+
if (this._selection.length)
|
|
601
|
+
this.tileCopy.emit(this._selectionToTileData(this._selection));
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Host **Ctrl+X** handler — emits the current selection via `tileCut`.
|
|
605
|
+
*
|
|
606
|
+
* Suppresses the default browser cut behavior. Fires only when at least one tile
|
|
607
|
+
* is selected. Bound via the `host` metadata as `(keydown.control.x)`.
|
|
608
|
+
*
|
|
609
|
+
* @param event The keyboard event (used to call `preventDefault`).
|
|
610
|
+
*/
|
|
611
|
+
onCut(event) {
|
|
612
|
+
event.preventDefault();
|
|
613
|
+
if (this._selection.length)
|
|
614
|
+
this.tileCut.emit(this._selectionToTileData(this._selection));
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Handles a double-click event forwarded from the inner `QueryListComponent`.
|
|
618
|
+
*
|
|
619
|
+
* If the double-clicked tile is not already the sole selected item, it is selected
|
|
620
|
+
* first (without modifier keys) so that `itemDblClick` always fires in the context
|
|
621
|
+
* of a known selection state. Then `itemDblClick` is emitted with the tile's data.
|
|
622
|
+
*
|
|
623
|
+
* Called from the template via `(itemDoubleClick)`. Not intended for external callers.
|
|
624
|
+
*
|
|
625
|
+
* @param index Zero-based index of the double-clicked tile in the current `items` array.
|
|
626
|
+
*/
|
|
322
627
|
onItemDoubleClick(index) {
|
|
323
628
|
const selectionIsEqual = this._selection.length === 1 && this._selection[0] === index;
|
|
324
629
|
if (!selectionIsEqual)
|
|
325
630
|
this.#internalSelectByIndex(index);
|
|
326
631
|
this.itemDblClick.emit(this.items()[index]);
|
|
327
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Handles the query result emitted by the inner `QueryListComponent`.
|
|
635
|
+
*
|
|
636
|
+
* Marks the component as having executed at least one search (`searchExecuted`),
|
|
637
|
+
* updates the `items` signal with the freshly mapped `TileData` view models, and
|
|
638
|
+
* re-emits the raw result via `queryResult` so the parent can update counters or
|
|
639
|
+
* analytics without a separate query.
|
|
640
|
+
*
|
|
641
|
+
* Called from the template via `(queryResult)`. Not intended for external callers.
|
|
642
|
+
*
|
|
643
|
+
* @param result The search result object containing `totalCount` and `items`.
|
|
644
|
+
*/
|
|
645
|
+
onQueryResult(result) {
|
|
646
|
+
this.searchExecuted.set(true);
|
|
647
|
+
const newItems = this.#mapToTileData(result.items.map((i) => new DmsObject(i)));
|
|
648
|
+
// Preserve drop-in items at the top so that `items` indices stay in sync with
|
|
649
|
+
// the rendered `resultItems` from QueryListComponent (which prepends drop-ins).
|
|
650
|
+
const dropInCount = this.list().dropInSize();
|
|
651
|
+
const currentItems = this.items();
|
|
652
|
+
const dropInItems = currentItems.slice(0, dropInCount);
|
|
653
|
+
let merged;
|
|
654
|
+
if (dropInItems.length > 0) {
|
|
655
|
+
const dropInIds = new Set(dropInItems.map((item) => item.id));
|
|
656
|
+
const filtered = newItems.filter((item) => !dropInIds.has(item.id));
|
|
657
|
+
merged = [...dropInItems, ...filtered];
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
merged = newItems;
|
|
661
|
+
}
|
|
662
|
+
// If any selected items are absent from the new result set (e.g. after deletion),
|
|
663
|
+
// clear the internal selection indices. Without this, #isSelectionEqual would return
|
|
664
|
+
// true when the inner list auto-selects the same index (now pointing to a different
|
|
665
|
+
// item), causing selectionChange to be silently skipped and the right panel to stay
|
|
666
|
+
// stale with the deleted item's content.
|
|
667
|
+
if (this._selection.length > 0) {
|
|
668
|
+
const mergedIds = new Set(merged.map((i) => i.id));
|
|
669
|
+
const selectionOutdated = this._selection.some((idx) => !mergedIds.has(this.items()[idx]?.id));
|
|
670
|
+
if (selectionOutdated) {
|
|
671
|
+
this._selection = [];
|
|
672
|
+
this._lastSelection = undefined;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
this.items.set(merged);
|
|
676
|
+
this.queryResult.emit(result);
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Handles the committed selection emitted by the inner list.
|
|
680
|
+
*
|
|
681
|
+
* For a single-item selection the full `#select()` path is taken so that `itemSelect`
|
|
682
|
+
* is also emitted. For multi-item selections only `#updateSelectionState()` runs to
|
|
683
|
+
* keep `selectionChange` and the internal state in sync without the single-item emit.
|
|
684
|
+
*
|
|
685
|
+
* Called from the template via `(itemSelect)` on `yuv-query-list`.
|
|
686
|
+
* Not intended for external callers.
|
|
687
|
+
*
|
|
688
|
+
* @param sel Array of zero-based indices representing the new selection.
|
|
689
|
+
*/
|
|
690
|
+
onListItemsSelect(sel) {
|
|
691
|
+
if (sel.length === 1) {
|
|
692
|
+
this.#internalSelectByIndex(sel[0]);
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
this.#updateSelectionState(sel);
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Handles live drag-selection changes forwarded from the inner `QueryListComponent`.
|
|
699
|
+
*
|
|
700
|
+
* Fires continuously while the user drags across tiles, updating the selection state
|
|
701
|
+
* in real time so the visual highlight tracks the gesture. Does not emit `itemSelect`
|
|
702
|
+
* (that fires only on the final committed selection via `onListItemsSelect`).
|
|
703
|
+
*
|
|
704
|
+
* Called from the template via `(dragSelectChange)`. Not intended for external callers.
|
|
705
|
+
*
|
|
706
|
+
* @param sel Current array of zero-based indices covered by the drag gesture.
|
|
707
|
+
*/
|
|
708
|
+
onDragSelectChange(sel) {
|
|
709
|
+
this.#updateSelectionState(sel);
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Handles a right-click (contextmenu) event on a tile.
|
|
713
|
+
*
|
|
714
|
+
* Suppresses the browser's native context menu. If the clicked tile is not already
|
|
715
|
+
* part of the selection, it is selected first. After a short delay (to allow the
|
|
716
|
+
* selection state to propagate), `ctxMenu` is emitted with the originating event and
|
|
717
|
+
* the current selection so the parent can position and populate a custom menu.
|
|
718
|
+
*
|
|
719
|
+
* The delay is intentional: it gives Angular change detection a tick to apply the
|
|
720
|
+
* selection update before the parent reads `selection()` in the `ctxMenu` handler.
|
|
721
|
+
*
|
|
722
|
+
* No-ops when `disableCustomContextMenu` is `true`.
|
|
723
|
+
*
|
|
724
|
+
* Called from the template via `(contextmenu)` on each tile. Not intended for
|
|
725
|
+
* external callers.
|
|
726
|
+
*
|
|
727
|
+
* @param event The originating mouse event (used to suppress default and for positioning).
|
|
728
|
+
* @param index Zero-based index of the right-clicked tile.
|
|
729
|
+
*/
|
|
328
730
|
contextMenuHandler(event, index) {
|
|
329
731
|
if (this.disableCustomContextMenu())
|
|
330
732
|
return;
|
|
@@ -335,18 +737,45 @@ class TileListComponent {
|
|
|
335
737
|
}
|
|
336
738
|
setTimeout(() => {
|
|
337
739
|
this.ctxMenu.emit({ event, selection: this.selection() });
|
|
740
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
338
741
|
}, 200);
|
|
339
742
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
743
|
+
/**
|
|
744
|
+
* Executes a tile inline action against the appropriate set of DMS objects.
|
|
745
|
+
*
|
|
746
|
+
* Resolves the target objects from the DMS service: if the tile whose action button
|
|
747
|
+
* was clicked is part of the current selection, the action runs against all selected
|
|
748
|
+
* objects (batch action); otherwise it runs against only that single tile's object.
|
|
749
|
+
*
|
|
750
|
+
* Suppresses the click event to prevent the tile's own selection handler from firing.
|
|
751
|
+
* Called from the template via the tile action buttons. Not intended for external callers.
|
|
752
|
+
*
|
|
753
|
+
* @param tileData The tile whose action button was clicked.
|
|
754
|
+
* @param action The resolved `Action` to execute.
|
|
755
|
+
* @param event The originating click event (stopped to prevent tile selection).
|
|
756
|
+
*/
|
|
757
|
+
executeAction(tileData, action, event) {
|
|
758
|
+
event.preventDefault();
|
|
759
|
+
event.stopPropagation();
|
|
343
760
|
const selectedIds = this.selection();
|
|
344
|
-
const ids = selectedIds.includes(
|
|
761
|
+
const ids = selectedIds.includes(tileData.id) ? selectedIds : [tileData.id];
|
|
345
762
|
this.#dmsService
|
|
346
763
|
.getDmsObjects(ids)
|
|
347
|
-
.pipe(switchMap((objects) =>
|
|
764
|
+
.pipe(switchMap((objects) => action.run(objects)))
|
|
348
765
|
.subscribe();
|
|
349
766
|
}
|
|
767
|
+
/**
|
|
768
|
+
* Selects tiles by their object IDs.
|
|
769
|
+
*
|
|
770
|
+
* Looks up each ID in the current `items` array and selects the matching indices
|
|
771
|
+
* in the inner list. If the list is still loading when this is called, the IDs are
|
|
772
|
+
* stored and applied automatically once the query completes (via `#preselectEffect`).
|
|
773
|
+
*
|
|
774
|
+
* IDs not found in the current result set are silently ignored. The first found item
|
|
775
|
+
* also receives keyboard focus via `setActiveItem()`.
|
|
776
|
+
*
|
|
777
|
+
* @param ids Array of object IDs (`system:objectId`) to select.
|
|
778
|
+
*/
|
|
350
779
|
selectById(ids) {
|
|
351
780
|
if (this.#busy()) {
|
|
352
781
|
this.#preselect.set(ids);
|
|
@@ -355,98 +784,115 @@ class TileListComponent {
|
|
|
355
784
|
this.#executeSelectById(ids);
|
|
356
785
|
}
|
|
357
786
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
787
|
+
/**
|
|
788
|
+
* Programmatically replaces the entire selection with the given indices.
|
|
789
|
+
*
|
|
790
|
+
* Only effective when `multiselect` is `true`. Delegates to the inner
|
|
791
|
+
* `QueryListComponent`. Out-of-range indices are silently discarded.
|
|
792
|
+
*
|
|
793
|
+
* @param index Array of zero-based item indices to select.
|
|
794
|
+
*/
|
|
367
795
|
multiSelect(index) {
|
|
368
796
|
this.list().multiSelect(index);
|
|
369
797
|
}
|
|
798
|
+
/**
|
|
799
|
+
* Selects the tile at the given zero-based index.
|
|
800
|
+
*
|
|
801
|
+
* Delegates to the inner `QueryListComponent`. Clamps the index to the valid range.
|
|
802
|
+
* Use `selectById()` when you have object IDs rather than positional indices.
|
|
803
|
+
*
|
|
804
|
+
* @param index Zero-based index of the tile to select.
|
|
805
|
+
*/
|
|
370
806
|
select(index) {
|
|
371
807
|
this.list().select(index);
|
|
372
808
|
}
|
|
373
|
-
#internalSelectByIndex(idx, evt) {
|
|
374
|
-
this.#select(idx, evt?.shiftKey, evt?.ctrlKey);
|
|
375
|
-
}
|
|
376
|
-
onQueryResult(e) {
|
|
377
|
-
this.searchExecuted.set(true);
|
|
378
|
-
this.items.set(this.#mapToTileData(e.items.map((i) => new DmsObject(i))));
|
|
379
|
-
this.queryResult.emit(e);
|
|
380
|
-
}
|
|
381
|
-
onListItemsSelect(sel) {
|
|
382
|
-
if (sel.length === 1) {
|
|
383
|
-
this.#internalSelectByIndex(sel[0]);
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
this.#updateSelectionState(sel);
|
|
387
|
-
}
|
|
388
|
-
onDragSelectChange(sel) {
|
|
389
|
-
this.#updateSelectionState(sel);
|
|
390
|
-
}
|
|
391
809
|
/**
|
|
392
|
-
*
|
|
393
|
-
*
|
|
810
|
+
* Re-executes the current query without changing the page or query parameters.
|
|
811
|
+
*
|
|
812
|
+
* If pagination is active, re-fetches the same page. Use this to reflect server-side
|
|
813
|
+
* changes (e.g. after a create/delete operation) without navigating away.
|
|
394
814
|
*/
|
|
395
|
-
#updateSelectionState(sel) {
|
|
396
|
-
const sorted = [...sel].sort();
|
|
397
|
-
// skip if selection hasn't changed
|
|
398
|
-
if (this.#isSelectionEqual(sorted))
|
|
399
|
-
return;
|
|
400
|
-
this._selection = sorted;
|
|
401
|
-
this._lastSelection = this._selection.length ? this._selection[this._selection.length - 1] : undefined;
|
|
402
|
-
const tiles = this._selectionToTileData(this._selection);
|
|
403
|
-
this.selection.set(tiles.map((t) => t.id));
|
|
404
|
-
this.selectionChange.emit(tiles);
|
|
405
|
-
this.selectedTile.set(tiles);
|
|
406
|
-
}
|
|
407
815
|
refresh() {
|
|
408
816
|
this.list().refresh();
|
|
409
817
|
}
|
|
818
|
+
/**
|
|
819
|
+
* Prepends `DmsObject` instances to the top of the tile list as temporary drop-in items.
|
|
820
|
+
*
|
|
821
|
+
* The objects are mapped through the same `ObjectConfig` resolution pipeline as regular
|
|
822
|
+
* query results, including action resolution. The existing selection is shifted so that
|
|
823
|
+
* currently selected tiles remain selected after the prepend.
|
|
824
|
+
*
|
|
825
|
+
* Use this for optimistic UI: show newly created or pasted objects immediately before
|
|
826
|
+
* the server index reflects them in the query results.
|
|
827
|
+
*
|
|
828
|
+
* Drop-in items are cleared automatically when the user navigates to a different page.
|
|
829
|
+
*
|
|
830
|
+
* @param objects `DmsObject` instances to prepend to the visible list.
|
|
831
|
+
*/
|
|
410
832
|
dropItems(objects) {
|
|
411
833
|
const mappedItems = this.#mapToTileData(objects);
|
|
412
834
|
const items = mappedItems.map((item) => ({
|
|
413
835
|
...item,
|
|
414
836
|
actions: (item.actions || [])
|
|
415
|
-
.map((
|
|
416
|
-
.filter((
|
|
837
|
+
.map((objectConfigAction) => this.#actionService.getActionById(objectConfigAction.id, this.options()?.actionContext))
|
|
838
|
+
.filter((action) => action !== undefined)
|
|
417
839
|
}));
|
|
418
840
|
this.items.set([...items, ...this.items()]);
|
|
419
841
|
this.list().dropItems(items);
|
|
420
842
|
}
|
|
843
|
+
/**
|
|
844
|
+
* Toggles an `ObjectFlavor` on or off and re-maps the current result set.
|
|
845
|
+
*
|
|
846
|
+
* If the given flavor is already the active `appliedFlavor`, it is cleared (toggle
|
|
847
|
+
* off). Otherwise the flavor is applied and all tiles whose `DmsObject.sots` includes
|
|
848
|
+
* `flavor.sot` are re-rendered using the config entry for `flavor.id`.
|
|
849
|
+
*
|
|
850
|
+
* Re-mapping runs against the last raw `SearchResultItem[]` (`#rawResultItems`) so
|
|
851
|
+
* no server round-trip is needed. Called automatically by `#flavorEffect` when the
|
|
852
|
+
* `flavor` input changes.
|
|
853
|
+
*
|
|
854
|
+
* @param flavor The `ObjectFlavor` to apply or remove.
|
|
855
|
+
*/
|
|
421
856
|
applyFlavor(flavor) {
|
|
422
857
|
this.appliedFlavor = this.appliedFlavor?.id === flavor.id ? undefined : flavor;
|
|
423
858
|
if (this.#rawResultItems)
|
|
424
859
|
this.items.set(this.#mapToTileData(this.#rawResultItems.map((i) => new DmsObject(i))));
|
|
425
860
|
}
|
|
426
861
|
/**
|
|
427
|
-
*
|
|
862
|
+
* Applies per-index optimistic overrides to the displayed tile data.
|
|
428
863
|
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
864
|
+
* Delegates to the inner `QueryListComponent.updateListItems()`. Each entry patches
|
|
865
|
+
* the tile at the given `index` with a new `TileData` value. Overrides accumulate
|
|
866
|
+
* until the user navigates to a different page, at which point the fresh server
|
|
867
|
+
* response replaces all local data.
|
|
431
868
|
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
869
|
+
* For DMS-object-based updates, prefer `updateTileList()` which resolves indices
|
|
870
|
+
* from object IDs automatically.
|
|
871
|
+
*
|
|
872
|
+
* @param updates Array of `{ index, value }` pairs describing which tiles to patch.
|
|
434
873
|
*/
|
|
435
874
|
updateListItems(updates) {
|
|
436
875
|
this.list().updateListItems(updates);
|
|
437
876
|
}
|
|
438
877
|
/**
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
*
|
|
878
|
+
* Optimistically updates tiles in the list that correspond to the given `DmsObject` instances.
|
|
879
|
+
*
|
|
880
|
+
* For each provided object, finds its matching tile by `id` in the current `items`
|
|
881
|
+
* array, re-maps it through `#mapToTileData()` to get a fresh `TileData` view model,
|
|
882
|
+
* and applies it via `updateListItems()`. Tiles not currently visible in the list are
|
|
883
|
+
* silently skipped.
|
|
884
|
+
*
|
|
885
|
+
* This is the preferred way to reflect server-confirmed changes (e.g. rename, metadata
|
|
886
|
+
* edit) without issuing a full query refresh. Updates are scoped to the current page
|
|
887
|
+
* and are discarded on the next page navigation.
|
|
888
|
+
*
|
|
889
|
+
* @param listItems Updated `DmsObject` instances to apply to the list.
|
|
444
890
|
*/
|
|
445
891
|
updateTileList(listItems) {
|
|
446
892
|
const updates = [];
|
|
447
893
|
listItems.forEach((item) => {
|
|
448
894
|
const idx = this.items().findIndex((listItem) => listItem.id === item.id);
|
|
449
|
-
if (idx >= 0 && this.
|
|
895
|
+
if (idx >= 0 && this.objectConfig) {
|
|
450
896
|
const mappedTileData = this.#mapToTileData([item]);
|
|
451
897
|
updates.push({ index: idx, value: mappedTileData[0] });
|
|
452
898
|
}
|
|
@@ -454,8 +900,15 @@ class TileListComponent {
|
|
|
454
900
|
this.updateListItems(updates);
|
|
455
901
|
}
|
|
456
902
|
/**
|
|
457
|
-
* Clears the current selection.
|
|
458
|
-
*
|
|
903
|
+
* Clears the current selection and resets all internal selection state.
|
|
904
|
+
*
|
|
905
|
+
* Resets `_selection`, `_lastSelection`, the `selection` signal, and `selectedTile`
|
|
906
|
+
* to empty. Also delegates to the inner list's `clear()` to sync the visual state.
|
|
907
|
+
* If the selection is already empty, the method is a no-op.
|
|
908
|
+
*
|
|
909
|
+
* @param silent When `true`, skips emitting `selectionChange`. Use this when the
|
|
910
|
+
* parent needs to reset state programmatically without triggering
|
|
911
|
+
* downstream reactions.
|
|
459
912
|
*/
|
|
460
913
|
clearSelection(silent = false) {
|
|
461
914
|
if (this._selection.length) {
|
|
@@ -469,8 +922,14 @@ class TileListComponent {
|
|
|
469
922
|
}
|
|
470
923
|
}
|
|
471
924
|
/**
|
|
472
|
-
*
|
|
473
|
-
*
|
|
925
|
+
* Advances the selection to the next tile in the list.
|
|
926
|
+
*
|
|
927
|
+
* Moves from the last selected index forward by one. Wraps around to index 0
|
|
928
|
+
* when the last tile is currently selected. Does nothing if no tile is selected
|
|
929
|
+
* (`_lastSelection` is `undefined`).
|
|
930
|
+
*
|
|
931
|
+
* Useful for implementing keyboard-driven "next item" navigation from a parent
|
|
932
|
+
* detail panel without giving focus back to the list.
|
|
474
933
|
*/
|
|
475
934
|
selectNext() {
|
|
476
935
|
if (this._lastSelection !== undefined) {
|
|
@@ -481,8 +940,14 @@ class TileListComponent {
|
|
|
481
940
|
}
|
|
482
941
|
}
|
|
483
942
|
/**
|
|
484
|
-
*
|
|
485
|
-
*
|
|
943
|
+
* Moves the selection to the previous tile in the list.
|
|
944
|
+
*
|
|
945
|
+
* Moves from the last selected index backward by one. Wraps around to the last tile
|
|
946
|
+
* when index 0 is currently selected. Does nothing if no tile is selected
|
|
947
|
+
* (`_lastSelection` is `undefined`).
|
|
948
|
+
*
|
|
949
|
+
* Useful for implementing keyboard-driven "previous item" navigation from a parent
|
|
950
|
+
* detail panel without giving focus back to the list.
|
|
486
951
|
*/
|
|
487
952
|
selectPrev() {
|
|
488
953
|
if (this._lastSelection !== undefined) {
|
|
@@ -492,14 +957,69 @@ class TileListComponent {
|
|
|
492
957
|
this.#select(i);
|
|
493
958
|
}
|
|
494
959
|
}
|
|
495
|
-
|
|
496
|
-
|
|
960
|
+
/**
|
|
961
|
+
* Handles a click on a projected `TileActionsMenuComponent` menu item.
|
|
962
|
+
*
|
|
963
|
+
* If the tile that owns the clicked menu item is part of the current selection,
|
|
964
|
+
* the click event is stopped from propagating so the tile's own `(click)` handler
|
|
965
|
+
* does not deselect other tiles. If the tile is not selected, the event is allowed
|
|
966
|
+
* to propagate normally so the tile gets selected as a side effect.
|
|
967
|
+
*
|
|
968
|
+
* Called from the template via the `TileActionsMenuComponent` item click binding.
|
|
969
|
+
* Not intended for external callers.
|
|
970
|
+
*
|
|
971
|
+
* @param tileData The tile that owns the clicked menu item.
|
|
972
|
+
* @param event The originating click event.
|
|
973
|
+
*/
|
|
974
|
+
menuItemClicked(tileData, event) {
|
|
975
|
+
if (this.selection().includes(tileData.id)) {
|
|
497
976
|
// only prevent event propagation if the click came from an element that
|
|
498
977
|
// is part of the current selection
|
|
499
978
|
event.stopPropagation();
|
|
500
979
|
event.preventDefault();
|
|
501
980
|
}
|
|
502
981
|
}
|
|
982
|
+
//#endregion
|
|
983
|
+
//#region Utilities
|
|
984
|
+
#getObjectConfig() {
|
|
985
|
+
this.#objectConfigService
|
|
986
|
+
.getObjectConfigs$(this.bucket() || '', true)
|
|
987
|
+
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
988
|
+
.subscribe({
|
|
989
|
+
next: (res) => {
|
|
990
|
+
this.objectConfig = res;
|
|
991
|
+
this.list().runTransformerAgain();
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
#internalSelectByIndex(idx, evt) {
|
|
996
|
+
this.#select(idx, evt?.shiftKey, evt?.ctrlKey);
|
|
997
|
+
}
|
|
998
|
+
#executeSelectById(ids) {
|
|
999
|
+
const indices = ids.map((id) => this.items().findIndex((i) => i.id === id)).filter((i) => i !== -1);
|
|
1000
|
+
this.list().multiSelect(indices);
|
|
1001
|
+
if (indices.length > 0) {
|
|
1002
|
+
this.list().setActiveItem(indices[0]);
|
|
1003
|
+
}
|
|
1004
|
+
this.#elRef.nativeElement.focus();
|
|
1005
|
+
this.#updateSelectionState(indices);
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* Shared method to update all selection state and emit outputs.
|
|
1009
|
+
* Used by `onListItemsSelect`, `onDragSelectChange`, and `selectById`.
|
|
1010
|
+
*/
|
|
1011
|
+
#updateSelectionState(sel) {
|
|
1012
|
+
const sorted = [...sel].sort();
|
|
1013
|
+
// skip if selection hasn't changed
|
|
1014
|
+
if (this.#isSelectionEqual(sorted))
|
|
1015
|
+
return;
|
|
1016
|
+
this._selection = sorted;
|
|
1017
|
+
this._lastSelection = this._selection.length ? this._selection[this._selection.length - 1] : undefined;
|
|
1018
|
+
const tiles = this._selectionToTileData(this._selection);
|
|
1019
|
+
this.selection.set(tiles.map((tile) => tile.id));
|
|
1020
|
+
this.selectionChange.emit(tiles);
|
|
1021
|
+
this.selectedTile.set(tiles);
|
|
1022
|
+
}
|
|
503
1023
|
#select(index, shiftKey = false, ctrlKey = false) {
|
|
504
1024
|
this.#elRef.nativeElement.focus();
|
|
505
1025
|
let newSelection;
|
|
@@ -542,69 +1062,76 @@ class TileListComponent {
|
|
|
542
1062
|
this._selection = newSelection;
|
|
543
1063
|
this._lastSelection = this._selection.length === 0 ? undefined : index;
|
|
544
1064
|
const tiles = this._selectionToTileData(this._selection);
|
|
545
|
-
this.selection.set(tiles.map((
|
|
1065
|
+
this.selection.set(tiles.map((tile) => tile.id));
|
|
546
1066
|
this.selectionChange.emit(tiles);
|
|
1067
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
547
1068
|
tiles.length === 1 && this.itemSelect.emit(tiles[0]);
|
|
548
1069
|
this.selectedTile.set(tiles);
|
|
549
1070
|
}
|
|
550
1071
|
#isSelectionEqual(newSelection) {
|
|
551
1072
|
if (newSelection.length !== this._selection.length)
|
|
552
1073
|
return false;
|
|
553
|
-
return newSelection.every((
|
|
1074
|
+
return newSelection.every((value, index) => value === this._selection[index]);
|
|
554
1075
|
}
|
|
555
1076
|
_selectionToTileData(selection) {
|
|
556
1077
|
return selection.map((idx) => this.items()[idx]);
|
|
557
1078
|
}
|
|
558
1079
|
#mapToTileData(objects) {
|
|
559
1080
|
return objects.map((dmsObject) => {
|
|
1081
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
560
1082
|
const sots = dmsObject.sots || [];
|
|
561
1083
|
if (!dmsObject.objectTypeId) {
|
|
562
|
-
throw new Error(
|
|
1084
|
+
throw new Error(
|
|
1085
|
+
// eslint-disable-next-line max-len
|
|
1086
|
+
`DmsObject with id '${dmsObject.id}' is missing objectTypeId. Please make sure that your query includes the object type ID field.`);
|
|
563
1087
|
}
|
|
564
|
-
let
|
|
565
|
-
// check if result
|
|
1088
|
+
let objectConfig = this.objectConfig[dmsObject.objectTypeId];
|
|
1089
|
+
// check if result item matches virtual config type
|
|
566
1090
|
const cfgTypes = this.options()?.configTypes || [];
|
|
567
1091
|
cfgTypes.forEach((cft) => {
|
|
568
1092
|
const matchesType = !cft.objectType || cft.objectType === dmsObject.objectTypeId;
|
|
569
|
-
const matchesSOTs = !cft.sots
|
|
1093
|
+
const matchesSOTs = !cft.sots?.length || cft.sots.every((sot) => sots.includes(sot));
|
|
570
1094
|
if (matchesType && matchesSOTs) {
|
|
571
|
-
|
|
1095
|
+
objectConfig = this.objectConfig[cft.id];
|
|
572
1096
|
}
|
|
573
1097
|
});
|
|
574
1098
|
// only apply a flavor if the object has that SOT
|
|
575
|
-
const ownAppliedFlavor = this.appliedFlavor && sots.includes(this.appliedFlavor.sot) && this.
|
|
1099
|
+
const ownAppliedFlavor = this.appliedFlavor && sots.includes(this.appliedFlavor.sot) && this.objectConfig[this.appliedFlavor.sot];
|
|
576
1100
|
if (ownAppliedFlavor) {
|
|
577
|
-
|
|
1101
|
+
objectConfig = this.objectConfig[this.appliedFlavor.id];
|
|
578
1102
|
}
|
|
579
|
-
|
|
580
|
-
|
|
1103
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
1104
|
+
if (!objectConfig)
|
|
1105
|
+
objectConfig = this.#objectConfigService.getDefaultConfig(dmsObject.objectTypeId);
|
|
581
1106
|
const tli = {
|
|
582
1107
|
objectTypeId: dmsObject.objectTypeId,
|
|
583
1108
|
id: dmsObject.id,
|
|
584
|
-
actions:
|
|
585
|
-
badges:
|
|
1109
|
+
actions: objectConfig.actions,
|
|
1110
|
+
badges: objectConfig.badges,
|
|
586
1111
|
instanceData: dmsObject.data,
|
|
587
1112
|
dmsObject,
|
|
588
|
-
title:
|
|
1113
|
+
title: objectConfig.title
|
|
1114
|
+
? this.#getResolvedObjectConfigItem(objectConfig.title.propertyName, dmsObject.data)
|
|
1115
|
+
: { propertyName: '', value: '' }
|
|
589
1116
|
};
|
|
590
|
-
tli.icon =
|
|
1117
|
+
tli.icon = objectConfig.icon
|
|
591
1118
|
? {
|
|
592
1119
|
rendererType: 'icon',
|
|
593
1120
|
propertyName: 'custom',
|
|
594
|
-
value:
|
|
595
|
-
meta: { isFontIcon: YmtMatIconRegistryService.isFontIcon(
|
|
1121
|
+
value: objectConfig.icon.svg,
|
|
1122
|
+
meta: { isFontIcon: YmtMatIconRegistryService.isFontIcon(objectConfig.icon.svg), objectTypeId: '' }
|
|
596
1123
|
}
|
|
597
1124
|
: {
|
|
598
1125
|
rendererType: 'icon',
|
|
599
1126
|
propertyName: BaseObjectTypeField.OBJECT_TYPE_ID,
|
|
600
1127
|
value: ownAppliedFlavor && this.appliedFlavor ? this.appliedFlavor.sot : dmsObject.objectTypeId
|
|
601
1128
|
};
|
|
602
|
-
if (
|
|
603
|
-
tli.description = this.#getResolvedObjectConfigItem(
|
|
604
|
-
if (
|
|
605
|
-
tli.meta = this.#getResolvedObjectConfigItem(
|
|
606
|
-
if (
|
|
607
|
-
tli.aside = this.#getResolvedObjectConfigItem(
|
|
1129
|
+
if (objectConfig.description)
|
|
1130
|
+
tli.description = this.#getResolvedObjectConfigItem(objectConfig.description.propertyName, dmsObject.data);
|
|
1131
|
+
if (objectConfig.meta)
|
|
1132
|
+
tli.meta = this.#getResolvedObjectConfigItem(objectConfig.meta.propertyName, dmsObject.data);
|
|
1133
|
+
if (objectConfig.aside)
|
|
1134
|
+
tli.aside = this.#getResolvedObjectConfigItem(objectConfig.aside.propertyName, dmsObject.data);
|
|
608
1135
|
return tli;
|
|
609
1136
|
});
|
|
610
1137
|
}
|
|
@@ -628,23 +1155,13 @@ class TileListComponent {
|
|
|
628
1155
|
}
|
|
629
1156
|
return item;
|
|
630
1157
|
}
|
|
631
|
-
|
|
632
|
-
this.#objectConfigService
|
|
633
|
-
.getObjectConfigs$(this.bucket() || '', true)
|
|
634
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
635
|
-
.subscribe({
|
|
636
|
-
next: (res) => {
|
|
637
|
-
this.oc = res;
|
|
638
|
-
this.list().runTransformerAgain();
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
}
|
|
1158
|
+
//#endregion
|
|
642
1159
|
// #region Effect Methods
|
|
643
1160
|
#flavorEffect;
|
|
644
1161
|
#preselectEffect;
|
|
645
1162
|
#closeMenuEffect;
|
|
646
1163
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TileListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
647
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TileListComponent, isStandalone: true, selector: "yuv-tile-list", inputs: { bucket: { classPropertyName: "bucket", publicName: "bucket", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, multiselect: { classPropertyName: "multiselect", publicName: "multiselect", isSignal: true, isRequired: false, transformFunction: null }, dense: { classPropertyName: "dense", publicName: "dense", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, flavor: { classPropertyName: "flavor", publicName: "flavor", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, preselect: { classPropertyName: "preselect", publicName: "preselect", isSignal: true, isRequired: false, transformFunction: null }, highlights: { classPropertyName: "highlights", publicName: "highlights", isSignal: true, isRequired: false, transformFunction: null }, preventChangeUntil: { classPropertyName: "preventChangeUntil", publicName: "preventChangeUntil", isSignal: true, isRequired: false, transformFunction: null }, autoSelect: { classPropertyName: "autoSelect", publicName: "autoSelect", isSignal: true, isRequired: false, transformFunction: null }, disableCustomContextMenu: { classPropertyName: "disableCustomContextMenu", publicName: "disableCustomContextMenu", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect", tileCopy: "tileCopy", tileCut: "tileCut", busy: "busy", queryResult: "queryResult", selectionChange: "selectionChange", itemDblClick: "itemDblClick", ctxMenu: "ctxMenu" }, host: { listeners: { "keydown.control.c": "onCopy($event)", "keydown.control.x": "onCut($event)" }, properties: { "class.dense": "dense()" } }, providers: [], queries: [{ propertyName: "menuComponent", first: true, predicate: TileActionsMenuComponent, descendants: true, isSignal: true }, { propertyName: "emptyContent", first: true, predicate: ["empty"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "list", first: true, predicate: ["list"], descendants: true, isSignal: true }, { propertyName: "menuTriggers", predicate: MatMenuTrigger, descendants: true, isSignal: true }], ngImport: i0, template: "<yuv-query-list\n #list\n [query]=\"query()\"\n [transformer]=\"transformer\"\n [preventChangeUntil]=\"preventChangeUntil()\"\n [autoSelect]=\"autoSelect()\"\n [pageSize]=\"pageSize()\"\n [multiselect]=\"multiselect()\"\n (itemDoubleClick)=\"onItemDoubleClick($event)\"\n (itemSelect)=\"onListItemsSelect($event)\"\n (queryResult)=\"onQueryResult($event)\"\n (dragSelectChange)=\"onDragSelectChange($event)\"\n>\n <ng-template #yuvQueryListItem let-item let-index=\"index\">\n <yuv-list-tile [class.dense]=\"dense()\" (contextmenu)=\"contextMenuHandler($event, index)\">\n <ng-template #iconSlot><ng-container *yuvRenderer=\"item.icon\"
|
|
1164
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: TileListComponent, isStandalone: true, selector: "yuv-tile-list", inputs: { bucket: { classPropertyName: "bucket", publicName: "bucket", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, multiselect: { classPropertyName: "multiselect", publicName: "multiselect", isSignal: true, isRequired: false, transformFunction: null }, dense: { classPropertyName: "dense", publicName: "dense", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, flavor: { classPropertyName: "flavor", publicName: "flavor", isSignal: true, isRequired: false, transformFunction: null }, query: { classPropertyName: "query", publicName: "query", isSignal: true, isRequired: false, transformFunction: null }, preselect: { classPropertyName: "preselect", publicName: "preselect", isSignal: true, isRequired: false, transformFunction: null }, highlights: { classPropertyName: "highlights", publicName: "highlights", isSignal: true, isRequired: false, transformFunction: null }, preventChangeUntil: { classPropertyName: "preventChangeUntil", publicName: "preventChangeUntil", isSignal: true, isRequired: false, transformFunction: null }, autoSelect: { classPropertyName: "autoSelect", publicName: "autoSelect", isSignal: true, isRequired: false, transformFunction: null }, disableCustomContextMenu: { classPropertyName: "disableCustomContextMenu", publicName: "disableCustomContextMenu", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelect: "itemSelect", tileCopy: "tileCopy", tileCut: "tileCut", busy: "busy", queryResult: "queryResult", selectionChange: "selectionChange", itemDblClick: "itemDblClick", ctxMenu: "ctxMenu" }, host: { listeners: { "keydown.control.c": "onCopy($event)", "keydown.control.x": "onCut($event)" }, properties: { "class.dense": "dense()" } }, providers: [], queries: [{ propertyName: "menuComponent", first: true, predicate: TileActionsMenuComponent, descendants: true, isSignal: true }, { propertyName: "emptyContent", first: true, predicate: ["empty"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "list", first: true, predicate: ["list"], descendants: true, isSignal: true }, { propertyName: "menuTriggers", predicate: MatMenuTrigger, descendants: true, isSignal: true }], ngImport: i0, template: "<yuv-query-list\n #list\n [query]=\"query()\"\n [transformer]=\"transformer\"\n idProperty=\"id\"\n [preventChangeUntil]=\"preventChangeUntil()\"\n [autoSelect]=\"autoSelect()\"\n [pageSize]=\"pageSize()\"\n [multiselect]=\"multiselect()\"\n (itemDoubleClick)=\"onItemDoubleClick($event)\"\n (itemSelect)=\"onListItemsSelect($event)\"\n (queryResult)=\"onQueryResult($event)\"\n (dragSelectChange)=\"onDragSelectChange($event)\"\n>\n <ng-template #yuvQueryListItem let-item let-index=\"index\">\n <yuv-list-tile [class.dense]=\"dense()\" [style]=\"highlightStyles()[item.id]\" (contextmenu)=\"contextMenuHandler($event, index)\">\n <ng-template #iconSlot><ng-container *yuvRenderer=\"item.icon\" /></ng-template>\n <ng-template #titleSlot><ng-container *yuvRenderer=\"item.title\" /></ng-template>\n <ng-template #descriptionSlot><ng-container *yuvRenderer=\"item.description\" /></ng-template>\n <ng-template #metaSlot><ng-container *yuvRenderer=\"item.meta\" /></ng-template>\n <ng-template #asideSlot><ng-container *yuvRenderer=\"item.aside\" /></ng-template>\n <ng-template #actionsSlot>\n @for (a of item.actions; track a.id) {\n <button\n ymt-icon-button\n [matTooltip]=\"a.label\"\n icon-button-size=\"small\"\n (click)=\"executeAction(item, a, $event)\"\n >\n <mat-icon inert=\"true\">{{ a.icon }}</mat-icon>\n </button>\n }\n\n @if (menu()) {\n <button\n ymt-icon-button\n icon-button-size=\"small\"\n (click)=\"menuItemClicked(item, $event)\"\n [matTooltip]=\"'yuv.tile-list.item.actions-menu.button.tooltip' | translate\"\n [matMenuTriggerFor]=\"menu()\"\n >\n <mat-icon inert=\"true\">more_vert</mat-icon>\n </button>\n }\n <ng-content select=\"yuv-tile-actions-menu, [yuv-tile-actions-menu]\" />\n </ng-template>\n <ng-template #extensionSlot>\n <ng-container *yuvTileExtension=\"{ typeId: item.objectTypeId, data: item.instanceData }\" />\n </ng-template>\n <ng-template #badgesSlot>{{ item.badges }}</ng-template>\n </yuv-list-tile>\n </ng-template>\n\n <ng-template #yuvQueryListEmpty>\n <div class=\"empty-list\">\n @let searchExe = searchExecuted();\n @if (searchExe && emptyContent()) {\n <ng-content />\n }\n </div>\n </ng-template>\n <div class=\"offset\" (click)=\"clearSelection()\"></div>\n</yuv-query-list>\n", styles: [":host{--paging-background: var(--ymt-surface);display:flex;flex-direction:column}:host yuv-query-list{flex:1;overflow-y:auto;display:flex;flex-flow:column;height:100%}:host yuv-query-list .offset{flex:1 1 auto}:host .empty-list{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: YuvListModule }, { kind: "component", type: i2.ListTileComponent, selector: "yuv-list-tile" }, { kind: "ngmodule", type: YuvQueryListModule }, { kind: "component", type: i3.QueryListComponent, selector: "yuv-query-list", inputs: ["query", "idProperty", "transformer", "preventChangeUntil", "autoSelect", "pageSize", "enableDragSelect", "multiselect", "selfHandleSelection", "includePermissions"], outputs: ["itemSelect", "dragSelectChange", "itemDoubleClick", "queryResult"] }, { kind: "directive", type: RendererDirective, selector: "[yuvRenderer]", inputs: ["yuvRenderer"] }, { kind: "directive", type: TileExtensionDirective, selector: "[yuvTileExtension]", inputs: ["yuvTileExtension"] }, { kind: "directive", type: YmtIconButtonDirective, selector: "button[ymtIconButton],button[ymt-icon-button],a[ymtIconButton],a[ymt-icon-button]", inputs: ["disabled", "disableRipple", "aria-disabled", "disabledInteractive", "icon-button-size"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2$1.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
648
1165
|
}
|
|
649
1166
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: TileListComponent, decorators: [{
|
|
650
1167
|
type: Component,
|
|
@@ -658,11 +1175,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
658
1175
|
TileExtensionDirective,
|
|
659
1176
|
YmtIconButtonDirective,
|
|
660
1177
|
...MATERIAL_IMPORTS
|
|
661
|
-
], host: {
|
|
1178
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
662
1179
|
'[class.dense]': 'dense()',
|
|
663
1180
|
'(keydown.control.c)': 'onCopy($event)',
|
|
664
1181
|
'(keydown.control.x)': 'onCut($event)'
|
|
665
|
-
}, template: "<yuv-query-list\n #list\n [query]=\"query()\"\n [transformer]=\"transformer\"\n [preventChangeUntil]=\"preventChangeUntil()\"\n [autoSelect]=\"autoSelect()\"\n [pageSize]=\"pageSize()\"\n [multiselect]=\"multiselect()\"\n (itemDoubleClick)=\"onItemDoubleClick($event)\"\n (itemSelect)=\"onListItemsSelect($event)\"\n (queryResult)=\"onQueryResult($event)\"\n (dragSelectChange)=\"onDragSelectChange($event)\"\n>\n <ng-template #yuvQueryListItem let-item let-index=\"index\">\n <yuv-list-tile [class.dense]=\"dense()\" (contextmenu)=\"contextMenuHandler($event, index)\">\n <ng-template #iconSlot><ng-container *yuvRenderer=\"item.icon\"
|
|
1182
|
+
}, template: "<yuv-query-list\n #list\n [query]=\"query()\"\n [transformer]=\"transformer\"\n idProperty=\"id\"\n [preventChangeUntil]=\"preventChangeUntil()\"\n [autoSelect]=\"autoSelect()\"\n [pageSize]=\"pageSize()\"\n [multiselect]=\"multiselect()\"\n (itemDoubleClick)=\"onItemDoubleClick($event)\"\n (itemSelect)=\"onListItemsSelect($event)\"\n (queryResult)=\"onQueryResult($event)\"\n (dragSelectChange)=\"onDragSelectChange($event)\"\n>\n <ng-template #yuvQueryListItem let-item let-index=\"index\">\n <yuv-list-tile [class.dense]=\"dense()\" [style]=\"highlightStyles()[item.id]\" (contextmenu)=\"contextMenuHandler($event, index)\">\n <ng-template #iconSlot><ng-container *yuvRenderer=\"item.icon\" /></ng-template>\n <ng-template #titleSlot><ng-container *yuvRenderer=\"item.title\" /></ng-template>\n <ng-template #descriptionSlot><ng-container *yuvRenderer=\"item.description\" /></ng-template>\n <ng-template #metaSlot><ng-container *yuvRenderer=\"item.meta\" /></ng-template>\n <ng-template #asideSlot><ng-container *yuvRenderer=\"item.aside\" /></ng-template>\n <ng-template #actionsSlot>\n @for (a of item.actions; track a.id) {\n <button\n ymt-icon-button\n [matTooltip]=\"a.label\"\n icon-button-size=\"small\"\n (click)=\"executeAction(item, a, $event)\"\n >\n <mat-icon inert=\"true\">{{ a.icon }}</mat-icon>\n </button>\n }\n\n @if (menu()) {\n <button\n ymt-icon-button\n icon-button-size=\"small\"\n (click)=\"menuItemClicked(item, $event)\"\n [matTooltip]=\"'yuv.tile-list.item.actions-menu.button.tooltip' | translate\"\n [matMenuTriggerFor]=\"menu()\"\n >\n <mat-icon inert=\"true\">more_vert</mat-icon>\n </button>\n }\n <ng-content select=\"yuv-tile-actions-menu, [yuv-tile-actions-menu]\" />\n </ng-template>\n <ng-template #extensionSlot>\n <ng-container *yuvTileExtension=\"{ typeId: item.objectTypeId, data: item.instanceData }\" />\n </ng-template>\n <ng-template #badgesSlot>{{ item.badges }}</ng-template>\n </yuv-list-tile>\n </ng-template>\n\n <ng-template #yuvQueryListEmpty>\n <div class=\"empty-list\">\n @let searchExe = searchExecuted();\n @if (searchExe && emptyContent()) {\n <ng-content />\n }\n </div>\n </ng-template>\n <div class=\"offset\" (click)=\"clearSelection()\"></div>\n</yuv-query-list>\n", styles: [":host{--paging-background: var(--ymt-surface);display:flex;flex-direction:column}:host yuv-query-list{flex:1;overflow-y:auto;display:flex;flex-flow:column;height:100%}:host yuv-query-list .offset{flex:1 1 auto}:host .empty-list{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%}\n"] }]
|
|
666
1183
|
}], ctorParameters: () => [] });
|
|
667
1184
|
|
|
668
1185
|
class ActionSelectComponent {
|