@acorex/platform 19.0.1 → 19.1.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 (96) hide show
  1. package/common/lib/app/application.types.d.ts +1 -0
  2. package/common/lib/common.module.d.ts +2 -2
  3. package/common/lib/layout/sticky.directive.d.ts +5 -1
  4. package/common/lib/settings/index.d.ts +1 -0
  5. package/common/lib/settings/setting-definition.provider.d.ts +7 -8
  6. package/common/lib/settings/setting.builder.d.ts +45 -0
  7. package/common/lib/settings/settings.provider.d.ts +3 -2
  8. package/common/lib/settings/settings.service.d.ts +9 -5
  9. package/common/lib/settings/settings.types.d.ts +15 -25
  10. package/common/lib/store/common.effects.d.ts +2 -2
  11. package/fesm2022/acorex-platform-common.mjs +255 -190
  12. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-layout-builder.mjs +82 -25
  14. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-layout-designer.mjs +12 -10
  16. package/fesm2022/acorex-platform-layout-designer.mjs.map +1 -1
  17. package/fesm2022/acorex-platform-layout-entity.mjs +23 -6
  18. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  19. package/fesm2022/acorex-platform-layout-setting.mjs +95 -76
  20. package/fesm2022/acorex-platform-layout-setting.mjs.map +1 -1
  21. package/fesm2022/acorex-platform-layouts.mjs +1 -1
  22. package/fesm2022/acorex-platform-layouts.mjs.map +1 -1
  23. package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-Bw-rbKbL.mjs → acorex-platform-themes-default-entity-master-create-view.component-CJ_HVKX-.mjs} +4 -4
  24. package/fesm2022/{acorex-platform-themes-default-entity-master-create-view.component-Bw-rbKbL.mjs.map → acorex-platform-themes-default-entity-master-create-view.component-CJ_HVKX-.mjs.map} +1 -1
  25. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-CeBk_nxz.mjs +305 -0
  26. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-CeBk_nxz.mjs.map +1 -0
  27. package/fesm2022/{acorex-platform-themes-default-entity-master-modify-view.component-DoeGBemE.mjs → acorex-platform-themes-default-entity-master-modify-view.component-DveB-N1Z.mjs} +5 -5
  28. package/fesm2022/{acorex-platform-themes-default-entity-master-modify-view.component-DoeGBemE.mjs.map → acorex-platform-themes-default-entity-master-modify-view.component-DveB-N1Z.mjs.map} +1 -1
  29. package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-D8UjpvuI.mjs → acorex-platform-themes-default-entity-master-single-view.component-q_DOP0cT.mjs} +12 -12
  30. package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-D8UjpvuI.mjs.map → acorex-platform-themes-default-entity-master-single-view.component-q_DOP0cT.mjs.map} +1 -1
  31. package/fesm2022/acorex-platform-themes-default.mjs +233 -193
  32. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  33. package/fesm2022/acorex-platform-themes-shared.mjs +182 -23
  34. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  35. package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-RCi5IJOR.mjs → acorex-platform-widgets-checkbox-widget-designer.component-B_Gec5Qf.mjs} +4 -4
  36. package/fesm2022/{acorex-platform-widgets-checkbox-widget-designer.component-RCi5IJOR.mjs.map → acorex-platform-widgets-checkbox-widget-designer.component-B_Gec5Qf.mjs.map} +1 -1
  37. package/fesm2022/{acorex-platform-widgets-color-box-widget-designer.component-CWhbgmDV.mjs → acorex-platform-widgets-color-box-widget-designer.component-B2g0ct24.mjs} +4 -4
  38. package/fesm2022/acorex-platform-widgets-color-box-widget-designer.component-B2g0ct24.mjs.map +1 -0
  39. package/fesm2022/{acorex-platform-widgets-page-widget-designer.component-DGNcuRbs.mjs → acorex-platform-widgets-page-widget-designer.component-CITselce.mjs} +5 -5
  40. package/fesm2022/acorex-platform-widgets-page-widget-designer.component-CITselce.mjs.map +1 -0
  41. package/fesm2022/acorex-platform-widgets.mjs +280 -127
  42. package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
  43. package/layout/builder/lib/builder/widget-column-renderer.d.ts +5 -1
  44. package/layout/builder/lib/builder/widget-renderer.component.directive.d.ts +6 -1
  45. package/layout/builder/lib/builder/widget.types.d.ts +14 -9
  46. package/layout/designer/lib/preview/preview.component.d.ts +2 -2
  47. package/layout/entity/lib/entity-detail-list.viewmodel.d.ts +1 -0
  48. package/layout/entity/lib/entity-master-list.viewmodel.d.ts +1 -0
  49. package/layout/entity/lib/widgets/lookup-widget/lookup-widget-selector.viewmodel.d.ts +1 -0
  50. package/layout/setting/lib/setting.viewmodel.d.ts +19 -19
  51. package/layouts/lib/admin/entity-layout/entity-details-view/entity-details-view.component.d.ts +1 -0
  52. package/package.json +14 -14
  53. package/themes/default/index.d.ts +2 -1
  54. package/themes/default/lib/layouts/base/index.d.ts +1 -0
  55. package/themes/default/lib/layouts/base/simple-page/simple-page.layout.d.ts +7 -0
  56. package/themes/default/lib/layouts/entity-layouts/entity-detail-list-view/entity-detail-list-view.component.d.ts +1 -0
  57. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +1 -0
  58. package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/list-view-option-columns/list-view-option-columns.component.d.ts +2 -2
  59. package/themes/default/lib/layouts/entity-layouts/entity-master-single-view/entity-master-single-view.component.d.ts +1 -0
  60. package/themes/default/lib/layouts/root-layout/components/header/header.component.d.ts +1 -0
  61. package/themes/default/lib/layouts/root-layout/root-layout.component.d.ts +1 -0
  62. package/themes/default/lib/layouts/setting-layout/setting-menu/setting-menu.component.d.ts +0 -2
  63. package/themes/default/lib/layouts/setting-layout/setting-page/setting-page.component.d.ts +5 -0
  64. package/themes/default/lib/layouts/setting-layout/setting-view/setting-view.component.d.ts +3 -1
  65. package/themes/shared/index.d.ts +1 -0
  66. package/themes/shared/lib/components/layout-elements/index.d.ts +2 -0
  67. package/themes/shared/lib/components/layout-elements/layout-blocks.component.d.ts +5 -0
  68. package/themes/shared/lib/components/layout-elements/layout-page-header.component.d.ts +11 -0
  69. package/themes/shared/lib/components/theme-slot.component.d.ts +1 -0
  70. package/themes/shared/lib/services/theme.service.d.ts +1 -0
  71. package/themes/shared/lib/setting.keys.d.ts +4 -0
  72. package/themes/shared/lib/setting.provider.d.ts +4 -0
  73. package/widgets/lib/properties/layout.props.d.ts +1 -0
  74. package/widgets/lib/widgets/advance/map/map-box-widget-edit.component.d.ts +1 -1
  75. package/widgets/lib/widgets/advance/map/map-box-widget-view.component.d.ts +1 -1
  76. package/widgets/lib/widgets/editors/checkbox/checkbox-widget-edit.component.d.ts +0 -3
  77. package/widgets/lib/widgets/editors/checkbox/checkbox-widget.config.d.ts +4 -6
  78. package/widgets/lib/widgets/editors/password/password-box-widget-view.component.d.ts +1 -1
  79. package/widgets/lib/widgets/editors/toggle/toggle-widget-edit.component.d.ts +4 -0
  80. package/widgets/lib/widgets/index.d.ts +1 -0
  81. package/widgets/lib/widgets/layout/block/block-widget-designer.component.d.ts +2 -2
  82. package/widgets/lib/widgets/layout/form-field/form-field-widget-designer.component.d.ts +2 -2
  83. package/widgets/lib/widgets/layout/grid/grid-widget-designer.component.d.ts +2 -2
  84. package/widgets/lib/widgets/layout/grid-item/grid-item-widget-designer.component.d.ts +2 -2
  85. package/widgets/lib/widgets/layout/grid-item/grid-item-widget-view.component.d.ts +2 -2
  86. package/widgets/lib/widgets/layout/grid-row/grid-row-widget-designer.component.d.ts +2 -2
  87. package/widgets/lib/widgets/layout/page/page-widget-designer.component.d.ts +2 -2
  88. package/widgets/lib/widgets/layout/repeater/repeater-widget-designer.component.d.ts +2 -2
  89. package/widgets/lib/widgets/property-editors/spacing/index.d.ts +3 -0
  90. package/widgets/lib/widgets/property-editors/spacing/spacing-widget-editor.component.d.ts +13 -0
  91. package/widgets/lib/widgets/property-editors/spacing/spacing-widget-type.d.ts +10 -0
  92. package/widgets/lib/widgets/property-editors/spacing/spacing-widget.config.d.ts +7 -0
  93. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DJYTC375.mjs +0 -305
  94. package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-DJYTC375.mjs.map +0 -1
  95. package/fesm2022/acorex-platform-widgets-color-box-widget-designer.component-CWhbgmDV.mjs.map +0 -1
  96. package/fesm2022/acorex-platform-widgets-page-widget-designer.component-DGNcuRbs.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, provideAppInitializer, inject, RendererFactory2, InjectionToken, Injector, ErrorHandler, NgModule, Inject, Directive, Input, EventEmitter, Output, runInInjectionContext, Optional, Component, ViewEncapsulation, ChangeDetectorRef, ChangeDetectionStrategy, ViewChild } from '@angular/core';
3
- import { kebabCase, cloneDeep, merge, sortBy, assign, isEqual, get, set } from 'lodash-es';
3
+ import { kebabCase, merge, cloneDeep, sortBy, assign, isEqual, get, set } from 'lodash-es';
4
4
  import { AXPopupModule } from '@acorex/components/popup';
5
5
  import { AXToastService, AXToastModule } from '@acorex/components/toast';
6
6
  import { AXDateTimeModule } from '@acorex/core/date-time';
@@ -763,38 +763,162 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
763
763
  args: [{ providedIn: 'root' }]
764
764
  }], ctorParameters: () => [{ type: i0.Injector }, { type: AXPErrorHandlerRegistryService }] });
765
765
 
766
+ class AXPSettingDefinitionProviderContext {
767
+ constructor() {
768
+ this.rootGroups = [];
769
+ this.groupMap = new Map();
770
+ }
771
+ addGroup(name, title, description, icon) {
772
+ const newGroup = {
773
+ name,
774
+ title,
775
+ description,
776
+ icon,
777
+ groups: [],
778
+ sections: [],
779
+ };
780
+ this.rootGroups.push(newGroup);
781
+ this.groupMap.set(name, newGroup); // Index by name
782
+ return new AXPSettingDefinitionGroupBuilder(this, newGroup);
783
+ }
784
+ group(name) {
785
+ const foundGroup = this.groupMap.get(name);
786
+ if (!foundGroup) {
787
+ throw new Error(`Group with name "${name}" not found.`);
788
+ }
789
+ return new AXPSettingDefinitionGroupBuilder(this, foundGroup);
790
+ }
791
+ getGroups() {
792
+ return this.rootGroups;
793
+ }
794
+ // Expose groupMap for controlled access
795
+ hasGroup(name) {
796
+ return this.groupMap.has(name);
797
+ }
798
+ getGroup(name) {
799
+ return this.groupMap.get(name);
800
+ }
801
+ }
802
+ class AXPSettingDefinitionGroupBuilder {
803
+ constructor(context, group) {
804
+ this.context = context;
805
+ this.group = group;
806
+ }
807
+ addSection(name, title, description) {
808
+ const newSection = {
809
+ name,
810
+ title,
811
+ description: description,
812
+ settings: [],
813
+ };
814
+ this.group.sections.push(newSection);
815
+ return new AXPSettingDefinitionSectionBuilder(this, newSection);
816
+ }
817
+ section(name) {
818
+ const foundSection = this.group.sections.find((section) => section.name === name);
819
+ if (!foundSection) {
820
+ throw new Error(`Section with name "${name}" not found in group "${this.group.name}".`);
821
+ }
822
+ return new AXPSettingDefinitionSectionBuilder(this, foundSection);
823
+ }
824
+ addGroup(name, title, description, icon) {
825
+ const newGroup = {
826
+ name,
827
+ title,
828
+ description: description,
829
+ icon,
830
+ groups: [],
831
+ sections: [],
832
+ };
833
+ this.group.groups.push(newGroup);
834
+ if (this.context.hasGroup(name)) {
835
+ throw new Error(`Group with name "${name}" already exists.`);
836
+ }
837
+ this.context['groupMap'].set(name, newGroup);
838
+ return new AXPSettingDefinitionGroupBuilder(this.context, newGroup);
839
+ }
840
+ endGroup() {
841
+ return this.context;
842
+ }
843
+ }
844
+ class AXPSettingDefinitionSectionBuilder {
845
+ constructor(groupBuilder, section) {
846
+ this.groupBuilder = groupBuilder;
847
+ this.section = section;
848
+ }
849
+ addSetting(setting) {
850
+ const newSetting = {
851
+ name: setting.key,
852
+ title: setting.title,
853
+ description: setting.description,
854
+ isRequired: setting.isRequired ?? false,
855
+ isInherited: setting.isInherited ?? false,
856
+ isEncrypted: setting.isEncrypted ?? false,
857
+ defaultValue: setting.defaultValue,
858
+ scope: setting.scope ?? 'G',
859
+ widget: {
860
+ type: setting.widget.type,
861
+ name: setting.key,
862
+ path: setting.key,
863
+ defaultValue: setting.defaultValue,
864
+ options: merge(setting.widget.options ?? {}, { label: setting.widget.options?.['label'] ?? setting.title }),
865
+ valueTransforms: setting.valueTransforms,
866
+ },
867
+ };
868
+ this.section.settings.push(newSetting);
869
+ return this;
870
+ }
871
+ endSection() {
872
+ return this.groupBuilder;
873
+ }
874
+ }
875
+
766
876
  // Injection token for setting providers
767
- const AXP_SETTING_PROVIDER = new InjectionToken('AXP_SETTING_PROVIDER');
877
+ const AXP_SETTING_DEFINITION_PROVIDER = new InjectionToken('AXP_SETTING_DEFINITION_PROVIDER');
768
878
  class AXPSettingDefinitionProviderService {
769
879
  constructor() {
770
- this.providers = inject(AXP_SETTING_PROVIDER, { optional: true });
880
+ this.providers = inject(AXP_SETTING_DEFINITION_PROVIDER, { optional: true });
771
881
  this.cache = null;
772
- this.pendingInserts = [];
773
- this.pendingAdditions = [];
774
882
  }
775
- // Retrieve all setting items, applying any pending operations
776
883
  async items() {
777
884
  if (this.cache) {
778
885
  return this.cache;
779
886
  }
780
- const items = [];
781
- const context = this.createProviderContext(items);
887
+ const context = new AXPSettingDefinitionProviderContext();
782
888
  if (Array.isArray(this.providers)) {
783
889
  for (const provider of this.providers) {
784
- provider.provide(context);
890
+ await provider.provide(context);
785
891
  }
786
892
  }
787
- // this.applyPendingOperations(items);
788
- this.cache = items;
789
- return items;
893
+ this.cache = context.getGroups();
894
+ return this.cache;
895
+ }
896
+ defaultValues(scope) {
897
+ const defaults = {};
898
+ const collectDefaults = (groups) => {
899
+ groups.forEach((group) => {
900
+ group.sections.forEach((section) => {
901
+ section.settings.forEach((setting) => {
902
+ if (setting.defaultValue !== undefined && (!scope || setting.scope === scope)) {
903
+ defaults[setting.name] = setting.defaultValue;
904
+ }
905
+ });
906
+ });
907
+ collectDefaults(group.groups);
908
+ });
909
+ };
910
+ if (this.cache) {
911
+ collectDefaults(this.cache);
912
+ }
913
+ return defaults;
790
914
  }
791
- findGroupDetails(groupName) {
915
+ findGroup(groupName) {
792
916
  if (this.cache) {
793
- return this.searchGroupDetails(this.cache, groupName, []); // Initialize with an empty breadcrumb
917
+ return this.searchRecursive(this.cache, groupName, []); // Initialize with an empty breadcrumb
794
918
  }
795
919
  return null;
796
920
  }
797
- searchGroupDetails(groups, groupName, breadcrumb) {
921
+ searchRecursive(groups, groupName, breadcrumb) {
798
922
  for (const group of groups) {
799
923
  const currentBreadcrumb = [...breadcrumb, { name: group.name, title: group.title }];
800
924
  // If the group name matches, return its details
@@ -802,11 +926,11 @@ class AXPSettingDefinitionProviderService {
802
926
  return {
803
927
  breadcrumb: currentBreadcrumb,
804
928
  sections: group.sections.length > 0 ? group.sections : null,
805
- childGroups: group.groups.length > 0 ? group.groups : null,
929
+ groups: group.groups.length > 0 ? group.groups : null,
806
930
  };
807
931
  }
808
932
  // Recursively search in nested groups
809
- const nestedResult = this.searchGroupDetails(group.groups, groupName, currentBreadcrumb);
933
+ const nestedResult = this.searchRecursive(group.groups, groupName, currentBreadcrumb);
810
934
  if (nestedResult) {
811
935
  return nestedResult;
812
936
  }
@@ -814,128 +938,6 @@ class AXPSettingDefinitionProviderService {
814
938
  // If no matching group is found
815
939
  return null;
816
940
  }
817
- // Create the provider context with methods to add items and find existing ones
818
- createProviderContext(items) {
819
- return {
820
- addItems: (newItems) => {
821
- items.push(...newItems);
822
- },
823
- addItem: (item) => {
824
- items.push(item);
825
- },
826
- addGroup: (group) => {
827
- items.push(group);
828
- },
829
- // find: (target: string): AXPSettingDefinitionFinderResult => {
830
- // return {
831
- // insertGroup: (item, position) => {
832
- // this.pendingInserts.push({ target, newItems: [item], position });
833
- // },
834
- // insertSingle: (item, position) => {
835
- // this.pendingInserts.push({ target, newItems: [item], position });
836
- // },
837
- // insertSingles: (items, position) => {
838
- // this.pendingInserts.push({ target, newItems: items, position });
839
- // },
840
- // addItems: (items) => {
841
- // this.pendingAdditions.push({ target, newItems: items });
842
- // },
843
- // addChildSingleAt: (item, index) => {
844
- // const foundItemInfo = this.findItemWithParent(this.cache || [], target);
845
- // if (foundItemInfo && foundItemInfo.foundItem) {
846
- // const { foundItem } = foundItemInfo;
847
- // if (foundItem.type === AXPSettingDefinitionItemType.Group) {
848
- // const group = foundItem as AXPSettingDefinitionGroup;
849
- // if (index >= 0 && index <= group.singles.length) {
850
- // group.singles.splice(index, 0, item);
851
- // } else {
852
- // console.warn(`Index "${index}" is out of bounds for singles.`);
853
- // }
854
- // } else {
855
- // console.warn(`Target "${target}" is not a group; cannot add a child single.`);
856
- // }
857
- // } else {
858
- // console.warn(`Target "${target}" not found for adding a child single.`);
859
- // }
860
- // },
861
- // addChildSingleFirst: (item) => {
862
- // const foundItemInfo = this.findItemWithParent(this.cache || [], target);
863
- // if (foundItemInfo && foundItemInfo.foundItem) {
864
- // const { foundItem } = foundItemInfo;
865
- // if (foundItem.type === AXPSettingDefinitionItemType.Group) {
866
- // const group = foundItem as AXPSettingDefinitionGroup;
867
- // group.singles.unshift(item);
868
- // } else {
869
- // console.warn(`Target "${target}" is not a group; cannot add a child single.`);
870
- // }
871
- // } else {
872
- // console.warn(`Target "${target}" not found for adding a child single.`);
873
- // }
874
- // },
875
- // addChildSingleLast: (item) => {
876
- // const foundItemInfo = this.findItemWithParent(this.cache || [], target);
877
- // if (foundItemInfo && foundItemInfo.foundItem) {
878
- // const { foundItem } = foundItemInfo;
879
- // if (foundItem.type === AXPSettingDefinitionItemType.Group) {
880
- // const group = foundItem as AXPSettingDefinitionGroup;
881
- // group.singles.push(item);
882
- // } else {
883
- // console.warn(`Target "${target}" is not a group; cannot add a child single.`);
884
- // }
885
- // } else {
886
- // console.warn(`Target "${target}" not found for adding a child single.`);
887
- // }
888
- // },
889
- // addChildGroupAt: (item, index) => {
890
- // const foundItemInfo = this.findItemWithParent(this.cache || [], target);
891
- // if (foundItemInfo && foundItemInfo.foundItem) {
892
- // const { foundItem } = foundItemInfo;
893
- // if (foundItem.type === AXPSettingDefinitionItemType.Group) {
894
- // const group = foundItem as AXPSettingDefinitionGroup;
895
- // if (index >= 0 && index <= group.groups.length) {
896
- // group.groups.splice(index, 0, item);
897
- // } else {
898
- // console.warn(`Index "${index}" is out of bounds for groups.`);
899
- // }
900
- // } else {
901
- // console.warn(`Target "${target}" is not a group; cannot add a child group.`);
902
- // }
903
- // } else {
904
- // console.warn(`Target "${target}" not found for adding a child group.`);
905
- // }
906
- // },
907
- // addChildGroupFirst: (item) => {
908
- // const foundItemInfo = this.findItemWithParent(this.cache || [], target);
909
- // if (foundItemInfo && foundItemInfo.foundItem) {
910
- // const { foundItem } = foundItemInfo;
911
- // if (foundItem.type === AXPSettingDefinitionItemType.Group) {
912
- // const group = foundItem as AXPSettingDefinitionGroup;
913
- // group.groups.unshift(item);
914
- // } else {
915
- // console.warn(`Target "${target}" is not a group; cannot add a child group.`);
916
- // }
917
- // } else {
918
- // console.warn(`Target "${target}" not found for adding a child group.`);
919
- // }
920
- // },
921
- // addChildGroupLast: (item) => {
922
- // const foundItemInfo = this.findItemWithParent(this.cache || [], target);
923
- // if (foundItemInfo && foundItemInfo.foundItem) {
924
- // const { foundItem } = foundItemInfo;
925
- // if (foundItem.type === AXPSettingDefinitionItemType.Group) {
926
- // const group = foundItem as AXPSettingDefinitionGroup;
927
- // group.groups.push(item);
928
- // } else {
929
- // console.warn(`Target "${target}" is not a group; cannot add a child group.`);
930
- // }
931
- // } else {
932
- // console.warn(`Target "${target}" not found for adding a child group.`);
933
- // }
934
- // },
935
- // };
936
- // },
937
- };
938
- }
939
941
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingDefinitionProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
940
942
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingDefinitionProviderService, providedIn: 'root' }); }
941
943
  }
@@ -944,13 +946,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
944
946
  args: [{ providedIn: 'root' }]
945
947
  }] });
946
948
 
947
- const AXP_SETTINGS_PROVIDER = new InjectionToken('AXP_SETTINGS_PROVIDER', {
949
+ const AXP_SETTING_VALUE_PROVIDER = new InjectionToken('AXP_SETTING_VALUE_PROVIDER', {
948
950
  providedIn: 'root',
949
951
  factory: () => {
950
- return new AXPSettingsProviderDefault();
952
+ return new AXPSettingValueProviderDefault();
951
953
  }
952
954
  });
953
- class AXPSettingsProviderDefault {
955
+ class AXPSettingValueProviderDefault {
954
956
  constructor() {
955
957
  this.cache = new Map();
956
958
  this.localStorageKey = 'AXP_SETTINGS';
@@ -967,22 +969,33 @@ class AXPSettingsProviderDefault {
967
969
  }
968
970
  return Promise.resolve([]);
969
971
  }
970
- async set(key, value) {
971
- this.cache.set(key, value);
972
- // Save to localStorage as a single key
972
+ async set(keyOrValues, value) {
973
+ if (typeof keyOrValues === 'string') {
974
+ // Single value update
975
+ this.cache.set(keyOrValues, value);
976
+ }
977
+ else {
978
+ // Bulk update
979
+ for (const [key, val] of Object.entries(keyOrValues)) {
980
+ this.cache.set(key, val);
981
+ }
982
+ }
983
+ await this.saveToLocalStorage();
984
+ }
985
+ async saveToLocalStorage() {
973
986
  const settingsObject = {};
974
- this.cache.forEach((val, k) => {
975
- settingsObject[k] = val;
987
+ this.cache.forEach((value, key) => {
988
+ settingsObject[key] = value;
976
989
  });
977
990
  localStorage.setItem(this.localStorageKey, JSON.stringify(settingsObject));
978
991
  }
979
992
  }
980
993
 
981
- class AXPSettingsService {
994
+ class AXPSettingValueProviderService {
982
995
  constructor() {
983
- this.settingsProvider = inject(AXP_SETTINGS_PROVIDER);
996
+ this.settingsProvider = inject(AXP_SETTING_VALUE_PROVIDER);
984
997
  this.settingsCache = new Map();
985
- this.changed = new Subject();
998
+ this.onChanged = new Subject();
986
999
  }
987
1000
  async load() {
988
1001
  try {
@@ -1004,22 +1017,45 @@ class AXPSettingsService {
1004
1017
  }
1005
1018
  return cloneDeep(this.settingsCache.get(key));
1006
1019
  }
1007
- async set(key, value) {
1008
- if (this.settingsCache.has(key)) {
1020
+ async all() {
1021
+ if (this.settingsCache.size == 0) {
1022
+ await this.load();
1023
+ }
1024
+ return Object.fromEntries(this.settingsCache);
1025
+ }
1026
+ // Implementation
1027
+ async set(keyOrValues, value) {
1028
+ const changes = {};
1029
+ if (typeof keyOrValues === 'string') {
1030
+ // Single value update
1031
+ const key = keyOrValues;
1009
1032
  this.settingsCache.set(key, value);
1010
- await this.settingsProvider.set(key, value);
1011
- this.changed.next({ key, value });
1033
+ changes[key] = value;
1034
+ await this.settingsProvider.set(key, value); // Call single update
1012
1035
  }
1013
1036
  else {
1014
- console.warn(`Setting with key "${key}" not found.`);
1015
- this.settingsCache.set(key, value);
1016
- this.set(key, value);
1037
+ // Bulk update
1038
+ const values = keyOrValues;
1039
+ for (const [key, val] of Object.entries(values)) {
1040
+ this.settingsCache.set(key, val);
1041
+ changes[key] = val;
1042
+ }
1043
+ await this.settingsProvider.set(values); // Call bulk update
1017
1044
  }
1045
+ // Prepare the detailed change event
1046
+ const keys = Object.keys(changes);
1047
+ const entries = Array.from(this.settingsCache.entries()).map(([key, value]) => ({ key, value }));
1048
+ // Emit the enhanced onChanged event
1049
+ this.onChanged.next({
1050
+ keys,
1051
+ values: changes,
1052
+ entries,
1053
+ });
1018
1054
  }
1019
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1020
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingsService, providedIn: 'root' }); }
1055
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingValueProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1056
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingValueProviderService, providedIn: 'root' }); }
1021
1057
  }
1022
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingsService, decorators: [{
1058
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPSettingValueProviderService, decorators: [{
1023
1059
  type: Injectable,
1024
1060
  args: [{
1025
1061
  providedIn: 'root',
@@ -1047,12 +1083,12 @@ class AXPCommonEffects {
1047
1083
  return of();
1048
1084
  })), { dispatch: false });
1049
1085
  }
1050
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCommonEffects, deps: [{ token: i1.Actions }, { token: i2.Router }, { token: AXPSettingsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1086
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCommonEffects, deps: [{ token: i1.Actions }, { token: i2.Router }, { token: AXPSettingValueProviderService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1051
1087
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCommonEffects }); }
1052
1088
  }
1053
1089
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCommonEffects, decorators: [{
1054
1090
  type: Injectable
1055
- }], ctorParameters: () => [{ type: i1.Actions }, { type: i2.Router }, { type: AXPSettingsService }] });
1091
+ }], ctorParameters: () => [{ type: i1.Actions }, { type: i2.Router }, { type: AXPSettingValueProviderService }] });
1056
1092
 
1057
1093
  //TODO Loading, Redirect, Drawer, Show toast
1058
1094
  const AXPRedirectEvent = createWorkFlowEvent('Redirect Event Fired');
@@ -1208,7 +1244,7 @@ class AXPCommonModule {
1208
1244
  },
1209
1245
  });
1210
1246
  }
1211
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCommonModule, deps: [{ token: 'AXPCommonModuleFactory' }, { token: AXPAppStartUpService }, { token: AXPSettingsService }, { token: AXPDataSeederService }], target: i0.ɵɵFactoryTarget.NgModule }); }
1247
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPCommonModule, deps: [{ token: 'AXPCommonModuleFactory' }, { token: AXPAppStartUpService }, { token: AXPSettingValueProviderService }, { token: AXPDataSeederService }], target: i0.ɵɵFactoryTarget.NgModule }); }
1212
1248
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.3", ngImport: i0, type: AXPCommonModule, imports: [i1.EffectsFeatureModule, i5.AXPWorkflowModule, AXPopupModule,
1213
1249
  AXDateTimeModule,
1214
1250
  AXToastModule], exports: [RouterModule] }); }
@@ -1274,7 +1310,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
1274
1310
  }], ctorParameters: () => [{ type: undefined, decorators: [{
1275
1311
  type: Inject,
1276
1312
  args: ['AXPCommonModuleFactory']
1277
- }] }, { type: AXPAppStartUpService }, { type: AXPSettingsService }, { type: AXPDataSeederService }] });
1313
+ }] }, { type: AXPAppStartUpService }, { type: AXPSettingValueProviderService }, { type: AXPDataSeederService }] });
1278
1314
 
1279
1315
  class AXPTextLogoConfig {
1280
1316
  constructor(text) {
@@ -1386,9 +1422,11 @@ class AXPStickyDirective {
1386
1422
  get isSticky() {
1387
1423
  return this._isSticky;
1388
1424
  }
1389
- set isSticky(v) {
1390
- this._isSticky = v;
1391
- this.isStickyChange.emit(v);
1425
+ set isSticky(value) {
1426
+ if (this._isSticky !== value) {
1427
+ this._isSticky = value;
1428
+ this.isStickyChange.emit(value);
1429
+ }
1392
1430
  }
1393
1431
  constructor(element, renderer, zone, cdr) {
1394
1432
  this.element = element;
@@ -1400,43 +1438,70 @@ class AXPStickyDirective {
1400
1438
  this._isSticky = false;
1401
1439
  this.onParentScroll = () => {
1402
1440
  this.zone.runOutsideAngular(() => {
1403
- const scrollPosition = this.parentElement === window
1441
+ const scrollTop = this.parentElement === window
1404
1442
  ? window.scrollY
1405
- : this.parentElement.scrollTop + this.targetElement.offsetTop;
1406
- if (scrollPosition - this.stickyOffset >= this.topOffset && !this.isSticky) {
1407
- this.isSticky = true;
1408
- this.stickyClass.split(' ').forEach((c) => {
1409
- if (c) {
1410
- this.renderer.addClass(this.targetElement, c);
1411
- }
1443
+ : this.parentElement.scrollTop;
1444
+ const shouldStick = scrollTop + this.stickyOffset >= this.topOffset;
1445
+ if (shouldStick !== this.isSticky) {
1446
+ this.zone.run(() => {
1447
+ this.isSticky = shouldStick;
1448
+ this.toggleStickyClasses(shouldStick);
1449
+ this.cdr.markForCheck();
1412
1450
  });
1413
- this.cdr.markForCheck();
1414
- }
1415
- else if (scrollPosition <= this.topOffset && this.isSticky) {
1416
- this.stickyClass.split(' ').forEach((c) => {
1417
- if (c) {
1418
- this.renderer.removeClass(this.targetElement, c);
1419
- }
1420
- });
1421
- this.isSticky = false;
1422
- this.cdr.markForCheck();
1423
1451
  }
1424
1452
  });
1425
1453
  };
1426
1454
  }
1427
1455
  ngAfterViewInit() {
1456
+ this.initSticky();
1457
+ // Add mutation observer for dynamic content
1458
+ this.mutationObserver = new MutationObserver(() => {
1459
+ this.updateTopOffset();
1460
+ });
1461
+ this.mutationObserver.observe(this.element.nativeElement, {
1462
+ childList: true,
1463
+ subtree: true,
1464
+ });
1465
+ // Add resize event listener
1466
+ window.addEventListener('resize', this.updateTopOffset.bind(this));
1467
+ }
1468
+ initSticky() {
1428
1469
  if (this.stickyParent instanceof HTMLElement) {
1429
1470
  this.parentElement = this.stickyParent;
1430
1471
  }
1431
1472
  else {
1432
- this.parentElement = document.querySelector(this.stickyParent) || window;
1473
+ this.parentElement =
1474
+ document.querySelector(this.stickyParent) || window;
1433
1475
  }
1434
- this.targetElement = document.querySelector(this.stickyTarget) || this.element.nativeElement;
1435
- this.topOffset = this.targetElement.offsetTop;
1436
- this.parentElement.addEventListener('scroll', this.onParentScroll.bind(this));
1476
+ this.targetElement =
1477
+ document.querySelector(this.stickyTarget) ||
1478
+ this.element.nativeElement;
1479
+ this.updateTopOffset();
1480
+ this.parentElement.addEventListener('scroll', this.onParentScroll);
1481
+ }
1482
+ updateTopOffset() {
1483
+ this.zone.runOutsideAngular(() => {
1484
+ const rect = this.targetElement.getBoundingClientRect();
1485
+ this.topOffset = rect.top + (window.scrollY || 0);
1486
+ });
1487
+ }
1488
+ toggleStickyClasses(isSticky) {
1489
+ const classes = this.stickyClass.split(' ').filter(Boolean);
1490
+ classes.forEach((className) => {
1491
+ if (isSticky) {
1492
+ this.renderer.addClass(this.targetElement, className);
1493
+ }
1494
+ else {
1495
+ this.renderer.removeClass(this.targetElement, className);
1496
+ }
1497
+ });
1437
1498
  }
1438
1499
  ngOnDestroy() {
1439
1500
  this.parentElement.removeEventListener('scroll', this.onParentScroll);
1501
+ window.removeEventListener('resize', this.updateTopOffset.bind(this));
1502
+ if (this.mutationObserver) {
1503
+ this.mutationObserver.disconnect();
1504
+ }
1440
1505
  }
1441
1506
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.3", ngImport: i0, type: AXPStickyDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1442
1507
  static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.3", type: AXPStickyDirective, isStandalone: true, selector: "[axpSticky]", inputs: { stickyClass: ["axpSticky", "stickyClass"], stickyOffset: "stickyOffset", stickyParent: "stickyParent", stickyTarget: "stickyTarget" }, outputs: { isStickyChange: "isStickyChange" }, exportAs: ["axpSticky"], ngImport: i0 }); }
@@ -3085,5 +3150,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.3", ngImpor
3085
3150
  * Generated bundle index. Do not edit.
3086
3151
  */
3087
3152
 
3088
- export { ALL_DEFAULT_OPERATORS, AXEntityLoaderDefault, AXMEntityCrudService, AXMEntityCrudServiceImpl, AXMWorkflowErrorHandler, AXPAppStartUpProvider, AXPAppStartUpService, AXPClipBoardService, AXPCommonEffects, AXPCommonModule, AXPCommonWidgetModule, AXPComponentLogoConfig, AXPComponentSlotDirective, AXPComponentSlotLoaderService, AXPComponentSlotModule, AXPComponentSlotRegistryService, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataGenerator, AXPDataProvider, AXPDataSeederService, AXPDexieEntityStorageService, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityDataProvider, AXPEntityDataProviderImpl, AXPEntityListViewConfigEmpty, AXPEntityQueryType, AXPEntityRegistryService, AXPEntityStorageService, AXPErrorHandlerRegistryService, AXPFilterOperatorMiddlewareService, AXPFilterOperatorMiddlewareServiceImpl, AXPFontIconLogoConfig, AXPFooterTextSlotComponent, AXPGlobalErrorHandler, AXPGridLayoutDirective, AXPImageUrlLogoConfig, AXPLogoComponent, AXPMenuProviderService, AXPMenuService, AXPNavBarSlotComponent, AXPNavigateAction, AXPPdfPageSize, AXPPdfService, AXPPlatformDefaultConfigs, AXPRedirectEvent, AXPRelationshipCardinality, AXPRelationshipKind, AXPSchemaModule, AXPSchemaRegistryService, AXPSettingDefinitionProviderService, AXPSettingsService, AXPSignInAction, AXPSignOutAction, AXPStickyDirective, AXPTextLogoConfig, AXPToastAction, AXPWidgetBase, AXPWidgetColumnRendererComponent, AXPWidgetEditBase, AXPWidgetFilterBase, AXPWidgetFilterRendererComponent, AXPWidgetRendererComponent, AXPWorkflowNavigateAction, AXP_DATA_SEEDER_TOKEN, AXP_ENTITY_LOADER, AXP_MENU_PROVIDER, AXP_PLATFORM_CONFIG_TOKEN, AXP_ROOT_CONFIG_TOKEN, AXP_SETTINGS_PROVIDER, AXP_SETTING_PROVIDER, AXP_WIDGET_TOKEN, BETWEEN_OPER, BOOLEAN_OPERATORS, CONTAINS_OPER, DATE_OPERATORS, ENDS_WITH_OPER, ENVIRONMENT, EQ_OPER, GTE_OPER, GT_OPER, IS_EMPTY_OPER, IS_NOT_EMPTY_OPER, LTE_OPER, LT_OPER, NOT_CONTAINS_OPER, NOT_EQ_OPER, NUMBER_OPERATORS, STARTS_WITH_OPER, STRING_OPERATORS, configPlatform, convertPropertiesToColumns, convertPropertyToColumn, getEntityInfo, resolveActionLook, widgetSchemas };
3153
+ export { ALL_DEFAULT_OPERATORS, AXEntityLoaderDefault, AXMEntityCrudService, AXMEntityCrudServiceImpl, AXMWorkflowErrorHandler, AXPAppStartUpProvider, AXPAppStartUpService, AXPClipBoardService, AXPCommonEffects, AXPCommonModule, AXPCommonWidgetModule, AXPComponentLogoConfig, AXPComponentSlotDirective, AXPComponentSlotLoaderService, AXPComponentSlotModule, AXPComponentSlotRegistryService, AXPCustomOperatorService, AXPCustomOperatorServiceImpl, AXPDataGenerator, AXPDataProvider, AXPDataSeederService, AXPDexieEntityStorageService, AXPDialogConfirmAction, AXPEntityCommandScope, AXPEntityDataProvider, AXPEntityDataProviderImpl, AXPEntityListViewConfigEmpty, AXPEntityQueryType, AXPEntityRegistryService, AXPEntityStorageService, AXPErrorHandlerRegistryService, AXPFilterOperatorMiddlewareService, AXPFilterOperatorMiddlewareServiceImpl, AXPFontIconLogoConfig, AXPFooterTextSlotComponent, AXPGlobalErrorHandler, AXPGridLayoutDirective, AXPImageUrlLogoConfig, AXPLogoComponent, AXPMenuProviderService, AXPMenuService, AXPNavBarSlotComponent, AXPNavigateAction, AXPPdfPageSize, AXPPdfService, AXPPlatformDefaultConfigs, AXPRedirectEvent, AXPRelationshipCardinality, AXPRelationshipKind, AXPSchemaModule, AXPSchemaRegistryService, AXPSettingDefinitionGroupBuilder, AXPSettingDefinitionProviderContext, AXPSettingDefinitionProviderService, AXPSettingDefinitionSectionBuilder, AXPSettingValueProviderService, AXPSignInAction, AXPSignOutAction, AXPStickyDirective, AXPTextLogoConfig, AXPToastAction, AXPWidgetBase, AXPWidgetColumnRendererComponent, AXPWidgetEditBase, AXPWidgetFilterBase, AXPWidgetFilterRendererComponent, AXPWidgetRendererComponent, AXPWorkflowNavigateAction, AXP_DATA_SEEDER_TOKEN, AXP_ENTITY_LOADER, AXP_MENU_PROVIDER, AXP_PLATFORM_CONFIG_TOKEN, AXP_ROOT_CONFIG_TOKEN, AXP_SETTING_DEFINITION_PROVIDER, AXP_SETTING_VALUE_PROVIDER, AXP_WIDGET_TOKEN, BETWEEN_OPER, BOOLEAN_OPERATORS, CONTAINS_OPER, DATE_OPERATORS, ENDS_WITH_OPER, ENVIRONMENT, EQ_OPER, GTE_OPER, GT_OPER, IS_EMPTY_OPER, IS_NOT_EMPTY_OPER, LTE_OPER, LT_OPER, NOT_CONTAINS_OPER, NOT_EQ_OPER, NUMBER_OPERATORS, STARTS_WITH_OPER, STRING_OPERATORS, configPlatform, convertPropertiesToColumns, convertPropertyToColumn, getEntityInfo, resolveActionLook, widgetSchemas };
3089
3154
  //# sourceMappingURL=acorex-platform-common.mjs.map