cx 24.0.2 → 24.2.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.
Files changed (62) hide show
  1. package/dist/data.js +15 -26
  2. package/dist/manifest.js +525 -522
  3. package/dist/ui.js +1 -1
  4. package/dist/widgets.js +162 -77
  5. package/locale/de-de.js +6 -1
  6. package/locale/en-us.js +5 -1
  7. package/locale/es-es.js +6 -1
  8. package/locale/fr-fr.js +7 -2
  9. package/locale/nl-nl.js +4 -5
  10. package/locale/pt-pt.js +12 -1
  11. package/locale/sr-latn-ba.js +6 -2
  12. package/package.json +1 -1
  13. package/src/charts/ColorMap.js +4 -6
  14. package/src/charts/axis/Axis.d.ts +96 -96
  15. package/src/charts/axis/Axis.js +252 -252
  16. package/src/data/Expression.js +212 -212
  17. package/src/data/Expression.spec.js +174 -174
  18. package/src/data/StringTemplate.spec.js +105 -105
  19. package/src/data/StructuredSelector.d.ts +1 -1
  20. package/src/data/ops/updateTree.js +1 -1
  21. package/src/data/ops/updateTree.spec.js +16 -14
  22. package/src/ui/Controller.d.ts +182 -182
  23. package/src/ui/Culture.d.ts +0 -3
  24. package/src/ui/DataProxy.d.ts +1 -0
  25. package/src/ui/DataProxy.js +2 -2
  26. package/src/ui/FocusManager.js +171 -171
  27. package/src/ui/Format.js +87 -87
  28. package/src/ui/Instance.d.ts +72 -72
  29. package/src/ui/Localization.js +0 -2
  30. package/src/ui/Rescope.js +2 -2
  31. package/src/ui/Text.js +2 -4
  32. package/src/ui/adapter/DataAdapter.js +7 -12
  33. package/src/ui/adapter/GroupAdapter.d.ts +22 -3
  34. package/src/ui/adapter/TreeAdapter.d.ts +23 -3
  35. package/src/ui/keyboardShortcuts.js +4 -5
  36. package/src/ui/selection/KeySelection.d.ts +1 -1
  37. package/src/ui/selection/PropertySelection.d.ts +1 -1
  38. package/src/ui/selection/PropertySelection.js +2 -4
  39. package/src/ui/selection/Selection.d.ts +1 -1
  40. package/src/widgets/form/ColorField.js +14 -9
  41. package/src/widgets/form/ColorPicker.scss +275 -275
  42. package/src/widgets/form/ColorPicker.variables.scss +22 -22
  43. package/src/widgets/form/DateTimeField.d.ts +86 -86
  44. package/src/widgets/form/DateTimeField.js +573 -572
  45. package/src/widgets/form/Field.js +24 -9
  46. package/src/widgets/form/FieldIcon.js +42 -0
  47. package/src/widgets/form/Label.js +88 -88
  48. package/src/widgets/form/LookupField.d.ts +173 -174
  49. package/src/widgets/form/LookupField.js +1130 -1131
  50. package/src/widgets/form/MonthField.d.ts +37 -38
  51. package/src/widgets/form/MonthField.js +16 -15
  52. package/src/widgets/form/NumberField.d.ts +2 -2
  53. package/src/widgets/form/NumberField.js +13 -13
  54. package/src/widgets/form/Select.d.ts +31 -35
  55. package/src/widgets/form/Select.js +7 -12
  56. package/src/widgets/form/TextArea.js +10 -6
  57. package/src/widgets/form/TextField.d.ts +2 -2
  58. package/src/widgets/form/TextField.js +17 -14
  59. package/src/widgets/form/UploadButton.d.ts +34 -34
  60. package/src/widgets/form/index.js +1 -2
  61. package/src/widgets/grid/Grid.d.ts +5 -2
  62. package/src/widgets/overlay/Dropdown.d.ts +1 -0
@@ -15,6 +15,7 @@ import { Localization } from "../../ui/Localization";
15
15
  import ClearIcon from "../icons/clear";
16
16
  import { autoFocus } from "../autoFocus";
17
17
  import { isString } from "../../util/isString";
18
+ import { getActiveElement } from "../../util/getActiveElement";
18
19
 
19
20
  export class TextField extends Field {
20
21
  init() {
@@ -39,7 +40,7 @@ export class TextField extends Field {
39
40
  icon: undefined,
40
41
  trim: undefined,
41
42
  },
42
- ...arguments
43
+ ...arguments,
43
44
  );
44
45
  }
45
46
 
@@ -51,6 +52,7 @@ export class TextField extends Field {
51
52
  data={instance.data}
52
53
  label={this.labelPlacement && getContent(this.renderLabel(context, instance, "label"))}
53
54
  help={this.helpPlacement && getContent(this.renderHelp(context, instance, "help"))}
55
+ icon={this.renderIcon(context, instance, "icon")}
54
56
  />
55
57
  );
56
58
  }
@@ -95,17 +97,17 @@ class Input extends VDOM.Component {
95
97
  }
96
98
 
97
99
  render() {
98
- let { instance, data, label, help } = this.props;
100
+ let { instance, data, label, help, icon: iconVDOM } = this.props;
99
101
  let { widget, state } = instance;
100
102
  let { CSS, baseClass, suppressErrorsUntilVisited } = widget;
101
103
 
102
- let icon = data.icon && (
104
+ let icon = iconVDOM && (
103
105
  <div
104
106
  className={CSS.element(baseClass, "left-icon")}
105
107
  onMouseDown={preventDefault}
106
- onClick={(e) => this.onChange(e, "enter")}
108
+ onClick={(e) => this.onChange(e.target.value, "enter")}
107
109
  >
108
- {Icon.render(data.icon, { className: CSS.element(baseClass, "icon") })}
110
+ {iconVDOM}
109
111
  </div>
110
112
  );
111
113
 
@@ -141,7 +143,7 @@ class Input extends VDOM.Component {
141
143
  clear: insideButton != null,
142
144
  empty: empty && !data.placeholder,
143
145
  error: data.error && (state.visited || !suppressErrorsUntilVisited || !empty),
144
- })
146
+ }),
145
147
  )}
146
148
  style={data.style}
147
149
  onMouseDown={stopPropagation}
@@ -163,8 +165,8 @@ class Input extends VDOM.Component {
163
165
  {...data.inputAttrs}
164
166
  onMouseMove={this.onMouseMove.bind(this)}
165
167
  onMouseLeave={this.onMouseLeave.bind(this)}
166
- onInput={(e) => this.onChange(e, "input")}
167
- onChange={(e) => this.onChange(e, "change")}
168
+ onInput={(e) => this.onChange(e.target.value, "input")}
169
+ onChange={(e) => this.onChange(e.target.value, "change")}
168
170
  onKeyDown={this.onKeyDown.bind(this)}
169
171
  onFocus={this.onFocus.bind(this)}
170
172
  onBlur={this.onBlur.bind(this)}
@@ -197,7 +199,7 @@ class Input extends VDOM.Component {
197
199
  });
198
200
  this.props.instance.set("focused", false);
199
201
  }
200
- this.onChange(e, "blur");
202
+ this.onChange(e.target.value, "blur");
201
203
  }
202
204
 
203
205
  onClearClick(e) {
@@ -222,6 +224,7 @@ class Input extends VDOM.Component {
222
224
  }
223
225
 
224
226
  componentWillUnmount() {
227
+ if (this.input == getActiveElement()) this.onChange(this.input.value, "blur");
225
228
  tooltipParentWillUnmount(this.props.instance);
226
229
  }
227
230
 
@@ -231,7 +234,7 @@ class Input extends VDOM.Component {
231
234
 
232
235
  switch (e.keyCode) {
233
236
  case KeyCode.enter:
234
- this.onChange(e, "enter");
237
+ this.onChange(e.target.value, "enter");
235
238
  break;
236
239
 
237
240
  case KeyCode.left:
@@ -243,13 +246,13 @@ class Input extends VDOM.Component {
243
246
 
244
247
  UNSAFE_componentWillReceiveProps(props) {
245
248
  let { data } = props;
246
- //the second check is required for debouncing, sometimes the value in the store lags after the input
247
- //and update may be caused by some other property, i.e. visited
249
+ // The second check is required for debouncing, sometimes the value in the store lags after the input
250
+ // and update may be caused by some other property, i.e. visited
248
251
  if (data.value != this.input.value && data.value != this.props.data.value) this.input.value = data.value || "";
249
252
  tooltipParentWillReceiveProps(this.input, ...getFieldTooltip(props.instance));
250
253
  }
251
254
 
252
- onChange(e, change) {
255
+ onChange(textValue, change) {
253
256
  let { instance, data } = this.props;
254
257
 
255
258
  let immediate = change == "blur" || change == "enter";
@@ -261,7 +264,7 @@ class Input extends VDOM.Component {
261
264
  let { widget } = instance;
262
265
 
263
266
  if (widget.reactOn.indexOf(change) != -1) {
264
- let text = this.trimmed(e.target.value);
267
+ let text = this.trimmed(textValue);
265
268
  if (data.maxLength != null && text.length > data.maxLength) {
266
269
  text = text.substring(0, data.maxLength);
267
270
  this.input.value = text;
@@ -1,34 +1,34 @@
1
- import * as Cx from "../../core";
2
- import { FieldProps } from "./Field";
3
-
4
- interface UploadButtonProps extends FieldProps {
5
- /** Text description. */
6
- text?: Cx.StringProp;
7
-
8
- url?: Cx.StringProp;
9
-
10
- /** Base CSS class to be applied to the element. Default is 'uploadbutton'. */
11
- baseClass?: string;
12
-
13
- /** Defaults to `false`. Set to `true` to enable multiple selection. */
14
- multiple?: boolean;
15
-
16
- method?: string;
17
- uploadInProgressText?: string;
18
-
19
- /** Defaults to `false`. Set to `true` to abort uploads if the button is destroyed (unmounted). */
20
- abortOnDestroy?: boolean;
21
-
22
- /** Defines file types that are accepted for upload. */
23
- accept?: Cx.StringProp;
24
-
25
- /** Name of the icon to be put on the left side of the button. */
26
- icon?: Cx.StringProp;
27
-
28
- onUploadStarting?: ((xhr: XMLHttpRequest, instance: any, file: File, formData: FormData) => boolean) | string;
29
- onUploadComplete?: ((xhr: XMLHttpRequest, instance: any, file: File, formData: FormData) => void) | string;
30
- onUploadProgress?: ((event: ProgressEvent, instance: any, file: File, formData: FormData) => void) | string;
31
- onUploadError?: ((event: ProgressEvent, instance: any, file: File, formData: FormData) => void) | string;
32
- }
33
-
34
- export class UploadButton extends Cx.Widget<UploadButtonProps> {}
1
+ import * as Cx from "../../core";
2
+ import { FieldProps } from "./Field";
3
+
4
+ interface UploadButtonProps extends FieldProps {
5
+ /** Text description. */
6
+ text?: Cx.StringProp;
7
+
8
+ url?: Cx.StringProp;
9
+
10
+ /** Base CSS class to be applied to the element. Default is 'uploadbutton'. */
11
+ baseClass?: string;
12
+
13
+ /** Defaults to `false`. Set to `true` to enable multiple selection. */
14
+ multiple?: boolean;
15
+
16
+ method?: string;
17
+ uploadInProgressText?: string;
18
+
19
+ /** Defaults to `false`. Set to `true` to abort uploads if the button is destroyed (unmounted). */
20
+ abortOnDestroy?: boolean;
21
+
22
+ /** Defines file types that are accepted for upload. */
23
+ accept?: Cx.StringProp;
24
+
25
+ /** Name of the icon to be put on the left side of the button. */
26
+ icon?: Cx.StringProp;
27
+
28
+ onUploadStarting?: ((xhr: XMLHttpRequest, instance: any, file: File, formData: FormData) => boolean) | string;
29
+ onUploadComplete?: ((xhr: XMLHttpRequest, instance: any, file: File, formData: FormData) => void) | string;
30
+ onUploadProgress?: ((event: ProgressEvent, instance: any, file: File, formData: FormData) => void) | string;
31
+ onUploadError?: ((event: ProgressEvent, instance: any, file: File, formData: FormData) => void) | string;
32
+ }
33
+
34
+ export class UploadButton extends Cx.Widget<UploadButtonProps> {}
@@ -25,5 +25,4 @@ export * from './DateTimeField';
25
25
  export * from './DateField';
26
26
  export * from './TimeField';
27
27
  export * from './Validator';
28
-
29
-
28
+ export * from './Label';
@@ -298,6 +298,9 @@ interface GridProps<T = unknown> extends StyledContainerProps {
298
298
  /** Parameters that affect filtering. */
299
299
  filterParams?: StructuredProp;
300
300
 
301
+ /** Callback function to be executed when a row is right-clicked. */
302
+ onRowContextMenu?: string | ((e: React.SyntheticEvent<any>, instance: Instance) => void);
303
+
301
304
  /** Callback to create a filter function for given filter params. */
302
305
  onCreateFilter?: (filterParams: any, instance?: Instance) => (record: T) => boolean;
303
306
 
@@ -316,7 +319,7 @@ interface GridProps<T = unknown> extends StyledContainerProps {
316
319
  sortField?: string;
317
320
  sortDirection?: string;
318
321
  },
319
- instance?: Instance
322
+ instance?: Instance,
320
323
  ) => FetchRecordsResult | Promise<FetchRecordsResult>;
321
324
 
322
325
  /** Callback function to be executed when a row is double-clicked. */
@@ -349,7 +352,7 @@ interface GridProps<T = unknown> extends StyledContainerProps {
349
352
  /** Callback to create a function that can be used to check whether a record is selectable. */
350
353
  onCreateIsRecordSelectable?: (
351
354
  params: any,
352
- instance: Instance
355
+ instance: Instance,
353
356
  ) => (record: T, options?: { range?: boolean; toggle?: boolean }) => boolean;
354
357
 
355
358
  /** Parameters whose change will cause scroll to be reset. */
@@ -7,6 +7,7 @@ export interface DropdownProps extends OverlayProps {
7
7
 
8
8
  offset?: number;
9
9
  matchWidth?: boolean;
10
+ matchMaxWidth?: boolean;
10
11
  placementOrder?: string;
11
12
  constrain?: boolean;
12
13
  positioning?: string;