cx 24.0.1 → 24.0.3

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 +169 -235
  2. package/dist/data.js +42 -85
  3. package/dist/hooks.js +1 -1
  4. package/dist/manifest.js +763 -760
  5. package/dist/svg.js +47 -97
  6. package/dist/ui.js +180 -242
  7. package/dist/util.js +9 -7
  8. package/dist/widgets.js +1296 -1517
  9. package/locale/de-de.js +6 -1
  10. package/locale/en-us.js +5 -1
  11. package/locale/es-es.js +6 -1
  12. package/locale/fr-fr.js +7 -2
  13. package/locale/nl-nl.js +4 -5
  14. package/locale/pt-pt.js +12 -1
  15. package/locale/sr-latn-ba.js +6 -2
  16. package/package.json +1 -1
  17. package/src/data/StructuredSelector.d.ts +1 -1
  18. package/src/data/ops/updateTree.js +1 -1
  19. package/src/data/ops/updateTree.spec.js +16 -14
  20. package/src/ui/Culture.d.ts +0 -3
  21. package/src/ui/DataProxy.d.ts +1 -0
  22. package/src/ui/DataProxy.js +2 -2
  23. package/src/ui/Localization.js +0 -2
  24. package/src/ui/Rescope.js +2 -2
  25. package/src/ui/Text.js +2 -4
  26. package/src/ui/adapter/DataAdapter.js +7 -12
  27. package/src/ui/adapter/GroupAdapter.d.ts +22 -3
  28. package/src/ui/adapter/TreeAdapter.d.ts +23 -3
  29. package/src/widgets/form/DateTimeField.d.ts +86 -86
  30. package/src/widgets/form/DateTimeField.js +569 -572
  31. package/src/widgets/form/Field.js +24 -9
  32. package/src/widgets/form/FieldIcon.js +42 -0
  33. package/src/widgets/form/LookupField.d.ts +174 -174
  34. package/src/widgets/form/LookupField.js +1130 -1131
  35. package/src/widgets/form/MonthField.d.ts +37 -38
  36. package/src/widgets/form/MonthField.js +6 -9
  37. package/src/widgets/form/NumberField.d.ts +2 -2
  38. package/src/widgets/form/NumberField.js +5 -9
  39. package/src/widgets/form/Select.d.ts +31 -35
  40. package/src/widgets/form/Select.js +7 -12
  41. package/src/widgets/form/TextField.d.ts +2 -2
  42. package/src/widgets/form/TextField.js +6 -5
  43. package/src/widgets/grid/Grid.d.ts +9 -6
  44. package/src/widgets/grid/Grid.js +3277 -3276
  45. package/src/widgets/overlay/Dropdown.d.ts +1 -0
@@ -1,88 +1,87 @@
1
- import * as Cx from '../../core';
2
- import { FieldProps } from './Field';
1
+ import * as Cx from "../../core";
2
+ import { FieldProps } from "./Field";
3
3
 
4
4
  interface MonthFieldProps extends FieldProps {
5
-
6
5
  /** Selected month. This should be a Date object or a valid date string consumable by Date.parse function. */
7
- value?: Cx.Prop< string | Date >,
8
-
6
+ value?: Cx.Prop<string | Date>;
7
+
9
8
  /** Set to `true` to allow range select. */
10
- range?: Cx.BooleanProp,
9
+ range?: Cx.BooleanProp;
11
10
 
12
- /**
11
+ /**
13
12
  * Start of the selected month range. This should be a Date object or a valid date string consumable by Date.parse function.
14
13
  * Used only if `range` is set to `true`.
15
14
  */
16
- from?: Cx.Prop< string | Date >,
15
+ from?: Cx.Prop<string | Date>;
17
16
 
18
- /**
17
+ /**
19
18
  * End of the selected month range. This should be a Date object or a valid date string consumable by Date.parse function.
20
- * Used only if `range` is set to `true`.
19
+ * Used only if `range` is set to `true`.
21
20
  */
22
- to?: Cx.Prop< string | Date >,
21
+ to?: Cx.Prop<string | Date>;
23
22
 
24
23
  /** Defaults to `false`. Used to make the field read-only. */
25
- readOnly?: Cx.BooleanProp,
24
+ readOnly?: Cx.BooleanProp;
26
25
 
27
26
  /** The opposite of `disabled`. */
28
- enabled?: Cx.BooleanProp,
27
+ enabled?: Cx.BooleanProp;
29
28
 
30
29
  /** Default text displayed when the field is empty. */
31
- placeholder?: Cx.StringProp,
30
+ placeholder?: Cx.StringProp;
32
31
 
33
32
  /** Minimum date value. This should be a Date object or a valid date string consumable by Date.parse function. */
34
- minValue?: Cx.Prop< string | Date >,
33
+ minValue?: Cx.Prop<string | Date>;
35
34
 
36
35
  /** Set to `true` to disallow the `minValue`. Default value is `false`. */
37
- minExclusive?: Cx.BooleanProp,
36
+ minExclusive?: Cx.BooleanProp;
38
37
 
39
38
  /** Maximum date value. This should be a Date object or a valid date string consumable by Date.parse function. */
40
- maxValue?: Cx.Prop< string | Date >,
41
-
39
+ maxValue?: Cx.Prop<string | Date>;
40
+
42
41
  /** Set to `true` to disallow the `maxValue`. Default value is `false`. */
43
- maxExclusive?: Cx.BooleanProp,
42
+ maxExclusive?: Cx.BooleanProp;
44
43
 
45
44
  /** String representing culture. Default is `en` */
46
- culture?: string,
45
+ culture?: string;
47
46
 
48
- /**
49
- * Set to `true` to hide the clear button. It can be used interchangeably with the `showClear` property.
50
- * Default value is `false`.
47
+ /**
48
+ * Set to `true` to hide the clear button. It can be used interchangeably with the `showClear` property.
49
+ * Default value is `false`.
51
50
  */
52
- hideClear?: boolean,
51
+ hideClear?: boolean;
53
52
 
54
53
  /** Base CSS class to be applied on the field. Defaults to `monthfield`. */
55
- baseClass?: string,
54
+ baseClass?: string;
56
55
 
57
56
  /** Maximum value error text. */
58
- maxValueErrorText?: string,
57
+ maxValueErrorText?: string;
59
58
 
60
59
  /** Maximum exclusive value error text. */
61
- maxExclusiveErrorText?: string,
60
+ maxExclusiveErrorText?: string;
62
61
 
63
62
  /** Minimum value error text. */
64
- minValueErrorText?: string,
63
+ minValueErrorText?: string;
65
64
 
66
65
  /** Minimum exclusive value error text. */
67
- minExclusiveErrorText?: string,
66
+ minExclusiveErrorText?: string;
68
67
 
69
68
  /** Invalid input error text. */
70
- inputErrorText?: string,
69
+ inputErrorText?: string;
71
70
 
72
- /** Name of the icon to be put on the left side of the input. */
73
- icon?: string,
71
+ /** Name or configuration of the icon to be put on the left side of the input. */
72
+ icon?: Cx.StringProp | Cx.Record;
74
73
 
75
- /**
76
- * Set to `false` to hide the clear button. It can be used interchangeably with the `hideClear` property.
77
- * Default value is `true`.
74
+ /**
75
+ * Set to `false` to hide the clear button. It can be used interchangeably with the `hideClear` property.
76
+ * Default value is `true`.
78
77
  */
79
- showClear?: boolean,
78
+ showClear?: boolean;
80
79
 
81
80
  /**
82
81
  * Set to `true` to display the clear button even if `required` is set. Default is `false`.
83
82
  */
84
- alwaysShowClear?: boolean,
85
-
83
+ alwaysShowClear?: boolean;
84
+
86
85
  /** The function that will be used to convert Date objects before writing data to the store.
87
86
  * Default implementation is Date.toISOString.
88
87
  * See also Culture.setDefaultDateEncoding.
@@ -63,7 +63,7 @@ export class MonthField extends Field {
63
63
  maxExclusive: undefined,
64
64
  icon: undefined,
65
65
  },
66
- ...arguments
66
+ ...arguments,
67
67
  );
68
68
  }
69
69
 
@@ -163,6 +163,7 @@ export class MonthField extends Field {
163
163
  }}
164
164
  label={this.labelPlacement && getContent(this.renderLabel(context, instance, "label"))}
165
165
  help={this.helpPlacement && getContent(this.renderHelp(context, instance, "help"))}
166
+ icon={this.renderIcon(context, instance, "icon")}
166
167
  />
167
168
  );
168
169
  }
@@ -261,7 +262,7 @@ class MonthInput extends VDOM.Component {
261
262
  }
262
263
 
263
264
  render() {
264
- var { instance, label, help, data } = this.props;
265
+ var { instance, label, help, data, icon: iconVDOM } = this.props;
265
266
  var { widget, state } = instance;
266
267
  var { CSS, baseClass, suppressErrorsUntilVisited } = widget;
267
268
 
@@ -294,12 +295,8 @@ class MonthInput extends VDOM.Component {
294
295
  );
295
296
  }
296
297
 
297
- if (data.icon) {
298
- icon = (
299
- <div className={CSS.element(baseClass, "left-icon")}>
300
- {Icon.render(data.icon, { className: CSS.element(baseClass, "icon") })}
301
- </div>
302
- );
298
+ if (iconVDOM) {
299
+ icon = <div className={CSS.element(baseClass, "left-icon")}>{iconVDOM}</div>;
303
300
  }
304
301
 
305
302
  var dropdown = false;
@@ -325,7 +322,7 @@ class MonthInput extends VDOM.Component {
325
322
  icon: !!icon,
326
323
  empty: empty && !data.placeholder,
327
324
  error: data.error && (state.visited || !suppressErrorsUntilVisited || !empty),
328
- })
325
+ }),
329
326
  )}
330
327
  style={data.style}
331
328
  onMouseDown={this.onMouseDown.bind(this)}
@@ -51,8 +51,8 @@ interface NumberFieldProps extends FieldProps {
51
51
  /** Round values to the nearest tick. Default is `true`. */
52
52
  snapToIncrement?: boolean;
53
53
 
54
- /** Name of the icon to be put on the left side of the input. */
55
- icon?: string;
54
+ /** Name or configuration of the icon to be put on the left side of the input. */
55
+ icon?: Cx.StringProp | Cx.Record;
56
56
 
57
57
  /** Set to `false` to hide the clear button. It can be used interchangeably with the `hideClear` property. Default value is `true`. */
58
58
  showClear?: boolean;
@@ -11,7 +11,6 @@ import {
11
11
  tooltipParentDidMount,
12
12
  } from "../overlay/tooltip-ops";
13
13
  import { stopPropagation } from "../../util/eventCallbacks";
14
- import { Icon } from "../Icon";
15
14
  import { Localization } from "../../ui/Localization";
16
15
  import ClearIcon from "../icons/clear";
17
16
  import { isString } from "../../util/isString";
@@ -46,7 +45,7 @@ export class NumberField extends Field {
46
45
  scale: undefined,
47
46
  offset: undefined,
48
47
  },
49
- ...arguments
48
+ ...arguments,
50
49
  );
51
50
  }
52
51
 
@@ -110,6 +109,7 @@ export class NumberField extends Field {
110
109
  instance={instance}
111
110
  label={this.labelPlacement && getContent(this.renderLabel(context, instance, "label"))}
112
111
  help={this.helpPlacement && getContent(this.renderHelp(context, instance, "help"))}
112
+ icon={this.renderIcon(context, instance, "icon")}
113
113
  />
114
114
  );
115
115
  }
@@ -151,15 +151,11 @@ class Input extends VDOM.Component {
151
151
  }
152
152
 
153
153
  render() {
154
- let { data, instance, label, help } = this.props;
154
+ let { data, instance, label, help, icon: iconVDOM } = this.props;
155
155
  let { widget, state } = instance;
156
156
  let { CSS, baseClass, suppressErrorsUntilVisited } = widget;
157
157
 
158
- let icon = data.icon && (
159
- <div className={CSS.element(baseClass, "left-icon")}>
160
- {Icon.render(data.icon, { className: CSS.element(baseClass, "icon") })}
161
- </div>
162
- );
158
+ let icon = iconVDOM && <div className={CSS.element(baseClass, "left-icon")}>{iconVDOM}</div>;
163
159
 
164
160
  let insideButton;
165
161
  if (!data.readOnly && !data.disabled) {
@@ -190,7 +186,7 @@ class Input extends VDOM.Component {
190
186
  icon: !!icon,
191
187
  empty: empty && !data.placeholder,
192
188
  error: data.error && (state.visited || !suppressErrorsUntilVisited || !empty),
193
- })
189
+ }),
194
190
  )}
195
191
  style={data.style}
196
192
  onMouseDown={stopPropagation}
@@ -1,73 +1,69 @@
1
- import * as Cx from '../../core';
2
- import { FieldProps } from './Field';
1
+ import * as Cx from "../../core";
2
+ import { FieldProps } from "./Field";
3
3
 
4
4
  interface SelectProps extends FieldProps {
5
-
6
5
  /** Select value. */
7
- value?: Cx.Prop<number | string>,
6
+ value?: Cx.Prop<number | string>;
8
7
 
9
8
  /** Value when no selection is made. Default is `undefined` */
10
- emptyValue?: any,
9
+ emptyValue?: any;
11
10
 
12
11
  /** The opposite of `disabled`. */
13
- enabled?: Cx.BooleanProp,
12
+ enabled?: Cx.BooleanProp;
14
13
 
15
14
  /** Default text displayed when the field is empty. */
16
- placeholder?: Cx.StringProp,
17
-
18
- /**
19
- * Set to `true` to hide the clear button. It can be used interchangeably with the `showClear` property. Default value is `false`.
20
- * Note, the `placeholder` needs to be specified for the clear button to render.
15
+ placeholder?: Cx.StringProp;
16
+
17
+ /**
18
+ * Set to `true` to hide the clear button. It can be used interchangeably with the `showClear` property. Default value is `false`.
19
+ * Note, the `placeholder` needs to be specified for the clear button to render.
21
20
  */
22
- hideClear?: boolean,
23
-
21
+ hideClear?: boolean;
22
+
24
23
  /**
25
- * Set to `false` to hide the clear button. It can be used interchangeably with the `hideClear` property. Default value is `true`.
26
- * Note, the `placeholder` needs to be specified for the clear button to render.
24
+ * Set to `false` to hide the clear button. It can be used interchangeably with the `hideClear` property. Default value is `true`.
25
+ * Note, the `placeholder` needs to be specified for the clear button to render.
27
26
  */
28
- showClear?: boolean,
27
+ showClear?: boolean;
29
28
 
30
29
  /**
31
30
  * Set to `true` to display the clear button even if `required` is set. Default is `false`.
32
31
  */
33
- alwaysShowClear?: boolean,
34
-
32
+ alwaysShowClear?: boolean;
33
+
35
34
  /** Base CSS class to be applied to the element. Defaults to `select`. */
36
- baseClass?: string,
35
+ baseClass?: string;
37
36
 
38
37
  /** Defaults to `false`. Set to `true` to enable multiple selection. */
39
- multiple?: boolean,
38
+ multiple?: boolean;
40
39
 
41
- /**
42
- * Convert values before selection.
43
- * Useful for converting strings into numbers. Default is `true`.
40
+ /**
41
+ * Convert values before selection.
42
+ * Useful for converting strings into numbers. Default is `true`.
44
43
  */
45
- convertValues?: boolean,
46
-
44
+ convertValues?: boolean;
45
+
47
46
  /** String value used to indicate a `null` entry */
48
- nullString?: string,
49
-
50
- /** Name of the icon to be put on the left side of the input. */
51
- icon?: string
47
+ nullString?: string;
52
48
 
49
+ /** Name or configuration of the icon to be put on the left side of the input. */
50
+ icon?: Cx.StringProp | Cx.Record;
53
51
  }
54
52
 
55
53
  export class Select extends Cx.Widget<SelectProps> {}
56
54
 
57
55
  interface OptionProps extends Cx.HtmlElementProps {
58
-
59
56
  /** Value property. */
60
- value?: Cx.StringProp,
57
+ value?: Cx.StringProp;
61
58
 
62
59
  /** Defaults to `false`. Set to `true` to disable the field. */
63
- disabled?: Cx.BooleanProp,
60
+ disabled?: Cx.BooleanProp;
64
61
 
65
62
  /** The opposite of `disabled`. */
66
- enabled?: Cx.BooleanProp,
63
+ enabled?: Cx.BooleanProp;
67
64
 
68
65
  /** Defaults to `false`. Set to `true` to select the the option. */
69
- selected?: Cx.BooleanProp,
70
-
66
+ selected?: Cx.BooleanProp;
71
67
  }
72
68
 
73
69
  export class Option extends Cx.Widget<OptionProps> {}
@@ -3,7 +3,6 @@ import { HtmlElement } from "../HtmlElement";
3
3
  import { Field, getFieldTooltip } from "./Field";
4
4
  import {
5
5
  tooltipParentWillReceiveProps,
6
- tooltipParentWillUnmount,
7
6
  tooltipMouseMove,
8
7
  tooltipMouseLeave,
9
8
  tooltipParentDidMount,
@@ -11,7 +10,6 @@ import {
11
10
  import { stopPropagation, preventDefault } from "../../util/eventCallbacks";
12
11
  import DropdownIcon from "../icons/drop-down";
13
12
  import ClearIcon from "../icons/clear";
14
- import { Icon } from "../Icon";
15
13
  import { Localization } from "../../ui/Localization";
16
14
  import { isString } from "../../util/isString";
17
15
  import { isDefined } from "../../util/isDefined";
@@ -29,7 +27,7 @@ export class Select extends Field {
29
27
  placeholder: undefined,
30
28
  icon: undefined,
31
29
  },
32
- ...arguments
30
+ ...arguments,
33
31
  );
34
32
  }
35
33
 
@@ -48,6 +46,7 @@ export class Select extends Field {
48
46
  select={(v) => this.select(v, instance)}
49
47
  label={this.labelPlacement && getContent(this.renderLabel(context, instance, "label"))}
50
48
  help={this.helpPlacement && getContent(this.renderHelp(context, instance, "help"))}
49
+ icon={this.renderIcon(context, instance, "icon")}
51
50
  >
52
51
  {this.renderChildren(context, instance)}
53
52
  </SelectComponent>
@@ -95,15 +94,11 @@ class SelectComponent extends VDOM.Component {
95
94
  }
96
95
 
97
96
  render() {
98
- let { multiple, select, instance, label, help } = this.props;
97
+ let { multiple, select, instance, label, help, icon: iconVDOM } = this.props;
99
98
  let { data, widget, state } = instance;
100
99
  let { CSS, baseClass } = widget;
101
100
 
102
- let icon = data.icon && (
103
- <div className={CSS.element(baseClass, "left-icon")}>
104
- {Icon.render(data.icon, { className: CSS.element(baseClass, "icon") })}
105
- </div>
106
- );
101
+ let icon = iconVDOM && <div className={CSS.element(baseClass, "left-icon")}>{iconVDOM}</div>;
107
102
 
108
103
  let insideButton,
109
104
  readOnly = data.disabled || data.readOnly;
@@ -148,11 +143,11 @@ class SelectComponent extends VDOM.Component {
148
143
  data.classNames,
149
144
  CSS.state({
150
145
  visited: state.visited,
151
- icon: data.icon,
146
+ icon: !!iconVDOM,
152
147
  focus: this.state.focus,
153
148
  error: state.visited && data.error,
154
149
  empty: data.empty && !data.placeholder,
155
- })
150
+ }),
156
151
  )}
157
152
  style={data.style}
158
153
  onMouseDown={stopPropagation}
@@ -252,7 +247,7 @@ export class Option extends HtmlElement {
252
247
  selected: undefined,
253
248
  text: undefined,
254
249
  },
255
- ...arguments
250
+ ...arguments,
256
251
  );
257
252
  }
258
253
 
@@ -63,8 +63,8 @@ export interface TextFieldProps extends FieldProps {
63
63
  /** Regular expression used to validate the user's input. */
64
64
  validationRegExp?: RegExp;
65
65
 
66
- /** Name of the icon to be put on the left side of the input. */
67
- icon?: Cx.StringProp;
66
+ /** Name or configuration of the icon to be put on the left side of the input. */
67
+ icon?: Cx.StringProp | Cx.Record;
68
68
 
69
69
  /** If trackFocus is set, this value will be set when the field receives or loses focus. */
70
70
  focused?: Cx.BooleanProp;
@@ -39,7 +39,7 @@ export class TextField extends Field {
39
39
  icon: undefined,
40
40
  trim: undefined,
41
41
  },
42
- ...arguments
42
+ ...arguments,
43
43
  );
44
44
  }
45
45
 
@@ -51,6 +51,7 @@ export class TextField extends Field {
51
51
  data={instance.data}
52
52
  label={this.labelPlacement && getContent(this.renderLabel(context, instance, "label"))}
53
53
  help={this.helpPlacement && getContent(this.renderHelp(context, instance, "help"))}
54
+ icon={this.renderIcon(context, instance, "icon")}
54
55
  />
55
56
  );
56
57
  }
@@ -95,17 +96,17 @@ class Input extends VDOM.Component {
95
96
  }
96
97
 
97
98
  render() {
98
- let { instance, data, label, help } = this.props;
99
+ let { instance, data, label, help, icon: iconVDOM } = this.props;
99
100
  let { widget, state } = instance;
100
101
  let { CSS, baseClass, suppressErrorsUntilVisited } = widget;
101
102
 
102
- let icon = data.icon && (
103
+ let icon = iconVDOM && (
103
104
  <div
104
105
  className={CSS.element(baseClass, "left-icon")}
105
106
  onMouseDown={preventDefault}
106
107
  onClick={(e) => this.onChange(e, "enter")}
107
108
  >
108
- {Icon.render(data.icon, { className: CSS.element(baseClass, "icon") })}
109
+ {iconVDOM}
109
110
  </div>
110
111
  );
111
112
 
@@ -141,7 +142,7 @@ class Input extends VDOM.Component {
141
142
  clear: insideButton != null,
142
143
  empty: empty && !data.placeholder,
143
144
  error: data.error && (state.visited || !suppressErrorsUntilVisited || !empty),
144
- })
145
+ }),
145
146
  )}
146
147
  style={data.style}
147
148
  onMouseDown={stopPropagation}
@@ -54,11 +54,11 @@ interface GridColumnDropEvent extends DragEvent {
54
54
 
55
55
  interface GridGroupingKey {
56
56
  [key: string]:
57
- | Prop<any>
58
- | {
59
- value: Prop<any>;
60
- direction: SortDirection;
61
- };
57
+ | Prop<any>
58
+ | {
59
+ value: Prop<any>;
60
+ direction: SortDirection;
61
+ };
62
62
  }
63
63
 
64
64
  type GridColumnAlignment = "left" | "right" | "center";
@@ -385,6 +385,9 @@ interface GridProps<T = unknown> extends StyledContainerProps {
385
385
 
386
386
  /** Callback to create a function that can be used to check whether a record is draggable. */
387
387
  onCreateIsRecordDraggable?: (params: any, instance: Instance) => (record: T) => boolean;
388
+
389
+ /** Callback function to get grid component and instance references on component init. */
390
+ onRef?: string | ((element: any, instance: Instance) => void);
388
391
  }
389
392
 
390
393
  interface GridCellInfo {
@@ -401,4 +404,4 @@ interface GridCellEditInfo<T> extends GridCellInfo {
401
404
  newData: T;
402
405
  }
403
406
 
404
- export class Grid<T = unknown> extends Widget<GridProps<T>> {}
407
+ export class Grid<T = unknown> extends Widget<GridProps<T>> { }