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