cx 23.6.0 → 23.8.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/ui.js CHANGED
@@ -1123,6 +1123,9 @@ var Repeater = /*#__PURE__*/ (function (_Container) {
1123
1123
  };
1124
1124
  this.dataAdapter.setFilter(filter);
1125
1125
  instance.mappedRecords = this.dataAdapter.getRecords(context, instance, data.records, instance.store);
1126
+ if (this.onTrackMappedRecords) {
1127
+ instance.invoke("onTrackMappedRecords", instance.mappedRecords, instance);
1128
+ }
1126
1129
  _Container.prototype.prepareData.call(this, context, instance);
1127
1130
  };
1128
1131
  _proto.explore = function explore(context, instance, data) {
package/dist/widgets.js CHANGED
@@ -8663,7 +8663,7 @@ var LookupField = /*#__PURE__*/ (function (_Field) {
8663
8663
  });
8664
8664
  }
8665
8665
  if (this.text) {
8666
- if (isAccessorChain(this.text)) this.value = bind(this.text);
8666
+ if (isAccessorChain(this.text)) this.text = bind(this.text);
8667
8667
  if (this.text.bind)
8668
8668
  b.push({
8669
8669
  local: this.text.bind,
@@ -8874,7 +8874,7 @@ function getOptionKey(bindings, data) {
8874
8874
  }
8875
8875
  function areKeysEqual(key1, key2) {
8876
8876
  if (!key1 || !key2 || key1.length != key2.length) return false;
8877
- for (var i = 0; i < key1.length; i++) if (key1[i] != key2[i]) return false;
8877
+ for (var i = 0; i < key1.length; i++) if (key1[i] !== key2[i]) return false;
8878
8878
  return true;
8879
8879
  }
8880
8880
  function convertOption(bindings, data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "23.6.0",
3
+ "version": "23.8.0",
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,3 +1,6 @@
1
- import { BoundedObjectProps } from "../svg/BoundedObject";
1
+ import { Widget } from "cx/src/core";
2
+ import { BoundedObject, BoundedObjectProps } from "../svg/BoundedObject";
2
3
 
3
- export class PieLabelsContainer extends BoundedObjectProps {}
4
+ interface PieLabelsContainerProps extends BoundedObjectProps {}
5
+
6
+ export class PieLabelsContainer extends Widget<PieLabelsContainerProps> {}
@@ -1,52 +1,61 @@
1
- import {
2
- RecordsProp,
3
- RecordAlias,
4
- StringProp,
5
- SortersProp,
6
- StructuredProp,
7
- CollatorOptions,
8
- Widget,
9
- PureContainerProps,
10
- Record,
11
- } from "../core";
12
- import { Instance } from "./Instance";
13
-
14
- interface RepeaterProps extends PureContainerProps {
15
- records: RecordsProp;
16
- recordName?: RecordAlias;
17
- recordAlias?: RecordAlias;
18
- indexName?: RecordAlias;
19
- indexAlias?: RecordAlias;
20
- cached?: boolean;
21
-
22
- /** Indicate that parent store data should not be mutated. */
23
- immutable?: boolean;
24
-
25
- /** Indicate that record stores should not be mutated. */
26
- sealed?: boolean;
27
-
28
- sorters?: SortersProp;
29
-
30
- /** A binding used to store the name of the field used for sorting the collection. Available only if `sorters` are not used. */
31
- sortField?: StringProp;
32
-
33
- /** A binding used to store the sort direction. Available only if `sorters` are not used. Possible values are `"ASC"` and `"DESC"`. Defaults to `"ASC"`. */
34
- sortDirection?: StringProp;
35
-
36
- /** Parameters that affect filtering */
37
- filterParams?: StructuredProp;
38
-
39
- /** Callback to create a filter function for given filter params. */
40
- onCreateFilter?: (filterParams: any, instance: Instance) => (record: Record) => boolean;
41
-
42
- /** Options for data sorting. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator */
43
- sortOptions?: CollatorOptions;
44
-
45
- /** A field used to get the unique identifier of the record. Setting keyField improves performance on sort operations as the widget is able to movement of records inside the collection. */
46
- keyField?: StringProp;
47
-
48
- /** Data adapter used to convert data in the list of records. Used for manipulation of records, e.g flattening the tree records. */
49
- dataAdapter?: any;
50
- }
51
-
52
- export class Repeater extends Widget<RepeaterProps> {}
1
+ import {
2
+ RecordsProp,
3
+ RecordAlias,
4
+ StringProp,
5
+ SortersProp,
6
+ StructuredProp,
7
+ CollatorOptions,
8
+ Widget,
9
+ PureContainerProps,
10
+ Record,
11
+ Prop,
12
+ SortDirection,
13
+ } from "../core";
14
+ import { Instance } from "./Instance";
15
+
16
+ interface RepeaterProps extends PureContainerProps {
17
+ records: RecordsProp;
18
+ recordName?: RecordAlias;
19
+ recordAlias?: RecordAlias;
20
+ indexName?: RecordAlias;
21
+ indexAlias?: RecordAlias;
22
+ cached?: boolean;
23
+
24
+ /** Indicate that parent store data should not be mutated. */
25
+ immutable?: boolean;
26
+
27
+ /** Indicate that record stores should not be mutated. */
28
+ sealed?: boolean;
29
+
30
+ sorters?: SortersProp;
31
+
32
+ /** A binding used to store the name of the field used for sorting the collection. Available only if `sorters` are not used. */
33
+ sortField?: StringProp;
34
+
35
+ /** A binding used to store the sort direction. Available only if `sorters` are not used. Possible values are `"ASC"` and `"DESC"`. Defaults to `"ASC"`. */
36
+ sortDirection?: Prop<SortDirection>;
37
+
38
+ /** Parameters that affect filtering */
39
+ filterParams?: StructuredProp;
40
+
41
+ /** Callback to create a filter function for given filter params. */
42
+ onCreateFilter?: (filterParams: any, instance: Instance) => (record: Record) => boolean;
43
+
44
+ /**
45
+ * Callback function to track and retrieve displayed records.
46
+ * Accepts new records as a first argument.
47
+ * If onCreateFilter callback is defined, filtered records can be retrieved using this callback.
48
+ */
49
+ onTrackMappedRecords?: string | ((records: Record[], instance: Instance) => void);
50
+
51
+ /** Options for data sorting. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator */
52
+ sortOptions?: CollatorOptions;
53
+
54
+ /** A field used to get the unique identifier of the record. Setting keyField improves performance on sort operations as the widget is able to movement of records inside the collection. */
55
+ keyField?: StringProp;
56
+
57
+ /** Data adapter used to convert data in the list of records. Used for manipulation of records, e.g flattening the tree records. */
58
+ dataAdapter?: any;
59
+ }
60
+
61
+ export class Repeater extends Widget<RepeaterProps> {}
@@ -1,33 +1,32 @@
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";
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
- records: undefined,
13
- sorters: undefined,
14
- sortField: undefined,
15
- sortDirection: undefined,
16
- filterParams: {
17
- structured: true
18
- }
19
- }, ...arguments);
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
- field: data.sortField,
63
- direction: data.sortDirection || "ASC"
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
- filter = instance.invoke("onCreateFilter", data.filterParams, instance);
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('recordData', record.data) || subInstance.cache('key', record.key);
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 = '$record';
93
- Repeater.prototype.indexName = '$index';
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('repeater', Repeater);
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: Cx.StyleProp;
36
+ draggedStyle?: Cx.StyleProp;
37
37
 
38
38
  /** Additional CSS class to be applied to the clone of the element being dragged. */
39
- cloneClass: Cx.ClassProp;
39
+ cloneClass?: Cx.ClassProp;
40
40
 
41
41
  /** Additional CSS class to be applied to the element being dragged. */
42
- draggedClass: Cx.ClassProp;
42
+ draggedClass?: Cx.ClassProp;
43
43
  }
44
44
 
45
45
  export class DragSource extends Cx.Widget<DragSourceProps> {}