cx 25.5.0 → 25.5.1
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 +709 -709
- package/dist/ui.js +7 -1
- package/dist/widgets.js +12 -0
- package/package.json +1 -1
- package/src/ui/Repeater.js +109 -102
- package/src/ui/adapter/ArrayAdapter.js +2 -2
- package/src/widgets/List.js +594 -587
- package/src/widgets/grid/Grid.js +3421 -3414
package/dist/ui.js
CHANGED
|
@@ -1017,7 +1017,7 @@ var ArrayAdapter = /*#__PURE__*/ (function (_DataAdapter) {
|
|
|
1017
1017
|
|
|
1018
1018
|
// cache by the key or by data reference
|
|
1019
1019
|
if (key != null) instance.cacheByKey[key] = recordStore;
|
|
1020
|
-
else instance.recordStoreCache.set(data, recordStore);
|
|
1020
|
+
else if (isObject(data)) instance.recordStoreCache.set(data, recordStore);
|
|
1021
1021
|
return {
|
|
1022
1022
|
store: recordStore,
|
|
1023
1023
|
index: index,
|
|
@@ -1147,6 +1147,12 @@ var Repeater = /*#__PURE__*/ (function (_Container) {
|
|
|
1147
1147
|
_proto.initInstance = function initInstance(context, instance) {
|
|
1148
1148
|
this.dataAdapter.initInstance(context, instance);
|
|
1149
1149
|
};
|
|
1150
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
1151
|
+
_Container.prototype.applyParentStore.call(this, instance);
|
|
1152
|
+
|
|
1153
|
+
// force prepareData to execute again and propagate the store change to the records
|
|
1154
|
+
if (instance.cached) delete instance.cached.rawData;
|
|
1155
|
+
};
|
|
1150
1156
|
_proto.prepareData = function prepareData(context, instance) {
|
|
1151
1157
|
var _this = this;
|
|
1152
1158
|
var data = instance.data;
|
package/dist/widgets.js
CHANGED
|
@@ -1272,6 +1272,12 @@ var List = /*#__PURE__*/ (function (_Widget) {
|
|
|
1272
1272
|
});
|
|
1273
1273
|
_Widget.prototype.prepareData.call(this, context, instance);
|
|
1274
1274
|
};
|
|
1275
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
1276
|
+
_Widget.prototype.applyParentStore.call(this, instance);
|
|
1277
|
+
|
|
1278
|
+
// force prepareData to execute again and propagate the store change to the records
|
|
1279
|
+
if (instance.cached) delete instance.cached.rawData;
|
|
1280
|
+
};
|
|
1275
1281
|
_proto.explore = function explore(context, instance, data) {
|
|
1276
1282
|
var _this2 = this;
|
|
1277
1283
|
var instances = [];
|
|
@@ -15644,6 +15650,12 @@ var Grid = /*#__PURE__*/ (function (_Container) {
|
|
|
15644
15650
|
page: 1,
|
|
15645
15651
|
};
|
|
15646
15652
|
};
|
|
15653
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
15654
|
+
_Container.prototype.applyParentStore.call(this, instance);
|
|
15655
|
+
|
|
15656
|
+
// force prepareData to execute again and propagate the store change to the records
|
|
15657
|
+
if (instance.cached) delete instance.cached.rawData;
|
|
15658
|
+
};
|
|
15647
15659
|
_proto.createRowTemplate = function createRowTemplate(context, columnParams, instance, groupingData) {
|
|
15648
15660
|
var _this = this;
|
|
15649
15661
|
var row = this.row || {};
|
package/package.json
CHANGED
package/src/ui/Repeater.js
CHANGED
|
@@ -1,102 +1,109 @@
|
|
|
1
|
-
import { Widget } from "./Widget";
|
|
2
|
-
import { PureContainer } from "./PureContainer";
|
|
3
|
-
import { Container } from "./Container";
|
|
4
|
-
import { ArrayAdapter } from "./adapter/ArrayAdapter";
|
|
5
|
-
import { UseParentLayout } from "./layout/UseParentLayout";
|
|
6
|
-
import { getAccessor } from "../data/getAccessor";
|
|
7
|
-
|
|
8
|
-
export class Repeater extends Container {
|
|
9
|
-
declareData() {
|
|
10
|
-
super.declareData(
|
|
11
|
-
{
|
|
12
|
-
records: undefined,
|
|
13
|
-
sorters: undefined,
|
|
14
|
-
sortField: undefined,
|
|
15
|
-
sortDirection: undefined,
|
|
16
|
-
filterParams: {
|
|
17
|
-
structured: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
...arguments
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
init() {
|
|
25
|
-
this.recordsAccessor = getAccessor(this.records);
|
|
26
|
-
|
|
27
|
-
if (this.recordAlias) this.recordName = this.recordAlias;
|
|
28
|
-
|
|
29
|
-
if (this.indexAlias) this.indexName = this.indexAlias;
|
|
30
|
-
|
|
31
|
-
this.dataAdapter = ArrayAdapter.create({
|
|
32
|
-
...this.dataAdapter,
|
|
33
|
-
recordName: this.recordName,
|
|
34
|
-
indexName: this.indexName,
|
|
35
|
-
keyField: this.keyField,
|
|
36
|
-
immutable: this.immutable,
|
|
37
|
-
sealed: this.sealed,
|
|
38
|
-
recordsAccessor: this.recordsAccessor,
|
|
39
|
-
sortOptions: this.sortOptions,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
this.item = PureContainer.create({
|
|
43
|
-
children: this.items || this.children,
|
|
44
|
-
layout: UseParentLayout,
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
delete this.children;
|
|
48
|
-
delete this.items;
|
|
49
|
-
|
|
50
|
-
super.init();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
initInstance(context, instance) {
|
|
54
|
-
this.dataAdapter.initInstance(context, instance);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
import { Widget } from "./Widget";
|
|
2
|
+
import { PureContainer } from "./PureContainer";
|
|
3
|
+
import { Container } from "./Container";
|
|
4
|
+
import { ArrayAdapter } from "./adapter/ArrayAdapter";
|
|
5
|
+
import { UseParentLayout } from "./layout/UseParentLayout";
|
|
6
|
+
import { getAccessor } from "../data/getAccessor";
|
|
7
|
+
|
|
8
|
+
export class Repeater extends Container {
|
|
9
|
+
declareData() {
|
|
10
|
+
super.declareData(
|
|
11
|
+
{
|
|
12
|
+
records: undefined,
|
|
13
|
+
sorters: undefined,
|
|
14
|
+
sortField: undefined,
|
|
15
|
+
sortDirection: undefined,
|
|
16
|
+
filterParams: {
|
|
17
|
+
structured: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
...arguments,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
init() {
|
|
25
|
+
this.recordsAccessor = getAccessor(this.records);
|
|
26
|
+
|
|
27
|
+
if (this.recordAlias) this.recordName = this.recordAlias;
|
|
28
|
+
|
|
29
|
+
if (this.indexAlias) this.indexName = this.indexAlias;
|
|
30
|
+
|
|
31
|
+
this.dataAdapter = ArrayAdapter.create({
|
|
32
|
+
...this.dataAdapter,
|
|
33
|
+
recordName: this.recordName,
|
|
34
|
+
indexName: this.indexName,
|
|
35
|
+
keyField: this.keyField,
|
|
36
|
+
immutable: this.immutable,
|
|
37
|
+
sealed: this.sealed,
|
|
38
|
+
recordsAccessor: this.recordsAccessor,
|
|
39
|
+
sortOptions: this.sortOptions,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
this.item = PureContainer.create({
|
|
43
|
+
children: this.items || this.children,
|
|
44
|
+
layout: UseParentLayout,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
delete this.children;
|
|
48
|
+
delete this.items;
|
|
49
|
+
|
|
50
|
+
super.init();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
initInstance(context, instance) {
|
|
54
|
+
this.dataAdapter.initInstance(context, instance);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
applyParentStore(instance) {
|
|
58
|
+
super.applyParentStore(instance);
|
|
59
|
+
|
|
60
|
+
// force prepareData to execute again and propagate the store change to the records
|
|
61
|
+
if (instance.cached) delete instance.cached.rawData;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
prepareData(context, instance) {
|
|
65
|
+
let { data } = instance;
|
|
66
|
+
if (data.sortField)
|
|
67
|
+
data.sorters = [
|
|
68
|
+
{
|
|
69
|
+
field: data.sortField,
|
|
70
|
+
direction: data.sortDirection || "ASC",
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
this.dataAdapter.sort(data.sorters);
|
|
74
|
+
let filter = null;
|
|
75
|
+
if (this.onCreateFilter) filter = instance.invoke("onCreateFilter", data.filterParams, instance);
|
|
76
|
+
else if (this.filter) filter = (item) => this.filter(item, data.filterParams);
|
|
77
|
+
this.dataAdapter.setFilter(filter);
|
|
78
|
+
instance.mappedRecords = this.dataAdapter.getRecords(context, instance, data.records, instance.store);
|
|
79
|
+
|
|
80
|
+
if (this.onTrackMappedRecords) {
|
|
81
|
+
instance.invoke("onTrackMappedRecords", instance.mappedRecords, instance);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
super.prepareData(context, instance);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
explore(context, instance, data) {
|
|
88
|
+
let instances = [];
|
|
89
|
+
instance.mappedRecords.forEach((record) => {
|
|
90
|
+
let subInstance = instance.getChild(context, this.item, record.key, record.store);
|
|
91
|
+
let changed = subInstance.cache("recordData", record.data) || subInstance.cache("key", record.key);
|
|
92
|
+
subInstance.record = record;
|
|
93
|
+
if (this.cached && !changed && subInstance.visible && !subInstance.childStateDirty) {
|
|
94
|
+
instances.push(subInstance);
|
|
95
|
+
subInstance.shouldUpdate = false;
|
|
96
|
+
} else if (subInstance.scheduleExploreIfVisible(context)) instances.push(subInstance);
|
|
97
|
+
});
|
|
98
|
+
instance.children = instances;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
Repeater.prototype.recordName = "$record";
|
|
103
|
+
Repeater.prototype.indexName = "$index";
|
|
104
|
+
Repeater.prototype.cached = false;
|
|
105
|
+
Repeater.prototype.immutable = false;
|
|
106
|
+
Repeater.prototype.sealed = false;
|
|
107
|
+
Repeater.prototype.isPureContainer = true;
|
|
108
|
+
|
|
109
|
+
Widget.alias("repeater", Repeater);
|
|
@@ -5,7 +5,7 @@ import { isArray } from "../../util/isArray";
|
|
|
5
5
|
import { ArrayElementView } from "../../data/ArrayElementView";
|
|
6
6
|
import { getAccessor } from "../../data/getAccessor";
|
|
7
7
|
import { Culture } from "../Culture";
|
|
8
|
-
import { isDefined } from "../../util";
|
|
8
|
+
import { isDefined, isObject } from "../../util";
|
|
9
9
|
|
|
10
10
|
export class ArrayAdapter extends DataAdapter {
|
|
11
11
|
init() {
|
|
@@ -92,7 +92,7 @@ export class ArrayAdapter extends DataAdapter {
|
|
|
92
92
|
|
|
93
93
|
// cache by the key or by data reference
|
|
94
94
|
if (key != null) instance.cacheByKey[key] = recordStore;
|
|
95
|
-
else instance.recordStoreCache.set(data, recordStore);
|
|
95
|
+
else if (isObject(data)) instance.recordStoreCache.set(data, recordStore);
|
|
96
96
|
|
|
97
97
|
return {
|
|
98
98
|
store: recordStore,
|