@duke333/builder-ui 0.2.0 → 0.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/admin/index.js +2 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +61 -51
- package/dist/index.js.map +1 -1
- package/dist/integration/index.js +2 -0
- package/dist/integration/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
// src/ready/BuilderProvider.tsx
|
|
2
4
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
5
|
import {
|
|
@@ -466,7 +468,7 @@ function builderErrorMessage(error, fallback) {
|
|
|
466
468
|
}
|
|
467
469
|
|
|
468
470
|
// src/ready/BuilderRuntimeComponents.tsx
|
|
469
|
-
import { useMemo as useMemo4, useState as
|
|
471
|
+
import { useMemo as useMemo4, useState as useState5 } from "react";
|
|
470
472
|
import { FormProvider as FormProvider2, useForm as useForm2 } from "react-hook-form";
|
|
471
473
|
|
|
472
474
|
// src/runtime/runtimeUtils.ts
|
|
@@ -591,7 +593,8 @@ function ReadyFields({ formId, viewId, schema, extraItems = [] }) {
|
|
|
591
593
|
}
|
|
592
594
|
|
|
593
595
|
// src/ready/ReadyOverlay.tsx
|
|
594
|
-
import { useEffect, useId, useRef as useRef3 } from "react";
|
|
596
|
+
import { useEffect, useId, useRef as useRef3, useState as useState2 } from "react";
|
|
597
|
+
import { createPortal } from "react-dom";
|
|
595
598
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
596
599
|
function ReadyOverlay({
|
|
597
600
|
open,
|
|
@@ -603,10 +606,14 @@ function ReadyOverlay({
|
|
|
603
606
|
}) {
|
|
604
607
|
const panelRef = useRef3(null);
|
|
605
608
|
const onCloseRef = useRef3(onClose);
|
|
609
|
+
const [portalRoot, setPortalRoot] = useState2(null);
|
|
606
610
|
onCloseRef.current = onClose;
|
|
607
611
|
const titleId = useId();
|
|
608
612
|
useEffect(() => {
|
|
609
|
-
|
|
613
|
+
setPortalRoot(document.body);
|
|
614
|
+
}, []);
|
|
615
|
+
useEffect(() => {
|
|
616
|
+
if (!open || !portalRoot) return;
|
|
610
617
|
const previous = document.activeElement;
|
|
611
618
|
panelRef.current?.focus();
|
|
612
619
|
const onKeyDown = (event) => {
|
|
@@ -636,29 +643,32 @@ function ReadyOverlay({
|
|
|
636
643
|
document.body.style.overflow = overflow;
|
|
637
644
|
previous?.focus();
|
|
638
645
|
};
|
|
639
|
-
}, [open]);
|
|
640
|
-
if (!open) return null;
|
|
641
|
-
return
|
|
642
|
-
"div",
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
/* @__PURE__ */ jsxs3("
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
|
|
646
|
+
}, [open, portalRoot]);
|
|
647
|
+
if (!open || !portalRoot) return null;
|
|
648
|
+
return createPortal(
|
|
649
|
+
/* @__PURE__ */ jsx3("div", { className: "builder-overlay", role: "presentation", onMouseDown: (event) => event.target === event.currentTarget && onClose(), children: /* @__PURE__ */ jsxs3(
|
|
650
|
+
"div",
|
|
651
|
+
{
|
|
652
|
+
ref: panelRef,
|
|
653
|
+
className: `builder-overlay__panel builder-overlay__panel--${presentation}`,
|
|
654
|
+
role: "dialog",
|
|
655
|
+
"aria-modal": "true",
|
|
656
|
+
"aria-labelledby": titleId,
|
|
657
|
+
tabIndex: -1,
|
|
658
|
+
children: [
|
|
659
|
+
/* @__PURE__ */ jsxs3("header", { className: "builder-overlay__header", children: [
|
|
660
|
+
/* @__PURE__ */ jsxs3("div", { children: [
|
|
661
|
+
/* @__PURE__ */ jsx3("h2", { id: titleId, className: "builder-title", children: title }),
|
|
662
|
+
description ? /* @__PURE__ */ jsx3("p", { className: "builder-description", children: description }) : null
|
|
663
|
+
] }),
|
|
664
|
+
/* @__PURE__ */ jsx3("button", { type: "button", className: "builder-icon-button", "aria-label": "\u0425\u0430\u0430\u0445", onClick: onClose, children: "\xD7" })
|
|
655
665
|
] }),
|
|
656
|
-
/* @__PURE__ */ jsx3("
|
|
657
|
-
]
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
)
|
|
666
|
+
/* @__PURE__ */ jsx3("div", { className: "builder-overlay__body", children })
|
|
667
|
+
]
|
|
668
|
+
}
|
|
669
|
+
) }),
|
|
670
|
+
portalRoot
|
|
671
|
+
);
|
|
662
672
|
}
|
|
663
673
|
function ReadyConfirmDialog({
|
|
664
674
|
open,
|
|
@@ -682,16 +692,16 @@ function ReadyErrorState({ title, description }) {
|
|
|
682
692
|
}
|
|
683
693
|
|
|
684
694
|
// src/ready/ReadySubform.tsx
|
|
685
|
-
import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef4, useState as
|
|
695
|
+
import { useEffect as useEffect2, useMemo as useMemo3, useRef as useRef4, useState as useState4 } from "react";
|
|
686
696
|
import { FormProvider, useForm } from "react-hook-form";
|
|
687
697
|
|
|
688
698
|
// src/ready/ReadyTable.tsx
|
|
689
|
-
import { useMemo as useMemo2, useState as
|
|
699
|
+
import { useMemo as useMemo2, useState as useState3 } from "react";
|
|
690
700
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
691
701
|
function useReadyTableState({ pageSize = 20 } = {}) {
|
|
692
|
-
const [page, setPage] =
|
|
693
|
-
const [search, setSearchValue] =
|
|
694
|
-
const [sort, setSort] =
|
|
702
|
+
const [page, setPage] = useState3(1);
|
|
703
|
+
const [search, setSearchValue] = useState3("");
|
|
704
|
+
const [sort, setSort] = useState3();
|
|
695
705
|
return {
|
|
696
706
|
query: { page, pageSize, search: search || void 0, sort },
|
|
697
707
|
page,
|
|
@@ -710,7 +720,7 @@ function useReadyTableState({ pageSize = 20 } = {}) {
|
|
|
710
720
|
};
|
|
711
721
|
}
|
|
712
722
|
function useReadyTable(args) {
|
|
713
|
-
const [selectedIds, setSelectedIds] =
|
|
723
|
+
const [selectedIds, setSelectedIds] = useState3([]);
|
|
714
724
|
return useMemo2(
|
|
715
725
|
() => ({
|
|
716
726
|
...args,
|
|
@@ -843,8 +853,8 @@ function makeDraftEntry(viewId, values, editing) {
|
|
|
843
853
|
}
|
|
844
854
|
function ReadySubform({ subform, parentEntry, rows, onRowsChange }) {
|
|
845
855
|
const { hooks, notify } = useBuilderRuntime();
|
|
846
|
-
const [open, setOpen] =
|
|
847
|
-
const [editing, setEditing] =
|
|
856
|
+
const [open, setOpen] = useState4(false);
|
|
857
|
+
const [editing, setEditing] = useState4(null);
|
|
848
858
|
const initialized = useRef4(false);
|
|
849
859
|
const parentValue = linkedValue(parentEntry, subform.parentField);
|
|
850
860
|
const viewQuery = hooks.useRuntimeBuilderView(subform.viewId, Boolean(subform.viewId));
|
|
@@ -998,7 +1008,7 @@ function childPayload(row, includeIdentity) {
|
|
|
998
1008
|
}
|
|
999
1009
|
function BuilderEntryEditor({ view, editing, open, onClose }) {
|
|
1000
1010
|
const { hooks, notify } = useBuilderRuntime();
|
|
1001
|
-
const [subforms, setSubforms] =
|
|
1011
|
+
const [subforms, setSubforms] = useState5({});
|
|
1002
1012
|
const save = hooks.useSaveBuilderViewEntry(view.id);
|
|
1003
1013
|
const createComposite = hooks.useCreateCompositeBuilderViewEntry(view.id);
|
|
1004
1014
|
const updateComposite = hooks.useUpdateCompositeBuilderViewEntry(view.id);
|
|
@@ -1041,9 +1051,9 @@ function BuilderEntryEditor({ view, editing, open, onClose }) {
|
|
|
1041
1051
|
}
|
|
1042
1052
|
function BuilderView({ viewId }) {
|
|
1043
1053
|
const { hooks, notify } = useBuilderRuntime();
|
|
1044
|
-
const [editing, setEditing] =
|
|
1045
|
-
const [editorOpen, setEditorOpen] =
|
|
1046
|
-
const [pendingDelete, setPendingDelete] =
|
|
1054
|
+
const [editing, setEditing] = useState5(null);
|
|
1055
|
+
const [editorOpen, setEditorOpen] = useState5(false);
|
|
1056
|
+
const [pendingDelete, setPendingDelete] = useState5(null);
|
|
1047
1057
|
const viewQuery = hooks.useRuntimeBuilderView(viewId);
|
|
1048
1058
|
const state = useReadyTableState();
|
|
1049
1059
|
const entriesQuery = hooks.useBuilderViewEntries(viewId, state.query);
|
|
@@ -2018,7 +2028,7 @@ function createBuilderDefaultListEditorBody(options) {
|
|
|
2018
2028
|
}
|
|
2019
2029
|
|
|
2020
2030
|
// src/admin/BuilderDefaultEntityManager.tsx
|
|
2021
|
-
import { useMemo as useMemo5, useState as
|
|
2031
|
+
import { useMemo as useMemo5, useState as useState6 } from "react";
|
|
2022
2032
|
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2023
2033
|
var styles2 = {
|
|
2024
2034
|
page: {
|
|
@@ -2115,7 +2125,7 @@ var styles2 = {
|
|
|
2115
2125
|
};
|
|
2116
2126
|
function createBuilderDefaultEntityManagerComponent(deps) {
|
|
2117
2127
|
return function BuilderDefaultEntityManager() {
|
|
2118
|
-
const [state, setState] =
|
|
2128
|
+
const [state, setState] = useState6({
|
|
2119
2129
|
page: 1,
|
|
2120
2130
|
pageSize: 20,
|
|
2121
2131
|
search: ""
|
|
@@ -2938,11 +2948,11 @@ function createBuilderAdminPages({
|
|
|
2938
2948
|
}
|
|
2939
2949
|
|
|
2940
2950
|
// src/admin/BuilderEntityManager.tsx
|
|
2941
|
-
import { useCallback as useCallback2, useMemo as useMemo6, useState as
|
|
2951
|
+
import { useCallback as useCallback2, useMemo as useMemo6, useState as useState7 } from "react";
|
|
2942
2952
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2943
2953
|
function createBuilderEntityManagerComponent(deps) {
|
|
2944
2954
|
return function BuilderEntityManager() {
|
|
2945
|
-
const [pendingDelete, setPendingDelete] =
|
|
2955
|
+
const [pendingDelete, setPendingDelete] = useState7(null);
|
|
2946
2956
|
const state = deps.useDataTableState({ pageSize: 20 });
|
|
2947
2957
|
const query = deps.hooks.useEntities(state.query);
|
|
2948
2958
|
const remove = deps.hooks.useDelete();
|
|
@@ -3002,9 +3012,9 @@ function createBuilderEntityManagerComponent(deps) {
|
|
|
3002
3012
|
}
|
|
3003
3013
|
function createBuilderEntityDialogManagerComponent(deps) {
|
|
3004
3014
|
return function BuilderEntityDialogManager() {
|
|
3005
|
-
const [editing, setEditing] =
|
|
3006
|
-
const [isEditorOpen, setEditorOpen] =
|
|
3007
|
-
const [pendingDelete, setPendingDelete] =
|
|
3015
|
+
const [editing, setEditing] = useState7(null);
|
|
3016
|
+
const [isEditorOpen, setEditorOpen] = useState7(false);
|
|
3017
|
+
const [pendingDelete, setPendingDelete] = useState7(null);
|
|
3008
3018
|
const state = deps.useDataTableState({ pageSize: 20 });
|
|
3009
3019
|
const query = deps.hooks.useEntities(state.query);
|
|
3010
3020
|
const remove = deps.hooks.useDelete();
|
|
@@ -3374,7 +3384,7 @@ function createDynamicListComponent(deps) {
|
|
|
3374
3384
|
}
|
|
3375
3385
|
|
|
3376
3386
|
// src/components/DynamicView.tsx
|
|
3377
|
-
import { useMemo as useMemo10, useState as
|
|
3387
|
+
import { useMemo as useMemo10, useState as useState8 } from "react";
|
|
3378
3388
|
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3379
3389
|
var interactiveRowTargetSelector = "button,a,input,select,textarea,[role='button'],[role='menuitem'],[data-builder-row-action]";
|
|
3380
3390
|
function hasClosest(target) {
|
|
@@ -3387,9 +3397,9 @@ function shouldHandleDynamicViewRowClick(event) {
|
|
|
3387
3397
|
}
|
|
3388
3398
|
function createDynamicViewComponent(deps) {
|
|
3389
3399
|
return function DynamicView({ viewId }) {
|
|
3390
|
-
const [editing, setEditing] =
|
|
3391
|
-
const [isDialogOpen, setDialogOpen] =
|
|
3392
|
-
const [pendingDelete, setPendingDelete] =
|
|
3400
|
+
const [editing, setEditing] = useState8(null);
|
|
3401
|
+
const [isDialogOpen, setDialogOpen] = useState8(false);
|
|
3402
|
+
const [pendingDelete, setPendingDelete] = useState8(null);
|
|
3393
3403
|
const viewQuery = deps.hooks.useRuntimeBuilderView(viewId);
|
|
3394
3404
|
const state = deps.useDataTableState({ pageSize: 20 });
|
|
3395
3405
|
const entriesQuery = deps.hooks.useBuilderViewEntries(viewId, state.query);
|
|
@@ -3483,7 +3493,7 @@ function createDynamicViewComponent(deps) {
|
|
|
3483
3493
|
}
|
|
3484
3494
|
|
|
3485
3495
|
// src/components/RuntimeEntryDialog.tsx
|
|
3486
|
-
import { useEffect as useEffect6, useMemo as useMemo11, useState as
|
|
3496
|
+
import { useEffect as useEffect6, useMemo as useMemo11, useState as useState9 } from "react";
|
|
3487
3497
|
import { FormProvider as FormProvider6, useForm as useForm7 } from "react-hook-form";
|
|
3488
3498
|
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3489
3499
|
function isDbTableSource(source) {
|
|
@@ -3518,7 +3528,7 @@ function createRuntimeEntryDialogComponent(deps) {
|
|
|
3518
3528
|
onSave,
|
|
3519
3529
|
isSaving
|
|
3520
3530
|
}) {
|
|
3521
|
-
const [draftSubforms, setDraftSubforms] =
|
|
3531
|
+
const [draftSubforms, setDraftSubforms] = useState9({});
|
|
3522
3532
|
const compositeCreate = deps.useCreateCompositeEntry?.(view.id);
|
|
3523
3533
|
const compositeUpdate = deps.useUpdateCompositeEntry?.(view.id);
|
|
3524
3534
|
const form = useForm7({
|
|
@@ -3704,7 +3714,7 @@ function validateBuilderFrontendSetup(config) {
|
|
|
3704
3714
|
// src/index.ts
|
|
3705
3715
|
var builderUiPackage = {
|
|
3706
3716
|
name: "@duke333/builder-ui",
|
|
3707
|
-
version: "0.2.
|
|
3717
|
+
version: "0.2.2"
|
|
3708
3718
|
};
|
|
3709
3719
|
export {
|
|
3710
3720
|
BUILDER_EDITOR_NONE_VALUE,
|