cx 23.3.1 → 23.4.1

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;
@@ -7392,6 +7392,7 @@ var ValidationError = /*#__PURE__*/ (function(_Widget) {
7392
7392
  {
7393
7393
  className: data.classNames,
7394
7394
  htmlFor: data.fieldId,
7395
+ style: data.style,
7395
7396
  children: data.errorMessage
7396
7397
  },
7397
7398
  key
@@ -17046,8 +17047,9 @@ var Validator = /*#__PURE__*/ (function(_Field) {
17046
17047
  return false;
17047
17048
  };
17048
17049
 
17049
- _proto.render = function render() {
17050
- return null;
17050
+ _proto.render = function render(context, instance, key) {
17051
+ if (!instance.state.visited || !instance.data.error) return;
17052
+ return this.renderChildren(context, instance, key);
17051
17053
  };
17052
17054
 
17053
17055
  return Validator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "23.3.1",
3
+ "version": "23.4.1",
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,4 +1,4 @@
1
- import { StructuredProp, Record, StructuredSelector as SS } from "../core";
1
+ import { StructuredProp, Record, Selector } from "../core";
2
2
  import { View } from "./View";
3
3
 
4
4
  interface StructuredSelectorConfig {
@@ -11,5 +11,7 @@ export class StructuredSelector {
11
11
 
12
12
  init(store: View);
13
13
 
14
- create(memoize?: bool = true): SS;
14
+ create(memoize?: bool = true): Selector<Record>;
15
+
16
+ createStoreSelector(): (store: View) => Record;
15
17
  }
@@ -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
-
@@ -1,10 +1,15 @@
1
- import {Widget, VDOM} from '../../ui/Widget';
1
+ import { Widget, VDOM } from "../../ui/Widget";
2
2
 
3
3
  export class ValidationError extends Widget {
4
-
5
4
  checkVisible(context, instance, data) {
6
- if (data.visible && context.lastFieldId && context.validation && context.validation.errors && context.validation.errors.length > 0) {
7
- var lastError = instance.lastError = context.validation.errors[context.validation.errors.length - 1];
5
+ if (
6
+ data.visible &&
7
+ context.lastFieldId &&
8
+ context.validation &&
9
+ context.validation.errors &&
10
+ context.validation.errors.length > 0
11
+ ) {
12
+ var lastError = (instance.lastError = context.validation.errors[context.validation.errors.length - 1]);
8
13
  return lastError.fieldId == context.lastFieldId && lastError.visited;
9
14
  }
10
15
 
@@ -12,9 +17,9 @@ export class ValidationError extends Widget {
12
17
  }
13
18
 
14
19
  explore(context, instance) {
15
- var {data, lastError} = instance;
16
- let c1 = instance.cache('lastErrorMessage', lastError.message);
17
- let c2 = instance.cache('lastErrorFieldId', lastError.fieldId);
20
+ var { data, lastError } = instance;
21
+ let c1 = instance.cache("lastErrorMessage", lastError.message);
22
+ let c2 = instance.cache("lastErrorFieldId", lastError.fieldId);
18
23
  if (c1 || c2) {
19
24
  data.errorMessage = lastError.message;
20
25
  data.fieldId = lastError.fieldId;
@@ -24,14 +29,16 @@ export class ValidationError extends Widget {
24
29
  }
25
30
 
26
31
  render(context, instance, key) {
27
- var {data} = instance;
28
- return <label key={key} className={data.classNames} htmlFor={data.fieldId}>
29
- {data.errorMessage}
30
- </label>
32
+ var { data } = instance;
33
+ return (
34
+ <label key={key} className={data.classNames} htmlFor={data.fieldId} style={data.style}>
35
+ {data.errorMessage}
36
+ </label>
37
+ );
31
38
  }
32
39
  }
33
40
 
34
- ValidationError.prototype.baseClass = 'validationerror';
41
+ ValidationError.prototype.baseClass = "validationerror";
35
42
  ValidationError.prototype.styled = true;
36
43
 
37
- Widget.alias('validation-error', ValidationError);
44
+ Widget.alias("validation-error", ValidationError);
@@ -14,7 +14,8 @@ export class Validator extends Field {
14
14
  return false;
15
15
  }
16
16
 
17
- render() {
18
- return null;
17
+ render(context, instance, key) {
18
+ if (!instance.state.visited || !instance.data.error) return;
19
+ return this.renderChildren(context, instance, key);
19
20
  }
20
21
  }
@@ -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;