@mediusinc/mng-commons 6.0.0-rc.2 → 6.0.0-rc.3

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.
Files changed (69) hide show
  1. package/core/helpers/notification.d.ts +17 -1
  2. package/core/i18n/i18n-error.d.ts +2 -3
  3. package/core/router/route-builder.d.ts +1 -1
  4. package/esm2022/core/helpers/notification.mjs +19 -4
  5. package/esm2022/core/i18n/i18n-error.mjs +10 -8
  6. package/esm2022/core/router/route-builder.mjs +2 -2
  7. package/esm2022/form/api/descriptors/action-button.descriptor.mjs +5 -17
  8. package/esm2022/form/api/descriptors/button-style.builder.mjs +80 -101
  9. package/esm2022/form/api/index.mjs +2 -1
  10. package/esm2022/form/api/models/button.model.mjs +2 -0
  11. package/esm2022/model/helpers/i18n.mjs +14 -9
  12. package/esm2022/table/components/column-value/column-value.component.mjs +4 -3
  13. package/esm2022/table/components/table/table.component.mjs +12 -11
  14. package/esm2022/table/helpers/notification.mjs +19 -13
  15. package/esm2022/tableview/action/components/action/action.component.mjs +41 -37
  16. package/esm2022/tableview/action/components/editor/injector-context/action-editor-injector-context.component.mjs +13 -8
  17. package/esm2022/tableview/action/helpers/i18n.mjs +50 -30
  18. package/esm2022/tableview/action/helpers/notification.mjs +73 -12
  19. package/esm2022/tableview/action/helpers/styles.mjs +2 -2
  20. package/esm2022/tableview/action/services/action-executor.service.mjs +83 -66
  21. package/esm2022/tableview/api/action/descriptors/action-editor.descriptor.mjs +34 -21
  22. package/esm2022/tableview/api/action/descriptors/action-link-descriptor.factory.mjs +4 -4
  23. package/esm2022/tableview/api/action/descriptors/action.descriptor.mjs +49 -67
  24. package/esm2022/tableview/api/action/models/action-confirmation.model.mjs +2 -0
  25. package/esm2022/tableview/api/action/models/action-descriptor.types.mjs +1 -1
  26. package/esm2022/tableview/api/editor/descriptors/field-action.descriptor.mjs +14 -8
  27. package/esm2022/tableview/api/editor/models/formly-custom-field.model.mjs +1 -1
  28. package/esm2022/tableview/api/index.mjs +2 -2
  29. package/esm2022/tableview/api/tableview/helpers/tableview-default-actions.mjs +67 -37
  30. package/esm2022/tableview/editor/components/editor/form-editor.component.mjs +5 -8
  31. package/esm2022/tableview/editor/components/formly/fields/formly-field-action/formly-field-action.component.mjs +7 -5
  32. package/esm2022/tableview/editor/components/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +29 -18
  33. package/esm2022/tableview/provide.mjs +44 -1
  34. package/fesm2022/mediusinc-mng-commons-core.mjs +29 -12
  35. package/fesm2022/mediusinc-mng-commons-core.mjs.map +1 -1
  36. package/fesm2022/mediusinc-mng-commons-form-api.mjs +137 -169
  37. package/fesm2022/mediusinc-mng-commons-form-api.mjs.map +1 -1
  38. package/fesm2022/mediusinc-mng-commons-model.mjs +13 -8
  39. package/fesm2022/mediusinc-mng-commons-model.mjs.map +1 -1
  40. package/fesm2022/mediusinc-mng-commons-table.mjs +32 -24
  41. package/fesm2022/mediusinc-mng-commons-table.mjs.map +1 -1
  42. package/fesm2022/mediusinc-mng-commons-tableview-api.mjs +165 -215
  43. package/fesm2022/mediusinc-mng-commons-tableview-api.mjs.map +1 -1
  44. package/fesm2022/mediusinc-mng-commons-tableview.mjs +358 -197
  45. package/fesm2022/mediusinc-mng-commons-tableview.mjs.map +1 -1
  46. package/form/api/descriptors/action-button.descriptor.d.ts +11 -13
  47. package/form/api/descriptors/button-style.builder.d.ts +30 -44
  48. package/form/api/index.d.ts +1 -0
  49. package/form/api/models/button.model.d.ts +19 -0
  50. package/i18n/sl.json +56 -6
  51. package/model/helpers/i18n.d.ts +8 -3
  52. package/package.json +13 -13
  53. package/table/components/column-value/column-value.component.d.ts +1 -0
  54. package/table/components/table/table.component.d.ts +0 -1
  55. package/table/helpers/notification.d.ts +10 -1
  56. package/tableview/action/components/action/action.component.d.ts +8 -11
  57. package/tableview/action/helpers/i18n.d.ts +36 -11
  58. package/tableview/action/helpers/notification.d.ts +37 -3
  59. package/tableview/api/action/descriptors/action-editor.descriptor.d.ts +18 -8
  60. package/tableview/api/action/descriptors/action.descriptor.d.ts +22 -31
  61. package/tableview/api/action/models/action-confirmation.model.d.ts +14 -0
  62. package/tableview/api/action/models/action-descriptor.types.d.ts +4 -0
  63. package/tableview/api/editor/descriptors/field-action.descriptor.d.ts +5 -5
  64. package/tableview/api/index.d.ts +1 -1
  65. package/tableview/api/tableview/helpers/tableview-default-actions.d.ts +1 -1
  66. package/tableview/provide.d.ts +7 -0
  67. package/version-info.json +6 -6
  68. package/esm2022/tableview/api/action/descriptors/action-confirmation.descriptor.mjs +0 -88
  69. package/tableview/api/action/descriptors/action-confirmation.descriptor.d.ts +0 -37
@@ -1,8 +1,8 @@
1
1
  import { of, Subject, isObservable, throwError, map, tap } from 'rxjs';
2
2
  import { StyleLevelEnum, CommonsInternalError, DataProviderInst, LoggerService, findReflectTypeName, StyleSizeEnum, ACommonsErrorBase, toObservable, fromEnumValuesAsValueArray, fromEnumConstantsAsValueArray, getEnumConstantName, GetterPipe, copyDataListParams } from '@mediusinc/mng-commons/core';
3
- import { ActionButtonDescriptor, ButtonStyleBuilder, LookupDataProviderInst, ButtonStyleRoundedEnum } from '@mediusinc/mng-commons/form/api';
4
3
  import * as i0 from '@angular/core';
5
4
  import { InjectionToken, Directive, Input, inject, Injector } from '@angular/core';
5
+ import { LookupDataProviderInst } from '@mediusinc/mng-commons/form/api';
6
6
  import { TableDataProviderInst, TableDescriptorInst, TableDynamicDescriptorInst } from '@mediusinc/mng-commons/table/api';
7
7
  import { model, ModelDescriptor } from '@mediusinc/mng-commons/model';
8
8
  import '@angular/forms';
@@ -37,92 +37,6 @@ var ActionEditorSubmitTypeEnum;
37
37
  ActionEditorSubmitTypeEnum[ActionEditorSubmitTypeEnum["Cancel"] = 1] = "Cancel";
38
38
  })(ActionEditorSubmitTypeEnum || (ActionEditorSubmitTypeEnum = {}));
39
39
 
40
- class ActionConfirmationDescriptor {
41
- constructor() {
42
- this._closeOnEscape = true; // Defines if dialog closes when esc key is pressed.
43
- this._closable = true; // Defines if dialog is closable.
44
- this._acceptButton = new ActionButtonDescriptor().withIcon('pi pi-check').withStyleClass(new ButtonStyleBuilder(StyleLevelEnum.Default));
45
- this._rejectButton = new ActionButtonDescriptor().withIcon('pi pi-times').withStyleClass(new ButtonStyleBuilder(StyleLevelEnum.Default).withTextButton());
46
- this._icon = 'pi pi-exclamation-triangle';
47
- }
48
- withIcon(icon) {
49
- this._icon = icon;
50
- return this;
51
- }
52
- withTitle(title) {
53
- this._title = title;
54
- return this;
55
- }
56
- withMessage(message) {
57
- this._message = message;
58
- return this;
59
- }
60
- withAcceptButton(actionButtonDescriptor) {
61
- this._acceptButton = actionButtonDescriptor;
62
- return this;
63
- }
64
- withRejectButton(actionButtonDescriptor) {
65
- this._rejectButton = actionButtonDescriptor;
66
- return this;
67
- }
68
- /**
69
- * set if dialog can be closed on escaped pressed
70
- * if true, then closable is also set to true
71
- * @param closeOnEscape
72
- */
73
- withCloseOnEscape(closeOnEscape) {
74
- if (closeOnEscape) {
75
- this._closable = true;
76
- }
77
- this._closeOnEscape = closeOnEscape;
78
- return this;
79
- }
80
- withClosable(closable) {
81
- this._closable = closable;
82
- return this;
83
- }
84
- withRunConfirmationConfigMapFn(runConfirmationConfigMapFn) {
85
- this._runConfirmationConfigMapFn = runConfirmationConfigMapFn;
86
- return this;
87
- }
88
- get icon() {
89
- return this._icon;
90
- }
91
- get title() {
92
- return this._title;
93
- }
94
- get message() {
95
- return this._message;
96
- }
97
- get closeOnEscape() {
98
- return this._closeOnEscape;
99
- }
100
- get closable() {
101
- return this._closable;
102
- }
103
- get runConfirmationConfigMapFn() {
104
- return this._runConfirmationConfigMapFn;
105
- }
106
- get acceptButton() {
107
- return this._acceptButton;
108
- }
109
- get rejectButton() {
110
- return this._rejectButton;
111
- }
112
- copy() {
113
- const descriptor = new ActionConfirmationDescriptor();
114
- descriptor._icon = this._icon;
115
- descriptor._title = this._title;
116
- descriptor._message = this._message;
117
- descriptor._acceptButton = this._acceptButton;
118
- descriptor._rejectButton = this._rejectButton;
119
- descriptor._closeOnEscape = this._closeOnEscape;
120
- descriptor._closable = this._closable;
121
- descriptor._runConfirmationConfigMapFn = this._runConfirmationConfigMapFn;
122
- return descriptor;
123
- }
124
- }
125
-
126
40
  class ActionDescriptorInst {
127
41
  constructor(actionName, cfg) {
128
42
  this._type = ActionTypeEnum.Direct;
@@ -130,10 +44,6 @@ class ActionDescriptorInst {
130
44
  this._position = ActionPositionEnum.ToolbarRight;
131
45
  this._level = StyleLevelEnum.Default;
132
46
  this._routeUrl = null;
133
- this._hasRunNotificationSuccess = true;
134
- this._hasRunNotificationError = true;
135
- //button
136
- this._button = new ActionButtonDescriptor();
137
47
  // multiple row selection
138
48
  this._hasItemsSelection = false;
139
49
  // subactions
@@ -182,9 +92,6 @@ class ActionDescriptorInst {
182
92
  get position() {
183
93
  return this._position;
184
94
  }
185
- get level() {
186
- return this._level;
187
- }
188
95
  get routeUrl() {
189
96
  return this._routeUrl;
190
97
  }
@@ -212,32 +119,14 @@ class ActionDescriptorInst {
212
119
  get actionNameLong() {
213
120
  return this._actionNameLong;
214
121
  }
215
- get className() {
216
- return this.button.styleClass.customClass;
217
- }
218
- get runConfirmationDialogDescriptor() {
219
- return this._runConfirmationDialogDescriptor;
220
- }
221
- get hasRunConfirmation() {
222
- return this._runConfirmationDialogDescriptor !== null && this._runConfirmationDialogDescriptor !== undefined;
223
- }
224
- get hasRunNotificationSuccess() {
225
- return this._hasRunNotificationSuccess;
226
- }
227
- get runNotificationSuccessTitle() {
228
- return this._runNotificationSuccessTitle;
229
- }
230
- get runNotificationSuccessMessage() {
231
- return this._runNotificationSuccessMessage;
122
+ get runConfirmation() {
123
+ return this._runConfirmation;
232
124
  }
233
- get hasRunNotificationError() {
234
- return this._hasRunNotificationError;
125
+ get runNotificationOnSuccess() {
126
+ return this._runNotificationOnSuccess;
235
127
  }
236
- get runNotificationErrorTitle() {
237
- return this._runNotificationErrorTitle;
238
- }
239
- get runNotificationErrorMessage() {
240
- return this._runNotificationErrorMessage;
128
+ get runNotificationOnError() {
129
+ return this._runNotificationOnError;
241
130
  }
242
131
  get afterRunAction() {
243
132
  return this._afterRunAction;
@@ -301,32 +190,20 @@ class ActionDescriptorInst {
301
190
  return this;
302
191
  }
303
192
  /**
304
- * creates confirmation action with default style based on action descriptor
193
+ * Creates confirmation action with default style based on action descriptor
305
194
  */
306
- withRunConfirmation() {
307
- this._runConfirmationDialogDescriptor = new ActionConfirmationDescriptor();
308
- this._runConfirmationDialogDescriptor.acceptButton.styleClass.withActionLevel(this._level);
309
- this._runConfirmationDialogDescriptor.rejectButton?.styleClass.withActionLevel(this._level);
310
- return this._runConfirmationDialogDescriptor;
195
+ withRunConfirmation(opts = true) {
196
+ this._runConfirmation = opts === true ? {} : opts === false ? undefined : opts;
197
+ return this;
311
198
  }
312
199
  /**
313
- * Add a configuration dialogue to action using ActionConfigurationDescriptor
314
- * @param runConfirmationDialogDescriptor descriptor with customizable information for dialog
200
+ * Override default notifications setup. Notifications can either be overridden with custom text or turned on/off.
201
+ *
202
+ * @param opts Provide config for texts or on/off flag for run success/error notifications.
315
203
  */
316
- withRunConfirmationDescriptor(runConfirmationDialogDescriptor) {
317
- this._runConfirmationDialogDescriptor = runConfirmationDialogDescriptor;
318
- return this;
319
- }
320
- withRunNotificationSuccess(title, message, hasNotification = true) {
321
- this._hasRunNotificationSuccess = hasNotification;
322
- this._runNotificationSuccessTitle = title;
323
- this._runNotificationSuccessMessage = message;
324
- return this;
325
- }
326
- withRunNotificationError(title, message, hasNotification = true) {
327
- this._hasRunNotificationError = hasNotification;
328
- this._runNotificationErrorTitle = title;
329
- this._runNotificationErrorMessage = message;
204
+ withNotifications(opts) {
205
+ this._runNotificationOnSuccess = typeof opts === 'boolean' ? opts : opts?.runOnSuccess;
206
+ this._runNotificationOnError = typeof opts === 'boolean' ? opts : opts?.runOnError;
330
207
  return this;
331
208
  }
332
209
  withAfterRunAction(action) {
@@ -348,12 +225,20 @@ class ActionDescriptorInst {
348
225
  this._tableviewCategory = category;
349
226
  return this;
350
227
  }
351
- withButtonDescriptor(button) {
228
+ withButtonOpts(button) {
352
229
  this._button = button;
353
230
  return this;
354
231
  }
355
- withButton(label, icon = null, styleLevel = StyleLevelEnum.Default, styleText = false) {
356
- this._button = new ActionButtonDescriptor().withLabel(label).withIcon(icon).withStyleClass(new ButtonStyleBuilder(styleLevel).withTextButton(styleText));
232
+ withButton(label, icon = null, level = StyleLevelEnum.Default) {
233
+ this._button = {
234
+ ...this._button,
235
+ label,
236
+ icon,
237
+ style: {
238
+ ...this._button?.style,
239
+ level: level
240
+ }
241
+ };
357
242
  return this;
358
243
  }
359
244
  withItemsSelection(hasSelection = true) {
@@ -404,13 +289,17 @@ class ActionDescriptorInst {
404
289
  descriptor._runFunction = this._runFunction;
405
290
  descriptor._isVisibleFunction = this._isVisibleFunction;
406
291
  descriptor._isEnabledFunction = this._isEnabledFunction;
407
- descriptor._runConfirmationDialogDescriptor = this._runConfirmationDialogDescriptor?.copy();
408
- descriptor._hasRunNotificationSuccess = this._hasRunNotificationSuccess;
409
- descriptor._runNotificationSuccessTitle = this._runNotificationSuccessTitle;
410
- descriptor._runNotificationSuccessMessage = this._runNotificationSuccessMessage;
411
- descriptor._hasRunNotificationError = this._hasRunNotificationError;
412
- descriptor._runNotificationErrorTitle = this._runNotificationErrorTitle;
413
- descriptor._runNotificationErrorMessage = this._runNotificationErrorMessage;
292
+ if (this._runConfirmation) {
293
+ descriptor._runConfirmation = { ...this._runConfirmation };
294
+ if (this._runConfirmation.acceptButton) {
295
+ descriptor._runConfirmation.acceptButton = { ...this._runConfirmation.acceptButton };
296
+ }
297
+ if (this._runConfirmation.rejectButton) {
298
+ descriptor._runConfirmation.rejectButton = { ...this._runConfirmation.rejectButton };
299
+ }
300
+ }
301
+ descriptor._runNotificationOnSuccess = typeof this._runNotificationOnSuccess === 'object' ? { ...this._runNotificationOnSuccess } : this._runNotificationOnSuccess;
302
+ descriptor._runNotificationOnError = typeof this._runNotificationOnError === 'object' ? { ...this._runNotificationOnError } : this._runNotificationOnError;
414
303
  if (this._afterRunAction != null) {
415
304
  descriptor._afterRunAction = typeof this._afterRunAction === 'function' ? this._afterRunAction : this._afterRunAction.copy();
416
305
  }
@@ -418,7 +307,16 @@ class ActionDescriptorInst {
418
307
  descriptor._onRunErrorAction = typeof this._onRunErrorAction === 'function' ? this._onRunErrorAction : this._onRunErrorAction.copy();
419
308
  }
420
309
  descriptor._permissions = this._permissions;
421
- descriptor._button = this._button.copy();
310
+ if (this._button) {
311
+ descriptor._button = {
312
+ ...this._button
313
+ };
314
+ if (this._button.style) {
315
+ descriptor._button.style = {
316
+ ...this._button.style
317
+ };
318
+ }
319
+ }
422
320
  descriptor._hasItemsSelection = this._hasItemsSelection;
423
321
  descriptor._component = this._component;
424
322
  descriptor._componentFromDi = this._componentFromDi;
@@ -580,14 +478,13 @@ class EditorDataProviderInst extends DataProviderInst {
580
478
  class ActionEditorDescriptorInst extends ActionDescriptorInst {
581
479
  constructor(editorDescriptor, actionName, cfg) {
582
480
  super(actionName, {
583
- model: cfg?.model ?? editorDescriptor.model,
584
- ...cfg
481
+ ...cfg,
482
+ model: cfg?.model ?? editorDescriptor.model
585
483
  });
586
484
  this._dataProvider = undefined;
587
485
  this._editorActions = [];
588
486
  this._editorTitle = undefined;
589
487
  this._editorTitleParams = undefined;
590
- this._hasFetchNotificationSuccess = false;
591
488
  this._dialogSize = StyleSizeEnum.Normal;
592
489
  this._resubmitRefetch = true;
593
490
  this._unsavedChangesConfirmation = false;
@@ -616,14 +513,11 @@ class ActionEditorDescriptorInst extends ActionDescriptorInst {
616
513
  get dialogClassName() {
617
514
  return this._dialogClassName;
618
515
  }
619
- get hasFetchNotificationSuccess() {
620
- return this._hasFetchNotificationSuccess;
516
+ get fetchNotificationOnSuccess() {
517
+ return this._fetchNotificationOnSuccess;
621
518
  }
622
- get fetchNotificationSuccessTitle() {
623
- return this._fetchNotificationSuccessTitle;
624
- }
625
- get fetchNotificationSuccessMessage() {
626
- return this._fetchNotificationSuccessMessage;
519
+ get fetchNotificationOnError() {
520
+ return this._fetchNotificationOnError;
627
521
  }
628
522
  get dataProvider() {
629
523
  return this._dataProvider;
@@ -685,10 +579,20 @@ class ActionEditorDescriptorInst extends ActionDescriptorInst {
685
579
  this._submitFunction = fn;
686
580
  return this;
687
581
  }
688
- withFetchNotificationError(title, message, hasNotification = true) {
689
- this._hasFetchNotificationSuccess = hasNotification;
690
- this._fetchNotificationSuccessTitle = title;
691
- this._fetchNotificationSuccessMessage = message;
582
+ /**
583
+ * Override default notifications setup. Notifications can either be overridden with custom text or turned on/off.
584
+ *
585
+ * @param opts Provide config for texts or on/off flag for submit (is same as run) or fetch success/error notifications.
586
+ */
587
+ withNotifications(opts) {
588
+ super.withNotifications(typeof opts === 'boolean'
589
+ ? opts
590
+ : {
591
+ runOnSuccess: opts?.submitOnSuccess ?? opts?.runOnSuccess,
592
+ runOnError: opts?.submitOnError ?? opts?.runOnError
593
+ });
594
+ this._fetchNotificationOnSuccess = typeof opts === 'boolean' ? opts : opts?.fetchOnSuccess;
595
+ this._fetchNotificationOnError = typeof opts === 'boolean' ? opts : opts?.fetchOnError;
692
596
  return this;
693
597
  }
694
598
  withEditorAction(action) {
@@ -725,9 +629,8 @@ class ActionEditorDescriptorInst extends ActionDescriptorInst {
725
629
  descriptor._editorActions = this._editorActions.map(a => a.copy());
726
630
  descriptor._editorTitle = this._editorTitle;
727
631
  descriptor._editorTitleParams = this._editorTitleParams != null ? { ...this._editorTitleParams } : undefined;
728
- descriptor._hasFetchNotificationSuccess = this._hasFetchNotificationSuccess;
729
- descriptor._fetchNotificationSuccessTitle = this._fetchNotificationSuccessTitle;
730
- descriptor._fetchNotificationSuccessMessage = this._fetchNotificationSuccessMessage;
632
+ descriptor._fetchNotificationOnSuccess = typeof this._fetchNotificationOnSuccess === 'object' ? { ...this._fetchNotificationOnSuccess } : this._fetchNotificationOnSuccess;
633
+ descriptor._fetchNotificationOnError = typeof this._fetchNotificationOnError === 'object' ? { ...this._fetchNotificationOnError } : this._fetchNotificationOnError;
731
634
  descriptor._dialogSize = this._dialogSize;
732
635
  descriptor._dialogClassName = this._dialogClassName;
733
636
  descriptor._fetchFunction = this._fetchFunction;
@@ -771,7 +674,11 @@ class ActionEditorSubmitDescriptorInst extends ActionDescriptorInst {
771
674
  * @param submitType
772
675
  */
773
676
  function actionEditorSubmit(editorAction, submitType = ActionEditorSubmitTypeEnum.Submit) {
774
- return new ActionEditorSubmitDescriptorInst(editorAction.actionName, editorAction.model, submitType).withButtonDescriptor(new ActionButtonDescriptor().withStyleClass(new ButtonStyleBuilder().withActionLevel(editorAction.level)));
677
+ return new ActionEditorSubmitDescriptorInst(editorAction.actionName, editorAction.model, submitType).withButtonOpts({
678
+ style: {
679
+ level: editorAction.button?.style?.level
680
+ }
681
+ });
775
682
  }
776
683
  /**
777
684
  * creates secondary button with text button style
@@ -779,7 +686,12 @@ function actionEditorSubmit(editorAction, submitType = ActionEditorSubmitTypeEnu
779
686
  * @param submitType
780
687
  */
781
688
  function actionEditorCancel(editorAction, submitType = ActionEditorSubmitTypeEnum.Cancel) {
782
- return new ActionEditorSubmitDescriptorInst(editorAction.actionName, editorAction.model, submitType).withButtonDescriptor(new ActionButtonDescriptor().withStyleClass(new ButtonStyleBuilder().withTextButton().withActionLevel(editorAction.level)));
689
+ return new ActionEditorSubmitDescriptorInst(editorAction.actionName, editorAction.model, submitType).withButtonOpts({
690
+ style: {
691
+ textButton: true,
692
+ level: editorAction.button?.style?.level
693
+ }
694
+ });
783
695
  }
784
696
 
785
697
  const actionEditorGetProviderCfgObj = (serviceOrDataProvider) => {
@@ -906,9 +818,9 @@ function actionLink(actionName, opts) {
906
818
  function actionLinkFromAction(action) {
907
819
  const descriptor = new ActionLinkDescriptorInst(action.actionName, { model: action.model });
908
820
  action.copyFieldsTo(descriptor);
909
- descriptor.withRunConfirmationDescriptor();
910
- descriptor.withRunNotificationSuccess(undefined, undefined, false);
911
- descriptor.withRunNotificationError(undefined, undefined, false);
821
+ // disable confirmation and notifications
822
+ descriptor.withRunConfirmation(false);
823
+ descriptor.withNotifications(false);
912
824
  descriptor.withAfterRunAction();
913
825
  descriptor.withOnRunErrorAction();
914
826
  descriptor.withSubactionsAsMenu(false);
@@ -1673,7 +1585,6 @@ class AFieldDescriptor extends AGenericFieldDescriptor {
1673
1585
  class FieldActionDescriptor extends AFieldDescriptor {
1674
1586
  constructor(property) {
1675
1587
  super(property);
1676
- this._button = new ActionButtonDescriptor();
1677
1588
  this._wrappers = ['field'];
1678
1589
  this._fieldActionName = property;
1679
1590
  }
@@ -1686,12 +1597,20 @@ class FieldActionDescriptor extends AFieldDescriptor {
1686
1597
  get wrappers() {
1687
1598
  return this._wrappers;
1688
1599
  }
1689
- withButtonDescriptor(button) {
1690
- this._button = button;
1600
+ withButton(label, icon = null, level = StyleLevelEnum.Default) {
1601
+ this._button = {
1602
+ ...this._button,
1603
+ label,
1604
+ icon,
1605
+ style: {
1606
+ ...this._button?.style,
1607
+ level: level
1608
+ }
1609
+ };
1691
1610
  return this;
1692
1611
  }
1693
- withButton(label, icon = null, styleLevel = StyleLevelEnum.Default, styleText = false) {
1694
- this._button = new ActionButtonDescriptor().withLabel(label).withIcon(icon).withStyleClass(new ButtonStyleBuilder(styleLevel).withTextButton(styleText));
1612
+ withButtonOpts(button) {
1613
+ this._button = button;
1695
1614
  return this;
1696
1615
  }
1697
1616
  withRunFunction(fn) {
@@ -1705,7 +1624,7 @@ class FieldActionDescriptor extends AFieldDescriptor {
1705
1624
  copy() {
1706
1625
  const field = new FieldActionDescriptor(this._property);
1707
1626
  this.copyFieldsTo(field);
1708
- field._button = this._button.copy();
1627
+ field._button = { ...this._button, style: { ...this._button?.style } };
1709
1628
  field._runFunction = this._runFunction?.bind(field);
1710
1629
  field._wrappers = [...this._wrappers];
1711
1630
  return field;
@@ -3669,7 +3588,7 @@ function tableviewCreateDefaultAction(type, tableview, defaultActions, defaultAc
3669
3588
  switch (type) {
3670
3589
  // table row actions
3671
3590
  case TableviewDefaultActionsEnum.Details:
3672
- return tableviewActionDetailsOnTable(tableview.detailsEditor, { injector });
3591
+ return tableviewActionDetailsOnTable(tableview.model, tableview.detailsEditor, { injector });
3673
3592
  case TableviewDefaultActionsEnum.Edit:
3674
3593
  return tableviewActionEditOnTable(tableview.model, tableview.editEditor, { table: tableview.table, injector });
3675
3594
  case TableviewDefaultActionsEnum.Delete:
@@ -3706,15 +3625,15 @@ function getRouteData(injector) {
3706
3625
  }
3707
3626
  const tableviewActionEditorDetailsActionName = 'details';
3708
3627
  const tableviewActionEditorDetailsRoute = ':itemId';
3709
- function tableviewActionDetailsOnTable(descriptor, opts) {
3628
+ function tableviewActionDetailsOnTable(model, descriptor, opts) {
3710
3629
  const routeData = getRouteData(opts?.injector);
3711
3630
  if (!routeData?.tableviewActions || routeData.tableviewActions.hasDetails) {
3712
3631
  const action = new ActionEditorDescriptorInst(descriptor, tableviewActionEditorDetailsActionName, {
3713
3632
  ...(opts?.serviceProvider ? actionEditorGetProviderCfgObj(opts?.serviceProvider) : {}),
3714
- isTableviewMainEditor: true
3633
+ isTableviewMainEditor: true,
3634
+ model: model
3715
3635
  });
3716
3636
  action.withPosition(opts?.position ?? ActionPositionEnum.RowClick);
3717
- action.withPosition(ActionPositionEnum.RowClick);
3718
3637
  action.withRouteTrigger(tableviewActionEditorDetailsRoute);
3719
3638
  action.withEditorActions([actionEditorCancel(action)]);
3720
3639
  action.withTableviewCategory(TableviewActionDefaultCategories.DETAILS);
@@ -3732,9 +3651,12 @@ function tableviewActionAddOnTable(model, descriptor, opts) {
3732
3651
  isTableviewMainEditor: true,
3733
3652
  model: model
3734
3653
  });
3735
- action.withPosition(opts?.position ?? ActionPositionEnum.ToolbarLeft);
3736
- action.withRouteTrigger(tableviewActionEditorAddRoute);
3737
- action.button.withIcon('pi pi-plus');
3654
+ action
3655
+ .withPosition(opts?.position ?? ActionPositionEnum.ToolbarLeft)
3656
+ .withRouteTrigger(tableviewActionEditorAddRoute)
3657
+ .withButtonOpts({
3658
+ icon: 'pi pi-plus'
3659
+ });
3738
3660
  action.withTableviewCategory(TableviewActionDefaultCategories.ADD);
3739
3661
  action.withUnsavedChangesConfirmation();
3740
3662
  return action;
@@ -3751,12 +3673,18 @@ function tableviewActionEditOnTable(model, descriptor, opts) {
3751
3673
  isTableviewMainEditor: true,
3752
3674
  model: model
3753
3675
  });
3754
- action.withPosition(opts?.position ?? ActionPositionEnum.RowInline);
3755
- action.button.styleClass.withSize(StyleSizeEnum.Small);
3756
- action.withRouteTrigger(tableviewActionEditorEditRoute);
3757
- action.withTableviewCategory(TableviewActionDefaultCategories.EDIT);
3758
- action.button.withLabel(null).withIcon('pi pi-pencil');
3759
- action.withUnsavedChangesConfirmation();
3676
+ action
3677
+ .withPosition(opts?.position ?? ActionPositionEnum.RowInline)
3678
+ .withButtonOpts({
3679
+ label: null,
3680
+ icon: 'pi pi-pencil',
3681
+ style: {
3682
+ size: StyleSizeEnum.Small
3683
+ }
3684
+ })
3685
+ .withRouteTrigger(tableviewActionEditorEditRoute)
3686
+ .withTableviewCategory(TableviewActionDefaultCategories.EDIT)
3687
+ .withUnsavedChangesConfirmation();
3760
3688
  return action;
3761
3689
  }
3762
3690
  return null;
@@ -3772,25 +3700,34 @@ function tableviewActionEditOnDetails(model, opts) {
3772
3700
  .withPositionTableviewCategories([TableviewActionDefaultCategories.DETAILS])
3773
3701
  .withPosition(opts?.position ?? ActionPositionEnum.FooterLeft)
3774
3702
  .withRouterLink('./edit')
3775
- .withQueryParams({}, 'merge');
3776
- linkAction.button.styleClass.withActionLevel(StyleLevelEnum.Secondary);
3777
- linkAction.button.styleClass.withSize(StyleSizeEnum.Normal);
3778
- linkAction.button.styleClass.withRoundedButton(ButtonStyleRoundedEnum.DEFAULT);
3779
- linkAction.button.withLabel();
3780
- linkAction.button.withIcon('pi pi-pencil');
3703
+ .withQueryParams({}, 'merge')
3704
+ .withButtonOpts({
3705
+ icon: 'pi pi-pencil',
3706
+ style: {
3707
+ level: StyleLevelEnum.Secondary
3708
+ }
3709
+ });
3781
3710
  return linkAction;
3782
3711
  }
3783
3712
  const tableviewActionDeleteActionName = 'delete';
3784
3713
  function tableviewActionDeleteOnTable(model, opts) {
3785
3714
  const routeData = getRouteData(opts?.injector);
3786
3715
  if (!routeData?.tableviewActions || routeData.tableviewActions.hasDelete) {
3787
- const action = new ActionDescriptorInst(tableviewActionDeleteActionName, opts?.serviceProvider ? actionGetProviderCfgObj(opts.serviceProvider) : {});
3788
- action.withPosition(opts?.position ?? ActionPositionEnum.RowInline);
3789
- action.button.styleClass.withSize(StyleSizeEnum.Small);
3790
- action.button.styleClass.withActionLevel(StyleLevelEnum.Danger);
3791
- action.withRunConfirmation();
3792
- action.withTableviewCategory(TableviewActionDefaultCategories.DELETE);
3793
- action.button.withLabel(null).withIcon('pi pi-trash');
3716
+ const action = new ActionDescriptorInst(tableviewActionDeleteActionName, {
3717
+ ...(opts?.serviceProvider ? actionGetProviderCfgObj(opts.serviceProvider) : {}),
3718
+ model: model
3719
+ })
3720
+ .withButtonOpts({
3721
+ label: null,
3722
+ icon: 'pi pi-trash',
3723
+ style: {
3724
+ size: StyleSizeEnum.Small,
3725
+ level: StyleLevelEnum.Danger
3726
+ }
3727
+ })
3728
+ .withPosition(opts?.position ?? ActionPositionEnum.RowInline)
3729
+ .withRunConfirmation()
3730
+ .withTableviewCategory(TableviewActionDefaultCategories.DELETE);
3794
3731
  return action;
3795
3732
  }
3796
3733
  return null;
@@ -3808,9 +3745,15 @@ function tableviewActionDeleteOnDetails(model, opts) {
3808
3745
  ctx.viewContainer?.reloadTable({});
3809
3746
  ctx.viewContainer?.closeEditor();
3810
3747
  }))
3811
- : null);
3812
- action.button.withLabel(undefined);
3813
- action.button.styleClass.withSize(StyleSizeEnum.Normal);
3748
+ : null)
3749
+ .withButtonOpts({
3750
+ ...action.button,
3751
+ label: undefined,
3752
+ style: {
3753
+ ...action.button?.style,
3754
+ size: StyleSizeEnum.Normal
3755
+ }
3756
+ });
3814
3757
  return action;
3815
3758
  }
3816
3759
  return null;
@@ -3819,7 +3762,7 @@ function tableviewActionExportOnTable(descriptor, opts) {
3819
3762
  const exportAction = new ActionDescriptorInst('export', {
3820
3763
  model: descriptor.model
3821
3764
  })
3822
- .withButtonDescriptor(new ActionButtonDescriptor().withIcon('pi pi-download'))
3765
+ .withButton(undefined, 'pi pi-download')
3823
3766
  .withSubactionsAsMenu();
3824
3767
  const subactions = [];
3825
3768
  if (opts?.defaultActions == null || opts?.defaultActions.includes(TableviewDefaultActionsEnum.ExportJson))
@@ -3849,7 +3792,8 @@ function tableviewActionExportJsonOnTable(descriptor, opts) {
3849
3792
  }))
3850
3793
  : ctx.parameters.item;
3851
3794
  })
3852
- .withButtonDescriptor(new ActionButtonDescriptor().withIcon('pi pi-code'))
3795
+ .withNotifications({ runOnSuccess: false })
3796
+ .withButton(undefined, 'pi pi-code')
3853
3797
  .withPosition(opts?.position ?? ActionPositionEnum.ToolbarRight);
3854
3798
  }
3855
3799
  function tableviewActionExportCsvOnTable(descriptor, opts) {
@@ -3876,7 +3820,8 @@ function tableviewActionExportCsvOnTable(descriptor, opts) {
3876
3820
  }))
3877
3821
  : ctx.parameters.item;
3878
3822
  })
3879
- .withButtonDescriptor(new ActionButtonDescriptor().withIcon('pi pi-file'))
3823
+ .withNotifications({ runOnSuccess: false })
3824
+ .withButton(undefined, 'pi pi-file')
3880
3825
  .withPosition(opts?.position ?? ActionPositionEnum.ToolbarRight);
3881
3826
  }
3882
3827
  function tableviewActionRefreshOnTable(descriptor, opts) {
@@ -3885,13 +3830,18 @@ function tableviewActionRefreshOnTable(descriptor, opts) {
3885
3830
  })
3886
3831
  .withPosition(ActionPositionEnum.ToolbarRight)
3887
3832
  .withTableviewCategory(TableviewActionDefaultCategories.READ)
3888
- .withRunNotificationSuccess(undefined, undefined, false)
3833
+ .withNotifications({ runOnSuccess: false })
3889
3834
  .withRunFunction(ctx => {
3890
3835
  ctx.viewContainer?.reloadTable({});
3891
3836
  return of(null);
3892
3837
  })
3893
- .withPosition(opts?.position ?? ActionPositionEnum.ToolbarRight);
3894
- action.button.withIcon('pi pi-refresh').styleClass.withActionLevel(StyleLevelEnum.Secondary);
3838
+ .withPosition(opts?.position ?? ActionPositionEnum.ToolbarRight)
3839
+ .withButtonOpts({
3840
+ icon: 'pi pi-refresh',
3841
+ style: {
3842
+ level: StyleLevelEnum.Secondary
3843
+ }
3844
+ });
3895
3845
  return action;
3896
3846
  }
3897
3847
  function tableviewActionLocalizationLangSelectOnTable(descriptor, opts) {
@@ -4252,5 +4202,5 @@ function tableviewDataProviderFromDescriptor(descriptor, serviceType) {
4252
4202
  * Generated bundle index. Do not edit.
4253
4203
  */
4254
4204
 
4255
- export { AFieldDescriptor, AFieldGroupDescriptor, AFormlyCustomFieldComponent, AGenericFieldDescriptor, ActionActivationTriggerEnum, ActionConfirmationDescriptor, ActionDescriptorInst, ActionEditorDescriptorInst, ActionEditorSubmitDescriptorInst, ActionEditorSubmitTypeEnum, ActionInstanceStateEnum, ActionLinkDescriptorInst, ActionPositionEnum, ActionTypeEnum, CommonsActionError, DATA_LANGUAGE_DROPDOWN_COMPONENT_IT, DataProviderExecutor, DynamicTableviewDataProviderInst, EDITOR_DEFAULT_GROUP_NAME, EditorDataProviderInst, EditorDescriptorInst, EditorDescriptorNestedObjectWrapper, FieldActionDescriptor, FieldGroupDescriptor, FieldGroupTypeEnum, FieldInputDescriptor, FieldInputTypeEnum, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldManyEditorActionEnum, FieldManyEditorDescriptor, FieldManyEditorTypeEnum, FieldManyToManyEditorActionEnum, FieldManyToManyEditorDescriptor, FieldManyToManyEditorTypeEnum, FieldSizeEnum, FieldTabGroupDescriptor, FieldValidationDescriptor, FormEventTypeEnum, FormFieldEventComponentSubtype, FormFieldEventDialogSubtype, FormFieldEventTypeEnum, TableviewActionDefaultCategories, TableviewDataProviderInst, TableviewDefaultActionsEnum, TableviewDescriptorInst, TableviewDynamicDescriptorInt, TableviewEditorTypeEnum, TableviewInputBuilder, action, actionEditor, actionEditorCancel, actionEditorGetProviderCfgObj, actionEditorOnEditor, actionEditorOnTableRow, actionEditorOnTableTop, actionEditorSubmit, actionGetProviderCfgObj, actionLink, actionLinkFromAction, actionOnEditor, actionOnTableRow, actionOnTableTop, convertDataToStringWithDelimiter, editorDataProvider, editorDescriptor, fieldLookupGetProviderCfgObj, fieldManyToManyGetProviderCfgObj, getDataProviderService, runCreateFromDataProvider, runDeleteFromDataProvider, runFetchFromDataProvider, runFnFromDataProviderOrFail, runFnFromDataProviderOrFallback, runGetAllFromDataProvider, runUpdateFromDataProvider, saveFileAs, tableview, tableviewActionAddOnTable, tableviewActionDeleteActionName, tableviewActionDeleteOnDetails, tableviewActionDeleteOnTable, tableviewActionDetailsOnTable, tableviewActionEditOnDetails, tableviewActionEditOnTable, tableviewActionEditorAddActionName, tableviewActionEditorAddRoute, tableviewActionEditorDetailsActionName, tableviewActionEditorDetailsRoute, tableviewActionEditorEditActionName, tableviewActionEditorEditRoute, tableviewActionExportCsvOnTable, tableviewActionExportJsonOnTable, tableviewActionExportOnTable, tableviewActionLocalizationLangSelectOnTable, tableviewActionRefreshOnTable, tableviewCreateDefaultAction, tableviewCreateDefaultActions, tableviewDataProvider, tableviewDataProviderFromDescriptor, tableviewDescriptor, tableviewDescriptorMultiModel, tableviewDynamicDataProvider, tableviewDynamicDescriptor, tableviewGetDefaultActions, tableviewMultiModel };
4205
+ export { AFieldDescriptor, AFieldGroupDescriptor, AFormlyCustomFieldComponent, AGenericFieldDescriptor, ActionActivationTriggerEnum, ActionDescriptorInst, ActionEditorDescriptorInst, ActionEditorSubmitDescriptorInst, ActionEditorSubmitTypeEnum, ActionInstanceStateEnum, ActionLinkDescriptorInst, ActionPositionEnum, ActionTypeEnum, CommonsActionError, DATA_LANGUAGE_DROPDOWN_COMPONENT_IT, DataProviderExecutor, DynamicTableviewDataProviderInst, EDITOR_DEFAULT_GROUP_NAME, EditorDataProviderInst, EditorDescriptorInst, EditorDescriptorNestedObjectWrapper, FieldActionDescriptor, FieldGroupDescriptor, FieldGroupTypeEnum, FieldInputDescriptor, FieldInputTypeEnum, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldManyEditorActionEnum, FieldManyEditorDescriptor, FieldManyEditorTypeEnum, FieldManyToManyEditorActionEnum, FieldManyToManyEditorDescriptor, FieldManyToManyEditorTypeEnum, FieldSizeEnum, FieldTabGroupDescriptor, FieldValidationDescriptor, FormEventTypeEnum, FormFieldEventComponentSubtype, FormFieldEventDialogSubtype, FormFieldEventTypeEnum, TableviewActionDefaultCategories, TableviewDataProviderInst, TableviewDefaultActionsEnum, TableviewDescriptorInst, TableviewDynamicDescriptorInt, TableviewEditorTypeEnum, TableviewInputBuilder, action, actionEditor, actionEditorCancel, actionEditorGetProviderCfgObj, actionEditorOnEditor, actionEditorOnTableRow, actionEditorOnTableTop, actionEditorSubmit, actionGetProviderCfgObj, actionLink, actionLinkFromAction, actionOnEditor, actionOnTableRow, actionOnTableTop, convertDataToStringWithDelimiter, editorDataProvider, editorDescriptor, fieldLookupGetProviderCfgObj, fieldManyToManyGetProviderCfgObj, getDataProviderService, runCreateFromDataProvider, runDeleteFromDataProvider, runFetchFromDataProvider, runFnFromDataProviderOrFail, runFnFromDataProviderOrFallback, runGetAllFromDataProvider, runUpdateFromDataProvider, saveFileAs, tableview, tableviewActionAddOnTable, tableviewActionDeleteActionName, tableviewActionDeleteOnDetails, tableviewActionDeleteOnTable, tableviewActionDetailsOnTable, tableviewActionEditOnDetails, tableviewActionEditOnTable, tableviewActionEditorAddActionName, tableviewActionEditorAddRoute, tableviewActionEditorDetailsActionName, tableviewActionEditorDetailsRoute, tableviewActionEditorEditActionName, tableviewActionEditorEditRoute, tableviewActionExportCsvOnTable, tableviewActionExportJsonOnTable, tableviewActionExportOnTable, tableviewActionLocalizationLangSelectOnTable, tableviewActionRefreshOnTable, tableviewCreateDefaultAction, tableviewCreateDefaultActions, tableviewDataProvider, tableviewDataProviderFromDescriptor, tableviewDescriptor, tableviewDescriptorMultiModel, tableviewDynamicDataProvider, tableviewDynamicDescriptor, tableviewGetDefaultActions, tableviewMultiModel };
4256
4206
  //# sourceMappingURL=mediusinc-mng-commons-tableview-api.mjs.map