cx 24.6.4 → 24.6.6
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/charts.js +27 -29
- package/dist/data.js +26 -29
- package/dist/manifest.js +808 -802
- package/dist/svg.js +59 -56
- package/dist/ui.js +51 -52
- package/dist/util.js +56 -10
- package/dist/widgets.js +74 -74
- package/package.json +1 -1
- package/src/charts/Legend.js +151 -151
- package/src/charts/Marker.d.ts +96 -96
- package/src/charts/Marker.js +299 -299
- package/src/charts/axis/Axis.d.ts +96 -96
- package/src/charts/axis/NumericAxis.js +347 -347
- package/src/charts/axis/Stack.js +55 -55
- package/src/charts/axis/TimeAxis.js +7 -6
- package/src/data/Binding.spec.js +69 -69
- package/src/data/StringTemplate.spec.js +105 -105
- package/src/data/getAccessor.spec.js +11 -11
- package/src/ui/Controller.d.ts +182 -182
- package/src/ui/FocusManager.js +171 -171
- package/src/ui/Format.js +3 -3
- package/src/ui/Instance.d.ts +72 -72
- package/src/ui/index.d.ts +42 -42
- package/src/util/Format.js +6 -5
- package/src/util/date/index.d.ts +10 -9
- package/src/util/date/index.js +10 -9
- package/src/util/date/parseDateInvariant.d.ts +3 -0
- package/src/util/date/parseDateInvariant.js +20 -0
- package/src/widgets/drag-drop/DropZone.js +214 -214
- package/src/widgets/form/Calendar.js +7 -6
- package/src/widgets/form/ColorField.js +3 -3
- package/src/widgets/form/DateTimeField.js +9 -6
- package/src/widgets/form/DateTimePicker.js +9 -8
- package/src/widgets/form/MonthField.js +9 -9
- package/src/widgets/form/MonthPicker.js +17 -16
- package/src/widgets/form/NumberField.js +1 -1
- package/src/widgets/form/TextField.js +290 -289
- package/src/widgets/form/UploadButton.d.ts +34 -34
- package/src/widgets/grid/variables.scss +88 -88
- package/src/widgets/overlay/Dropdown.js +612 -612
|
@@ -4,16 +4,17 @@ import { Culture } from "../../ui";
|
|
|
4
4
|
import { Cx } from "../../ui/Cx";
|
|
5
5
|
import { Localization } from "../../ui/Localization";
|
|
6
6
|
import { VDOM, Widget, getContent } from "../../ui/Widget";
|
|
7
|
+
import { parseDateInvariant } from "../../util";
|
|
7
8
|
import { Console } from "../../util/Console";
|
|
8
9
|
import { Format } from "../../util/Format";
|
|
9
10
|
import { KeyCode } from "../../util/KeyCode";
|
|
10
11
|
import { dateDiff } from "../../util/date/dateDiff";
|
|
11
12
|
import { monthStart } from "../../util/date/monthStart";
|
|
12
13
|
import { stopPropagation } from "../../util/eventCallbacks";
|
|
14
|
+
import { getActiveElement } from "../../util/getActiveElement";
|
|
13
15
|
import { isDefined } from "../../util/isDefined";
|
|
14
16
|
import { isTouchDevice } from "../../util/isTouchDevice";
|
|
15
17
|
import { isTouchEvent } from "../../util/isTouchEvent";
|
|
16
|
-
import { Icon } from "../Icon";
|
|
17
18
|
import { autoFocus } from "../autoFocus";
|
|
18
19
|
import ClearIcon from "../icons/clear";
|
|
19
20
|
import DropdownIcon from "../icons/drop-down";
|
|
@@ -27,7 +28,6 @@ import {
|
|
|
27
28
|
} from "../overlay/tooltip-ops";
|
|
28
29
|
import { Field, getFieldTooltip } from "./Field";
|
|
29
30
|
import { MonthPicker } from "./MonthPicker";
|
|
30
|
-
import { getActiveElement } from "../../util/getActiveElement";
|
|
31
31
|
|
|
32
32
|
export class MonthField extends Field {
|
|
33
33
|
declareData() {
|
|
@@ -93,11 +93,11 @@ export class MonthField extends Field {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
if (!this.range && data.value) {
|
|
96
|
-
data.date =
|
|
96
|
+
data.date = parseDateInvariant(data.value);
|
|
97
97
|
data.formatted = this.culture.format(data.date, formatOptions);
|
|
98
98
|
} else if (this.range && data.from && data.to) {
|
|
99
|
-
data.from =
|
|
100
|
-
data.to =
|
|
99
|
+
data.from = parseDateInvariant(data.from);
|
|
100
|
+
data.to = parseDateInvariant(data.to);
|
|
101
101
|
data.to.setDate(data.to.getDate() - 1);
|
|
102
102
|
let fromStr = this.culture.format(data.from, formatOptions);
|
|
103
103
|
let toStr = this.culture.format(data.to, formatOptions);
|
|
@@ -105,11 +105,11 @@ export class MonthField extends Field {
|
|
|
105
105
|
else data.formatted = fromStr;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
if (data.refDate) data.refDate = monthStart(
|
|
108
|
+
if (data.refDate) data.refDate = monthStart(parseDateInvariant(data.refDate));
|
|
109
109
|
|
|
110
|
-
if (data.maxValue) data.maxValue = monthStart(
|
|
110
|
+
if (data.maxValue) data.maxValue = monthStart(parseDateInvariant(data.maxValue));
|
|
111
111
|
|
|
112
|
-
if (data.minValue) data.minValue = monthStart(
|
|
112
|
+
if (data.minValue) data.minValue = monthStart(parseDateInvariant(data.minValue));
|
|
113
113
|
|
|
114
114
|
instance.lastDropdown = context.lastDropdown;
|
|
115
115
|
}
|
|
@@ -485,7 +485,7 @@ class MonthInput extends VDOM.Component {
|
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
componentWillUnmount() {
|
|
488
|
-
if (this.input == getActiveElement()) {
|
|
488
|
+
if (this.input == getActiveElement() && this.input.value != this.props.data.formatted) {
|
|
489
489
|
this.onChange(this.input.value, "blur");
|
|
490
490
|
}
|
|
491
491
|
tooltipParentWillUnmount(this.props.instance);
|
|
@@ -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(
|
|
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(
|
|
79
|
+
if (data.from) data.from = monthStart(parseDateInvariant(data.from));
|
|
79
80
|
|
|
80
|
-
if (data.to) data.to = monthStart(
|
|
81
|
+
if (data.to) data.to = monthStart(parseDateInvariant(data.to));
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
if (data.refDate) data.refDate = monthStart(
|
|
84
|
+
if (data.refDate) data.refDate = monthStart(parseDateInvariant(data.refDate));
|
|
84
85
|
|
|
85
|
-
if (data.maxValue) data.maxValue = monthStart(
|
|
86
|
+
if (data.maxValue) data.maxValue = monthStart(parseDateInvariant(data.maxValue));
|
|
86
87
|
|
|
87
|
-
if (data.minValue) data.minValue = monthStart(
|
|
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
|
|
|
@@ -249,7 +249,7 @@ class Input extends VDOM.Component {
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
componentWillUnmount() {
|
|
252
|
-
if (this.input == getActiveElement()) {
|
|
252
|
+
if (this.input == getActiveElement() && this.input.value != this.props.data.formatted) {
|
|
253
253
|
this.onChange({ target: { value: this.input.value } }, "blur");
|
|
254
254
|
}
|
|
255
255
|
tooltipParentWillUnmount(this.props.instance);
|