cx 24.6.3 → 24.6.5

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 (38) hide show
  1. package/dist/charts.js +27 -29
  2. package/dist/data.js +26 -29
  3. package/dist/manifest.js +748 -742
  4. package/dist/svg.js +59 -56
  5. package/dist/ui.js +51 -52
  6. package/dist/util.js +56 -10
  7. package/dist/widgets.js +69 -69
  8. package/package.json +1 -1
  9. package/src/charts/Legend.js +151 -151
  10. package/src/charts/Marker.d.ts +96 -96
  11. package/src/charts/Marker.js +299 -299
  12. package/src/charts/axis/Axis.d.ts +96 -96
  13. package/src/charts/axis/NumericAxis.js +347 -347
  14. package/src/charts/axis/Stack.js +55 -55
  15. package/src/charts/axis/TimeAxis.js +7 -6
  16. package/src/data/Binding.spec.js +69 -69
  17. package/src/data/StringTemplate.spec.js +105 -105
  18. package/src/data/getAccessor.spec.js +11 -11
  19. package/src/ui/Controller.d.ts +182 -182
  20. package/src/ui/FocusManager.js +171 -171
  21. package/src/ui/Format.js +3 -3
  22. package/src/ui/Instance.d.ts +72 -72
  23. package/src/ui/index.d.ts +42 -42
  24. package/src/util/Format.js +6 -5
  25. package/src/util/date/index.d.ts +10 -9
  26. package/src/util/date/index.js +10 -9
  27. package/src/util/date/parseDateInvariant.d.ts +3 -0
  28. package/src/util/date/parseDateInvariant.js +20 -0
  29. package/src/widgets/drag-drop/DropZone.js +214 -214
  30. package/src/widgets/form/Calendar.js +7 -6
  31. package/src/widgets/form/DateTimeField.js +8 -5
  32. package/src/widgets/form/DateTimePicker.js +9 -8
  33. package/src/widgets/form/MonthField.js +8 -8
  34. package/src/widgets/form/MonthPicker.js +17 -16
  35. package/src/widgets/form/TextField.js +1 -0
  36. package/src/widgets/form/UploadButton.d.ts +34 -34
  37. package/src/widgets/grid/variables.scss +88 -88
  38. package/src/widgets/overlay/Dropdown.js +612 -612
@@ -26,6 +26,7 @@ import { isTouchEvent } from "../../util/isTouchEvent";
26
26
  import { getCursorPos } from "../overlay/captureMouse";
27
27
 
28
28
  import { enableCultureSensitiveFormatting } from "../../ui/Format";
29
+ import { parseDateInvariant } from "../../util";
29
30
  enableCultureSensitiveFormatting();
30
31
 
31
32
  export class MonthPicker extends Field {
@@ -59,7 +60,7 @@ export class MonthPicker extends Field {
59
60
  maxValue: undefined,
60
61
  maxExclusive: undefined,
61
62
  },
62
- ...arguments
63
+ ...arguments,
63
64
  );
64
65
  }
65
66
 
@@ -72,19 +73,19 @@ export class MonthPicker extends Field {
72
73
  disabled: data.disabled,
73
74
  };
74
75
 
75
- if (!this.range && data.value) data.date = monthStart(new Date(data.value));
76
+ if (!this.range && data.value) data.date = monthStart(parseDateInvariant(data.value));
76
77
 
77
78
  if (this.range) {
78
- if (data.from) data.from = monthStart(new Date(data.from));
79
+ if (data.from) data.from = monthStart(parseDateInvariant(data.from));
79
80
 
80
- if (data.to) data.to = monthStart(new Date(data.to));
81
+ if (data.to) data.to = monthStart(parseDateInvariant(data.to));
81
82
  }
82
83
 
83
- if (data.refDate) data.refDate = monthStart(new Date(data.refDate));
84
+ if (data.refDate) data.refDate = monthStart(parseDateInvariant(data.refDate));
84
85
 
85
- if (data.maxValue) data.maxValue = monthStart(new Date(data.maxValue));
86
+ if (data.maxValue) data.maxValue = monthStart(parseDateInvariant(data.maxValue));
86
87
 
87
- if (data.minValue) data.minValue = monthStart(new Date(data.minValue));
88
+ if (data.minValue) data.minValue = monthStart(parseDateInvariant(data.minValue));
88
89
 
89
90
  super.prepareData(...arguments);
90
91
  }
@@ -272,7 +273,7 @@ export class MonthPickerComponent extends VDOM.Component {
272
273
  cursorQuarter: (cursorQuarter + 3) % 4,
273
274
  cursorYear: cursorQuarter == 0 ? cursorYear - 1 : cursorYear,
274
275
  },
275
- { ensureVisible: true }
276
+ { ensureVisible: true },
276
277
  );
277
278
  else if (column == "M")
278
279
  if (cursorMonth > 3) this.moveCursor(e, { cursorMonth: cursorMonth - 3 }, { ensureVisible: true });
@@ -280,7 +281,7 @@ export class MonthPickerComponent extends VDOM.Component {
280
281
  this.moveCursor(
281
282
  e,
282
283
  { cursorMonth: cursorMonth + 9, cursorYear: cursorYear - 1 },
283
- { ensureVisible: true }
284
+ { ensureVisible: true },
284
285
  );
285
286
  break;
286
287
 
@@ -293,7 +294,7 @@ export class MonthPickerComponent extends VDOM.Component {
293
294
  cursorQuarter: (cursorQuarter + 1) % 4,
294
295
  cursorYear: cursorQuarter == 3 ? cursorYear + 1 : cursorYear,
295
296
  },
296
- { ensureVisible: true }
297
+ { ensureVisible: true },
297
298
  );
298
299
  else if (column == "M")
299
300
  if (cursorMonth < 10) this.moveCursor(e, { cursorMonth: cursorMonth + 3 }, { ensureVisible: true });
@@ -301,7 +302,7 @@ export class MonthPickerComponent extends VDOM.Component {
301
302
  this.moveCursor(
302
303
  e,
303
304
  { cursorMonth: cursorMonth - 9, cursorYear: cursorYear + 1 },
304
- { ensureVisible: true }
305
+ { ensureVisible: true },
305
306
  );
306
307
  break;
307
308
 
@@ -470,7 +471,7 @@ export class MonthPickerComponent extends VDOM.Component {
470
471
  onMouseUp={this.handleMouseUp}
471
472
  >
472
473
  {y}
473
- </th>
474
+ </th>,
474
475
  );
475
476
 
476
477
  for (let i = 0; i < 3; i++) {
@@ -500,7 +501,7 @@ export class MonthPickerComponent extends VDOM.Component {
500
501
  onTouchEnd={this.handleMouseUp}
501
502
  >
502
503
  {monthNames[m - 1].substr(0, 3)}
503
- </td>
504
+ </td>,
504
505
  );
505
506
  }
506
507
  row.push(
@@ -519,7 +520,7 @@ export class MonthPickerComponent extends VDOM.Component {
519
520
  onMouseUp={this.handleMouseUp}
520
521
  >
521
522
  {`Q${q + 1}`}
522
- </th>
523
+ </th>,
523
524
  );
524
525
  rows.push(row);
525
526
  }
@@ -568,7 +569,7 @@ export class MonthPickerComponent extends VDOM.Component {
568
569
  let visibleItems = ceil5(Math.ceil(this.dom.el.offsetHeight / this.state.yearHeight));
569
570
  let start = Math.max(
570
571
  startYear,
571
- startYear + floor5(Math.floor(this.dom.el.scrollTop / this.state.yearHeight)) - visibleItems
572
+ startYear + floor5(Math.floor(this.dom.el.scrollTop / this.state.yearHeight)) - visibleItems,
572
573
  );
573
574
  if (start != this.state.start && start + bufferSize <= endYear) {
574
575
  this.setState({
@@ -606,7 +607,7 @@ export class MonthPickerComponent extends VDOM.Component {
606
607
  this.dom.el.scrollTop =
607
608
  (this.state.cursorYear - startYear + yearCount / 2) * this.state.yearHeight -
608
609
  this.dom.el.offsetHeight / 2;
609
- }
610
+ },
610
611
  );
611
612
  }
612
613
 
@@ -203,6 +203,7 @@ class Input extends VDOM.Component {
203
203
  }
204
204
 
205
205
  onClearClick(e) {
206
+ this.input.value = ""; // prevent onChange call with old text value on blur or component unmount
206
207
  this.props.instance.set("value", this.props.instance.widget.emptyValue, { immediate: true });
207
208
  }
208
209
 
@@ -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> {}
@@ -1,88 +1,88 @@
1
- // GRID
2
- $cx-default-grid-font-size: $cx-default-box-font-size !default;
3
- $cx-default-grid-border-color: $cx-default-border-color !default;
4
- $cx-default-grid-border-radius: null !default;
5
- $cx-default-grid-box-shadow: null !default;
6
-
7
- // header
8
- $cx-default-grid-header-font-size: $cx-default-box-font-size !default;
9
- $cx-default-grid-header-font-weight: normal !default;
10
- $cx-default-grid-header-line-height: null !default;
11
- $cx-default-grid-header-color: $cx-default-color !default;
12
- $cx-default-grid-header-background-color: #eee !default;
13
- $cx-default-grid-header-border-color: $cx-default-border-color !default;
14
- $cx-default-grid-header-box-shadow: null !default;
15
- $cx-default-grid-header-padding: null !default;
16
-
17
- $cx-grid-header-state-style-map: (
18
- default: (
19
- font-size: $cx-default-grid-header-font-size,
20
- font-weight: $cx-default-grid-header-font-weight,
21
- line-height: $cx-default-grid-header-line-height,
22
- color: $cx-default-grid-header-color,
23
- background-color: $cx-default-grid-header-background-color,
24
- border-color: $cx-default-grid-header-border-color,
25
- background-clip: border-box,
26
- padding: $cx-default-grid-header-padding,
27
- ),
28
- hover: (
29
- background-color: darken($cx-default-grid-header-background-color, 2),
30
- ),
31
- sorted: (
32
- background-color: darken($cx-default-grid-header-background-color, 7),
33
- ),
34
- sorted-hover: (
35
- background-color: darken($cx-default-grid-header-background-color, 5),
36
- ),
37
- ) !default;
38
-
39
- // data
40
- $cx-default-grid-data-font-size: null !default;
41
- $cx-default-grid-data-font-weight: null !default;
42
- $cx-default-grid-data-line-height: null !default;
43
- $cx-default-grid-data-background-color: transparent !default;
44
- $cx-default-grid-data-alternate-background-color: null !default;
45
- $cx-default-grid-data-border-color: $cx-default-grid-border-color !default;
46
- $cx-default-grid-data-padding: 5px !default;
47
-
48
- $cx-grid-data-state-style-map: cx-deep-map-merge(
49
- $cx-list-item,
50
- (
51
- default: (
52
- font-size: $cx-default-grid-data-font-size,
53
- line-height: $cx-default-grid-data-line-height,
54
- font-weight: $cx-default-grid-data-font-weight,
55
- background-color: $cx-default-grid-data-background-color,
56
- border-color: $cx-default-grid-data-border-color,
57
- padding: $cx-default-grid-data-padding,
58
- ),
59
- alternate: (
60
- background-color: $cx-default-grid-data-alternate-background-color,
61
- ),
62
- )
63
- ) !default;
64
-
65
- // pagination
66
- $cx-grid-pagination-default-border-width: $cx-default-border-width !default;
67
- $cx-grid-pagination-default-border-color: $cx-default-border-color !default;
68
- $cx-grid-pagination-default-border-radius: null !default;
69
- $cx-grid-pagination-default-outer-border-radius: $cx-default-border-radius !default;
70
- $cx-grid-pagination-default-padding: cx-top($cx-default-box-padding) 2 * cx-top($cx-default-box-padding) !default;
71
-
72
- $cx-grid-pagination-state-style-map: cx-deep-map-merge($cx-list-item, ()) !default;
73
-
74
- $cx-grid-cell-cursor-style: (
75
- left: -1px,
76
- top: -1px,
77
- right: -1px,
78
- bottom: -1px,
79
- background: rgba(green, 0.1),
80
- border: 2px solid rgba(green, 1),
81
- );
82
-
83
- $cx-dependencies: map-merge(
84
- $cx-dependencies,
85
- (
86
- "cx/widgets/Grid": "cx/widgets/DragClone",
87
- )
88
- );
1
+ // GRID
2
+ $cx-default-grid-font-size: $cx-default-box-font-size !default;
3
+ $cx-default-grid-border-color: $cx-default-border-color !default;
4
+ $cx-default-grid-border-radius: null !default;
5
+ $cx-default-grid-box-shadow: null !default;
6
+
7
+ // header
8
+ $cx-default-grid-header-font-size: $cx-default-box-font-size !default;
9
+ $cx-default-grid-header-font-weight: normal !default;
10
+ $cx-default-grid-header-line-height: null !default;
11
+ $cx-default-grid-header-color: $cx-default-color !default;
12
+ $cx-default-grid-header-background-color: #eee !default;
13
+ $cx-default-grid-header-border-color: $cx-default-border-color !default;
14
+ $cx-default-grid-header-box-shadow: null !default;
15
+ $cx-default-grid-header-padding: null !default;
16
+
17
+ $cx-grid-header-state-style-map: (
18
+ default: (
19
+ font-size: $cx-default-grid-header-font-size,
20
+ font-weight: $cx-default-grid-header-font-weight,
21
+ line-height: $cx-default-grid-header-line-height,
22
+ color: $cx-default-grid-header-color,
23
+ background-color: $cx-default-grid-header-background-color,
24
+ border-color: $cx-default-grid-header-border-color,
25
+ background-clip: border-box,
26
+ padding: $cx-default-grid-header-padding,
27
+ ),
28
+ hover: (
29
+ background-color: darken($cx-default-grid-header-background-color, 2),
30
+ ),
31
+ sorted: (
32
+ background-color: darken($cx-default-grid-header-background-color, 7),
33
+ ),
34
+ sorted-hover: (
35
+ background-color: darken($cx-default-grid-header-background-color, 5),
36
+ ),
37
+ ) !default;
38
+
39
+ // data
40
+ $cx-default-grid-data-font-size: null !default;
41
+ $cx-default-grid-data-font-weight: null !default;
42
+ $cx-default-grid-data-line-height: null !default;
43
+ $cx-default-grid-data-background-color: transparent !default;
44
+ $cx-default-grid-data-alternate-background-color: null !default;
45
+ $cx-default-grid-data-border-color: $cx-default-grid-border-color !default;
46
+ $cx-default-grid-data-padding: 5px !default;
47
+
48
+ $cx-grid-data-state-style-map: cx-deep-map-merge(
49
+ $cx-list-item,
50
+ (
51
+ default: (
52
+ font-size: $cx-default-grid-data-font-size,
53
+ line-height: $cx-default-grid-data-line-height,
54
+ font-weight: $cx-default-grid-data-font-weight,
55
+ background-color: $cx-default-grid-data-background-color,
56
+ border-color: $cx-default-grid-data-border-color,
57
+ padding: $cx-default-grid-data-padding,
58
+ ),
59
+ alternate: (
60
+ background-color: $cx-default-grid-data-alternate-background-color,
61
+ ),
62
+ )
63
+ ) !default;
64
+
65
+ // pagination
66
+ $cx-grid-pagination-default-border-width: $cx-default-border-width !default;
67
+ $cx-grid-pagination-default-border-color: $cx-default-border-color !default;
68
+ $cx-grid-pagination-default-border-radius: null !default;
69
+ $cx-grid-pagination-default-outer-border-radius: $cx-default-border-radius !default;
70
+ $cx-grid-pagination-default-padding: cx-top($cx-default-box-padding) 2 * cx-top($cx-default-box-padding) !default;
71
+
72
+ $cx-grid-pagination-state-style-map: cx-deep-map-merge($cx-list-item, ()) !default;
73
+
74
+ $cx-grid-cell-cursor-style: (
75
+ left: -1px,
76
+ top: -1px,
77
+ right: -1px,
78
+ bottom: -1px,
79
+ background: rgba(green, 0.1),
80
+ border: 2px solid rgba(green, 1),
81
+ );
82
+
83
+ $cx-dependencies: map-merge(
84
+ $cx-dependencies,
85
+ (
86
+ "cx/widgets/Grid": "cx/widgets/DragClone",
87
+ )
88
+ );