@coolon/angular-ui-powerups 16.1.0-alpha.268 → 16.1.0-alpha.269
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/esm2022/lib/components/forms/sub-form-list/sub-form-list.component.mjs +97 -4
- package/esm2022/lib/components/forms/sub-form-list/sub-form-row.directive.mjs +6 -1
- package/fesm2022/coolon-angular-ui-powerups.mjs +101 -3
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/components/forms/sub-form-list/sub-form-list.component.d.ts +67 -2
- package/lib/components/forms/sub-form-list/sub-form-row.directive.d.ts +5 -0
- package/package.json +1 -1
|
@@ -3385,6 +3385,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
3385
3385
|
*
|
|
3386
3386
|
* The commands are on the row sub-form itself (`removeItemCommand`, `moveUpCommand`,
|
|
3387
3387
|
* `moveDownCommand`), so the context is the same one the row template gets.
|
|
3388
|
+
*
|
|
3389
|
+
* It renders as a single grid item in the row's `actions` cell — unlike the default cluster, whose
|
|
3390
|
+
* three buttons are placed separately so a layout can split them. Ignored, with a warning, under
|
|
3391
|
+
* `rowLayout="custom"`: that layout hands the whole row to the `aupSubFormRow` template, which
|
|
3392
|
+
* reaches the very same commands.
|
|
3388
3393
|
*/
|
|
3389
3394
|
class SubFormRowActionsDirective {
|
|
3390
3395
|
templateRef;
|
|
@@ -3475,6 +3480,19 @@ class SubFormListComponent extends DisposableComponent {
|
|
|
3475
3480
|
* far edge of the list; turn it on for a row whose single field should span the width.
|
|
3476
3481
|
*/
|
|
3477
3482
|
fill = false;
|
|
3483
|
+
/**
|
|
3484
|
+
* How the library lays the row's cells out. {@link RowLayout.INLINE} — the default — is one line
|
|
3485
|
+
* of `handle · content · up · down · actions`.
|
|
3486
|
+
*
|
|
3487
|
+
* Each value is a named preset over the row's public CSS variables
|
|
3488
|
+
* (`--aup-sub-form-row-areas` / `-columns` / `-rows`), which a consumer can set from its own
|
|
3489
|
+
* stylesheet to override any of them — the variable wins over the preset, deliberately.
|
|
3490
|
+
*
|
|
3491
|
+
* Bind this once. It selects a class on each row, and {@link RowLayout.CUSTOM} additionally
|
|
3492
|
+
* changes what the row renders, so flipping it at runtime rebuilds the very bindings the row
|
|
3493
|
+
* context memoisation exists to keep stable.
|
|
3494
|
+
*/
|
|
3495
|
+
rowLayout = SubFormListComponent.RowLayout.INLINE;
|
|
3478
3496
|
rowTemplate;
|
|
3479
3497
|
actionsTemplate;
|
|
3480
3498
|
emptyTemplate;
|
|
@@ -3553,8 +3571,40 @@ class SubFormListComponent extends DisposableComponent {
|
|
|
3553
3571
|
get buttonsOnDemand() {
|
|
3554
3572
|
return this.resolvedReorder === SubFormListComponent.Reorder.DRAG;
|
|
3555
3573
|
}
|
|
3574
|
+
/** A hook for consumer stylesheets and e2e selectors; the layout rules key off the row's class. */
|
|
3575
|
+
get rowLayoutAttribute() {
|
|
3576
|
+
return this.rowLayout;
|
|
3577
|
+
}
|
|
3578
|
+
get inlineLayout() {
|
|
3579
|
+
return this.rowLayout === SubFormListComponent.RowLayout.INLINE;
|
|
3580
|
+
}
|
|
3581
|
+
get railLayout() {
|
|
3582
|
+
return this.rowLayout === SubFormListComponent.RowLayout.RAIL;
|
|
3583
|
+
}
|
|
3584
|
+
get customLayout() {
|
|
3585
|
+
return this.rowLayout === SubFormListComponent.RowLayout.CUSTOM;
|
|
3586
|
+
}
|
|
3587
|
+
/**
|
|
3588
|
+
* The three standard buttons, as flat grid items. Excludes the case where a template replaces
|
|
3589
|
+
* them, so the two branches are siblings rather than an `if/else` — which is what lets the
|
|
3590
|
+
* default cluster be flat while the replacing one keeps a wrapper to be placed by.
|
|
3591
|
+
*/
|
|
3592
|
+
get defaultActionsVisible() {
|
|
3593
|
+
return !this.customLayout && !this.actionsTemplate && (this.moveButtonsVisible || this.removable);
|
|
3594
|
+
}
|
|
3595
|
+
get customActionsVisible() {
|
|
3596
|
+
return !this.customLayout && !!this.actionsTemplate;
|
|
3597
|
+
}
|
|
3598
|
+
/** Whether anything trails the content — drives the content cell's trailing spacing. */
|
|
3556
3599
|
get hasActions() {
|
|
3557
|
-
return
|
|
3600
|
+
return this.customActionsVisible || this.defaultActionsVisible;
|
|
3601
|
+
}
|
|
3602
|
+
/**
|
|
3603
|
+
* Not folded into the `onInit` callback above: a non-static `@ContentChild` is not resolved until
|
|
3604
|
+
* `ngAfterContentInit`, so {@link actionsTemplate} is still undefined during `ngOnInit`.
|
|
3605
|
+
*/
|
|
3606
|
+
ngAfterContentInit() {
|
|
3607
|
+
this.warnAboutIgnoredCustomLayoutInputs();
|
|
3558
3608
|
}
|
|
3559
3609
|
trackByRow(index, context) {
|
|
3560
3610
|
return context.row;
|
|
@@ -3574,6 +3624,24 @@ class SubFormListComponent extends DisposableComponent {
|
|
|
3574
3624
|
this.list.move(moved, event.currentIndex);
|
|
3575
3625
|
this.markForCheck();
|
|
3576
3626
|
}
|
|
3627
|
+
/**
|
|
3628
|
+
* `CUSTOM` hands the row to the caller, which silently ignores two inputs that would otherwise
|
|
3629
|
+
* have rendered something. The reorder warning fires only for an *explicit* `BUTTONS`/`BOTH` —
|
|
3630
|
+
* `reorder` defaults to `AUTO`, and a plain custom row is very likely rendering the commands
|
|
3631
|
+
* itself, which the component cannot detect.
|
|
3632
|
+
*/
|
|
3633
|
+
warnAboutIgnoredCustomLayoutInputs() {
|
|
3634
|
+
if (!this.customLayout) {
|
|
3635
|
+
return;
|
|
3636
|
+
}
|
|
3637
|
+
if (this.actionsTemplate) {
|
|
3638
|
+
console.warn(`aup-sub-form-list: the aupSubFormRowActions template was ignored — rowLayout="custom" hands the whole row to the aupSubFormRow template, which gets the same context and so the same row.removeItemCommand / moveUpCommand / moveDownCommand. Render the cluster in there instead.`);
|
|
3639
|
+
}
|
|
3640
|
+
const asked = this.reorder;
|
|
3641
|
+
if (asked === SubFormListComponent.Reorder.BUTTONS || asked === SubFormListComponent.Reorder.BOTH) {
|
|
3642
|
+
console.warn(`aup-sub-form-list: reorder="${asked}" renders no move buttons under rowLayout="custom". Render row.moveUpCommand and row.moveDownCommand in the aupSubFormRow template — CDK drag is pointer-only, so without them there is no keyboard path for reordering.`);
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3577
3645
|
warnAboutUnsupportedReordering() {
|
|
3578
3646
|
const asked = this.reorder;
|
|
3579
3647
|
if (asked !== SubFormListComponent.Reorder.AUTO
|
|
@@ -3583,7 +3651,7 @@ class SubFormListComponent extends DisposableComponent {
|
|
|
3583
3651
|
}
|
|
3584
3652
|
}
|
|
3585
3653
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SubFormListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3586
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: SubFormListComponent, selector: "aup-sub-form-list", inputs: { list: "list", reorder: "reorder", removable$: "removable$", removable: "removable", removeFace: "removeFace", moveUpFace: "moveUpFace", moveDownFace: "moveDownFace", dragHandleIcon: "dragHandleIcon", addCommand: "addCommand", emptyText: "emptyText", dense: "dense", fill: "fill" }, host: { properties: { "class.dense": "this.dense", "class.fill": "this.fill", "class.buttons-on-demand": "this.buttonsOnDemand" } }, queries: [{ propertyName: "rowTemplate", first: true, predicate: SubFormRowDirective, descendants: true }, { propertyName: "actionsTemplate", first: true, predicate: SubFormRowActionsDirective, descendants: true }, { propertyName: "emptyTemplate", first: true, predicate: SubFormListEmptyDirective, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"rows\"\n role=\"list\"\n cdkDropList\n [cdkDropListDisabled]=\"!dragEnabled\"\n (cdkDropListDropped)=\"onDropped($event)\"\n data-cy=\"sub-form-rows\">\n\n <div class=\"row\"\n role=\"listitem\"\n *ngFor=\"let context of rows; trackBy: trackByRow\"\n cdkDrag\n [cdkDragDisabled]=\"!dragEnabled\"\n data-cy=\"sub-form-row\">\n\n <!-- Deliberately not focusable and hidden from assistive tech: CDK drag is pointer-only, so a\n focusable handle would take a tab stop and then do nothing. The move buttons are the\n keyboard path, which is why they survive even in reorder=\"drag\". -->\n <span class=\"drag-handle\" *ngIf=\"dragEnabled\" cdkDragHandle aria-hidden=\"true\"\n data-cy=\"sub-form-drag-handle\">\n <aup-icon [icon]=\"dragHandleIcon\"></aup-icon>\n </span>\n\n <div class=\"content\">\n <ng-container *ngIf=\"rowTemplate\"\n [ngTemplateOutlet]=\"rowTemplate.templateRef\"\n [ngTemplateOutletContext]=\"context\"></ng-container>\n </div>\n\n <div class=\"actions\" *ngIf=\"hasActions\">\n <ng-container *ngIf=\"actionsTemplate; else defaultActions\"\n [ngTemplateOutlet]=\"actionsTemplate.templateRef\"\n [ngTemplateOutletContext]=\"context\"></ng-container>\n <ng-template #defaultActions>\n <aup-command *ngIf=\"moveButtonsVisible\" class=\"move-command\"\n [command]=\"context.row.moveUpCommand\"\n [face]=\"moveUpFace\" data-cy=\"sub-form-move-up\"></aup-command>\n <aup-command *ngIf=\"moveButtonsVisible\" class=\"move-command\"\n [command]=\"context.row.moveDownCommand\"\n [face]=\"moveDownFace\" data-cy=\"sub-form-move-down\"></aup-command>\n <aup-command *ngIf=\"removable\" [command]=\"context.row.removeItemCommand\"\n [face]=\"removeFace\" data-cy=\"sub-form-remove\"></aup-command>\n </ng-template>\n </div>\n </div>\n</div>\n\n<ng-container *ngIf=\"empty\">\n <ng-container *ngIf=\"emptyTemplate; else defaultEmpty\"\n [ngTemplateOutlet]=\"emptyTemplate.templateRef\"></ng-container>\n <ng-template #defaultEmpty>\n <aup-empty-state *ngIf=\"emptyText\" data-cy=\"sub-form-list-empty\">{{emptyText}}</aup-empty-state>\n </ng-template>\n</ng-container>\n\n<ul class=\"list-errors\" *ngIf=\"listErrors.length\" data-cy=\"sub-form-list-errors\">\n <li *ngFor=\"let error of listErrors\">{{error}}</li>\n</ul>\n\n<div class=\"footer\" *ngIf=\"hasAddCommand\">\n <aup-command [command]=\"addCommand\" data-cy=\"sub-form-list-add\"></aup-command>\n</div>\n", styles: [":host{display:block;--aup-sub-form-row-gap: 8px}.rows{display:flex;flex-direction:column;gap:var(--aup-sub-form-row-gap)}.row{display:grid;grid-template-columns:auto auto auto;justify-content:start;align-items:center;gap:var(--aup-sub-form-row-gap);background:var(--aup-sub-form-row-background, transparent)}.drag-handle{grid-column:1}.content{grid-column:2}.actions{grid-column:3}:host(.fill) .row{grid-template-columns:auto 1fr auto;justify-content:stretch}.drag-handle{display:flex;align-items:center;cursor:grab;color:#00000061}.drag-handle:active{cursor:grabbing}.content{display:flex;flex-wrap:wrap;align-items:flex-start;gap:var(--aup-sub-form-row-gap);min-width:0}.actions{display:flex;align-items:center;gap:0;white-space:nowrap}:host(.buttons-on-demand) .row .move-command{opacity:0;transition:opacity .15s ease-in-out}:host(.buttons-on-demand) .row:hover .move-command,:host(.buttons-on-demand) .row:focus-within .move-command{opacity:1}.list-errors{margin:var(--aup-sub-form-row-gap) 0 0;padding-left:1.2em;color:var(--aup-error-color, #f44336);font-size:12px}.footer{display:flex;margin-top:var(--aup-sub-form-row-gap)}.row.cdk-drag-preview{box-sizing:border-box;border-radius:4px;background:var(--aup-sub-form-row-background, #fff);box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f;padding:4px}.row.cdk-drag-placeholder{opacity:.4}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.rows.cdk-drop-list-dragging .row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$7.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2$7.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2$7.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: IconComponent, selector: "aup-icon", inputs: ["icon"] }, { kind: "component", type: CommandComponent, selector: "aup-command", inputs: ["command", "face$", "face", "busyFace$", "busyFace", "alignFace"] }, { kind: "component", type: EmptyStateComponent, selector: "aup-empty-state" }] });
|
|
3654
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.9", type: SubFormListComponent, selector: "aup-sub-form-list", inputs: { list: "list", reorder: "reorder", removable$: "removable$", removable: "removable", removeFace: "removeFace", moveUpFace: "moveUpFace", moveDownFace: "moveDownFace", dragHandleIcon: "dragHandleIcon", addCommand: "addCommand", emptyText: "emptyText", dense: "dense", fill: "fill", rowLayout: "rowLayout" }, host: { properties: { "class.dense": "this.dense", "class.fill": "this.fill", "class.buttons-on-demand": "this.buttonsOnDemand", "attr.data-row-layout": "this.rowLayoutAttribute" } }, queries: [{ propertyName: "rowTemplate", first: true, predicate: SubFormRowDirective, descendants: true }, { propertyName: "actionsTemplate", first: true, predicate: SubFormRowActionsDirective, descendants: true }, { propertyName: "emptyTemplate", first: true, predicate: SubFormListEmptyDirective, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"rows\"\n role=\"list\"\n cdkDropList\n [cdkDropListDisabled]=\"!dragEnabled\"\n (cdkDropListDropped)=\"onDropped($event)\"\n data-cy=\"sub-form-rows\">\n\n <!-- The layout classes go on .row, not the host: CDK's drag preview is a deep clone of .row\n appended to <body>, and a rule anchored on the host cannot reach it. Written as discrete\n [class.x] bindings rather than one [ngClass] object literal, which would allocate a fresh\n object on every change-detection pass. -->\n <div class=\"row\"\n role=\"listitem\"\n *ngFor=\"let context of rows; trackBy: trackByRow\"\n [class.layout-inline]=\"inlineLayout\"\n [class.layout-rail]=\"railLayout\"\n [class.layout-custom]=\"customLayout\"\n [class.fill]=\"fill\"\n [class.buttons-on-demand]=\"buttonsOnDemand\"\n [class.has-actions]=\"hasActions\"\n cdkDrag\n [cdkDragDisabled]=\"!dragEnabled\"\n data-cy=\"sub-form-row\">\n\n <!-- Deliberately not focusable and hidden from assistive tech: CDK drag is pointer-only, so a\n focusable handle would take a tab stop and then do nothing. The move buttons are the\n keyboard path, which is why they survive even in reorder=\"drag\" \u2014 and why rowLayout=\"custom\",\n which renders none of them, makes that path the caller's to provide.\n\n It stays library-rendered in every layout because it has to: CdkDragHandle finds its drag\n through the node injector and CdkDrag collects handles with a content query, both scoped to\n the template cdkDrag is written in. A cdkDragHandle in a caller's row template resolves no\n parent and, because that injection is optional, silently does nothing. -->\n <span class=\"drag-handle\" *ngIf=\"dragEnabled\" cdkDragHandle aria-hidden=\"true\"\n data-cy=\"sub-form-drag-handle\">\n <aup-icon [icon]=\"dragHandleIcon\"></aup-icon>\n </span>\n\n <!-- Given `display: contents` under rowLayout=\"custom\", so the projected template's own\n top-level elements become the row's grid items. Never *ngIf'd away for that: recreating it\n would tear down and rebuild the caller's row bindings, which is exactly what the row\n context memoisation exists to prevent. -->\n <div class=\"content\">\n <ng-container *ngIf=\"rowTemplate\"\n [ngTemplateOutlet]=\"rowTemplate.templateRef\"\n [ngTemplateOutletContext]=\"context\"></ng-container>\n </div>\n\n <!-- The default cluster is three flat grid items, one per named cell, so a layout can place\n them independently \u2014 the rail stacks the moves away from remove. -->\n <ng-container *ngIf=\"defaultActionsVisible\">\n <aup-command *ngIf=\"moveButtonsVisible\" class=\"move-command move-up\"\n [command]=\"context.row.moveUpCommand\"\n [face]=\"moveUpFace\" data-cy=\"sub-form-move-up\"></aup-command>\n <aup-command *ngIf=\"moveButtonsVisible\" class=\"move-command move-down\"\n [command]=\"context.row.moveDownCommand\"\n [face]=\"moveDownFace\" data-cy=\"sub-form-move-down\"></aup-command>\n <aup-command *ngIf=\"removable\" class=\"remove\" [command]=\"context.row.removeItemCommand\"\n [face]=\"removeFace\" data-cy=\"sub-form-remove\"></aup-command>\n </ng-container>\n\n <!-- The replacing cluster keeps its wrapper: it is one grid item in the `actions` cell, and an\n ng-container outlet generates no element to place. -->\n <div class=\"actions\" *ngIf=\"customActionsVisible\">\n <ng-container [ngTemplateOutlet]=\"actionsTemplate.templateRef\"\n [ngTemplateOutletContext]=\"context\"></ng-container>\n </div>\n </div>\n</div>\n\n<ng-container *ngIf=\"empty\">\n <ng-container *ngIf=\"emptyTemplate; else defaultEmpty\"\n [ngTemplateOutlet]=\"emptyTemplate.templateRef\"></ng-container>\n <ng-template #defaultEmpty>\n <aup-empty-state *ngIf=\"emptyText\" data-cy=\"sub-form-list-empty\">{{emptyText}}</aup-empty-state>\n </ng-template>\n</ng-container>\n\n<ul class=\"list-errors\" *ngIf=\"listErrors.length\" data-cy=\"sub-form-list-errors\">\n <li *ngFor=\"let error of listErrors\">{{error}}</li>\n</ul>\n\n<div class=\"footer\" *ngIf=\"hasAddCommand\">\n <aup-command [command]=\"addCommand\" data-cy=\"sub-form-list-add\"></aup-command>\n</div>\n", styles: [":host{display:block}.rows{display:flex;flex-direction:column;gap:var(--aup-sub-form-row-gap, 8px)}.row{display:grid;grid-template-areas:var(--aup-sub-form-row-areas, var(--resolved-sub-form-row-areas, \"handle content up down actions\"));grid-template-columns:var(--aup-sub-form-row-columns, var(--resolved-sub-form-row-columns, auto auto auto auto auto));grid-template-rows:var(--aup-sub-form-row-rows, var(--resolved-sub-form-row-rows, auto));justify-content:start;align-items:center;gap:0;background:var(--aup-sub-form-row-background, transparent)}.drag-handle{grid-area:handle}.content{grid-area:content}.move-up{grid-area:up}.move-down{grid-area:down}.remove,.actions{grid-area:actions}.drag-handle,.row.has-actions .content{margin-inline-end:var(--aup-sub-form-row-gap, 8px)}.drag-handle{display:flex;align-items:center;cursor:grab;color:#00000061}.drag-handle:active{cursor:grabbing}.content{display:flex;flex-wrap:wrap;align-items:flex-start;gap:var(--aup-sub-form-row-gap, 8px);min-width:0}.move-up,.move-down,.remove{white-space:nowrap}.actions{display:flex;align-items:center;gap:0;white-space:nowrap}.row.layout-rail{--resolved-sub-form-row-areas: \"up content actions\" \"handle content actions\" \"down content actions\";--resolved-sub-form-row-columns: auto auto auto;--resolved-sub-form-row-rows: auto auto auto}.row.layout-rail .move-up{align-self:start}.row.layout-rail .move-down{align-self:end}.row.layout-rail .drag-handle,.row.layout-rail .move-up,.row.layout-rail .move-down{justify-self:center}.row.layout-rail .move-up,.row.layout-rail .move-down{margin-inline-end:var(--aup-sub-form-row-gap, 8px)}.row.layout-custom{--resolved-sub-form-row-areas: none;--resolved-sub-form-row-columns: none;--resolved-sub-form-row-rows: none}.row.layout-custom .content{display:contents}.row.layout-inline.fill{--resolved-sub-form-row-columns: auto 1fr auto auto auto}.row.layout-rail.fill{--resolved-sub-form-row-columns: auto 1fr auto}.row.buttons-on-demand .move-command{opacity:0;transition:opacity .15s ease-in-out}.row.buttons-on-demand:hover .move-command,.row.buttons-on-demand:focus-within .move-command{opacity:1}.list-errors{margin:var(--aup-sub-form-row-gap, 8px) 0 0;padding-left:1.2em;color:var(--aup-error-color, #f44336);font-size:12px}.footer{display:flex;margin-top:var(--aup-sub-form-row-gap, 8px)}.row.cdk-drag-preview{box-sizing:border-box;border-radius:4px;background:var(--aup-sub-form-row-background, #fff);box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.row.cdk-drag-placeholder{opacity:.4}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.rows.cdk-drop-list-dragging .row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2$7.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2$7.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2$7.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: IconComponent, selector: "aup-icon", inputs: ["icon"] }, { kind: "component", type: CommandComponent, selector: "aup-command", inputs: ["command", "face$", "face", "busyFace$", "busyFace", "alignFace"] }, { kind: "component", type: EmptyStateComponent, selector: "aup-empty-state" }] });
|
|
3587
3655
|
}
|
|
3588
3656
|
__decorate([
|
|
3589
3657
|
Proxify(),
|
|
@@ -3599,7 +3667,7 @@ __decorate([
|
|
|
3599
3667
|
], SubFormListComponent.prototype, "addCommand", null);
|
|
3600
3668
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImport: i0, type: SubFormListComponent, decorators: [{
|
|
3601
3669
|
type: Component,
|
|
3602
|
-
args: [{ selector: 'aup-sub-form-list', template: "<div class=\"rows\"\n role=\"list\"\n cdkDropList\n [cdkDropListDisabled]=\"!dragEnabled\"\n (cdkDropListDropped)=\"onDropped($event)\"\n data-cy=\"sub-form-rows\">\n\n <div class=\"row\"\n role=\"listitem\"\n *ngFor=\"let context of rows; trackBy: trackByRow\"\n cdkDrag\n [cdkDragDisabled]=\"!dragEnabled\"\n data-cy=\"sub-form-row\">\n\n <!-- Deliberately not focusable and hidden from assistive tech: CDK drag is pointer-only, so a\n focusable handle would take a tab stop and then do nothing. The move buttons are the\n keyboard path, which is why they survive even in reorder=\"drag\". -->\n <span class=\"drag-handle\" *ngIf=\"dragEnabled\" cdkDragHandle aria-hidden=\"true\"\n data-cy=\"sub-form-drag-handle\">\n <aup-icon [icon]=\"dragHandleIcon\"></aup-icon>\n </span>\n\n <div class=\"content\">\n <ng-container *ngIf=\"rowTemplate\"\n [ngTemplateOutlet]=\"rowTemplate.templateRef\"\n [ngTemplateOutletContext]=\"context\"></ng-container>\n </div>\n\n
|
|
3670
|
+
args: [{ selector: 'aup-sub-form-list', template: "<div class=\"rows\"\n role=\"list\"\n cdkDropList\n [cdkDropListDisabled]=\"!dragEnabled\"\n (cdkDropListDropped)=\"onDropped($event)\"\n data-cy=\"sub-form-rows\">\n\n <!-- The layout classes go on .row, not the host: CDK's drag preview is a deep clone of .row\n appended to <body>, and a rule anchored on the host cannot reach it. Written as discrete\n [class.x] bindings rather than one [ngClass] object literal, which would allocate a fresh\n object on every change-detection pass. -->\n <div class=\"row\"\n role=\"listitem\"\n *ngFor=\"let context of rows; trackBy: trackByRow\"\n [class.layout-inline]=\"inlineLayout\"\n [class.layout-rail]=\"railLayout\"\n [class.layout-custom]=\"customLayout\"\n [class.fill]=\"fill\"\n [class.buttons-on-demand]=\"buttonsOnDemand\"\n [class.has-actions]=\"hasActions\"\n cdkDrag\n [cdkDragDisabled]=\"!dragEnabled\"\n data-cy=\"sub-form-row\">\n\n <!-- Deliberately not focusable and hidden from assistive tech: CDK drag is pointer-only, so a\n focusable handle would take a tab stop and then do nothing. The move buttons are the\n keyboard path, which is why they survive even in reorder=\"drag\" \u2014 and why rowLayout=\"custom\",\n which renders none of them, makes that path the caller's to provide.\n\n It stays library-rendered in every layout because it has to: CdkDragHandle finds its drag\n through the node injector and CdkDrag collects handles with a content query, both scoped to\n the template cdkDrag is written in. A cdkDragHandle in a caller's row template resolves no\n parent and, because that injection is optional, silently does nothing. -->\n <span class=\"drag-handle\" *ngIf=\"dragEnabled\" cdkDragHandle aria-hidden=\"true\"\n data-cy=\"sub-form-drag-handle\">\n <aup-icon [icon]=\"dragHandleIcon\"></aup-icon>\n </span>\n\n <!-- Given `display: contents` under rowLayout=\"custom\", so the projected template's own\n top-level elements become the row's grid items. Never *ngIf'd away for that: recreating it\n would tear down and rebuild the caller's row bindings, which is exactly what the row\n context memoisation exists to prevent. -->\n <div class=\"content\">\n <ng-container *ngIf=\"rowTemplate\"\n [ngTemplateOutlet]=\"rowTemplate.templateRef\"\n [ngTemplateOutletContext]=\"context\"></ng-container>\n </div>\n\n <!-- The default cluster is three flat grid items, one per named cell, so a layout can place\n them independently \u2014 the rail stacks the moves away from remove. -->\n <ng-container *ngIf=\"defaultActionsVisible\">\n <aup-command *ngIf=\"moveButtonsVisible\" class=\"move-command move-up\"\n [command]=\"context.row.moveUpCommand\"\n [face]=\"moveUpFace\" data-cy=\"sub-form-move-up\"></aup-command>\n <aup-command *ngIf=\"moveButtonsVisible\" class=\"move-command move-down\"\n [command]=\"context.row.moveDownCommand\"\n [face]=\"moveDownFace\" data-cy=\"sub-form-move-down\"></aup-command>\n <aup-command *ngIf=\"removable\" class=\"remove\" [command]=\"context.row.removeItemCommand\"\n [face]=\"removeFace\" data-cy=\"sub-form-remove\"></aup-command>\n </ng-container>\n\n <!-- The replacing cluster keeps its wrapper: it is one grid item in the `actions` cell, and an\n ng-container outlet generates no element to place. -->\n <div class=\"actions\" *ngIf=\"customActionsVisible\">\n <ng-container [ngTemplateOutlet]=\"actionsTemplate.templateRef\"\n [ngTemplateOutletContext]=\"context\"></ng-container>\n </div>\n </div>\n</div>\n\n<ng-container *ngIf=\"empty\">\n <ng-container *ngIf=\"emptyTemplate; else defaultEmpty\"\n [ngTemplateOutlet]=\"emptyTemplate.templateRef\"></ng-container>\n <ng-template #defaultEmpty>\n <aup-empty-state *ngIf=\"emptyText\" data-cy=\"sub-form-list-empty\">{{emptyText}}</aup-empty-state>\n </ng-template>\n</ng-container>\n\n<ul class=\"list-errors\" *ngIf=\"listErrors.length\" data-cy=\"sub-form-list-errors\">\n <li *ngFor=\"let error of listErrors\">{{error}}</li>\n</ul>\n\n<div class=\"footer\" *ngIf=\"hasAddCommand\">\n <aup-command [command]=\"addCommand\" data-cy=\"sub-form-list-add\"></aup-command>\n</div>\n", styles: [":host{display:block}.rows{display:flex;flex-direction:column;gap:var(--aup-sub-form-row-gap, 8px)}.row{display:grid;grid-template-areas:var(--aup-sub-form-row-areas, var(--resolved-sub-form-row-areas, \"handle content up down actions\"));grid-template-columns:var(--aup-sub-form-row-columns, var(--resolved-sub-form-row-columns, auto auto auto auto auto));grid-template-rows:var(--aup-sub-form-row-rows, var(--resolved-sub-form-row-rows, auto));justify-content:start;align-items:center;gap:0;background:var(--aup-sub-form-row-background, transparent)}.drag-handle{grid-area:handle}.content{grid-area:content}.move-up{grid-area:up}.move-down{grid-area:down}.remove,.actions{grid-area:actions}.drag-handle,.row.has-actions .content{margin-inline-end:var(--aup-sub-form-row-gap, 8px)}.drag-handle{display:flex;align-items:center;cursor:grab;color:#00000061}.drag-handle:active{cursor:grabbing}.content{display:flex;flex-wrap:wrap;align-items:flex-start;gap:var(--aup-sub-form-row-gap, 8px);min-width:0}.move-up,.move-down,.remove{white-space:nowrap}.actions{display:flex;align-items:center;gap:0;white-space:nowrap}.row.layout-rail{--resolved-sub-form-row-areas: \"up content actions\" \"handle content actions\" \"down content actions\";--resolved-sub-form-row-columns: auto auto auto;--resolved-sub-form-row-rows: auto auto auto}.row.layout-rail .move-up{align-self:start}.row.layout-rail .move-down{align-self:end}.row.layout-rail .drag-handle,.row.layout-rail .move-up,.row.layout-rail .move-down{justify-self:center}.row.layout-rail .move-up,.row.layout-rail .move-down{margin-inline-end:var(--aup-sub-form-row-gap, 8px)}.row.layout-custom{--resolved-sub-form-row-areas: none;--resolved-sub-form-row-columns: none;--resolved-sub-form-row-rows: none}.row.layout-custom .content{display:contents}.row.layout-inline.fill{--resolved-sub-form-row-columns: auto 1fr auto auto auto}.row.layout-rail.fill{--resolved-sub-form-row-columns: auto 1fr auto}.row.buttons-on-demand .move-command{opacity:0;transition:opacity .15s ease-in-out}.row.buttons-on-demand:hover .move-command,.row.buttons-on-demand:focus-within .move-command{opacity:1}.list-errors{margin:var(--aup-sub-form-row-gap, 8px) 0 0;padding-left:1.2em;color:var(--aup-error-color, #f44336);font-size:12px}.footer{display:flex;margin-top:var(--aup-sub-form-row-gap, 8px)}.row.cdk-drag-preview{box-sizing:border-box;border-radius:4px;background:var(--aup-sub-form-row-background, #fff);box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}.row.cdk-drag-placeholder{opacity:.4}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.rows.cdk-drop-list-dragging .row:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}\n"] }]
|
|
3603
3671
|
}], ctorParameters: function () { return []; }, propDecorators: { list: [{
|
|
3604
3672
|
type: Input
|
|
3605
3673
|
}], reorder: [{
|
|
@@ -3630,6 +3698,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
3630
3698
|
args: ['class.fill']
|
|
3631
3699
|
}, {
|
|
3632
3700
|
type: Input
|
|
3701
|
+
}], rowLayout: [{
|
|
3702
|
+
type: Input
|
|
3633
3703
|
}], rowTemplate: [{
|
|
3634
3704
|
type: ContentChild,
|
|
3635
3705
|
args: [SubFormRowDirective]
|
|
@@ -3642,6 +3712,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
3642
3712
|
}], buttonsOnDemand: [{
|
|
3643
3713
|
type: HostBinding,
|
|
3644
3714
|
args: ['class.buttons-on-demand']
|
|
3715
|
+
}], rowLayoutAttribute: [{
|
|
3716
|
+
type: HostBinding,
|
|
3717
|
+
args: ['attr.data-row-layout']
|
|
3645
3718
|
}] } });
|
|
3646
3719
|
(function (SubFormListComponent) {
|
|
3647
3720
|
SubFormListComponent.Reorder = Enum({
|
|
@@ -3653,6 +3726,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.9", ngImpor
|
|
|
3653
3726
|
DRAG: 'drag',
|
|
3654
3727
|
BOTH: 'both',
|
|
3655
3728
|
});
|
|
3729
|
+
SubFormListComponent.RowLayout = Enum({
|
|
3730
|
+
/** One line: `handle · content · up · down · actions`. The default. */
|
|
3731
|
+
INLINE: 'inline',
|
|
3732
|
+
/** `up` / `handle` / `down` stacked in a leading rail, content beside it, actions trailing. */
|
|
3733
|
+
RAIL: 'rail',
|
|
3734
|
+
/**
|
|
3735
|
+
* The caller lays the row out. No preset area map, no library-rendered buttons, and the content
|
|
3736
|
+
* wrapper is given `display: contents` so the row template's own top-level elements become the
|
|
3737
|
+
* grid items it writes `grid-area` on.
|
|
3738
|
+
*
|
|
3739
|
+
* The drag handle is still rendered whenever `reorder` enables drag — it has to be, since a
|
|
3740
|
+
* `cdkDragHandle` in a caller's template silently fails to attach — so drag survives a custom
|
|
3741
|
+
* layout. Two obligations come with that: include a `handle` area in the map (an unknown named
|
|
3742
|
+
* line falls back to auto-placement), and render the move commands yourself, because they are
|
|
3743
|
+
* the only keyboard path to reordering and the library no longer provides them.
|
|
3744
|
+
*
|
|
3745
|
+
* One known limitation: CDK appends the drag preview to `<body>`, so a map set on or above this
|
|
3746
|
+
* component's host does not reach it and the preview auto-places instead. The caller's own
|
|
3747
|
+
* `grid-area` rules *do* survive, being compound selectors on cloned elements — only the track
|
|
3748
|
+
* definition is lost. Hoisting the map to `:root` fixes the preview but sets the public variable
|
|
3749
|
+
* for every list on the page, overriding their layouts too, so it is only an option when the
|
|
3750
|
+
* page has one list.
|
|
3751
|
+
*/
|
|
3752
|
+
CUSTOM: 'custom',
|
|
3753
|
+
});
|
|
3656
3754
|
// Held as constants rather than object literals in the template: CommandFace members are
|
|
3657
3755
|
// functions and these bind once per row, so a literal would allocate a new face on every pass.
|
|
3658
3756
|
SubFormListComponent.DEFAULT_REMOVE_FACE = { icon: () => 'mat:delete', tooltip: () => 'Remove' };
|