@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useTranslation } from "../../i18n/hooks.mjs";
|
|
4
4
|
import { cn } from "../../lib/utils.mjs";
|
|
5
|
-
import { useBlockEditorActions, useBlockSchema, useBlockValues, useIsBlockExpanded } from "./block-editor-context.mjs";
|
|
5
|
+
import { useBlockEditorActions, useBlockSchema, useBlockValues, useIsBlockExpanded, useIsBlockSelected } from "./block-editor-context.mjs";
|
|
6
6
|
import { BlockInsertButton } from "./block-insert-button.mjs";
|
|
7
7
|
import { Card, CardContent, CardHeader } from "../ui/card.mjs";
|
|
8
8
|
import { BlockFieldsRenderer } from "./block-fields-renderer.mjs";
|
|
@@ -27,13 +27,14 @@ function areBlockItemPropsEqual(prev, next) {
|
|
|
27
27
|
return prev.block === next.block && prev.level === next.level && prev.index === next.index && prev.parentId === next.parentId;
|
|
28
28
|
}
|
|
29
29
|
const BlockItem = React.memo(function BlockItem$1(t0) {
|
|
30
|
-
const $ = c(
|
|
30
|
+
const $ = c(105);
|
|
31
31
|
const { block, level } = t0;
|
|
32
32
|
const { t } = useTranslation();
|
|
33
33
|
const actions = useBlockEditorActions();
|
|
34
34
|
const blockSchema = useBlockSchema(block.type);
|
|
35
35
|
const values = useBlockValues(block.id);
|
|
36
36
|
const isExpanded = useIsBlockExpanded(block.id);
|
|
37
|
+
const isSelected = useIsBlockSelected(block.id);
|
|
37
38
|
const isUnknownType = !blockSchema;
|
|
38
39
|
const canHaveChildren = blockSchema?.allowChildren ?? false;
|
|
39
40
|
let t1;
|
|
@@ -129,63 +130,68 @@ const BlockItem = React.memo(function BlockItem$1(t0) {
|
|
|
129
130
|
$[25] = showDropIndicator;
|
|
130
131
|
$[26] = t11;
|
|
131
132
|
} else t11 = $[26];
|
|
132
|
-
const t12 =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
t13 = cn("gap-0 overflow-hidden p-0 transition-shadow", t12);
|
|
136
|
-
$[27] = t12;
|
|
137
|
-
$[28] = t13;
|
|
138
|
-
} else t13 = $[28];
|
|
139
|
-
let t14;
|
|
140
|
-
if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
|
|
141
|
-
t14 = cn("group flex cursor-pointer flex-row items-center gap-2 px-3 py-2 select-none", "hover:bg-muted transition-colors", "focus-visible:ring-ring/25 focus-visible:ring-3 focus-visible:outline-none focus-visible:ring-inset");
|
|
142
|
-
$[29] = t14;
|
|
143
|
-
} else t14 = $[29];
|
|
133
|
+
const t12 = `content._values.${block.id}`;
|
|
134
|
+
const t13 = isUnknownType && "border-destructive/50";
|
|
135
|
+
const t14 = isSelected && "border-primary ring-primary/20 ring-2";
|
|
144
136
|
let t15;
|
|
145
|
-
if ($[
|
|
146
|
-
t15 =
|
|
137
|
+
if ($[27] !== t13 || $[28] !== t14) {
|
|
138
|
+
t15 = cn("gap-0 overflow-hidden p-0 transition-[border-color,box-shadow]", t13, t14);
|
|
139
|
+
$[27] = t13;
|
|
140
|
+
$[28] = t14;
|
|
141
|
+
$[29] = t15;
|
|
142
|
+
} else t15 = $[29];
|
|
143
|
+
const t16 = isSelected && "bg-primary/5";
|
|
144
|
+
let t17;
|
|
145
|
+
if ($[30] !== t16) {
|
|
146
|
+
t17 = cn("group flex cursor-pointer flex-row items-center gap-2 px-3 py-2 select-none", "hover:bg-muted transition-colors", "focus-visible:ring-ring/25 focus-visible:ring-3 focus-visible:outline-none focus-visible:ring-inset", t16);
|
|
147
|
+
$[30] = t16;
|
|
148
|
+
$[31] = t17;
|
|
149
|
+
} else t17 = $[31];
|
|
150
|
+
let t18;
|
|
151
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
152
|
+
t18 = /* @__PURE__ */ jsx(Icon, {
|
|
147
153
|
icon: "ph:dots-six-vertical",
|
|
148
154
|
className: "text-muted-foreground h-4 w-4"
|
|
149
155
|
});
|
|
150
|
-
$[
|
|
151
|
-
} else
|
|
152
|
-
let
|
|
153
|
-
if ($[
|
|
154
|
-
|
|
156
|
+
$[32] = t18;
|
|
157
|
+
} else t18 = $[32];
|
|
158
|
+
let t19;
|
|
159
|
+
if ($[33] !== attributes || $[34] !== listeners) {
|
|
160
|
+
t19 = /* @__PURE__ */ jsx("button", {
|
|
155
161
|
type: "button",
|
|
156
162
|
"data-drag-handle": true,
|
|
157
163
|
className: "hover:bg-muted -ml-1 cursor-grab rounded p-1 active:cursor-grabbing",
|
|
158
164
|
...attributes,
|
|
159
165
|
...listeners,
|
|
160
166
|
onClick: _temp,
|
|
161
|
-
children:
|
|
167
|
+
children: t18
|
|
162
168
|
});
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
} else
|
|
167
|
-
const
|
|
168
|
-
let
|
|
169
|
-
if ($[
|
|
170
|
-
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
} else
|
|
174
|
-
let
|
|
175
|
-
if ($[
|
|
176
|
-
|
|
169
|
+
$[33] = attributes;
|
|
170
|
+
$[34] = listeners;
|
|
171
|
+
$[35] = t19;
|
|
172
|
+
} else t19 = $[35];
|
|
173
|
+
const t20 = isExpanded && "rotate-90";
|
|
174
|
+
let t21;
|
|
175
|
+
if ($[36] !== t20) {
|
|
176
|
+
t21 = cn("h-4 w-4 transition-transform duration-150 ease-in-out", t20);
|
|
177
|
+
$[36] = t20;
|
|
178
|
+
$[37] = t21;
|
|
179
|
+
} else t21 = $[37];
|
|
180
|
+
let t22;
|
|
181
|
+
if ($[38] !== t21) {
|
|
182
|
+
t22 = /* @__PURE__ */ jsx("div", {
|
|
177
183
|
className: "text-muted-foreground",
|
|
178
184
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
179
185
|
icon: "ph:caret-right",
|
|
180
|
-
className:
|
|
186
|
+
className: t21
|
|
181
187
|
})
|
|
182
188
|
});
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
} else
|
|
186
|
-
let
|
|
187
|
-
if ($[
|
|
188
|
-
|
|
189
|
+
$[38] = t21;
|
|
190
|
+
$[39] = t22;
|
|
191
|
+
} else t22 = $[39];
|
|
192
|
+
let t23;
|
|
193
|
+
if ($[40] !== blockSchema?.admin?.icon || $[41] !== isRoot || $[42] !== isUnknownType) {
|
|
194
|
+
t23 = isUnknownType ? /* @__PURE__ */ jsx(Icon, {
|
|
189
195
|
icon: "ph:warning",
|
|
190
196
|
className: "text-destructive h-3.5 w-3.5"
|
|
191
197
|
}) : /* @__PURE__ */ jsx(BlockIcon, {
|
|
@@ -193,50 +199,50 @@ const BlockItem = React.memo(function BlockItem$1(t0) {
|
|
|
193
199
|
size: 14,
|
|
194
200
|
className: isRoot ? "text-foreground" : "text-muted-foreground"
|
|
195
201
|
});
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
} else
|
|
201
|
-
const
|
|
202
|
-
let
|
|
203
|
-
if ($[
|
|
204
|
-
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
207
|
-
} else
|
|
208
|
-
let
|
|
209
|
-
if ($[
|
|
210
|
-
|
|
211
|
-
className:
|
|
202
|
+
$[40] = blockSchema?.admin?.icon;
|
|
203
|
+
$[41] = isRoot;
|
|
204
|
+
$[42] = isUnknownType;
|
|
205
|
+
$[43] = t23;
|
|
206
|
+
} else t23 = $[43];
|
|
207
|
+
const t24 = isUnknownType ? "text-destructive" : isRoot ? "text-foreground" : "text-foreground/90";
|
|
208
|
+
let t25;
|
|
209
|
+
if ($[44] !== t24) {
|
|
210
|
+
t25 = cn("truncate text-sm font-medium", t24);
|
|
211
|
+
$[44] = t24;
|
|
212
|
+
$[45] = t25;
|
|
213
|
+
} else t25 = $[45];
|
|
214
|
+
let t26;
|
|
215
|
+
if ($[46] !== blockLabel || $[47] !== t25) {
|
|
216
|
+
t26 = /* @__PURE__ */ jsx("span", {
|
|
217
|
+
className: t25,
|
|
212
218
|
children: blockLabel
|
|
213
219
|
});
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
} else
|
|
218
|
-
let
|
|
219
|
-
if ($[
|
|
220
|
-
|
|
220
|
+
$[46] = blockLabel;
|
|
221
|
+
$[47] = t25;
|
|
222
|
+
$[48] = t26;
|
|
223
|
+
} else t26 = $[48];
|
|
224
|
+
let t27;
|
|
225
|
+
if ($[49] !== values) {
|
|
226
|
+
t27 = values && /* @__PURE__ */ jsx("span", {
|
|
221
227
|
className: "text-muted-foreground hidden truncate text-xs sm:inline",
|
|
222
228
|
children: getPreviewText(values)
|
|
223
229
|
});
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
} else
|
|
227
|
-
let
|
|
228
|
-
if ($[
|
|
229
|
-
|
|
230
|
+
$[49] = values;
|
|
231
|
+
$[50] = t27;
|
|
232
|
+
} else t27 = $[50];
|
|
233
|
+
let t28;
|
|
234
|
+
if ($[51] !== t26 || $[52] !== t27) {
|
|
235
|
+
t28 = /* @__PURE__ */ jsxs("div", {
|
|
230
236
|
className: "flex min-w-0 flex-1 items-baseline gap-2",
|
|
231
|
-
children: [
|
|
237
|
+
children: [t26, t27]
|
|
232
238
|
});
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
} else
|
|
237
|
-
let
|
|
238
|
-
if ($[
|
|
239
|
-
|
|
239
|
+
$[51] = t26;
|
|
240
|
+
$[52] = t27;
|
|
241
|
+
$[53] = t28;
|
|
242
|
+
} else t28 = $[53];
|
|
243
|
+
let t29;
|
|
244
|
+
if ($[54] !== block.id || $[55] !== canHaveChildren || $[56] !== handleDuplicate || $[57] !== handleRemove) {
|
|
245
|
+
t29 = /* @__PURE__ */ jsx("div", {
|
|
240
246
|
"data-actions-menu": true,
|
|
241
247
|
children: /* @__PURE__ */ jsx(BlockItemDropdownMenu, {
|
|
242
248
|
blockId: block.id,
|
|
@@ -246,55 +252,58 @@ const BlockItem = React.memo(function BlockItem$1(t0) {
|
|
|
246
252
|
className: "h-7 w-7 opacity-0 transition-opacity group-hover:opacity-100"
|
|
247
253
|
})
|
|
248
254
|
});
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
252
|
-
$[
|
|
253
|
-
$[
|
|
254
|
-
} else
|
|
255
|
-
let
|
|
256
|
-
if ($[
|
|
257
|
-
|
|
255
|
+
$[54] = block.id;
|
|
256
|
+
$[55] = canHaveChildren;
|
|
257
|
+
$[56] = handleDuplicate;
|
|
258
|
+
$[57] = handleRemove;
|
|
259
|
+
$[58] = t29;
|
|
260
|
+
} else t29 = $[58];
|
|
261
|
+
let t30;
|
|
262
|
+
if ($[59] !== handleKeyDown || $[60] !== handleToggleExpand || $[61] !== isExpanded || $[62] !== t17 || $[63] !== t19 || $[64] !== t22 || $[65] !== t23 || $[66] !== t28 || $[67] !== t29) {
|
|
263
|
+
t30 = /* @__PURE__ */ jsxs(CardHeader, {
|
|
258
264
|
role: "button",
|
|
259
265
|
tabIndex: 0,
|
|
260
|
-
|
|
266
|
+
"aria-expanded": isExpanded,
|
|
267
|
+
className: t17,
|
|
261
268
|
onClick: handleToggleExpand,
|
|
262
269
|
onKeyDown: handleKeyDown,
|
|
263
270
|
children: [
|
|
264
|
-
t16,
|
|
265
271
|
t19,
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
272
|
+
t22,
|
|
273
|
+
t23,
|
|
274
|
+
t28,
|
|
275
|
+
t29
|
|
269
276
|
]
|
|
270
277
|
});
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
278
|
+
$[59] = handleKeyDown;
|
|
279
|
+
$[60] = handleToggleExpand;
|
|
280
|
+
$[61] = isExpanded;
|
|
281
|
+
$[62] = t17;
|
|
282
|
+
$[63] = t19;
|
|
283
|
+
$[64] = t22;
|
|
284
|
+
$[65] = t23;
|
|
285
|
+
$[66] = t28;
|
|
286
|
+
$[67] = t29;
|
|
287
|
+
$[68] = t30;
|
|
288
|
+
} else t30 = $[68];
|
|
289
|
+
let t31;
|
|
290
|
+
if ($[69] !== block.id || $[70] !== blockSchema || $[71] !== isExpanded || $[72] !== isRoot) {
|
|
291
|
+
t31 = isExpanded && blockSchema && /* @__PURE__ */ jsx(CardContent, {
|
|
283
292
|
className: cn("p-3", !isRoot && "py-2"),
|
|
284
293
|
children: /* @__PURE__ */ jsx(BlockFieldsRenderer, {
|
|
285
294
|
blockId: block.id,
|
|
286
295
|
blockSchema
|
|
287
296
|
})
|
|
288
297
|
});
|
|
289
|
-
$[
|
|
290
|
-
$[
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
} else
|
|
295
|
-
let
|
|
296
|
-
if ($[
|
|
297
|
-
|
|
298
|
+
$[69] = block.id;
|
|
299
|
+
$[70] = blockSchema;
|
|
300
|
+
$[71] = isExpanded;
|
|
301
|
+
$[72] = isRoot;
|
|
302
|
+
$[73] = t31;
|
|
303
|
+
} else t31 = $[73];
|
|
304
|
+
let t32;
|
|
305
|
+
if ($[74] !== block.type || $[75] !== isExpanded || $[76] !== isUnknownType || $[77] !== t) {
|
|
306
|
+
t32 = isExpanded && isUnknownType && /* @__PURE__ */ jsx(CardContent, {
|
|
298
307
|
className: "p-3",
|
|
299
308
|
children: /* @__PURE__ */ jsxs("div", {
|
|
300
309
|
className: "text-destructive flex items-center gap-2 text-sm",
|
|
@@ -304,31 +313,33 @@ const BlockItem = React.memo(function BlockItem$1(t0) {
|
|
|
304
313
|
}), /* @__PURE__ */ jsx("span", { children: t("blocks.unknownType", { type: block.type }) })]
|
|
305
314
|
})
|
|
306
315
|
});
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
} else
|
|
313
|
-
let
|
|
314
|
-
if ($[
|
|
315
|
-
|
|
316
|
-
|
|
316
|
+
$[74] = block.type;
|
|
317
|
+
$[75] = isExpanded;
|
|
318
|
+
$[76] = isUnknownType;
|
|
319
|
+
$[77] = t;
|
|
320
|
+
$[78] = t32;
|
|
321
|
+
} else t32 = $[78];
|
|
322
|
+
let t33;
|
|
323
|
+
if ($[79] !== t12 || $[80] !== t15 || $[81] !== t30 || $[82] !== t31 || $[83] !== t32) {
|
|
324
|
+
t33 = /* @__PURE__ */ jsxs(Card, {
|
|
325
|
+
"data-field-path": t12,
|
|
326
|
+
className: t15,
|
|
317
327
|
children: [
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
328
|
+
t30,
|
|
329
|
+
t31,
|
|
330
|
+
t32
|
|
321
331
|
]
|
|
322
332
|
});
|
|
323
|
-
$[
|
|
324
|
-
$[
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
333
|
+
$[79] = t12;
|
|
334
|
+
$[80] = t15;
|
|
335
|
+
$[81] = t30;
|
|
336
|
+
$[82] = t31;
|
|
337
|
+
$[83] = t32;
|
|
338
|
+
$[84] = t33;
|
|
339
|
+
} else t33 = $[84];
|
|
340
|
+
let t34;
|
|
341
|
+
if ($[85] !== block.children || $[86] !== block.id || $[87] !== canHaveChildren || $[88] !== isExpanded || $[89] !== level) {
|
|
342
|
+
t34 = canHaveChildren && isExpanded && block.children.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
332
343
|
className: "relative",
|
|
333
344
|
children: [/* @__PURE__ */ jsx("div", { className: "bg-border absolute top-0 bottom-0 left-3 w-px" }), /* @__PURE__ */ jsx("div", {
|
|
334
345
|
className: "space-y-2 pt-2 pl-8",
|
|
@@ -339,16 +350,16 @@ const BlockItem = React.memo(function BlockItem$1(t0) {
|
|
|
339
350
|
})
|
|
340
351
|
})]
|
|
341
352
|
});
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
$[
|
|
345
|
-
$[
|
|
346
|
-
$[
|
|
347
|
-
$[
|
|
348
|
-
} else
|
|
349
|
-
let
|
|
350
|
-
if ($[
|
|
351
|
-
|
|
353
|
+
$[85] = block.children;
|
|
354
|
+
$[86] = block.id;
|
|
355
|
+
$[87] = canHaveChildren;
|
|
356
|
+
$[88] = isExpanded;
|
|
357
|
+
$[89] = level;
|
|
358
|
+
$[90] = t34;
|
|
359
|
+
} else t34 = $[90];
|
|
360
|
+
let t35;
|
|
361
|
+
if ($[91] !== block.children || $[92] !== block.id || $[93] !== blockLabel || $[94] !== canHaveChildren || $[95] !== isExpanded) {
|
|
362
|
+
t35 = canHaveChildren && isExpanded && /* @__PURE__ */ jsxs("div", {
|
|
352
363
|
className: "relative mt-2 pl-8",
|
|
353
364
|
children: [
|
|
354
365
|
/* @__PURE__ */ jsx("div", { className: "bg-border absolute -top-2 left-3 h-[calc(50%+8px)] w-px" }),
|
|
@@ -363,36 +374,36 @@ const BlockItem = React.memo(function BlockItem$1(t0) {
|
|
|
363
374
|
})
|
|
364
375
|
]
|
|
365
376
|
});
|
|
366
|
-
$[
|
|
367
|
-
$[
|
|
368
|
-
$[
|
|
369
|
-
$[
|
|
370
|
-
$[
|
|
371
|
-
$[
|
|
372
|
-
} else
|
|
373
|
-
let
|
|
374
|
-
if ($[
|
|
375
|
-
|
|
377
|
+
$[91] = block.children;
|
|
378
|
+
$[92] = block.id;
|
|
379
|
+
$[93] = blockLabel;
|
|
380
|
+
$[94] = canHaveChildren;
|
|
381
|
+
$[95] = isExpanded;
|
|
382
|
+
$[96] = t35;
|
|
383
|
+
} else t35 = $[96];
|
|
384
|
+
let t36;
|
|
385
|
+
if ($[97] !== setNodeRef || $[98] !== style || $[99] !== t10 || $[100] !== t11 || $[101] !== t33 || $[102] !== t34 || $[103] !== t35) {
|
|
386
|
+
t36 = /* @__PURE__ */ jsxs("div", {
|
|
376
387
|
ref: setNodeRef,
|
|
377
388
|
style,
|
|
378
389
|
className: t10,
|
|
379
390
|
children: [
|
|
380
391
|
t11,
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
392
|
+
t33,
|
|
393
|
+
t34,
|
|
394
|
+
t35
|
|
384
395
|
]
|
|
385
396
|
});
|
|
386
|
-
$[
|
|
387
|
-
$[
|
|
388
|
-
$[
|
|
389
|
-
$[
|
|
390
|
-
$[
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
394
|
-
} else
|
|
395
|
-
return
|
|
397
|
+
$[97] = setNodeRef;
|
|
398
|
+
$[98] = style;
|
|
399
|
+
$[99] = t10;
|
|
400
|
+
$[100] = t11;
|
|
401
|
+
$[101] = t33;
|
|
402
|
+
$[102] = t34;
|
|
403
|
+
$[103] = t35;
|
|
404
|
+
$[104] = t36;
|
|
405
|
+
} else t36 = $[104];
|
|
406
|
+
return t36;
|
|
396
407
|
}, areBlockItemPropsEqual);
|
|
397
408
|
function getBlockLabel(block, blockSchema, values) {
|
|
398
409
|
if (values) {
|
|
@@ -19,6 +19,18 @@ function findBlockById(tree, id) {
|
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
+
* Find the path of block IDs from root to the target block.
|
|
23
|
+
*/
|
|
24
|
+
function getBlockPathIds(tree, id) {
|
|
25
|
+
for (const node of tree) {
|
|
26
|
+
const nextPath = [node.id];
|
|
27
|
+
if (node.id === id) return nextPath;
|
|
28
|
+
const childPath = getBlockPathIds(node.children, id);
|
|
29
|
+
if (childPath) return [...nextPath, ...childPath];
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
22
34
|
* Find a block's position (parent and index) in the tree.
|
|
23
35
|
*/
|
|
24
36
|
function findBlockPosition(tree, id, parentId = null) {
|
|
@@ -182,4 +194,4 @@ function getDefaultValues(fields) {
|
|
|
182
194
|
}
|
|
183
195
|
|
|
184
196
|
//#endregion
|
|
185
|
-
export { countBlocks, duplicateBlockInTree, findBlockById, findBlockPosition, getAllBlockIds, getDefaultValues, insertBlockInTree, removeBlockFromTree, reorderBlockInTree };
|
|
197
|
+
export { countBlocks, duplicateBlockInTree, findBlockById, findBlockPosition, getAllBlockIds, getBlockPathIds, getDefaultValues, insertBlockInTree, removeBlockFromTree, reorderBlockInTree };
|