@quadrel-enterprise-ui/framework 21.7.0 → 21.7.1

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.
@@ -36927,7 +36927,12 @@ class QdPageStepComponent extends CdkStep {
36927
36927
  * * @note The use of CDK attributes is not permitted. Please configure this component here.
36928
36928
  */
36929
36929
  config;
36930
- control;
36930
+ /**
36931
+ * The form of the step, for example a QdFormGroup.
36932
+ *
36933
+ * The stepper only moves on to the next step when this form is valid. Optional steps skip this check.
36934
+ */
36935
+ stepControl;
36931
36936
  infoBanners;
36932
36937
  _destroyed$ = new Subject();
36933
36938
  constructor() {
@@ -36957,7 +36962,7 @@ class QdPageStepComponent extends CdkStep {
36957
36962
  console.error('Quadrel Framework | QdPageStep - Please provide a label for the step.');
36958
36963
  }
36959
36964
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdPageStepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
36960
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdPageStepComponent, isStandalone: true, selector: "qd-page-step", inputs: { config: "config", control: "control" }, host: { classAttribute: "qd-stepper" }, providers: [
36965
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdPageStepComponent, isStandalone: true, selector: "qd-page-step", inputs: { config: "config", stepControl: "stepControl" }, host: { classAttribute: "qd-stepper" }, providers: [
36961
36966
  { provide: CdkStep, useExisting: QdPageStepComponent },
36962
36967
  { provide: STEPPER_GLOBAL_OPTIONS, useValue: { showError: true } }
36963
36968
  ], queries: [{ propertyName: "infoBanners", predicate: QdPageInfoBannerComponent }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: "<ng-template>\n <div class=\"page-info-banners\">\n <ng-content select=\"qd-page-info-banner\"></ng-content>\n </div>\n\n <ng-content></ng-content>\n</ng-template>\n", styles: [".page-info-banners:has(>qd-page-info-banner:not(.qd-page-info-banner-empty)){padding:1rem 1.25rem .5rem;border-bottom:rgb(213,213,213) solid .0625rem;background-color:#fff}.page-info-banners>qd-page-info-banner:last-child{margin-bottom:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -36970,7 +36975,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
36970
36975
  ], host: { class: 'qd-stepper' }, standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template>\n <div class=\"page-info-banners\">\n <ng-content select=\"qd-page-info-banner\"></ng-content>\n </div>\n\n <ng-content></ng-content>\n</ng-template>\n", styles: [".page-info-banners:has(>qd-page-info-banner:not(.qd-page-info-banner-empty)){padding:1rem 1.25rem .5rem;border-bottom:rgb(213,213,213) solid .0625rem;background-color:#fff}.page-info-banners>qd-page-info-banner:last-child{margin-bottom:0}\n"] }]
36971
36976
  }], ctorParameters: () => [], propDecorators: { config: [{
36972
36977
  type: Input
36973
- }], control: [{
36978
+ }], stepControl: [{
36974
36979
  type: Input
36975
36980
  }], infoBanners: [{
36976
36981
  type: ContentChildren,
@@ -37179,25 +37184,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
37179
37184
  * #### Configuration
37180
37185
  *
37181
37186
  * ```ts
37182
- * type ColumnDefinition = 'rubrik' | 'data' | 'status';
37187
+ * type ColumnDefinition = 'category' | 'amount' | 'status';
37183
37188
  * const config: QdQuickEditConfig<ColumnDefinition> = {
37184
37189
  * columns: [
37185
37190
  * {
37186
- * name: 'rubrik',
37191
+ * name: 'category',
37187
37192
  * type: 'text',
37188
- * i18n: 'translation.key.rubrik',
37193
+ * i18n: 'translation.key.category',
37189
37194
  * isEditable: () => false
37190
37195
  * },
37191
37196
  * {
37192
- * name: 'data',
37197
+ * name: 'amount',
37193
37198
  * type: 'integer',
37194
- * i18n: 'translation.key.data',
37195
- * isEditable: (row, column) => !!row['rubrik'],
37199
+ * i18n: 'translation.key.amount',
37200
+ * isEditable: row => !!row['category'],
37196
37201
  * validators: [Validators.required] // only relevant in template data mode
37202
+ * },
37203
+ * {
37204
+ * name: 'status',
37205
+ * type: 'enum',
37206
+ * i18n: 'translation.key.status',
37207
+ * isEditable: () => true,
37208
+ * options: [
37209
+ * { value: '1', i18n: 'translation.key.status.active' },
37210
+ * { value: '0', i18n: 'translation.key.status.inactive' }
37211
+ * ]
37197
37212
  * }
37198
37213
  * ],
37199
- * canAdd: true,
37200
- * secondaryActions: [...]
37214
+ * canAdd: true
37201
37215
  * }
37202
37216
  * ```
37203
37217
  *
@@ -37207,39 +37221,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
37207
37221
  *
37208
37222
  * ```ts
37209
37223
  * form = new FormGroup({
37210
- * data: new FormArray([
37224
+ * rows: new FormArray([
37211
37225
  * new FormGroup({
37212
- * rubrik: new QdFormControl('Text'),
37213
- * data: new QdFormControl(123)
37226
+ * category: new QdFormControl('Text'),
37227
+ * amount: new QdFormControl(123),
37228
+ * status: new QdFormControl('1')
37214
37229
  * })
37215
37230
  * ])
37216
37231
  * })
37217
37232
  * ```
37218
37233
  *
37219
- * Then bind the `formArrayName` directive in the template:
37234
+ * Then bind the `formArrayName` directive in the template. The name is the key of your FormArray,
37235
+ * it has nothing to do with the `data` input:
37220
37236
  *
37221
37237
  * ```html
37222
37238
  * <form [formGroup]="form">
37223
- * <qd-quick-edit [config]="config" formArrayName="data"></qd-quick-edit>
37239
+ * <qd-quick-edit [config]="config" formArrayName="rows"></qd-quick-edit>
37224
37240
  * </form>
37225
37241
  * ```
37226
37242
  *
37227
- * You can add new rows by reacting to `(addNewClicked)`:
37243
+ * In this mode the FormArray is the single source of truth for the rows. QuickEdit keeps no copy of its own.
37244
+ * What the FormArray holds is what the table shows.
37245
+ *
37246
+ * **Adding rows:** QuickEdit does not create the row for you. It emits `(addNewClicked)` and you insert a new FormGroup:
37247
+ *
37248
+ * ```ts
37249
+ * addRow(): void {
37250
+ * this.form.controls.rows.insert(0, new FormGroup({ ... }));
37251
+ * }
37252
+ * ```
37253
+ *
37254
+ * **Removing rows:** QuickEdit removes the row for you. It calls `removeAt(index)` on your FormArray.
37255
+ * There is no separate output event, because the FormArray already tells you: `valueChanges` fires, `length` and `controls` are updated.
37256
+ * The remove action only appears when `canAdd` is set — that one flag switches adding and removing on together.
37257
+ * With `hasRemoveConfirmation` or `removeConfirmationMessage` in the config, a confirmation dialog is shown first.
37258
+ * The row is only removed after the user confirms.
37259
+ *
37260
+ * **Reacting to a changed set of rows:** subscribe to the FormArray, not to QuickEdit. This covers both directions,
37261
+ * rows you insert and rows QuickEdit removes:
37228
37262
  *
37229
37263
  * ```ts
37230
- * addControl(): void {
37231
- * this.form.get('data')?.insert(0, new FormGroup({ ... }));
37264
+ * ngOnInit(): void {
37265
+ * this.form.controls.rows.valueChanges
37266
+ * .pipe(takeUntilDestroyed(this.destroyRef))
37267
+ * .subscribe(rows => (this.rowCount = rows.length));
37232
37268
  * }
37233
37269
  * ```
37234
37270
  *
37271
+ * **Row actions:** an entry of `config.secondaryActions` receives the value of its row, never its position.
37272
+ * Carry your own key in the row when the handler has to find that row again in your FormArray.
37273
+ *
37235
37274
  * #### Template Data (optional)
37236
37275
  *
37237
37276
  * Alternatively, you can provide a static `data` array. This is useful for read-only scenarios without reactive forms.
37238
37277
  *
37239
37278
  * ```ts
37240
- * const data: QdQuickEditData<MyColumns> = [
37241
- * { rubrik: 'Foo', data: 42 },
37242
- * { rubrik: 'Bar', data: 77 }
37279
+ * const data: QdQuickEditData<ColumnDefinition> = [
37280
+ * { category: 'Foo', amount: 42, status: '1' },
37281
+ * { category: 'Bar', amount: 77, status: '0' }
37243
37282
  * ];
37244
37283
  * ```
37245
37284
  *
@@ -37247,6 +37286,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
37247
37286
  * <qd-quick-edit [config]="config" [data]="data"></qd-quick-edit>
37248
37287
  * ```
37249
37288
  *
37289
+ * **How this mode differs:** QuickEdit builds its own FormGroup with a `rows` FormArray from the `data` input.
37290
+ * Here QuickEdit is the source of truth, not your array.
37291
+ *
37292
+ * - Adding a row: QuickEdit inserts an empty row at the top itself. `(addNewClicked)` is not emitted.
37293
+ * - Removing a row: QuickEdit removes the row from its own FormArray and also from the `data` array you passed in (in place, via `splice`).
37294
+ * - Reacting to a changed set of rows: `(formGroupChange)` emits QuickEdit's FormGroup on every change. Read the rows from `formGroup.get('rows')`.
37295
+ * - Passing a new `data` array reference rebuilds all rows from that array.
37296
+ *
37250
37297
  * #### Validation
37251
37298
  *
37252
37299
  * - In **FormArray mode**, validators must be set directly on your FormControls. Validators in `config.columns` are ignored.
@@ -37270,39 +37317,46 @@ class QdQuickEditComponent {
37270
37317
  controlContainer = inject(ControlContainer, { optional: true, self: true });
37271
37318
  confirmationDialogService = inject(QdConfirmationDialogOpenerService);
37272
37319
  /**
37273
- * Configuration of the QuickEdit. The generic type specifies the column definition. <br />
37320
+ * Configuration of the QuickEdit. The generic type names the columns.
37274
37321
  *
37275
- * **Usage:**
37322
+ * Every column name must be a member of that type, and `name`, `type`, `i18n` and `isEditable`
37323
+ * are required on each column. The only column types are `text`, `integer` and `enum`.
37276
37324
  *
37277
37325
  * @example
37278
- * type ColumnDefinition = 'article' | 'mass' | 'documents';
37326
+ * type ColumnDefinition = 'article' | 'mass' | 'unit';
37279
37327
  * const config: QdQuickEditConfig<ColumnDefinition> = {
37280
37328
  * columns: [
37281
37329
  * {
37282
- * name: 'rubrik',
37330
+ * name: 'article',
37283
37331
  * type: 'text',
37284
- * i18n: 'translation.key.rubrik',
37332
+ * i18n: 'translation.key.article',
37285
37333
  * isEditable: () => false
37286
37334
  * },
37287
37335
  * {
37288
- * name: 'data',
37336
+ * name: 'mass',
37289
37337
  * type: 'integer',
37290
- * i18n: 'translation.key.data',
37291
- * isEditable: (row, column) => row['active'] == 1,
37292
- * validators: [Validators.required]
37338
+ * i18n: 'translation.key.mass',
37339
+ * isEditable: row => row['article'] != null,
37340
+ * validators: [Validators.required] // only applied in template data mode
37293
37341
  * },
37294
37342
  * {
37295
- * name: 'size',
37296
- * type: 'boolean',
37297
- * i18n: 'translation.key.size',
37298
- * validators: [customValidatorFunction()]
37343
+ * name: 'unit',
37344
+ * type: 'enum',
37345
+ * i18n: 'translation.key.unit',
37346
+ * isEditable: () => true,
37347
+ * options: [
37348
+ * { value: 'kg', i18n: 'translation.key.unit.kg' },
37349
+ * { value: 't', i18n: 'translation.key.unit.t' }
37350
+ * ]
37299
37351
  * }
37300
- * ]
37352
+ * ],
37353
+ * canAdd: true
37301
37354
  * }
37302
37355
  */
37303
37356
  config;
37304
37357
  /**
37305
- * Data provider for QuickEdit.
37358
+ * Data provider for QuickEdit. Only used in template data mode.
37359
+ * QuickEdit removes rows from this array in place. Ignored when `formArrayName` is bound.
37306
37360
  */
37307
37361
  data;
37308
37362
  get templateData() {
@@ -37319,8 +37373,13 @@ class QdQuickEditComponent {
37319
37373
  /**
37320
37374
  * The form group instance of QdQuickEdit.
37321
37375
  * Use this form group to bind it to step-control of QdStepper or other custom logics.
37376
+ * Only emits in template data mode. In FormArray mode your own FormArray is the source of truth.
37322
37377
  */
37323
37378
  formGroupChange = new EventEmitter();
37379
+ /**
37380
+ * Emitted in FormArray mode when the user clicks the add button.
37381
+ * Insert a new FormGroup into your FormArray. Not emitted in template data mode.
37382
+ */
37324
37383
  addNewClicked = new EventEmitter();
37325
37384
  focusables;
37326
37385
  customForDirective;
@@ -37344,6 +37403,9 @@ class QdQuickEditComponent {
37344
37403
  get visibleColumns() {
37345
37404
  return this.config.columns.filter(column => !column.isHidden);
37346
37405
  }
37406
+ /**
37407
+ * Track function for the column loop. Keeps a column's cells alive while the rows change.
37408
+ */
37347
37409
  trackByColumnName(_, column) {
37348
37410
  return column.name;
37349
37411
  }
@@ -37376,20 +37438,38 @@ class QdQuickEditComponent {
37376
37438
  this._destroyed$.next();
37377
37439
  this._destroyed$.complete();
37378
37440
  }
37441
+ /**
37442
+ * Whether a secondary action is disabled for one row.
37443
+ * Resolves the `isDisabled` of the action, which may be a flag or a function of the row.
37444
+ */
37379
37445
  isActionDisabled(action, row) {
37380
37446
  if (typeof action.isDisabled === 'function')
37381
37447
  return action.isDisabled(row);
37382
37448
  return !!action.isDisabled;
37383
37449
  }
37450
+ /**
37451
+ * Runs the handler of a secondary action for one row.
37452
+ * The handler receives the row value only, never its position.
37453
+ */
37384
37454
  handleSecondaryAction(action, rowIndex) {
37385
37455
  if (!action)
37386
37456
  return;
37387
37457
  const selectedRowData = this.controlContainer?.control?.controls[rowIndex].value ?? this.rows.value[rowIndex];
37388
37458
  action.handler(selectedRowData);
37389
37459
  }
37460
+ /**
37461
+ * Maps a column type onto a facet component.
37462
+ *
37463
+ * @deprecated Nothing calls this any more, the template renders the cells directly. Planned for v22.
37464
+ */
37390
37465
  getComponentType(column) {
37391
37466
  return COMPONENT_MAP[column.type] || null;
37392
37467
  }
37468
+ /**
37469
+ * Builds the inputs of the facet component for one cell.
37470
+ *
37471
+ * @deprecated Nothing calls this any more, the template renders the cells directly. Planned for v22.
37472
+ */
37393
37473
  getComponentInputs(column, row) {
37394
37474
  const testId = this.testId && this.testId + '-cell-' + column.name;
37395
37475
  if (column.type === 'enum')
@@ -37399,6 +37479,10 @@ class QdQuickEditComponent {
37399
37479
  };
37400
37480
  return { data: row[column.name], testId };
37401
37481
  }
37482
+ /**
37483
+ * Adds a row and focuses its first field.
37484
+ * FormArray mode: emits `addNewClicked` and leaves the insert to you. Template data mode: inserts an empty row at the top.
37485
+ */
37402
37486
  createRow() {
37403
37487
  this.redrawOnNextChange();
37404
37488
  if (this.controlContainer) {
@@ -37416,6 +37500,10 @@ class QdQuickEditComponent {
37416
37500
  this.changeDetectorRef.detectChanges();
37417
37501
  window.setTimeout(() => this.focusFirstControl());
37418
37502
  }
37503
+ /**
37504
+ * Removes the row at `index`, after the confirmation dialog when one is configured.
37505
+ * FormArray mode: calls `removeAt(index)` on your FormArray, no extra event. Template data mode: removes from the internal FormArray and from `data`.
37506
+ */
37419
37507
  removeRow(index) {
37420
37508
  const { hasRemoveConfirmation, removeConfirmationMessage } = this.config;
37421
37509
  if (hasRemoveConfirmation || removeConfirmationMessage) {
@@ -37522,6 +37610,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
37522
37610
  args: [QdCustomForDirective]
37523
37611
  }] } });
37524
37612
 
37613
+ /**
37614
+ * Provides {@link QdQuickEditComponent} for editing rows inline.
37615
+ *
37616
+ * Import it where the table is used. It brings the form controls the cells need.
37617
+ */
37525
37618
  class QdQuickEditModule {
37526
37619
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdQuickEditModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
37527
37620
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.17", ngImport: i0, type: QdQuickEditModule, declarations: [QdQuickEditComponent, QdCustomForDirective], imports: [QdCoreModule,