@acorex/platform 18.0.4 → 18.0.5

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 (70) hide show
  1. package/common/lib/data/dexie-storage.service.d.ts +0 -1
  2. package/common/lib/layout/grid-layout/grid-layout.types.d.ts +1 -2
  3. package/common/lib/schema/widgets/lookup/lookup-widget-filter.component.d.ts +1 -1
  4. package/common/lib/schema/widgets/lookup/lookup-widget-view.component.d.ts +2 -1
  5. package/common/lib/utils/data-generator.d.ts +13 -1
  6. package/common/lib/utils/index.d.ts +1 -0
  7. package/common/lib/utils/pdf.service.d.ts +25 -0
  8. package/esm2022/common/lib/data/dexie-storage.service.mjs +2 -4
  9. package/esm2022/common/lib/layout/grid-layout/grid-layout.directive.mjs +5 -5
  10. package/esm2022/common/lib/layout/grid-layout/grid-layout.types.mjs +1 -1
  11. package/esm2022/common/lib/schema/widgets/lookup/lookup-widget-edit.component.mjs +20 -3
  12. package/esm2022/common/lib/schema/widgets/lookup/lookup-widget-filter.component.mjs +20 -3
  13. package/esm2022/common/lib/schema/widgets/lookup/lookup-widget-view.component.mjs +5 -5
  14. package/esm2022/common/lib/utils/data-generator.mjs +67 -2
  15. package/esm2022/common/lib/utils/index.mjs +2 -1
  16. package/esm2022/common/lib/utils/pdf.service.mjs +85 -0
  17. package/esm2022/layout/entity/lib/entity-master-create.viewmodel.mjs +23 -19
  18. package/esm2022/layout/entity/lib/entity-master-list.viewmodel.mjs +27 -8
  19. package/esm2022/layout/entity/lib/entity-master-single.viewmodel.mjs +33 -28
  20. package/esm2022/layout/entity/lib/widgets/lookup-widget/lookup-widget-edit.component.mjs +22 -7
  21. package/esm2022/layout/entity/lib/widgets/lookup-widget/lookup-widget-selector.component.mjs +1 -2
  22. package/esm2022/layout/entity/lib/widgets/lookup-widget/lookup-widget-selector.viewmodel.mjs +15 -3
  23. package/esm2022/layout/entity/lib/workflows/create-entity.workflow.mjs +3 -4
  24. package/esm2022/layout/entity/lib/workflows/delete-entity.workflow.mjs +1 -4
  25. package/esm2022/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.mjs +4 -1
  26. package/esm2022/themes/default/lib/layouts/entity-layouts/entity-master-single-view/entity-master-single-view.component.mjs +6 -3
  27. package/esm2022/widgets/lib/editors/date-time-box-widget/date-time-box-widget-view.component.mjs +1 -2
  28. package/esm2022/widgets/lib/editors/rich-text-widget/rich-text-widget-edit.component.mjs +3 -3
  29. package/esm2022/widgets/lib/editors/rich-text-widget/rich-text-widget-view.component.mjs +14 -8
  30. package/esm2022/widgets/lib/editors/selection-list-widget/selection-list-widget-view.component.mjs +3 -2
  31. package/esm2022/widgets/lib/editors/signature-pad-widget/signature-pad-widget-edit.component.mjs +3 -2
  32. package/esm2022/widgets/lib/editors/signature-pad-widget/signature-pad-widget-view.component.mjs +3 -2
  33. package/esm2022/widgets/lib/editors/text-box-widget/text-box-widget-edit.component.mjs +3 -2
  34. package/esm2022/widgets/lib/editors/text-box-widget/text-box-widget-view.component.mjs +3 -2
  35. package/esm2022/workflow/lib/actions/start-workflow.action.mjs +7 -3
  36. package/esm2022/workflow/lib/workflow.service.mjs +3 -3
  37. package/esm2022/workflow/lib/workflow.types.mjs +11 -10
  38. package/fesm2022/{acorex-platform-common-lookup-widget-edit.component-D9UhViUG.mjs → acorex-platform-common-lookup-widget-edit.component-Do_yV2hi.mjs} +19 -2
  39. package/fesm2022/acorex-platform-common-lookup-widget-edit.component-Do_yV2hi.mjs.map +1 -0
  40. package/fesm2022/{acorex-platform-common-lookup-widget-filter.component-RWweQQaO.mjs → acorex-platform-common-lookup-widget-filter.component-AKqbYe-l.mjs} +19 -2
  41. package/fesm2022/acorex-platform-common-lookup-widget-filter.component-AKqbYe-l.mjs.map +1 -0
  42. package/fesm2022/{acorex-platform-common-lookup-widget-view.component-mXo8VADX.mjs → acorex-platform-common-lookup-widget-view.component-BHqYDEuU.mjs} +5 -5
  43. package/fesm2022/acorex-platform-common-lookup-widget-view.component-BHqYDEuU.mjs.map +1 -0
  44. package/fesm2022/acorex-platform-common.mjs +159 -13
  45. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  46. package/fesm2022/acorex-platform-layout-entity.mjs +116 -66
  47. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  48. package/fesm2022/acorex-platform-themes-default.mjs +8 -2
  49. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  50. package/fesm2022/acorex-platform-widgets.mjs +24 -15
  51. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  52. package/fesm2022/acorex-platform-workflow.mjs +18 -13
  53. package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
  54. package/layout/entity/lib/entity-master-list.viewmodel.d.ts +7 -5
  55. package/layout/entity/lib/entity-master-single.viewmodel.d.ts +7 -5
  56. package/layout/entity/lib/widgets/lookup-widget/lookup-widget-edit.component.d.ts +2 -0
  57. package/package.json +1 -1
  58. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +1 -0
  59. package/themes/default/lib/layouts/entity-layouts/entity-master-single-view/entity-master-single-view.component.d.ts +1 -0
  60. package/widgets/lib/editors/rich-text-widget/rich-text-widget-edit.component.d.ts +1 -1
  61. package/widgets/lib/editors/rich-text-widget/rich-text-widget-view.component.d.ts +3 -2
  62. package/widgets/lib/editors/signature-pad-widget/signature-pad-widget-edit.component.d.ts +1 -1
  63. package/widgets/lib/editors/signature-pad-widget/signature-pad-widget-view.component.d.ts +1 -1
  64. package/widgets/lib/editors/text-box-widget/text-box-widget-edit.component.d.ts +1 -1
  65. package/widgets/lib/editors/text-box-widget/text-box-widget-view.component.d.ts +1 -1
  66. package/workflow/lib/workflow.service.d.ts +1 -1
  67. package/workflow/lib/workflow.types.d.ts +4 -3
  68. package/fesm2022/acorex-platform-common-lookup-widget-edit.component-D9UhViUG.mjs.map +0 -1
  69. package/fesm2022/acorex-platform-common-lookup-widget-filter.component-RWweQQaO.mjs.map +0 -1
  70. package/fesm2022/acorex-platform-common-lookup-widget-view.component-mXo8VADX.mjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { AXFormatService } from '@acorex/core/format';
2
2
  import { cloneDeep, set, merge, get } from 'lodash-es';
3
3
  import * as i0 from '@angular/core';
4
- import { InjectionToken, inject, Injectable, computed, signal, Injector, Component, ChangeDetectionStrategy, ViewChild, NgModule } from '@angular/core';
4
+ import { InjectionToken, inject, Injectable, computed, signal, Injector, Component, ChangeDetectionStrategy, DestroyRef, ViewChild, NgModule } from '@angular/core';
5
5
  import * as i1$2 from '@acorex/platform/workflow';
6
6
  import { createWorkFlowEvent, AXPWorkflowAction, AXPWorkflowService, ofType, AXPWorkflowModule } from '@acorex/platform/workflow';
7
7
  import { AXPSessionService } from '@acorex/platform/auth';
@@ -12,7 +12,7 @@ import { AXPopupService } from '@acorex/components/popup';
12
12
  import { AXPlatform } from '@acorex/core/platform';
13
13
  import * as i1 from '@acorex/components/common';
14
14
  import { AXDataSource, AXCommonModule } from '@acorex/components/common';
15
- import { Subject } from 'rxjs';
15
+ import { Subject, takeUntil } from 'rxjs';
16
16
  import { RouterModule, ROUTES } from '@angular/router';
17
17
  import * as i6 from '@acorex/platform/layout/builder';
18
18
  import { AXPWidgetBase, AXPLayoutBuilderModule, AXPLayoutBuilderService, AXPColumnWidgetBase } from '@acorex/platform/layout/builder';
@@ -37,6 +37,7 @@ import { AXFormModule } from '@acorex/components/form';
37
37
  import * as i5$1 from '@acorex/components/loading';
38
38
  import { AXLoadingModule } from '@acorex/components/loading';
39
39
  import { AXValidationModule } from '@acorex/core/validation';
40
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
40
41
 
41
42
  const AXP_ENTITY_CONFIG_TOKEN = new InjectionToken('AXP_ENTITY_CONFIG_TOKEN');
42
43
  const AXP_ENTITY_DEFINITION_LOADER = new InjectionToken('AXP_ENTITY_DEFINITION_LOADER');
@@ -147,7 +148,6 @@ class AXPEntityPerformDeleteAction extends AXPWorkflowAction {
147
148
  this.loadingDialog = inject(AXLoadingDialogService);
148
149
  }
149
150
  async execute(context) {
150
- debugger;
151
151
  const moduleEntity = context.getVariable('entity');
152
152
  const [moduleName, entityName] = moduleEntity.split(".");
153
153
  const items = context.getVariable('data');
@@ -197,14 +197,12 @@ class AXPEntityPerformDeleteAction extends AXPWorkflowAction {
197
197
  if (successfulPromises > 0 && failedPromises === 0) {
198
198
  // All items deleted successfully
199
199
  await this.dialogService.alert('Deletion Successful', `${successfulPromises} item(s) has been deleted.`, 'success');
200
- debugger;
201
200
  // Dispatch actions
202
201
  this.dispatch(AXPEntityDeletedEvent({ entity: moduleEntity, ids: ids }));
203
202
  }
204
203
  else if (successfulPromises > 0 && failedPromises > 0) {
205
204
  // Some items deleted successfully, some failed
206
205
  await this.dialogService.alert('Partial Deletion Completed', `${successfulPromises} item(s) deleted successfully. However, ${failedPromises} item(s) could not be deleted.`, 'warning');
207
- debugger;
208
206
  // Dispatch actions
209
207
  this.dispatch(AXPEntityDeletedEvent({ entity: moduleEntity, ids: ids }));
210
208
  }
@@ -605,21 +603,18 @@ class AXPEntityMasterSingleViewGroupViewModel {
605
603
  return source;
606
604
  });
607
605
  this.props = computed(() => {
608
- const props = this.entity.properties.filter(c => c.groupId == this.group.id &&
609
- c.schema.hidden != true).map(c => c.name);
610
- const viewProps = this.entity.interfaces?.master?.single?.properties?.filter(c => props.includes(c.name)) ?? [];
611
- return viewProps.map(e => {
612
- return new AXPEntityMasterSingleElementViewModel(this.entity, this, e);
613
- });
606
+ const { properties, interfaces } = this.entity;
607
+ const groupProperties = properties
608
+ .filter(({ groupId, schema }) => groupId === this.group.id && !schema.hidden)
609
+ .map(({ name }) => name);
610
+ const viewProperties = interfaces?.master?.single?.properties?.filter(({ name }) => groupProperties.includes(name)) ?? [];
611
+ return viewProperties.map(prop => new AXPEntityMasterSingleElementViewModel(this.entity, this, prop));
614
612
  });
615
613
  this.editableProps = computed(() => {
616
- const editableProps = this.entity.interfaces?.master?.update?.properties?.map(c => c.name) ?? [];
617
- const props = this.entity.properties.filter(c => c.groupId == this.group.id &&
618
- c.schema.hidden != true &&
619
- editableProps.includes(c.name));
620
- return props.map(e => {
621
- return new AXPEntityMasterSingleElementViewModel(this.entity, this, e);
622
- });
614
+ const { properties, interfaces } = this.entity;
615
+ const editablePropertyNames = interfaces?.master?.update?.properties?.map(({ name }) => name) ?? [];
616
+ const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId === this.group.id && !schema.hidden && editablePropertyNames.includes(name));
617
+ return filteredProperties.map(prop => new AXPEntityMasterSingleElementViewModel(this.entity, this, prop));
623
618
  });
624
619
  this.editable = computed(() => {
625
620
  return this.editableProps().length > 0;
@@ -667,6 +662,7 @@ class AXPEntityMasterSingleViewModel {
667
662
  this.session = this.injector.get(AXPSessionService);
668
663
  this.formatService = this.injector.get(AXFormatService);
669
664
  this.workflow = this.injector.get(AXPWorkflowService);
665
+ this.destroyed = new Subject();
670
666
  this.events$ = new Subject();
671
667
  this.context = signal(cloneDeep(this.entityData));
672
668
  this.actions = computed(() => {
@@ -679,15 +675,11 @@ class AXPEntityMasterSingleViewModel {
679
675
  return this.actions().filter(c => c.priority == 'secondary');
680
676
  });
681
677
  this.sections = computed(() => {
682
- const viewProps = this.entityDef.interfaces?.master?.single?.properties?.map(c => c.name);
683
- const props = this.entityDef.properties.filter(c => c.groupId &&
684
- c.schema.hidden != true &&
685
- viewProps?.includes(c.name));
686
- const groups = this.entityDef.interfaces?.master?.single?.sections?.filter(g => props.some(p => p.groupId == g.id)) ?? [];
687
- const result = groups?.map((section) => {
688
- return new AXPEntityMasterSingleViewGroupViewModel(this.entityDef, section);
689
- });
690
- return (result ?? []);
678
+ const { interfaces, properties } = this.entityDef;
679
+ const viewProps = interfaces?.master?.single?.properties?.map(({ name }) => name) ?? [];
680
+ const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId && !schema.hidden && viewProps.includes(name));
681
+ const groups = interfaces?.master?.single?.sections?.filter(({ id }) => filteredProperties.some(({ groupId }) => groupId === id)) ?? [];
682
+ return groups.map(section => new AXPEntityMasterSingleViewGroupViewModel(this.entityDef, section));
691
683
  });
692
684
  //****************** Title ******************//
693
685
  this.title = computed(() => {
@@ -721,7 +713,10 @@ class AXPEntityMasterSingleViewModel {
721
713
  this.relatedEntities = computed(() => {
722
714
  return this.entityDef.relatedEntities?.map(re => new AXPEntityDetailListViewModel(this.injector, re, { entity: this.entityDef, data: this.entityData })) ?? [];
723
715
  });
724
- this.workflow.events$.pipe(ofType(AXPEntityDeletedEvent)).subscribe((event) => {
716
+ this.workflow.events$
717
+ .pipe(ofType(AXPEntityDeletedEvent))
718
+ .pipe(takeUntil(this.destroyed))
719
+ .subscribe((event) => {
725
720
  if (event.payload.entity == this.entityDef.source &&
726
721
  event.payload.ids.includes(this.context().id)) {
727
722
  this.workflow.execute('show-list-view', {
@@ -729,7 +724,10 @@ class AXPEntityMasterSingleViewModel {
729
724
  });
730
725
  }
731
726
  });
732
- this.workflow.events$.pipe(ofType(AXPEntityModifyEvent)).subscribe(async (event) => {
727
+ this.workflow.events$
728
+ .pipe(ofType(AXPEntityModifyEvent))
729
+ .pipe(takeUntil(this.destroyed))
730
+ .subscribe(async (event) => {
733
731
  if (event.payload.entity == this.entityDef.source &&
734
732
  event.payload.values.id === this.context().id) {
735
733
  this.context.set(event.payload.values);
@@ -737,7 +735,6 @@ class AXPEntityMasterSingleViewModel {
737
735
  });
738
736
  }
739
737
  async executeCommand(commandName, data = null) {
740
- // debugger
741
738
  //TODO: syntact for workflow
742
739
  switch (commandName) {
743
740
  case 'delete-entity':
@@ -761,11 +758,17 @@ class AXPEntityMasterSingleViewModel {
761
758
  const action = this.actions().find(c => c.name == commandName);
762
759
  this.workflow.execute(commandName, {
763
760
  entity: this.entityDef.source,
764
- data: action?.scope == AXPEntityCommandScope.Individual ? data : null
761
+ data: action?.scope == AXPEntityCommandScope.Individual ? this.context() : null
765
762
  });
766
763
  }
767
764
  }
768
765
  }
766
+ //
767
+ //
768
+ destroy() {
769
+ this.destroyed.next();
770
+ this.destroyed.complete();
771
+ }
769
772
  }
770
773
  class AXPEntityDetailViewModelFactory {
771
774
  constructor() {
@@ -819,13 +822,15 @@ class AXPEntityCreateViewSectionViewModel {
819
822
  return source;
820
823
  });
821
824
  this.elements = computed(() => {
822
- const createProps = this.entity.interfaces?.master?.create?.properties ?? [];
823
- const createPropsNames = createProps.map(c => c.name);
824
- const props = this.entity.properties.filter(c => c.groupId == this.group.id &&
825
- c.schema.hidden != true &&
826
- createPropsNames.includes(c.name));
827
- return props.map(p => {
828
- return new AXPEntityCreateViewElementViewModel(this.entity, this, p, createProps.find(c => c.name == p.name));
825
+ const { interfaces, properties } = this.entity;
826
+ const createProps = interfaces?.master?.create?.properties ?? [];
827
+ const createPropNames = new Set(createProps.map(({ name }) => name));
828
+ const filteredProperties = properties.filter(({ groupId, schema, name }) => groupId === this.group.id &&
829
+ !schema.hidden &&
830
+ createPropNames.has(name));
831
+ return filteredProperties.map(property => {
832
+ const createProp = createProps.find(({ name }) => name === property.name);
833
+ return new AXPEntityCreateViewElementViewModel(this.entity, this, property, createProp);
829
834
  });
830
835
  });
831
836
  }
@@ -877,22 +882,24 @@ class AXPEntityMasterCreateViewModel {
877
882
  this.context = signal(this.initialData ?? {});
878
883
  this.isInProgress = signal(false);
879
884
  this.sections = computed(() => {
880
- const createProps = this.entityDef.interfaces?.master?.create?.properties?.map(c => c.name) ?? [];
881
- const props = this.entityDef.properties.filter(p => p.groupId && p.schema.hidden != true && createProps.includes(p.name));
882
- const groups = this.entityDef.interfaces?.master?.create?.sections?.filter(g => props.some(p => p.groupId == g.id)) ?? [];
883
- const result = groups?.map((section) => {
884
- return new AXPEntityCreateViewSectionViewModel(this.entityDef, section);
885
- });
886
- return (result ?? []);
885
+ const { interfaces, properties } = this.entityDef;
886
+ const createProps = interfaces?.master?.create?.properties?.map(({ name }) => name) ?? [];
887
+ const visibleProperties = properties.filter(({ groupId, schema, name }) => groupId && !schema.hidden && createProps.includes(name));
888
+ const sections = interfaces?.master?.create?.sections?.filter(({ id }) => visibleProperties.some(({ groupId }) => groupId === id)) ?? [];
889
+ return sections.map(section => new AXPEntityCreateViewSectionViewModel(this.entityDef, section));
887
890
  });
888
891
  if (!initialData)
889
892
  initialData = {};
890
893
  this.config.properties
891
- .filter(c => c.schema.defaultValue && typeof c.schema.defaultValue === 'function')
894
+ .filter(c => c.schema.defaultValue != null)
892
895
  .forEach(p => {
893
- debugger;
894
- const func = p.schema.defaultValue;
895
- set(initialData, p.name, func(initialData));
896
+ if (typeof p.schema.defaultValue === 'function') {
897
+ const func = p.schema.defaultValue;
898
+ set(initialData, p.name, func(initialData));
899
+ }
900
+ else {
901
+ set(initialData, p.name, p.schema.defaultValue);
902
+ }
896
903
  });
897
904
  this.context.set(initialData);
898
905
  }
@@ -956,6 +963,7 @@ class AXPEntityMasterListViewModel {
956
963
  this.formatService = this.injector.get(AXFormatService);
957
964
  this.session = this.injector.get(AXPSessionService);
958
965
  this.workflow = this.injector.get(AXPWorkflowService);
966
+ this.destroyed = new Subject();
959
967
  this.events$ = new Subject();
960
968
  this.dataSource = new AXDataSource({
961
969
  byKey: (key) => {
@@ -1031,11 +1039,14 @@ class AXPEntityMasterListViewModel {
1031
1039
  };
1032
1040
  //****************** Columns ******************//
1033
1041
  this.allAvailableColumns = () => {
1034
- const columns = this.entityDef.columns?.map(c => c.name) ?? [];
1035
- const props = this.entityDef.properties.filter(p => p.schema.hidden != true);
1036
- const displayColumns = props.filter(p => columns.some(c => c == p.name));
1037
- return displayColumns.map(p => {
1038
- return new AXPEntityListViewColumnViewModel(p, this.entityDef.columns?.find(c => c.name == p.name));
1042
+ const { columns = [], properties } = this.entityDef;
1043
+ const visibleProperties = properties.filter(({ schema }) => !schema?.hidden);
1044
+ const visiblePropNames = new Set(visibleProperties.map(({ name }) => name));
1045
+ return columns
1046
+ .filter(({ name }) => visiblePropNames.has(name))
1047
+ .map(column => {
1048
+ const property = visibleProperties.find(({ name }) => name === column.name);
1049
+ return new AXPEntityListViewColumnViewModel(property, column);
1039
1050
  });
1040
1051
  };
1041
1052
  this.visibleColumnCount = () => {
@@ -1073,7 +1084,11 @@ class AXPEntityMasterListViewModel {
1073
1084
  });
1074
1085
  });
1075
1086
  this.view = signal(this.views()[0]);
1076
- this.workflow.events$.pipe(ofType(AXPEntityDeletedEvent)).subscribe((event) => {
1087
+ this.workflow.events$
1088
+ .pipe(ofType(AXPEntityDeletedEvent))
1089
+ .pipe(takeUntil(this.destroyed))
1090
+ .subscribe((event) => {
1091
+ debugger;
1077
1092
  if (event.payload.entity == this.entityDef.source) {
1078
1093
  this.selectedItems.set([]);
1079
1094
  this.events$.next({ action: "refresh" });
@@ -1104,6 +1119,12 @@ class AXPEntityMasterListViewModel {
1104
1119
  //
1105
1120
  this.dataSource.sort(...this.sortedFields().map(s => ({ dir: s.dir, field: s.name })));
1106
1121
  //
1122
+ this.advanceFilters.filters = this.view().conditions.map(f => ({
1123
+ field: f.name,
1124
+ operator: f.operator,
1125
+ value: f.value
1126
+ }));
1127
+ //
1107
1128
  const inline = this.inlineFilters.filters?.length ?? 0;
1108
1129
  const advance = this.advanceFilters.filters?.length ?? 0;
1109
1130
  if (inline && !advance) {
@@ -1181,6 +1202,11 @@ class AXPEntityMasterListViewModel {
1181
1202
  data: action?.scope == AXPEntityCommandScope.Selected ? this.selectedItems() : data
1182
1203
  });
1183
1204
  }
1205
+ //
1206
+ destroy() {
1207
+ this.destroyed.next();
1208
+ this.destroyed.complete();
1209
+ }
1184
1210
  }
1185
1211
  class AXPEntityListViewModelFactory {
1186
1212
  constructor() {
@@ -1221,21 +1247,20 @@ class AXPEntityCreatePopupAction extends AXPWorkflowAction {
1221
1247
  }
1222
1248
  async execute(context) {
1223
1249
  const [module, entity] = context.getVariable('entity').split(".");
1224
- const dataContext = context.getVariable('context');
1250
+ const data = context.getVariable('data');
1225
1251
  const entityRef = await this.entityRegistery.resolve(module, entity);
1226
1252
  const com = await this.config.viewers.master.create();
1227
1253
  const result = await this.popupService.open(com, {
1228
1254
  title: `Create New ${entityRef.formats.individual}`,
1229
1255
  size: this.platform.is('Mobile') || this.platform.is('SM') ? 'full' : 'md',
1230
1256
  data: {
1231
- vm: await this.factory.create(module, entity, dataContext),
1257
+ vm: await this.factory.create(module, entity, data),
1232
1258
  entity,
1233
1259
  },
1234
1260
  });
1235
1261
  context.setOutput('result', false);
1236
1262
  if (result.data?.save) {
1237
1263
  context.setOutput('result', true);
1238
- context.setVariable('redirect', result.data.redirect);
1239
1264
  context.setVariable('data', result.data.item);
1240
1265
  }
1241
1266
  }
@@ -1347,7 +1372,6 @@ class AXPLookupWidgetSelectorComponent extends AXBasePageComponent {
1347
1372
  // super.ngOnInit();
1348
1373
  // }
1349
1374
  ngAfterViewInit() {
1350
- debugger;
1351
1375
  if (this.searchTerm) {
1352
1376
  this.vm.applyInlineFilter(this.searchTerm);
1353
1377
  }
@@ -1551,13 +1575,25 @@ class AXPLookupWidgetSelectorViewModel {
1551
1575
  //
1552
1576
  //this.dataSource.sort(...this.sortedFields().map(s => ({ dir: s.dir, field: s.name } as AXDataSourceSortOption)));
1553
1577
  //
1578
+ // Check if inlineFilters or parentFilters have any filters
1579
+ const hasInlineFilters = (this.inlineFilters?.filters?.length ?? 0) > 0;
1580
+ const hasParentFilters = (this.parentFilters?.filters?.length ?? 0) > 0;
1581
+ // Construct the filters array based on the presence of filters
1582
+ const filters = [];
1583
+ if (hasInlineFilters) {
1584
+ filters.push(this.inlineFilters);
1585
+ }
1586
+ if (hasParentFilters && this.parentFilters) {
1587
+ filters.push(this.parentFilters);
1588
+ }
1589
+ // Apply the filters to the dataSource
1554
1590
  this.dataSource.filter({
1555
1591
  field: null,
1556
1592
  logic: 'and',
1557
1593
  operator: null,
1558
- filters: this.parentFilters ? [this.inlineFilters, this.parentFilters] : [this.inlineFilters]
1594
+ filters: filters
1559
1595
  });
1560
- //
1596
+ // Refresh the dataSource
1561
1597
  this.dataSource.refresh();
1562
1598
  }
1563
1599
  async find(value) {
@@ -1577,6 +1613,7 @@ class AXPLookupWidgetEditComponent extends AXPWidgetBase {
1577
1613
  this.formatService = inject(AXFormatService);
1578
1614
  this.popupService = inject(AXPopupService);
1579
1615
  this.builderService = inject(AXPLayoutBuilderService);
1616
+ this.destroyRef = inject(DestroyRef);
1580
1617
  this.displayText = signal("");
1581
1618
  this.selectedItem = signal(null);
1582
1619
  this.searchTerm = signal(null);
@@ -1602,10 +1639,14 @@ class AXPLookupWidgetEditComponent extends AXPWidgetBase {
1602
1639
  else if (value != null) {
1603
1640
  await this.findByValue();
1604
1641
  }
1605
- this.builderService.onChanged.subscribe(async (c) => {
1642
+ //
1643
+ this.builderService
1644
+ .onChanged
1645
+ .pipe(takeUntilDestroyed(this.destroyRef))
1646
+ .subscribe(async (c) => {
1606
1647
  if (c.path == this.path) {
1607
- console.log(c, this.getValue());
1608
- await this.findByValue();
1648
+ if (this.getValue())
1649
+ await this.findByValue();
1609
1650
  }
1610
1651
  });
1611
1652
  }
@@ -1684,12 +1725,17 @@ class AXPLookupWidgetEditComponent extends AXPWidgetBase {
1684
1725
  this.builderService.setValue(i, item);
1685
1726
  }
1686
1727
  else {
1687
- this.builderService.setValue(i.target, get(item, i.source));
1728
+ const key = get(item, i.source);
1729
+ this.builderService.setValue(i.target, key);
1688
1730
  }
1689
1731
  });
1690
1732
  }
1691
1733
  }
1692
1734
  }
1735
+ handleClearClick() {
1736
+ this.clear();
1737
+ this.setValue(null);
1738
+ }
1693
1739
  clear() {
1694
1740
  this.searchTerm.set('');
1695
1741
  this.displayText.set('');
@@ -1701,6 +1747,8 @@ class AXPLookupWidgetEditComponent extends AXPWidgetBase {
1701
1747
  @for (validation of validationRules; track $index) {
1702
1748
  <ax-validation-rule [rule]="validation.rule" [message]="validation.options?.message" [options]="validation.options"></ax-validation-rule>
1703
1749
  }
1750
+ <ax-clear-button (click)="handleClearClick()"></ax-clear-button>
1751
+
1704
1752
  <ax-suffix>
1705
1753
  <ax-button color="ghost" look="twotone" [disabled]="isLoading()" (onClick)="handleOnClick($event)">
1706
1754
  @if(isLoading())
@@ -1714,7 +1762,7 @@ class AXPLookupWidgetEditComponent extends AXPWidgetBase {
1714
1762
  </ax-button>
1715
1763
  </ax-suffix>
1716
1764
  </ax-text-box>
1717
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: AXSelectBoxModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "component", type: i2$1.AXTextBoxComponent, selector: "ax-text-box", inputs: ["disabled", "tabIndex", "readonly", "value", "state", "name", "id", "placeholder", "maxLength", "allowNull", "type", "autoComplete", "look", "mask-options", "class"], outputs: ["onBlur", "onFocus", "valueChange", "stateChange", "onValueChanged", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i3.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-sub-title, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "component", type: i5$1.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "ngmodule", type: AXValidationModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "directive", type: i6$1.AXValidationRuleDirective, selector: "ax-validation-rule", inputs: ["rule", "options", "message"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1765
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: AXSelectBoxModule }, { kind: "ngmodule", type: AXTextBoxModule }, { kind: "component", type: i2$1.AXTextBoxComponent, selector: "ax-text-box", inputs: ["disabled", "tabIndex", "readonly", "value", "state", "name", "id", "placeholder", "maxLength", "allowNull", "type", "autoComplete", "look", "mask-options", "class"], outputs: ["onBlur", "onFocus", "valueChange", "stateChange", "onValueChanged", "readonlyChange", "disabledChange", "onKeyDown", "onKeyUp", "onKeyPress"] }, { kind: "ngmodule", type: AXButtonModule }, { kind: "component", type: i2.AXButtonComponent, selector: "ax-button", inputs: ["disabled", "size", "tabIndex", "color", "look", "text", "toggleable", "selected", "type"], outputs: ["onBlur", "onFocus", "onClick", "selectedChange", "toggleableChange", "lookChange", "colorChange", "disabledChange"] }, { kind: "ngmodule", type: AXDecoratorModule }, { kind: "component", type: i3.AXDecoratorIconComponent, selector: "ax-icon", inputs: ["icon"] }, { kind: "component", type: i3.AXDecoratorClearButtonComponent, selector: "ax-clear-button", inputs: ["icon"] }, { kind: "component", type: i3.AXDecoratorGenericComponent, selector: "ax-footer, ax-header, ax-content, ax-divider, ax-form-hint, ax-prefix, ax-suffix, ax-text, ax-title, ax-sub-title, ax-placeholder, ax-overlay" }, { kind: "ngmodule", type: AXLoadingModule }, { kind: "component", type: i5$1.AXLoadingComponent, selector: "ax-loading", inputs: ["visible", "type", "context"], outputs: ["visibleChange"] }, { kind: "ngmodule", type: AXValidationModule }, { kind: "ngmodule", type: AXFormModule }, { kind: "directive", type: i6$1.AXValidationRuleDirective, selector: "ax-validation-rule", inputs: ["rule", "options", "message"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1718
1766
  }
1719
1767
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImport: i0, type: AXPLookupWidgetEditComponent, decorators: [{
1720
1768
  type: Component,
@@ -1724,6 +1772,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
1724
1772
  @for (validation of validationRules; track $index) {
1725
1773
  <ax-validation-rule [rule]="validation.rule" [message]="validation.options?.message" [options]="validation.options"></ax-validation-rule>
1726
1774
  }
1775
+ <ax-clear-button (click)="handleClearClick()"></ax-clear-button>
1776
+
1727
1777
  <ax-suffix>
1728
1778
  <ax-button color="ghost" look="twotone" [disabled]="isLoading()" (onClick)="handleOnClick($event)">
1729
1779
  @if(isLoading())