@plasmicpkgs/plasmic-rich-components 1.0.249 → 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.
@@ -582,7 +582,9 @@ function getFieldValue(record, cconfig) {
582
582
  return value;
583
583
  }
584
584
  function getFieldAggregateValue(record, cconfigs, separator = ", ") {
585
- if (!(cconfigs == null ? void 0 : cconfigs.length)) return void 0;
585
+ if (!(cconfigs == null ? void 0 : cconfigs.length)) {
586
+ return void 0;
587
+ }
586
588
  return (cconfigs == null ? void 0 : cconfigs.length) ? cconfigs.map((item) => getFieldValue(record, item)).join(separator) : void 0;
587
589
  }
588
590
  function renderValue(record, cconfig) {
@@ -634,15 +636,19 @@ function tryCoerceAuto(value) {
634
636
  }
635
637
  return CANNOT_COERCE;
636
638
  }
639
+ function safeLocale(locale) {
640
+ return locale && locale.trim() !== "" ? locale : void 0;
641
+ }
637
642
  function renderNumber(value, cconfig) {
643
+ const locale = safeLocale(cconfig.locale);
638
644
  if (cconfig.dataType === "number") {
639
- return new Intl.NumberFormat(cconfig.locale, cconfig).format(value);
645
+ return new Intl.NumberFormat(locale, cconfig).format(value);
640
646
  } else if (cconfig.dataType === "percent") {
641
- return new Intl.NumberFormat(cconfig.locale, __spreadProps$8(__spreadValues$b({}, cconfig), {
647
+ return new Intl.NumberFormat(locale, __spreadProps$8(__spreadValues$b({}, cconfig), {
642
648
  style: "percent"
643
649
  })).format(value);
644
650
  } else if (cconfig.dataType === "currency") {
645
- return new Intl.NumberFormat(cconfig.locale, __spreadProps$8(__spreadValues$b(__spreadValues$b({}, DEFAULT_CURRENCY_SETTINGS), cconfig), {
651
+ return new Intl.NumberFormat(locale, __spreadProps$8(__spreadValues$b(__spreadValues$b({}, DEFAULT_CURRENCY_SETTINGS), cconfig), {
646
652
  style: "currency"
647
653
  })).format(value);
648
654
  } else {
@@ -657,7 +663,10 @@ function renderDate(value, cconfig) {
657
663
  if (opts.timeStyle === "none") {
658
664
  delete opts["timeStyle"];
659
665
  }
660
- return new Intl.DateTimeFormat(cconfig.locale, opts).format(value);
666
+ return new Intl.DateTimeFormat(
667
+ safeLocale(cconfig.locale),
668
+ opts
669
+ ).format(value);
661
670
  }
662
671
  const SECOND_MS = 1e3;
663
672
  const MINUTE_MS = 60 * SECOND_MS;
@@ -676,7 +685,10 @@ function renderRelativeDate(value, cconfig) {
676
685
  var _a;
677
686
  const opts = __spreadValues$b(__spreadValues$b({}, DEFAULT_RELATIVE_DATETIME_SETTINGS), cconfig);
678
687
  const unit = (_a = cconfig.unit) != null ? _a : "day";
679
- const formatter = new Intl.RelativeTimeFormat(cconfig.locale, opts);
688
+ const formatter = new Intl.RelativeTimeFormat(
689
+ safeLocale(cconfig.locale),
690
+ opts
691
+ );
680
692
  if (isOneOf(unit, UNITS_BY_MS)) {
681
693
  const diff = value.getTime() - (/* @__PURE__ */ new Date()).getTime();
682
694
  return formatter.format(Math.round(diff / UNIT_TO_MS[unit]), unit);