@duke333/builder-ui 0.1.4 → 0.1.5
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 +7 -0
- package/dist/{BuilderAdminPages-Buy2nvjs.d.ts → BuilderAdminPages-C-jaMLOa.d.ts} +6 -0
- package/dist/{RuntimeEntryDialog-DAO74GFp.d.ts → RuntimeEntryDialog-Bw741XbS.d.ts} +12 -5
- package/dist/admin/index.d.ts +2 -2
- package/dist/admin/index.js +30 -3
- package/dist/admin/index.js.map +1 -1
- package/dist/components/index.d.ts +5 -3
- package/dist/components/index.js +53 -25
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +76 -8
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/index.js +30 -3
- package/dist/integration/index.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -1
- package/dist/runtime/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -128,11 +128,13 @@ function builderFormEditorValuesFromEntity(form, emptyValues) {
|
|
|
128
128
|
parentField: subform.parentField,
|
|
129
129
|
childField: subform.childField,
|
|
130
130
|
buttonLabel: subform.buttonLabel ?? "",
|
|
131
|
-
icon: subform.icon ?? ""
|
|
131
|
+
icon: subform.icon ?? "",
|
|
132
|
+
presentation: subform.presentation ?? "dialog"
|
|
132
133
|
}));
|
|
133
134
|
return {
|
|
134
135
|
title: form.title,
|
|
135
136
|
description: form.description ?? "",
|
|
137
|
+
presentation: form.schema.presentation ?? "dialog",
|
|
136
138
|
sourceType: source?.type ?? "none",
|
|
137
139
|
sourceTable: source?.type === "dbTable" ? source.tableName : BUILDER_EDITOR_NONE_VALUE,
|
|
138
140
|
apiBasePath: source?.type === "apiEndpoint" ? source.basePath : "",
|
|
@@ -214,6 +216,7 @@ function builderFormEditorInputFromValues(values) {
|
|
|
214
216
|
description: values.description || null,
|
|
215
217
|
source,
|
|
216
218
|
schema: {
|
|
219
|
+
presentation: values.presentation ?? "dialog",
|
|
217
220
|
fields: values.fields.map((field) => ({
|
|
218
221
|
key: field.key,
|
|
219
222
|
label: field.label,
|
|
@@ -258,7 +261,8 @@ function builderFormEditorInputFromValues(values) {
|
|
|
258
261
|
parentField: subform.parentField,
|
|
259
262
|
childField: subform.childField,
|
|
260
263
|
buttonLabel: subform.buttonLabel?.trim() || void 0,
|
|
261
|
-
icon: subform.icon?.trim() || void 0
|
|
264
|
+
icon: subform.icon?.trim() || void 0,
|
|
265
|
+
presentation: subform.presentation ?? "dialog"
|
|
262
266
|
}))
|
|
263
267
|
},
|
|
264
268
|
triggers: values.triggers.map((trigger) => ({
|
|
@@ -463,6 +467,13 @@ function createBuilderDefaultFormEditorBody(options) {
|
|
|
463
467
|
/* @__PURE__ */ jsx("span", { style: styles.label, children: "Description" }),
|
|
464
468
|
/* @__PURE__ */ jsx("input", { style: styles.input, ...form.register("description") })
|
|
465
469
|
] }),
|
|
470
|
+
/* @__PURE__ */ jsxs("label", { style: styles.field, children: [
|
|
471
|
+
/* @__PURE__ */ jsx("span", { style: styles.label, children: "Presentation" }),
|
|
472
|
+
/* @__PURE__ */ jsxs("select", { style: styles.input, ...form.register("presentation"), children: [
|
|
473
|
+
/* @__PURE__ */ jsx("option", { value: "dialog", children: "Dialog" }),
|
|
474
|
+
/* @__PURE__ */ jsx("option", { value: "drawer", children: "Drawer" })
|
|
475
|
+
] })
|
|
476
|
+
] }),
|
|
466
477
|
/* @__PURE__ */ jsxs("label", { style: styles.field, children: [
|
|
467
478
|
/* @__PURE__ */ jsx("span", { style: styles.label, children: "Datasource" }),
|
|
468
479
|
/* @__PURE__ */ jsxs("select", { style: styles.input, ...form.register("sourceType"), children: [
|
|
@@ -644,7 +655,8 @@ function createBuilderDefaultFormEditorBody(options) {
|
|
|
644
655
|
parentField: "id",
|
|
645
656
|
childField: "parentId",
|
|
646
657
|
buttonLabel: "",
|
|
647
|
-
icon: ""
|
|
658
|
+
icon: "",
|
|
659
|
+
presentation: "dialog"
|
|
648
660
|
}),
|
|
649
661
|
children: "Add subform"
|
|
650
662
|
}
|
|
@@ -671,6 +683,20 @@ function createBuilderDefaultFormEditorBody(options) {
|
|
|
671
683
|
/* @__PURE__ */ jsx("span", { style: styles.label, children: "Child field" }),
|
|
672
684
|
/* @__PURE__ */ jsx("input", { style: styles.input, ...form.register(`subforms.${index}.childField`) })
|
|
673
685
|
] }),
|
|
686
|
+
/* @__PURE__ */ jsxs("label", { style: styles.field, children: [
|
|
687
|
+
/* @__PURE__ */ jsx("span", { style: styles.label, children: "Presentation" }),
|
|
688
|
+
/* @__PURE__ */ jsxs(
|
|
689
|
+
"select",
|
|
690
|
+
{
|
|
691
|
+
style: styles.input,
|
|
692
|
+
...form.register(`subforms.${index}.presentation`),
|
|
693
|
+
children: [
|
|
694
|
+
/* @__PURE__ */ jsx("option", { value: "dialog", children: "Dialog" }),
|
|
695
|
+
/* @__PURE__ */ jsx("option", { value: "drawer", children: "Drawer" })
|
|
696
|
+
]
|
|
697
|
+
}
|
|
698
|
+
)
|
|
699
|
+
] }),
|
|
674
700
|
/* @__PURE__ */ jsx("button", { type: "button", style: styles.button, onClick: () => subformArray.remove(index), children: "Remove" })
|
|
675
701
|
] }, subform.id))
|
|
676
702
|
] }),
|
|
@@ -1534,6 +1560,7 @@ function createBuilderAdminPages({
|
|
|
1534
1560
|
const emptyFormValues = {
|
|
1535
1561
|
title: "",
|
|
1536
1562
|
description: "",
|
|
1563
|
+
presentation: "dialog",
|
|
1537
1564
|
sourceType: "none",
|
|
1538
1565
|
sourceTable: BUILDER_EDITOR_NONE_VALUE,
|
|
1539
1566
|
apiBasePath: "",
|
|
@@ -2349,6 +2376,15 @@ function createDynamicListComponent(deps) {
|
|
|
2349
2376
|
// src/components/DynamicView.tsx
|
|
2350
2377
|
import { useMemo as useMemo6, useState as useState3 } from "react";
|
|
2351
2378
|
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2379
|
+
var interactiveRowTargetSelector = "button,a,input,select,textarea,[role='button'],[role='menuitem'],[data-builder-row-action]";
|
|
2380
|
+
function hasClosest(target) {
|
|
2381
|
+
return typeof target === "object" && target !== null && "closest" in target && typeof target.closest === "function";
|
|
2382
|
+
}
|
|
2383
|
+
function shouldHandleDynamicViewRowClick(event) {
|
|
2384
|
+
if (!event) return true;
|
|
2385
|
+
if (event.defaultPrevented) return false;
|
|
2386
|
+
return !hasClosest(event.target) || !event.target.closest(interactiveRowTargetSelector);
|
|
2387
|
+
}
|
|
2352
2388
|
function createDynamicViewComponent(deps) {
|
|
2353
2389
|
return function DynamicView({ viewId }) {
|
|
2354
2390
|
const [editing, setEditing] = useState3(null);
|
|
@@ -2362,11 +2398,15 @@ function createDynamicViewComponent(deps) {
|
|
|
2362
2398
|
const view = viewQuery.data;
|
|
2363
2399
|
const columns = useMemo6(
|
|
2364
2400
|
() => view ? deps.buildColumns(view, {
|
|
2365
|
-
onEdit: (entry) => {
|
|
2401
|
+
onEdit: (entry, event) => {
|
|
2402
|
+
event?.stopPropagation?.();
|
|
2366
2403
|
setEditing(entry);
|
|
2367
2404
|
setDialogOpen(true);
|
|
2368
2405
|
},
|
|
2369
|
-
onDelete:
|
|
2406
|
+
onDelete: (entry, event) => {
|
|
2407
|
+
event?.stopPropagation?.();
|
|
2408
|
+
setPendingDelete(entry);
|
|
2409
|
+
}
|
|
2370
2410
|
}) : [],
|
|
2371
2411
|
[view]
|
|
2372
2412
|
);
|
|
@@ -2397,7 +2437,8 @@ function createDynamicViewComponent(deps) {
|
|
|
2397
2437
|
searchPlaceholder: "\u041C\u04E9\u0440 \u0445\u0430\u0439\u0445...",
|
|
2398
2438
|
emptyTitle: "\u041C\u04E9\u0440 \u0430\u043B\u0433\u0430",
|
|
2399
2439
|
emptyDescription: "\u042D\u043D\u044D view \u0434\u044D\u044D\u0440 \u044D\u0445\u043D\u0438\u0439 \u043C\u04E9\u0440\u04E9\u04E9 \u043D\u044D\u043C\u044D\u044D\u0440\u044D\u0439.",
|
|
2400
|
-
onRowClick: (entry) => {
|
|
2440
|
+
onRowClick: (entry, event) => {
|
|
2441
|
+
if (!shouldHandleDynamicViewRowClick(event)) return;
|
|
2401
2442
|
setEditing(entry);
|
|
2402
2443
|
setDialogOpen(true);
|
|
2403
2444
|
},
|
|
@@ -2560,6 +2601,7 @@ function createRuntimeEntryDialogComponent(deps) {
|
|
|
2560
2601
|
deps.DialogShell,
|
|
2561
2602
|
{
|
|
2562
2603
|
open,
|
|
2604
|
+
presentation: view.form?.schema.presentation ?? "dialog",
|
|
2563
2605
|
title: editing ? "\u041C\u04E9\u0440 \u0437\u0430\u0441\u0430\u0445" : "\u041C\u04E9\u0440 \u043D\u044D\u043C\u044D\u0445",
|
|
2564
2606
|
description: view.title,
|
|
2565
2607
|
onClose,
|
|
@@ -2936,11 +2978,34 @@ function createBuilderIntegration(config) {
|
|
|
2936
2978
|
adminPages
|
|
2937
2979
|
};
|
|
2938
2980
|
}
|
|
2981
|
+
function createBuilderPortalIntegration(config) {
|
|
2982
|
+
return createBuilderIntegration(config);
|
|
2983
|
+
}
|
|
2984
|
+
function validateBuilderFrontendSetup(config) {
|
|
2985
|
+
const checks = [
|
|
2986
|
+
{
|
|
2987
|
+
name: "adminBasePath",
|
|
2988
|
+
ok: Boolean(config.adminBasePath && normalizeBasePath(config.adminBasePath).startsWith("/")),
|
|
2989
|
+
message: "adminBasePath must be an absolute route path."
|
|
2990
|
+
},
|
|
2991
|
+
{
|
|
2992
|
+
name: "runtimeBasePath",
|
|
2993
|
+
ok: Boolean(config.runtimeBasePath && normalizeBasePath(config.runtimeBasePath).startsWith("/")),
|
|
2994
|
+
message: "runtimeBasePath must be an absolute route path."
|
|
2995
|
+
},
|
|
2996
|
+
{
|
|
2997
|
+
name: "transport",
|
|
2998
|
+
ok: Boolean(config.transport),
|
|
2999
|
+
message: "API transport is required."
|
|
3000
|
+
}
|
|
3001
|
+
].map((check) => check.ok ? { name: check.name, ok: true } : check);
|
|
3002
|
+
return { ok: checks.every((check) => check.ok), checks };
|
|
3003
|
+
}
|
|
2939
3004
|
|
|
2940
3005
|
// src/index.ts
|
|
2941
3006
|
var builderUiPackage = {
|
|
2942
3007
|
name: "@duke333/builder-ui",
|
|
2943
|
-
version: "0.1.
|
|
3008
|
+
version: "0.1.5"
|
|
2944
3009
|
};
|
|
2945
3010
|
export {
|
|
2946
3011
|
BUILDER_EDITOR_NONE_VALUE,
|
|
@@ -2974,6 +3039,7 @@ export {
|
|
|
2974
3039
|
createBuilderIntegration,
|
|
2975
3040
|
createBuilderKeys,
|
|
2976
3041
|
createBuilderListEditorPageComponent,
|
|
3042
|
+
createBuilderPortalIntegration,
|
|
2977
3043
|
createBuilderViewDialogComponent,
|
|
2978
3044
|
createDynamicFormComponent,
|
|
2979
3045
|
createDynamicListComponent,
|
|
@@ -2984,7 +3050,9 @@ export {
|
|
|
2984
3050
|
nextBuilderFormLayoutGroupId,
|
|
2985
3051
|
parseBuilderFormLayoutDragPayload,
|
|
2986
3052
|
serializeBuilderFormLayoutDragPayload,
|
|
3053
|
+
shouldHandleDynamicViewRowClick,
|
|
2987
3054
|
swapBuilderFormLayoutItems,
|
|
2988
|
-
useBuilderFormLayoutEditor
|
|
3055
|
+
useBuilderFormLayoutEditor,
|
|
3056
|
+
validateBuilderFrontendSetup
|
|
2989
3057
|
};
|
|
2990
3058
|
//# sourceMappingURL=index.js.map
|