@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
|
@@ -31,39 +31,29 @@ const BlockScopeContext = React.createContext(null);
|
|
|
31
31
|
function BlockScopeProvider(t0) {
|
|
32
32
|
const $ = c(6);
|
|
33
33
|
const { blockId, basePath: t1, children } = t0;
|
|
34
|
-
const
|
|
35
|
-
const parentScope = React.useContext(BlockScopeContext);
|
|
34
|
+
const fieldPrefix = `${t1 === void 0 ? "content._values" : t1}.${blockId}`;
|
|
36
35
|
let t2;
|
|
37
|
-
bb0: {
|
|
38
|
-
if (parentScope) {
|
|
39
|
-
t2 = `${parentScope.fieldPrefix}.${blockId}`;
|
|
40
|
-
break bb0;
|
|
41
|
-
}
|
|
42
|
-
t2 = `${basePath}.${blockId}`;
|
|
43
|
-
}
|
|
44
|
-
const fieldPrefix = t2;
|
|
45
|
-
let t3;
|
|
46
36
|
if ($[0] !== blockId || $[1] !== fieldPrefix) {
|
|
47
|
-
|
|
37
|
+
t2 = {
|
|
48
38
|
blockId,
|
|
49
39
|
fieldPrefix
|
|
50
40
|
};
|
|
51
41
|
$[0] = blockId;
|
|
52
42
|
$[1] = fieldPrefix;
|
|
53
|
-
$[2] =
|
|
54
|
-
} else
|
|
55
|
-
const value =
|
|
56
|
-
let
|
|
43
|
+
$[2] = t2;
|
|
44
|
+
} else t2 = $[2];
|
|
45
|
+
const value = t2;
|
|
46
|
+
let t3;
|
|
57
47
|
if ($[3] !== children || $[4] !== value) {
|
|
58
|
-
|
|
48
|
+
t3 = /* @__PURE__ */ jsx(BlockScopeContext.Provider, {
|
|
59
49
|
value,
|
|
60
50
|
children
|
|
61
51
|
});
|
|
62
52
|
$[3] = children;
|
|
63
53
|
$[4] = value;
|
|
64
|
-
$[5] =
|
|
65
|
-
} else
|
|
66
|
-
return
|
|
54
|
+
$[5] = t3;
|
|
55
|
+
} else t3 = $[5];
|
|
56
|
+
return t3;
|
|
67
57
|
}
|
|
68
58
|
/**
|
|
69
59
|
* Get current block scope context.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BlockScopeContextValue, BlockScopeProvider, BlockScopeProviderProps, useBlockScope, useResolveFieldPath } from "./block-scope-context.mjs";
|
|
2
2
|
import { PreviewBanner, PreviewBannerProps } from "./preview-banner.mjs";
|
|
3
3
|
import { PreviewField, PreviewFieldProps, PreviewProvider, StandalonePreviewField, usePreviewContext } from "./preview-field.mjs";
|
|
4
|
-
import { AdminToPreviewMessage, BlockClickedMessage, FieldClickedMessage, FocusFieldMessage, PreviewConfig, PreviewReadyMessage, PreviewRefreshMessage, PreviewToAdminMessage, RefreshCompleteMessage, SelectBlockMessage, isAdminToPreviewMessage, isPreviewToAdminMessage } from "./types.mjs";
|
|
4
|
+
import { AdminToPreviewMessage, BlockClickedMessage, CommitMessage, FieldClickedMessage, FieldValueEditedMessage, FocusFieldMessage, FullResyncMessage, InitSnapshotMessage, PatchAppliedMessage, PatchBatchMessage, PreviewConfig, PreviewPatchOp, PreviewReadyMessage, PreviewRefreshMessage, PreviewToAdminMessage, RefreshCompleteMessage, ResyncRequestMessage, SelectBlockMessage, isAdminToPreviewMessage, isPreviewToAdminMessage } from "./types.mjs";
|
|
5
5
|
import { UseCollectionPreviewOptions, UseCollectionPreviewResult, useCollectionPreview } from "./use-collection-preview.mjs";
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//#region src/client/preview/patch.ts
|
|
2
|
+
function cloneSnapshot(value) {
|
|
3
|
+
if (typeof globalThis.structuredClone === "function") return globalThis.structuredClone(value);
|
|
4
|
+
if (value === void 0) return value;
|
|
5
|
+
return JSON.parse(JSON.stringify(value));
|
|
6
|
+
}
|
|
7
|
+
function shouldApplyPatchBatch(lastAppliedSeq, nextSeq) {
|
|
8
|
+
return lastAppliedSeq == null || nextSeq > lastAppliedSeq;
|
|
9
|
+
}
|
|
10
|
+
function applyPatchBatchImmutable(data, ops) {
|
|
11
|
+
return ops.reduce((current, op) => {
|
|
12
|
+
if (op.op === "set") return setAtPath(current, op.path, op.value);
|
|
13
|
+
if (op.op === "remove") return removeAtPath(current, op.path);
|
|
14
|
+
throw new Error(`Unsupported preview patch operation: ${op.op}`);
|
|
15
|
+
}, data);
|
|
16
|
+
}
|
|
17
|
+
function splitPath(path) {
|
|
18
|
+
if (path === "") return [];
|
|
19
|
+
return path.split(".");
|
|
20
|
+
}
|
|
21
|
+
function isObjectRecord(value) {
|
|
22
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
23
|
+
}
|
|
24
|
+
function isArrayIndex(segment) {
|
|
25
|
+
return /^(0|[1-9]\d*)$/.test(segment);
|
|
26
|
+
}
|
|
27
|
+
function createContainer(nextSegment) {
|
|
28
|
+
return nextSegment !== void 0 && isArrayIndex(nextSegment) ? [] : {};
|
|
29
|
+
}
|
|
30
|
+
function cloneContainer(value, nextSegment) {
|
|
31
|
+
if (Array.isArray(value)) return [...value];
|
|
32
|
+
if (isObjectRecord(value)) return { ...value };
|
|
33
|
+
return createContainer(nextSegment);
|
|
34
|
+
}
|
|
35
|
+
function readChild(container, segment) {
|
|
36
|
+
if (Array.isArray(container) && isArrayIndex(segment)) return container[Number(segment)];
|
|
37
|
+
if (isObjectRecord(container)) return container[segment];
|
|
38
|
+
}
|
|
39
|
+
function writeChild(container, segment, value) {
|
|
40
|
+
if (Array.isArray(container) && isArrayIndex(segment)) {
|
|
41
|
+
container[Number(segment)] = value;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
container[segment] = value;
|
|
45
|
+
}
|
|
46
|
+
function hasChild(container, segment) {
|
|
47
|
+
if (Array.isArray(container) && isArrayIndex(segment)) {
|
|
48
|
+
const index = Number(segment);
|
|
49
|
+
return index >= 0 && index < container.length;
|
|
50
|
+
}
|
|
51
|
+
if (isObjectRecord(container)) return Object.prototype.hasOwnProperty.call(container, segment);
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
function deleteChild(container, segment) {
|
|
55
|
+
if (Array.isArray(container) && isArrayIndex(segment)) {
|
|
56
|
+
container.splice(Number(segment), 1);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
delete container[segment];
|
|
60
|
+
}
|
|
61
|
+
function setAtPath(data, path, value) {
|
|
62
|
+
const segments = splitPath(path);
|
|
63
|
+
if (segments.length === 0) return cloneSnapshot(value);
|
|
64
|
+
const root = cloneContainer(data, segments[0]);
|
|
65
|
+
let cursor = root;
|
|
66
|
+
for (let index = 0; index < segments.length - 1; index += 1) {
|
|
67
|
+
const segment = segments[index];
|
|
68
|
+
const nextSegment = segments[index + 1];
|
|
69
|
+
const nextChild = cloneContainer(readChild(cursor, segment), nextSegment);
|
|
70
|
+
writeChild(cursor, segment, nextChild);
|
|
71
|
+
cursor = nextChild;
|
|
72
|
+
}
|
|
73
|
+
writeChild(cursor, segments[segments.length - 1], cloneSnapshot(value));
|
|
74
|
+
return root;
|
|
75
|
+
}
|
|
76
|
+
function removeAtPath(data, path) {
|
|
77
|
+
const segments = splitPath(path);
|
|
78
|
+
if (segments.length === 0) return;
|
|
79
|
+
if (!Array.isArray(data) && !isObjectRecord(data)) return data;
|
|
80
|
+
const root = cloneContainer(data, segments[0]);
|
|
81
|
+
let sourceCursor = data;
|
|
82
|
+
let cursor = root;
|
|
83
|
+
for (let index = 0; index < segments.length - 1; index += 1) {
|
|
84
|
+
const segment = segments[index];
|
|
85
|
+
if (!hasChild(sourceCursor, segment)) return data;
|
|
86
|
+
const sourceChild = readChild(sourceCursor, segment);
|
|
87
|
+
if (!Array.isArray(sourceChild) && !isObjectRecord(sourceChild)) return data;
|
|
88
|
+
const nextChild = cloneContainer(sourceChild, segments[index + 1]);
|
|
89
|
+
writeChild(cursor, segment, nextChild);
|
|
90
|
+
sourceCursor = sourceChild;
|
|
91
|
+
cursor = nextChild;
|
|
92
|
+
}
|
|
93
|
+
const finalSegment = segments[segments.length - 1];
|
|
94
|
+
if (!hasChild(sourceCursor, finalSegment)) return data;
|
|
95
|
+
deleteChild(cursor, finalSegment);
|
|
96
|
+
return root;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { applyPatchBatchImmutable, cloneSnapshot, shouldApplyPatchBatch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime22 from "react/jsx-runtime";
|
|
2
2
|
|
|
3
3
|
//#region src/client/preview/preview-banner.d.ts
|
|
4
4
|
|
|
@@ -40,6 +40,6 @@ declare function PreviewBanner({
|
|
|
40
40
|
isPreviewMode,
|
|
41
41
|
className,
|
|
42
42
|
exitPreviewUrl
|
|
43
|
-
}: PreviewBannerProps):
|
|
43
|
+
}: PreviewBannerProps): react_jsx_runtime22.JSX.Element | null;
|
|
44
44
|
//#endregion
|
|
45
45
|
export { PreviewBanner, PreviewBannerProps };
|
|
@@ -8,17 +8,30 @@ type PreviewFieldProps = {
|
|
|
8
8
|
field: string;
|
|
9
9
|
/** Field type for routing (regular, block, or relation) */
|
|
10
10
|
fieldType?: "regular" | "block" | "relation";
|
|
11
|
+
/** Enable inline scalar editing in preview mode */
|
|
12
|
+
editable?: "text" | "textarea";
|
|
11
13
|
/** Content to render */
|
|
12
14
|
children: React.ReactNode;
|
|
13
15
|
/** HTML element type */
|
|
14
16
|
as?: React.ElementType;
|
|
15
17
|
/** Additional class names */
|
|
16
18
|
className?: string;
|
|
19
|
+
/** Inline styles for the rendered element */
|
|
20
|
+
style?: React.CSSProperties;
|
|
17
21
|
/** Click handler (uses context by default) */
|
|
18
22
|
onClick?: (fieldPath: string, context?: {
|
|
19
23
|
blockId?: string;
|
|
20
24
|
fieldType?: "regular" | "block" | "relation";
|
|
21
25
|
}) => void;
|
|
26
|
+
/** Inline edit commit handler (uses context/default postMessage by default) */
|
|
27
|
+
onValueCommit?: (payload: PreviewFieldValueEditedPayload) => void;
|
|
28
|
+
};
|
|
29
|
+
type PreviewFieldValueEditedPayload = {
|
|
30
|
+
path: string;
|
|
31
|
+
value: unknown;
|
|
32
|
+
inputKind: "text" | "textarea" | "number" | "boolean";
|
|
33
|
+
blockId?: string;
|
|
34
|
+
fieldType?: "regular" | "block" | "relation";
|
|
22
35
|
};
|
|
23
36
|
type PreviewContextValue = {
|
|
24
37
|
isPreviewMode: boolean;
|
|
@@ -26,6 +39,7 @@ type PreviewContextValue = {
|
|
|
26
39
|
blockId?: string;
|
|
27
40
|
fieldType?: "regular" | "block" | "relation";
|
|
28
41
|
}) => void;
|
|
42
|
+
handleFieldValueEdited?: (payload: PreviewFieldValueEditedPayload) => void;
|
|
29
43
|
focusedField: string | null;
|
|
30
44
|
};
|
|
31
45
|
/**
|
|
@@ -33,17 +47,26 @@ type PreviewContextValue = {
|
|
|
33
47
|
* Use this at the root of your preview page.
|
|
34
48
|
*/
|
|
35
49
|
declare function PreviewProvider({
|
|
50
|
+
preview,
|
|
36
51
|
isPreviewMode,
|
|
37
52
|
focusedField,
|
|
38
53
|
onFieldClick,
|
|
54
|
+
onFieldValueEdited,
|
|
39
55
|
children
|
|
40
56
|
}: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
preview?: {
|
|
58
|
+
isPreviewMode: boolean;
|
|
59
|
+
focusedField: string | null;
|
|
60
|
+
handleFieldClick: PreviewContextValue["handleFieldClick"];
|
|
61
|
+
handleFieldValueEdited?: PreviewContextValue["handleFieldValueEdited"];
|
|
62
|
+
};
|
|
63
|
+
isPreviewMode?: boolean;
|
|
64
|
+
focusedField?: string | null;
|
|
65
|
+
onFieldClick?: (fieldPath: string, context?: {
|
|
44
66
|
blockId?: string;
|
|
45
67
|
fieldType?: "regular" | "block" | "relation";
|
|
46
68
|
}) => void;
|
|
69
|
+
onFieldValueEdited?: (payload: PreviewFieldValueEditedPayload) => void;
|
|
47
70
|
children: React.ReactNode;
|
|
48
71
|
}): react_jsx_runtime23.JSX.Element;
|
|
49
72
|
/**
|
|
@@ -77,10 +100,13 @@ declare function usePreviewContext(): PreviewContextValue | null;
|
|
|
77
100
|
declare function PreviewField({
|
|
78
101
|
field,
|
|
79
102
|
fieldType,
|
|
103
|
+
editable,
|
|
80
104
|
children,
|
|
81
105
|
as: Component,
|
|
82
106
|
className,
|
|
83
|
-
|
|
107
|
+
style,
|
|
108
|
+
onClick,
|
|
109
|
+
onValueCommit
|
|
84
110
|
}: PreviewFieldProps): react_jsx_runtime23.JSX.Element;
|
|
85
111
|
/**
|
|
86
112
|
* Standalone PreviewField that works without context.
|
|
@@ -89,12 +115,15 @@ declare function PreviewField({
|
|
|
89
115
|
declare function StandalonePreviewField({
|
|
90
116
|
field,
|
|
91
117
|
fieldType,
|
|
118
|
+
editable,
|
|
92
119
|
children,
|
|
93
120
|
as: Component,
|
|
94
121
|
className,
|
|
122
|
+
style,
|
|
95
123
|
isPreviewMode,
|
|
96
124
|
isFocused,
|
|
97
|
-
onFieldClick
|
|
125
|
+
onFieldClick,
|
|
126
|
+
onValueCommit
|
|
98
127
|
}: PreviewFieldProps & {
|
|
99
128
|
isPreviewMode: boolean;
|
|
100
129
|
isFocused?: boolean;
|