@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
@@ -2,7 +2,6 @@ export * from './entity.enums';
2
2
  export * from './entity.interfaces';
3
3
  export * from './entity.utils';
4
4
  export * from './store';
5
- export * from './store-strategy';
6
5
  export * from './state';
7
6
  export * from './watcher';
8
7
  export * from './transaction';
@@ -1,6 +1,7 @@
1
1
  import { BehaviorSubject } from 'rxjs';
2
2
  import { EntityKey, EntityRecord, EntityState } from './entity.interfaces';
3
3
  import { EntityStateManager } from './state';
4
+ import type { EntityStoreStrategy } from './strategies/strategy';
4
5
  import { EntityView } from './view';
5
6
  export interface EntityStoreOptions {
6
7
  getKey?: (entity: object) => EntityKey;
@@ -56,6 +57,10 @@ export declare class EntityStore<E extends object = object, S extends EntityStat
56
57
  */
57
58
  get pristine(): boolean;
58
59
  private _pristine;
60
+ /**
61
+ * Strategies
62
+ */
63
+ private strategies;
59
64
  constructor(entities: E[], options?: EntityStoreOptions);
60
65
  /**
61
66
  * Get an entity from the store by key
@@ -104,6 +109,34 @@ export declare class EntityStore<E extends object = object, S extends EntityStat
104
109
  * @param entities Entities
105
110
  */
106
111
  updateMany(entities: E[]): void;
112
+ /**
113
+ * Add a strategy to this store
114
+ * @param strategy Entity store strategy
115
+ * @returns Entity store
116
+ */
117
+ addStrategy(strategy: EntityStoreStrategy, activate?: boolean): EntityStore;
118
+ /**
119
+ * Remove a strategy from this store
120
+ * @param strategy Entity store strategy
121
+ * @returns Entity store
122
+ */
123
+ removeStrategy(strategy: EntityStoreStrategy): EntityStore;
124
+ /**
125
+ * Return strategies of a given type
126
+ * @param type Entity store strategy class
127
+ * @returns Strategies
128
+ */
129
+ getStrategyOfType(type: typeof EntityStoreStrategy): EntityStoreStrategy;
130
+ /**
131
+ * Activate strategies of a given type
132
+ * @param type Entity store strategy class
133
+ */
134
+ activateStrategyOfType(type: typeof EntityStoreStrategy): void;
135
+ /**
136
+ * Deactivate strategies of a given type
137
+ * @param type Entity store strategy class
138
+ */
139
+ deactivateStrategyOfType(type: typeof EntityStoreStrategy): void;
107
140
  /**
108
141
  * Delete an entity from the store
109
142
  * @param entity Entity
@@ -1,6 +1,6 @@
1
1
  import { BehaviorSubject } from 'rxjs';
2
2
  import { EntityStoreStrategyOptions } from '../entity.interfaces';
3
- import { EntityStore } from '../store';
3
+ import type { EntityStore } from '../store';
4
4
  /**
5
5
  * Entity store strategies. They can do pretty much anything during a store's
6
6
  * lifetime. For example, they may act as triggers when something happens.
@@ -1,6 +1,6 @@
1
1
  import { BehaviorSubject } from 'rxjs';
2
2
  import { ActionStore } from '../../action';
3
- import { EntityStoreWithStrategy } from '../../entity';
3
+ import { EntityStore } from '../../entity';
4
4
  import { Widget } from '../../widget';
5
5
  import { WorkspaceOptions } from './workspace.interfaces';
6
6
  /**
@@ -55,7 +55,7 @@ export declare class Workspace<E extends object = object> {
55
55
  /**
56
56
  * Entities store
57
57
  */
58
- get entityStore(): EntityStoreWithStrategy<E>;
58
+ get entityStore(): EntityStore<E>;
59
59
  /**
60
60
  * Actions store (some actions activate a widget)
61
61
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igo2/common",
3
- "version": "16.1.1",
3
+ "version": "16.3.0",
4
4
  "description": "IGO Library",
5
5
  "author": "IGO Community",
6
6
  "keywords": [
@@ -25,7 +25,7 @@
25
25
  "./style": {
26
26
  "style": "./style/style.css"
27
27
  },
28
- "./theming": {
28
+ "./theme": {
29
29
  "sass": "./src/common-theme.scss"
30
30
  },
31
31
  "./partial/*": {
@@ -44,8 +44,8 @@
44
44
  "@angular/material": "^16.2.4",
45
45
  "@angular/platform-browser": "^16.2.5",
46
46
  "@floating-ui/utils": "^0.1.4",
47
- "@igo2/core": "^16.1.1",
48
- "@igo2/utils": "^16.1.1",
47
+ "@igo2/core": "^16.3.0",
48
+ "@igo2/utils": "^16.3.0",
49
49
  "angular-shepherd": "16.0.0",
50
50
  "ngx-color": "^9.0.0",
51
51
  "scroll-into-view-if-needed": "^3.0.0",
@@ -1,73 +0,0 @@
1
- import { EntityStore } from './store';
2
- export class EntityStoreWithStrategy extends EntityStore {
3
- /**
4
- * Strategies
5
- */
6
- strategies = [];
7
- constructor(entities, options = {}) {
8
- super(entities, options);
9
- }
10
- /**
11
- * Add a strategy to this store
12
- * @param strategy Entity store strategy
13
- * @returns Entity store
14
- */
15
- addStrategy(strategy, activate = false) {
16
- const existingStrategy = this.strategies.find((_strategy) => {
17
- return strategy.constructor === _strategy.constructor;
18
- });
19
- if (existingStrategy !== undefined) {
20
- throw new Error('A strategy of this type already exists on that EntityStore.');
21
- }
22
- this.strategies.push(strategy);
23
- strategy.bindStore(this);
24
- if (activate === true) {
25
- strategy.activate();
26
- }
27
- return this;
28
- }
29
- /**
30
- * Remove a strategy from this store
31
- * @param strategy Entity store strategy
32
- * @returns Entity store
33
- */
34
- removeStrategy(strategy) {
35
- const index = this.strategies.indexOf(strategy);
36
- if (index >= 0) {
37
- this.strategies.splice(index, 1);
38
- strategy.unbindStore(this);
39
- }
40
- return this;
41
- }
42
- /**
43
- * Return strategies of a given type
44
- * @param type Entity store strategy class
45
- * @returns Strategies
46
- */
47
- getStrategyOfType(type) {
48
- return this.strategies.find((strategy) => {
49
- return strategy instanceof type;
50
- });
51
- }
52
- /**
53
- * Activate strategies of a given type
54
- * @param type Entity store strategy class
55
- */
56
- activateStrategyOfType(type) {
57
- const strategy = this.getStrategyOfType(type);
58
- if (strategy !== undefined) {
59
- strategy.activate();
60
- }
61
- }
62
- /**
63
- * Deactivate strategies of a given type
64
- * @param type Entity store strategy class
65
- */
66
- deactivateStrategyOfType(type) {
67
- const strategy = this.getStrategyOfType(type);
68
- if (strategy !== undefined) {
69
- strategy.deactivate();
70
- }
71
- }
72
- }
73
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmUtc3RyYXRlZ3kuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21tb24vc3J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3JlIHN0cmF0ZWd5IGNsYXNzXHJcbiAgICovXHJcbiAgZGVhY3RpdmF0ZVN0cmF0ZWd5T2ZUeXBlKHR5cGU6IHR5cGVvZiBFbnRpdHlTdG9yZVN0cmF0ZWd5KSB7XHJcbiAgICBjb25zdCBzdHJhdGVneSA9IHRoaXMuZ2V0U3RyYXRlZ3lPZlR5cGUodHlwZSk7XHJcbiAgICBpZiAoc3RyYXRlZ3kgIT09IHVuZGVmaW5lZCkge1xyXG4gICAgICBzdHJhdGVneS5kZWFjdGl2YXRlKCk7XHJcbiAgICB9XHJcbiAgfVxyXG59XHJcbiJdfQ==
@@ -1,38 +0,0 @@
1
- import { EntityState } from './entity.interfaces';
2
- import { EntityStore, EntityStoreOptions } from './store';
3
- import { EntityStoreStrategy } from './strategies/strategy';
4
- export declare class EntityStoreWithStrategy<E extends object = object, S extends EntityState = EntityState> extends EntityStore<E, S> {
5
- /**
6
- * Strategies
7
- */
8
- private strategies;
9
- constructor(entities: E[], options?: EntityStoreOptions);
10
- /**
11
- * Add a strategy to this store
12
- * @param strategy Entity store strategy
13
- * @returns Entity store
14
- */
15
- addStrategy(strategy: EntityStoreStrategy, activate?: boolean): EntityStore;
16
- /**
17
- * Remove a strategy from this store
18
- * @param strategy Entity store strategy
19
- * @returns Entity store
20
- */
21
- removeStrategy(strategy: EntityStoreStrategy): EntityStore;
22
- /**
23
- * Return strategies of a given type
24
- * @param type Entity store strategy class
25
- * @returns Strategies
26
- */
27
- getStrategyOfType(type: typeof EntityStoreStrategy): EntityStoreStrategy;
28
- /**
29
- * Activate strategies of a given type
30
- * @param type Entity store strategy class
31
- */
32
- activateStrategyOfType(type: typeof EntityStoreStrategy): void;
33
- /**
34
- * Deactivate strategies of a given type
35
- * @param type Entity store strategy class
36
- */
37
- deactivateStrategyOfType(type: typeof EntityStoreStrategy): void;
38
- }