@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/.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 +2 -2
- 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
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))
|
|
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(
|
|
659
|
+
return new Intl.NumberFormat(locale, cconfig).format(value);
|
|
654
660
|
} else if (cconfig.dataType === "percent") {
|
|
655
|
-
return new Intl.NumberFormat(
|
|
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(
|
|
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(
|
|
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(
|
|
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);
|