@duke333/builder-ui 0.1.1 → 0.1.3
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 +38 -120
- package/dist/BuilderAdminPages-Buy2nvjs.d.ts +592 -0
- package/dist/admin/index.d.ts +7 -590
- package/dist/admin/index.js +39 -21
- package/dist/admin/index.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +61 -36
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +27 -2
- package/dist/integration/index.js +1843 -11
- package/dist/integration/index.js.map +1 -1
- package/package.json +17 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { BUILDER_EDITOR_NONE_VALUE, BuilderAdminPageContracts, BuilderAdminPagesOptions, BuilderAdminPagesRoutes, BuilderDefaultEntity, BuilderDefaultEntityListResult, BuilderDefaultEntityManagerDependencies, BuilderDefaultEntityManagerLabels, BuilderDefaultEntityManagerState, BuilderDefaultEntityMutation, BuilderDefaultEntityQueryResult, BuilderDefaultFormEditorBodyOptions, BuilderDefaultListEditorBodyOptions, BuilderDefaultOption,
|
|
1
|
+
export { B as BUILDER_EDITOR_NONE_VALUE, a as BuilderAdminPageContracts, b as BuilderAdminPagesOptions, c as BuilderAdminPagesRoutes, d as BuilderDefaultEntity, e as BuilderDefaultEntityListResult, f as BuilderDefaultEntityManagerDependencies, g as BuilderDefaultEntityManagerLabels, h as BuilderDefaultEntityManagerState, i as BuilderDefaultEntityMutation, j as BuilderDefaultEntityQueryResult, k as BuilderDefaultFormEditorBodyOptions, l as BuilderDefaultListEditorBodyOptions, m as BuilderDefaultOption, n as BuilderEditorDbTable, o as BuilderEditorSelectOption, p as BuilderEditorTriggerValues, q as BuilderFormEditorBodyProps, r as BuilderFormEditorEntity, s as BuilderFormEditorFieldValues, t as BuilderFormEditorPageDependencies, u as BuilderFormEditorValues, v as BuilderListEditorBodyProps, w as BuilderListEditorColumnValues, x as BuilderListEditorEntity, y as BuilderListEditorPageDependencies, z as BuilderListEditorValues, A as BuilderViewEditorEntity, C as BuilderViewEditorValues, D as builderEditorOptionsToText, E as builderEditorSearchFieldsToText, F as builderEditorTextToOptions, G as builderEditorTextToSearchFields, H as builderFormEditorFieldsFromTable, I as builderFormEditorInputFromValues, J as builderFormEditorValuesFromEntity, K as builderListEditorColumnsFromTable, L as builderListEditorInputFromValues, M as builderListEditorValuesFromEntity, N as builderViewEditorInputFromValues, O as builderViewEditorValuesFromEntity, P as createBuilderAdminPages, Q as createBuilderDefaultEntityManagerComponent, R as createBuilderDefaultFormEditorBody, S as createBuilderDefaultListEditorBody, T as createBuilderFormEditorPageComponent, U as createBuilderListEditorPageComponent, V as getBuilderEditorTriggerRoute } from './BuilderAdminPages-Buy2nvjs.js';
|
|
2
|
+
export { BuilderDefaultViewEditorContracts, BuilderDefaultViewEditorPageOptions, BuilderEntityDialogManagerDependencies, BuilderEntityManagerActions, BuilderEntityManagerAddButtonProps, BuilderEntityManagerDataGridProps, BuilderEntityManagerDeleteDialogProps, BuilderEntityManagerDependencies, BuilderEntityManagerDialogAddButtonProps, BuilderEntityManagerEditorDialogProps, BuilderEntityManagerEntity, BuilderEntityManagerHookResult, BuilderEntityManagerLabels, BuilderEntityManagerMutation, BuilderFormLayoutDragPayload, BuilderFormLayoutItem, BuilderViewDialogBodyProps, BuilderViewDialogDependencies, BuilderViewDialogProps, BuilderViewDialogShellProps, builderFormLayoutDragDataType, clampBuilderFormLayoutSpan, createBuilderDefaultViewEditorPage, createBuilderEntityDialogManagerComponent, createBuilderEntityManagerComponent, createBuilderViewDialogComponent, nextBuilderFormLayoutGroupId, parseBuilderFormLayoutDragPayload, serializeBuilderFormLayoutDragPayload, swapBuilderFormLayoutItems, useBuilderFormLayoutEditor } from './admin/index.js';
|
|
2
3
|
export { BuilderApiClient, BuilderApiContracts, BuilderApiQuery, BuilderApiQueryValue, BuilderApiTransport, BuilderFieldOptionsQuery, createBuilderApiClient } from './api/index.js';
|
|
3
4
|
export { D as DynamicFormContracts, a as DynamicFormDependencies, b as DynamicFormErrorStateProps, c as DynamicFormFieldsProps, d as DynamicFormNotifications, e as DynamicFormProps, f as DynamicFormShellProps, g as DynamicFormSubmitProps, h as DynamicListContracts, i as DynamicListDataGridProps, j as DynamicListDependencies, k as DynamicListErrorStateProps, l as DynamicListProps, m as DynamicViewAddButtonProps, n as DynamicViewColumnActions, o as DynamicViewContracts, p as DynamicViewDataGridProps, q as DynamicViewDeleteDialogProps, r as DynamicViewDependencies, s as DynamicViewEntryDialogProps, t as DynamicViewErrorStateProps, u as DynamicViewProps, v as RuntimeEntryDialogActionsProps, w as RuntimeEntryDialogDependencies, x as RuntimeEntryDialogFieldsProps, y as RuntimeEntryDialogNotifications, z as RuntimeEntryDialogProps, A as RuntimeEntryDialogSaveArgs, B as RuntimeEntryDialogShellProps, C as RuntimeEntryDialogViewLike, E as createDynamicFormComponent, F as createDynamicListComponent, G as createDynamicViewComponent, H as createRuntimeEntryDialogComponent } from './RuntimeEntryDialog-DAO74GFp.js';
|
|
4
5
|
export { BuilderHooks, createBuilderHooks, createBuilderKeys } from './hooks/index.js';
|
package/dist/index.js
CHANGED
|
@@ -166,15 +166,15 @@ function builderListEditorValuesFromEntity(list, emptyValues) {
|
|
|
166
166
|
version: list.version
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
|
-
function builderViewEditorValuesFromEntity(view, emptyValues, defaultPermission) {
|
|
169
|
+
function builderViewEditorValuesFromEntity(view, emptyValues, defaultPermission = "") {
|
|
170
170
|
if (!view) return emptyValues;
|
|
171
171
|
return {
|
|
172
172
|
title: view.title,
|
|
173
173
|
description: view.description ?? "",
|
|
174
174
|
formId: view.formId ?? BUILDER_EDITOR_NONE_VALUE,
|
|
175
175
|
listId: view.listId ?? BUILDER_EDITOR_NONE_VALUE,
|
|
176
|
-
permissionRead: view.permissionRead
|
|
177
|
-
permissionWrite: view.permissionWrite
|
|
176
|
+
permissionRead: view.permissionRead || defaultPermission,
|
|
177
|
+
permissionWrite: view.permissionWrite || defaultPermission,
|
|
178
178
|
triggersText: JSON.stringify(view.triggers ?? [], null, 2),
|
|
179
179
|
version: view.version
|
|
180
180
|
};
|
|
@@ -294,8 +294,8 @@ function builderViewEditorInputFromValues(values, parseTriggers) {
|
|
|
294
294
|
description: values.description || null,
|
|
295
295
|
formId: values.formId === BUILDER_EDITOR_NONE_VALUE ? null : values.formId,
|
|
296
296
|
listId: values.listId === BUILDER_EDITOR_NONE_VALUE ? null : values.listId,
|
|
297
|
-
permissionRead: values.permissionRead,
|
|
298
|
-
permissionWrite: values.permissionWrite,
|
|
297
|
+
permissionRead: values.permissionRead || null,
|
|
298
|
+
permissionWrite: values.permissionWrite || null,
|
|
299
299
|
triggers: values.triggersText?.trim() ? parseTriggers(values.triggersText) : [],
|
|
300
300
|
version: values.version
|
|
301
301
|
};
|
|
@@ -1061,7 +1061,7 @@ function createBuilderDefaultEntityManagerComponent(deps) {
|
|
|
1061
1061
|
// src/admin/BuilderDefaultViewEditorPage.tsx
|
|
1062
1062
|
import { useEffect } from "react";
|
|
1063
1063
|
import { useForm } from "react-hook-form";
|
|
1064
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1064
|
+
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1065
1065
|
var styles3 = {
|
|
1066
1066
|
page: {
|
|
1067
1067
|
display: "grid",
|
|
@@ -1158,27 +1158,37 @@ var defaultEmptyValues = {
|
|
|
1158
1158
|
description: "",
|
|
1159
1159
|
formId: BUILDER_EDITOR_NONE_VALUE,
|
|
1160
1160
|
listId: BUILDER_EDITOR_NONE_VALUE,
|
|
1161
|
-
permissionRead: "
|
|
1162
|
-
permissionWrite: "
|
|
1161
|
+
permissionRead: "",
|
|
1162
|
+
permissionWrite: "",
|
|
1163
1163
|
triggersText: "[]",
|
|
1164
1164
|
version: 0
|
|
1165
1165
|
};
|
|
1166
1166
|
function createBuilderDefaultViewEditorPage(options) {
|
|
1167
|
+
const defaultPermission = options.defaultPermission ?? "";
|
|
1168
|
+
const showPermissions = options.permissionOptions.length > 0;
|
|
1167
1169
|
return function BuilderDefaultViewEditorPage({ viewId }) {
|
|
1168
1170
|
const view = options.hooks.useBuilderView(viewId);
|
|
1169
1171
|
const forms = options.hooks.useBuilderFormOptions();
|
|
1170
1172
|
const lists = options.hooks.useBuilderListOptions();
|
|
1171
1173
|
const save = options.hooks.useSaveBuilderView();
|
|
1172
1174
|
const form = useForm({
|
|
1173
|
-
defaultValues: {
|
|
1175
|
+
defaultValues: {
|
|
1176
|
+
...defaultEmptyValues,
|
|
1177
|
+
permissionRead: defaultPermission,
|
|
1178
|
+
permissionWrite: defaultPermission
|
|
1179
|
+
}
|
|
1174
1180
|
});
|
|
1175
1181
|
useEffect(() => {
|
|
1176
1182
|
if (viewId && !view.data) return;
|
|
1177
1183
|
form.reset(
|
|
1178
1184
|
builderViewEditorValuesFromEntity(
|
|
1179
1185
|
view.data ?? null,
|
|
1180
|
-
{
|
|
1181
|
-
|
|
1186
|
+
{
|
|
1187
|
+
...defaultEmptyValues,
|
|
1188
|
+
permissionRead: defaultPermission,
|
|
1189
|
+
permissionWrite: defaultPermission
|
|
1190
|
+
},
|
|
1191
|
+
defaultPermission
|
|
1182
1192
|
)
|
|
1183
1193
|
);
|
|
1184
1194
|
}, [form, view.data, viewId]);
|
|
@@ -1238,14 +1248,22 @@ function createBuilderDefaultViewEditorPage(options) {
|
|
|
1238
1248
|
(lists.data ?? []).map((item) => /* @__PURE__ */ jsx3("option", { value: item.id, children: item.title }, item.id))
|
|
1239
1249
|
] })
|
|
1240
1250
|
] }),
|
|
1241
|
-
/* @__PURE__ */ jsxs3(
|
|
1242
|
-
/* @__PURE__ */
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1251
|
+
showPermissions ? /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1252
|
+
/* @__PURE__ */ jsxs3("label", { style: styles3.field, children: [
|
|
1253
|
+
/* @__PURE__ */ jsx3("span", { style: styles3.label, children: "Read permission" }),
|
|
1254
|
+
/* @__PURE__ */ jsxs3("select", { style: styles3.input, ...form.register("permissionRead"), children: [
|
|
1255
|
+
/* @__PURE__ */ jsx3("option", { value: "", children: "Authenticated users" }),
|
|
1256
|
+
options.permissionOptions.map((permission) => /* @__PURE__ */ jsx3("option", { value: permission.value, children: permission.label }, permission.value))
|
|
1257
|
+
] })
|
|
1258
|
+
] }),
|
|
1259
|
+
/* @__PURE__ */ jsxs3("label", { style: styles3.field, children: [
|
|
1260
|
+
/* @__PURE__ */ jsx3("span", { style: styles3.label, children: "Write permission" }),
|
|
1261
|
+
/* @__PURE__ */ jsxs3("select", { style: styles3.input, ...form.register("permissionWrite"), children: [
|
|
1262
|
+
/* @__PURE__ */ jsx3("option", { value: "", children: "Authenticated users" }),
|
|
1263
|
+
options.permissionOptions.map((permission) => /* @__PURE__ */ jsx3("option", { value: permission.value, children: permission.label }, permission.value))
|
|
1264
|
+
] })
|
|
1265
|
+
] })
|
|
1266
|
+
] }) : null,
|
|
1249
1267
|
/* @__PURE__ */ jsxs3("label", { style: { ...styles3.field, gridColumn: "1 / -1" }, children: [
|
|
1250
1268
|
/* @__PURE__ */ jsx3("span", { style: styles3.label, children: "Triggers JSON" }),
|
|
1251
1269
|
/* @__PURE__ */ jsx3("textarea", { style: styles3.textarea, ...form.register("triggersText") })
|
|
@@ -1414,7 +1432,7 @@ var defaultFieldTriggerEventOptions = [
|
|
|
1414
1432
|
{ value: "onChange", label: "On change" },
|
|
1415
1433
|
{ value: "onBlur", label: "On blur" }
|
|
1416
1434
|
];
|
|
1417
|
-
var defaultPermissionOptions = [
|
|
1435
|
+
var defaultPermissionOptions = [];
|
|
1418
1436
|
function parseJsonArray(value) {
|
|
1419
1437
|
const parsed = JSON.parse(value);
|
|
1420
1438
|
return Array.isArray(parsed) ? parsed : [];
|
|
@@ -1473,7 +1491,7 @@ function createBuilderAdminPages({
|
|
|
1473
1491
|
listTriggerEventOptions = defaultListTriggerEventOptions,
|
|
1474
1492
|
fieldTriggerEventOptions = defaultFieldTriggerEventOptions,
|
|
1475
1493
|
permissionOptions = defaultPermissionOptions,
|
|
1476
|
-
defaultPermission = "
|
|
1494
|
+
defaultPermission = "",
|
|
1477
1495
|
notifySuccess,
|
|
1478
1496
|
notifyError,
|
|
1479
1497
|
parseViewTriggers = parseJsonArray
|
|
@@ -2564,11 +2582,6 @@ function createRuntimeEntryDialogComponent(deps) {
|
|
|
2564
2582
|
};
|
|
2565
2583
|
}
|
|
2566
2584
|
|
|
2567
|
-
// src/components/RuntimeSubformField.tsx
|
|
2568
|
-
import { useEffect as useEffect5, useMemo as useMemo8, useRef, useState as useState5 } from "react";
|
|
2569
|
-
import { FormProvider as FormProvider5, useForm as useForm6 } from "react-hook-form";
|
|
2570
|
-
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2571
|
-
|
|
2572
2585
|
// src/hooks/createBuilderHooks.ts
|
|
2573
2586
|
import { keepPreviousData, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
2574
2587
|
function createBuilderKeys() {
|
|
@@ -2891,24 +2904,36 @@ function withQuery(path, query) {
|
|
|
2891
2904
|
}
|
|
2892
2905
|
function createBuilderIntegration(config) {
|
|
2893
2906
|
const adminBasePath = normalizeBasePath(config.adminBasePath ?? "/admin/dev/builder");
|
|
2907
|
+
const runtimeBasePath = normalizeBasePath(config.runtimeBasePath ?? "/admin/winu");
|
|
2894
2908
|
const api = createBuilderApiClient(config.transport);
|
|
2895
2909
|
const hooks = createBuilderHooks(api);
|
|
2896
2910
|
const formsPath = `${adminBasePath}/forms`;
|
|
2897
2911
|
const listsPath = `${adminBasePath}/lists`;
|
|
2898
|
-
|
|
2899
|
-
|
|
2912
|
+
const routes = {
|
|
2913
|
+
adminBasePath,
|
|
2914
|
+
runtimeBasePath,
|
|
2915
|
+
adminHomePath: adminBasePath,
|
|
2916
|
+
formsPath,
|
|
2917
|
+
newFormPath: `${formsPath}/new`,
|
|
2918
|
+
editFormPath: (id) => withQuery(`${formsPath}/edit`, { id }),
|
|
2919
|
+
listsPath,
|
|
2920
|
+
newListPath: `${listsPath}/new`,
|
|
2921
|
+
editListPath: (id) => withQuery(`${listsPath}/edit`, { id }),
|
|
2922
|
+
viewsPath: `${adminBasePath}/views`
|
|
2923
|
+
};
|
|
2924
|
+
const adminPages = config.adminPages ? createBuilderAdminPages({
|
|
2925
|
+
...config.adminPages,
|
|
2900
2926
|
hooks,
|
|
2901
2927
|
routes: {
|
|
2902
2928
|
adminBasePath,
|
|
2903
|
-
|
|
2904
|
-
formsPath,
|
|
2905
|
-
newFormPath: `${formsPath}/new`,
|
|
2906
|
-
editFormPath: (id) => withQuery(`${formsPath}/edit`, { id }),
|
|
2907
|
-
listsPath,
|
|
2908
|
-
newListPath: `${listsPath}/new`,
|
|
2909
|
-
editListPath: (id) => withQuery(`${listsPath}/edit`, { id }),
|
|
2910
|
-
viewsPath: `${adminBasePath}/views`
|
|
2929
|
+
runtimeBasePath
|
|
2911
2930
|
}
|
|
2931
|
+
}) : void 0;
|
|
2932
|
+
return {
|
|
2933
|
+
api,
|
|
2934
|
+
hooks,
|
|
2935
|
+
routes,
|
|
2936
|
+
adminPages
|
|
2912
2937
|
};
|
|
2913
2938
|
}
|
|
2914
2939
|
|