@praxisui/table 10.0.0-rc.4 → 10.0.0-rc.41

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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Inject, Component } from '@angular/core';
2
+ import { ViewChild, Inject, Component } from '@angular/core';
3
3
  import * as i1 from '@angular/material/dialog';
4
4
  import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
5
5
  import * as i3 from '@angular/material/button';
@@ -8,10 +8,11 @@ import * as i15 from '@angular/material/progress-bar';
8
8
  import { MatProgressBarModule } from '@angular/material/progress-bar';
9
9
  import * as i7 from '@angular/material/icon';
10
10
  import { MatIconModule } from '@angular/material/icon';
11
- import * as i10 from '@angular/material/tooltip';
11
+ import * as i14 from '@angular/material/tooltip';
12
12
  import { MatTooltipModule } from '@angular/material/tooltip';
13
13
  import { PraxisFilterForm } from '@praxisui/dynamic-form';
14
14
  import { PraxisIconButtonComponent } from '@praxisui/core';
15
+ import { aq as projectFilterPayload } from './praxisui-table-praxisui-table-CdEy3SYM.mjs';
15
16
 
16
17
  class FilterFormDialogHostComponent {
17
18
  data;
@@ -20,6 +21,8 @@ class FilterFormDialogHostComponent {
20
21
  ready = false;
21
22
  lastValue = {};
22
23
  formGroup = null;
24
+ filterForm;
25
+ pendingAction = null;
23
26
  canSave = false;
24
27
  saving = false;
25
28
  constructor(data, ref) {
@@ -48,11 +51,39 @@ class FilterFormDialogHostComponent {
48
51
  this.updateCanSave();
49
52
  }
50
53
  apply() {
54
+ this.requestProjectedValue('apply');
55
+ }
56
+ requestProjectedValue(action) {
57
+ if (!this.valid || this.formGroup?.invalid || this.formGroup?.pending)
58
+ return;
59
+ if (this.filterForm) {
60
+ this.pendingAction = action;
61
+ try {
62
+ this.filterForm.onFormSubmit();
63
+ }
64
+ finally {
65
+ this.pendingAction = null;
66
+ }
67
+ return;
68
+ }
69
+ // A host without a rendered form has no schema projection to apply.
70
+ if (this.data?.config)
71
+ return;
51
72
  const formData = this.formGroup?.getRawValue?.() ??
52
73
  this.lastValue ??
53
74
  this.data?.initialDto ??
54
75
  {};
55
- this.ref.close({ formData });
76
+ this.completeAction(action, formData);
77
+ }
78
+ onProjectedSubmit(event) {
79
+ this.completeAction(this.pendingAction ?? 'apply', event.formData);
80
+ }
81
+ completeAction(action, formData) {
82
+ this.lastValue = formData;
83
+ if (action === 'apply')
84
+ this.ref.close({ formData });
85
+ else
86
+ this.saveProjectedShortcut(formData);
56
87
  }
57
88
  close() { this.ref.close(); }
58
89
  clean(obj) {
@@ -68,7 +99,8 @@ class FilterFormDialogHostComponent {
68
99
  const base = this.data?.initialDto || {};
69
100
  const current = this.formGroup?.getRawValue?.() ?? this.lastValue ?? {};
70
101
  const merged = { ...base, ...current };
71
- return this.clean(merged);
102
+ const projected = projectFilterPayload(merged, this.data?.config?.fieldMetadata ?? []);
103
+ return projected === null ? {} : this.clean(projected);
72
104
  }
73
105
  updateCanSave() {
74
106
  this.canSave =
@@ -91,7 +123,13 @@ class FilterFormDialogHostComponent {
91
123
  saveShortcut() {
92
124
  if (!this.canSave || this.saving)
93
125
  return;
94
- const dto = this.buildDtoForSave();
126
+ this.requestProjectedValue('save');
127
+ }
128
+ saveProjectedShortcut(projected) {
129
+ const merged = projectFilterPayload({ ...(this.data?.initialDto || {}), ...projected }, this.data?.config?.fieldMetadata ?? []);
130
+ if (merged === null)
131
+ return;
132
+ const dto = this.clean(merged);
95
133
  if (!Object.keys(dto).length)
96
134
  return;
97
135
  this.saving = true;
@@ -104,7 +142,7 @@ class FilterFormDialogHostComponent {
104
142
  }
105
143
  }
106
144
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: FilterFormDialogHostComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
107
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: FilterFormDialogHostComponent, isStandalone: true, selector: "praxis-filter-form-dialog-host", ngImport: i0, template: `
145
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.14", type: FilterFormDialogHostComponent, isStandalone: true, selector: "praxis-filter-form-dialog-host", viewQueries: [{ propertyName: "filterForm", first: true, predicate: PraxisFilterForm, descendants: true }], ngImport: i0, template: `
108
146
  <div class="pfx-dialog-title">
109
147
  <h2 mat-dialog-title class="pfx-dialog-title-text">
110
148
  <mat-icon>tune</mat-icon>
@@ -137,6 +175,7 @@ class FilterFormDialogHostComponent {
137
175
  (formReady)="onReady($event)"
138
176
  (valueChange)="onChange($event)"
139
177
  (validityChange)="onValidity($event)"
178
+ (submit)="onProjectedSubmit($event)"
140
179
  ></praxis-filter-form>
141
180
  }
142
181
  @if (!data?.config && !data?.schemaLoading) {
@@ -160,7 +199,7 @@ class FilterFormDialogHostComponent {
160
199
  {{ data.i18n?.apply || 'Aplicar' }}
161
200
  </button>
162
201
  </mat-dialog-actions>
163
- `, isInline: true, styles: [".pfx-dialog-title{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-right:8px}.pfx-dialog-title-text{display:inline-flex;align-items:center;gap:8px;margin:0;padding:0;font-weight:600;color:var(--mdc-dialog-subhead-color, var(--md-sys-color-on-surface))}.pfx-dialog-close{margin-left:auto}.pfx-filter-dialog-content{display:flex;flex-direction:column;gap:12px;padding-top:8px}.pfx-empty-state{margin:8px 0 0;color:var(--mdc-dialog-supporting-text-color, var(--md-sys-color-on-surface-variant))}.pfx-dialog-loading{display:flex;flex-direction:column;gap:10px;min-height:128px;justify-content:center;color:var(--mdc-dialog-supporting-text-color, var(--md-sys-color-on-surface-variant));font-size:.875rem}.pfx-form-pending{height:0;overflow:hidden;visibility:hidden;pointer-events:none}.pfx-dialog-actions{padding:var(--pdx-dialog-actions-padding, 12px 24px 16px);border-top:1px solid var(--md-sys-color-outline-variant);background:transparent;display:flex;align-items:center;gap:8px}.pfx-save-shortcut-button{margin-right:auto}.pfx-save-shortcut-button mat-icon{margin-right:6px;width:18px;height:18px;font-size:18px}\n"], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i15.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: PraxisFilterForm, selector: "praxis-filter-form", inputs: ["config", "formId", "resourcePath", "mode"], outputs: ["formReady", "valueChange", "submit", "requestSearch", "validityChange"] }, { kind: "component", type: PraxisIconButtonComponent, selector: "button[praxisIconButton]", inputs: ["praxisIconButton", "size", "appearance", "presentation", "pressed", "busy"] }] });
202
+ `, isInline: true, styles: [".pfx-dialog-title{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-right:8px}.pfx-dialog-title-text{display:inline-flex;align-items:center;gap:8px;margin:0;padding:0;font-weight:600;color:var(--mdc-dialog-subhead-color, var(--md-sys-color-on-surface))}.pfx-dialog-close{margin-left:auto}.pfx-filter-dialog-content{display:flex;flex-direction:column;gap:12px;padding-top:8px}.pfx-empty-state{margin:8px 0 0;color:var(--mdc-dialog-supporting-text-color, var(--md-sys-color-on-surface-variant))}.pfx-dialog-loading{display:flex;flex-direction:column;gap:10px;min-height:128px;justify-content:center;color:var(--mdc-dialog-supporting-text-color, var(--md-sys-color-on-surface-variant));font-size:.875rem}.pfx-form-pending{height:0;overflow:hidden;visibility:hidden;pointer-events:none}.pfx-dialog-actions{padding:var(--pdx-dialog-actions-padding, 12px 24px 16px);border-top:1px solid var(--md-sys-color-outline-variant);background:transparent;display:flex;align-items:center;gap:8px}.pfx-save-shortcut-button{margin-right:auto}.pfx-save-shortcut-button mat-icon{margin-right:6px;width:18px;height:18px;font-size:18px}\n"], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i15.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i14.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: PraxisFilterForm, selector: "praxis-filter-form", inputs: ["config", "formId", "resourcePath", "endpointKey", "apiUrlEntry", "mode"], outputs: ["formReady", "valueChange", "submit", "requestSearch", "validityChange"] }, { kind: "component", type: PraxisIconButtonComponent, selector: "button[praxisIconButton]", inputs: ["praxisIconButton", "size", "appearance", "presentation", "pressed", "busy"] }] });
164
203
  }
165
204
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: FilterFormDialogHostComponent, decorators: [{
166
205
  type: Component,
@@ -197,6 +236,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
197
236
  (formReady)="onReady($event)"
198
237
  (valueChange)="onChange($event)"
199
238
  (validityChange)="onValidity($event)"
239
+ (submit)="onProjectedSubmit($event)"
200
240
  ></praxis-filter-form>
201
241
  }
202
242
  @if (!data?.config && !data?.schemaLoading) {
@@ -224,6 +264,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
224
264
  }], ctorParameters: () => [{ type: undefined, decorators: [{
225
265
  type: Inject,
226
266
  args: [MAT_DIALOG_DATA]
227
- }] }, { type: i1.MatDialogRef }] });
267
+ }] }, { type: i1.MatDialogRef }], propDecorators: { filterForm: [{
268
+ type: ViewChild,
269
+ args: [PraxisFilterForm]
270
+ }] } });
228
271
 
229
272
  export { FilterFormDialogHostComponent };