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
@@ -1,275 +1,275 @@
1
- //@if cx-call-once("cx/widgets/checker-background") {
2
- // %cx-checker-bg {
3
- // background-repeat: repeat;
4
- // background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuOWwzfk4AAAAfSURBVChTY9i5Y89/dAwEDOh4SCjEJohN8+BXuOc/AOttNBKJWD4sAAAAAElFTkSuQmCC");
5
- // }
6
- //}
7
-
8
- @mixin cx-checker-background($tile-size: 4px, $color: rgba(gray, 0.5)) {
9
- background-image: linear-gradient(45deg, $color 25%, transparent 25%),
10
- linear-gradient(-45deg, $color 25%, transparent 25%), linear-gradient(45deg, transparent 75%, $color 75%),
11
- linear-gradient(-45deg, transparent 75%, $color 75%);
12
- background-size: 2 * $tile-size 2 * $tile-size;
13
- background-position: 0 0, 0 $tile-size, $tile-size -#{$tile-size}, -#{$tile-size} 0px;
14
- }
15
-
16
- @mixin cx-colorpicker(
17
- $name: "colorpicker",
18
- $state-style-map: $cx-colorpicker-state-style-map,
19
- $placeholder: $cx-input-placeholder,
20
- $besm: $cx-besm
21
- ) {
22
- $block: map-get($besm, block);
23
- $element: map-get($besm, element);
24
- $state: map-get($besm, state);
25
-
26
- $size: 220px;
27
-
28
- .#{$block}#{$name} {
29
- $styles: cx-deep-map-merge(
30
- $state-style-map,
31
- (
32
- default: (
33
- padding: 4px,
34
- ),
35
- )
36
- );
37
-
38
- @include cx-add-state-rules($styles, default);
39
-
40
- display: inline-flex;
41
- flex-direction: column;
42
-
43
- @media screen and (min-width: 500px) {
44
- flex-direction: row;
45
- }
46
-
47
- &:hover {
48
- @include cx-add-state-rules($state-style-map, hover);
49
- }
50
-
51
- input {
52
- @include cxe-field-input(
53
- $besm,
54
- $state-style-map,
55
- $placeholder: $placeholder,
56
- $input: false,
57
- $overrides: (
58
- default: (
59
- line-height: 14px,
60
- font-size: 11px,
61
- font-family: $cx-default-colorpicker-font-family,
62
- )
63
- )
64
- );
65
- }
66
- }
67
-
68
- .#{$element}#{$name}-picker {
69
- width: $size;
70
- height: $size;
71
- margin: 4px;
72
- //cursor: crosshair;
73
- position: relative;
74
- touch-action: none;
75
-
76
- background: -webkit-linear-gradient(
77
- top,
78
- hsl(0, 0%, 100%) 0%,
79
- hsla(0, 0%, 100%, 0) 50%,
80
- hsla(0, 0%, 0%, 0) 50%,
81
- hsl(0, 0%, 0%) 100%
82
- ),
83
- -webkit-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%);
84
- background: -moz-linear-gradient(
85
- top,
86
- hsl(0, 0%, 100%) 0%,
87
- hsla(0, 0%, 100%, 0) 50%,
88
- hsla(0, 0%, 0%, 0) 50%,
89
- hsl(0, 0%, 0%) 100%
90
- ),
91
- -moz-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%);
92
- background: -ms-linear-gradient(
93
- top,
94
- hsl(0, 0%, 100%) 0%,
95
- hsla(0, 0%, 100%, 0) 50%,
96
- hsla(0, 0%, 0%, 0) 50%,
97
- hsl(0, 0%, 0%) 100%
98
- ),
99
- -ms-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%);
100
- background: -o-linear-gradient(
101
- top,
102
- hsl(0, 0%, 100%) 0%,
103
- hsla(0, 0%, 100%, 0) 50%,
104
- hsla(0, 0%, 0%, 0) 50%,
105
- hsl(0, 0%, 0%) 100%
106
- ),
107
- -o-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%);
108
- }
109
-
110
- .#{$element}#{$name}-indicator {
111
- position: absolute;
112
- border: 2px solid rgba(255, 255, 255, 0.8);
113
- border-radius: 50%;
114
- box-sizing: border-box;
115
- width: 9px;
116
- height: 9px;
117
- left: calc(50% - 5px);
118
- top: calc(50% - 5px);
119
- }
120
-
121
- .#{$element}#{$name}-hue {
122
- height: 15px;
123
- position: relative;
124
- background: -moz-linear-gradient(
125
- left,
126
- #f00 0%,
127
- #ff0 16.66%,
128
- #0f0 33.33%,
129
- #0ff 50%,
130
- #00f 66.66%,
131
- #f0f 83.33%,
132
- #f00 100%
133
- );
134
- background: -webkit-linear-gradient(
135
- left,
136
- #f00 0%,
137
- #ff0 16.66%,
138
- #0f0 33.33%,
139
- #0ff 50%,
140
- #00f 66.66%,
141
- #f0f 83.33%,
142
- #f00 100%
143
- );
144
- background: -ms-linear-gradient(
145
- left,
146
- #f00 0%,
147
- #ff0 16.66%,
148
- #0f0 33.33%,
149
- #0ff 50%,
150
- #00f 66.66%,
151
- #f0f 83.33%,
152
- #f00 100%
153
- );
154
- background: -o-linear-gradient(
155
- left,
156
- #f00 0%,
157
- #ff0 16.66%,
158
- #0f0 33.33%,
159
- #0ff 50%,
160
- #00f 66.66%,
161
- #f0f 83.33%,
162
- #f00 100%
163
- );
164
- touch-action: none;
165
-
166
- .#{$element}#{$name}-indicator {
167
- border-color: rgba(0, 0, 0, 0.5);
168
- height: calc(100% + 4px);
169
- border-radius: 2px;
170
- width: 4px;
171
- top: -2px;
172
- }
173
- }
174
-
175
- .#{$element}#{$name}-alpha {
176
- height: 16px;
177
- //@extend %cx-checker-bg;
178
- @include cx-checker-background();
179
- position: relative;
180
- touch-action: none;
181
-
182
- & > div:first-child {
183
- width: 100%;
184
- height: 100%;
185
- }
186
-
187
- .#{$element}#{$name}-indicator {
188
- border-color: rgba(0, 0, 0, 0.5);
189
- top: -2px;
190
- height: calc(100% + 4px);
191
- border-radius: 2px;
192
- width: 4px;
193
- }
194
- }
195
-
196
- .#{$element}#{$name}-details {
197
- width: $size;
198
- min-height: 170px;
199
- margin: 4px;
200
- display: flex;
201
- flex-direction: column;
202
- justify-content: space-between;
203
- }
204
-
205
- .#{$element}#{$name}-inputs {
206
- label {
207
- width: 25%;
208
- display: inline-block;
209
- text-align: right;
210
-
211
- input {
212
- margin-left: 2px;
213
- width: 60%;
214
- text-align: center;
215
- }
216
- }
217
- }
218
-
219
- .#{$element}#{$name}-pixel-picker {
220
- display: flex;
221
- width: 20px;
222
- height: 20px;
223
- flex-shrink: 0;
224
- align-items: center;
225
- margin-top: 4px;
226
-
227
- svg path {
228
- fill: currentColor;
229
- }
230
-
231
- &:hover {
232
- cursor: pointer;
233
-
234
- svg path {
235
- fill: currentColor;
236
- opacity: 0.5;
237
- }
238
- }
239
- }
240
-
241
- .#{$element}#{$name}-preview {
242
- display: flex;
243
- }
244
-
245
- .#{$element}#{$name}-color {
246
- @include cx-checker-background();
247
- height: 64px;
248
- width: 64px;
249
- border-radius: 4px;
250
- align-self: flex-end;
251
-
252
- & > div {
253
- width: 100%;
254
- height: 100%;
255
- }
256
- }
257
-
258
- .#{$element}#{$name}-values {
259
- flex-grow: 1;
260
- margin: 0 8px;
261
-
262
- input {
263
- width: 100%;
264
- display: block;
265
- }
266
-
267
- input:not(:last-child) {
268
- margin: 0 0 4px 0;
269
- }
270
- }
271
- }
272
-
273
- @if (cx-should-include("cx/widgets/ColorPicker")) {
274
- @include cx-colorpicker();
275
- }
1
+ //@if cx-call-once("cx/widgets/checker-background") {
2
+ // %cx-checker-bg {
3
+ // background-repeat: repeat;
4
+ // background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAYdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuOWwzfk4AAAAfSURBVChTY9i5Y89/dAwEDOh4SCjEJohN8+BXuOc/AOttNBKJWD4sAAAAAElFTkSuQmCC");
5
+ // }
6
+ //}
7
+
8
+ @mixin cx-checker-background($tile-size: 4px, $color: rgba(gray, 0.5)) {
9
+ background-image: linear-gradient(45deg, $color 25%, transparent 25%),
10
+ linear-gradient(-45deg, $color 25%, transparent 25%), linear-gradient(45deg, transparent 75%, $color 75%),
11
+ linear-gradient(-45deg, transparent 75%, $color 75%);
12
+ background-size: 2 * $tile-size 2 * $tile-size;
13
+ background-position: 0 0, 0 $tile-size, $tile-size -#{$tile-size}, -#{$tile-size} 0px;
14
+ }
15
+
16
+ @mixin cx-colorpicker(
17
+ $name: "colorpicker",
18
+ $state-style-map: $cx-colorpicker-state-style-map,
19
+ $placeholder: $cx-input-placeholder,
20
+ $besm: $cx-besm
21
+ ) {
22
+ $block: map-get($besm, block);
23
+ $element: map-get($besm, element);
24
+ $state: map-get($besm, state);
25
+
26
+ $size: 220px;
27
+
28
+ .#{$block}#{$name} {
29
+ $styles: cx-deep-map-merge(
30
+ $state-style-map,
31
+ (
32
+ default: (
33
+ padding: 4px,
34
+ ),
35
+ )
36
+ );
37
+
38
+ @include cx-add-state-rules($styles, default);
39
+
40
+ display: inline-flex;
41
+ flex-direction: column;
42
+
43
+ @media screen and (min-width: 500px) {
44
+ flex-direction: row;
45
+ }
46
+
47
+ &:hover {
48
+ @include cx-add-state-rules($state-style-map, hover);
49
+ }
50
+
51
+ input {
52
+ @include cxe-field-input(
53
+ $besm,
54
+ $state-style-map,
55
+ $placeholder: $placeholder,
56
+ $input: false,
57
+ $overrides: (
58
+ default: (
59
+ line-height: 14px,
60
+ font-size: 11px,
61
+ font-family: $cx-default-colorpicker-font-family,
62
+ )
63
+ )
64
+ );
65
+ }
66
+ }
67
+
68
+ .#{$element}#{$name}-picker {
69
+ width: $size;
70
+ height: $size;
71
+ margin: 4px;
72
+ //cursor: crosshair;
73
+ position: relative;
74
+ touch-action: none;
75
+
76
+ background: -webkit-linear-gradient(
77
+ top,
78
+ hsl(0, 0%, 100%) 0%,
79
+ hsla(0, 0%, 100%, 0) 50%,
80
+ hsla(0, 0%, 0%, 0) 50%,
81
+ hsl(0, 0%, 0%) 100%
82
+ ),
83
+ -webkit-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%);
84
+ background: -moz-linear-gradient(
85
+ top,
86
+ hsl(0, 0%, 100%) 0%,
87
+ hsla(0, 0%, 100%, 0) 50%,
88
+ hsla(0, 0%, 0%, 0) 50%,
89
+ hsl(0, 0%, 0%) 100%
90
+ ),
91
+ -moz-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%);
92
+ background: -ms-linear-gradient(
93
+ top,
94
+ hsl(0, 0%, 100%) 0%,
95
+ hsla(0, 0%, 100%, 0) 50%,
96
+ hsla(0, 0%, 0%, 0) 50%,
97
+ hsl(0, 0%, 0%) 100%
98
+ ),
99
+ -ms-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%);
100
+ background: -o-linear-gradient(
101
+ top,
102
+ hsl(0, 0%, 100%) 0%,
103
+ hsla(0, 0%, 100%, 0) 50%,
104
+ hsla(0, 0%, 0%, 0) 50%,
105
+ hsl(0, 0%, 0%) 100%
106
+ ),
107
+ -o-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%);
108
+ }
109
+
110
+ .#{$element}#{$name}-indicator {
111
+ position: absolute;
112
+ border: 2px solid rgba(255, 255, 255, 0.8);
113
+ border-radius: 50%;
114
+ box-sizing: border-box;
115
+ width: 9px;
116
+ height: 9px;
117
+ left: calc(50% - 5px);
118
+ top: calc(50% - 5px);
119
+ }
120
+
121
+ .#{$element}#{$name}-hue {
122
+ height: 15px;
123
+ position: relative;
124
+ background: -moz-linear-gradient(
125
+ left,
126
+ #f00 0%,
127
+ #ff0 16.66%,
128
+ #0f0 33.33%,
129
+ #0ff 50%,
130
+ #00f 66.66%,
131
+ #f0f 83.33%,
132
+ #f00 100%
133
+ );
134
+ background: -webkit-linear-gradient(
135
+ left,
136
+ #f00 0%,
137
+ #ff0 16.66%,
138
+ #0f0 33.33%,
139
+ #0ff 50%,
140
+ #00f 66.66%,
141
+ #f0f 83.33%,
142
+ #f00 100%
143
+ );
144
+ background: -ms-linear-gradient(
145
+ left,
146
+ #f00 0%,
147
+ #ff0 16.66%,
148
+ #0f0 33.33%,
149
+ #0ff 50%,
150
+ #00f 66.66%,
151
+ #f0f 83.33%,
152
+ #f00 100%
153
+ );
154
+ background: -o-linear-gradient(
155
+ left,
156
+ #f00 0%,
157
+ #ff0 16.66%,
158
+ #0f0 33.33%,
159
+ #0ff 50%,
160
+ #00f 66.66%,
161
+ #f0f 83.33%,
162
+ #f00 100%
163
+ );
164
+ touch-action: none;
165
+
166
+ .#{$element}#{$name}-indicator {
167
+ border-color: rgba(0, 0, 0, 0.5);
168
+ height: calc(100% + 4px);
169
+ border-radius: 2px;
170
+ width: 4px;
171
+ top: -2px;
172
+ }
173
+ }
174
+
175
+ .#{$element}#{$name}-alpha {
176
+ height: 16px;
177
+ //@extend %cx-checker-bg;
178
+ @include cx-checker-background();
179
+ position: relative;
180
+ touch-action: none;
181
+
182
+ & > div:first-child {
183
+ width: 100%;
184
+ height: 100%;
185
+ }
186
+
187
+ .#{$element}#{$name}-indicator {
188
+ border-color: rgba(0, 0, 0, 0.5);
189
+ top: -2px;
190
+ height: calc(100% + 4px);
191
+ border-radius: 2px;
192
+ width: 4px;
193
+ }
194
+ }
195
+
196
+ .#{$element}#{$name}-details {
197
+ width: $size;
198
+ min-height: 170px;
199
+ margin: 4px;
200
+ display: flex;
201
+ flex-direction: column;
202
+ justify-content: space-between;
203
+ }
204
+
205
+ .#{$element}#{$name}-inputs {
206
+ label {
207
+ width: 25%;
208
+ display: inline-block;
209
+ text-align: right;
210
+
211
+ input {
212
+ margin-left: 2px;
213
+ width: 60%;
214
+ text-align: center;
215
+ }
216
+ }
217
+ }
218
+
219
+ .#{$element}#{$name}-pixel-picker {
220
+ display: flex;
221
+ width: 20px;
222
+ height: 20px;
223
+ flex-shrink: 0;
224
+ align-items: center;
225
+ margin-top: 4px;
226
+
227
+ svg path {
228
+ fill: currentColor;
229
+ }
230
+
231
+ &:hover {
232
+ cursor: pointer;
233
+
234
+ svg path {
235
+ fill: currentColor;
236
+ opacity: 0.5;
237
+ }
238
+ }
239
+ }
240
+
241
+ .#{$element}#{$name}-preview {
242
+ display: flex;
243
+ }
244
+
245
+ .#{$element}#{$name}-color {
246
+ @include cx-checker-background();
247
+ height: 64px;
248
+ width: 64px;
249
+ border-radius: 4px;
250
+ align-self: flex-end;
251
+
252
+ & > div {
253
+ width: 100%;
254
+ height: 100%;
255
+ }
256
+ }
257
+
258
+ .#{$element}#{$name}-values {
259
+ flex-grow: 1;
260
+ margin: 0 8px;
261
+
262
+ input {
263
+ width: 100%;
264
+ display: block;
265
+ }
266
+
267
+ input:not(:last-child) {
268
+ margin: 0 0 4px 0;
269
+ }
270
+ }
271
+ }
272
+
273
+ @if (cx-should-include("cx/widgets/ColorPicker")) {
274
+ @include cx-colorpicker();
275
+ }
@@ -1,22 +1,22 @@
1
- $cx-default-colorpicker-font-family: "Consolas", monospace !default;
2
- $cx-default-colorpicker-font-size: 11px !default;
3
- $cx-default-colorpicker-background-color: $cx-default-input-background-color !default;
4
- $cx-default-colorpicker-border-width: $cx-default-box-border-width !default;
5
- $cx-default-colorpicker-border-color: $cx-default-input-border-color !default;
6
- $cx-default-colorpicker-box-shadow: none !default;
7
-
8
- $cx-colorpicker-state-style-map: cx-deep-map-merge(
9
- $cx-input-state-style-map,
10
- (
11
- default: (
12
- font-family: $cx-default-colorpicker-font-family,
13
- font-size: $cx-default-colorpicker-font-size,
14
- background-color: $cx-default-colorpicker-background-color,
15
- border-width: $cx-default-colorpicker-border-width,
16
- border-color: $cx-default-colorpicker-border-color,
17
- box-shadow: $cx-default-colorpicker-box-shadow,
18
- padding: 2px,
19
- ),
20
- hover: (),
21
- )
22
- ) !default;
1
+ $cx-default-colorpicker-font-family: "Consolas", monospace !default;
2
+ $cx-default-colorpicker-font-size: 11px !default;
3
+ $cx-default-colorpicker-background-color: $cx-default-input-background-color !default;
4
+ $cx-default-colorpicker-border-width: $cx-default-box-border-width !default;
5
+ $cx-default-colorpicker-border-color: $cx-default-input-border-color !default;
6
+ $cx-default-colorpicker-box-shadow: none !default;
7
+
8
+ $cx-colorpicker-state-style-map: cx-deep-map-merge(
9
+ $cx-input-state-style-map,
10
+ (
11
+ default: (
12
+ font-family: $cx-default-colorpicker-font-family,
13
+ font-size: $cx-default-colorpicker-font-size,
14
+ background-color: $cx-default-colorpicker-background-color,
15
+ border-width: $cx-default-colorpicker-border-width,
16
+ border-color: $cx-default-colorpicker-border-color,
17
+ box-shadow: $cx-default-colorpicker-box-shadow,
18
+ padding: 2px,
19
+ ),
20
+ hover: (),
21
+ )
22
+ ) !default;
@@ -26,6 +26,8 @@ import { stopPropagation } from "../../util/eventCallbacks";
26
26
  import { Format } from "../../util/Format";
27
27
  import { TimeList } from "./TimeList";
28
28
  import { autoFocus } from "../autoFocus";
29
+ import { getActiveElement } from "../../util";
30
+ import { parseDateInvariant } from "../../util";
29
31
 
30
32
  export class DateTimeField extends Field {
31
33
  declareData() {
@@ -76,7 +78,9 @@ export class DateTimeField extends Field {
76
78
  let { data } = instance;
77
79
 
78
80
  if (data.value) {
79
- let date = new Date(data.value);
81
+ let date = parseDateInvariant(data.value);
82
+ // let date = new Date(data.value);
83
+
80
84
  if (isNaN(date.getTime())) data.formatted = String(data.value);
81
85
  else {
82
86
  // handle utc edge cases
@@ -86,11 +90,11 @@ export class DateTimeField extends Field {
86
90
  data.date = date;
87
91
  } else data.formatted = "";
88
92
 
89
- if (data.refDate) data.refDate = zeroTime(new Date(data.refDate));
93
+ if (data.refDate) data.refDate = zeroTime(parseDateInvariant(data.refDate));
90
94
 
91
- if (data.maxValue) data.maxValue = new Date(data.maxValue);
95
+ if (data.maxValue) data.maxValue = parseDateInvariant(data.maxValue);
92
96
 
93
- if (data.minValue) data.minValue = new Date(data.minValue);
97
+ if (data.minValue) data.minValue = parseDateInvariant(data.minValue);
94
98
 
95
99
  if (this.segment == "date") {
96
100
  if (data.minValue) data.minValue = zeroTime(data.minValue);
@@ -362,8 +366,8 @@ class DateTimeInput extends VDOM.Component {
362
366
  tabIndex={data.tabIndex}
363
367
  placeholder={data.placeholder}
364
368
  {...data.inputAttrs}
365
- onInput={(e) => this.onChange(e, "input")}
366
- onChange={(e) => this.onChange(e, "change")}
369
+ onInput={(e) => this.onChange(e.target.value, "input")}
370
+ onChange={(e) => this.onChange(e.target.value, "change")}
367
371
  onKeyDown={(e) => this.onKeyDown(e)}
368
372
  onBlur={(e) => {
369
373
  this.onBlur(e);
@@ -421,7 +425,7 @@ class DateTimeInput extends VDOM.Component {
421
425
 
422
426
  switch (e.keyCode) {
423
427
  case KeyCode.enter:
424
- this.onChange(e, "enter");
428
+ this.onChange(e.target.value, "enter");
425
429
  break;
426
430
 
427
431
  case KeyCode.esc:
@@ -453,7 +457,7 @@ class DateTimeInput extends VDOM.Component {
453
457
  this.setState({
454
458
  focus: false,
455
459
  });
456
- this.onChange(e, "blur");
460
+ this.onChange(e.target.value, "blur");
457
461
  }
458
462
 
459
463
  closeDropdown(e, callback) {
@@ -509,10 +513,13 @@ class DateTimeInput extends VDOM.Component {
509
513
  }
510
514
 
511
515
  componentWillUnmount() {
516
+ if (this.input == getActiveElement()) {
517
+ this.onChange(this.input.value, "blur");
518
+ }
512
519
  tooltipParentWillUnmount(this.props.instance);
513
520
  }
514
521
 
515
- onChange(e, eventType) {
522
+ onChange(inputValue, eventType) {
516
523
  let { instance, data } = this.props;
517
524
  let { widget } = instance;
518
525
 
@@ -522,7 +529,7 @@ class DateTimeInput extends VDOM.Component {
522
529
 
523
530
  if (eventType == "enter") instance.setState({ visited: true });
524
531
 
525
- this.setValue(e.target.value, data.value);
532
+ this.setValue(inputValue, data.value);
526
533
  }
527
534
 
528
535
  setValue(text, baseValue) {
@@ -536,7 +543,7 @@ class DateTimeInput extends VDOM.Component {
536
543
  });
537
544
 
538
545
  if (!isNaN(date)) {
539
- let mixed = new Date(baseValue);
546
+ let mixed = parseDateInvariant(baseValue);
540
547
  if (date && baseValue && !isNaN(mixed) && widget.partial) {
541
548
  switch (widget.segment) {
542
549
  case "date":