cx 25.5.1 → 25.6.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.
Files changed (45) hide show
  1. package/dist/charts.js +40 -21
  2. package/dist/manifest.js +771 -771
  3. package/dist/ui.js +0 -15
  4. package/dist/widgets.js +34 -25
  5. package/package.json +1 -1
  6. package/src/charts/LineGraph.js +1 -1
  7. package/src/charts/axis/NumericAxis.d.ts +46 -46
  8. package/src/charts/helpers/PointReducer.d.ts +9 -0
  9. package/src/charts/helpers/PointReducer.js +36 -22
  10. package/src/data/AugmentedViewBase.js +77 -77
  11. package/src/data/ExposedRecordView.js +75 -75
  12. package/src/data/ExposedValueView.js +73 -73
  13. package/src/data/Ref.d.ts +24 -24
  14. package/src/data/Ref.spec.js +79 -79
  15. package/src/data/StoreRef.spec.js +24 -24
  16. package/src/data/StructuredDataAccessor.d.ts +7 -7
  17. package/src/data/SubscribableView.js +54 -54
  18. package/src/ui/Container.js +154 -154
  19. package/src/ui/DataProxy.js +31 -45
  20. package/src/ui/DetachedScope.js +98 -98
  21. package/src/ui/Instance.d.ts +72 -72
  22. package/src/ui/Instance.js +623 -623
  23. package/src/ui/IsolatedScope.js +30 -30
  24. package/src/ui/Repeater.js +109 -109
  25. package/src/ui/Rescope.js +35 -35
  26. package/src/ui/Restate.js +167 -167
  27. package/src/ui/Widget.js +184 -184
  28. package/src/ui/adapter/ArrayAdapter.js +152 -152
  29. package/src/ui/adapter/TreeAdapter.js +101 -101
  30. package/src/ui/createFunctionalComponent.d.ts +1 -1
  31. package/src/ui/index.d.ts +42 -42
  32. package/src/ui/layout/exploreChildren.d.ts +12 -12
  33. package/src/ui/layout/exploreChildren.js +27 -27
  34. package/src/util/debounce.js +18 -18
  35. package/src/util/validatedDebounce.js +19 -19
  36. package/src/widgets/Button.js +118 -118
  37. package/src/widgets/List.js +594 -594
  38. package/src/widgets/form/Calendar.d.ts +86 -86
  39. package/src/widgets/form/Checkbox.js +5 -2
  40. package/src/widgets/form/MonthField.d.ts +5 -0
  41. package/src/widgets/form/MonthField.js +1 -0
  42. package/src/widgets/form/MonthPicker.d.ts +13 -0
  43. package/src/widgets/form/MonthPicker.js +25 -21
  44. package/src/widgets/grid/Grid.js +3421 -3421
  45. package/src/widgets/nav/Route.js +102 -102
package/src/ui/Widget.js CHANGED
@@ -1,184 +1,184 @@
1
- import { Component } from "../util/Component";
2
- import { CSSHelper } from "./CSSHelper";
3
- import "./CSS";
4
- import { StructuredSelector } from "../data/StructuredSelector";
5
- import { parseStyle } from "../util/parseStyle";
6
- import { isString } from "../util/isString";
7
- import { isDefined } from "../util/isDefined";
8
- import { isArray } from "../util/isArray";
9
- import { Console } from "../util/Console";
10
-
11
- import { VDOM as vdom } from "./VDOM";
12
- export const VDOM = vdom;
13
-
14
- let widgetId = 100;
15
-
16
- export class Widget extends Component {
17
- constructor(config) {
18
- super(config);
19
- this.widgetId = widgetId++;
20
-
21
- if (isArray(this.jsxSpread)) {
22
- if (!this.jsxAttributes) this.jsxAttributes = [];
23
-
24
- this.jsxSpread.forEach((spread) => {
25
- for (var key in spread) {
26
- this[key] = spread[key];
27
- this.jsxAttributes.push(key);
28
- }
29
- });
30
- }
31
- }
32
-
33
- init() {
34
- if (this.styles) this.style = this.styles;
35
-
36
- if (this.styled) this.style = parseStyle(this.style);
37
- else if (this.style) {
38
- Console.warn(
39
- "Components that allow use of the style attribute should set styled = true on their prototype. This will be an error in future versions.",
40
- );
41
- this.style = parseStyle(this.style);
42
- this.styled = true;
43
- }
44
-
45
- if (typeof this.if !== "undefined") this.visible = this.if;
46
-
47
- this.declareData();
48
-
49
- if (this.outerLayout) {
50
- if (isArray(this.outerLayout)) throw new Error("Only single element outer layout is supported.");
51
- //TODO: better handle the case when outer layout is an array. How to get around circular dependency to PureContainer
52
- this.outerLayout = Widget.create(this.outerLayout);
53
- }
54
-
55
- if (this.contentFor) this.putInto = this.contentFor;
56
-
57
- if (this.putInto) this.isContent = true;
58
-
59
- if (isString(this.CSS)) this.CSS = CSSHelper.get(this.CSS);
60
-
61
- this.initHelpers();
62
- this.initComponents();
63
-
64
- this.initialized = true;
65
- }
66
-
67
- initComponents() {
68
- if (arguments.length > 0) {
69
- this.components = Object.assign(...arguments);
70
- for (var k in this.components) if (!this.components[k]) delete this.components[k];
71
- }
72
- }
73
-
74
- initHelpers() {
75
- if (arguments.length > 0) {
76
- this.helpers = Object.assign(...arguments);
77
- }
78
- }
79
-
80
- declareData() {
81
- let options = {};
82
-
83
- if (this.styled) options.class = options.className = options.style = { structured: true };
84
-
85
- var props = {
86
- visible: undefined,
87
- mod: {
88
- structured: true,
89
- },
90
- ...options,
91
- };
92
-
93
- Object.assign(props, ...arguments);
94
- this.selector = new StructuredSelector({ props: props, values: this });
95
- this.nameMap = this.selector.nameMap;
96
- }
97
-
98
- prepareCSS(context, { data }) {
99
- data.classNames = this.CSS.expand(
100
- this.CSS.block(this.baseClass, data.mod, data.stateMods),
101
- data.class,
102
- data.className,
103
- );
104
- data.style = parseStyle(data.style);
105
- }
106
-
107
- prepareData(context, instance) {
108
- if (this.styled) this.prepareCSS(context, instance);
109
- }
110
-
111
- initInstance(context, instance) {}
112
-
113
- initState(context, instance) {}
114
-
115
- checkVisible(context, instance, data) {
116
- return data.visible;
117
- }
118
-
119
- explore(context, instance) {
120
- if (this.components) instance.components = {};
121
- for (let cmp in this.components) {
122
- let ins = instance.getChild(context, this.components[cmp], "cmp-" + cmp, instance.store);
123
- if (ins.scheduleExploreIfVisible(context)) instance.components[cmp] = ins;
124
- }
125
- }
126
-
127
- render(context, instance, key) {
128
- Console.log(this);
129
- throw new Error(
130
- 'Widget\'s render method should be overridden. This error usually happens if with incorrect imports, i.e. import { TextField } from "cx/data". Please check the console for details about the component configuration.',
131
- );
132
- }
133
-
134
- update() {
135
- this.version = (this.version || 0) + 1;
136
- }
137
-
138
- applyParentStore(instance) {
139
- instance.store = instance.parentStore;
140
-
141
- // check when this is actually needed, perhaps this is needed only for tables and repeated elements
142
- // if (instance.cached) delete instance.cached.rawData; // force prepareData to execute again
143
- }
144
-
145
- static resetCounter() {
146
- widgetId = 100;
147
- }
148
- }
149
-
150
- Widget.prototype.visible = true;
151
- Widget.prototype.memoize = true; //cache rendered content and use it if possible
152
- Widget.prototype.CSS = "cx";
153
- Widget.prototype.styled = false;
154
-
155
- Widget.namespace = "ui.";
156
- Widget.optimizePrepare = true;
157
-
158
- Widget.factory = (type, config, more) => {
159
- throw new Error(`Invalid widget type: ${type}.`);
160
- };
161
-
162
- export function contentAppend(result, w, prependSpace) {
163
- if (w == null || w === false) return false;
164
- if (isArray(w)) w.forEach((c) => contentAppend(result, c));
165
- else if (isDefined(w.content) && !w.atomic) return contentAppend(result, w.content);
166
- else {
167
- if (prependSpace) result.push(" ");
168
- result.push(w);
169
- }
170
- return true;
171
- }
172
-
173
- export function getContentArray(x) {
174
- let result = [];
175
- contentAppend(result, x);
176
- return result;
177
- }
178
-
179
- export function getContent(x) {
180
- let result = getContentArray(x);
181
- if (result.length == 0) return null;
182
- if (result.length == 1) return result[0];
183
- return result;
184
- }
1
+ import { Component } from "../util/Component";
2
+ import { CSSHelper } from "./CSSHelper";
3
+ import "./CSS";
4
+ import { StructuredSelector } from "../data/StructuredSelector";
5
+ import { parseStyle } from "../util/parseStyle";
6
+ import { isString } from "../util/isString";
7
+ import { isDefined } from "../util/isDefined";
8
+ import { isArray } from "../util/isArray";
9
+ import { Console } from "../util/Console";
10
+
11
+ import { VDOM as vdom } from "./VDOM";
12
+ export const VDOM = vdom;
13
+
14
+ let widgetId = 100;
15
+
16
+ export class Widget extends Component {
17
+ constructor(config) {
18
+ super(config);
19
+ this.widgetId = widgetId++;
20
+
21
+ if (isArray(this.jsxSpread)) {
22
+ if (!this.jsxAttributes) this.jsxAttributes = [];
23
+
24
+ this.jsxSpread.forEach((spread) => {
25
+ for (var key in spread) {
26
+ this[key] = spread[key];
27
+ this.jsxAttributes.push(key);
28
+ }
29
+ });
30
+ }
31
+ }
32
+
33
+ init() {
34
+ if (this.styles) this.style = this.styles;
35
+
36
+ if (this.styled) this.style = parseStyle(this.style);
37
+ else if (this.style) {
38
+ Console.warn(
39
+ "Components that allow use of the style attribute should set styled = true on their prototype. This will be an error in future versions.",
40
+ );
41
+ this.style = parseStyle(this.style);
42
+ this.styled = true;
43
+ }
44
+
45
+ if (typeof this.if !== "undefined") this.visible = this.if;
46
+
47
+ this.declareData();
48
+
49
+ if (this.outerLayout) {
50
+ if (isArray(this.outerLayout)) throw new Error("Only single element outer layout is supported.");
51
+ //TODO: better handle the case when outer layout is an array. How to get around circular dependency to PureContainer
52
+ this.outerLayout = Widget.create(this.outerLayout);
53
+ }
54
+
55
+ if (this.contentFor) this.putInto = this.contentFor;
56
+
57
+ if (this.putInto) this.isContent = true;
58
+
59
+ if (isString(this.CSS)) this.CSS = CSSHelper.get(this.CSS);
60
+
61
+ this.initHelpers();
62
+ this.initComponents();
63
+
64
+ this.initialized = true;
65
+ }
66
+
67
+ initComponents() {
68
+ if (arguments.length > 0) {
69
+ this.components = Object.assign(...arguments);
70
+ for (var k in this.components) if (!this.components[k]) delete this.components[k];
71
+ }
72
+ }
73
+
74
+ initHelpers() {
75
+ if (arguments.length > 0) {
76
+ this.helpers = Object.assign(...arguments);
77
+ }
78
+ }
79
+
80
+ declareData() {
81
+ let options = {};
82
+
83
+ if (this.styled) options.class = options.className = options.style = { structured: true };
84
+
85
+ var props = {
86
+ visible: undefined,
87
+ mod: {
88
+ structured: true,
89
+ },
90
+ ...options,
91
+ };
92
+
93
+ Object.assign(props, ...arguments);
94
+ this.selector = new StructuredSelector({ props: props, values: this });
95
+ this.nameMap = this.selector.nameMap;
96
+ }
97
+
98
+ prepareCSS(context, { data }) {
99
+ data.classNames = this.CSS.expand(
100
+ this.CSS.block(this.baseClass, data.mod, data.stateMods),
101
+ data.class,
102
+ data.className,
103
+ );
104
+ data.style = parseStyle(data.style);
105
+ }
106
+
107
+ prepareData(context, instance) {
108
+ if (this.styled) this.prepareCSS(context, instance);
109
+ }
110
+
111
+ initInstance(context, instance) {}
112
+
113
+ initState(context, instance) {}
114
+
115
+ checkVisible(context, instance, data) {
116
+ return data.visible;
117
+ }
118
+
119
+ explore(context, instance) {
120
+ if (this.components) instance.components = {};
121
+ for (let cmp in this.components) {
122
+ let ins = instance.getChild(context, this.components[cmp], "cmp-" + cmp, instance.store);
123
+ if (ins.scheduleExploreIfVisible(context)) instance.components[cmp] = ins;
124
+ }
125
+ }
126
+
127
+ render(context, instance, key) {
128
+ Console.log(this);
129
+ throw new Error(
130
+ 'Widget\'s render method should be overridden. This error usually happens if with incorrect imports, i.e. import { TextField } from "cx/data". Please check the console for details about the component configuration.',
131
+ );
132
+ }
133
+
134
+ update() {
135
+ this.version = (this.version || 0) + 1;
136
+ }
137
+
138
+ applyParentStore(instance) {
139
+ instance.store = instance.parentStore;
140
+
141
+ // check when this is actually needed, perhaps this is needed only for tables and repeated elements
142
+ // if (instance.cached) delete instance.cached.rawData; // force prepareData to execute again
143
+ }
144
+
145
+ static resetCounter() {
146
+ widgetId = 100;
147
+ }
148
+ }
149
+
150
+ Widget.prototype.visible = true;
151
+ Widget.prototype.memoize = true; //cache rendered content and use it if possible
152
+ Widget.prototype.CSS = "cx";
153
+ Widget.prototype.styled = false;
154
+
155
+ Widget.namespace = "ui.";
156
+ Widget.optimizePrepare = true;
157
+
158
+ Widget.factory = (type, config, more) => {
159
+ throw new Error(`Invalid widget type: ${type}.`);
160
+ };
161
+
162
+ export function contentAppend(result, w, prependSpace) {
163
+ if (w == null || w === false) return false;
164
+ if (isArray(w)) w.forEach((c) => contentAppend(result, c));
165
+ else if (isDefined(w.content) && !w.atomic) return contentAppend(result, w.content);
166
+ else {
167
+ if (prependSpace) result.push(" ");
168
+ result.push(w);
169
+ }
170
+ return true;
171
+ }
172
+
173
+ export function getContentArray(x) {
174
+ let result = [];
175
+ contentAppend(result, x);
176
+ return result;
177
+ }
178
+
179
+ export function getContent(x) {
180
+ let result = getContentArray(x);
181
+ if (result.length == 0) return null;
182
+ if (result.length == 1) return result[0];
183
+ return result;
184
+ }
@@ -1,152 +1,152 @@
1
- import { DataAdapter } from "./DataAdapter";
2
- import { ReadOnlyDataView } from "../../data/ReadOnlyDataView";
3
- import { sorter } from "../../data/comparer";
4
- import { isArray } from "../../util/isArray";
5
- import { ArrayElementView } from "../../data/ArrayElementView";
6
- import { getAccessor } from "../../data/getAccessor";
7
- import { Culture } from "../Culture";
8
- import { isDefined, isObject } from "../../util";
9
-
10
- export class ArrayAdapter extends DataAdapter {
11
- init() {
12
- this.recordsAccessor = getAccessor(this.recordsBinding ? this.recordsBinding : this.recordsAccessor);
13
-
14
- //resolve accessor chains
15
- this.recordName = this.recordName.toString();
16
- this.indexName = this.indexName.toString();
17
- }
18
-
19
- initInstance(context, instance) {
20
- if (!instance.recordStoreCache) {
21
- instance.recordStoreCache = new WeakMap();
22
- instance.cacheByKey = {};
23
- }
24
-
25
- if (!instance.recordsAccessor && this.recordsAccessor) {
26
- instance.recordsAccessor = this.recordsAccessor.bindInstance
27
- ? this.recordsAccessor.bindInstance(instance)
28
- : this.recordsAccessor;
29
- }
30
- }
31
-
32
- getRecords(context, instance, records, parentStore) {
33
- if (!instance.recordStoreCache) this.initInstance(context, instance);
34
-
35
- return this.mapRecords(context, instance, records, parentStore, instance.recordsAccessor);
36
- }
37
-
38
- mapRecords(context, instance, records, parentStore, recordsAccessor) {
39
- let result = [];
40
-
41
- if (!instance.recordStoreCache) this.initInstance(context, instance);
42
-
43
- if (isArray(records))
44
- records.forEach((data, index) => {
45
- if (this.filterFn && !this.filterFn(data)) return;
46
-
47
- let record = this.mapRecord(context, instance, data, parentStore, recordsAccessor, index);
48
-
49
- result.push(record);
50
- });
51
-
52
- if (this.sorter) result = this.sorter(result);
53
-
54
- return result;
55
- }
56
-
57
- mapRecord(context, instance, data, parentStore, recordsAccessor, index) {
58
- let key = this.cacheByKeyField && this.keyField ? data[this.keyField] : null;
59
- let recordStore = key != null ? instance.cacheByKey[key] : instance.recordStoreCache.get(data);
60
-
61
- if (recordsAccessor) {
62
- if (!recordStore)
63
- recordStore = new ArrayElementView({
64
- store: parentStore,
65
- arrayAccessor: recordsAccessor,
66
- itemIndex: index,
67
- recordAlias: this.recordName,
68
- indexAlias: this.indexName,
69
- immutable: this.immutable,
70
- sealed: this.sealed,
71
- });
72
- else {
73
- recordStore.setStore(parentStore);
74
- recordStore.setIndex(index);
75
- }
76
- } else {
77
- if (!recordStore)
78
- recordStore = new ReadOnlyDataView({
79
- store: parentStore,
80
- data: {
81
- [this.recordName]: data,
82
- [this.indexName]: index,
83
- },
84
- immutable: this.immutable,
85
- sealed: this.sealed,
86
- });
87
- else {
88
- recordStore.setStore(parentStore);
89
- recordStore.setData(data);
90
- }
91
- }
92
-
93
- // cache by the key or by data reference
94
- if (key != null) instance.cacheByKey[key] = recordStore;
95
- else if (isObject(data)) instance.recordStoreCache.set(data, recordStore);
96
-
97
- return {
98
- store: recordStore,
99
- index: index,
100
- data: data,
101
- type: "data",
102
- key: this.keyField ? data[this.keyField] : index,
103
- };
104
- }
105
-
106
- setFilter(filterFn) {
107
- this.filterFn = filterFn;
108
- }
109
-
110
- getComparer(sortOptions) {
111
- return sortOptions ? Culture.getComparer(sortOptions) : null;
112
- }
113
-
114
- buildSorter(sorters) {
115
- if (isArray(sorters) && sorters.length > 0) {
116
- let fieldValueMapper;
117
- let dataAccessor;
118
-
119
- //if all sorters are based on record fields access data directly (faster)
120
- if (sorters.every((x) => x.field && x.value == null)) {
121
- dataAccessor = (x) => x.data;
122
- fieldValueMapper = (x) => ({ bind: x.field });
123
- } else {
124
- dataAccessor = (x) => x.store.getData();
125
- fieldValueMapper = (x) => ({ bind: this.recordName + "." + x.field });
126
- }
127
- this.sorter = sorter(
128
- sorters.map((x) => {
129
- let s = Object.assign({}, x);
130
- if (s.field && s.value == null) s.value = fieldValueMapper(s);
131
- if (!s.comparer)
132
- s.comparer = this.getComparer(isDefined(s.sortOptions) ? s.sortOptions : this.sortOptions);
133
- return s;
134
- }),
135
- dataAccessor,
136
- );
137
- } else {
138
- this.sorter = null;
139
- }
140
- }
141
-
142
- sort(sorters) {
143
- this.buildSorter(sorters);
144
- }
145
- }
146
-
147
- ArrayAdapter.prototype.immutable = false;
148
- ArrayAdapter.prototype.sealed = false;
149
- ArrayAdapter.prototype.keyField = null;
150
- ArrayAdapter.prototype.cacheByKeyField = true;
151
-
152
- ArrayAdapter.autoInit = true;
1
+ import { DataAdapter } from "./DataAdapter";
2
+ import { ReadOnlyDataView } from "../../data/ReadOnlyDataView";
3
+ import { sorter } from "../../data/comparer";
4
+ import { isArray } from "../../util/isArray";
5
+ import { ArrayElementView } from "../../data/ArrayElementView";
6
+ import { getAccessor } from "../../data/getAccessor";
7
+ import { Culture } from "../Culture";
8
+ import { isDefined, isObject } from "../../util";
9
+
10
+ export class ArrayAdapter extends DataAdapter {
11
+ init() {
12
+ this.recordsAccessor = getAccessor(this.recordsBinding ? this.recordsBinding : this.recordsAccessor);
13
+
14
+ //resolve accessor chains
15
+ this.recordName = this.recordName.toString();
16
+ this.indexName = this.indexName.toString();
17
+ }
18
+
19
+ initInstance(context, instance) {
20
+ if (!instance.recordStoreCache) {
21
+ instance.recordStoreCache = new WeakMap();
22
+ instance.cacheByKey = {};
23
+ }
24
+
25
+ if (!instance.recordsAccessor && this.recordsAccessor) {
26
+ instance.recordsAccessor = this.recordsAccessor.bindInstance
27
+ ? this.recordsAccessor.bindInstance(instance)
28
+ : this.recordsAccessor;
29
+ }
30
+ }
31
+
32
+ getRecords(context, instance, records, parentStore) {
33
+ if (!instance.recordStoreCache) this.initInstance(context, instance);
34
+
35
+ return this.mapRecords(context, instance, records, parentStore, instance.recordsAccessor);
36
+ }
37
+
38
+ mapRecords(context, instance, records, parentStore, recordsAccessor) {
39
+ let result = [];
40
+
41
+ if (!instance.recordStoreCache) this.initInstance(context, instance);
42
+
43
+ if (isArray(records))
44
+ records.forEach((data, index) => {
45
+ if (this.filterFn && !this.filterFn(data)) return;
46
+
47
+ let record = this.mapRecord(context, instance, data, parentStore, recordsAccessor, index);
48
+
49
+ result.push(record);
50
+ });
51
+
52
+ if (this.sorter) result = this.sorter(result);
53
+
54
+ return result;
55
+ }
56
+
57
+ mapRecord(context, instance, data, parentStore, recordsAccessor, index) {
58
+ let key = this.cacheByKeyField && this.keyField ? data[this.keyField] : null;
59
+ let recordStore = key != null ? instance.cacheByKey[key] : instance.recordStoreCache.get(data);
60
+
61
+ if (recordsAccessor) {
62
+ if (!recordStore)
63
+ recordStore = new ArrayElementView({
64
+ store: parentStore,
65
+ arrayAccessor: recordsAccessor,
66
+ itemIndex: index,
67
+ recordAlias: this.recordName,
68
+ indexAlias: this.indexName,
69
+ immutable: this.immutable,
70
+ sealed: this.sealed,
71
+ });
72
+ else {
73
+ recordStore.setStore(parentStore);
74
+ recordStore.setIndex(index);
75
+ }
76
+ } else {
77
+ if (!recordStore)
78
+ recordStore = new ReadOnlyDataView({
79
+ store: parentStore,
80
+ data: {
81
+ [this.recordName]: data,
82
+ [this.indexName]: index,
83
+ },
84
+ immutable: this.immutable,
85
+ sealed: this.sealed,
86
+ });
87
+ else {
88
+ recordStore.setStore(parentStore);
89
+ recordStore.setData(data);
90
+ }
91
+ }
92
+
93
+ // cache by the key or by data reference
94
+ if (key != null) instance.cacheByKey[key] = recordStore;
95
+ else if (isObject(data)) instance.recordStoreCache.set(data, recordStore);
96
+
97
+ return {
98
+ store: recordStore,
99
+ index: index,
100
+ data: data,
101
+ type: "data",
102
+ key: this.keyField ? data[this.keyField] : index,
103
+ };
104
+ }
105
+
106
+ setFilter(filterFn) {
107
+ this.filterFn = filterFn;
108
+ }
109
+
110
+ getComparer(sortOptions) {
111
+ return sortOptions ? Culture.getComparer(sortOptions) : null;
112
+ }
113
+
114
+ buildSorter(sorters) {
115
+ if (isArray(sorters) && sorters.length > 0) {
116
+ let fieldValueMapper;
117
+ let dataAccessor;
118
+
119
+ //if all sorters are based on record fields access data directly (faster)
120
+ if (sorters.every((x) => x.field && x.value == null)) {
121
+ dataAccessor = (x) => x.data;
122
+ fieldValueMapper = (x) => ({ bind: x.field });
123
+ } else {
124
+ dataAccessor = (x) => x.store.getData();
125
+ fieldValueMapper = (x) => ({ bind: this.recordName + "." + x.field });
126
+ }
127
+ this.sorter = sorter(
128
+ sorters.map((x) => {
129
+ let s = Object.assign({}, x);
130
+ if (s.field && s.value == null) s.value = fieldValueMapper(s);
131
+ if (!s.comparer)
132
+ s.comparer = this.getComparer(isDefined(s.sortOptions) ? s.sortOptions : this.sortOptions);
133
+ return s;
134
+ }),
135
+ dataAccessor,
136
+ );
137
+ } else {
138
+ this.sorter = null;
139
+ }
140
+ }
141
+
142
+ sort(sorters) {
143
+ this.buildSorter(sorters);
144
+ }
145
+ }
146
+
147
+ ArrayAdapter.prototype.immutable = false;
148
+ ArrayAdapter.prototype.sealed = false;
149
+ ArrayAdapter.prototype.keyField = null;
150
+ ArrayAdapter.prototype.cacheByKeyField = true;
151
+
152
+ ArrayAdapter.autoInit = true;