cx 23.11.1 → 23.12.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/widgets.js CHANGED
@@ -9301,12 +9301,12 @@ var LookupComponent = /*#__PURE__*/ (function (_VDOM$Component) {
9301
9301
  if (this.props.multiple) {
9302
9302
  var readOnly = data.disabled || data.readOnly;
9303
9303
  if (isNonEmptyArray(data.records)) {
9304
- var _this$onGetRecordDisp2;
9304
+ var _widget$onGetRecordDi;
9305
9305
  var valueTextFormatter =
9306
- (_this$onGetRecordDisp2 = this.onGetRecordDisplayText) != null
9307
- ? _this$onGetRecordDisp2
9306
+ (_widget$onGetRecordDi = widget.onGetRecordDisplayText) != null
9307
+ ? _widget$onGetRecordDi
9308
9308
  : function (record) {
9309
- return record[_this9.valueTextField];
9309
+ return record[widget.valueTextField];
9310
9310
  };
9311
9311
  text = data.records.map(function (v, i) {
9312
9312
  return /*#__PURE__*/ jsxs(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "23.11.1",
3
+ "version": "23.12.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,18 +1,20 @@
1
- interface Aggregator {
2
- process(value: number, weight?: number);
3
- getResult(): number
4
- }
5
-
6
- export class AggregateFunction {
7
- static sum(): Aggregator;
8
-
9
- static avg(): Aggregator;
10
-
11
- static count(): Aggregator;
12
-
13
- static distinct(): Aggregator;
14
-
15
- static min(): Aggregator;
16
-
17
- static max(): Aggregator;
18
- }
1
+ interface Aggregator {
2
+ process(value: number, weight?: number);
3
+ getResult(): number;
4
+ }
5
+
6
+ export class AggregateFunction {
7
+ static sum(): Aggregator;
8
+
9
+ static avg(): Aggregator;
10
+
11
+ static count(): Aggregator;
12
+
13
+ static distinct(): Aggregator;
14
+
15
+ static min(): Aggregator;
16
+
17
+ static max(): Aggregator;
18
+
19
+ static last(): Aggregator;
20
+ }
@@ -1,149 +1,145 @@
1
- export class AggregateFunction {
2
- static sum() {
3
- return new Sum();
4
- }
5
-
6
- static avg() {
7
- return new Avg();
8
- }
9
-
10
- static count() {
11
- return new Count();
12
- }
13
-
14
- static distinct() {
15
- return new Distinct();
16
- }
17
-
18
- static min() {
19
- return new Min();
20
- }
21
-
22
- static max() {
23
- return new Max();
24
- }
25
- }
26
-
27
- class Sum {
28
- process(value) {
29
- this.empty = false;
30
- if (!isNaN(value))
31
- this.result += value;
32
- else
33
- this.invalid = true;
34
- }
35
-
36
- getResult() {
37
- if (this.invalid)
38
- return null;
39
- return this.result;
40
- }
41
- }
42
-
43
- Sum.prototype.result = 0;
44
- Sum.prototype.empty = true;
45
-
46
- class Avg {
47
- process(value, count = 1) {
48
- this.empty = false;
49
- if (!isNaN(value) && !isNaN(count)) {
50
- this.result += value * count;
51
- this.count += count;
52
- }
53
- else
54
- this.invalid = true;
55
- }
56
-
57
- getResult() {
58
- if (this.empty || this.invalid || this.count == 0)
59
- return null;
60
- return this.result / this.count;
61
- }
62
- }
63
-
64
- Avg.prototype.result = 0;
65
- Avg.prototype.count = 0;
66
- Avg.prototype.empty = true;
67
-
68
- class Count {
69
- process(value) {
70
- if (value != null)
71
- this.result++;
72
- }
73
-
74
- getResult() {
75
- return this.result;
76
- }
77
- }
78
-
79
- Count.prototype.result = 0;
80
-
81
-
82
- class Distinct {
83
- constructor() {
84
- this.values = {};
85
- }
86
-
87
- process(value) {
88
- if (value == null || this.values[value])
89
- return;
90
- this.values[value] = true;
91
- this.empty = false;
92
- this.result++;
93
- }
94
-
95
- getResult() {
96
- if (this.empty || this.invalid)
97
- return null;
98
- return this.result;
99
- }
100
- }
101
-
102
- Distinct.prototype.result = 0;
103
- Distinct.prototype.empty = true;
104
-
105
- class Max {
106
- process(value) {
107
- if (!isNaN(value)) {
108
- if (this.empty)
109
- this.result = value;
110
- else if (value > this.result)
111
- this.result = value;
112
- this.empty = false;
113
- }
114
- else if (value != null)
115
- this.invalid = true;
116
- }
117
-
118
- getResult() {
119
- if (this.empty || this.invalid)
120
- return null;
121
- return this.result;
122
- }
123
- }
124
-
125
- Max.prototype.result = 0;
126
- Max.prototype.empty = true;
127
-
128
- class Min {
129
- process(value) {
130
- if (!isNaN(value)) {
131
- if (this.empty)
132
- this.result = value;
133
- else if (value < this.result)
134
- this.result = value;
135
- this.empty = false;
136
- }
137
- else if (value != null)
138
- this.invalid = true;
139
- }
140
-
141
- getResult() {
142
- if (this.empty || this.invalid)
143
- return null;
144
- return this.result;
145
- }
146
- }
147
-
148
- Min.prototype.result = 0;
149
- Min.prototype.empty = true;
1
+ export class AggregateFunction {
2
+ static sum() {
3
+ return new Sum();
4
+ }
5
+
6
+ static avg() {
7
+ return new Avg();
8
+ }
9
+
10
+ static count() {
11
+ return new Count();
12
+ }
13
+
14
+ static distinct() {
15
+ return new Distinct();
16
+ }
17
+
18
+ static min() {
19
+ return new Min();
20
+ }
21
+
22
+ static max() {
23
+ return new Max();
24
+ }
25
+
26
+ static last() {
27
+ return new LastValue();
28
+ }
29
+ }
30
+
31
+ class Sum {
32
+ process(value) {
33
+ this.empty = false;
34
+ if (!isNaN(value)) this.result += value;
35
+ else this.invalid = true;
36
+ }
37
+
38
+ getResult() {
39
+ if (this.invalid) return null;
40
+ return this.result;
41
+ }
42
+ }
43
+
44
+ Sum.prototype.result = 0;
45
+ Sum.prototype.empty = true;
46
+
47
+ class Avg {
48
+ process(value, count = 1) {
49
+ this.empty = false;
50
+ if (!isNaN(value) && !isNaN(count)) {
51
+ this.result += value * count;
52
+ this.count += count;
53
+ } else this.invalid = true;
54
+ }
55
+
56
+ getResult() {
57
+ if (this.empty || this.invalid || this.count == 0) return null;
58
+ return this.result / this.count;
59
+ }
60
+ }
61
+
62
+ Avg.prototype.result = 0;
63
+ Avg.prototype.count = 0;
64
+ Avg.prototype.empty = true;
65
+
66
+ class Count {
67
+ process(value) {
68
+ if (value != null) this.result++;
69
+ }
70
+
71
+ getResult() {
72
+ return this.result;
73
+ }
74
+ }
75
+
76
+ Count.prototype.result = 0;
77
+
78
+ class Distinct {
79
+ constructor() {
80
+ this.values = {};
81
+ }
82
+
83
+ process(value) {
84
+ if (value == null || this.values[value]) return;
85
+ this.values[value] = true;
86
+ this.empty = false;
87
+ this.result++;
88
+ }
89
+
90
+ getResult() {
91
+ if (this.empty || this.invalid) return null;
92
+ return this.result;
93
+ }
94
+ }
95
+
96
+ Distinct.prototype.result = 0;
97
+ Distinct.prototype.empty = true;
98
+
99
+ class Max {
100
+ process(value) {
101
+ if (!isNaN(value)) {
102
+ if (this.empty) this.result = value;
103
+ else if (value > this.result) this.result = value;
104
+ this.empty = false;
105
+ } else if (value != null) this.invalid = true;
106
+ }
107
+
108
+ getResult() {
109
+ if (this.empty || this.invalid) return null;
110
+ return this.result;
111
+ }
112
+ }
113
+
114
+ Max.prototype.result = 0;
115
+ Max.prototype.empty = true;
116
+
117
+ class Min {
118
+ process(value) {
119
+ if (!isNaN(value)) {
120
+ if (this.empty) this.result = value;
121
+ else if (value < this.result) this.result = value;
122
+ this.empty = false;
123
+ } else if (value != null) this.invalid = true;
124
+ }
125
+
126
+ getResult() {
127
+ if (this.empty || this.invalid) return null;
128
+ return this.result;
129
+ }
130
+ }
131
+
132
+ Min.prototype.result = 0;
133
+ Min.prototype.empty = true;
134
+
135
+ class LastValue {
136
+ process(value) {
137
+ this.result = value;
138
+ }
139
+
140
+ getResult() {
141
+ return this.result;
142
+ }
143
+ }
144
+
145
+ LastValue.prototype.result = null;
@@ -8,9 +8,9 @@ interface SandboxProps extends Cx.PureContainerProps {
8
8
 
9
9
  accessKey?: Cx.StringProp;
10
10
 
11
- recordName?: string;
12
- recordAlias?: string;
13
- immutable?: boolean;
11
+ recordName?: Cx.RecordAlias;
12
+ recordAlias?: Cx.RecordAlias;
13
+ immutable?: Cx.BooleanProp;
14
14
  }
15
15
 
16
16
  export class Sandbox extends Cx.Widget<SandboxProps> {}
@@ -590,7 +590,7 @@ class LookupComponent extends VDOM.Component {
590
590
  if (this.props.multiple) {
591
591
  let readOnly = data.disabled || data.readOnly;
592
592
  if (isNonEmptyArray(data.records)) {
593
- let valueTextFormatter = this.onGetRecordDisplayText ?? ((record) => record[this.valueTextField]);
593
+ let valueTextFormatter = widget.onGetRecordDisplayText ?? ((record) => record[widget.valueTextField]);
594
594
  text = data.records.map((v, i) => (
595
595
  <div
596
596
  key={i}
@@ -136,6 +136,7 @@ interface GridColumnConfig {
136
136
 
137
137
  /** Options for data sorting. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator */
138
138
  sortOptions?: CollatorOptions;
139
+ colSpan?: NumberProp;
139
140
  }
140
141
 
141
142
  interface GridRowLineConfig {