@plasmicpkgs/plasmic-rich-components 1.0.250 → 1.0.251

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/index.js CHANGED
@@ -596,7 +596,9 @@ function getFieldValue(record, cconfig) {
596
596
  return value;
597
597
  }
598
598
  function getFieldAggregateValue(record, cconfigs, separator = ", ") {
599
- if (!(cconfigs == null ? void 0 : cconfigs.length)) return void 0;
599
+ if (!(cconfigs == null ? void 0 : cconfigs.length)) {
600
+ return void 0;
601
+ }
600
602
  return (cconfigs == null ? void 0 : cconfigs.length) ? cconfigs.map((item) => getFieldValue(record, item)).join(separator) : void 0;
601
603
  }
602
604
  function renderValue(record, cconfig) {
@@ -648,15 +650,19 @@ function tryCoerceAuto(value) {
648
650
  }
649
651
  return CANNOT_COERCE;
650
652
  }
653
+ function safeLocale(locale) {
654
+ return locale && locale.trim() !== "" ? locale : void 0;
655
+ }
651
656
  function renderNumber(value, cconfig) {
657
+ const locale = safeLocale(cconfig.locale);
652
658
  if (cconfig.dataType === "number") {
653
- return new Intl.NumberFormat(cconfig.locale, cconfig).format(value);
659
+ return new Intl.NumberFormat(locale, cconfig).format(value);
654
660
  } else if (cconfig.dataType === "percent") {
655
- return new Intl.NumberFormat(cconfig.locale, __spreadProps$8(__spreadValues$b({}, cconfig), {
661
+ return new Intl.NumberFormat(locale, __spreadProps$8(__spreadValues$b({}, cconfig), {
656
662
  style: "percent"
657
663
  })).format(value);
658
664
  } else if (cconfig.dataType === "currency") {
659
- return new Intl.NumberFormat(cconfig.locale, __spreadProps$8(__spreadValues$b(__spreadValues$b({}, DEFAULT_CURRENCY_SETTINGS), cconfig), {
665
+ return new Intl.NumberFormat(locale, __spreadProps$8(__spreadValues$b(__spreadValues$b({}, DEFAULT_CURRENCY_SETTINGS), cconfig), {
660
666
  style: "currency"
661
667
  })).format(value);
662
668
  } else {
@@ -671,7 +677,10 @@ function renderDate(value, cconfig) {
671
677
  if (opts.timeStyle === "none") {
672
678
  delete opts["timeStyle"];
673
679
  }
674
- return new Intl.DateTimeFormat(cconfig.locale, opts).format(value);
680
+ return new Intl.DateTimeFormat(
681
+ safeLocale(cconfig.locale),
682
+ opts
683
+ ).format(value);
675
684
  }
676
685
  const SECOND_MS = 1e3;
677
686
  const MINUTE_MS = 60 * SECOND_MS;
@@ -690,7 +699,10 @@ function renderRelativeDate(value, cconfig) {
690
699
  var _a;
691
700
  const opts = __spreadValues$b(__spreadValues$b({}, DEFAULT_RELATIVE_DATETIME_SETTINGS), cconfig);
692
701
  const unit = (_a = cconfig.unit) != null ? _a : "day";
693
- const formatter = new Intl.RelativeTimeFormat(cconfig.locale, opts);
702
+ const formatter = new Intl.RelativeTimeFormat(
703
+ safeLocale(cconfig.locale),
704
+ opts
705
+ );
694
706
  if (isOneOf(unit, UNITS_BY_MS)) {
695
707
  const diff = value.getTime() - (/* @__PURE__ */ new Date()).getTime();
696
708
  return formatter.format(Math.round(diff / UNIT_TO_MS[unit]), unit);