@mediusinc/mng-commons 3.0.0-rc.9 → 3.0.0

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 (29) hide show
  1. package/dev-scripts/version-info.js +13 -6
  2. package/esm2022/lib/components/form/formly/fields/formly-field-action/formly-field-action.component.mjs +22 -4
  3. package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +4 -4
  4. package/esm2022/lib/components/form/models/field-action-context.model.mjs +1 -1
  5. package/esm2022/lib/components/form/models/index.mjs +2 -1
  6. package/esm2022/lib/components/tableview/table/table.component.mjs +47 -50
  7. package/esm2022/lib/descriptors/editor/field.descriptor.mjs +13 -4
  8. package/esm2022/lib/models/version.model.mjs +1 -1
  9. package/esm2022/lib/pipes/json-path.pipe.mjs +3 -62
  10. package/esm2022/lib/services/action-executor.service.mjs +22 -12
  11. package/esm2022/lib/services/configuration.service.mjs +1 -1
  12. package/esm2022/lib/services/logger.service.mjs +2 -2
  13. package/esm2022/lib/services/version.service.mjs +1 -1
  14. package/esm2022/lib/utils/editor-formly.util.mjs +2 -1
  15. package/esm2022/lib/utils/object.util.mjs +50 -1
  16. package/fesm2022/mediusinc-mng-commons.mjs +153 -130
  17. package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
  18. package/lib/components/form/formly/fields/formly-field-action/formly-field-action.component.d.ts +3 -0
  19. package/lib/components/form/models/field-action-context.model.d.ts +7 -0
  20. package/lib/components/form/models/index.d.ts +1 -0
  21. package/lib/components/tableview/table/table.component.d.ts +1 -0
  22. package/lib/descriptors/editor/field.descriptor.d.ts +7 -5
  23. package/lib/models/version.model.d.ts +1 -1
  24. package/lib/pipes/json-path.pipe.d.ts +0 -1
  25. package/lib/utils/object.util.d.ts +1 -0
  26. package/package.json +4 -1
  27. package/scss/common/theme/designer/_components.scss +1 -1
  28. package/scss/mng-overrides/_theme_dialog.scss +7 -0
  29. package/scss/mng-overrides/_theme_tableview.scss +3 -0
@@ -1,5 +1,5 @@
1
1
  import * as i2$1 from '@angular/common';
2
- import { DatePipe, AsyncPipe, NgIf, NgForOf, NgSwitch, NgSwitchCase, NgSwitchDefault, DecimalPipe, CurrencyPipe, NgClass, NgStyle, NgTemplateOutlet, CommonModule } from '@angular/common';
2
+ import { DatePipe, AsyncPipe, NgIf, NgForOf, NgSwitch, NgSwitchCase, NgSwitchDefault, DecimalPipe, CurrencyPipe, NgClass, NgStyle, NgTemplateOutlet, JsonPipe, CommonModule } from '@angular/common';
3
3
  import * as i1$1 from '@angular/common/http';
4
4
  import { HttpErrorResponse, HttpClient, HttpClientModule, HttpParams } from '@angular/common/http';
5
5
  import * as i0 from '@angular/core';
@@ -82,11 +82,14 @@ import { PrimeNGConfig, FilterService, FilterMatchMode, ConfirmationService, Mes
82
82
  import * as i11 from 'primeng/menu';
83
83
  import { MenuModule } from 'primeng/menu';
84
84
  import { isObservable, throwError, BehaviorSubject, Subject, ReplaySubject, distinctUntilChanged, take, mergeMap, of, combineLatest, switchMap, from, timeout, tap, Observable, debounceTime, merge } from 'rxjs';
85
- import { filter, map, catchError, first, mergeMap as mergeMap$1, take as take$1, startWith } from 'rxjs/operators';
85
+ import { filter, map, startWith, catchError, first, mergeMap as mergeMap$1, take as take$1 } from 'rxjs/operators';
86
+ import { logger } from 'nx/src/utils/logger';
86
87
  import 'reflect-metadata';
87
88
  import { Title, DomSanitizer } from '@angular/platform-browser';
88
89
  import { ZIndexUtils } from 'primeng/utils';
89
90
  import { TimesIcon } from 'primeng/icons/times';
91
+ import * as i5$2 from 'primeng/message';
92
+ import { MessageModule } from 'primeng/message';
90
93
  import { trigger, state, style, transition, animate } from '@angular/animations';
91
94
 
92
95
  /**
@@ -1214,67 +1217,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
1214
1217
  * - Array notation (e.g.: [0])
1215
1218
  */
1216
1219
  class JsonPathPipe {
1217
- constructor() {
1218
- this.logger = MngLoggerService.get().create('JsonPathPipe');
1219
- }
1220
1220
  transform(value, path = '') {
1221
- if (path === '$') {
1222
- // only return the root
1223
- return value;
1224
- }
1225
- // Check for leading root object notation
1226
- if (path.startsWith('$')) {
1227
- path = path.substring(1);
1228
- }
1229
- // Check for leading .
1230
- if (path.startsWith('.')) {
1231
- path = path.substring(1);
1232
- }
1233
- if (path.indexOf('.') >= 0) {
1234
- const pathSplit = path.split('.');
1235
- let currValue = value;
1236
- for (const p of pathSplit) {
1237
- if (typeof currValue === 'undefined' || currValue === null) {
1238
- return currValue;
1239
- }
1240
- if (!p.length) {
1241
- // empty path, return current value
1242
- return currValue;
1243
- }
1244
- const leftBracketIdx = p.indexOf('[');
1245
- if (leftBracketIdx >= 0 && p.endsWith(']')) {
1246
- // should be reference to array
1247
- const arrayPath = p.substring(0, leftBracketIdx);
1248
- const arrayIdx = +p.substring(leftBracketIdx + 1, p.length - 1);
1249
- const array = currValue[arrayPath];
1250
- if (Array.isArray(array)) {
1251
- if (arrayIdx >= 0 && arrayIdx < array.length) {
1252
- // valid index, continue on the path
1253
- currValue = array[arrayIdx];
1254
- continue;
1255
- }
1256
- else {
1257
- this.logger?.warn(`Path ${path} array index at ${p} is not within valid array range`, value);
1258
- }
1259
- }
1260
- else {
1261
- this.logger?.warn(`Path ${path} array at ${p} is not a valid array`, value);
1262
- }
1263
- return undefined;
1264
- }
1265
- else if (typeof currValue === 'object') {
1266
- currValue = currValue[p];
1267
- }
1268
- else {
1269
- this.logger?.warn(`Path ${path} is not valid for object`, value);
1270
- return currValue;
1271
- }
1272
- }
1273
- return currValue;
1274
- }
1275
- else {
1276
- return value[path];
1277
- }
1221
+ return ObjectUtil.getPropertyByPath(value, path);
1278
1222
  }
1279
1223
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: JsonPathPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1280
1224
  static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: JsonPathPipe, isStandalone: true, name: "jsonPath" }); }
@@ -1666,7 +1610,7 @@ class MngLoggerService {
1666
1610
  else if (data?.length && data[0] instanceof Error) {
1667
1611
  // if first data is error, also consider as error
1668
1612
  logEntry.error = data[0];
1669
- data = data.splice(1);
1613
+ logEntry.data = data.splice(1);
1670
1614
  }
1671
1615
  this._log(logEntry);
1672
1616
  }
@@ -2442,10 +2386,11 @@ class MngActionExecutorService {
2442
2386
  .withActionData(ctx.parameters.actionData)
2443
2387
  .withRoute(ctx.parameters.route)
2444
2388
  .withSourceComponent(ctx.parameters.sourceComponent)
2445
- .withViewContainer(ctx.parameters.viewContainer), undefined, ctx.instance);
2389
+ .withViewContainer(ctx.parameters.viewContainer), undefined, ctx.instance, true);
2446
2390
  ctx.instance.nextActionInstance = nextActionInstance;
2447
2391
  // finish current action when next action finishes
2448
- return nextActionInstance.state$.pipe(filter(state => state >= ActionInstanceStateEnum.FinishSuccessFinal), map(() => {
2392
+ return nextActionInstance.state$.pipe(startWith(nextActionInstance.state), // provide first state cause it might be finished already
2393
+ filter(state => state >= ActionInstanceStateEnum.FinishSuccessFinal), take(1), map(() => {
2449
2394
  ctx.instance.state = ActionInstanceStateEnum.NextActionEnd;
2450
2395
  return runResult;
2451
2396
  }));
@@ -2470,6 +2415,9 @@ class MngActionExecutorService {
2470
2415
  ctx.instance.state = isMainRunFn ? ActionInstanceStateEnum.RunError : ActionInstanceStateEnum.FetchError;
2471
2416
  // mark execution error on context
2472
2417
  ctx.executionError(actionError);
2418
+ if (ctx.instance.action.hasRunNotificationError) {
2419
+ NotificationUtil.actionNotificationError(this.translate, ctx.instance.action, actionError, 'fetch', ctx.parameters.viewContainer, ctx.parameters.item);
2420
+ }
2473
2421
  let errorObs = of(void 0);
2474
2422
  if (isMainRunFn) {
2475
2423
  ctx.instance.error = err;
@@ -2481,14 +2429,10 @@ class MngActionExecutorService {
2481
2429
  .withActionData(ctx.parameters.actionData)
2482
2430
  .withRoute(ctx.parameters.route)
2483
2431
  .withSourceComponent(ctx.parameters.sourceComponent)
2484
- .withViewContainer(ctx.parameters.viewContainer));
2432
+ .withViewContainer(ctx.parameters.viewContainer), undefined, undefined, true);
2485
2433
  ctx.instance.errorActionInstance = errorActionInstance;
2486
- errorObs = errorActionInstance.state$.pipe(filter(state => state >= ActionInstanceStateEnum.FinishSuccessFinal), map(() => void 0));
2487
- }
2488
- }
2489
- else {
2490
- if (ctx.instance.action.hasRunNotificationError) {
2491
- NotificationUtil.actionNotificationError(this.translate, ctx.instance.action, actionError, 'fetch', ctx.parameters.viewContainer, ctx.parameters.item);
2434
+ errorObs = errorActionInstance.state$.pipe(startWith(errorActionInstance.state), // provide first state cause it might be finished already
2435
+ filter(state => state >= ActionInstanceStateEnum.FinishSuccessFinal), take(1), map(() => void 0));
2492
2436
  }
2493
2437
  }
2494
2438
  // list and map only to mark instance state as finished error state
@@ -2742,7 +2686,7 @@ class MngActionExecutorService {
2742
2686
  finishAction(instance, onDestroy = false) {
2743
2687
  instance = this.getOrCreateInstance(instance);
2744
2688
  if (instance.state >= ActionInstanceStateEnum.FinishSuccessFinal) {
2745
- this.logger.debug(`ActionInstance ${instance.instanceLongName} already finished`);
2689
+ this.logger.trace(`ActionInstance ${instance.instanceLongName} already finished`);
2746
2690
  return;
2747
2691
  }
2748
2692
  let finalState;
@@ -2789,6 +2733,15 @@ class MngActionExecutorService {
2789
2733
  instance.context?.parameters.viewContainer?.setActionRouteTriggeredInstance?.(newInstance);
2790
2734
  instance.reactivationInstance = newInstance;
2791
2735
  }
2736
+ // finish related actions
2737
+ if (instance.nextActionInstance) {
2738
+ logger.debug(`Finishing instance ${instance.instanceLongName} related next action instance: ${instance.nextActionInstance.instanceLongName}`);
2739
+ this.finishAction(instance.nextActionInstance, onDestroy);
2740
+ }
2741
+ if (instance.errorActionInstance) {
2742
+ logger.debug(`Finishing instance ${instance.instanceLongName} related error action instance: ${instance.errorActionInstance.instanceLongName}`);
2743
+ this.finishAction(instance.errorActionInstance, onDestroy);
2744
+ }
2792
2745
  }
2793
2746
  /**
2794
2747
  * Triggers action with parameters.
@@ -6903,7 +6856,7 @@ class FieldInputDescriptor extends AFieldDescriptor {
6903
6856
  this._imageUrlInputHiddenOnDisabled = inputVisibleOnDisabled;
6904
6857
  return this;
6905
6858
  }
6906
- asCustomComponent(customComponent, useWrappers, componentInputs) {
6859
+ asCustomComponent(customComponent, wrappers = ['field'], componentInputs) {
6907
6860
  this._fieldType = FieldInputTypeEnum.Custom;
6908
6861
  if (typeof customComponent === 'string') {
6909
6862
  this._customComponentName = customComponent;
@@ -6912,8 +6865,8 @@ class FieldInputDescriptor extends AFieldDescriptor {
6912
6865
  this._customComponentType = customComponent;
6913
6866
  this._customComponentInputs = componentInputs;
6914
6867
  }
6915
- if (useWrappers) {
6916
- this._customComponentWrappers = useWrappers;
6868
+ if (wrappers) {
6869
+ this._customComponentWrappers = wrappers;
6917
6870
  }
6918
6871
  return this;
6919
6872
  }
@@ -6996,6 +6949,7 @@ class FieldActionDescriptor extends AFieldDescriptor {
6996
6949
  constructor(editor, property) {
6997
6950
  super(editor, property);
6998
6951
  this._button = new ActionButtonDescriptor();
6952
+ this._wrappers = ['field'];
6999
6953
  this._fieldActionName = property;
7000
6954
  let displayName = property;
7001
6955
  if (this._editor.model)
@@ -7008,6 +6962,9 @@ class FieldActionDescriptor extends AFieldDescriptor {
7008
6962
  get runFunction() {
7009
6963
  return this._runFunction;
7010
6964
  }
6965
+ get wrappers() {
6966
+ return this._wrappers;
6967
+ }
7011
6968
  withButtonDescriptor(button) {
7012
6969
  this._button = button;
7013
6970
  return this;
@@ -7020,11 +6977,16 @@ class FieldActionDescriptor extends AFieldDescriptor {
7020
6977
  this._runFunction = fn;
7021
6978
  return this;
7022
6979
  }
6980
+ withWrappers(wrappers) {
6981
+ this._wrappers = wrappers;
6982
+ return this;
6983
+ }
7023
6984
  copy() {
7024
6985
  const field = new FieldActionDescriptor(this._editor, this._property);
7025
6986
  this.copyFieldsTo(field);
7026
6987
  field._button = this._button.copy();
7027
6988
  field._runFunction = this._runFunction?.bind(field);
6989
+ field._wrappers = [...this._wrappers];
7028
6990
  return field;
7029
6991
  }
7030
6992
  }
@@ -7928,6 +7890,7 @@ class EditorFormlyUtil {
7928
7890
  }
7929
7891
  else if (descriptor instanceof FieldActionDescriptor) {
7930
7892
  field.type = 'action';
7893
+ field.wrappers = descriptor.wrappers;
7931
7894
  delete field.key;
7932
7895
  }
7933
7896
  else if (descriptor instanceof FieldLookupEnumDescriptor) {
@@ -8215,6 +8178,55 @@ class ObjectUtil {
8215
8178
  }
8216
8179
  return Array.from(getterSet);
8217
8180
  }
8181
+ static getPropertyByPath(value, path) {
8182
+ if (path === '$') {
8183
+ // only return the root
8184
+ return value;
8185
+ }
8186
+ // Check for leading root object notation
8187
+ if (path.startsWith('$')) {
8188
+ path = path.substring(1);
8189
+ }
8190
+ // Check for leading .
8191
+ if (path.startsWith('.')) {
8192
+ path = path.substring(1);
8193
+ }
8194
+ if (path.indexOf('.') >= 0) {
8195
+ const pathSplit = path.split('.');
8196
+ let currValue = value;
8197
+ for (const p of pathSplit) {
8198
+ if (typeof currValue === 'undefined' || currValue === null) {
8199
+ return currValue;
8200
+ }
8201
+ if (!p.length) {
8202
+ // empty path, return current value
8203
+ return currValue;
8204
+ }
8205
+ const leftBracketIdx = p.indexOf('[');
8206
+ if (leftBracketIdx >= 0 && p.endsWith(']')) {
8207
+ // should be reference to array
8208
+ const arrayPath = p.substring(0, leftBracketIdx);
8209
+ const arrayIdx = +p.substring(leftBracketIdx + 1, p.length - 1);
8210
+ const array = currValue[arrayPath];
8211
+ if (Array.isArray(array)) {
8212
+ if (arrayIdx >= 0 && arrayIdx < array.length) {
8213
+ // valid index, continue on the path
8214
+ currValue = array[arrayIdx];
8215
+ continue;
8216
+ }
8217
+ }
8218
+ return undefined;
8219
+ }
8220
+ else if (typeof currValue === 'object') {
8221
+ currValue = currValue[p];
8222
+ }
8223
+ }
8224
+ return currValue;
8225
+ }
8226
+ else {
8227
+ return value[path];
8228
+ }
8229
+ }
8218
8230
  }
8219
8231
 
8220
8232
  class StringUtil {
@@ -12537,52 +12549,11 @@ class MngTableComponent {
12537
12549
  // Used for configs within this method and is not dynamically set by TableDynamicDescriptor
12538
12550
  const baseConfigDescriptor = this.initialDescriptor;
12539
12551
  if (!(this.initialDescriptor instanceof TableDynamicDescriptor)) {
12540
- this.descriptor = this.initialDescriptor;
12552
+ this.setMainAndRelatedDescriptors(this.initialDescriptor);
12541
12553
  }
12542
12554
  // map row settings
12543
- this.filterDescriptors = this.descriptor?.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor) ?? [];
12544
- this.hasColumnFilters = this.filterDescriptors.length > 0;
12545
12555
  this.rows = baseConfigDescriptor?.defaultNumRows ?? 25;
12546
12556
  this.rowsPerPageOptions = baseConfigDescriptor?.rowsPerPageOptions ?? [25, 50, 100];
12547
- // get layout preferences if they exist
12548
- if (this.descriptor?.model.typeName) {
12549
- this.localstorageKey = TableviewUtil.generateTableLayoutPrefsKey(this.descriptor?.model.typeName, this.router.url, this.descriptor?.dataKey);
12550
- const preferences = this.localStorageService.getItem(this.cmpTypeName, this.localstorageKey);
12551
- if (preferences && typeof preferences === 'object') {
12552
- if (preferences.columnWidths) {
12553
- this.layoutPreferences.columnWidths = preferences.columnWidths;
12554
- }
12555
- if (preferences.columnOrder && Array.isArray(preferences.columnOrder) && preferences.columnOrder.every((el) => typeof el === 'string')) {
12556
- this.layoutPreferences.columnOrder = preferences.columnOrder;
12557
- }
12558
- if (preferences.columnVisibility && Array.isArray(preferences.columnVisibility) && preferences.columnVisibility.every((el) => typeof el === 'string')) {
12559
- this.layoutPreferences.columnVisibility = preferences.columnVisibility;
12560
- }
12561
- }
12562
- }
12563
- // initialize columns with additional properties
12564
- if (this.descriptor?.columns) {
12565
- this.areColumnsReorderable = this.descriptor.columns.some(value => value.isReorderable);
12566
- this.areColumnsToggleable = this.descriptor.columns.some(value => value.isToggleable);
12567
- this.columns = this.descriptor.columns.map(col => ({
12568
- descriptor: col,
12569
- disabled: !col.isToggleable,
12570
- isVisible: this.layoutPreferences.columnVisibility ? this.layoutPreferences.columnVisibility.includes(col.property) : col.isVisible,
12571
- width: this.layoutPreferences.columnWidths?.[col.property]
12572
- }));
12573
- if (this.layoutPreferences.columnOrder) {
12574
- const newColumnOrder = [];
12575
- for (const colName of this.layoutPreferences.columnOrder) {
12576
- const foundCol = this.columns.find(el => el.descriptor.property === colName);
12577
- if (foundCol) {
12578
- newColumnOrder.push(foundCol);
12579
- }
12580
- }
12581
- if (newColumnOrder.length === this.columns.length)
12582
- this.columns = newColumnOrder;
12583
- }
12584
- this.visibleColumns = this.columns.filter(el => el.isVisible);
12585
- }
12586
12557
  // process actions
12587
12558
  for (const action of this.actions) {
12588
12559
  switch (action.position) {
@@ -12845,13 +12816,7 @@ class MngTableComponent {
12845
12816
  .subscribe({
12846
12817
  next: res => {
12847
12818
  if (this.initialDescriptor instanceof TableDynamicDescriptor) {
12848
- this.descriptor = this.initialDescriptor.toTableDescriptorFromData(res);
12849
- this.filterDescriptors = this.descriptor.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor);
12850
- this.hasColumnFilters = this.filterDescriptors.length > 0;
12851
- this.isPagination = this.descriptor.paginationMode === TablePaginationModeEnum.Pagination;
12852
- this.infiniteScroll = this.descriptor.paginationMode === TablePaginationModeEnum.InfiniteScroll;
12853
- this.rows = this.initialDescriptor.defaultNumRows;
12854
- this.rowsPerPageOptions = this.initialDescriptor.rowsPerPageOptions;
12819
+ this.setMainAndRelatedDescriptors(this.initialDescriptor.toTableDescriptorFromData(res));
12855
12820
  }
12856
12821
  if (this.infiniteScroll) {
12857
12822
  if (this.isFilterChanged || this.isSortChanged) {
@@ -12897,6 +12862,50 @@ class MngTableComponent {
12897
12862
  this.useQueryParamsInitializedSubejct.next(true);
12898
12863
  this.loadTableWithDataProvider(mediusQueryParam);
12899
12864
  }
12865
+ setMainAndRelatedDescriptors(descriptor) {
12866
+ this.descriptor = descriptor;
12867
+ this.filterDescriptors = this.descriptor?.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor) ?? [];
12868
+ this.hasColumnFilters = this.filterDescriptors.length > 0;
12869
+ // get layout preferences if they exist
12870
+ if (this.descriptor?.model.typeName) {
12871
+ this.localstorageKey = TableviewUtil.generateTableLayoutPrefsKey(this.descriptor?.model.typeName, this.router.url, this.descriptor?.dataKey);
12872
+ const preferences = this.localStorageService.getItem(this.cmpTypeName, this.localstorageKey);
12873
+ if (preferences && typeof preferences === 'object') {
12874
+ if (preferences.columnWidths) {
12875
+ this.layoutPreferences.columnWidths = preferences.columnWidths;
12876
+ }
12877
+ if (preferences.columnOrder && Array.isArray(preferences.columnOrder) && preferences.columnOrder.every((el) => typeof el === 'string')) {
12878
+ this.layoutPreferences.columnOrder = preferences.columnOrder;
12879
+ }
12880
+ if (preferences.columnVisibility && Array.isArray(preferences.columnVisibility) && preferences.columnVisibility.every((el) => typeof el === 'string')) {
12881
+ this.layoutPreferences.columnVisibility = preferences.columnVisibility;
12882
+ }
12883
+ }
12884
+ }
12885
+ // initialize columns with additional properties
12886
+ if (this.descriptor?.columns) {
12887
+ this.areColumnsReorderable = this.descriptor.columns.some(value => value.isReorderable);
12888
+ this.areColumnsToggleable = this.descriptor.columns.some(value => value.isToggleable);
12889
+ this.columns = this.descriptor.columns.map(col => ({
12890
+ descriptor: col,
12891
+ disabled: !col.isToggleable,
12892
+ isVisible: this.layoutPreferences.columnVisibility ? this.layoutPreferences.columnVisibility.includes(col.property) : col.isVisible,
12893
+ width: this.layoutPreferences.columnWidths?.[col.property]
12894
+ }));
12895
+ if (this.layoutPreferences.columnOrder) {
12896
+ const newColumnOrder = [];
12897
+ for (const colName of this.layoutPreferences.columnOrder) {
12898
+ const foundCol = this.columns.find(el => el.descriptor.property === colName);
12899
+ if (foundCol) {
12900
+ newColumnOrder.push(foundCol);
12901
+ }
12902
+ }
12903
+ if (newColumnOrder.length === this.columns.length)
12904
+ this.columns = newColumnOrder;
12905
+ }
12906
+ this.visibleColumns = this.columns.filter(el => el.isVisible);
12907
+ }
12908
+ }
12900
12909
  updatePrimeSortAndFilter(mediusQueryParam) {
12901
12910
  this.multiSortMeta = this.createSortMeta(mediusQueryParam);
12902
12911
  this.filterMetadata = this.createFilterMeta(mediusQueryParam);
@@ -13944,7 +13953,7 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
13944
13953
  this.descriptor.lookupTableDescriptor.defaultSortProperty.forEach((p, idx) => queryParamBuilder.withSort(p, this.descriptor.lookupTableDescriptor.defaultSortAsc[idx]));
13945
13954
  }
13946
13955
  if (this.descriptor.hasLookupExcludeValues) {
13947
- const filterValues = this.formControl.value.map((i) => i[this.descriptor.excludeValueProperty]);
13956
+ const filterValues = this.formControl.value.map((i) => ObjectUtil.getPropertyByPath(i, this.descriptor.excludeValueProperty));
13948
13957
  queryParamBuilder.withFilter(this.descriptor.excludeFilterProperty, filterValues, undefined, MediusFilterMatchType.NotIn);
13949
13958
  }
13950
13959
  this.lookupDataProviderSubscription = this.descriptor.lookupTableDataProvider?.getAll(queryParamBuilder.build(), this.dialogDataProviderService).subscribe({
@@ -14005,7 +14014,7 @@ class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
14005
14014
  name: 'FormlyFieldTableDialogMultiselectComponentError'
14006
14015
  });
14007
14016
  }
14008
- value = value.filter((i) => i[compareProperty] !== item[compareProperty]);
14017
+ value = value.filter((i) => ObjectUtil.getPropertyByPath(i, compareProperty) !== ObjectUtil.getPropertyByPath(item, compareProperty));
14009
14018
  this.formControl.patchValue(value);
14010
14019
  this.formControl.markAsTouched();
14011
14020
  this.formControl.markAsDirty();
@@ -14064,7 +14073,8 @@ class MngFormlyFieldActionComponent extends FieldType {
14064
14073
  this.buttonClass = this.descriptor.button.styleClass.build();
14065
14074
  }
14066
14075
  onClick() {
14067
- this.descriptor.runFunction?.({
14076
+ this.actionMessage = undefined;
14077
+ const result = this.descriptor.runFunction?.({
14068
14078
  descriptor: this.descriptor,
14069
14079
  formEditorComponent: this.props.formEditorComponent,
14070
14080
  formly: {
@@ -14076,13 +14086,26 @@ class MngFormlyFieldActionComponent extends FieldType {
14076
14086
  props: this.props
14077
14087
  }
14078
14088
  });
14089
+ if (result) {
14090
+ if (isObservable(result)) {
14091
+ result.subscribe(res => this.processResult(res));
14092
+ }
14093
+ else {
14094
+ this.processResult(result);
14095
+ }
14096
+ }
14097
+ }
14098
+ processResult(res) {
14099
+ if (res.message) {
14100
+ this.actionMessage = res.message;
14101
+ }
14079
14102
  }
14080
14103
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngFormlyFieldActionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
14081
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngFormlyFieldActionComponent, isStandalone: true, selector: "mng-formly-field-action", usesInheritance: true, ngImport: i0, template: "<button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(descriptor.button.icon)\"\n [label]=\"$any(descriptor.button.label === null ? null : descriptor.button.label ?? props!.label) | translate\"\n [pTooltip]=\"$any(descriptor.button.tooltip) | translate\"\n [disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n [class]=\"buttonClass\"></button>\n", dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i6.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i6$1.Ripple, selector: "[pRipple]" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i4$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
14104
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.7", type: MngFormlyFieldActionComponent, isStandalone: true, selector: "mng-formly-field-action", usesInheritance: true, ngImport: i0, template: "<div class=\"flex\">\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(descriptor.button.icon)\"\n [label]=\"$any(descriptor.button.label === null ? null : descriptor.button.label ?? props!.label) | translate\"\n [pTooltip]=\"$any(descriptor.button.tooltip) | translate\"\n [disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n [class]=\"buttonClass + (actionMessage ? ' mr-2' : '')\"></button>\n <p-message *ngIf=\"actionMessage\" [text]=\"actionMessage!.content\" [severity]=\"actionMessage?.severity ?? 'success'\"></p-message>\n</div>\n", dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i6.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "ngmodule", type: RippleModule }, { kind: "directive", type: i6$1.Ripple, selector: "[pRipple]" }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i4$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i5$2.UIMessage, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
14082
14105
  }
14083
14106
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: MngFormlyFieldActionComponent, decorators: [{
14084
14107
  type: Component,
14085
- args: [{ standalone: true, selector: 'mng-formly-field-action', imports: [ButtonModule, RippleModule, TranslateModule, TooltipModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(descriptor.button.icon)\"\n [label]=\"$any(descriptor.button.label === null ? null : descriptor.button.label ?? props!.label) | translate\"\n [pTooltip]=\"$any(descriptor.button.tooltip) | translate\"\n [disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n [class]=\"buttonClass\"></button>\n" }]
14108
+ args: [{ standalone: true, selector: 'mng-formly-field-action', imports: [ButtonModule, RippleModule, TranslateModule, TooltipModule, JsonPipe, MessageModule, NgIf], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex\">\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(descriptor.button.icon)\"\n [label]=\"$any(descriptor.button.label === null ? null : descriptor.button.label ?? props!.label) | translate\"\n [pTooltip]=\"$any(descriptor.button.tooltip) | translate\"\n [disabled]=\"formControl.disabled\"\n (click)=\"onClick()\"\n [class]=\"buttonClass + (actionMessage ? ' mr-2' : '')\"></button>\n <p-message *ngIf=\"actionMessage\" [text]=\"actionMessage!.content\" [severity]=\"actionMessage?.severity ?? 'success'\"></p-message>\n</div>\n" }]
14086
14109
  }] });
14087
14110
 
14088
14111
  class MngFormlyFieldCustomComponent extends FieldType {