cx 26.4.4 → 26.5.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 (69) hide show
  1. package/build/charts/axis/Axis.d.ts +8 -0
  2. package/build/charts/axis/Axis.d.ts.map +1 -1
  3. package/build/charts/axis/Axis.js +18 -1
  4. package/build/charts/axis/TimeAxis.js +1 -0
  5. package/build/ui/Format.d.ts.map +1 -1
  6. package/build/ui/Format.js +26 -2
  7. package/build/util/Format.d.ts.map +1 -1
  8. package/build/util/Format.js +6 -0
  9. package/build/util/date/dateQuarter.d.ts +7 -0
  10. package/build/util/date/dateQuarter.d.ts.map +1 -0
  11. package/build/util/date/dateQuarter.js +8 -0
  12. package/build/util/date/dayBefore.d.ts +12 -0
  13. package/build/util/date/dayBefore.d.ts.map +1 -0
  14. package/build/util/date/dayBefore.js +15 -0
  15. package/build/util/date/index.d.ts +2 -0
  16. package/build/util/date/index.d.ts.map +1 -1
  17. package/build/util/date/index.js +2 -0
  18. package/build/widgets/form/DateTimePicker.d.ts.map +1 -1
  19. package/build/widgets/form/DateTimePicker.js +53 -31
  20. package/build/widgets/form/Field.d.ts.map +1 -1
  21. package/build/widgets/form/Field.js +2 -1
  22. package/build/widgets/form/Wheel.d.ts +8 -0
  23. package/build/widgets/form/Wheel.d.ts.map +1 -1
  24. package/build/widgets/form/Wheel.js +30 -7
  25. package/build/widgets/grid/Grid.d.ts +1 -1
  26. package/build/widgets/grid/Grid.d.ts.map +1 -1
  27. package/dist/charts.css +6 -0
  28. package/dist/charts.js +18 -1
  29. package/dist/manifest.js +787 -778
  30. package/dist/ui.js +33 -1
  31. package/dist/util.js +32 -0
  32. package/dist/widgets.js +225 -173
  33. package/package.json +1 -1
  34. package/src/charts/BarGraph.scss +31 -31
  35. package/src/charts/Legend.scss +57 -57
  36. package/src/charts/LegendEntry.scss +35 -35
  37. package/src/charts/LineGraph.scss +28 -28
  38. package/src/charts/RangeMarker.scss +3 -0
  39. package/src/charts/axis/Axis.tsx +31 -1
  40. package/src/charts/axis/TimeAxis.tsx +1 -0
  41. package/src/charts/helpers/SnapPointFinder.ts +136 -136
  42. package/src/charts/helpers/ValueAtFinder.ts +72 -72
  43. package/src/charts/index.scss +1 -0
  44. package/src/data/AugmentedViewBase.ts +89 -89
  45. package/src/data/View.ts +301 -301
  46. package/src/data/createAccessorModelProxy.ts +66 -66
  47. package/src/ui/Format.spec.ts +32 -0
  48. package/src/ui/Format.ts +27 -2
  49. package/src/ui/Repeater.spec.tsx +181 -181
  50. package/src/util/Format.spec.ts +11 -0
  51. package/src/util/Format.ts +7 -0
  52. package/src/util/date/dateQuarter.ts +8 -0
  53. package/src/util/date/dayBefore.ts +15 -0
  54. package/src/util/date/index.ts +2 -0
  55. package/src/util/scss/include.scss +69 -69
  56. package/src/widgets/Button.maps.scss +103 -103
  57. package/src/widgets/form/Calendar.tsx +772 -772
  58. package/src/widgets/form/DateTimePicker.tsx +453 -392
  59. package/src/widgets/form/Field.tsx +2 -1
  60. package/src/widgets/form/ValidationGroup.spec.tsx +30 -1
  61. package/src/widgets/form/Wheel.tsx +36 -7
  62. package/src/widgets/grid/Grid.scss +657 -657
  63. package/src/widgets/grid/Grid.tsx +1 -1
  64. package/src/widgets/grid/variables.scss +47 -47
  65. package/src/widgets/index.ts +63 -63
  66. package/src/widgets/nav/MenuItem.scss +150 -150
  67. package/src/widgets/nav/Tab.ts +122 -122
  68. package/src/widgets/overlay/Overlay.tsx +1029 -1029
  69. package/src/widgets/variables.scss +61 -61
package/dist/ui.js CHANGED
@@ -15,12 +15,12 @@ import {
15
15
  ZoomIntoPropertyView,
16
16
  setGetExpressionCacheCallback,
17
17
  setGetStringTemplateCacheCallback,
18
+ StringTemplate,
18
19
  SubscribableView,
19
20
  Store,
20
21
  NestedDataView,
21
22
  Grouper,
22
23
  getComparer,
23
- StringTemplate,
24
24
  } from "cx/data";
25
25
  export { computable, createAccessorModelProxy, createModel } from "cx/data";
26
26
  import {
@@ -53,7 +53,9 @@ import {
53
53
  Format as Format$1,
54
54
  resolveMinMaxFractionDigits,
55
55
  parseDateInvariant,
56
+ dayBefore,
56
57
  setGetFormatCacheCallback,
58
+ dateQuarter,
57
59
  TraversalStack,
58
60
  reverseSlice,
59
61
  appDataFlag,
@@ -1902,6 +1904,31 @@ class ZIndexManager {
1902
1904
  }
1903
1905
 
1904
1906
  const Format = Format$1;
1907
+ // The `quarter` formatter renders a calendar quarter via a string-template
1908
+ // pattern with `{q}` (quarter number), `{yyyy}` and `{yy}` (year) placeholders.
1909
+ // Placeholders are case-insensitive (`{Q}`, `{YYYY}`, `{YY}` work too). It lives
1910
+ // here rather than in util/Format because it depends on StringTemplate from the
1911
+ // data layer, which util/ cannot import. It is registered eagerly since it does
1912
+ // not depend on culture settings.
1913
+ Format$1.registerFactory("quarter", (fmt, pattern, mode) => {
1914
+ let exclusive = mode === "exclusive" || mode === "ex" || mode === "e";
1915
+ let template = StringTemplate.get(pattern || "Q{q} {yyyy}");
1916
+ return (value) => {
1917
+ let date = parseDateInvariant(value);
1918
+ if (exclusive) date = dayBefore(date);
1919
+ let q = dateQuarter(date);
1920
+ let yyyy = date.getFullYear();
1921
+ let yy = String(yyyy % 100).padStart(2, "0");
1922
+ return template({
1923
+ q,
1924
+ Q: q,
1925
+ yyyy,
1926
+ YYYY: yyyy,
1927
+ yy,
1928
+ YY: yy,
1929
+ });
1930
+ };
1931
+ });
1905
1932
  let cultureSensitiveFormatsRegistered = false;
1906
1933
  function resolveNumberFormattingFlags(flags) {
1907
1934
  if (!flags) return null;
@@ -1966,6 +1993,11 @@ function enableCultureSensitiveFormatting() {
1966
1993
  let formatter = culture.getFormatter(format);
1967
1994
  return (value) => formatter.format(parseDateInvariant(value));
1968
1995
  });
1996
+ Format$1.registerFactory(["dayBefore", "daybefore"], (fmt, format = "yyyyMd hhmm") => {
1997
+ let culture = Culture.getDateTimeCulture();
1998
+ let formatter = culture.getFormatter(format);
1999
+ return (value) => formatter.format(dayBefore(parseDateInvariant(value)));
2000
+ });
1969
2001
  setGetFormatCacheCallback(() => {
1970
2002
  let cache = getCurrentCultureCache();
1971
2003
  if (!cache.formatCache) cache.formatCache = {};
package/dist/util.js CHANGED
@@ -156,6 +156,22 @@ function overrideParseDateInvariant(newImpl) {
156
156
  impl = newImpl;
157
157
  }
158
158
 
159
+ /**
160
+ * Returns a new `Date` representing the calendar day before the given date,
161
+ * keeping the same time of day. Month and year boundaries are handled
162
+ * automatically. The input is not mutated.
163
+ *
164
+ * Useful for displaying the exclusive end of a date range as an inclusive
165
+ * value, e.g. a period ending at `2021-01-01` shown as `Dec 2020`.
166
+ * @param date
167
+ * @returns {Date}
168
+ */
169
+ function dayBefore(date) {
170
+ let result = new Date(date.getTime());
171
+ result.setDate(result.getDate() - 1);
172
+ return result;
173
+ }
174
+
159
175
  const defaultFormatter = (v) => v.toString();
160
176
  let formatFactory = {
161
177
  string: function () {
@@ -225,6 +241,10 @@ let formatFactory = {
225
241
  let time = formatFactory.time();
226
242
  return (value) => date(value) + " " + time(value);
227
243
  },
244
+ dayBefore: function () {
245
+ let datetime = formatFactory.datetime();
246
+ return (value) => datetime(dayBefore(parseDateInvariant(value)));
247
+ },
228
248
  ellipsis: function (part0, length, where) {
229
249
  length = Number(length);
230
250
  if (!(length > 3)) length = 10;
@@ -288,6 +308,7 @@ formatFactory.ps = formatFactory.percentageSign;
288
308
  formatFactory.d = formatFactory.date;
289
309
  formatFactory.t = formatFactory.time;
290
310
  formatFactory.dt = formatFactory.datetime;
311
+ formatFactory.daybefore = formatFactory.dayBefore;
291
312
  formatFactory.zeropad = formatFactory.zeroPad;
292
313
  formatFactory.leftpad = formatFactory.leftPad;
293
314
  formatFactory.capitalize = formatFactory.capitalize;
@@ -715,6 +736,15 @@ function dateDiff(d1, d2) {
715
736
  return d1.getTime() - d2.getTime();
716
737
  }
717
738
 
739
+ /**
740
+ * Returns the calendar quarter (1-4) the given date falls in.
741
+ * @param date
742
+ * @returns {number}
743
+ */
744
+ function dateQuarter(date) {
745
+ return Math.floor(date.getMonth() / 3) + 1;
746
+ }
747
+
718
748
  /**
719
749
  * Zeros out time for the given Date object. E.g. for date object representing Wed Apr 19 2017 14:31:51 GMT+0200
720
750
  * returns Wed Apr 19 2017 00:00:00 GMT+0200.
@@ -1575,6 +1605,8 @@ export {
1575
1605
  coalesce,
1576
1606
  createComponentFactory,
1577
1607
  dateDiff,
1608
+ dateQuarter,
1609
+ dayBefore,
1578
1610
  debounce,
1579
1611
  debug,
1580
1612
  deprecatedFlag,
package/dist/widgets.js CHANGED
@@ -6708,6 +6708,7 @@ class Field extends PureContainerBase {
6708
6708
  data._readOnly = data.readOnly;
6709
6709
  data._viewMode = data.mode === "view" || data.viewMode;
6710
6710
  data._tabOnEnterKey = data.tabOnEnterKey;
6711
+ data._visited = data.visited;
6711
6712
  data.validationValue = this.getValidationValue(data);
6712
6713
  instance.parentDisabled = context.parentDisabled;
6713
6714
  instance.parentReadOnly = context.parentReadOnly;
@@ -6745,7 +6746,7 @@ class Field extends PureContainerBase {
6745
6746
  data._tabOnEnterKey,
6746
6747
  context.parentTabOnEnterKey,
6747
6748
  );
6748
- data.visited = coalesce(context.parentStrict ? context.parentVisited : null, data.visited, context.parentVisited);
6749
+ data.visited = coalesce(context.parentStrict ? context.parentVisited : null, data._visited, context.parentVisited);
6749
6750
  if (!data.error && !data.disabled && !data.viewMode) this.validate(context, instance);
6750
6751
  if (data.visited && !state?.visited) {
6751
6752
  //feels hacky but it should be ok since we're in the middle of a new render cycle
@@ -13164,6 +13165,9 @@ class Wheel extends PureContainerBase {
13164
13165
  Wheel.prototype.baseClass = "wheel";
13165
13166
  Wheel.prototype.size = 3;
13166
13167
  Wheel.prototype.styled = true;
13168
+ /** A cyclic wheel renders its option list this many times, leaving scroll
13169
+ * headroom on both sides of the centre copy. */
13170
+ const WHEEL_BUFFER_COPIES = 3;
13167
13171
  class WheelComponent extends VDOM.Component {
13168
13172
  index;
13169
13173
  wheelEl;
@@ -13185,28 +13189,34 @@ class WheelComponent extends VDOM.Component {
13185
13189
  wheelRef;
13186
13190
  scrollRef;
13187
13191
  render() {
13188
- let { size, children, CSS, baseClass, active, className, style, onMouseDown } = this.props;
13192
+ let { size, children, CSS, baseClass, active, className, style, onMouseDown, cycle } = this.props;
13189
13193
  let optionClass = CSS.element(baseClass, "option");
13190
13194
  let dummyClass = CSS.element(baseClass, "option", {
13191
13195
  dummy: true,
13192
13196
  });
13197
+ // A cyclic wheel repeats the option list so it can scroll past either end.
13198
+ let options = children;
13199
+ if (cycle) {
13200
+ options = [];
13201
+ for (let i = 0; i < WHEEL_BUFFER_COPIES; i++) options.push(...children);
13202
+ }
13193
13203
  let tpad = [],
13194
13204
  bpad = [];
13195
13205
  for (let i = 0; i < (size - 1) / 2; i++) {
13196
13206
  tpad.push({
13197
13207
  key: -1 - i,
13198
- child: children[0],
13208
+ child: options[0],
13199
13209
  cls: dummyClass,
13200
13210
  });
13201
13211
  bpad.push({
13202
13212
  key: -100 - i,
13203
- child: children[0],
13213
+ child: options[0],
13204
13214
  cls: dummyClass,
13205
13215
  });
13206
13216
  }
13207
13217
  let displayedOptions = [
13208
13218
  ...tpad,
13209
- ...children.map((c, i) => ({
13219
+ ...options.map((c, i) => ({
13210
13220
  key: i,
13211
13221
  child: c,
13212
13222
  cls: optionClass,
@@ -13314,7 +13324,19 @@ class WheelComponent extends VDOM.Component {
13314
13324
  if (this.props.onPipeKeyDown) this.props.onPipeKeyDown(this.onKeyDown);
13315
13325
  }
13316
13326
  UNSAFE_componentWillReceiveProps(props) {
13317
- this.index = props.index || 0;
13327
+ let newIndex = props.index || 0;
13328
+ // A cyclic wheel renders the option list several times, so the same value
13329
+ // appears in several copies. Snap to the copy nearest the wheel's current
13330
+ // position rather than the one `props.index` names — a wrap then scrolls
13331
+ // one item into the adjacent (identical) copy with no jump, instead of
13332
+ // animating all the way back to the centre copy.
13333
+ if (props.cycle) {
13334
+ let period = props.children.length;
13335
+ let value = ((newIndex % period) + period) % period;
13336
+ newIndex = value + period * Math.round((this.index - value) / period);
13337
+ newIndex = Math.max(0, Math.min(period * WHEEL_BUFFER_COPIES - 1, newIndex));
13338
+ }
13339
+ this.index = newIndex;
13318
13340
  this.scrollTo();
13319
13341
  }
13320
13342
  componentWillUnmount() {
@@ -13351,8 +13373,9 @@ class WheelComponent extends VDOM.Component {
13351
13373
  }
13352
13374
  }
13353
13375
  select(newIndex) {
13354
- let { children } = this.props;
13355
- newIndex = Math.max(0, Math.min(children.length - 1, newIndex));
13376
+ let { children, cycle } = this.props;
13377
+ let length = children.length * (cycle ? WHEEL_BUFFER_COPIES : 1);
13378
+ newIndex = Math.max(0, Math.min(length - 1, newIndex));
13356
13379
  if (this.index !== newIndex) {
13357
13380
  this.index = newIndex;
13358
13381
  this.props.onChange(newIndex);
@@ -13408,6 +13431,24 @@ DateTimePicker.prototype.size = 3;
13408
13431
  DateTimePicker.prototype.autoFocus = false;
13409
13432
  DateTimePicker.prototype.segment = "datetime";
13410
13433
  DateTimePicker.prototype.showSeconds = false;
13434
+ // Builds the option spans for a numeric wheel — one zero-padded span per value.
13435
+ // Pass the result to a WheelComponent with `cycle` set to make it scroll
13436
+ // endlessly; centre the current value by passing `index = value + range`.
13437
+ function buildNumberWheel(range, startAt) {
13438
+ return Array.from(
13439
+ {
13440
+ length: range,
13441
+ },
13442
+ (_, j) =>
13443
+ jsx(
13444
+ "span",
13445
+ {
13446
+ children: String(j + startAt).padStart(2, "0"),
13447
+ },
13448
+ j,
13449
+ ),
13450
+ );
13451
+ }
13411
13452
  class DateTimePickerComponent extends VDOM.Component {
13412
13453
  el;
13413
13454
  keyDownPipes;
@@ -13419,6 +13460,7 @@ class DateTimePickerComponent extends VDOM.Component {
13419
13460
  date: date,
13420
13461
  activeWheel: null,
13421
13462
  };
13463
+ this.century = (date.getFullYear() / 100) | 0;
13422
13464
  let { widget } = props.instance;
13423
13465
  let pickerWidget = widget;
13424
13466
  this.handleChange = this.handleChange.bind(this);
@@ -13481,56 +13523,37 @@ class DateTimePickerComponent extends VDOM.Component {
13481
13523
  let date = this.state.date;
13482
13524
  let culture = Culture.getDateTimeCulture();
13483
13525
  let monthNames = culture.getMonthNames("short");
13484
- let years = [];
13485
- for (let y = 1970; y <= 2050; y++)
13486
- years.push(
13487
- jsx(
13488
- "span",
13489
- {
13490
- children: y,
13491
- },
13492
- y,
13493
- ),
13494
- );
13495
- let days = [];
13496
- let start = new Date(date.getFullYear(), date.getMonth(), 1);
13497
- while (start.getMonth() === date.getMonth()) {
13498
- let day = start.getDate();
13499
- days.push(
13500
- jsx(
13501
- "span",
13502
- {
13503
- children: day < 10 ? "0" + day : day,
13504
- },
13505
- day,
13506
- ),
13507
- );
13508
- start.setDate(start.getDate() + 1);
13509
- }
13510
- let hours = [];
13511
- for (let h = 0; h < 24; h++) {
13512
- hours.push(
13513
- jsx(
13514
- "span",
13515
- {
13516
- children: h < 10 ? "0" + h : h,
13517
- },
13518
- h,
13519
- ),
13520
- );
13521
- }
13522
- let minutes = [];
13523
- for (let m = 0; m < 60; m++) {
13524
- minutes.push(
13525
- jsx(
13526
- "span",
13527
- {
13528
- children: m < 10 ? "0" + m : m,
13529
- },
13530
- m,
13531
- ),
13532
- );
13526
+ // Years: a window spanning the current century, rebuilt when it changes.
13527
+ let currentCentury = (date.getFullYear() / 100) | 0;
13528
+ if (!this.years || this.century !== currentCentury) {
13529
+ this.century = currentCentury;
13530
+ this.firstYear = currentCentury * 100 - 3;
13531
+ let lastYear = (currentCentury + 1) * 100 + 5;
13532
+ this.years = [];
13533
+ for (let y = this.firstYear; y <= lastYear; y++)
13534
+ this.years.push(
13535
+ jsx(
13536
+ "span",
13537
+ {
13538
+ children: y,
13539
+ },
13540
+ y,
13541
+ ),
13542
+ );
13533
13543
  }
13544
+ let years = this.years;
13545
+ // Day/hour/minute wheels use a 3x buffer (see buildNumberWheel). The day
13546
+ // buffer depends on the month length, so it is rebuilt when that changes.
13547
+ const numberOfDaysInMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
13548
+ if (!this.days || this.numberOfDaysInMonth !== numberOfDaysInMonth) {
13549
+ this.numberOfDaysInMonth = numberOfDaysInMonth;
13550
+ this.days = buildNumberWheel(numberOfDaysInMonth, 1);
13551
+ }
13552
+ let days = this.days;
13553
+ if (!this.hours) this.hours = buildNumberWheel(24, 0);
13554
+ let hours = this.hours;
13555
+ if (!this.minutes) this.minutes = buildNumberWheel(60, 0);
13556
+ let minutes = this.minutes;
13534
13557
  return jsxs("div", {
13535
13558
  tabIndex: 0,
13536
13559
  ref: (el) => {
@@ -13542,30 +13565,34 @@ class DateTimePickerComponent extends VDOM.Component {
13542
13565
  onKeyDown: this.onKeyDown,
13543
13566
  children: [
13544
13567
  this.wheels.year &&
13545
- jsx(WheelComponent, {
13546
- size: size,
13547
- CSS: CSS,
13548
- active: this.state.activeWheel === "year",
13549
- baseClass: baseClass + "-wheel",
13550
- index: date.getFullYear() - 1970,
13551
- onChange: (newIndex) => {
13552
- this.setState(
13553
- (state) => ({
13554
- date: this.setDateComponent(this.state.date, "year", newIndex + 1970),
13555
- }),
13556
- this.handleChange,
13557
- );
13558
- },
13559
- onPipeKeyDown: (kd) => {
13560
- this.keyDownPipes["year"] = kd;
13561
- },
13562
- onMouseDown: () => {
13563
- this.setState({
13564
- activeWheel: "year",
13565
- });
13568
+ jsx(
13569
+ WheelComponent,
13570
+ {
13571
+ size: size,
13572
+ CSS: CSS,
13573
+ active: this.state.activeWheel === "year",
13574
+ baseClass: baseClass + "-wheel",
13575
+ index: date.getFullYear() - this.firstYear,
13576
+ onChange: (newIndex) => {
13577
+ this.setState(
13578
+ (state) => ({
13579
+ date: this.setDateComponent(state.date, "year", newIndex + this.firstYear),
13580
+ }),
13581
+ this.handleChange,
13582
+ );
13583
+ },
13584
+ onPipeKeyDown: (kd) => {
13585
+ this.keyDownPipes["year"] = kd;
13586
+ },
13587
+ onMouseDown: () => {
13588
+ this.setState({
13589
+ activeWheel: "year",
13590
+ });
13591
+ },
13592
+ children: years,
13566
13593
  },
13567
- children: years,
13568
- }),
13594
+ `years-${this.century}`,
13595
+ ),
13569
13596
  this.wheels.year &&
13570
13597
  this.wheels.month &&
13571
13598
  jsx("span", {
@@ -13581,7 +13608,7 @@ class DateTimePickerComponent extends VDOM.Component {
13581
13608
  onChange: (newIndex) => {
13582
13609
  this.setState(
13583
13610
  (state) => ({
13584
- date: this.setDateComponent(this.state.date, "month", newIndex),
13611
+ date: this.setDateComponent(state.date, "month", newIndex),
13585
13612
  }),
13586
13613
  this.handleChange,
13587
13614
  );
@@ -13610,120 +13637,144 @@ class DateTimePickerComponent extends VDOM.Component {
13610
13637
  children: "-",
13611
13638
  }),
13612
13639
  this.wheels.date &&
13613
- jsx(WheelComponent, {
13614
- size: size,
13615
- CSS: CSS,
13616
- active: this.state.activeWheel === "date",
13617
- baseClass: baseClass + "-wheel",
13618
- index: date.getDate() - 1,
13619
- onChange: (newIndex) => {
13620
- this.setState(
13621
- (state) => ({
13622
- date: this.setDateComponent(this.state.date, "date", newIndex + 1),
13623
- }),
13624
- this.handleChange,
13625
- );
13626
- },
13627
- onPipeKeyDown: (kd) => {
13628
- this.keyDownPipes["date"] = kd;
13629
- },
13630
- onMouseDown: () => {
13631
- this.setState({
13632
- activeWheel: "date",
13633
- });
13640
+ jsx(
13641
+ WheelComponent,
13642
+ {
13643
+ size: size,
13644
+ CSS: CSS,
13645
+ cycle: true,
13646
+ active: this.state.activeWheel === "date",
13647
+ baseClass: baseClass + "-wheel",
13648
+ index: date.getDate() - 1 + this.numberOfDaysInMonth,
13649
+ onChange: (rawIndex) => {
13650
+ let day = rawIndex % this.numberOfDaysInMonth;
13651
+ this.setState(
13652
+ (state) => ({
13653
+ date: this.setDateComponent(state.date, "date", day + 1),
13654
+ }),
13655
+ this.handleChange,
13656
+ );
13657
+ },
13658
+ onPipeKeyDown: (kd) => {
13659
+ this.keyDownPipes["date"] = kd;
13660
+ },
13661
+ onMouseDown: () => {
13662
+ this.setState({
13663
+ activeWheel: "date",
13664
+ });
13665
+ },
13666
+ children: days,
13634
13667
  },
13635
- children: days,
13636
- }),
13668
+ "date",
13669
+ ),
13637
13670
  this.wheels.hours &&
13638
13671
  this.wheels.year &&
13639
13672
  jsx("span", {
13640
13673
  className: CSS.element(baseClass, "spacer"),
13641
13674
  }),
13642
13675
  this.wheels.hours &&
13643
- jsx(WheelComponent, {
13644
- size: size,
13645
- CSS: CSS,
13646
- active: this.state.activeWheel === "hours",
13647
- baseClass: baseClass + "-wheel",
13648
- index: date.getHours(),
13649
- onChange: (newIndex) => {
13650
- this.setState(
13651
- (state) => ({
13652
- date: this.setDateComponent(this.state.date, "hours", newIndex),
13653
- }),
13654
- this.handleChange,
13655
- );
13656
- },
13657
- onPipeKeyDown: (kd) => {
13658
- this.keyDownPipes["hours"] = kd;
13659
- },
13660
- onMouseDown: () => {
13661
- this.setState({
13662
- activeWheel: "hours",
13663
- });
13676
+ jsx(
13677
+ WheelComponent,
13678
+ {
13679
+ size: size,
13680
+ CSS: CSS,
13681
+ cycle: true,
13682
+ active: this.state.activeWheel === "hours",
13683
+ baseClass: baseClass + "-wheel",
13684
+ index: date.getHours() + 24,
13685
+ onChange: (rawIndex) => {
13686
+ let hour = rawIndex % 24;
13687
+ this.setState(
13688
+ (state) => ({
13689
+ date: this.setDateComponent(state.date, "hours", hour),
13690
+ }),
13691
+ this.handleChange,
13692
+ );
13693
+ },
13694
+ onPipeKeyDown: (kd) => {
13695
+ this.keyDownPipes["hours"] = kd;
13696
+ },
13697
+ onMouseDown: () => {
13698
+ this.setState({
13699
+ activeWheel: "hours",
13700
+ });
13701
+ },
13702
+ children: hours,
13664
13703
  },
13665
- children: hours,
13666
- }),
13704
+ "hours",
13705
+ ),
13667
13706
  this.wheels.hours &&
13668
13707
  this.wheels.minutes &&
13669
13708
  jsx("span", {
13670
13709
  children: ":",
13671
13710
  }),
13672
13711
  this.wheels.minutes &&
13673
- jsx(WheelComponent, {
13674
- size: size,
13675
- CSS: CSS,
13676
- baseClass: baseClass + "-wheel",
13677
- active: this.state.activeWheel === "minutes",
13678
- index: date.getMinutes(),
13679
- onChange: (newIndex) => {
13680
- this.setState(
13681
- (state) => ({
13682
- date: this.setDateComponent(this.state.date, "minutes", newIndex),
13683
- }),
13684
- this.handleChange,
13685
- );
13686
- },
13687
- onPipeKeyDown: (kd) => {
13688
- this.keyDownPipes["minutes"] = kd;
13689
- },
13690
- onMouseDown: () => {
13691
- this.setState({
13692
- activeWheel: "minutes",
13693
- });
13712
+ jsx(
13713
+ WheelComponent,
13714
+ {
13715
+ size: size,
13716
+ CSS: CSS,
13717
+ cycle: true,
13718
+ baseClass: baseClass + "-wheel",
13719
+ active: this.state.activeWheel === "minutes",
13720
+ index: date.getMinutes() + 60,
13721
+ onChange: (rawIndex) => {
13722
+ let minute = rawIndex % 60;
13723
+ this.setState(
13724
+ (state) => ({
13725
+ date: this.setDateComponent(state.date, "minutes", minute),
13726
+ }),
13727
+ this.handleChange,
13728
+ );
13729
+ },
13730
+ onPipeKeyDown: (kd) => {
13731
+ this.keyDownPipes["minutes"] = kd;
13732
+ },
13733
+ onMouseDown: () => {
13734
+ this.setState({
13735
+ activeWheel: "minutes",
13736
+ });
13737
+ },
13738
+ children: minutes,
13694
13739
  },
13695
- children: minutes,
13696
- }),
13740
+ "minutes",
13741
+ ),
13697
13742
  this.wheels.minutes &&
13698
13743
  this.wheels.seconds &&
13699
13744
  jsx("span", {
13700
13745
  children: ":",
13701
13746
  }),
13702
13747
  this.wheels.seconds &&
13703
- jsx(WheelComponent, {
13704
- size: size,
13705
- CSS: CSS,
13706
- baseClass: baseClass + "-wheel",
13707
- active: this.state.activeWheel === "seconds",
13708
- index: date.getSeconds(),
13709
- onChange: (newIndex) => {
13710
- this.setState(
13711
- (state) => ({
13712
- date: this.setDateComponent(this.state.date, "seconds", newIndex),
13713
- }),
13714
- this.handleChange,
13715
- );
13716
- },
13717
- onPipeKeyDown: (kd) => {
13718
- this.keyDownPipes["seconds"] = kd;
13719
- },
13720
- onMouseDown: () => {
13721
- this.setState({
13722
- activeWheel: "seconds",
13723
- });
13748
+ jsx(
13749
+ WheelComponent,
13750
+ {
13751
+ size: size,
13752
+ CSS: CSS,
13753
+ cycle: true,
13754
+ baseClass: baseClass + "-wheel",
13755
+ active: this.state.activeWheel === "seconds",
13756
+ index: date.getSeconds() + 60,
13757
+ onChange: (rawIndex) => {
13758
+ let second = rawIndex % 60;
13759
+ this.setState(
13760
+ (state) => ({
13761
+ date: this.setDateComponent(state.date, "seconds", second),
13762
+ }),
13763
+ this.handleChange,
13764
+ );
13765
+ },
13766
+ onPipeKeyDown: (kd) => {
13767
+ this.keyDownPipes["seconds"] = kd;
13768
+ },
13769
+ onMouseDown: () => {
13770
+ this.setState({
13771
+ activeWheel: "seconds",
13772
+ });
13773
+ },
13774
+ children: minutes,
13724
13775
  },
13725
- children: minutes,
13726
- }),
13776
+ "seconds",
13777
+ ),
13727
13778
  ],
13728
13779
  });
13729
13780
  }
@@ -18586,6 +18637,7 @@ export {
18586
18637
  ValidationError,
18587
18638
  ValidationGroup,
18588
18639
  Validator,
18640
+ WHEEL_BUFFER_COPIES,
18589
18641
  Wheel,
18590
18642
  WheelComponent,
18591
18643
  Window,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "26.4.4",
3
+ "version": "26.5.1",
4
4
  "description": "Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.",
5
5
  "exports": {
6
6
  "./data": {