@igo2/common 16.1.1 → 16.3.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 (31) hide show
  1. package/esm2022/lib/backdrop/backdrop.component.mjs +1 -1
  2. package/esm2022/lib/clickout/clickout.directive.mjs +1 -1
  3. package/esm2022/lib/collapsible/index.mjs +1 -1
  4. package/esm2022/lib/context-menu/index.mjs +1 -1
  5. package/esm2022/lib/custom-html/custom-html.component.mjs +1 -1
  6. package/esm2022/lib/custom-html/index.mjs +1 -1
  7. package/esm2022/lib/entity/index.mjs +1 -1
  8. package/esm2022/lib/entity/shared/index.mjs +1 -2
  9. package/esm2022/lib/entity/shared/store.mjs +67 -1
  10. package/esm2022/lib/entity/shared/strategies/strategy.mjs +1 -1
  11. package/esm2022/lib/form/form-field/index.mjs +1 -1
  12. package/esm2022/lib/form/index.mjs +1 -1
  13. package/esm2022/lib/image/index.mjs +1 -1
  14. package/esm2022/lib/json-dialog/json-dialog.component.mjs +1 -1
  15. package/esm2022/lib/keyvalue/keyvalue.pipe.mjs +1 -1
  16. package/esm2022/lib/list/index.mjs +1 -1
  17. package/esm2022/lib/spinner/index.mjs +1 -1
  18. package/esm2022/lib/stop-propagation/index.mjs +1 -1
  19. package/esm2022/lib/stop-propagation/stop-drop-propagation.directive.mjs +1 -1
  20. package/esm2022/lib/stop-propagation/stop-propagation.directive.mjs +1 -1
  21. package/esm2022/lib/workspace/index.mjs +1 -1
  22. package/esm2022/lib/workspace/shared/workspace.mjs +1 -1
  23. package/fesm2022/igo2-common.mjs +67 -73
  24. package/fesm2022/igo2-common.mjs.map +1 -1
  25. package/lib/entity/shared/index.d.ts +0 -1
  26. package/lib/entity/shared/store.d.ts +33 -0
  27. package/lib/entity/shared/strategies/strategy.d.ts +1 -1
  28. package/lib/workspace/shared/workspace.d.ts +2 -2
  29. package/package.json +4 -4
  30. package/esm2022/lib/entity/shared/store-strategy.mjs +0 -73
  31. package/lib/entity/shared/store-strategy.d.ts +0 -38
@@ -929,6 +929,10 @@ class EntityStore {
929
929
  return this._pristine;
930
930
  }
931
931
  _pristine = true;
932
+ /**
933
+ * Strategies
934
+ */
935
+ strategies = [];
932
936
  constructor(entities, options = {}) {
933
937
  this.getKey = options.getKey ? options.getKey : getEntityId;
934
938
  this.getProperty = options.getProperty
@@ -1031,6 +1035,68 @@ class EntityStore {
1031
1035
  this._pristine = false;
1032
1036
  this.next();
1033
1037
  }
1038
+ /**
1039
+ * Add a strategy to this store
1040
+ * @param strategy Entity store strategy
1041
+ * @returns Entity store
1042
+ */
1043
+ addStrategy(strategy, activate = false) {
1044
+ const existingStrategy = this.strategies.find((_strategy) => {
1045
+ return strategy.constructor === _strategy.constructor;
1046
+ });
1047
+ if (existingStrategy !== undefined) {
1048
+ throw new Error('A strategy of this type already exists on that EntityStore.');
1049
+ }
1050
+ this.strategies.push(strategy);
1051
+ strategy.bindStore(this);
1052
+ if (activate === true) {
1053
+ strategy.activate();
1054
+ }
1055
+ return this;
1056
+ }
1057
+ /**
1058
+ * Remove a strategy from this store
1059
+ * @param strategy Entity store strategy
1060
+ * @returns Entity store
1061
+ */
1062
+ removeStrategy(strategy) {
1063
+ const index = this.strategies.indexOf(strategy);
1064
+ if (index >= 0) {
1065
+ this.strategies.splice(index, 1);
1066
+ strategy.unbindStore(this);
1067
+ }
1068
+ return this;
1069
+ }
1070
+ /**
1071
+ * Return strategies of a given type
1072
+ * @param type Entity store strategy class
1073
+ * @returns Strategies
1074
+ */
1075
+ getStrategyOfType(type) {
1076
+ return this.strategies.find((strategy) => {
1077
+ return strategy instanceof type;
1078
+ });
1079
+ }
1080
+ /**
1081
+ * Activate strategies of a given type
1082
+ * @param type Entity store strategy class
1083
+ */
1084
+ activateStrategyOfType(type) {
1085
+ const strategy = this.getStrategyOfType(type);
1086
+ if (strategy !== undefined) {
1087
+ strategy.activate();
1088
+ }
1089
+ }
1090
+ /**
1091
+ * Deactivate strategies of a given type
1092
+ * @param type Entity store strategy class
1093
+ */
1094
+ deactivateStrategyOfType(type) {
1095
+ const strategy = this.getStrategyOfType(type);
1096
+ if (strategy !== undefined) {
1097
+ strategy.deactivate();
1098
+ }
1099
+ }
1034
1100
  /**
1035
1101
  * Delete an entity from the store
1036
1102
  * @param entity Entity
@@ -1123,78 +1189,6 @@ class EntityStore {
1123
1189
  }
1124
1190
  }
1125
1191
 
1126
- class EntityStoreWithStrategy extends EntityStore {
1127
- /**
1128
- * Strategies
1129
- */
1130
- strategies = [];
1131
- constructor(entities, options = {}) {
1132
- super(entities, options);
1133
- }
1134
- /**
1135
- * Add a strategy to this store
1136
- * @param strategy Entity store strategy
1137
- * @returns Entity store
1138
- */
1139
- addStrategy(strategy, activate = false) {
1140
- const existingStrategy = this.strategies.find((_strategy) => {
1141
- return strategy.constructor === _strategy.constructor;
1142
- });
1143
- if (existingStrategy !== undefined) {
1144
- throw new Error('A strategy of this type already exists on that EntityStore.');
1145
- }
1146
- this.strategies.push(strategy);
1147
- strategy.bindStore(this);
1148
- if (activate === true) {
1149
- strategy.activate();
1150
- }
1151
- return this;
1152
- }
1153
- /**
1154
- * Remove a strategy from this store
1155
- * @param strategy Entity store strategy
1156
- * @returns Entity store
1157
- */
1158
- removeStrategy(strategy) {
1159
- const index = this.strategies.indexOf(strategy);
1160
- if (index >= 0) {
1161
- this.strategies.splice(index, 1);
1162
- strategy.unbindStore(this);
1163
- }
1164
- return this;
1165
- }
1166
- /**
1167
- * Return strategies of a given type
1168
- * @param type Entity store strategy class
1169
- * @returns Strategies
1170
- */
1171
- getStrategyOfType(type) {
1172
- return this.strategies.find((strategy) => {
1173
- return strategy instanceof type;
1174
- });
1175
- }
1176
- /**
1177
- * Activate strategies of a given type
1178
- * @param type Entity store strategy class
1179
- */
1180
- activateStrategyOfType(type) {
1181
- const strategy = this.getStrategyOfType(type);
1182
- if (strategy !== undefined) {
1183
- strategy.activate();
1184
- }
1185
- }
1186
- /**
1187
- * Deactivate strategies of a given type
1188
- * @param type Entity store strategy class
1189
- */
1190
- deactivateStrategyOfType(type) {
1191
- const strategy = this.getStrategyOfType(type);
1192
- if (strategy !== undefined) {
1193
- strategy.deactivate();
1194
- }
1195
- }
1196
- }
1197
-
1198
1192
  /**
1199
1193
  * This class is used to synchronize a component's changes
1200
1194
  * detection with an EntityStore changes. For example, it is frequent
@@ -8771,5 +8765,5 @@ class Widget extends DynamicComponent {
8771
8765
  * Generated bundle index. Do not edit.
8772
8766
  */
8773
8767
 
8774
- export { ActionStore, ActionbarComponent, ActionbarMode, BackdropComponent, ClickoutDirective, ClonePipe, CollapseDirective, CollapsibleComponent, ColorPickerFormFieldComponent, ColorPickerFormFieldModule, ConfirmDialogComponent, ConfirmDialogService, ContextMenuDirective, CustomHtmlComponent, DOMService, DragAndDropDirective, DynamicComponent, DynamicComponentService, DynamicOutletComponent, EntityOperationType, EntitySelectorComponent, EntityStateManager, EntityStore, EntityStoreFilterCustomFuncStrategy, EntityStoreFilterSelectionStrategy, EntityStoreStrategy, EntityStoreWatcher, EntityStoreWithStrategy, EntityTableColumnRenderer, EntityTableComponent, EntityTablePaginatorComponent, EntityTableScrollBehavior, EntityTableSelectionState, EntityTransaction, EntityView, FlexibleComponent, FormComponent, FormDialogComponent, FormDialogService, FormFieldComponent, FormFieldSelectComponent, FormFieldService, FormFieldTextComponent, FormFieldTextareaComponent, FormGroupComponent, FormService, HomeButtonComponent, IgoActionModule, IgoActionbarModule, IgoBackdropModule, IgoBadgeIconDirective, IgoClickoutModule, IgoCloneModule, IgoCollapsibleModule, IgoConfirmDialogModule, IgoContextMenuModule, IgoCustomHtmlModule, IgoDOMModule, IgoDrapDropModule, IgoDynamicComponentModule, IgoDynamicOutletModule, IgoEntityModule, IgoEntitySelectorModule, IgoEntityTableModule, IgoEntityTablePaginatorModule, IgoFlexibleModule, IgoFormDialogModule, IgoFormFieldComponent, IgoFormFieldModule, IgoFormFormModule, IgoFormGroupModule, IgoFormModule, IgoHomeButtonModule, IgoImageModule, IgoInteractiveTourModule, IgoJsonDialogModule, IgoKeyValueModule, IgoListModule, IgoMatBadgeIconModule, IgoPanelModule, IgoSelectValueDialogModule, IgoSidenavModule, IgoSpinnerModule, IgoStopPropagationModule, IgoTableModule, IgoToolModule, IgoToolboxModule, IgoWidgetModule, IgoWidgetOutletModule, IgoWorkspaceModule, IgoWorkspaceSelectorModule, IgoWorkspaceWidgetOutletModule, ImageErrorDirective, InteractiveTourComponent, InteractiveTourLoader, InteractiveTourService, JsonDialogComponent, JsonDialogService, KeyValuePipe, ListComponent, ListItemDirective, LongPressDirective, PanelComponent, SanitizeHtmlPipe, SecureImagePipe, SelectValueCheckRadioDialogComponent, SelectValueDialogService, SelectValueDialogType, SidenavShimDirective, SpinnerActivityDirective, SpinnerComponent, StopDropPropagationDirective, StopPropagationDirective, TableActionColor, TableComponent, TableDataSource, TableDatabase, ToolComponent, ToolService, Toolbox, ToolboxColor, ToolboxComponent, Widget, WidgetOutletComponent, WidgetService, Workspace, WorkspaceSelectorComponent, WorkspaceStore, WorkspaceWidgetOutletComponent, formControlIsRequired, getAllFormFields, getControlErrorMessage, getDefaultErrorMessages, getEntityIcon, getEntityId, getEntityProperty, getEntityRevision, getEntityTitle, getEntityTitleHtml, getFormFieldByName };
8768
+ export { ActionStore, ActionbarComponent, ActionbarMode, BackdropComponent, ClickoutDirective, ClonePipe, CollapseDirective, CollapsibleComponent, ColorPickerFormFieldComponent, ColorPickerFormFieldModule, ConfirmDialogComponent, ConfirmDialogService, ContextMenuDirective, CustomHtmlComponent, DOMService, DragAndDropDirective, DynamicComponent, DynamicComponentService, DynamicOutletComponent, EntityOperationType, EntitySelectorComponent, EntityStateManager, EntityStore, EntityStoreFilterCustomFuncStrategy, EntityStoreFilterSelectionStrategy, EntityStoreStrategy, EntityStoreWatcher, EntityTableColumnRenderer, EntityTableComponent, EntityTablePaginatorComponent, EntityTableScrollBehavior, EntityTableSelectionState, EntityTransaction, EntityView, FlexibleComponent, FormComponent, FormDialogComponent, FormDialogService, FormFieldComponent, FormFieldSelectComponent, FormFieldService, FormFieldTextComponent, FormFieldTextareaComponent, FormGroupComponent, FormService, HomeButtonComponent, IgoActionModule, IgoActionbarModule, IgoBackdropModule, IgoBadgeIconDirective, IgoClickoutModule, IgoCloneModule, IgoCollapsibleModule, IgoConfirmDialogModule, IgoContextMenuModule, IgoCustomHtmlModule, IgoDOMModule, IgoDrapDropModule, IgoDynamicComponentModule, IgoDynamicOutletModule, IgoEntityModule, IgoEntitySelectorModule, IgoEntityTableModule, IgoEntityTablePaginatorModule, IgoFlexibleModule, IgoFormDialogModule, IgoFormFieldComponent, IgoFormFieldModule, IgoFormFormModule, IgoFormGroupModule, IgoFormModule, IgoHomeButtonModule, IgoImageModule, IgoInteractiveTourModule, IgoJsonDialogModule, IgoKeyValueModule, IgoListModule, IgoMatBadgeIconModule, IgoPanelModule, IgoSelectValueDialogModule, IgoSidenavModule, IgoSpinnerModule, IgoStopPropagationModule, IgoTableModule, IgoToolModule, IgoToolboxModule, IgoWidgetModule, IgoWidgetOutletModule, IgoWorkspaceModule, IgoWorkspaceSelectorModule, IgoWorkspaceWidgetOutletModule, ImageErrorDirective, InteractiveTourComponent, InteractiveTourLoader, InteractiveTourService, JsonDialogComponent, JsonDialogService, KeyValuePipe, ListComponent, ListItemDirective, LongPressDirective, PanelComponent, SanitizeHtmlPipe, SecureImagePipe, SelectValueCheckRadioDialogComponent, SelectValueDialogService, SelectValueDialogType, SidenavShimDirective, SpinnerActivityDirective, SpinnerComponent, StopDropPropagationDirective, StopPropagationDirective, TableActionColor, TableComponent, TableDataSource, TableDatabase, ToolComponent, ToolService, Toolbox, ToolboxColor, ToolboxComponent, Widget, WidgetOutletComponent, WidgetService, Workspace, WorkspaceSelectorComponent, WorkspaceStore, WorkspaceWidgetOutletComponent, formControlIsRequired, getAllFormFields, getControlErrorMessage, getDefaultErrorMessages, getEntityIcon, getEntityId, getEntityProperty, getEntityRevision, getEntityTitle, getEntityTitleHtml, getFormFieldByName };
8775
8769
  //# sourceMappingURL=igo2-common.mjs.map