@questpie/admin 3.2.0 → 3.2.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/client/blocks/block-renderer.d.mts +12 -2
- package/dist/client/blocks/block-renderer.mjs +357 -49
- package/dist/client/components/blocks/block-editor-context.mjs +11 -1
- package/dist/client/components/blocks/block-editor-provider.mjs +68 -26
- package/dist/client/components/blocks/block-item.mjs +181 -170
- package/dist/client/components/blocks/utils/tree-utils.mjs +13 -1
- package/dist/client/components/fields/array-field.mjs +177 -118
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +305 -310
- package/dist/client/components/filter-builder/filters-tab.mjs +1 -1
- package/dist/client/components/history-sidebar.mjs +121 -114
- package/dist/client/components/preview/live-preview-mode.mjs +210 -175
- package/dist/client/components/preview/preview-pane.mjs +288 -333
- package/dist/client/components/primitives/option-label.mjs +44 -0
- package/dist/client/components/primitives/select-multi.mjs +408 -383
- package/dist/client/components/primitives/select-single.mjs +387 -357
- package/dist/client/components/widgets/chart-widget.mjs +168 -143
- package/dist/client/contexts/focus-context.d.mts +16 -1
- package/dist/client/contexts/focus-context.mjs +90 -38
- package/dist/client/hooks/use-brand.mjs +2 -1
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/block-scope-context.mjs +10 -20
- package/dist/client/preview/index.d.mts +1 -1
- package/dist/client/preview/patch.mjs +100 -0
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-field.d.mts +34 -5
- package/dist/client/preview/preview-field.mjs +385 -118
- package/dist/client/preview/types.d.mts +82 -3
- package/dist/client/preview/types.mjs +85 -6
- package/dist/client/preview/use-collection-preview.d.mts +19 -1
- package/dist/client/preview/use-collection-preview.mjs +182 -58
- package/dist/client/runtime/index.d.mts +2 -2
- package/dist/client/runtime/index.mjs +2 -2
- package/dist/client/runtime/provider.d.mts +5 -5
- package/dist/client/utils/build-field-definitions-from-schema.mjs +8 -3
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/collection/bulk-action-toolbar.mjs +23 -25
- package/dist/client/views/collection/cells/primitive-cells.mjs +63 -13
- package/dist/client/views/collection/columns/build-columns.mjs +1 -0
- package/dist/client/views/collection/form-view.mjs +262 -33
- package/dist/client/views/collection/table-view.mjs +16 -11
- package/dist/client/views/layout/admin-layout-provider.d.mts +5 -5
- package/dist/client/views/layout/admin-layout-provider.mjs +107 -16
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client.d.mts +2 -2
- package/dist/client.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/server/augmentation/common.d.mts +8 -4
- package/dist/server/augmentation/form-layout.d.mts +1 -1
- package/dist/server/i18n/messages/cs.mjs +11 -0
- package/dist/server/i18n/messages/de.mjs +11 -0
- package/dist/server/i18n/messages/en.mjs +11 -0
- package/dist/server/i18n/messages/es.mjs +11 -0
- package/dist/server/i18n/messages/fr.mjs +11 -0
- package/dist/server/i18n/messages/pl.mjs +11 -0
- package/dist/server/i18n/messages/pt.mjs +11 -0
- package/dist/server/i18n/messages/sk.mjs +11 -0
- package/dist/server/modules/admin/block/block-builder.d.mts +7 -10
- package/dist/server/modules/admin/block/block-builder.mjs +7 -10
- package/dist/server/modules/admin/collections/apikey.d.mts +64 -64
- package/dist/server/modules/admin/collections/assets.d.mts +57 -20
- package/dist/server/modules/admin/collections/session.d.mts +38 -38
- package/dist/server/modules/admin/collections/user.d.mts +100 -34
- package/dist/server/modules/admin/collections/user.mjs +4 -4
- package/dist/server/modules/admin/collections/verification.d.mts +31 -31
- package/dist/server/modules/admin/index.d.mts +3 -3
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/admin-config.mjs +9 -12
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/translations.mjs +1 -1
- package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +4 -6
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +4 -6
- package/dist/server/modules/admin-preferences/collections/saved-views.mjs +4 -6
- package/package.json +3 -3
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { formatLabel } from "../../lib/utils.mjs";
|
|
2
|
+
import { flattenOptions } from "./types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/client/components/primitives/option-label.ts
|
|
5
|
+
function normalizeLabel(value) {
|
|
6
|
+
return value.trim().toLowerCase().replace(/\s+/g, "");
|
|
7
|
+
}
|
|
8
|
+
function labelLooksDerivedFromValue(label, value) {
|
|
9
|
+
const rawValue = String(value);
|
|
10
|
+
const normalizedLabel = normalizeLabel(label);
|
|
11
|
+
return normalizedLabel === normalizeLabel(rawValue) || normalizedLabel === normalizeLabel(formatLabel(rawValue));
|
|
12
|
+
}
|
|
13
|
+
function hasLocaleLabel(label, locale) {
|
|
14
|
+
if (!label || typeof label !== "object" || "key" in label) return false;
|
|
15
|
+
if (typeof label[locale] === "string") return true;
|
|
16
|
+
const language = locale.split("-")[0];
|
|
17
|
+
return !!language && typeof label[language] === "string";
|
|
18
|
+
}
|
|
19
|
+
function getStatusTranslation(value, t) {
|
|
20
|
+
const key = `status.${String(value)}`;
|
|
21
|
+
const translated = t(key);
|
|
22
|
+
return translated === key ? void 0 : translated;
|
|
23
|
+
}
|
|
24
|
+
function resolveOptionLabel({ value, label, resolveText, t, locale, fallback = String(value) }) {
|
|
25
|
+
const statusTranslation = getStatusTranslation(value, t);
|
|
26
|
+
if (!label) return statusTranslation ?? fallback;
|
|
27
|
+
if (statusTranslation && typeof label === "object" && !("key" in label) && !hasLocaleLabel(label, locale)) return statusTranslation;
|
|
28
|
+
if (statusTranslation && typeof label === "string" && labelLooksDerivedFromValue(label, value)) return statusTranslation;
|
|
29
|
+
return resolveText(label, statusTranslation ?? fallback);
|
|
30
|
+
}
|
|
31
|
+
function resolveOptionLabelForValue({ value, options, resolveText, t, locale, fallback = String(value) }) {
|
|
32
|
+
if (!Array.isArray(options)) return getStatusTranslation(value, t) ?? fallback;
|
|
33
|
+
return resolveOptionLabel({
|
|
34
|
+
value,
|
|
35
|
+
label: flattenOptions(options).find((item) => String(item.value) === String(value))?.label,
|
|
36
|
+
resolveText,
|
|
37
|
+
t,
|
|
38
|
+
locale,
|
|
39
|
+
fallback
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { resolveOptionLabel, resolveOptionLabelForValue };
|