cx 23.12.2 → 24.0.0

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/ui.js CHANGED
@@ -1465,60 +1465,91 @@ var ZIndexManager = /*#__PURE__*/ (function () {
1465
1465
 
1466
1466
  var Format = Format$1;
1467
1467
  var cultureSensitiveFormatsRegistered = false;
1468
+ function resolveNumberFormattingFlags(flags) {
1469
+ if (!flags) return null;
1470
+ var result = {};
1471
+ if (flags.indexOf("+") >= 0) result.signDisplay = "exceptZero";
1472
+ if (flags.indexOf("c") >= 0) result.notation = "compact";
1473
+ if (flags.indexOf("a") >= 0) result.currencySign = "accounting";
1474
+ return result;
1475
+ }
1468
1476
  function enableCultureSensitiveFormatting() {
1469
1477
  if (cultureSensitiveFormatsRegistered) return;
1470
1478
  cultureSensitiveFormatsRegistered = true;
1471
- Format$1.registerFactory(["number", "n"], function (format, minimumFractionDigits, maximumFractionDigits) {
1472
- var culture = Culture.getNumberCulture();
1473
- var formatter = culture.getFormatter(resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits));
1474
- return function (value) {
1475
- return formatter.format(value);
1476
- };
1477
- });
1478
- Format$1.registerFactory("currency", function (format, currency, minimumFractionDigits, maximumFractionDigits) {
1479
- var culture = Culture.getNumberCulture();
1480
- currency = currency || Culture.defaultCurrency;
1481
- var formatter = culture.getFormatter(
1482
- _objectSpread2(
1483
- {
1484
- style: "currency",
1485
- currency: currency,
1486
- },
1487
- resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)
1488
- )
1489
- );
1490
- return function (value) {
1491
- return formatter.format(value);
1492
- };
1493
- });
1494
- Format$1.registerFactory(["percentage", "p", "%"], function (format, minimumFractionDigits, maximumFractionDigits) {
1479
+ Format$1.registerFactory(["number", "n"], function (format, minimumFractionDigits, maximumFractionDigits, flags) {
1495
1480
  var culture = Culture.getNumberCulture();
1496
1481
  var formatter = culture.getFormatter(
1497
1482
  _objectSpread2(
1498
- {
1499
- style: "percent",
1500
- },
1501
- resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)
1483
+ _objectSpread2({}, resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)),
1484
+ resolveNumberFormattingFlags(flags)
1502
1485
  )
1503
1486
  );
1504
1487
  return function (value) {
1505
1488
  return formatter.format(value);
1506
1489
  };
1507
1490
  });
1508
- Format$1.registerFactory(["percentSign", "ps"], function (format, minimumFractionDigits, maximumFractionDigits) {
1509
- var culture = Culture.getNumberCulture();
1510
- var formatter = culture.getFormatter(
1511
- _objectSpread2(
1512
- {
1513
- style: "percent",
1514
- },
1515
- resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)
1516
- )
1517
- );
1518
- return function (value) {
1519
- return formatter.format(value / 100);
1520
- };
1521
- });
1491
+ Format$1.registerFactory(
1492
+ "currency",
1493
+ function (format, currency, minimumFractionDigits, maximumFractionDigits, flags) {
1494
+ var culture = Culture.getNumberCulture();
1495
+ currency = currency || Culture.defaultCurrency;
1496
+ var formatter = culture.getFormatter(
1497
+ _objectSpread2(
1498
+ _objectSpread2(
1499
+ {
1500
+ style: "currency",
1501
+ currency: currency,
1502
+ },
1503
+ resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)
1504
+ ),
1505
+ resolveNumberFormattingFlags(flags)
1506
+ )
1507
+ );
1508
+ return function (value) {
1509
+ return formatter.format(value);
1510
+ };
1511
+ }
1512
+ );
1513
+ Format$1.registerFactory(
1514
+ ["percentage", "p", "%"],
1515
+ function (format, minimumFractionDigits, maximumFractionDigits, flags) {
1516
+ var culture = Culture.getNumberCulture();
1517
+ var formatter = culture.getFormatter(
1518
+ _objectSpread2(
1519
+ _objectSpread2(
1520
+ {
1521
+ style: "percent",
1522
+ },
1523
+ resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)
1524
+ ),
1525
+ resolveNumberFormattingFlags(flags)
1526
+ )
1527
+ );
1528
+ return function (value) {
1529
+ return formatter.format(value);
1530
+ };
1531
+ }
1532
+ );
1533
+ Format$1.registerFactory(
1534
+ ["percentSign", "ps"],
1535
+ function (format, minimumFractionDigits, maximumFractionDigits, flags) {
1536
+ var culture = Culture.getNumberCulture();
1537
+ var formatter = culture.getFormatter(
1538
+ _objectSpread2(
1539
+ _objectSpread2(
1540
+ {
1541
+ style: "percent",
1542
+ },
1543
+ resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits)
1544
+ ),
1545
+ resolveNumberFormattingFlags(flags)
1546
+ )
1547
+ );
1548
+ return function (value) {
1549
+ return formatter.format(value / 100);
1550
+ };
1551
+ }
1552
+ );
1522
1553
  Format$1.registerFactory(["date", "d"], function (fmt, format) {
1523
1554
  if (format === void 0) {
1524
1555
  format = "yyyyMMdd";
@@ -2770,6 +2801,7 @@ var Restate = /*#__PURE__*/ (function (_PureContainer) {
2770
2801
  onError: this.onError,
2771
2802
  deferredUntilIdle: instance.data.deferredUntilIdle,
2772
2803
  idleTimeout: instance.data.idleTimeout,
2804
+ immediate: this.immediate,
2773
2805
  },
2774
2806
  key
2775
2807
  );
@@ -2778,6 +2810,7 @@ var Restate = /*#__PURE__*/ (function (_PureContainer) {
2778
2810
  })(PureContainer);
2779
2811
  Restate.prototype.detached = false;
2780
2812
  Restate.prototype.waitForIdle = false;
2813
+ Restate.prototype.immediate = false;
2781
2814
  var PrivateStore = Restate;
2782
2815
  var RestateStore = /*#__PURE__*/ (function (_Store) {
2783
2816
  _inheritsLoose(RestateStore, _Store);
@@ -4456,6 +4489,7 @@ export {
4456
4489
  preventFocus,
4457
4490
  preventFocusOnTouch,
4458
4491
  registerKeyboardShortcut,
4492
+ resolveNumberFormattingFlags,
4459
4493
  startAppLoop,
4460
4494
  startHotAppLoop,
4461
4495
  tpl,
package/dist/widgets.js CHANGED
@@ -3266,15 +3266,14 @@ var OverlayComponent = /*#__PURE__*/ (function (_VDOM$Component2) {
3266
3266
  }),
3267
3267
  style: parseStyle(data.shadowStyle),
3268
3268
  children: [
3269
- widget.backdrop &&
3270
- /*#__PURE__*/ jsx(
3271
- "div",
3272
- {
3273
- className: CSS.element("overlay", "modal-backdrop"),
3274
- onClick: this.onBackdropClick.bind(this),
3275
- },
3276
- "backdrop"
3277
- ),
3269
+ /*#__PURE__*/ jsx(
3270
+ "div",
3271
+ {
3272
+ className: CSS.element("overlay", "modal-backdrop"),
3273
+ onClick: this.onBackdropClick.bind(this),
3274
+ },
3275
+ "backdrop"
3276
+ ),
3278
3277
  content,
3279
3278
  ],
3280
3279
  },
@@ -3365,6 +3364,8 @@ var OverlayComponent = /*#__PURE__*/ (function (_VDOM$Component2) {
3365
3364
  if (widget.onBackdropClick) instance.invoke("onBackdropClick", e, instance);
3366
3365
  if (widget.backdrop) {
3367
3366
  if (instance.dismiss) instance.dismiss();
3367
+ } else if (widget.modal) {
3368
+ FocusManager.focus(this.el);
3368
3369
  }
3369
3370
  };
3370
3371
  _proto3.onMouseUp = function onMouseUp(e) {
@@ -10748,14 +10749,16 @@ var MonthPicker = /*#__PURE__*/ (function (_Field) {
10748
10749
  );
10749
10750
  };
10750
10751
  _proto.handleSelect = function handleSelect(e, instance, date1, date2) {
10751
- var data = instance.data;
10752
+ var data = instance.data,
10753
+ widget = instance.widget;
10754
+ var encode = widget.encoding || Culture.getDefaultDateEncoding();
10752
10755
  if (data.disabled) return;
10753
10756
  if (!validationCheck(date1, data)) return;
10754
10757
  if (this.onBeforeSelect && instance.invoke("onBeforeSelect", e, instance, date1, date2) === false) return;
10755
10758
  if (this.range) {
10756
- instance.set("from", date1.toISOString());
10757
- instance.set("to", date2.toISOString());
10758
- } else instance.set("value", date1.toISOString());
10759
+ instance.set("from", encode(date1));
10760
+ instance.set("to", encode(date2));
10761
+ } else instance.set("value", encode(date1));
10759
10762
  if (this.onSelect) instance.invoke("onSelect", instance, date1, date2);
10760
10763
  };
10761
10764
  return MonthPicker;
@@ -12071,16 +12074,18 @@ var MonthField = /*#__PURE__*/ (function (_Field) {
12071
12074
  return date;
12072
12075
  };
12073
12076
  _proto.handleSelect = function handleSelect(instance, date1, date2) {
12077
+ var widget = instance.widget;
12078
+ var encode = widget.encoding || Culture.getDefaultDateEncoding();
12074
12079
  instance.setState({
12075
12080
  inputError: false,
12076
12081
  });
12077
12082
  if (this.range) {
12078
- var d1 = date1 ? date1.toISOString() : this.emptyValue;
12079
- var d2 = date2 ? date2.toISOString() : this.emptyValue;
12083
+ var d1 = date1 ? encode(date1) : this.emptyValue;
12084
+ var d2 = date2 ? encode(date2) : this.emptyValue;
12080
12085
  instance.set("from", d1);
12081
12086
  instance.set("to", d2);
12082
12087
  } else {
12083
- var value = date1 ? date1.toISOString() : this.emptyValue;
12088
+ var value = date1 ? encode(date1) : this.emptyValue;
12084
12089
  instance.set("value", value);
12085
12090
  }
12086
12091
  };
@@ -12143,6 +12148,7 @@ var MonthInput = /*#__PURE__*/ (function (_VDOM$Component) {
12143
12148
  ),
12144
12149
  {},
12145
12150
  {
12151
+ encoding: widget.encoding,
12146
12152
  autoFocus: true,
12147
12153
  onFocusOut: function onFocusOut(e) {
12148
12154
  _this2.closeDropdown(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "23.12.2",
3
+ "version": "24.0.0",
4
4
  "description": "Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.",
5
5
  "main": "index.js",
6
6
  "jsnext:main": "src/index.js",
@@ -31,7 +31,6 @@ export class PieLabel extends BoundedObject {
31
31
  super.prepare(context, instance);
32
32
  if (!context.registerPieLabel)
33
33
  throw new Error("PieLabel components are allowed only within PieLabelsContainer components.");
34
- console.log(instance.actualBounds, instance.originalBounds, instance.parentRect);
35
34
  let right = instance.parentRect.r > instance.parentRect.l;
36
35
  context.push("textDirection", right ? "right" : "left");
37
36
  context.registerPieLabel(instance);