@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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/dist/plasmic-rich-components.esm.js +18 -6
- package/dist/plasmic-rich-components.esm.js.map +1 -1
- package/package.json +3 -3
- package/skinny/{common-prop-types-65645309.cjs.js → common-prop-types-20d2bda2.cjs.js} +2 -2
- package/skinny/{common-prop-types-65645309.cjs.js.map → common-prop-types-20d2bda2.cjs.js.map} +1 -1
- package/skinny/{common-prop-types-336da74d.esm.js → common-prop-types-b9d35f8a.esm.js} +2 -2
- package/skinny/{common-prop-types-336da74d.esm.js.map → common-prop-types-b9d35f8a.esm.js.map} +1 -1
- package/skinny/{formatting-8501a0f4.esm.js → formatting-9ccc2a97.esm.js} +19 -7
- package/skinny/formatting-9ccc2a97.esm.js.map +1 -0
- package/skinny/{formatting-bef072c7.cjs.js → formatting-f714c946.cjs.js} +19 -7
- package/skinny/formatting-f714c946.cjs.js.map +1 -0
- package/skinny/rich-calendar/index.cjs.js +2 -2
- package/skinny/rich-calendar/index.esm.js +2 -2
- package/skinny/rich-details/index.cjs.js +1 -1
- package/skinny/rich-details/index.esm.js +1 -1
- package/skinny/rich-list/index.cjs.js +2 -2
- package/skinny/rich-list/index.esm.js +2 -2
- package/skinny/rich-table/index.cjs.js +2 -2
- package/skinny/rich-table/index.esm.js +2 -2
- package/skinny/formatting-8501a0f4.esm.js.map +0 -1
- package/skinny/formatting-bef072c7.cjs.js.map +0 -1
|
@@ -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))
|
|
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(
|
|
645
|
+
return new Intl.NumberFormat(locale, cconfig).format(value);
|
|
640
646
|
} else if (cconfig.dataType === "percent") {
|
|
641
|
-
return new Intl.NumberFormat(
|
|
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(
|
|
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(
|
|
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(
|
|
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);
|