@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.
@@ -1,4 +1,5 @@
1
1
  import { CdkDragDrop } from '@angular/cdk/drag-drop';
2
+ import { AfterContentInit } from '@angular/core';
2
3
  import { Command, CommandFace, SubFormList, ValueModel } from '@coolon/pectin';
3
4
  import { Enum } from 'typescript-string-enums';
4
5
  import { DisposableComponent } from '../../disposable-component';
@@ -27,7 +28,7 @@ import * as i0 from "@angular/core";
27
28
  * previous list, which is not a scenario a form has — the list is built in the component's
28
29
  * constructor and lives as long as the form does.
29
30
  */
30
- export declare class SubFormListComponent<T extends object = any, B extends SubFormList.Fields = SubFormList.Fields> extends DisposableComponent {
31
+ export declare class SubFormListComponent<T extends object = any, B extends SubFormList.Fields = SubFormList.Fields> extends DisposableComponent implements AfterContentInit {
31
32
  list: SubFormList<T, B>;
32
33
  /**
33
34
  * Which reordering affordances to offer. `AUTO` — the default — resolves to {@link Reorder.BOTH}
@@ -61,6 +62,19 @@ export declare class SubFormListComponent<T extends object = any, B extends SubF
61
62
  * far edge of the list; turn it on for a row whose single field should span the width.
62
63
  */
63
64
  fill: boolean;
65
+ /**
66
+ * How the library lays the row's cells out. {@link RowLayout.INLINE} — the default — is one line
67
+ * of `handle · content · up · down · actions`.
68
+ *
69
+ * Each value is a named preset over the row's public CSS variables
70
+ * (`--aup-sub-form-row-areas` / `-columns` / `-rows`), which a consumer can set from its own
71
+ * stylesheet to override any of them — the variable wins over the preset, deliberately.
72
+ *
73
+ * Bind this once. It selects a class on each row, and {@link RowLayout.CUSTOM} additionally
74
+ * changes what the row renders, so flipping it at runtime rebuilds the very bindings the row
75
+ * context memoisation exists to keep stable.
76
+ */
77
+ rowLayout: SubFormListComponent.RowLayout;
64
78
  rowTemplate: SubFormRowDirective;
65
79
  actionsTemplate: SubFormRowActionsDirective;
66
80
  emptyTemplate: SubFormListEmptyDirective;
@@ -96,7 +110,25 @@ export declare class SubFormListComponent<T extends object = any, B extends SubF
96
110
  */
97
111
  get dragEnabled(): boolean;
98
112
  get buttonsOnDemand(): boolean;
113
+ /** A hook for consumer stylesheets and e2e selectors; the layout rules key off the row's class. */
114
+ get rowLayoutAttribute(): string;
115
+ get inlineLayout(): boolean;
116
+ get railLayout(): boolean;
117
+ get customLayout(): boolean;
118
+ /**
119
+ * The three standard buttons, as flat grid items. Excludes the case where a template replaces
120
+ * them, so the two branches are siblings rather than an `if/else` — which is what lets the
121
+ * default cluster be flat while the replacing one keeps a wrapper to be placed by.
122
+ */
123
+ get defaultActionsVisible(): boolean;
124
+ get customActionsVisible(): boolean;
125
+ /** Whether anything trails the content — drives the content cell's trailing spacing. */
99
126
  get hasActions(): boolean;
127
+ /**
128
+ * Not folded into the `onInit` callback above: a non-static `@ContentChild` is not resolved until
129
+ * `ngAfterContentInit`, so {@link actionsTemplate} is still undefined during `ngOnInit`.
130
+ */
131
+ ngAfterContentInit(): void;
100
132
  trackByRow(index: number, context: SubFormRowContext): unknown;
101
133
  /**
102
134
  * CDK reports `currentIndex` after the dragged row has been taken out of the list, which is the
@@ -106,9 +138,16 @@ export declare class SubFormListComponent<T extends object = any, B extends SubF
106
138
  * row does not visibly snap back to where it started.
107
139
  */
108
140
  onDropped(event: CdkDragDrop<unknown>): void;
141
+ /**
142
+ * `CUSTOM` hands the row to the caller, which silently ignores two inputs that would otherwise
143
+ * have rendered something. The reorder warning fires only for an *explicit* `BUTTONS`/`BOTH` —
144
+ * `reorder` defaults to `AUTO`, and a plain custom row is very likely rendering the commands
145
+ * itself, which the component cannot detect.
146
+ */
147
+ private warnAboutIgnoredCustomLayoutInputs;
109
148
  private warnAboutUnsupportedReordering;
110
149
  static ɵfac: i0.ɵɵFactoryDeclaration<SubFormListComponent<any, any>, never>;
111
- static ɵcmp: i0.ɵɵComponentDeclaration<SubFormListComponent<any, any>, "aup-sub-form-list", never, { "list": { "alias": "list"; "required": false; }; "reorder": { "alias": "reorder"; "required": false; }; "removable$": { "alias": "removable$"; "required": false; }; "removable": { "alias": "removable"; "required": false; }; "removeFace": { "alias": "removeFace"; "required": false; }; "moveUpFace": { "alias": "moveUpFace"; "required": false; }; "moveDownFace": { "alias": "moveDownFace"; "required": false; }; "dragHandleIcon": { "alias": "dragHandleIcon"; "required": false; }; "addCommand": { "alias": "addCommand"; "required": false; }; "emptyText": { "alias": "emptyText"; "required": false; }; "dense": { "alias": "dense"; "required": false; }; "fill": { "alias": "fill"; "required": false; }; }, {}, ["rowTemplate", "actionsTemplate", "emptyTemplate"], never, false, never>;
150
+ static ɵcmp: i0.ɵɵComponentDeclaration<SubFormListComponent<any, any>, "aup-sub-form-list", never, { "list": { "alias": "list"; "required": false; }; "reorder": { "alias": "reorder"; "required": false; }; "removable$": { "alias": "removable$"; "required": false; }; "removable": { "alias": "removable"; "required": false; }; "removeFace": { "alias": "removeFace"; "required": false; }; "moveUpFace": { "alias": "moveUpFace"; "required": false; }; "moveDownFace": { "alias": "moveDownFace"; "required": false; }; "dragHandleIcon": { "alias": "dragHandleIcon"; "required": false; }; "addCommand": { "alias": "addCommand"; "required": false; }; "emptyText": { "alias": "emptyText"; "required": false; }; "dense": { "alias": "dense"; "required": false; }; "fill": { "alias": "fill"; "required": false; }; "rowLayout": { "alias": "rowLayout"; "required": false; }; }, {}, ["rowTemplate", "actionsTemplate", "emptyTemplate"], never, false, never>;
112
151
  }
113
152
  export declare namespace SubFormListComponent {
114
153
  const Reorder: {
@@ -121,6 +160,32 @@ export declare namespace SubFormListComponent {
121
160
  BOTH: "both";
122
161
  };
123
162
  type Reorder = Enum<typeof Reorder>;
163
+ const RowLayout: {
164
+ /** One line: `handle · content · up · down · actions`. The default. */
165
+ INLINE: "inline";
166
+ /** `up` / `handle` / `down` stacked in a leading rail, content beside it, actions trailing. */
167
+ RAIL: "rail";
168
+ /**
169
+ * The caller lays the row out. No preset area map, no library-rendered buttons, and the content
170
+ * wrapper is given `display: contents` so the row template's own top-level elements become the
171
+ * grid items it writes `grid-area` on.
172
+ *
173
+ * The drag handle is still rendered whenever `reorder` enables drag — it has to be, since a
174
+ * `cdkDragHandle` in a caller's template silently fails to attach — so drag survives a custom
175
+ * layout. Two obligations come with that: include a `handle` area in the map (an unknown named
176
+ * line falls back to auto-placement), and render the move commands yourself, because they are
177
+ * the only keyboard path to reordering and the library no longer provides them.
178
+ *
179
+ * One known limitation: CDK appends the drag preview to `<body>`, so a map set on or above this
180
+ * component's host does not reach it and the preview auto-places instead. The caller's own
181
+ * `grid-area` rules *do* survive, being compound selectors on cloned elements — only the track
182
+ * definition is lost. Hoisting the map to `:root` fixes the preview but sets the public variable
183
+ * for every list on the page, overriding their layouts too, so it is only an option when the
184
+ * page has one list.
185
+ */
186
+ CUSTOM: "custom";
187
+ };
188
+ type RowLayout = Enum<typeof RowLayout>;
124
189
  const DEFAULT_REMOVE_FACE: CommandFace;
125
190
  const DEFAULT_MOVE_UP_FACE: CommandFace;
126
191
  const DEFAULT_MOVE_DOWN_FACE: CommandFace;
@@ -45,6 +45,11 @@ export declare class SubFormRowDirective {
45
45
  *
46
46
  * The commands are on the row sub-form itself (`removeItemCommand`, `moveUpCommand`,
47
47
  * `moveDownCommand`), so the context is the same one the row template gets.
48
+ *
49
+ * It renders as a single grid item in the row's `actions` cell — unlike the default cluster, whose
50
+ * three buttons are placed separately so a layout can split them. Ignored, with a warning, under
51
+ * `rowLayout="custom"`: that layout hands the whole row to the `aupSubFormRow` template, which
52
+ * reaches the very same commands.
48
53
  */
49
54
  export declare class SubFormRowActionsDirective {
50
55
  readonly templateRef: TemplateRef<SubFormRowContext>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "16.1.0-alpha.268",
3
+ "version": "16.1.0-alpha.269",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^16.2.9",
6
6
  "@angular/common": "^16.2.9",