cx 23.5.2 → 23.7.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.
- package/dist/charts.js +39 -24
- package/dist/manifest.js +770 -770
- package/dist/ui.js +3 -0
- package/dist/widgets.js +1 -1
- package/package.json +1 -1
- package/src/charts/PieLabelsContainer.d.ts +5 -2
- package/src/charts/axis/Axis.d.ts +96 -82
- package/src/charts/axis/Axis.js +252 -222
- package/src/data/Grouper.spec.js +34 -15
- package/src/ui/Repeater.d.ts +7 -0
- package/src/ui/Repeater.js +41 -38
- package/src/widgets/drag-drop/DragSource.d.ts +3 -3
- package/src/widgets/form/LookupField.js +1 -1
package/src/ui/Repeater.js
CHANGED
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import {Widget} from
|
|
2
|
-
import {PureContainer} from
|
|
3
|
-
import {Container} from
|
|
4
|
-
import {ArrayAdapter} from
|
|
5
|
-
import {UseParentLayout} from "./layout/UseParentLayout";
|
|
6
|
-
import {getAccessor} from "../data/getAccessor";
|
|
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
7
|
|
|
8
8
|
export class Repeater extends Container {
|
|
9
|
-
|
|
10
9
|
declareData() {
|
|
11
|
-
super.declareData(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
init() {
|
|
23
|
-
|
|
24
25
|
this.recordsAccessor = getAccessor(this.records);
|
|
25
26
|
|
|
26
|
-
if (this.recordAlias)
|
|
27
|
-
this.recordName = this.recordAlias;
|
|
27
|
+
if (this.recordAlias) this.recordName = this.recordAlias;
|
|
28
28
|
|
|
29
|
-
if (this.indexAlias)
|
|
30
|
-
this.indexName = this.indexAlias;
|
|
29
|
+
if (this.indexAlias) this.indexName = this.indexAlias;
|
|
31
30
|
|
|
32
31
|
this.dataAdapter = ArrayAdapter.create({
|
|
33
32
|
...this.dataAdapter,
|
|
@@ -37,12 +36,12 @@ export class Repeater extends Container {
|
|
|
37
36
|
immutable: this.immutable,
|
|
38
37
|
sealed: this.sealed,
|
|
39
38
|
recordsAccessor: this.recordsAccessor,
|
|
40
|
-
sortOptions: this.sortOptions
|
|
39
|
+
sortOptions: this.sortOptions,
|
|
41
40
|
});
|
|
42
41
|
|
|
43
42
|
this.item = PureContainer.create({
|
|
44
43
|
children: this.items || this.children,
|
|
45
|
-
layout: UseParentLayout
|
|
44
|
+
layout: UseParentLayout,
|
|
46
45
|
});
|
|
47
46
|
|
|
48
47
|
delete this.children;
|
|
@@ -56,20 +55,25 @@ export class Repeater extends Container {
|
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
prepareData(context, instance) {
|
|
59
|
-
let {data} = instance;
|
|
58
|
+
let { data } = instance;
|
|
60
59
|
if (data.sortField)
|
|
61
|
-
data.sorters = [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
data.sorters = [
|
|
61
|
+
{
|
|
62
|
+
field: data.sortField,
|
|
63
|
+
direction: data.sortDirection || "ASC",
|
|
64
|
+
},
|
|
65
|
+
];
|
|
65
66
|
this.dataAdapter.sort(data.sorters);
|
|
66
67
|
let filter = null;
|
|
67
|
-
if (this.onCreateFilter)
|
|
68
|
-
|
|
69
|
-
else if (this.filter)
|
|
70
|
-
filter = item => this.filter(item, data.filterParams);
|
|
68
|
+
if (this.onCreateFilter) filter = instance.invoke("onCreateFilter", data.filterParams, instance);
|
|
69
|
+
else if (this.filter) filter = (item) => this.filter(item, data.filterParams);
|
|
71
70
|
this.dataAdapter.setFilter(filter);
|
|
72
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
|
+
|
|
73
77
|
super.prepareData(context, instance);
|
|
74
78
|
}
|
|
75
79
|
|
|
@@ -77,23 +81,22 @@ export class Repeater extends Container {
|
|
|
77
81
|
let instances = [];
|
|
78
82
|
instance.mappedRecords.forEach((record) => {
|
|
79
83
|
let subInstance = instance.getChild(context, this.item, record.key, record.store);
|
|
80
|
-
let changed = subInstance.cache(
|
|
84
|
+
let changed = subInstance.cache("recordData", record.data) || subInstance.cache("key", record.key);
|
|
81
85
|
subInstance.record = record;
|
|
82
86
|
if (this.cached && !changed && subInstance.visible && !subInstance.childStateDirty) {
|
|
83
87
|
instances.push(subInstance);
|
|
84
88
|
subInstance.shouldUpdate = false;
|
|
85
|
-
} else if (subInstance.scheduleExploreIfVisible(context))
|
|
86
|
-
instances.push(subInstance);
|
|
89
|
+
} else if (subInstance.scheduleExploreIfVisible(context)) instances.push(subInstance);
|
|
87
90
|
});
|
|
88
91
|
instance.children = instances;
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
Repeater.prototype.recordName =
|
|
93
|
-
Repeater.prototype.indexName =
|
|
95
|
+
Repeater.prototype.recordName = "$record";
|
|
96
|
+
Repeater.prototype.indexName = "$index";
|
|
94
97
|
Repeater.prototype.cached = false;
|
|
95
98
|
Repeater.prototype.immutable = false;
|
|
96
99
|
Repeater.prototype.sealed = false;
|
|
97
100
|
Repeater.prototype.isPureContainer = true;
|
|
98
101
|
|
|
99
|
-
Widget.alias(
|
|
102
|
+
Widget.alias("repeater", Repeater);
|
|
@@ -33,13 +33,13 @@ interface DragSourceProps extends Cx.StyledContainerProps {
|
|
|
33
33
|
cloneStyle?: Cx.StyleProp;
|
|
34
34
|
|
|
35
35
|
/** CSS styles to be applied to the element being dragged. */
|
|
36
|
-
draggedStyle
|
|
36
|
+
draggedStyle?: Cx.StyleProp;
|
|
37
37
|
|
|
38
38
|
/** Additional CSS class to be applied to the clone of the element being dragged. */
|
|
39
|
-
cloneClass
|
|
39
|
+
cloneClass?: Cx.ClassProp;
|
|
40
40
|
|
|
41
41
|
/** Additional CSS class to be applied to the element being dragged. */
|
|
42
|
-
draggedClass
|
|
42
|
+
draggedClass?: Cx.ClassProp;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export class DragSource extends Cx.Widget<DragSourceProps> {}
|
|
@@ -266,7 +266,7 @@ function getOptionKey(bindings, data) {
|
|
|
266
266
|
function areKeysEqual(key1, key2) {
|
|
267
267
|
if (!key1 || !key2 || key1.length != key2.length) return false;
|
|
268
268
|
|
|
269
|
-
for (let i = 0; i < key1.length; i++) if (key1[i]
|
|
269
|
+
for (let i = 0; i < key1.length; i++) if (key1[i] !== key2[i]) return false;
|
|
270
270
|
|
|
271
271
|
return true;
|
|
272
272
|
}
|