cx 23.3.0 → 23.4.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
@@ -3784,7 +3784,6 @@ var Selection = /*#__PURE__*/ (function(_Component) {
3784
3784
  })(Component);
3785
3785
  Selection.prototype.toggle = false;
3786
3786
  Selection.namespace = "ui.selection.";
3787
-
3788
3787
  var SimpleSelection = /*#__PURE__*/ (function(_Selection) {
3789
3788
  _inheritsLoose(SimpleSelection, _Selection);
3790
3789
 
@@ -5211,6 +5210,7 @@ export {
5211
5210
  ResizeManager,
5212
5211
  Restate,
5213
5212
  Selection,
5213
+ SimpleSelection,
5214
5214
  StaticText,
5215
5215
  StructuredInstanceDataAccessor,
5216
5216
  Text,
package/dist/widgets.js CHANGED
@@ -3935,7 +3935,7 @@ var OverlayComponent = /*#__PURE__*/ (function(_VDOM$Component2) {
3935
3935
  this.shadowEl,
3936
3936
  "wheel",
3937
3937
  function(e) {
3938
- if (e.shiftKey) return; //check if there is a scrollable element within the shadow or overlay contents
3938
+ if (e.shiftKey || e.ctrlKey) return; //check if there is a scrollable element within the shadow or overlay contents
3939
3939
  //such that its scrollbar is not at the very end
3940
3940
 
3941
3941
  var scrollAllowed = false;
@@ -11709,7 +11709,7 @@ var Input$1 = /*#__PURE__*/ (function(_VDOM$Component) {
11709
11709
  var decimalSeparator = this.getDecimalSeparator(fmt) || Format.value(1.1, "n;1")[1];
11710
11710
  var formatted = Format.value(value, fmt); //re-parse to avoid differences between formatted value and value in the store
11711
11711
 
11712
- value = widget.parseValue(formatted, instance) * data.scale + data.offset; //allow users to type numbers like 100.0003 without interruptions
11712
+ value = widget.parseValue(formatted, instance) * data.scale + data.offset; //allow users to type numbers like 100.0003 or -0.05 without interruptions
11713
11713
  //if the last typed in character is zero or dot (decimal separator) skip processing it
11714
11714
 
11715
11715
  if (
@@ -11717,7 +11717,8 @@ var Input$1 = /*#__PURE__*/ (function(_VDOM$Component) {
11717
11717
  this.input.selectionStart == this.input.selectionEnd &&
11718
11718
  this.input.selectionEnd >= this.getLengthWithoutSuffix(this.input.value, decimalSeparator) &&
11719
11719
  (e.target.value[this.input.selectionEnd - 1] == decimalSeparator ||
11720
- (e.target.value.indexOf(decimalSeparator) >= 0 && e.target.value[this.input.selectionEnd - 1] == "0"))
11720
+ (e.target.value.indexOf(decimalSeparator) >= 0 && e.target.value[this.input.selectionEnd - 1] == "0") ||
11721
+ (this.input.selectionEnd == 2 && e.target.value[0] === "-" && e.target.value[1] === "0"))
11721
11722
  )
11722
11723
  return;
11723
11724
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "23.3.0",
3
+ "version": "23.4.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",
@@ -21,6 +21,44 @@ export function computable(
21
21
  p4: string,
22
22
  computeFn: (v1: any, v2: any, v3: any, v4: any) => any
23
23
  ): Computable;
24
+ export function computable(
25
+ p1: string,
26
+ p2: string,
27
+ p3: string,
28
+ p4: string,
29
+ p5: string,
30
+ computeFn: (v1: any, v2: any, v3: any, v4: any, v5: any) => any
31
+ ): Computable;
32
+ export function computable(
33
+ p1: string,
34
+ p2: string,
35
+ p3: string,
36
+ p4: string,
37
+ p5: string,
38
+ p6: string,
39
+ computeFn: (v1: any, v2: any, v3: any, v4: any, v5: any, v6: any) => any
40
+ ): Computable;
41
+ export function computable(
42
+ p1: string,
43
+ p2: string,
44
+ p3: string,
45
+ p4: string,
46
+ p5: string,
47
+ p6: string,
48
+ p7: string,
49
+ computeFn: (v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any) => any
50
+ ): Computable;
51
+ export function computable(
52
+ p1: string,
53
+ p2: string,
54
+ p3: string,
55
+ p4: string,
56
+ p5: string,
57
+ p6: string,
58
+ p7: string,
59
+ p8: string,
60
+ computeFn: (v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any, v8: any) => any
61
+ ): Computable;
24
62
 
25
63
  export function computable<V1, R>(arg1: AccessorChain<V1>, compute: (v1: V1) => R): Computable<R>;
26
64
  export function computable<V1, V2, R>(
@@ -43,3 +81,45 @@ export function computable<V1, V2, V3, V4, R>(
43
81
  arg4: AccessorChain<V4>,
44
82
  compute: (v1: V1, v2: V2, v3: V3, v4: V4) => R
45
83
  ): Computable<R>;
84
+
85
+ export function computable<V1, V2, V3, V4, V5, R>(
86
+ arg1: AccessorChain<V1>,
87
+ arg2: AccessorChain<V2>,
88
+ arg3: AccessorChain<V3>,
89
+ arg4: AccessorChain<V4>,
90
+ arg5: AccessorChain<V5>,
91
+ compute: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5) => R
92
+ ): Computable<R>;
93
+
94
+ export function computable<V1, V2, V3, V4, V5, V6, R>(
95
+ arg1: AccessorChain<V1>,
96
+ arg2: AccessorChain<V2>,
97
+ arg3: AccessorChain<V3>,
98
+ arg4: AccessorChain<V4>,
99
+ arg5: AccessorChain<V5>,
100
+ arg6: AccessorChain<V6>,
101
+ compute: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5, v6: V6) => R
102
+ ): Computable<R>;
103
+
104
+ export function computable<V1, V2, V3, V4, V5, V6, V7, R>(
105
+ arg1: AccessorChain<V1>,
106
+ arg2: AccessorChain<V2>,
107
+ arg3: AccessorChain<V3>,
108
+ arg4: AccessorChain<V4>,
109
+ arg5: AccessorChain<V5>,
110
+ arg6: AccessorChain<V6>,
111
+ arg7: AccessorChain<V7>,
112
+ compute: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5, v6: V6, v7: V7) => R
113
+ ): Computable<R>;
114
+
115
+ export function computable<V1, V2, V3, V4, V5, V6, V7, V8, R>(
116
+ arg1: AccessorChain<V1>,
117
+ arg2: AccessorChain<V2>,
118
+ arg3: AccessorChain<V3>,
119
+ arg4: AccessorChain<V4>,
120
+ arg5: AccessorChain<V5>,
121
+ arg6: AccessorChain<V6>,
122
+ arg7: AccessorChain<V7>,
123
+ arg8: AccessorChain<V8>,
124
+ compute: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5, v6: V6, v7: V7, v8: V8) => R
125
+ ): Computable<R>;
@@ -37,6 +37,60 @@ export class Controller<D = any> {
37
37
  callback: (v1: V1, v2: V2, v3: V3, v4: V4) => void,
38
38
  autoRun?: boolean
39
39
  ): void;
40
+ addTrigger<V1, V2, V3, V4, V5>(
41
+ name: string,
42
+ args: [
43
+ Cx.AccessorChain<V1>,
44
+ Cx.AccessorChain<V2>,
45
+ Cx.AccessorChain<V3>,
46
+ Cx.AccessorChain<V4>,
47
+ Cx.AccessorChain<V5>
48
+ ],
49
+ callback: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5) => void,
50
+ autoRun?: boolean
51
+ ): void;
52
+ addTrigger<V1, V2, V3, V4, V5, V6>(
53
+ name: string,
54
+ args: [
55
+ Cx.AccessorChain<V1>,
56
+ Cx.AccessorChain<V2>,
57
+ Cx.AccessorChain<V3>,
58
+ Cx.AccessorChain<V4>,
59
+ Cx.AccessorChain<V5>,
60
+ Cx.AccessorChain<V6>
61
+ ],
62
+ callback: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5, v6: V6) => void,
63
+ autoRun?: boolean
64
+ ): void;
65
+ addTrigger<V1, V2, V3, V4, V5, V6, V7>(
66
+ name: string,
67
+ args: [
68
+ Cx.AccessorChain<V1>,
69
+ Cx.AccessorChain<V2>,
70
+ Cx.AccessorChain<V3>,
71
+ Cx.AccessorChain<V4>,
72
+ Cx.AccessorChain<V5>,
73
+ Cx.AccessorChain<V6>,
74
+ Cx.AccessorChain<V7>
75
+ ],
76
+ callback: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5, v6: V6, v7: V7) => void,
77
+ autoRun?: boolean
78
+ ): void;
79
+ addTrigger<V1, V2, V3, V4, V5, V6, V7, V8>(
80
+ name: string,
81
+ args: [
82
+ Cx.AccessorChain<V1>,
83
+ Cx.AccessorChain<V2>,
84
+ Cx.AccessorChain<V3>,
85
+ Cx.AccessorChain<V4>,
86
+ Cx.AccessorChain<V5>,
87
+ Cx.AccessorChain<V6>,
88
+ Cx.AccessorChain<V7>,
89
+ Cx.AccessorChain<V8>
90
+ ],
91
+ callback: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5, v6: V6, v7: V7, v8: v8) => void,
92
+ autoRun?: boolean
93
+ ): void;
40
94
 
41
95
  addTrigger(
42
96
  name: string,
@@ -61,6 +115,56 @@ export class Controller<D = any> {
61
115
  args: [Cx.AccessorChain<V1>, Cx.AccessorChain<V2>, Cx.AccessorChain<V3>, Cx.AccessorChain<V4>],
62
116
  callback: (v1: V1, v2: V2, v3: V3, v4: V4) => R
63
117
  ): void;
118
+ addComputable<V1, V2, V3, V4, V5, R>(
119
+ path: Cx.AccessorChain<R>,
120
+ args: [
121
+ Cx.AccessorChain<V1>,
122
+ Cx.AccessorChain<V2>,
123
+ Cx.AccessorChain<V3>,
124
+ Cx.AccessorChain<V4>,
125
+ Cx.AccessorChain<V5>
126
+ ],
127
+ callback: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5) => R
128
+ ): void;
129
+ addComputable<V1, V2, V3, V4, V5, V6, R>(
130
+ path: Cx.AccessorChain<R>,
131
+ args: [
132
+ Cx.AccessorChain<V1>,
133
+ Cx.AccessorChain<V2>,
134
+ Cx.AccessorChain<V3>,
135
+ Cx.AccessorChain<V4>,
136
+ Cx.AccessorChain<V5>,
137
+ Cx.AccessorChain<V6>
138
+ ],
139
+ callback: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5, v6: V6) => R
140
+ ): void;
141
+ addComputable<V1, V2, V3, V4, V5, V6, V7, R>(
142
+ path: Cx.AccessorChain<R>,
143
+ args: [
144
+ Cx.AccessorChain<V1>,
145
+ Cx.AccessorChain<V2>,
146
+ Cx.AccessorChain<V3>,
147
+ Cx.AccessorChain<V4>,
148
+ Cx.AccessorChain<V5>,
149
+ Cx.AccessorChain<V6>,
150
+ Cx.AccessorChain<V7>
151
+ ],
152
+ callback: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5, v6: V6, v7: V7) => R
153
+ ): void;
154
+ addComputable<V1, V2, V3, V4, V5, V6, V7, V8, R>(
155
+ path: Cx.AccessorChain<R>,
156
+ args: [
157
+ Cx.AccessorChain<V1>,
158
+ Cx.AccessorChain<V2>,
159
+ Cx.AccessorChain<V3>,
160
+ Cx.AccessorChain<V4>,
161
+ Cx.AccessorChain<V5>,
162
+ Cx.AccessorChain<V6>,
163
+ Cx.AccessorChain<V7>,
164
+ Cx.AccessorChain<V8>
165
+ ],
166
+ callback: (v1: V1, v2: V2, v3: V3, v4: V4, v5: V5, v6: V6, v7: V7, v8: V8) => R
167
+ ): void;
64
168
 
65
169
  addComputable(path: string, args: (string | Cx.AccessorChain<any>)[], callback: (...args) => any): void;
66
170
 
@@ -1,19 +1,18 @@
1
- import {Record} from '../../core';
2
- import {Component} from '../../util/Component';
3
- import {View} from '../../data/View';
4
- import {Instance} from '../Instance';
1
+ import { Record } from "../../core";
2
+ import { Component } from "../../util/Component";
3
+ import { View } from "../../data/View";
4
+ import { Instance } from "../Instance";
5
5
 
6
6
  interface SelectOptions {
7
- add: Boolean;
8
- toggle: Boolean;
7
+ add: Boolean;
8
+ toggle: Boolean;
9
9
  }
10
10
 
11
11
  export class Selection extends Component {
12
-
13
12
  isSelected(store: View, record: Record, index?: number);
14
13
 
15
- getIsSelectedDelegate(store: View) : (record: Record, index: number) => boolean;
16
-
14
+ getIsSelectedDelegate(store: View): (record: Record, index: number) => boolean;
15
+
17
16
  select(store: View, record: Record, index: number);
18
17
 
19
18
  declareData(): Record;
@@ -23,5 +22,6 @@ export class Selection extends Component {
23
22
  selectInstance(instance: Instance, options: SelectOptions);
24
23
 
25
24
  isInstanceSelected(instance: Instance): boolean;
26
-
27
25
  }
26
+
27
+ export class SimpleSelection extends Selection {}
@@ -1,7 +1,6 @@
1
- import {Component} from '../../util/Component';
1
+ import { Component } from "../../util/Component";
2
2
 
3
3
  export class Selection extends Component {
4
-
5
4
  isSelected(store, record, index) {
6
5
  return this.bind && store.get(this.bind) === record;
7
6
  }
@@ -9,9 +8,9 @@ export class Selection extends Component {
9
8
  getIsSelectedDelegate(store) {
10
9
  return (record, index) => this.isSelected(store, record, index);
11
10
  }
12
-
11
+
13
12
  select(store, record, index, options) {
14
- this.selectMultiple(store, [record], [index], options)
13
+ this.selectMultiple(store, [record], [index], options);
15
14
  }
16
15
 
17
16
  selectMultiple(store, records, indexes, options) {
@@ -20,43 +19,43 @@ export class Selection extends Component {
20
19
 
21
20
  declareData() {
22
21
  var declaration = {
23
- $selection: { structured: true }
22
+ $selection: { structured: true },
24
23
  };
25
24
 
26
25
  return Object.assign(declaration, ...arguments);
27
26
  }
28
27
 
29
28
  configureWidget(widget) {
30
-
31
29
  if (this.record || this.index) {
32
30
  widget.$selection = Object.assign(widget.$selection || {}, {
33
31
  record: this.record,
34
- index: this.index
35
- })
32
+ index: this.index,
33
+ });
36
34
  }
37
35
 
38
36
  return this.declareData();
39
37
  }
40
38
 
41
39
  selectInstance(instance, options) {
42
- var {store, data} = instance;
40
+ var { store, data } = instance;
43
41
  if (!data.$selection)
44
- throw new Error('Selection model not properly configured. Using the selectInstance method without specified record and index bindings.');
42
+ throw new Error(
43
+ "Selection model not properly configured. Using the selectInstance method without specified record and index bindings."
44
+ );
45
45
  return this.select(store, data.$selection.record, data.$selection.index, options);
46
46
  }
47
47
 
48
48
  isInstanceSelected(instance) {
49
- var {store, data} = instance;
49
+ var { store, data } = instance;
50
50
  return data.$selection && this.isSelected(store, data.$selection.record, data.$selection.index);
51
51
  }
52
52
  }
53
53
 
54
54
  Selection.prototype.toggle = false;
55
55
 
56
- Selection.namespace = 'ui.selection.';
57
-
58
- class SimpleSelection extends Selection {
56
+ Selection.namespace = "ui.selection.";
59
57
 
58
+ export class SimpleSelection extends Selection {
60
59
  isSelected(store, record, index) {
61
60
  return this.getIsSelectedDelegate(store)(record, index);
62
61
  }
@@ -67,8 +66,7 @@ class SimpleSelection extends Selection {
67
66
  }
68
67
 
69
68
  selectMultiple(store, records, index) {
70
- if (this.bind)
71
- store.set(this.bind, records[0]);
69
+ if (this.bind) store.set(this.bind, records[0]);
72
70
  }
73
71
  }
74
72
 
@@ -89,9 +87,7 @@ class DummySelection extends Selection {
89
87
  DummySelection.prototype.isDummy = true;
90
88
 
91
89
  Selection.factory = (name) => {
92
- if (typeof name == 'object')
93
- return new SimpleSelection(name);
90
+ if (typeof name == "object") return new SimpleSelection(name);
94
91
 
95
92
  return new DummySelection();
96
93
  };
97
-
@@ -417,14 +417,15 @@ class Input extends VDOM.Component {
417
417
 
418
418
  value = widget.parseValue(formatted, instance) * data.scale + data.offset;
419
419
 
420
- //allow users to type numbers like 100.0003 without interruptions
420
+ //allow users to type numbers like 100.0003 or -0.05 without interruptions
421
421
  //if the last typed in character is zero or dot (decimal separator) skip processing it
422
422
  if (
423
423
  change == "change" &&
424
424
  this.input.selectionStart == this.input.selectionEnd &&
425
425
  this.input.selectionEnd >= this.getLengthWithoutSuffix(this.input.value, decimalSeparator) &&
426
426
  (e.target.value[this.input.selectionEnd - 1] == decimalSeparator ||
427
- (e.target.value.indexOf(decimalSeparator) >= 0 && e.target.value[this.input.selectionEnd - 1] == "0"))
427
+ (e.target.value.indexOf(decimalSeparator) >= 0 && e.target.value[this.input.selectionEnd - 1] == "0") ||
428
+ (this.input.selectionEnd == 2 && e.target.value[0] === "-" && e.target.value[1] === "0"))
428
429
  )
429
430
  return;
430
431
 
@@ -103,6 +103,7 @@ interface GridColumnConfig {
103
103
  header1?: StringProp | GridColumnHeaderConfig;
104
104
  header2?: StringProp | GridColumnHeaderConfig;
105
105
  header3?: StringProp | GridColumnHeaderConfig;
106
+ fixed?: BooleanProp;
106
107
  sortable?: boolean;
107
108
  aggregate?: "min" | "max" | "count" | "sum" | "distinct" | "avg";
108
109
  aggregateAlias?: string;
@@ -626,7 +626,7 @@ export class OverlayComponent extends VDOM.Component {
626
626
  this.shadowEl,
627
627
  "wheel",
628
628
  (e) => {
629
- if (e.shiftKey) return;
629
+ if (e.shiftKey || e.ctrlKey) return;
630
630
  //check if there is a scrollable element within the shadow or overlay contents
631
631
  //such that its scrollbar is not at the very end
632
632
  let scrollAllowed = false;