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/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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "25.5.0",
3
+ "version": "25.5.1",
4
4
  "description": "Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.",
5
5
  "main": "index.js",
6
6
  "jsnext:main": "src/index.js",
@@ -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
- prepareData(context, instance) {
58
- let { data } = instance;
59
- if (data.sortField)
60
- data.sorters = [
61
- {
62
- field: data.sortField,
63
- direction: data.sortDirection || "ASC",
64
- },
65
- ];
66
- this.dataAdapter.sort(data.sorters);
67
- let filter = null;
68
- if (this.onCreateFilter) filter = instance.invoke("onCreateFilter", data.filterParams, instance);
69
- else if (this.filter) filter = (item) => this.filter(item, data.filterParams);
70
- this.dataAdapter.setFilter(filter);
71
- instance.mappedRecords = this.dataAdapter.getRecords(context, instance, data.records, instance.store);
72
-
73
- if (this.onTrackMappedRecords) {
74
- instance.invoke("onTrackMappedRecords", instance.mappedRecords, instance);
75
- }
76
-
77
- super.prepareData(context, instance);
78
- }
79
-
80
- explore(context, instance, data) {
81
- let instances = [];
82
- instance.mappedRecords.forEach((record) => {
83
- let subInstance = instance.getChild(context, this.item, record.key, record.store);
84
- let changed = subInstance.cache("recordData", record.data) || subInstance.cache("key", record.key);
85
- subInstance.record = record;
86
- if (this.cached && !changed && subInstance.visible && !subInstance.childStateDirty) {
87
- instances.push(subInstance);
88
- subInstance.shouldUpdate = false;
89
- } else if (subInstance.scheduleExploreIfVisible(context)) instances.push(subInstance);
90
- });
91
- instance.children = instances;
92
- }
93
- }
94
-
95
- Repeater.prototype.recordName = "$record";
96
- Repeater.prototype.indexName = "$index";
97
- Repeater.prototype.cached = false;
98
- Repeater.prototype.immutable = false;
99
- Repeater.prototype.sealed = false;
100
- Repeater.prototype.isPureContainer = true;
101
-
102
- Widget.alias("repeater", Repeater);
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,