cx 25.5.1 → 25.5.2
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/manifest.js +810 -810
- package/dist/ui.js +0 -15
- package/dist/widgets.js +4 -1
- package/package.json +1 -1
- package/src/data/AugmentedViewBase.js +77 -77
- package/src/data/ExposedRecordView.js +75 -75
- package/src/data/ExposedValueView.js +73 -73
- package/src/ui/Container.js +154 -154
- package/src/ui/DataProxy.js +31 -45
- package/src/ui/DetachedScope.js +98 -98
- package/src/ui/Instance.d.ts +72 -72
- package/src/ui/Instance.js +623 -623
- package/src/ui/IsolatedScope.js +30 -30
- package/src/ui/Repeater.js +109 -109
- package/src/ui/Rescope.js +35 -35
- package/src/ui/Restate.js +167 -167
- package/src/ui/Widget.js +184 -184
- package/src/ui/adapter/ArrayAdapter.js +152 -152
- package/src/ui/adapter/TreeAdapter.js +101 -101
- package/src/ui/layout/exploreChildren.d.ts +12 -12
- package/src/ui/layout/exploreChildren.js +27 -27
- package/src/widgets/List.js +594 -594
- package/src/widgets/form/Checkbox.js +203 -200
- package/src/widgets/grid/Grid.js +3421 -3421
- package/src/widgets/nav/Route.js +102 -102
package/dist/ui.js
CHANGED
|
@@ -2981,21 +2981,6 @@ var DataProxy = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
2981
2981
|
_proto.init = function init() {
|
|
2982
2982
|
if (!this.data) this.data = {};
|
|
2983
2983
|
if (this.alias) this.data[this.alias] = this.value;
|
|
2984
|
-
|
|
2985
|
-
// nesting is required to avoid resetting the store on every render and recalculating the data
|
|
2986
|
-
this.container = PureContainer.create({
|
|
2987
|
-
type: PureContainer,
|
|
2988
|
-
items: this.children || this.items,
|
|
2989
|
-
layout: this.layout,
|
|
2990
|
-
controller: this.controller,
|
|
2991
|
-
outerLayout: this.outerLayout,
|
|
2992
|
-
ws: this.ws,
|
|
2993
|
-
});
|
|
2994
|
-
this.children = [this.container];
|
|
2995
|
-
delete this.items;
|
|
2996
|
-
delete this.controller;
|
|
2997
|
-
delete this.outerLayout;
|
|
2998
|
-
this.layout = UseParentLayout;
|
|
2999
2984
|
_PureContainer.prototype.init.call(this);
|
|
3000
2985
|
};
|
|
3001
2986
|
_proto.initInstance = function initInstance(context, instance) {
|
package/dist/widgets.js
CHANGED
|
@@ -7340,7 +7340,10 @@ var Checkbox = /*#__PURE__*/ (function (_Field) {
|
|
|
7340
7340
|
"label",
|
|
7341
7341
|
{
|
|
7342
7342
|
className: data.classNames,
|
|
7343
|
-
onMouseDown:
|
|
7343
|
+
onMouseDown: function onMouseDown(e) {
|
|
7344
|
+
e.stopPropagation();
|
|
7345
|
+
if (_this.unfocusable) e.preventDefault();
|
|
7346
|
+
},
|
|
7344
7347
|
onMouseMove: function onMouseMove(e) {
|
|
7345
7348
|
return tooltipMouseMove$1.apply(void 0, [e].concat(getFieldTooltip(instance)));
|
|
7346
7349
|
},
|
package/package.json
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { View } from "./View";
|
|
2
|
-
import { Binding } from "./Binding";
|
|
3
|
-
|
|
4
|
-
export class AugmentedViewBase extends View {
|
|
5
|
-
getData() {
|
|
6
|
-
if (this.sealed && this.meta.version === this.cache.version && this.meta === this.store.meta)
|
|
7
|
-
return this.cache.result;
|
|
8
|
-
let parentStoreData = this.store.getData();
|
|
9
|
-
let result = this.getBaseData(parentStoreData);
|
|
10
|
-
this.embedAugmentData(result, parentStoreData);
|
|
11
|
-
this.cache.result = result;
|
|
12
|
-
this.cache.parentStoreData = parentStoreData;
|
|
13
|
-
this.cache.version = this.meta.version;
|
|
14
|
-
this.meta = this.store.meta;
|
|
15
|
-
return this.cache.result;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
getBaseData(parentStoreData) {
|
|
19
|
-
if (this.sealed || this.immutable || this.store.sealed) return { ...parentStoreData };
|
|
20
|
-
return parentStoreData;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
embedAugmentData(result, parentStoreData) {
|
|
24
|
-
throw new Error("abstract");
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
isExtraKey(key) {
|
|
28
|
-
throw new Error("abstract");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Stores which need to support nested aliases should override this method
|
|
32
|
-
getExtraKeyBinding(key) {
|
|
33
|
-
let binding = Binding.get(key);
|
|
34
|
-
return this.isExtraKey(binding.parts[0]) ? Binding.get(binding.parts[0]) : null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
setExtraKeyValue(key, value) {
|
|
38
|
-
throw new Error("abstract");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
deleteExtraKeyValue(key) {
|
|
42
|
-
throw new Error("abstract");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
setItem(path, value) {
|
|
46
|
-
let extraKeyBinding = this.getExtraKeyBinding(path);
|
|
47
|
-
if (extraKeyBinding) {
|
|
48
|
-
let binding = Binding.get(path);
|
|
49
|
-
let newValue = value;
|
|
50
|
-
if (binding.parts.length > extraKeyBinding.parts.length) {
|
|
51
|
-
let data = {};
|
|
52
|
-
this.embedAugmentData(data, this.store.getData());
|
|
53
|
-
let binding = Binding.get(path);
|
|
54
|
-
data = binding.set(data, value);
|
|
55
|
-
newValue = extraKeyBinding.value(data);
|
|
56
|
-
}
|
|
57
|
-
return this.setExtraKeyValue(extraKeyBinding.path, newValue);
|
|
58
|
-
}
|
|
59
|
-
return super.setItem(path, value);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
deleteItem(path) {
|
|
63
|
-
let extraKeyBinding = this.getExtraKeyBinding(path);
|
|
64
|
-
if (extraKeyBinding) {
|
|
65
|
-
if (path == extraKeyBinding.path) return this.deleteExtraKeyValue(extraKeyBinding.path);
|
|
66
|
-
let data = {};
|
|
67
|
-
this.embedAugmentData(data, this.store.getData());
|
|
68
|
-
let binding = Binding.get(path);
|
|
69
|
-
data = binding.delete(data);
|
|
70
|
-
let newValue = extraKeyBinding.value(data);
|
|
71
|
-
return this.setExtraKeyValue(extraKeyBinding.path, newValue);
|
|
72
|
-
}
|
|
73
|
-
return super.deleteItem(path);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
AugmentedViewBase.prototype.immutable = false;
|
|
1
|
+
import { View } from "./View";
|
|
2
|
+
import { Binding } from "./Binding";
|
|
3
|
+
|
|
4
|
+
export class AugmentedViewBase extends View {
|
|
5
|
+
getData() {
|
|
6
|
+
if (this.sealed && this.meta.version === this.cache.version && this.meta === this.store.meta)
|
|
7
|
+
return this.cache.result;
|
|
8
|
+
let parentStoreData = this.store.getData();
|
|
9
|
+
let result = this.getBaseData(parentStoreData);
|
|
10
|
+
this.embedAugmentData(result, parentStoreData);
|
|
11
|
+
this.cache.result = result;
|
|
12
|
+
this.cache.parentStoreData = parentStoreData;
|
|
13
|
+
this.cache.version = this.meta.version;
|
|
14
|
+
this.meta = this.store.meta;
|
|
15
|
+
return this.cache.result;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
getBaseData(parentStoreData) {
|
|
19
|
+
if (this.sealed || this.immutable || this.store.sealed) return { ...parentStoreData };
|
|
20
|
+
return parentStoreData;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
embedAugmentData(result, parentStoreData) {
|
|
24
|
+
throw new Error("abstract");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
isExtraKey(key) {
|
|
28
|
+
throw new Error("abstract");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Stores which need to support nested aliases should override this method
|
|
32
|
+
getExtraKeyBinding(key) {
|
|
33
|
+
let binding = Binding.get(key);
|
|
34
|
+
return this.isExtraKey(binding.parts[0]) ? Binding.get(binding.parts[0]) : null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
setExtraKeyValue(key, value) {
|
|
38
|
+
throw new Error("abstract");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
deleteExtraKeyValue(key) {
|
|
42
|
+
throw new Error("abstract");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
setItem(path, value) {
|
|
46
|
+
let extraKeyBinding = this.getExtraKeyBinding(path);
|
|
47
|
+
if (extraKeyBinding) {
|
|
48
|
+
let binding = Binding.get(path);
|
|
49
|
+
let newValue = value;
|
|
50
|
+
if (binding.parts.length > extraKeyBinding.parts.length) {
|
|
51
|
+
let data = {};
|
|
52
|
+
this.embedAugmentData(data, this.store.getData());
|
|
53
|
+
let binding = Binding.get(path);
|
|
54
|
+
data = binding.set(data, value);
|
|
55
|
+
newValue = extraKeyBinding.value(data);
|
|
56
|
+
}
|
|
57
|
+
return this.setExtraKeyValue(extraKeyBinding.path, newValue);
|
|
58
|
+
}
|
|
59
|
+
return super.setItem(path, value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
deleteItem(path) {
|
|
63
|
+
let extraKeyBinding = this.getExtraKeyBinding(path);
|
|
64
|
+
if (extraKeyBinding) {
|
|
65
|
+
if (path == extraKeyBinding.path) return this.deleteExtraKeyValue(extraKeyBinding.path);
|
|
66
|
+
let data = {};
|
|
67
|
+
this.embedAugmentData(data, this.store.getData());
|
|
68
|
+
let binding = Binding.get(path);
|
|
69
|
+
data = binding.delete(data);
|
|
70
|
+
let newValue = extraKeyBinding.value(data);
|
|
71
|
+
return this.setExtraKeyValue(extraKeyBinding.path, newValue);
|
|
72
|
+
}
|
|
73
|
+
return super.deleteItem(path);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
AugmentedViewBase.prototype.immutable = false;
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { View } from "./View";
|
|
2
|
-
import { Binding } from "./Binding";
|
|
3
|
-
|
|
4
|
-
export class ExposedRecordView extends View {
|
|
5
|
-
getData() {
|
|
6
|
-
if (
|
|
7
|
-
this.sealed &&
|
|
8
|
-
this.meta.version === this.cache.version &&
|
|
9
|
-
this.cache.itemIndex === this.itemIndex &&
|
|
10
|
-
this.meta === this.store.meta
|
|
11
|
-
)
|
|
12
|
-
return this.cache.result;
|
|
13
|
-
|
|
14
|
-
this.cache.result = this.embed(this.store.getData());
|
|
15
|
-
this.cache.version = this.meta.version;
|
|
16
|
-
this.cache.itemIndex = this.itemIndex;
|
|
17
|
-
this.meta = this.store.meta;
|
|
18
|
-
return this.cache.result;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
embed(data) {
|
|
22
|
-
const collection = this.collectionBinding.value(data);
|
|
23
|
-
const record = collection[this.itemIndex];
|
|
24
|
-
const copy = this.sealed || this.immutable || this.store.sealed ? { ...data } : data;
|
|
25
|
-
copy[this.recordName] = record;
|
|
26
|
-
if (this.indexName) copy[this.indexName] = this.itemIndex;
|
|
27
|
-
return copy;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
setIndex(index) {
|
|
31
|
-
this.itemIndex = index;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
setItem(path, value) {
|
|
35
|
-
if (path == this.recordName || path.indexOf(this.recordName + ".") == 0) {
|
|
36
|
-
const storeData = this.store.getData();
|
|
37
|
-
const collection = this.collectionBinding.value(storeData);
|
|
38
|
-
const data = this.embed(storeData);
|
|
39
|
-
const d = Binding.get(path).set(data, value);
|
|
40
|
-
if (d === data) return false;
|
|
41
|
-
const record = d[this.recordName];
|
|
42
|
-
const newCollection = [
|
|
43
|
-
...collection.slice(0, this.itemIndex),
|
|
44
|
-
record,
|
|
45
|
-
...collection.slice(this.itemIndex + 1),
|
|
46
|
-
];
|
|
47
|
-
return this.store.setItem(this.collectionBinding.path, newCollection);
|
|
48
|
-
}
|
|
49
|
-
return this.store.setItem(path, value);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
deleteItem(path) {
|
|
53
|
-
let storeData, collection, newCollection;
|
|
54
|
-
|
|
55
|
-
if (path == this.recordName) {
|
|
56
|
-
storeData = this.store.getData();
|
|
57
|
-
collection = this.collectionBinding.value(storeData);
|
|
58
|
-
newCollection = [...collection.slice(0, this.itemIndex), ...collection.slice(this.itemIndex + 1)];
|
|
59
|
-
return this.store.setItem(this.collectionBinding.path, newCollection);
|
|
60
|
-
} else if (path.indexOf(this.recordName + ".") == 0) {
|
|
61
|
-
storeData = this.store.getData();
|
|
62
|
-
collection = this.collectionBinding.value(storeData);
|
|
63
|
-
const data = this.embed(storeData);
|
|
64
|
-
const d = Binding.get(path).delete(data);
|
|
65
|
-
if (d === data) return false;
|
|
66
|
-
const record = d[this.recordName];
|
|
67
|
-
newCollection = [...collection.slice(0, this.itemIndex), record, ...collection.slice(this.itemIndex + 1)];
|
|
68
|
-
return this.store.setItem(this.collectionBinding.path, newCollection);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return this.store.deleteItem(path);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
ExposedRecordView.prototype.immutable = false;
|
|
1
|
+
import { View } from "./View";
|
|
2
|
+
import { Binding } from "./Binding";
|
|
3
|
+
|
|
4
|
+
export class ExposedRecordView extends View {
|
|
5
|
+
getData() {
|
|
6
|
+
if (
|
|
7
|
+
this.sealed &&
|
|
8
|
+
this.meta.version === this.cache.version &&
|
|
9
|
+
this.cache.itemIndex === this.itemIndex &&
|
|
10
|
+
this.meta === this.store.meta
|
|
11
|
+
)
|
|
12
|
+
return this.cache.result;
|
|
13
|
+
|
|
14
|
+
this.cache.result = this.embed(this.store.getData());
|
|
15
|
+
this.cache.version = this.meta.version;
|
|
16
|
+
this.cache.itemIndex = this.itemIndex;
|
|
17
|
+
this.meta = this.store.meta;
|
|
18
|
+
return this.cache.result;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
embed(data) {
|
|
22
|
+
const collection = this.collectionBinding.value(data);
|
|
23
|
+
const record = collection[this.itemIndex];
|
|
24
|
+
const copy = this.sealed || this.immutable || this.store.sealed ? { ...data } : data;
|
|
25
|
+
copy[this.recordName] = record;
|
|
26
|
+
if (this.indexName) copy[this.indexName] = this.itemIndex;
|
|
27
|
+
return copy;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
setIndex(index) {
|
|
31
|
+
this.itemIndex = index;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
setItem(path, value) {
|
|
35
|
+
if (path == this.recordName || path.indexOf(this.recordName + ".") == 0) {
|
|
36
|
+
const storeData = this.store.getData();
|
|
37
|
+
const collection = this.collectionBinding.value(storeData);
|
|
38
|
+
const data = this.embed(storeData);
|
|
39
|
+
const d = Binding.get(path).set(data, value);
|
|
40
|
+
if (d === data) return false;
|
|
41
|
+
const record = d[this.recordName];
|
|
42
|
+
const newCollection = [
|
|
43
|
+
...collection.slice(0, this.itemIndex),
|
|
44
|
+
record,
|
|
45
|
+
...collection.slice(this.itemIndex + 1),
|
|
46
|
+
];
|
|
47
|
+
return this.store.setItem(this.collectionBinding.path, newCollection);
|
|
48
|
+
}
|
|
49
|
+
return this.store.setItem(path, value);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
deleteItem(path) {
|
|
53
|
+
let storeData, collection, newCollection;
|
|
54
|
+
|
|
55
|
+
if (path == this.recordName) {
|
|
56
|
+
storeData = this.store.getData();
|
|
57
|
+
collection = this.collectionBinding.value(storeData);
|
|
58
|
+
newCollection = [...collection.slice(0, this.itemIndex), ...collection.slice(this.itemIndex + 1)];
|
|
59
|
+
return this.store.setItem(this.collectionBinding.path, newCollection);
|
|
60
|
+
} else if (path.indexOf(this.recordName + ".") == 0) {
|
|
61
|
+
storeData = this.store.getData();
|
|
62
|
+
collection = this.collectionBinding.value(storeData);
|
|
63
|
+
const data = this.embed(storeData);
|
|
64
|
+
const d = Binding.get(path).delete(data);
|
|
65
|
+
if (d === data) return false;
|
|
66
|
+
const record = d[this.recordName];
|
|
67
|
+
newCollection = [...collection.slice(0, this.itemIndex), record, ...collection.slice(this.itemIndex + 1)];
|
|
68
|
+
return this.store.setItem(this.collectionBinding.path, newCollection);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return this.store.deleteItem(path);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
ExposedRecordView.prototype.immutable = false;
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { View } from "./View";
|
|
2
|
-
import { Binding } from "./Binding";
|
|
3
|
-
|
|
4
|
-
export class ExposedValueView extends View {
|
|
5
|
-
getData() {
|
|
6
|
-
if (
|
|
7
|
-
this.sealed &&
|
|
8
|
-
this.meta.version === this.cache.version &&
|
|
9
|
-
this.cache.key === this.key &&
|
|
10
|
-
this.meta == this.store.meta
|
|
11
|
-
)
|
|
12
|
-
return this.cache.result;
|
|
13
|
-
|
|
14
|
-
let data = this.store.getData();
|
|
15
|
-
let container = this.containerBinding.value(data) || {};
|
|
16
|
-
let record = container[this.key];
|
|
17
|
-
|
|
18
|
-
this.cache.version = this.meta.version;
|
|
19
|
-
this.cache.key = this.key;
|
|
20
|
-
this.cache.result = this.sealed || this.immutable || this.store.sealed ? { ...data } : data;
|
|
21
|
-
this.cache.result[this.recordName] = record;
|
|
22
|
-
this.meta = this.store.meta;
|
|
23
|
-
return this.cache.result;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
setKey(key) {
|
|
27
|
-
this.key = key;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
getKey() {
|
|
31
|
-
return this.key;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
setItem(path, value) {
|
|
35
|
-
if (path == this.recordName || path.indexOf(this.recordName + ".") == 0) {
|
|
36
|
-
var data = this.getData();
|
|
37
|
-
var d = Binding.get(path).set(data, value);
|
|
38
|
-
if (d === data) return false;
|
|
39
|
-
var container = this.containerBinding.value(d);
|
|
40
|
-
var record = d[this.recordName];
|
|
41
|
-
var newContainer = Object.assign({}, container);
|
|
42
|
-
newContainer[this.key] = record;
|
|
43
|
-
return this.store.setItem(this.containerBinding.path, newContainer);
|
|
44
|
-
}
|
|
45
|
-
return this.store.setItem(path, value);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
deleteItem(path) {
|
|
49
|
-
var data, container, newContainer;
|
|
50
|
-
|
|
51
|
-
if (path == this.recordName) {
|
|
52
|
-
data = this.getData();
|
|
53
|
-
container = this.containerBinding.value(data);
|
|
54
|
-
if (!container || !container.hasOwnProperty(path)) return false;
|
|
55
|
-
newContainer = Object.assign({}, container);
|
|
56
|
-
delete newContainer[this.key];
|
|
57
|
-
this.store.set(this.containerBinding.path, newContainer);
|
|
58
|
-
} else if (path.indexOf(this.recordName + ".") == 0) {
|
|
59
|
-
data = this.getData();
|
|
60
|
-
var d = Binding.get(path).delete(data);
|
|
61
|
-
if (d === data) return false;
|
|
62
|
-
container = this.containerBinding.value(d);
|
|
63
|
-
var record = d[this.recordName];
|
|
64
|
-
newContainer = Object.assign({}, container);
|
|
65
|
-
newContainer[this.key] = record;
|
|
66
|
-
return this.store.setItem(this.containerBinding.path, newContainer);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return this.store.deleteItem(path);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
ExposedValueView.prototype.immutable = false;
|
|
1
|
+
import { View } from "./View";
|
|
2
|
+
import { Binding } from "./Binding";
|
|
3
|
+
|
|
4
|
+
export class ExposedValueView extends View {
|
|
5
|
+
getData() {
|
|
6
|
+
if (
|
|
7
|
+
this.sealed &&
|
|
8
|
+
this.meta.version === this.cache.version &&
|
|
9
|
+
this.cache.key === this.key &&
|
|
10
|
+
this.meta == this.store.meta
|
|
11
|
+
)
|
|
12
|
+
return this.cache.result;
|
|
13
|
+
|
|
14
|
+
let data = this.store.getData();
|
|
15
|
+
let container = this.containerBinding.value(data) || {};
|
|
16
|
+
let record = container[this.key];
|
|
17
|
+
|
|
18
|
+
this.cache.version = this.meta.version;
|
|
19
|
+
this.cache.key = this.key;
|
|
20
|
+
this.cache.result = this.sealed || this.immutable || this.store.sealed ? { ...data } : data;
|
|
21
|
+
this.cache.result[this.recordName] = record;
|
|
22
|
+
this.meta = this.store.meta;
|
|
23
|
+
return this.cache.result;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
setKey(key) {
|
|
27
|
+
this.key = key;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
getKey() {
|
|
31
|
+
return this.key;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
setItem(path, value) {
|
|
35
|
+
if (path == this.recordName || path.indexOf(this.recordName + ".") == 0) {
|
|
36
|
+
var data = this.getData();
|
|
37
|
+
var d = Binding.get(path).set(data, value);
|
|
38
|
+
if (d === data) return false;
|
|
39
|
+
var container = this.containerBinding.value(d);
|
|
40
|
+
var record = d[this.recordName];
|
|
41
|
+
var newContainer = Object.assign({}, container);
|
|
42
|
+
newContainer[this.key] = record;
|
|
43
|
+
return this.store.setItem(this.containerBinding.path, newContainer);
|
|
44
|
+
}
|
|
45
|
+
return this.store.setItem(path, value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
deleteItem(path) {
|
|
49
|
+
var data, container, newContainer;
|
|
50
|
+
|
|
51
|
+
if (path == this.recordName) {
|
|
52
|
+
data = this.getData();
|
|
53
|
+
container = this.containerBinding.value(data);
|
|
54
|
+
if (!container || !container.hasOwnProperty(path)) return false;
|
|
55
|
+
newContainer = Object.assign({}, container);
|
|
56
|
+
delete newContainer[this.key];
|
|
57
|
+
this.store.set(this.containerBinding.path, newContainer);
|
|
58
|
+
} else if (path.indexOf(this.recordName + ".") == 0) {
|
|
59
|
+
data = this.getData();
|
|
60
|
+
var d = Binding.get(path).delete(data);
|
|
61
|
+
if (d === data) return false;
|
|
62
|
+
container = this.containerBinding.value(d);
|
|
63
|
+
var record = d[this.recordName];
|
|
64
|
+
newContainer = Object.assign({}, container);
|
|
65
|
+
newContainer[this.key] = record;
|
|
66
|
+
return this.store.setItem(this.containerBinding.path, newContainer);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return this.store.deleteItem(path);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
ExposedValueView.prototype.immutable = false;
|