@umbraco-cms/backoffice 14.0.0--preview004-e1502383 → 14.0.0--preview004-ad35ba20
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.
- package/dist-cms/libs/observable-api/index.d.ts +3 -13
- package/dist-cms/libs/observable-api/index.js +3 -13
- package/dist-cms/libs/observable-api/{array-state.d.ts → states/array-state.d.ts} +2 -2
- package/dist-cms/libs/observable-api/{array-state.js → states/array-state.js} +14 -14
- package/dist-cms/libs/observable-api/{basic-state.d.ts → states/basic-state.d.ts} +1 -1
- package/dist-cms/libs/observable-api/{basic-state.js → states/basic-state.js} +1 -1
- package/dist-cms/libs/observable-api/{deep-state.d.ts → states/deep-state.d.ts} +2 -2
- package/dist-cms/libs/observable-api/{deep-state.js → states/deep-state.js} +3 -3
- package/dist-cms/libs/observable-api/states/index.d.ts +8 -0
- package/dist-cms/libs/observable-api/states/index.js +8 -0
- package/dist-cms/libs/observable-api/types/index.d.ts +2 -0
- package/dist-cms/libs/observable-api/types/index.js +2 -0
- package/dist-cms/libs/observable-api/{create-observable-part.function.d.ts → utils/create-observable-part.function.d.ts} +3 -3
- package/dist-cms/libs/observable-api/{create-observable-part.function.js → utils/create-observable-part.function.js} +2 -2
- package/dist-cms/libs/observable-api/{default-memoization.js → utils/default-memoization.function.js} +1 -1
- package/dist-cms/libs/observable-api/utils/index.d.ts +8 -0
- package/dist-cms/libs/observable-api/utils/index.js +8 -0
- package/dist-cms/packages/core/store/store-base.js +3 -3
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- /package/dist-cms/libs/observable-api/{boolean-state.d.ts → states/boolean-state.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{boolean-state.js → states/boolean-state.js} +0 -0
- /package/dist-cms/libs/observable-api/{class-state.d.ts → states/class-state.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{class-state.js → states/class-state.js} +0 -0
- /package/dist-cms/libs/observable-api/{number-state.d.ts → states/number-state.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{number-state.js → states/number-state.js} +0 -0
- /package/dist-cms/libs/observable-api/{object-state.d.ts → states/object-state.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{object-state.js → states/object-state.js} +0 -0
- /package/dist-cms/libs/observable-api/{string-state.d.ts → states/string-state.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{string-state.js → states/string-state.js} +0 -0
- /package/dist-cms/libs/observable-api/{mapping-function.d.ts → types/mapping-function.type.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{mapping-function.js → types/mapping-function.type.js} +0 -0
- /package/dist-cms/libs/observable-api/{memoization-function.d.ts → types/memoization-function.type.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{memoization-function.js → types/memoization-function.type.js} +0 -0
- /package/dist-cms/libs/observable-api/{append-to-frozen-array.function.d.ts → utils/append-to-frozen-array.function.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{append-to-frozen-array.function.js → utils/append-to-frozen-array.function.js} +0 -0
- /package/dist-cms/libs/observable-api/{deep-freeze.function.d.ts → utils/deep-freeze.function.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{deep-freeze.function.js → utils/deep-freeze.function.js} +0 -0
- /package/dist-cms/libs/observable-api/{default-memoization.d.ts → utils/default-memoization.function.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{filter-frozen-array.function.d.ts → utils/filter-frozen-array.function.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{filter-frozen-array.function.js → utils/filter-frozen-array.function.js} +0 -0
- /package/dist-cms/libs/observable-api/{naive-object-comparison.d.ts → utils/naive-object-comparison.function.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{naive-object-comparison.js → utils/naive-object-comparison.function.js} +0 -0
- /package/dist-cms/libs/observable-api/{partial-update-frozen-array.function.d.ts → utils/partial-update-frozen-array.function.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{partial-update-frozen-array.function.js → utils/partial-update-frozen-array.function.js} +0 -0
- /package/dist-cms/libs/observable-api/{push-to-unique-array.function.d.ts → utils/push-to-unique-array.function.d.ts} +0 -0
- /package/dist-cms/libs/observable-api/{push-to-unique-array.function.js → utils/push-to-unique-array.function.js} +0 -0
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
export * from './observer.controller.js';
|
|
2
2
|
export * from './observer.js';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './string-state.js';
|
|
7
|
-
export * from './class-state.js';
|
|
8
|
-
export * from './deep-state.js';
|
|
9
|
-
export * from './array-state.js';
|
|
10
|
-
export * from './object-state.js';
|
|
11
|
-
export * from './create-observable-part.function.js';
|
|
12
|
-
export * from './append-to-frozen-array.function.js';
|
|
13
|
-
export * from './filter-frozen-array.function.js';
|
|
14
|
-
export * from './partial-update-frozen-array.function.js';
|
|
15
|
-
export * from './mapping-function.js';
|
|
3
|
+
export * from './states/index.js';
|
|
4
|
+
export * from './types/index.js';
|
|
5
|
+
export * from './utils/index.js';
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
export * from './observer.controller.js';
|
|
2
2
|
export * from './observer.js';
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './string-state.js';
|
|
7
|
-
export * from './class-state.js';
|
|
8
|
-
export * from './deep-state.js';
|
|
9
|
-
export * from './array-state.js';
|
|
10
|
-
export * from './object-state.js';
|
|
11
|
-
export * from './create-observable-part.function.js';
|
|
12
|
-
export * from './append-to-frozen-array.function.js';
|
|
13
|
-
export * from './filter-frozen-array.function.js';
|
|
14
|
-
export * from './partial-update-frozen-array.function.js';
|
|
15
|
-
export * from './mapping-function.js';
|
|
3
|
+
export * from './states/index.js';
|
|
4
|
+
export * from './types/index.js';
|
|
5
|
+
export * from './utils/index.js';
|
|
@@ -10,8 +10,8 @@ import { UmbDeepState } from './deep-state.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class UmbArrayState<T> extends UmbDeepState<T[]> {
|
|
12
12
|
#private;
|
|
13
|
-
readonly
|
|
14
|
-
constructor(initialData: T[],
|
|
13
|
+
readonly getUniqueMethod: (entry: T) => unknown;
|
|
14
|
+
constructor(initialData: T[], getUniqueOfEntryMethod: (entry: T) => unknown);
|
|
15
15
|
/**
|
|
16
16
|
* @method sortBy
|
|
17
17
|
* @param {(a: T, b: T) => number} sortMethod - A method to be used for sorting everytime data is set.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { partialUpdateFrozenArray } from '../utils/partial-update-frozen-array.function.js';
|
|
2
|
+
import { pushToUniqueArray } from '../utils/push-to-unique-array.function.js';
|
|
1
3
|
import { UmbDeepState } from './deep-state.js';
|
|
2
|
-
import { partialUpdateFrozenArray } from './partial-update-frozen-array.function.js';
|
|
3
|
-
import { pushToUniqueArray } from './push-to-unique-array.function.js';
|
|
4
4
|
/**
|
|
5
5
|
* @export
|
|
6
6
|
* @class UmbArrayState
|
|
@@ -12,9 +12,9 @@ import { pushToUniqueArray } from './push-to-unique-array.function.js';
|
|
|
12
12
|
*/
|
|
13
13
|
export class UmbArrayState extends UmbDeepState {
|
|
14
14
|
#sortMethod;
|
|
15
|
-
constructor(initialData,
|
|
15
|
+
constructor(initialData, getUniqueOfEntryMethod) {
|
|
16
16
|
super(initialData);
|
|
17
|
-
this.
|
|
17
|
+
this.getUniqueMethod = getUniqueOfEntryMethod;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* @method sortBy
|
|
@@ -55,12 +55,12 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
55
55
|
*/
|
|
56
56
|
remove(uniques) {
|
|
57
57
|
let next = this.getValue();
|
|
58
|
-
if (this.
|
|
58
|
+
if (this.getUniqueMethod) {
|
|
59
59
|
uniques.forEach((unique) => {
|
|
60
60
|
next = next.filter((x) => {
|
|
61
61
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
62
62
|
// @ts-ignore
|
|
63
|
-
return this.
|
|
63
|
+
return this.getUniqueMethod(x) !== unique;
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
this.next(next);
|
|
@@ -82,11 +82,11 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
82
82
|
*/
|
|
83
83
|
removeOne(unique) {
|
|
84
84
|
let next = this.getValue();
|
|
85
|
-
if (this.
|
|
85
|
+
if (this.getUniqueMethod) {
|
|
86
86
|
next = next.filter((x) => {
|
|
87
87
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
88
88
|
// @ts-ignore
|
|
89
|
-
return this.
|
|
89
|
+
return this.getUniqueMethod(x) !== unique;
|
|
90
90
|
});
|
|
91
91
|
this.next(next);
|
|
92
92
|
}
|
|
@@ -132,8 +132,8 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
132
132
|
*/
|
|
133
133
|
appendOne(entry) {
|
|
134
134
|
const next = [...this.getValue()];
|
|
135
|
-
if (this.
|
|
136
|
-
pushToUniqueArray(next, entry, this.
|
|
135
|
+
if (this.getUniqueMethod) {
|
|
136
|
+
pushToUniqueArray(next, entry, this.getUniqueMethod);
|
|
137
137
|
}
|
|
138
138
|
else {
|
|
139
139
|
next.push(entry);
|
|
@@ -158,10 +158,10 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
158
158
|
* ]);
|
|
159
159
|
*/
|
|
160
160
|
append(entries) {
|
|
161
|
-
if (this.
|
|
161
|
+
if (this.getUniqueMethod) {
|
|
162
162
|
const next = [...this.getValue()];
|
|
163
163
|
entries.forEach((entry) => {
|
|
164
|
-
pushToUniqueArray(next, entry, this.
|
|
164
|
+
pushToUniqueArray(next, entry, this.getUniqueMethod);
|
|
165
165
|
});
|
|
166
166
|
this.next(next);
|
|
167
167
|
}
|
|
@@ -185,10 +185,10 @@ export class UmbArrayState extends UmbDeepState {
|
|
|
185
185
|
* myState.updateOne(2, {value: 'updated-bar'});
|
|
186
186
|
*/
|
|
187
187
|
updateOne(unique, entry) {
|
|
188
|
-
if (!this.
|
|
188
|
+
if (!this.getUniqueMethod) {
|
|
189
189
|
throw new Error("Can't partial update an ArrayState without a getUnique method provided when constructed.");
|
|
190
190
|
}
|
|
191
|
-
this.next(partialUpdateFrozenArray(this.getValue(), entry, (x) => unique === this.
|
|
191
|
+
this.next(partialUpdateFrozenArray(this.getValue(), entry, (x) => unique === this.getUniqueMethod(x)));
|
|
192
192
|
return this;
|
|
193
193
|
}
|
|
194
194
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UmbBasicState } from './basic-state.js';
|
|
2
|
-
import type { MappingFunction } from '
|
|
3
|
-
import type { MemoizationFunction } from '
|
|
2
|
+
import type { MappingFunction } from '../types/mapping-function.type.js';
|
|
3
|
+
import type { MemoizationFunction } from '../types/memoization-function.type.js';
|
|
4
4
|
/**
|
|
5
5
|
* @export
|
|
6
6
|
* @class UmbDeepState
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UmbBasicState } from './basic-state.js';
|
|
2
|
-
import { createObservablePart } from '
|
|
3
|
-
import { deepFreeze } from '
|
|
4
|
-
import { naiveObjectComparison } from '
|
|
2
|
+
import { createObservablePart } from '../utils/create-observable-part.function.js';
|
|
3
|
+
import { deepFreeze } from '../utils/deep-freeze.function.js';
|
|
4
|
+
import { naiveObjectComparison } from '../utils/naive-object-comparison.function.js';
|
|
5
5
|
/**
|
|
6
6
|
* @export
|
|
7
7
|
* @class UmbDeepState
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './basic-state.js';
|
|
2
|
+
export * from './boolean-state.js';
|
|
3
|
+
export * from './number-state.js';
|
|
4
|
+
export * from './string-state.js';
|
|
5
|
+
export * from './class-state.js';
|
|
6
|
+
export * from './deep-state.js';
|
|
7
|
+
export * from './array-state.js';
|
|
8
|
+
export * from './object-state.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './basic-state.js';
|
|
2
|
+
export * from './boolean-state.js';
|
|
3
|
+
export * from './number-state.js';
|
|
4
|
+
export * from './string-state.js';
|
|
5
|
+
export * from './class-state.js';
|
|
6
|
+
export * from './deep-state.js';
|
|
7
|
+
export * from './array-state.js';
|
|
8
|
+
export * from './object-state.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { MemoizationFunction } from '
|
|
2
|
-
import { MappingFunction } from '
|
|
3
|
-
import { Observable } from '
|
|
1
|
+
import { MemoizationFunction } from '../types/memoization-function.type.js';
|
|
2
|
+
import { MappingFunction } from '../types/mapping-function.type.js';
|
|
3
|
+
import { Observable } from '../../../external/rxjs/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* @export
|
|
6
6
|
* @method createObservablePart
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defaultMemoization } from './default-memoization.js';
|
|
2
|
-
import { distinctUntilChanged, map, shareReplay } from '
|
|
1
|
+
import { defaultMemoization } from './default-memoization.function.js';
|
|
2
|
+
import { distinctUntilChanged, map, shareReplay } from '../../../external/rxjs/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* @export
|
|
5
5
|
* @method createObservablePart
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { naiveObjectComparison } from './naive-object-comparison.js';
|
|
1
|
+
import { naiveObjectComparison } from './naive-object-comparison.function.js';
|
|
2
2
|
export function defaultMemoization(previousValue, currentValue) {
|
|
3
3
|
if (typeof previousValue === 'object' && typeof currentValue === 'object') {
|
|
4
4
|
return naiveObjectComparison(previousValue, currentValue);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './append-to-frozen-array.function.js';
|
|
2
|
+
export * from './create-observable-part.function.js';
|
|
3
|
+
export * from './deep-freeze.function.js';
|
|
4
|
+
export * from './default-memoization.function.js';
|
|
5
|
+
export * from './filter-frozen-array.function.js';
|
|
6
|
+
export * from './naive-object-comparison.function.js';
|
|
7
|
+
export * from './partial-update-frozen-array.function.js';
|
|
8
|
+
export * from './push-to-unique-array.function.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './append-to-frozen-array.function.js';
|
|
2
|
+
export * from './create-observable-part.function.js';
|
|
3
|
+
export * from './deep-freeze.function.js';
|
|
4
|
+
export * from './default-memoization.function.js';
|
|
5
|
+
export * from './filter-frozen-array.function.js';
|
|
6
|
+
export * from './naive-object-comparison.function.js';
|
|
7
|
+
export * from './partial-update-frozen-array.function.js';
|
|
8
|
+
export * from './push-to-unique-array.function.js';
|
|
@@ -18,7 +18,7 @@ export class UmbStoreBase extends EventTarget {
|
|
|
18
18
|
*/
|
|
19
19
|
append(item) {
|
|
20
20
|
this._data.append([item]);
|
|
21
|
-
const unique = this._data.
|
|
21
|
+
const unique = this._data.getUniqueMethod(item);
|
|
22
22
|
this.dispatchEvent(new UmbStoreAppendEvent([unique]));
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
@@ -28,7 +28,7 @@ export class UmbStoreBase extends EventTarget {
|
|
|
28
28
|
*/
|
|
29
29
|
appendItems(items) {
|
|
30
30
|
this._data.append(items);
|
|
31
|
-
const uniques = items.map((item) => this._data.
|
|
31
|
+
const uniques = items.map((item) => this._data.getUniqueMethod(item));
|
|
32
32
|
this.dispatchEvent(new UmbStoreAppendEvent(uniques));
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
@@ -66,7 +66,7 @@ export class UmbStoreBase extends EventTarget {
|
|
|
66
66
|
* @memberof UmbStoreBase
|
|
67
67
|
*/
|
|
68
68
|
getItems(uniques) {
|
|
69
|
-
return this._data.getValue().filter((item) => uniques.includes(this._data.
|
|
69
|
+
return this._data.getValue().filter((item) => uniques.includes(this._data.getUniqueMethod(item)));
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Returns an observable of the entire store
|