@firecms/core 3.5.2-canary.a36570e → 3.5.2
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/{de-CUF9f7S-.js → de-CNfJQcnh.js} +1 -1
- package/dist/{de-CUF9f7S-.js.map → de-CNfJQcnh.js.map} +1 -1
- package/dist/{editor-WZytSO_1.js → editor-D0A5yaaJ.js} +1 -1
- package/dist/{editor-WZytSO_1.js.map → editor-D0A5yaaJ.js.map} +1 -1
- package/dist/{fr-DmkMX6hp.js → fr-CBtSvDVp.js} +1 -1
- package/dist/{fr-DmkMX6hp.js.map → fr-CBtSvDVp.js.map} +1 -1
- package/dist/{hi-BKuaMr7w.js → hi-Delc4l61.js} +1 -1
- package/dist/{hi-BKuaMr7w.js.map → hi-Delc4l61.js.map} +1 -1
- package/dist/index.es.js +32 -12
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +24 -4
- package/dist/index.umd.js.map +1 -1
- package/dist/{it-BwQflFGz.js → it-CdsoaRVO.js} +1 -1
- package/dist/{it-BwQflFGz.js.map → it-CdsoaRVO.js.map} +1 -1
- package/dist/{pl-BPsAvZvc.js → pl-DoTvWcwp.js} +1 -1
- package/dist/{pl-BPsAvZvc.js.map → pl-DoTvWcwp.js.map} +1 -1
- package/dist/preview/components/__tests__/DatePreview.test.d.ts +1 -0
- package/dist/{pt-D5q7OQp1.js → pt-DCfk8Nkq.js} +1 -1
- package/dist/{pt-D5q7OQp1.js.map → pt-DCfk8Nkq.js.map} +1 -1
- package/dist/types/locales.d.ts +1 -1
- package/dist/util/__tests__/locales.test.d.ts +1 -0
- package/dist/util/date_fns_locales.d.ts +13 -0
- package/package.json +3 -3
- package/src/form/field_bindings/BlockFieldBinding.tsx +2 -1
- package/src/preview/components/DatePreview.tsx +14 -2
- package/src/preview/components/__tests__/DatePreview.test.tsx +39 -0
- package/src/types/locales.ts +2 -0
- package/src/util/__tests__/locales.test.ts +46 -0
- package/src/util/date_fns_locales.ts +28 -0
package/dist/index.es.js
CHANGED
|
@@ -4851,6 +4851,16 @@ function useDateFnsLocale(locale) {
|
|
|
4851
4851
|
function _temp$C(count) {
|
|
4852
4852
|
return count + 1;
|
|
4853
4853
|
}
|
|
4854
|
+
const supportedLocales = new Map([...Object.keys(loaders), "en", "fil"].map((locale) => [locale.toLowerCase(), locale]));
|
|
4855
|
+
function resolveLocale(value) {
|
|
4856
|
+
if (typeof value !== "string") return void 0;
|
|
4857
|
+
const parts = value.trim().split(/[-_\s]+/).filter(Boolean);
|
|
4858
|
+
if (parts.length === 0) return void 0;
|
|
4859
|
+
return supportedLocales.get(parts.join("").toLowerCase()) ?? supportedLocales.get(parts[0].toLowerCase());
|
|
4860
|
+
}
|
|
4861
|
+
function localeToLanguageTag(locale) {
|
|
4862
|
+
return locale.replace(/^([a-z]{2,3})([A-Z][A-Za-z]+)$/, "$1-$2");
|
|
4863
|
+
}
|
|
4854
4864
|
const CONTAINER_FULL_WIDTH = "100vw";
|
|
4855
4865
|
const ADDITIONAL_TAB_WIDTH = "55vw";
|
|
4856
4866
|
const FORM_CONTAINER_WIDTH = "768px";
|
|
@@ -7733,6 +7743,13 @@ function ArrayOneOfPreview(t0) {
|
|
|
7733
7743
|
}
|
|
7734
7744
|
return t3;
|
|
7735
7745
|
}
|
|
7746
|
+
function dateTimeFormat(locale, options) {
|
|
7747
|
+
try {
|
|
7748
|
+
return new Intl.DateTimeFormat(locale ? localeToLanguageTag(locale) : "en-US", options);
|
|
7749
|
+
} catch {
|
|
7750
|
+
return new Intl.DateTimeFormat("en-US", options);
|
|
7751
|
+
}
|
|
7752
|
+
}
|
|
7736
7753
|
function DatePreview(t0) {
|
|
7737
7754
|
const $ = c(22);
|
|
7738
7755
|
const {
|
|
@@ -7766,7 +7783,7 @@ function DatePreview(t0) {
|
|
|
7766
7783
|
options.hour = "2-digit";
|
|
7767
7784
|
options.minute = "2-digit";
|
|
7768
7785
|
}
|
|
7769
|
-
const formatter =
|
|
7786
|
+
const formatter = dateTimeFormat(customizationController?.locale, options);
|
|
7770
7787
|
t22 = formatter.format(date);
|
|
7771
7788
|
$[1] = customizationController?.locale;
|
|
7772
7789
|
$[2] = date;
|
|
@@ -15875,10 +15892,11 @@ function BlockFieldBinding({
|
|
|
15875
15892
|
setValue(null);
|
|
15876
15893
|
}, children: /* @__PURE__ */ jsx(CloseIcon, { size: "small" }) })
|
|
15877
15894
|
] });
|
|
15895
|
+
const canAddElements = !property.disabled && !isSubmitting && !disabled && (property.canAddElements ?? true);
|
|
15878
15896
|
const firstOneOfKey = Object.keys(property.oneOf.properties)[0];
|
|
15879
15897
|
const body = /* @__PURE__ */ jsx(ArrayContainer, { value, className: "flex flex-col gap-3", droppableId: propertyKey, addLabel: property.name ? t("add_to_field", {
|
|
15880
15898
|
fieldName: property.name
|
|
15881
|
-
}) : t("add_entry"), buildEntry, onInternalIdAdded: setLastAddedId, disabled: isSubmitting || Boolean(property.disabled), canAddElements
|
|
15899
|
+
}) : t("add_entry"), buildEntry, onInternalIdAdded: setLastAddedId, disabled: isSubmitting || Boolean(property.disabled), canAddElements, onValueChange: (value_0) => setFieldValue(propertyKey, value_0), newDefaultEntry: {
|
|
15882
15900
|
[property.oneOf.typeField ?? DEFAULT_ONE_OF_TYPE]: firstOneOfKey,
|
|
15883
15901
|
[property.oneOf.valueField ?? DEFAULT_ONE_OF_VALUE]: getDefaultValueFor(property.oneOf.properties[firstOneOfKey])
|
|
15884
15902
|
} });
|
|
@@ -16100,7 +16118,7 @@ function CircularProgressCenter(t0) {
|
|
|
16100
16118
|
}
|
|
16101
16119
|
return t3;
|
|
16102
16120
|
}
|
|
16103
|
-
const FireCMSEditor$1 = lazyEager(() => import("./editor-
|
|
16121
|
+
const FireCMSEditor$1 = lazyEager(() => import("./editor-D0A5yaaJ.js"), "FireCMSEditor");
|
|
16104
16122
|
function MarkdownEditorFieldBinding$1({
|
|
16105
16123
|
property,
|
|
16106
16124
|
propertyKey,
|
|
@@ -32655,7 +32673,7 @@ function FireCMS(props) {
|
|
|
32655
32673
|
children,
|
|
32656
32674
|
entityLinkBuilder,
|
|
32657
32675
|
userConfigPersistence,
|
|
32658
|
-
dateTimeFormat,
|
|
32676
|
+
dateTimeFormat: dateTimeFormat2,
|
|
32659
32677
|
locale,
|
|
32660
32678
|
authController,
|
|
32661
32679
|
storageSource,
|
|
@@ -32704,7 +32722,7 @@ function FireCMS(props) {
|
|
|
32704
32722
|
const pluginsLoading = plugins?.some((p_0) => p_0.loading) ?? false;
|
|
32705
32723
|
const loading = authController.initialLoading || navigationController.loading || pluginsLoading;
|
|
32706
32724
|
const customizationController = {
|
|
32707
|
-
dateTimeFormat,
|
|
32725
|
+
dateTimeFormat: dateTimeFormat2,
|
|
32708
32726
|
locale,
|
|
32709
32727
|
entityLinkBuilder,
|
|
32710
32728
|
plugins,
|
|
@@ -35847,12 +35865,12 @@ const es = {
|
|
|
35847
35865
|
};
|
|
35848
35866
|
const FIRECMS_NS = "firecms_core";
|
|
35849
35867
|
const localeLoaders = {
|
|
35850
|
-
de: () => import("./de-
|
|
35851
|
-
fr: () => import("./fr-
|
|
35852
|
-
it: () => import("./it-
|
|
35853
|
-
hi: () => import("./hi-
|
|
35854
|
-
pt: () => import("./pt-
|
|
35855
|
-
pl: () => import("./pl-
|
|
35868
|
+
de: () => import("./de-CNfJQcnh.js").then((m) => m.de),
|
|
35869
|
+
fr: () => import("./fr-CBtSvDVp.js").then((m) => m.fr),
|
|
35870
|
+
it: () => import("./it-CdsoaRVO.js").then((m) => m.it),
|
|
35871
|
+
hi: () => import("./hi-Delc4l61.js").then((m) => m.hi),
|
|
35872
|
+
pt: () => import("./pt-DCfk8Nkq.js").then((m) => m.pt),
|
|
35873
|
+
pl: () => import("./pl-DoTvWcwp.js").then((m) => m.pl)
|
|
35856
35874
|
};
|
|
35857
35875
|
const loadedLocales = {
|
|
35858
35876
|
en,
|
|
@@ -36021,7 +36039,7 @@ function buildResources(translations) {
|
|
|
36021
36039
|
}
|
|
36022
36040
|
return resources;
|
|
36023
36041
|
}
|
|
36024
|
-
const LazyFireCMSEditor = React__default.lazy(() => import("./editor-
|
|
36042
|
+
const LazyFireCMSEditor = React__default.lazy(() => import("./editor-D0A5yaaJ.js").then((module) => ({
|
|
36025
36043
|
default: module.FireCMSEditor
|
|
36026
36044
|
})));
|
|
36027
36045
|
function FireCMSEditor(props) {
|
|
@@ -36272,6 +36290,7 @@ export {
|
|
|
36272
36290
|
jsonStringifyReplacer,
|
|
36273
36291
|
lazyEager,
|
|
36274
36292
|
loadDateFnsLocale,
|
|
36293
|
+
localeToLanguageTag,
|
|
36275
36294
|
makePropertiesEditable,
|
|
36276
36295
|
mergeCallbacks,
|
|
36277
36296
|
mergeCollection,
|
|
@@ -36309,6 +36328,7 @@ export {
|
|
|
36309
36328
|
resolveEntityAction,
|
|
36310
36329
|
resolveEntityView,
|
|
36311
36330
|
resolveEnumValues,
|
|
36331
|
+
resolveLocale,
|
|
36312
36332
|
resolveNavigationFrom,
|
|
36313
36333
|
resolvePermissions,
|
|
36314
36334
|
resolveProperties,
|