cx 24.0.3 → 24.2.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.
Files changed (46) hide show
  1. package/dist/charts.js +61 -63
  2. package/dist/data.js +50 -70
  3. package/dist/manifest.js +719 -713
  4. package/dist/svg.js +70 -71
  5. package/dist/ui.js +104 -112
  6. package/dist/util.js +94 -13
  7. package/dist/widgets.js +273 -257
  8. package/package.json +1 -1
  9. package/src/charts/ColorMap.js +4 -6
  10. package/src/charts/axis/Axis.d.ts +96 -96
  11. package/src/charts/axis/Axis.js +252 -252
  12. package/src/charts/axis/TimeAxis.js +7 -6
  13. package/src/data/Expression.js +212 -212
  14. package/src/data/Expression.spec.js +174 -174
  15. package/src/data/StringTemplate.spec.js +105 -105
  16. package/src/ui/Controller.d.ts +182 -182
  17. package/src/ui/FocusManager.js +171 -171
  18. package/src/ui/Format.js +88 -87
  19. package/src/ui/Instance.d.ts +72 -72
  20. package/src/ui/keyboardShortcuts.js +4 -5
  21. package/src/ui/selection/KeySelection.d.ts +1 -1
  22. package/src/ui/selection/PropertySelection.d.ts +1 -1
  23. package/src/ui/selection/PropertySelection.js +2 -4
  24. package/src/ui/selection/Selection.d.ts +1 -1
  25. package/src/util/Format.js +73 -86
  26. package/src/util/date/index.d.ts +10 -9
  27. package/src/util/date/index.js +10 -9
  28. package/src/util/date/parseDateInvariant.d.ts +3 -0
  29. package/src/util/date/parseDateInvariant.js +20 -0
  30. package/src/widgets/form/Calendar.js +27 -26
  31. package/src/widgets/form/ColorField.js +14 -9
  32. package/src/widgets/form/ColorPicker.scss +275 -275
  33. package/src/widgets/form/ColorPicker.variables.scss +22 -22
  34. package/src/widgets/form/DateTimeField.js +18 -11
  35. package/src/widgets/form/DateTimePicker.js +9 -8
  36. package/src/widgets/form/Label.js +88 -88
  37. package/src/widgets/form/LookupField.d.ts +8 -9
  38. package/src/widgets/form/MonthField.js +17 -13
  39. package/src/widgets/form/MonthPicker.js +17 -16
  40. package/src/widgets/form/NumberField.js +8 -4
  41. package/src/widgets/form/TextArea.js +10 -6
  42. package/src/widgets/form/TextField.js +11 -9
  43. package/src/widgets/form/UploadButton.d.ts +34 -34
  44. package/src/widgets/form/index.js +1 -2
  45. package/src/widgets/grid/Grid.d.ts +11 -8
  46. package/src/widgets/grid/Grid.js +3277 -3277
@@ -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() {
@@ -104,7 +105,7 @@ class Input extends VDOM.Component {
104
105
  <div
105
106
  className={CSS.element(baseClass, "left-icon")}
106
107
  onMouseDown={preventDefault}
107
- onClick={(e) => this.onChange(e, "enter")}
108
+ onClick={(e) => this.onChange(e.target.value, "enter")}
108
109
  >
109
110
  {iconVDOM}
110
111
  </div>
@@ -164,8 +165,8 @@ class Input extends VDOM.Component {
164
165
  {...data.inputAttrs}
165
166
  onMouseMove={this.onMouseMove.bind(this)}
166
167
  onMouseLeave={this.onMouseLeave.bind(this)}
167
- onInput={(e) => this.onChange(e, "input")}
168
- onChange={(e) => this.onChange(e, "change")}
168
+ onInput={(e) => this.onChange(e.target.value, "input")}
169
+ onChange={(e) => this.onChange(e.target.value, "change")}
169
170
  onKeyDown={this.onKeyDown.bind(this)}
170
171
  onFocus={this.onFocus.bind(this)}
171
172
  onBlur={this.onBlur.bind(this)}
@@ -198,7 +199,7 @@ class Input extends VDOM.Component {
198
199
  });
199
200
  this.props.instance.set("focused", false);
200
201
  }
201
- this.onChange(e, "blur");
202
+ this.onChange(e.target.value, "blur");
202
203
  }
203
204
 
204
205
  onClearClick(e) {
@@ -223,6 +224,7 @@ class Input extends VDOM.Component {
223
224
  }
224
225
 
225
226
  componentWillUnmount() {
227
+ if (this.input == getActiveElement()) this.onChange(this.input.value, "blur");
226
228
  tooltipParentWillUnmount(this.props.instance);
227
229
  }
228
230
 
@@ -232,7 +234,7 @@ class Input extends VDOM.Component {
232
234
 
233
235
  switch (e.keyCode) {
234
236
  case KeyCode.enter:
235
- this.onChange(e, "enter");
237
+ this.onChange(e.target.value, "enter");
236
238
  break;
237
239
 
238
240
  case KeyCode.left:
@@ -244,13 +246,13 @@ class Input extends VDOM.Component {
244
246
 
245
247
  UNSAFE_componentWillReceiveProps(props) {
246
248
  let { data } = props;
247
- //the second check is required for debouncing, sometimes the value in the store lags after the input
248
- //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
249
251
  if (data.value != this.input.value && data.value != this.props.data.value) this.input.value = data.value || "";
250
252
  tooltipParentWillReceiveProps(this.input, ...getFieldTooltip(props.instance));
251
253
  }
252
254
 
253
- onChange(e, change) {
255
+ onChange(textValue, change) {
254
256
  let { instance, data } = this.props;
255
257
 
256
258
  let immediate = change == "blur" || change == "enter";
@@ -262,7 +264,7 @@ class Input extends VDOM.Component {
262
264
  let { widget } = instance;
263
265
 
264
266
  if (widget.reactOn.indexOf(change) != -1) {
265
- let text = this.trimmed(e.target.value);
267
+ let text = this.trimmed(textValue);
266
268
  if (data.maxLength != null && text.length > data.maxLength) {
267
269
  text = text.substring(0, data.maxLength);
268
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';
@@ -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";
@@ -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. */
@@ -404,4 +407,4 @@ interface GridCellEditInfo<T> extends GridCellInfo {
404
407
  newData: T;
405
408
  }
406
409
 
407
- export class Grid<T = unknown> extends Widget<GridProps<T>> { }
410
+ export class Grid<T = unknown> extends Widget<GridProps<T>> {}