@questpie/admin 3.0.3 → 3.0.4
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/README.md +34 -5
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +4 -1
- package/dist/client/builder/types/action-types.d.mts +31 -3
- package/dist/client/builder/types/collection-types.d.mts +140 -0
- package/dist/client/builder/types/ui-config.d.mts +16 -2
- package/dist/client/builder/types/views.d.mts +57 -0
- package/dist/client/builder/types/widget-types.d.mts +5 -0
- package/dist/client/components/actions/action-button.mjs +137 -199
- package/dist/client/components/actions/action-dialog.mjs +198 -156
- package/dist/client/components/actions/confirmation-dialog.mjs +2 -2
- package/dist/client/components/actions/header-actions.mjs +52 -53
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/auth/auth-loading.mjs +41 -18
- package/dist/client/components/blocks/block-fields-renderer.mjs +64 -28
- package/dist/client/components/blocks/block-insert-button.mjs +4 -4
- package/dist/client/components/blocks/block-item.mjs +2 -2
- package/dist/client/components/blocks/block-library-sidebar.mjs +2 -2
- package/dist/client/components/component-renderer.mjs +1 -1
- package/dist/client/components/fields/array-field.mjs +14 -14
- package/dist/client/components/fields/asset-preview-field.mjs +1 -1
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +84 -104
- package/dist/client/components/fields/json-field.mjs +2 -2
- package/dist/client/components/fields/object-array-field.mjs +22 -22
- package/dist/client/components/fields/object-field.mjs +5 -5
- package/dist/client/components/fields/relation/displays/cards-display.mjs +16 -9
- package/dist/client/components/fields/relation/displays/chips-display.mjs +15 -12
- package/dist/client/components/fields/relation/displays/grid-display.mjs +15 -11
- package/dist/client/components/fields/relation/displays/list-display.mjs +33 -20
- package/dist/client/components/fields/relation/displays/table-display.mjs +62 -93
- package/dist/client/components/fields/relation/relation-items-display.mjs +1 -1
- package/dist/client/components/fields/relation-picker.mjs +7 -6
- package/dist/client/components/fields/relation-select.mjs +71 -47
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +392 -82
- package/dist/client/components/fields/rich-text-editor/extensions.mjs +54 -23
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +24 -50
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +66 -0
- package/dist/client/components/fields/rich-text-editor/index.d.mts +38 -0
- package/dist/client/components/fields/rich-text-editor/index.mjs +637 -376
- package/dist/client/components/fields/rich-text-editor/link-utils.mjs +26 -0
- package/dist/client/components/fields/rich-text-editor/presets.d.mts +10 -0
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +27 -6
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +464 -346
- package/dist/client/components/fields/rich-text-editor/types.d.mts +77 -0
- package/dist/client/components/fields/upload-field.mjs +45 -49
- package/dist/client/components/filter-builder/columns-tab.mjs +69 -62
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +473 -308
- package/dist/client/components/filter-builder/filters-tab.mjs +109 -82
- package/dist/client/components/filter-builder/saved-views-tab.mjs +300 -198
- package/dist/client/components/history-sidebar.mjs +850 -340
- package/dist/client/components/layout/field-layout-renderer.mjs +6 -5
- package/dist/client/components/locale-switcher.mjs +8 -8
- package/dist/client/components/media/media-grid.mjs +12 -9
- package/dist/client/components/media/media-picker-dialog.mjs +242 -230
- package/dist/client/components/preview/live-preview-mode.mjs +1 -1
- package/dist/client/components/primitives/asset-preview.mjs +37 -22
- package/dist/client/components/primitives/date-input.mjs +212 -249
- package/dist/client/components/primitives/dropzone.mjs +192 -159
- package/dist/client/components/primitives/field-select-control.mjs +93 -0
- package/dist/client/components/primitives/select-multi.mjs +251 -230
- package/dist/client/components/primitives/select-single.mjs +345 -290
- package/dist/client/components/primitives/time-input.mjs +2 -2
- package/dist/client/components/sheets/resource-sheet.mjs +2 -0
- package/dist/client/components/ui/accordion.mjs +4 -4
- package/dist/client/components/ui/alert.mjs +3 -3
- package/dist/client/components/ui/badge.mjs +4 -4
- package/dist/client/components/ui/button.mjs +47 -37
- package/dist/client/components/ui/card.mjs +2 -2
- package/dist/client/components/ui/checkbox.mjs +1 -1
- package/dist/client/components/ui/command.mjs +5 -5
- package/dist/client/components/ui/dialog.mjs +3 -3
- package/dist/client/components/ui/drawer.mjs +1 -1
- package/dist/client/components/ui/dropdown-menu.mjs +157 -15
- package/dist/client/components/ui/empty-state.mjs +88 -59
- package/dist/client/components/ui/field.mjs +2 -2
- package/dist/client/components/ui/input-group.mjs +3 -3
- package/dist/client/components/ui/input.mjs +1 -1
- package/dist/client/components/ui/kbd.mjs +1 -1
- package/dist/client/components/ui/label.mjs +1 -1
- package/dist/client/components/ui/popover.mjs +19 -11
- package/dist/client/components/ui/scroll-fade.mjs +170 -0
- package/dist/client/components/ui/search-input.mjs +1 -1
- package/dist/client/components/ui/select.mjs +129 -27
- package/dist/client/components/ui/sheet.mjs +54 -34
- package/dist/client/components/ui/sidebar.mjs +15 -14
- package/dist/client/components/ui/skeleton.mjs +28 -12
- package/dist/client/components/ui/switch.mjs +2 -2
- package/dist/client/components/ui/table.mjs +82 -74
- package/dist/client/components/ui/tabs.mjs +26 -31
- package/dist/client/components/ui/textarea.mjs +1 -1
- package/dist/client/components/ui/tooltip.mjs +1 -1
- package/dist/client/components/widgets/chart-widget.mjs +134 -96
- package/dist/client/components/widgets/progress-widget.mjs +59 -34
- package/dist/client/components/widgets/quick-actions-widget.mjs +184 -113
- package/dist/client/components/widgets/recent-items-widget.mjs +144 -102
- package/dist/client/components/widgets/stats-widget.mjs +91 -72
- package/dist/client/components/widgets/table-widget.mjs +159 -246
- package/dist/client/components/widgets/timeline-widget.mjs +66 -43
- package/dist/client/components/widgets/value-widget.mjs +261 -152
- package/dist/client/components/widgets/widget-empty-state.mjs +88 -0
- package/dist/client/components/widgets/widget-skeletons.mjs +53 -20
- package/dist/client/contexts/focus-context.d.mts +2 -2
- package/dist/client/hooks/use-action.mjs +63 -55
- package/dist/client/hooks/use-audit-history.mjs +1 -65
- package/dist/client/hooks/use-collection-validation.mjs +36 -23
- package/dist/client/hooks/use-collection.mjs +96 -1
- package/dist/client/hooks/use-saved-views.mjs +70 -49
- package/dist/client/hooks/use-server-actions.mjs +59 -40
- package/dist/client/hooks/use-server-validation.mjs +156 -41
- package/dist/client/hooks/use-server-widget-data.mjs +1 -1
- package/dist/client/hooks/use-setup-status.d.mts +3 -3
- package/dist/client/hooks/use-setup-status.mjs +2 -2
- package/dist/client/hooks/use-transition-stage.mjs +2 -10
- package/dist/client/hooks/use-validation-error-map.mjs +31 -13
- package/dist/client/hooks/use-view-state.mjs +238 -174
- package/dist/client/i18n/date-locale.mjs +33 -0
- package/dist/client/i18n/hooks.mjs +17 -1
- package/dist/client/lib/utils.mjs +3 -2
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +2 -2
- package/dist/client/runtime/provider.mjs +8 -1
- package/dist/client/runtime/translations-provider.mjs +1 -1
- package/dist/client/scope/picker.d.mts +2 -2
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/styles/base.css +1022 -0
- package/dist/client/styles/index.css +3 -589
- package/dist/client/utils/auto-expand-fields.mjs +4 -2
- package/dist/client/utils/keyboard-shortcuts.mjs +26 -0
- package/dist/client/utils/use-lazy-component.mjs +80 -0
- package/dist/client/views/auth/auth-layout.d.mts +18 -11
- package/dist/client/views/auth/auth-layout.mjs +291 -80
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/forgot-password-form.mjs +2 -2
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +1 -1
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.mjs +2 -2
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/collection/auto-form-fields.mjs +11 -9
- package/dist/client/views/collection/bulk-action-toolbar.mjs +173 -138
- package/dist/client/views/collection/cells/complex-cells.mjs +22 -22
- package/dist/client/views/collection/cells/primitive-cells.mjs +1 -1
- package/dist/client/views/collection/cells/relation-cells.mjs +147 -129
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +224 -278
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +64 -36
- package/dist/client/views/collection/cells/upload-cells.mjs +199 -9
- package/dist/client/views/collection/columns/build-columns.mjs +29 -9
- package/dist/client/views/collection/columns/column-defaults.mjs +2 -2
- package/dist/client/views/collection/field-renderer.mjs +50 -89
- package/dist/client/views/collection/form-view.mjs +237 -227
- package/dist/client/views/collection/table-view.mjs +1162 -229
- package/dist/client/views/collection/view-skeletons.mjs +222 -79
- package/dist/client/views/common/global-search.mjs +29 -18
- package/dist/client/views/dashboard/dashboard-grid.mjs +678 -501
- package/dist/client/views/dashboard/dashboard-widget.mjs +6 -3
- package/dist/client/views/dashboard/widget-card.mjs +23 -14
- package/dist/client/views/globals/global-form-view.mjs +634 -589
- package/dist/client/views/layout/admin-layout-provider.mjs +67 -70
- package/dist/client/views/layout/admin-layout.d.mts +3 -6
- package/dist/client/views/layout/admin-layout.mjs +149 -172
- package/dist/client/views/layout/admin-router.mjs +747 -544
- package/dist/client/views/layout/admin-sidebar.d.mts +38 -1
- package/dist/client/views/layout/admin-sidebar.mjs +751 -591
- package/dist/client/views/layout/admin-theme.d.mts +10 -0
- package/dist/client/views/layout/admin-theme.mjs +84 -0
- package/dist/client/views/layout/admin-view-layout.mjs +161 -0
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/accept-invite-page.mjs +49 -26
- 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/forgot-password-page.mjs +2 -19
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.mjs +2 -19
- package/dist/client/views/pages/login-page.d.mts +1 -1
- package/dist/client/views/pages/login-page.mjs +4 -21
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.mjs +3 -20
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.mjs +3 -20
- package/dist/client.d.mts +6 -2
- package/dist/client.mjs +2 -1
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/index.d.mts +6 -2
- package/dist/index.mjs +2 -1
- package/dist/server/augmentation/dashboard.d.mts +67 -3
- package/dist/server/augmentation/form-layout.d.mts +21 -0
- package/dist/server/augmentation/index.d.mts +1 -1
- package/dist/server/codegen/admin-client-template.mjs +4 -0
- package/dist/server/fields/blocks.d.mts +1 -1
- package/dist/server/fields/blocks.mjs +12 -0
- package/dist/server/fields/rich-text.d.mts +1 -1
- package/dist/server/fields/rich-text.mjs +8 -0
- package/dist/server/i18n/index.mjs +17 -1
- package/dist/server/i18n/messages/cs.mjs +23 -0
- package/dist/server/i18n/messages/de.mjs +23 -0
- package/dist/server/i18n/messages/en.mjs +64 -1
- package/dist/server/i18n/messages/es.mjs +23 -0
- package/dist/server/i18n/messages/fr.mjs +23 -0
- package/dist/server/i18n/messages/pl.mjs +23 -0
- package/dist/server/i18n/messages/pt.mjs +23 -0
- package/dist/server/i18n/messages/sk.mjs +83 -1
- package/dist/server/modules/admin/block/introspection.mjs +4 -1
- package/dist/server/modules/admin/block/prefetch.mjs +12 -2
- package/dist/server/modules/admin/collections/account.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
- package/dist/server/modules/admin/collections/assets.d.mts +20 -20
- package/dist/server/modules/admin/collections/assets.mjs +0 -1
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +12 -0
- package/dist/server/modules/admin/collections/user.mjs +40 -9
- package/dist/server/modules/admin/collections/verification.d.mts +2 -2
- package/dist/server/modules/admin/dto/admin-config.dto.mjs +2 -0
- package/dist/server/modules/admin/factories.mjs +7 -18
- package/dist/server/modules/admin/index.d.mts +1 -1
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/admin-config.mjs +34 -16
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/execute-action.mjs +33 -0
- 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/setup.d.mts +10 -10
- package/dist/server/modules/admin/routes/setup.mjs +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/translations.mjs +5 -1
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/admin-preferences.mjs +1 -1
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
- package/dist/server/modules/audit/.generated/module.d.mts +1 -1
- package/dist/server/modules/audit/.generated/module.mjs +1 -1
- package/dist/server/modules/audit/collections/audit-log.d.mts +2 -2
- package/dist/server/modules/audit/collections/audit-log.mjs +1 -1
- package/dist/server/modules/audit/config/app.mjs +99 -42
- package/dist/server/modules/audit/jobs/audit-cleanup.mjs +1 -1
- package/dist/server/plugin.mjs +4 -2
- package/dist/server/proxy-factories.d.mts +4 -3
- package/dist/server/proxy-factories.mjs +34 -8
- package/dist/shared/types/saved-views.types.d.mts +2 -0
- package/package.json +6 -4
- package/dist/client/components/fields/rich-text-editor/link-popover.mjs +0 -85
- package/dist/client/components/ui/spinner.mjs +0 -52
- package/dist/client/components/ui/toolbar.mjs +0 -136
- package/dist/client/contexts/breadcrumb-context.mjs +0 -60
- package/dist/client/views/layout/admin-topbar.mjs +0 -236
|
@@ -9,39 +9,49 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
|
9
9
|
* Note: This hook requires the `adminModule` to be used in your app setup.
|
|
10
10
|
* If admin_saved_views collection is not available, returns empty array.
|
|
11
11
|
*/
|
|
12
|
-
function useSavedViews(collectionName) {
|
|
13
|
-
const $ = c(
|
|
12
|
+
function useSavedViews(collectionName, userId) {
|
|
13
|
+
const $ = c(11);
|
|
14
14
|
const client = useAdminStore(_temp);
|
|
15
15
|
let t0;
|
|
16
|
-
if ($[0] !== collectionName) {
|
|
17
|
-
t0 = [
|
|
16
|
+
if ($[0] !== collectionName || $[1] !== userId) {
|
|
17
|
+
t0 = [
|
|
18
|
+
"admin_saved_views",
|
|
19
|
+
collectionName,
|
|
20
|
+
userId
|
|
21
|
+
];
|
|
18
22
|
$[0] = collectionName;
|
|
19
|
-
$[1] =
|
|
20
|
-
|
|
23
|
+
$[1] = userId;
|
|
24
|
+
$[2] = t0;
|
|
25
|
+
} else t0 = $[2];
|
|
21
26
|
let t1;
|
|
22
|
-
if ($[
|
|
27
|
+
if ($[3] !== client?.collections || $[4] !== collectionName || $[5] !== userId) {
|
|
23
28
|
t1 = async () => {
|
|
24
29
|
const collections = client?.collections;
|
|
25
30
|
if (!collections?.admin_saved_views) return { docs: [] };
|
|
26
|
-
|
|
31
|
+
const where = userId ? {
|
|
32
|
+
collectionName,
|
|
33
|
+
userId
|
|
34
|
+
} : { collectionName };
|
|
35
|
+
return { docs: (await collections.admin_saved_views.find({ where }))?.docs ?? [] };
|
|
27
36
|
};
|
|
28
|
-
$[
|
|
29
|
-
$[
|
|
30
|
-
$[
|
|
31
|
-
|
|
37
|
+
$[3] = client?.collections;
|
|
38
|
+
$[4] = collectionName;
|
|
39
|
+
$[5] = userId;
|
|
40
|
+
$[6] = t1;
|
|
41
|
+
} else t1 = $[6];
|
|
32
42
|
const t2 = !!client;
|
|
33
43
|
let t3;
|
|
34
|
-
if ($[
|
|
44
|
+
if ($[7] !== t0 || $[8] !== t1 || $[9] !== t2) {
|
|
35
45
|
t3 = {
|
|
36
46
|
queryKey: t0,
|
|
37
47
|
queryFn: t1,
|
|
38
48
|
enabled: t2
|
|
39
49
|
};
|
|
40
|
-
$[
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
44
|
-
} else t3 = $[
|
|
50
|
+
$[7] = t0;
|
|
51
|
+
$[8] = t1;
|
|
52
|
+
$[9] = t2;
|
|
53
|
+
$[10] = t3;
|
|
54
|
+
} else t3 = $[10];
|
|
45
55
|
return useQuery(t3);
|
|
46
56
|
}
|
|
47
57
|
/**
|
|
@@ -50,56 +60,62 @@ function useSavedViews(collectionName) {
|
|
|
50
60
|
function _temp(s) {
|
|
51
61
|
return s.client;
|
|
52
62
|
}
|
|
53
|
-
function useSaveView(collectionName) {
|
|
54
|
-
const $ = c(
|
|
63
|
+
function useSaveView(collectionName, userId) {
|
|
64
|
+
const $ = c(11);
|
|
55
65
|
const client = useAdminStore(_temp2);
|
|
56
66
|
const queryClient = useQueryClient();
|
|
57
67
|
let t0;
|
|
58
|
-
if ($[0] !== client?.collections || $[1] !== collectionName) {
|
|
68
|
+
if ($[0] !== client?.collections || $[1] !== collectionName || $[2] !== userId) {
|
|
59
69
|
t0 = async (data) => {
|
|
60
70
|
const collections = client?.collections;
|
|
61
71
|
if (!collections?.admin_saved_views) throw new Error("admin_saved_views collection not available. Make sure to use the adminModule in your app setup.");
|
|
62
72
|
return collections.admin_saved_views.create({
|
|
63
73
|
...data,
|
|
64
74
|
collectionName,
|
|
65
|
-
userId: data.userId || "anonymous",
|
|
75
|
+
userId: data.userId || userId || "anonymous",
|
|
66
76
|
isDefault: false
|
|
67
77
|
});
|
|
68
78
|
};
|
|
69
79
|
$[0] = client?.collections;
|
|
70
80
|
$[1] = collectionName;
|
|
71
|
-
$[2] =
|
|
72
|
-
|
|
81
|
+
$[2] = userId;
|
|
82
|
+
$[3] = t0;
|
|
83
|
+
} else t0 = $[3];
|
|
73
84
|
let t1;
|
|
74
|
-
if ($[
|
|
85
|
+
if ($[4] !== collectionName || $[5] !== queryClient || $[6] !== userId) {
|
|
75
86
|
t1 = () => {
|
|
76
|
-
queryClient.invalidateQueries({ queryKey: [
|
|
87
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
88
|
+
"admin_saved_views",
|
|
89
|
+
collectionName,
|
|
90
|
+
userId
|
|
91
|
+
] });
|
|
77
92
|
};
|
|
78
|
-
$[
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
|
|
93
|
+
$[4] = collectionName;
|
|
94
|
+
$[5] = queryClient;
|
|
95
|
+
$[6] = userId;
|
|
96
|
+
$[7] = t1;
|
|
97
|
+
} else t1 = $[7];
|
|
82
98
|
let t2;
|
|
83
|
-
if ($[
|
|
99
|
+
if ($[8] !== t0 || $[9] !== t1) {
|
|
84
100
|
t2 = {
|
|
85
101
|
mutationFn: t0,
|
|
86
102
|
onSuccess: t1
|
|
87
103
|
};
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
} else t2 = $[
|
|
104
|
+
$[8] = t0;
|
|
105
|
+
$[9] = t1;
|
|
106
|
+
$[10] = t2;
|
|
107
|
+
} else t2 = $[10];
|
|
92
108
|
return useMutation(t2);
|
|
93
109
|
}
|
|
94
110
|
/**
|
|
95
|
-
* Hook to
|
|
111
|
+
* Hook to delete a view
|
|
96
112
|
*/
|
|
97
113
|
function _temp2(s) {
|
|
98
114
|
return s.client;
|
|
99
115
|
}
|
|
100
|
-
function useDeleteSavedView(collectionName) {
|
|
101
|
-
const $ = c(
|
|
102
|
-
const client = useAdminStore(
|
|
116
|
+
function useDeleteSavedView(collectionName, userId) {
|
|
117
|
+
const $ = c(9);
|
|
118
|
+
const client = useAdminStore(_temp3);
|
|
103
119
|
const queryClient = useQueryClient();
|
|
104
120
|
let t0;
|
|
105
121
|
if ($[0] !== client?.collections) {
|
|
@@ -112,27 +128,32 @@ function useDeleteSavedView(collectionName) {
|
|
|
112
128
|
$[1] = t0;
|
|
113
129
|
} else t0 = $[1];
|
|
114
130
|
let t1;
|
|
115
|
-
if ($[2] !== collectionName || $[3] !== queryClient) {
|
|
131
|
+
if ($[2] !== collectionName || $[3] !== queryClient || $[4] !== userId) {
|
|
116
132
|
t1 = () => {
|
|
117
|
-
queryClient.invalidateQueries({ queryKey: [
|
|
133
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
134
|
+
"admin_saved_views",
|
|
135
|
+
collectionName,
|
|
136
|
+
userId
|
|
137
|
+
] });
|
|
118
138
|
};
|
|
119
139
|
$[2] = collectionName;
|
|
120
140
|
$[3] = queryClient;
|
|
121
|
-
$[4] =
|
|
122
|
-
|
|
141
|
+
$[4] = userId;
|
|
142
|
+
$[5] = t1;
|
|
143
|
+
} else t1 = $[5];
|
|
123
144
|
let t2;
|
|
124
|
-
if ($[
|
|
145
|
+
if ($[6] !== t0 || $[7] !== t1) {
|
|
125
146
|
t2 = {
|
|
126
147
|
mutationFn: t0,
|
|
127
148
|
onSuccess: t1
|
|
128
149
|
};
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
} else t2 = $[
|
|
150
|
+
$[6] = t0;
|
|
151
|
+
$[7] = t1;
|
|
152
|
+
$[8] = t2;
|
|
153
|
+
} else t2 = $[8];
|
|
133
154
|
return useMutation(t2);
|
|
134
155
|
}
|
|
135
|
-
function
|
|
156
|
+
function _temp3(s) {
|
|
136
157
|
return s.client;
|
|
137
158
|
}
|
|
138
159
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { selectAdmin, selectClient, useAdminStore } from "../runtime/provider.mjs";
|
|
4
|
+
import { configureField } from "../builder/field/field.mjs";
|
|
4
5
|
import { useCollectionSchema } from "./use-collection-schema.mjs";
|
|
5
6
|
import { c } from "react/compiler-runtime";
|
|
6
7
|
|
|
@@ -28,21 +29,25 @@ function buildServerFormFields(rawFields, fieldRegistry) {
|
|
|
28
29
|
if (!rawFields || !fieldRegistry) return {};
|
|
29
30
|
const result = {};
|
|
30
31
|
for (const [fieldName, fieldConfig] of Object.entries(rawFields)) {
|
|
31
|
-
|
|
32
|
-
if (
|
|
32
|
+
if (!fieldConfig || typeof fieldConfig !== "object") continue;
|
|
33
|
+
if ("name" in fieldConfig && "component" in fieldConfig && "~options" in fieldConfig) {
|
|
33
34
|
result[fieldName] = fieldConfig;
|
|
34
35
|
continue;
|
|
35
36
|
}
|
|
37
|
+
const fc = fieldConfig;
|
|
36
38
|
const fieldBuilder = fieldRegistry[typeof fc.type === "string" && fc.type.length > 0 ? fc.type : "text"] ?? fieldRegistry.text ?? null;
|
|
37
|
-
if (!fieldBuilder
|
|
38
|
-
const options = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (fc.
|
|
45
|
-
|
|
39
|
+
if (!fieldBuilder) continue;
|
|
40
|
+
const options = { ...fc };
|
|
41
|
+
delete options.type;
|
|
42
|
+
delete options.options;
|
|
43
|
+
delete options.admin;
|
|
44
|
+
delete options.default;
|
|
45
|
+
if (fc.default !== void 0) options.defaultValue = fc.default;
|
|
46
|
+
else if (fc.defaultValue !== void 0) options.defaultValue = fc.defaultValue;
|
|
47
|
+
if (Array.isArray(fc.options)) options.options = fc.options;
|
|
48
|
+
else if (fc.options && typeof fc.options === "object") Object.assign(options, fc.options);
|
|
49
|
+
if (fc.admin && typeof fc.admin === "object") Object.assign(options, fc.admin);
|
|
50
|
+
result[fieldName] = configureField(fieldBuilder, options);
|
|
46
51
|
}
|
|
47
52
|
return result;
|
|
48
53
|
}
|
|
@@ -117,48 +122,57 @@ function mapServerAction(serverAction, collection, fieldRegistry, client) {
|
|
|
117
122
|
* ```
|
|
118
123
|
*/
|
|
119
124
|
function useServerActions(t0) {
|
|
120
|
-
const $ = c(
|
|
121
|
-
const { collection } = t0;
|
|
125
|
+
const $ = c(11);
|
|
126
|
+
const { collection, schema: schemaOverride } = t0;
|
|
122
127
|
const admin = useAdminStore(selectAdmin);
|
|
123
128
|
const client = useAdminStore(selectClient);
|
|
124
|
-
const
|
|
129
|
+
const t1 = !schemaOverride;
|
|
130
|
+
let t2;
|
|
131
|
+
if ($[0] !== t1) {
|
|
132
|
+
t2 = { enabled: t1 };
|
|
133
|
+
$[0] = t1;
|
|
134
|
+
$[1] = t2;
|
|
135
|
+
} else t2 = $[1];
|
|
136
|
+
const { data: queriedSchema, isPending: isSchemaPending } = useCollectionSchema(collection, t2);
|
|
137
|
+
const schema = schemaOverride ?? queriedSchema;
|
|
138
|
+
const isPending = schemaOverride ? false : isSchemaPending;
|
|
125
139
|
schema?.admin?.actions;
|
|
126
|
-
let
|
|
140
|
+
let t3;
|
|
127
141
|
bb0: {
|
|
128
142
|
const actionsConfig = schema?.admin?.actions;
|
|
129
143
|
if (!actionsConfig?.custom?.length) {
|
|
130
|
-
let
|
|
131
|
-
if ($[
|
|
132
|
-
|
|
133
|
-
$[
|
|
134
|
-
} else
|
|
135
|
-
|
|
144
|
+
let t4$2;
|
|
145
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
146
|
+
t4$2 = [];
|
|
147
|
+
$[2] = t4$2;
|
|
148
|
+
} else t4$2 = $[2];
|
|
149
|
+
t3 = t4$2;
|
|
136
150
|
break bb0;
|
|
137
151
|
}
|
|
138
|
-
let
|
|
139
|
-
if ($[
|
|
152
|
+
let t4$1;
|
|
153
|
+
if ($[3] !== actionsConfig.custom || $[4] !== admin || $[5] !== client || $[6] !== collection) {
|
|
140
154
|
const fieldRegistry = admin?.getFields?.() ?? null;
|
|
141
|
-
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
} else
|
|
148
|
-
|
|
155
|
+
t4$1 = actionsConfig.custom.map((serverAction) => mapServerAction(serverAction, collection, fieldRegistry, client));
|
|
156
|
+
$[3] = actionsConfig.custom;
|
|
157
|
+
$[4] = admin;
|
|
158
|
+
$[5] = client;
|
|
159
|
+
$[6] = collection;
|
|
160
|
+
$[7] = t4$1;
|
|
161
|
+
} else t4$1 = $[7];
|
|
162
|
+
t3 = t4$1;
|
|
149
163
|
}
|
|
150
|
-
const serverActions =
|
|
151
|
-
let
|
|
152
|
-
if ($[
|
|
153
|
-
|
|
164
|
+
const serverActions = t3;
|
|
165
|
+
let t4;
|
|
166
|
+
if ($[8] !== isPending || $[9] !== serverActions) {
|
|
167
|
+
t4 = {
|
|
154
168
|
serverActions,
|
|
155
169
|
isLoading: isPending
|
|
156
170
|
};
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
} else
|
|
161
|
-
return
|
|
171
|
+
$[8] = isPending;
|
|
172
|
+
$[9] = serverActions;
|
|
173
|
+
$[10] = t4;
|
|
174
|
+
} else t4 = $[10];
|
|
175
|
+
return t4;
|
|
162
176
|
}
|
|
163
177
|
/**
|
|
164
178
|
* Merge server actions with local actions config.
|
|
@@ -168,11 +182,15 @@ function mergeServerActions(localActions, serverActions) {
|
|
|
168
182
|
if (!serverActions.length) return localActions;
|
|
169
183
|
const headerActions = [...localActions.header?.primary ?? []];
|
|
170
184
|
const headerSecondary = [...localActions.header?.secondary ?? []];
|
|
185
|
+
const rowActions = [...localActions.row ?? []];
|
|
171
186
|
const bulkActions = [...localActions.bulk ?? []];
|
|
172
187
|
for (const action of serverActions) switch (action.scope) {
|
|
173
188
|
case "bulk":
|
|
174
189
|
bulkActions.push(action);
|
|
175
190
|
break;
|
|
191
|
+
case "row":
|
|
192
|
+
rowActions.push(action);
|
|
193
|
+
break;
|
|
176
194
|
case "header":
|
|
177
195
|
headerActions.push(action);
|
|
178
196
|
break;
|
|
@@ -183,6 +201,7 @@ function mergeServerActions(localActions, serverActions) {
|
|
|
183
201
|
primary: headerActions,
|
|
184
202
|
secondary: headerSecondary
|
|
185
203
|
},
|
|
204
|
+
row: rowActions,
|
|
186
205
|
bulk: bulkActions
|
|
187
206
|
};
|
|
188
207
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useValidationTranslator } from "./use-validation-error-map.mjs";
|
|
1
2
|
import { useCollectionSchema } from "./use-collection-schema.mjs";
|
|
2
3
|
import { useGlobalSchema } from "./use-global-schema.mjs";
|
|
3
4
|
import { c } from "react/compiler-runtime";
|
|
@@ -37,6 +38,112 @@ function stripAdditionalProperties(schema) {
|
|
|
37
38
|
if (s.items) s.items = stripAdditionalProperties(s.items);
|
|
38
39
|
return s;
|
|
39
40
|
}
|
|
41
|
+
function translateResolverErrors(errors, translate, parentPath = "") {
|
|
42
|
+
const translatedErrors = Array.isArray(errors) ? [...errors] : { ...errors };
|
|
43
|
+
for (const [key, value] of Object.entries(translatedErrors)) {
|
|
44
|
+
if (!value || typeof value !== "object") continue;
|
|
45
|
+
const path = parentPath ? `${parentPath}.${key}` : key;
|
|
46
|
+
if (isFieldError(value)) translatedErrors[key] = translateFieldError(value, translate, path);
|
|
47
|
+
else translatedErrors[key] = translateResolverErrors(value, translate, path);
|
|
48
|
+
}
|
|
49
|
+
return translatedErrors;
|
|
50
|
+
}
|
|
51
|
+
function isFieldError(value) {
|
|
52
|
+
return "message" in value || "type" in value;
|
|
53
|
+
}
|
|
54
|
+
function translateFieldError(error, translate, path) {
|
|
55
|
+
const translated = translateAjvMessage(error, translate, path);
|
|
56
|
+
const types = error.types && typeof error.types === "object" ? Object.fromEntries(Object.entries(error.types).map(([key, value]) => [key, Array.isArray(value) ? value.map((message) => translateAjvMessage({
|
|
57
|
+
...error,
|
|
58
|
+
type: key,
|
|
59
|
+
message: String(message)
|
|
60
|
+
}, translate, path)) : translateAjvMessage({
|
|
61
|
+
...error,
|
|
62
|
+
type: key,
|
|
63
|
+
message: String(value)
|
|
64
|
+
}, translate, path)])) : error.types;
|
|
65
|
+
return {
|
|
66
|
+
...error,
|
|
67
|
+
message: translated,
|
|
68
|
+
...types && { types }
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function translateAjvMessage(error, translate, field) {
|
|
72
|
+
const message = typeof error.message === "string" ? error.message : "";
|
|
73
|
+
const type = typeof error.type === "string" ? error.type : "";
|
|
74
|
+
const baseParams = { field };
|
|
75
|
+
if (message.startsWith("validation.")) return translate(message, baseParams);
|
|
76
|
+
switch (type) {
|
|
77
|
+
case "required": return translate("validation.required", baseParams);
|
|
78
|
+
case "type": return translate("validation.invalidType", {
|
|
79
|
+
...baseParams,
|
|
80
|
+
expected: extractExpectedType(message) ?? "unknown",
|
|
81
|
+
received: extractReceivedType(message) ?? "unknown"
|
|
82
|
+
});
|
|
83
|
+
case "enum": return translate("validation.enum.invalid", baseParams);
|
|
84
|
+
case "minLength": return translate("validation.string.min", {
|
|
85
|
+
...baseParams,
|
|
86
|
+
min: extractFirstNumber(message) ?? ""
|
|
87
|
+
});
|
|
88
|
+
case "maxLength": return translate("validation.string.max", {
|
|
89
|
+
...baseParams,
|
|
90
|
+
max: extractFirstNumber(message) ?? ""
|
|
91
|
+
});
|
|
92
|
+
case "pattern": return translate("validation.string.regex", baseParams);
|
|
93
|
+
case "format": return translate(formatMessageToValidationKey(message), baseParams);
|
|
94
|
+
case "minimum":
|
|
95
|
+
case "exclusiveMinimum": return translate("validation.number.min", {
|
|
96
|
+
...baseParams,
|
|
97
|
+
min: extractFirstNumber(message) ?? ""
|
|
98
|
+
});
|
|
99
|
+
case "maximum":
|
|
100
|
+
case "exclusiveMaximum": return translate("validation.number.max", {
|
|
101
|
+
...baseParams,
|
|
102
|
+
max: extractFirstNumber(message) ?? ""
|
|
103
|
+
});
|
|
104
|
+
case "minItems": return translate("validation.array.min", {
|
|
105
|
+
...baseParams,
|
|
106
|
+
min: extractFirstNumber(message) ?? ""
|
|
107
|
+
});
|
|
108
|
+
case "maxItems": return translate("validation.array.max", {
|
|
109
|
+
...baseParams,
|
|
110
|
+
max: extractFirstNumber(message) ?? ""
|
|
111
|
+
});
|
|
112
|
+
default: return interpolateMessage(message, baseParams);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function extractFirstNumber(message) {
|
|
116
|
+
const match = message.match(/\d+/);
|
|
117
|
+
return match ? Number(match[0]) : void 0;
|
|
118
|
+
}
|
|
119
|
+
function extractExpectedType(message) {
|
|
120
|
+
return message.match(/must be (?:a |an )?([A-Za-z_][\w-]*)/)?.[1] ?? message.match(/expected ([A-Za-z_][\w-]*)/)?.[1];
|
|
121
|
+
}
|
|
122
|
+
function extractReceivedType(message) {
|
|
123
|
+
return message.match(/received ([A-Za-z_][\w-]*)/)?.[1];
|
|
124
|
+
}
|
|
125
|
+
function formatMessageToValidationKey(message) {
|
|
126
|
+
if (message.includes("\"email\"")) return "validation.string.email";
|
|
127
|
+
if (message.includes("\"uri\"") || message.includes("\"url\"")) return "validation.string.url";
|
|
128
|
+
if (message.includes("\"date-time\"")) return "validation.string.datetime";
|
|
129
|
+
if (message.includes("\"time\"")) return "validation.time.invalid";
|
|
130
|
+
return "validation.string.regex";
|
|
131
|
+
}
|
|
132
|
+
function interpolateMessage(message, params) {
|
|
133
|
+
return message.replace(/\{\{(\w+)\}\}/g, (_, key) => {
|
|
134
|
+
const value = params[key];
|
|
135
|
+
return value !== void 0 ? String(value) : "";
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function withTranslatedResolver(resolver, translate) {
|
|
139
|
+
return async (values, context, options) => {
|
|
140
|
+
const result = await resolver(values, context, options);
|
|
141
|
+
return {
|
|
142
|
+
...result,
|
|
143
|
+
errors: translateResolverErrors(result.errors, translate)
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
}
|
|
40
147
|
/**
|
|
41
148
|
* Hook to create a react-hook-form resolver using server's JSON Schema
|
|
42
149
|
*
|
|
@@ -80,77 +187,82 @@ function stripAdditionalProperties(schema) {
|
|
|
80
187
|
* ```
|
|
81
188
|
*/
|
|
82
189
|
function useServerValidation(collection, t0) {
|
|
83
|
-
const $ = c(
|
|
190
|
+
const $ = c(18);
|
|
84
191
|
let t1;
|
|
85
192
|
if ($[0] !== t0) {
|
|
86
193
|
t1 = t0 === void 0 ? {} : t0;
|
|
87
194
|
$[0] = t0;
|
|
88
195
|
$[1] = t1;
|
|
89
196
|
} else t1 = $[1];
|
|
90
|
-
const { mode: t2, enabled: t3 } = t1;
|
|
197
|
+
const { mode: t2, enabled: t3, schema: schemaOverride } = t1;
|
|
91
198
|
const mode = t2 === void 0 ? "create" : t2;
|
|
92
199
|
const enabled = t3 === void 0 ? true : t3;
|
|
200
|
+
const translateValidation = useValidationTranslator();
|
|
201
|
+
const shouldFetchSchema = enabled && !schemaOverride;
|
|
93
202
|
let t4;
|
|
94
|
-
if ($[2] !==
|
|
95
|
-
t4 = { enabled };
|
|
96
|
-
$[2] =
|
|
203
|
+
if ($[2] !== shouldFetchSchema) {
|
|
204
|
+
t4 = { enabled: shouldFetchSchema };
|
|
205
|
+
$[2] = shouldFetchSchema;
|
|
97
206
|
$[3] = t4;
|
|
98
207
|
} else t4 = $[3];
|
|
99
|
-
const { data:
|
|
208
|
+
const { data: queriedSchema, isLoading: queriedIsLoading, error: queriedError } = useCollectionSchema(collection, t4);
|
|
209
|
+
const schema = schemaOverride ?? queriedSchema;
|
|
210
|
+
const isLoading = schemaOverride ? false : queriedIsLoading;
|
|
211
|
+
const error = schemaOverride ? null : queriedError;
|
|
100
212
|
let t5;
|
|
101
|
-
if ($[4] !== collection || $[5] !== error || $[6] !== isLoading || $[7] !== mode || $[8] !== schema?.validation?.insert || $[9] !== schema?.validation?.update) {
|
|
213
|
+
if ($[4] !== collection || $[5] !== error || $[6] !== isLoading || $[7] !== mode || $[8] !== schema?.validation?.insert || $[9] !== schema?.validation?.update || $[10] !== translateValidation) {
|
|
102
214
|
bb0: {
|
|
103
215
|
const jsonSchema = stripAdditionalProperties(mode === "create" ? schema?.validation?.insert : schema?.validation?.update);
|
|
104
216
|
if (!jsonSchema || typeof jsonSchema !== "object") {
|
|
105
217
|
const t6 = error ?? null;
|
|
106
218
|
let t7;
|
|
107
|
-
if ($[
|
|
219
|
+
if ($[12] !== isLoading || $[13] !== t6) {
|
|
108
220
|
t7 = {
|
|
109
221
|
resolver: void 0,
|
|
110
222
|
hasServerSchema: false,
|
|
111
223
|
isLoading,
|
|
112
224
|
error: t6
|
|
113
225
|
};
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
} else t7 = $[
|
|
226
|
+
$[12] = isLoading;
|
|
227
|
+
$[13] = t6;
|
|
228
|
+
$[14] = t7;
|
|
229
|
+
} else t7 = $[14];
|
|
118
230
|
t5 = t7;
|
|
119
231
|
break bb0;
|
|
120
232
|
}
|
|
121
233
|
try {
|
|
122
|
-
const resolver = ajvResolver(jsonSchema, {
|
|
234
|
+
const resolver = withTranslatedResolver(ajvResolver(jsonSchema, {
|
|
123
235
|
allErrors: true,
|
|
124
236
|
strict: false,
|
|
125
237
|
coerceTypes: true,
|
|
126
238
|
useDefaults: true,
|
|
127
239
|
formats: {}
|
|
128
|
-
}, { mode: "async" });
|
|
240
|
+
}, { mode: "async" }), translateValidation);
|
|
129
241
|
let t7;
|
|
130
|
-
if ($[
|
|
242
|
+
if ($[15] !== resolver) {
|
|
131
243
|
t7 = {
|
|
132
244
|
resolver,
|
|
133
245
|
hasServerSchema: true,
|
|
134
246
|
isLoading: false,
|
|
135
247
|
error: null
|
|
136
248
|
};
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
} else t7 = $[
|
|
249
|
+
$[15] = resolver;
|
|
250
|
+
$[16] = t7;
|
|
251
|
+
} else t7 = $[16];
|
|
140
252
|
t5 = t7;
|
|
141
253
|
} catch (t6) {
|
|
142
254
|
const e = t6;
|
|
143
255
|
console.warn(`[useServerValidation] Failed to compile JSON Schema for ${collection}:`, e);
|
|
144
256
|
let t7;
|
|
145
|
-
if ($[
|
|
257
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
146
258
|
t7 = {
|
|
147
259
|
resolver: void 0,
|
|
148
260
|
hasServerSchema: false,
|
|
149
261
|
isLoading: false,
|
|
150
262
|
error: e instanceof Error ? e : new Error(String(e))
|
|
151
263
|
};
|
|
152
|
-
$[
|
|
153
|
-
} else t7 = $[
|
|
264
|
+
$[17] = t7;
|
|
265
|
+
} else t7 = $[17];
|
|
154
266
|
t5 = t7;
|
|
155
267
|
}
|
|
156
268
|
}
|
|
@@ -160,8 +272,9 @@ function useServerValidation(collection, t0) {
|
|
|
160
272
|
$[7] = mode;
|
|
161
273
|
$[8] = schema?.validation?.insert;
|
|
162
274
|
$[9] = schema?.validation?.update;
|
|
163
|
-
$[10] =
|
|
164
|
-
|
|
275
|
+
$[10] = translateValidation;
|
|
276
|
+
$[11] = t5;
|
|
277
|
+
} else t5 = $[11];
|
|
165
278
|
return t5;
|
|
166
279
|
}
|
|
167
280
|
/**
|
|
@@ -206,7 +319,7 @@ function usePreferServerValidation(collection, t0, fallbackResolver) {
|
|
|
206
319
|
* @returns Server validation result with resolver
|
|
207
320
|
*/
|
|
208
321
|
function useGlobalServerValidation(globalName, t0) {
|
|
209
|
-
const $ = c(
|
|
322
|
+
const $ = c(16);
|
|
210
323
|
let t1;
|
|
211
324
|
if ($[0] !== t0) {
|
|
212
325
|
t1 = t0 === void 0 ? {} : t0;
|
|
@@ -215,6 +328,7 @@ function useGlobalServerValidation(globalName, t0) {
|
|
|
215
328
|
} else t1 = $[1];
|
|
216
329
|
const { enabled: t2 } = t1;
|
|
217
330
|
const enabled = t2 === void 0 ? true : t2;
|
|
331
|
+
const translateValidation = useValidationTranslator();
|
|
218
332
|
let t3;
|
|
219
333
|
if ($[2] !== enabled) {
|
|
220
334
|
t3 = { enabled };
|
|
@@ -223,58 +337,58 @@ function useGlobalServerValidation(globalName, t0) {
|
|
|
223
337
|
} else t3 = $[3];
|
|
224
338
|
const { data: schema, isLoading, error } = useGlobalSchema(globalName, t3);
|
|
225
339
|
let t4;
|
|
226
|
-
if ($[4] !== error || $[5] !== globalName || $[6] !== isLoading || $[7] !== schema?.validation?.update) {
|
|
340
|
+
if ($[4] !== error || $[5] !== globalName || $[6] !== isLoading || $[7] !== schema?.validation?.update || $[8] !== translateValidation) {
|
|
227
341
|
bb0: {
|
|
228
342
|
const jsonSchema = stripAdditionalProperties(schema?.validation?.update);
|
|
229
343
|
if (!jsonSchema || typeof jsonSchema !== "object") {
|
|
230
344
|
const t5 = error ?? null;
|
|
231
345
|
let t6;
|
|
232
|
-
if ($[
|
|
346
|
+
if ($[10] !== isLoading || $[11] !== t5) {
|
|
233
347
|
t6 = {
|
|
234
348
|
resolver: void 0,
|
|
235
349
|
hasServerSchema: false,
|
|
236
350
|
isLoading,
|
|
237
351
|
error: t5
|
|
238
352
|
};
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
} else t6 = $[
|
|
353
|
+
$[10] = isLoading;
|
|
354
|
+
$[11] = t5;
|
|
355
|
+
$[12] = t6;
|
|
356
|
+
} else t6 = $[12];
|
|
243
357
|
t4 = t6;
|
|
244
358
|
break bb0;
|
|
245
359
|
}
|
|
246
360
|
try {
|
|
247
|
-
const resolver = ajvResolver(jsonSchema, {
|
|
361
|
+
const resolver = withTranslatedResolver(ajvResolver(jsonSchema, {
|
|
248
362
|
allErrors: true,
|
|
249
363
|
strict: false,
|
|
250
364
|
coerceTypes: true,
|
|
251
365
|
useDefaults: true
|
|
252
|
-
}, { mode: "async" });
|
|
366
|
+
}, { mode: "async" }), translateValidation);
|
|
253
367
|
let t6;
|
|
254
|
-
if ($[
|
|
368
|
+
if ($[13] !== resolver) {
|
|
255
369
|
t6 = {
|
|
256
370
|
resolver,
|
|
257
371
|
hasServerSchema: true,
|
|
258
372
|
isLoading: false,
|
|
259
373
|
error: null
|
|
260
374
|
};
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
} else t6 = $[
|
|
375
|
+
$[13] = resolver;
|
|
376
|
+
$[14] = t6;
|
|
377
|
+
} else t6 = $[14];
|
|
264
378
|
t4 = t6;
|
|
265
379
|
} catch (t5) {
|
|
266
380
|
const e = t5;
|
|
267
381
|
console.warn(`[useGlobalServerValidation] Failed to compile JSON Schema for ${globalName}:`, e);
|
|
268
382
|
let t6;
|
|
269
|
-
if ($[
|
|
383
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
270
384
|
t6 = {
|
|
271
385
|
resolver: void 0,
|
|
272
386
|
hasServerSchema: false,
|
|
273
387
|
isLoading: false,
|
|
274
388
|
error: e instanceof Error ? e : new Error(String(e))
|
|
275
389
|
};
|
|
276
|
-
$[
|
|
277
|
-
} else t6 = $[
|
|
390
|
+
$[15] = t6;
|
|
391
|
+
} else t6 = $[15];
|
|
278
392
|
t4 = t6;
|
|
279
393
|
}
|
|
280
394
|
}
|
|
@@ -282,8 +396,9 @@ function useGlobalServerValidation(globalName, t0) {
|
|
|
282
396
|
$[5] = globalName;
|
|
283
397
|
$[6] = isLoading;
|
|
284
398
|
$[7] = schema?.validation?.update;
|
|
285
|
-
$[8] =
|
|
286
|
-
|
|
399
|
+
$[8] = translateValidation;
|
|
400
|
+
$[9] = t4;
|
|
401
|
+
} else t4 = $[9];
|
|
287
402
|
return t4;
|
|
288
403
|
}
|
|
289
404
|
|