@duke333/builder-ui 0.2.3 → 0.2.4
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/{BuilderAdminPages-DrOrFyIX.d.ts → BuilderAdminPages-DwwdA8Dv.d.ts} +12 -0
- package/dist/{RuntimeEntryDialog-Bw741XbS.d.ts → RuntimeEntryDialog-B4TbF8os.d.ts} +1 -1
- package/dist/admin/index.d.ts +2 -2
- package/dist/admin/index.js +45 -4
- package/dist/admin/index.js.map +1 -1
- package/dist/api/index.d.ts +14 -0
- package/dist/api/index.js +19 -2
- package/dist/api/index.js.map +1 -1
- package/dist/components/index.d.ts +4 -3
- package/dist/components/index.js +31 -12
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.js +30 -3
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +142 -22
- package/dist/index.js +998 -532
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/index.js +94 -9
- package/dist/integration/index.js.map +1 -1
- package/dist/runtime/index.d.ts +16 -26
- package/dist/runtime/index.js +41 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtimeUtils-CCtLyIf1.d.ts +33 -0
- package/dist/styles.css +155 -0
- package/dist/styles.css.map +1 -1
- package/package.json +5 -2
package/dist/hooks/index.js
CHANGED
|
@@ -28,12 +28,30 @@ function createBuilderKeys() {
|
|
|
28
28
|
}
|
|
29
29
|
function createBuilderHooks(client) {
|
|
30
30
|
const builderKeys = createBuilderKeys();
|
|
31
|
+
function isRuntimeEntryListCache(value) {
|
|
32
|
+
return typeof value === "object" && value !== null && "items" in value && Array.isArray(value.items) && "total" in value;
|
|
33
|
+
}
|
|
34
|
+
function replaceCachedRuntimeViewEntry(queryClient, viewId, entry) {
|
|
35
|
+
queryClient.setQueriesData(
|
|
36
|
+
{ queryKey: [...builderKeys.runtimeView(viewId), "entries"] },
|
|
37
|
+
(current) => {
|
|
38
|
+
if (!isRuntimeEntryListCache(current)) return current;
|
|
39
|
+
return {
|
|
40
|
+
...current,
|
|
41
|
+
items: current.items.map((item) => item.id === entry.id ? entry : item)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
31
46
|
function invalidateRuntimeViewEntries(queryClient, viewId) {
|
|
32
47
|
return Promise.all([
|
|
33
48
|
queryClient.invalidateQueries({ queryKey: builderKeys.runtimeView(viewId) }),
|
|
34
49
|
queryClient.invalidateQueries({ queryKey: [...builderKeys.runtimeView(viewId), "entries"] })
|
|
35
50
|
]);
|
|
36
51
|
}
|
|
52
|
+
function invalidateAllRuntimeViewEntries(queryClient) {
|
|
53
|
+
return queryClient.invalidateQueries({ queryKey: ["builder", "runtime", "view"] });
|
|
54
|
+
}
|
|
37
55
|
function useBuilderDbTables() {
|
|
38
56
|
return useQuery({ queryKey: builderKeys.dbTables(), queryFn: client.listBuilderDbTables });
|
|
39
57
|
}
|
|
@@ -244,14 +262,20 @@ function createBuilderHooks(client) {
|
|
|
244
262
|
viewId,
|
|
245
263
|
input
|
|
246
264
|
),
|
|
247
|
-
onSuccess: () =>
|
|
265
|
+
onSuccess: (entry) => {
|
|
266
|
+
replaceCachedRuntimeViewEntry(queryClient, viewId, entry);
|
|
267
|
+
return invalidateRuntimeViewEntries(queryClient, viewId);
|
|
268
|
+
}
|
|
248
269
|
});
|
|
249
270
|
}
|
|
250
271
|
function useCreateCompositeBuilderViewEntry(viewId) {
|
|
251
272
|
const queryClient = useQueryClient();
|
|
252
273
|
return useMutation({
|
|
253
274
|
mutationFn: (input) => client.createCompositeBuilderViewEntry(viewId, input),
|
|
254
|
-
onSuccess: () =>
|
|
275
|
+
onSuccess: (entry) => {
|
|
276
|
+
replaceCachedRuntimeViewEntry(queryClient, viewId, entry);
|
|
277
|
+
return invalidateAllRuntimeViewEntries(queryClient);
|
|
278
|
+
}
|
|
255
279
|
});
|
|
256
280
|
}
|
|
257
281
|
function useUpdateCompositeBuilderViewEntry(viewId) {
|
|
@@ -261,7 +285,10 @@ function createBuilderHooks(client) {
|
|
|
261
285
|
id,
|
|
262
286
|
input
|
|
263
287
|
}) => client.updateCompositeBuilderViewEntry(viewId, id, input),
|
|
264
|
-
onSuccess: () =>
|
|
288
|
+
onSuccess: (entry) => {
|
|
289
|
+
replaceCachedRuntimeViewEntry(queryClient, viewId, entry);
|
|
290
|
+
return invalidateAllRuntimeViewEntries(queryClient);
|
|
291
|
+
}
|
|
265
292
|
});
|
|
266
293
|
}
|
|
267
294
|
function useDeleteBuilderViewEntry(id) {
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/createBuilderHooks.ts"],"sourcesContent":["\"use client\";\n\nimport { keepPreviousData, useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport type { BuilderApiClient, BuilderApiContracts } from \"../api\";\n\nexport function createBuilderKeys<C extends BuilderApiContracts>() {\n const builderKeys = {\n forms: [\"builder\", \"forms\"] as const,\n dbTables: () => [\"builder\", \"datasources\", \"tables\"] as const,\n formList: (query: C[\"ListBuilderFormsQuery\"]) => [...builderKeys.forms, \"list\", query] as const,\n form: (id: string) => [...builderKeys.forms, \"detail\", id] as const,\n formOptions: () => [...builderKeys.forms, \"options\"] as const,\n lists: [\"builder\", \"lists\"] as const,\n listList: (query: C[\"ListBuilderListsQuery\"]) => [...builderKeys.lists, \"list\", query] as const,\n list: (id: string) => [...builderKeys.lists, \"detail\", id] as const,\n listOptions: () => [...builderKeys.lists, \"options\"] as const,\n views: [\"builder\", \"views\"] as const,\n viewList: (query: C[\"ListBuilderViewsQuery\"]) => [...builderKeys.views, \"list\", query] as const,\n view: (id: string) => [...builderKeys.views, \"detail\", id] as const,\n runtimeForm: (id: string) => [\"builder\", \"runtime\", \"form\", id] as const,\n runtimeFieldOptions: (\n formId: string,\n fieldKey: string,\n query: C[\"ListBuilderFieldOptionsQuery\"],\n ) => [...builderKeys.runtimeForm(formId), \"fields\", fieldKey, \"options\", query] as const,\n runtimeFormEntries: (id: string) => [...builderKeys.runtimeForm(id), \"entries\"] as const,\n runtimeList: (id: string) => [\"builder\", \"runtime\", \"list\", id] as const,\n runtimeListEntries: (id: string, query: C[\"ListBuilderViewEntriesQuery\"]) =>\n [...builderKeys.runtimeList(id), \"entries\", query] as const,\n runtimeView: (id: string) => [\"builder\", \"runtime\", \"view\", id] as const,\n entries: (id: string, query: C[\"ListBuilderViewEntriesQuery\"]) =>\n [...builderKeys.runtimeView(id), \"entries\", query] as const,\n };\n\n return builderKeys;\n}\n\nexport function createBuilderHooks<C extends BuilderApiContracts>(client: BuilderApiClient<C>) {\n const builderKeys = createBuilderKeys<C>();\n\n function invalidateRuntimeViewEntries(\n queryClient: ReturnType<typeof useQueryClient>,\n viewId: string,\n ) {\n return Promise.all([\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeView(viewId) }),\n queryClient.invalidateQueries({ queryKey: [...builderKeys.runtimeView(viewId), \"entries\"] }),\n ]);\n }\n\n function useBuilderDbTables() {\n return useQuery({ queryKey: builderKeys.dbTables(), queryFn: client.listBuilderDbTables });\n }\n\n function useBuilderForms(query: C[\"ListBuilderFormsQuery\"]) {\n return useQuery({\n queryKey: builderKeys.formList(query),\n queryFn: () => client.listBuilderForms(query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useBuilderFormOptions() {\n return useQuery({\n queryKey: builderKeys.formOptions(),\n queryFn: client.listBuilderFormOptions,\n });\n }\n\n function useBuilderForm(id?: string) {\n return useQuery({\n queryKey: builderKeys.form(id ?? \"\"),\n queryFn: () => client.getBuilderForm(id ?? \"\"),\n enabled: Boolean(id),\n });\n }\n\n function useSaveBuilderForm() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderFormInput\"] }) =>\n id\n ? client.updateBuilderForm(id, input)\n : client.createBuilderForm(input as unknown as C[\"CreateBuilderFormInput\"]),\n onSuccess: (form) => {\n queryClient.invalidateQueries({ queryKey: builderKeys.forms });\n queryClient.invalidateQueries({ queryKey: builderKeys.form(form.id) });\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeForm(form.id) });\n },\n });\n }\n\n function useReplicateBuilderForm() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id: string; input: C[\"ReplicateBuilderEntityInput\"] }) =>\n client.replicateBuilderForm(id, input),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.forms }),\n });\n }\n\n function useDeleteBuilderForm() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: client.deleteBuilderForm,\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.forms }),\n });\n }\n\n function useBuilderLists(query: C[\"ListBuilderListsQuery\"]) {\n return useQuery({\n queryKey: builderKeys.listList(query),\n queryFn: () => client.listBuilderLists(query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useBuilderListOptions() {\n return useQuery({\n queryKey: builderKeys.listOptions(),\n queryFn: client.listBuilderListOptions,\n });\n }\n\n function useBuilderList(id?: string) {\n return useQuery({\n queryKey: builderKeys.list(id ?? \"\"),\n queryFn: () => client.getBuilderList(id ?? \"\"),\n enabled: Boolean(id),\n });\n }\n\n function useSaveBuilderList() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderListInput\"] }) =>\n id\n ? client.updateBuilderList(id, input)\n : client.createBuilderList(input as unknown as C[\"CreateBuilderListInput\"]),\n onSuccess: (list) => {\n queryClient.invalidateQueries({ queryKey: builderKeys.lists });\n queryClient.invalidateQueries({ queryKey: builderKeys.list(list.id) });\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeList(list.id) });\n },\n });\n }\n\n function useReplicateBuilderList() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id: string; input: C[\"ReplicateBuilderEntityInput\"] }) =>\n client.replicateBuilderList(id, input),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.lists }),\n });\n }\n\n function useDeleteBuilderList() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: client.deleteBuilderList,\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.lists }),\n });\n }\n\n function useBuilderViews(query: C[\"ListBuilderViewsQuery\"]) {\n return useQuery({\n queryKey: builderKeys.viewList(query),\n queryFn: () => client.listBuilderViews(query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useBuilderView(id?: string) {\n return useQuery({\n queryKey: builderKeys.view(id ?? \"\"),\n queryFn: () => client.getBuilderView(id ?? \"\"),\n enabled: Boolean(id),\n });\n }\n\n function useSaveBuilderView() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderViewInput\"] }) =>\n id\n ? client.updateBuilderView(id, input)\n : client.createBuilderView(input as unknown as C[\"CreateBuilderViewInput\"]),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views }),\n });\n }\n\n function useReplicateBuilderView() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id: string; input: C[\"ReplicateBuilderEntityInput\"] }) =>\n client.replicateBuilderView(id, input),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views }),\n });\n }\n\n function useDeleteBuilderView() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: client.deleteBuilderView,\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views }),\n });\n }\n\n function useRuntimeBuilderForm(id: string) {\n return useQuery({\n queryKey: builderKeys.runtimeForm(id),\n queryFn: () => client.getRuntimeBuilderForm(id),\n });\n }\n\n function useRuntimeBuilderFormFieldOptions(\n formId: string | undefined,\n fieldKey: string,\n query: C[\"ListBuilderFieldOptionsQuery\"],\n enabled = true,\n ) {\n return useQuery({\n queryKey: builderKeys.runtimeFieldOptions(formId ?? \"\", fieldKey, query),\n queryFn: () => client.listRuntimeBuilderFormFieldOptions(formId ?? \"\", fieldKey, query),\n enabled: Boolean(formId) && enabled,\n });\n }\n\n function useRunRuntimeBuilderFieldTrigger() {\n return useMutation({\n mutationFn: (args: {\n formId?: string;\n viewId?: string;\n fieldKey: string;\n event: C[\"BuilderFieldTriggerEvent\"];\n input: C[\"RunBuilderFieldTriggerInput\"];\n }) => {\n if (args.viewId) {\n return client.runRuntimeBuilderViewFieldTrigger(\n args.viewId,\n args.fieldKey,\n args.event,\n args.input,\n );\n }\n if (args.formId) {\n return client.runRuntimeBuilderFormFieldTrigger(\n args.formId,\n args.fieldKey,\n args.event,\n args.input,\n );\n }\n throw new Error(\"formId эсвэл viewId шаардлагатай\");\n },\n });\n }\n\n function useRuntimeBuilderList(id: string) {\n return useQuery({\n queryKey: builderKeys.runtimeList(id),\n queryFn: () => client.getRuntimeBuilderList(id),\n });\n }\n\n function useRuntimeBuilderListEntries(id: string, query: C[\"ListBuilderViewEntriesQuery\"]) {\n return useQuery({\n queryKey: builderKeys.runtimeListEntries(id, query),\n queryFn: () => client.listRuntimeBuilderListEntries(id, query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useSaveRuntimeBuilderFormEntry(formId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: C[\"CreateBuilderViewEntryInput\"]) =>\n client.createRuntimeBuilderFormEntry(formId, input),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeFormEntries(formId) });\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeForm(formId) });\n queryClient.invalidateQueries({ queryKey: [\"builder\", \"runtime\", \"list\"] });\n },\n });\n }\n\n function useRuntimeBuilderView(id: string, enabled = true) {\n return useQuery({\n queryKey: builderKeys.runtimeView(id),\n queryFn: () => client.getRuntimeBuilderView(id),\n enabled: Boolean(id) && enabled,\n });\n }\n\n function useBuilderViewEntries(\n id: string,\n query: C[\"ListBuilderViewEntriesQuery\"],\n enabled = true,\n ) {\n return useQuery({\n queryKey: builderKeys.entries(id, query),\n queryFn: () => client.listBuilderViewEntries(id, query),\n placeholderData: keepPreviousData,\n enabled: Boolean(id) && enabled,\n });\n }\n\n function useSaveBuilderViewEntry(viewId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderViewEntryInput\"] }) =>\n id\n ? client.updateBuilderViewEntry(viewId, id, input)\n : client.createBuilderViewEntry(\n viewId,\n input as unknown as C[\"CreateBuilderViewEntryInput\"],\n ),\n onSuccess: () => invalidateRuntimeViewEntries(queryClient, viewId),\n });\n }\n\n function useCreateCompositeBuilderViewEntry(viewId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: C[\"CreateCompositeBuilderViewEntryInput\"]) =>\n client.createCompositeBuilderViewEntry(viewId, input),\n onSuccess: () => invalidateRuntimeViewEntries(queryClient, viewId),\n });\n }\n\n function useUpdateCompositeBuilderViewEntry(viewId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n id,\n input,\n }: {\n id: string;\n input: C[\"UpdateCompositeBuilderViewEntryInput\"];\n }) => client.updateCompositeBuilderViewEntry(viewId, id, input),\n onSuccess: () => invalidateRuntimeViewEntries(queryClient, viewId),\n });\n }\n\n function useDeleteBuilderViewEntry(id: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (entryId: string) => client.deleteBuilderViewEntry(id, entryId),\n onSuccess: () => invalidateRuntimeViewEntries(queryClient, id),\n });\n }\n\n return {\n builderKeys,\n useBuilderDbTables,\n useBuilderForm,\n useBuilderFormOptions,\n useBuilderForms,\n useBuilderList,\n useBuilderListOptions,\n useBuilderLists,\n useBuilderViewEntries,\n useBuilderView,\n useBuilderViews,\n useDeleteBuilderForm,\n useDeleteBuilderList,\n useDeleteBuilderView,\n useDeleteBuilderViewEntry,\n useCreateCompositeBuilderViewEntry,\n useReplicateBuilderForm,\n useReplicateBuilderList,\n useReplicateBuilderView,\n useRuntimeBuilderForm,\n useRuntimeBuilderFormFieldOptions,\n useRuntimeBuilderList,\n useRuntimeBuilderListEntries,\n useRuntimeBuilderView,\n useRunRuntimeBuilderFieldTrigger,\n useSaveBuilderForm,\n useSaveBuilderList,\n useSaveBuilderView,\n useSaveBuilderViewEntry,\n useSaveRuntimeBuilderFormEntry,\n useUpdateCompositeBuilderViewEntry,\n };\n}\n\nexport type BuilderHooks<C extends BuilderApiContracts> = ReturnType<typeof createBuilderHooks<C>>;\n"],"mappings":";;;AAEA,SAAS,kBAAkB,aAAa,UAAU,sBAAsB;AAGjE,SAAS,oBAAmD;AACjE,QAAM,cAAc;AAAA,IAClB,OAAO,CAAC,WAAW,OAAO;AAAA,IAC1B,UAAU,MAAM,CAAC,WAAW,eAAe,QAAQ;AAAA,IACnD,UAAU,CAAC,UAAsC,CAAC,GAAG,YAAY,OAAO,QAAQ,KAAK;AAAA,IACrF,MAAM,CAAC,OAAe,CAAC,GAAG,YAAY,OAAO,UAAU,EAAE;AAAA,IACzD,aAAa,MAAM,CAAC,GAAG,YAAY,OAAO,SAAS;AAAA,IACnD,OAAO,CAAC,WAAW,OAAO;AAAA,IAC1B,UAAU,CAAC,UAAsC,CAAC,GAAG,YAAY,OAAO,QAAQ,KAAK;AAAA,IACrF,MAAM,CAAC,OAAe,CAAC,GAAG,YAAY,OAAO,UAAU,EAAE;AAAA,IACzD,aAAa,MAAM,CAAC,GAAG,YAAY,OAAO,SAAS;AAAA,IACnD,OAAO,CAAC,WAAW,OAAO;AAAA,IAC1B,UAAU,CAAC,UAAsC,CAAC,GAAG,YAAY,OAAO,QAAQ,KAAK;AAAA,IACrF,MAAM,CAAC,OAAe,CAAC,GAAG,YAAY,OAAO,UAAU,EAAE;AAAA,IACzD,aAAa,CAAC,OAAe,CAAC,WAAW,WAAW,QAAQ,EAAE;AAAA,IAC9D,qBAAqB,CACnB,QACA,UACA,UACG,CAAC,GAAG,YAAY,YAAY,MAAM,GAAG,UAAU,UAAU,WAAW,KAAK;AAAA,IAC9E,oBAAoB,CAAC,OAAe,CAAC,GA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,EAAE;AAAA,IAC/D,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/createBuilderHooks.ts"],"sourcesContent":["\"use client\";\n\nimport { keepPreviousData, useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport type { BuilderApiClient, BuilderApiContracts } from \"../api\";\n\nexport function createBuilderKeys<C extends BuilderApiContracts>() {\n const builderKeys = {\n forms: [\"builder\", \"forms\"] as const,\n dbTables: () => [\"builder\", \"datasources\", \"tables\"] as const,\n formList: (query: C[\"ListBuilderFormsQuery\"]) => [...builderKeys.forms, \"list\", query] as const,\n form: (id: string) => [...builderKeys.forms, \"detail\", id] as const,\n formOptions: () => [...builderKeys.forms, \"options\"] as const,\n lists: [\"builder\", \"lists\"] as const,\n listList: (query: C[\"ListBuilderListsQuery\"]) => [...builderKeys.lists, \"list\", query] as const,\n list: (id: string) => [...builderKeys.lists, \"detail\", id] as const,\n listOptions: () => [...builderKeys.lists, \"options\"] as const,\n views: [\"builder\", \"views\"] as const,\n viewList: (query: C[\"ListBuilderViewsQuery\"]) => [...builderKeys.views, \"list\", query] as const,\n view: (id: string) => [...builderKeys.views, \"detail\", id] as const,\n runtimeForm: (id: string) => [\"builder\", \"runtime\", \"form\", id] as const,\n runtimeFieldOptions: (\n formId: string,\n fieldKey: string,\n query: C[\"ListBuilderFieldOptionsQuery\"],\n ) => [...builderKeys.runtimeForm(formId), \"fields\", fieldKey, \"options\", query] as const,\n runtimeFormEntries: (id: string) => [...builderKeys.runtimeForm(id), \"entries\"] as const,\n runtimeList: (id: string) => [\"builder\", \"runtime\", \"list\", id] as const,\n runtimeListEntries: (id: string, query: C[\"ListBuilderViewEntriesQuery\"]) =>\n [...builderKeys.runtimeList(id), \"entries\", query] as const,\n runtimeView: (id: string) => [\"builder\", \"runtime\", \"view\", id] as const,\n entries: (id: string, query: C[\"ListBuilderViewEntriesQuery\"]) =>\n [...builderKeys.runtimeView(id), \"entries\", query] as const,\n };\n\n return builderKeys;\n}\n\nexport function createBuilderHooks<C extends BuilderApiContracts>(client: BuilderApiClient<C>) {\n const builderKeys = createBuilderKeys<C>();\n\n type RuntimeEntryListCache = {\n items: C[\"BuilderViewEntry\"][];\n total: number;\n };\n\n function isRuntimeEntryListCache(value: unknown): value is RuntimeEntryListCache {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"items\" in value &&\n Array.isArray(value.items) &&\n \"total\" in value\n );\n }\n\n function replaceCachedRuntimeViewEntry(\n queryClient: ReturnType<typeof useQueryClient>,\n viewId: string,\n entry: C[\"BuilderViewEntry\"],\n ) {\n queryClient.setQueriesData<unknown>(\n { queryKey: [...builderKeys.runtimeView(viewId), \"entries\"] },\n (current: unknown) => {\n if (!isRuntimeEntryListCache(current)) return current;\n return {\n ...current,\n items: current.items.map((item) => (item.id === entry.id ? entry : item)),\n };\n },\n );\n }\n\n function invalidateRuntimeViewEntries(\n queryClient: ReturnType<typeof useQueryClient>,\n viewId: string,\n ) {\n return Promise.all([\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeView(viewId) }),\n queryClient.invalidateQueries({ queryKey: [...builderKeys.runtimeView(viewId), \"entries\"] }),\n ]);\n }\n\n function invalidateAllRuntimeViewEntries(queryClient: ReturnType<typeof useQueryClient>) {\n return queryClient.invalidateQueries({ queryKey: [\"builder\", \"runtime\", \"view\"] });\n }\n\n function useBuilderDbTables() {\n return useQuery({ queryKey: builderKeys.dbTables(), queryFn: client.listBuilderDbTables });\n }\n\n function useBuilderForms(query: C[\"ListBuilderFormsQuery\"]) {\n return useQuery({\n queryKey: builderKeys.formList(query),\n queryFn: () => client.listBuilderForms(query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useBuilderFormOptions() {\n return useQuery({\n queryKey: builderKeys.formOptions(),\n queryFn: client.listBuilderFormOptions,\n });\n }\n\n function useBuilderForm(id?: string) {\n return useQuery({\n queryKey: builderKeys.form(id ?? \"\"),\n queryFn: () => client.getBuilderForm(id ?? \"\"),\n enabled: Boolean(id),\n });\n }\n\n function useSaveBuilderForm() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderFormInput\"] }) =>\n id\n ? client.updateBuilderForm(id, input)\n : client.createBuilderForm(input as unknown as C[\"CreateBuilderFormInput\"]),\n onSuccess: (form) => {\n queryClient.invalidateQueries({ queryKey: builderKeys.forms });\n queryClient.invalidateQueries({ queryKey: builderKeys.form(form.id) });\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeForm(form.id) });\n },\n });\n }\n\n function useReplicateBuilderForm() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id: string; input: C[\"ReplicateBuilderEntityInput\"] }) =>\n client.replicateBuilderForm(id, input),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.forms }),\n });\n }\n\n function useDeleteBuilderForm() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: client.deleteBuilderForm,\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.forms }),\n });\n }\n\n function useBuilderLists(query: C[\"ListBuilderListsQuery\"]) {\n return useQuery({\n queryKey: builderKeys.listList(query),\n queryFn: () => client.listBuilderLists(query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useBuilderListOptions() {\n return useQuery({\n queryKey: builderKeys.listOptions(),\n queryFn: client.listBuilderListOptions,\n });\n }\n\n function useBuilderList(id?: string) {\n return useQuery({\n queryKey: builderKeys.list(id ?? \"\"),\n queryFn: () => client.getBuilderList(id ?? \"\"),\n enabled: Boolean(id),\n });\n }\n\n function useSaveBuilderList() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderListInput\"] }) =>\n id\n ? client.updateBuilderList(id, input)\n : client.createBuilderList(input as unknown as C[\"CreateBuilderListInput\"]),\n onSuccess: (list) => {\n queryClient.invalidateQueries({ queryKey: builderKeys.lists });\n queryClient.invalidateQueries({ queryKey: builderKeys.list(list.id) });\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeList(list.id) });\n },\n });\n }\n\n function useReplicateBuilderList() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id: string; input: C[\"ReplicateBuilderEntityInput\"] }) =>\n client.replicateBuilderList(id, input),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.lists }),\n });\n }\n\n function useDeleteBuilderList() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: client.deleteBuilderList,\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.lists }),\n });\n }\n\n function useBuilderViews(query: C[\"ListBuilderViewsQuery\"]) {\n return useQuery({\n queryKey: builderKeys.viewList(query),\n queryFn: () => client.listBuilderViews(query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useBuilderView(id?: string) {\n return useQuery({\n queryKey: builderKeys.view(id ?? \"\"),\n queryFn: () => client.getBuilderView(id ?? \"\"),\n enabled: Boolean(id),\n });\n }\n\n function useSaveBuilderView() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderViewInput\"] }) =>\n id\n ? client.updateBuilderView(id, input)\n : client.createBuilderView(input as unknown as C[\"CreateBuilderViewInput\"]),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views }),\n });\n }\n\n function useReplicateBuilderView() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id: string; input: C[\"ReplicateBuilderEntityInput\"] }) =>\n client.replicateBuilderView(id, input),\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views }),\n });\n }\n\n function useDeleteBuilderView() {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: client.deleteBuilderView,\n onSuccess: () => queryClient.invalidateQueries({ queryKey: builderKeys.views }),\n });\n }\n\n function useRuntimeBuilderForm(id: string) {\n return useQuery({\n queryKey: builderKeys.runtimeForm(id),\n queryFn: () => client.getRuntimeBuilderForm(id),\n });\n }\n\n function useRuntimeBuilderFormFieldOptions(\n formId: string | undefined,\n fieldKey: string,\n query: C[\"ListBuilderFieldOptionsQuery\"],\n enabled = true,\n ) {\n return useQuery({\n queryKey: builderKeys.runtimeFieldOptions(formId ?? \"\", fieldKey, query),\n queryFn: () => client.listRuntimeBuilderFormFieldOptions(formId ?? \"\", fieldKey, query),\n enabled: Boolean(formId) && enabled,\n });\n }\n\n function useRunRuntimeBuilderFieldTrigger() {\n return useMutation({\n mutationFn: (args: {\n formId?: string;\n viewId?: string;\n fieldKey: string;\n event: C[\"BuilderFieldTriggerEvent\"];\n input: C[\"RunBuilderFieldTriggerInput\"];\n }) => {\n if (args.viewId) {\n return client.runRuntimeBuilderViewFieldTrigger(\n args.viewId,\n args.fieldKey,\n args.event,\n args.input,\n );\n }\n if (args.formId) {\n return client.runRuntimeBuilderFormFieldTrigger(\n args.formId,\n args.fieldKey,\n args.event,\n args.input,\n );\n }\n throw new Error(\"formId эсвэл viewId шаардлагатай\");\n },\n });\n }\n\n function useRuntimeBuilderList(id: string) {\n return useQuery({\n queryKey: builderKeys.runtimeList(id),\n queryFn: () => client.getRuntimeBuilderList(id),\n });\n }\n\n function useRuntimeBuilderListEntries(id: string, query: C[\"ListBuilderViewEntriesQuery\"]) {\n return useQuery({\n queryKey: builderKeys.runtimeListEntries(id, query),\n queryFn: () => client.listRuntimeBuilderListEntries(id, query),\n placeholderData: keepPreviousData,\n });\n }\n\n function useSaveRuntimeBuilderFormEntry(formId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: C[\"CreateBuilderViewEntryInput\"]) =>\n client.createRuntimeBuilderFormEntry(formId, input),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeFormEntries(formId) });\n queryClient.invalidateQueries({ queryKey: builderKeys.runtimeForm(formId) });\n queryClient.invalidateQueries({ queryKey: [\"builder\", \"runtime\", \"list\"] });\n },\n });\n }\n\n function useRuntimeBuilderView(id: string, enabled = true) {\n return useQuery({\n queryKey: builderKeys.runtimeView(id),\n queryFn: () => client.getRuntimeBuilderView(id),\n enabled: Boolean(id) && enabled,\n });\n }\n\n function useBuilderViewEntries(\n id: string,\n query: C[\"ListBuilderViewEntriesQuery\"],\n enabled = true,\n ) {\n return useQuery({\n queryKey: builderKeys.entries(id, query),\n queryFn: () => client.listBuilderViewEntries(id, query),\n placeholderData: keepPreviousData,\n enabled: Boolean(id) && enabled,\n });\n }\n\n function useSaveBuilderViewEntry(viewId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({ id, input }: { id?: string; input: C[\"UpdateBuilderViewEntryInput\"] }) =>\n id\n ? client.updateBuilderViewEntry(viewId, id, input)\n : client.createBuilderViewEntry(\n viewId,\n input as unknown as C[\"CreateBuilderViewEntryInput\"],\n ),\n onSuccess: (entry) => {\n replaceCachedRuntimeViewEntry(queryClient, viewId, entry);\n return invalidateRuntimeViewEntries(queryClient, viewId);\n },\n });\n }\n\n function useCreateCompositeBuilderViewEntry(viewId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (input: C[\"CreateCompositeBuilderViewEntryInput\"]) =>\n client.createCompositeBuilderViewEntry(viewId, input),\n onSuccess: (entry) => {\n replaceCachedRuntimeViewEntry(queryClient, viewId, entry);\n return invalidateAllRuntimeViewEntries(queryClient);\n },\n });\n }\n\n function useUpdateCompositeBuilderViewEntry(viewId: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: ({\n id,\n input,\n }: {\n id: string;\n input: C[\"UpdateCompositeBuilderViewEntryInput\"];\n }) => client.updateCompositeBuilderViewEntry(viewId, id, input),\n onSuccess: (entry) => {\n replaceCachedRuntimeViewEntry(queryClient, viewId, entry);\n return invalidateAllRuntimeViewEntries(queryClient);\n },\n });\n }\n\n function useDeleteBuilderViewEntry(id: string) {\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: (entryId: string) => client.deleteBuilderViewEntry(id, entryId),\n onSuccess: () => invalidateRuntimeViewEntries(queryClient, id),\n });\n }\n\n return {\n builderKeys,\n useBuilderDbTables,\n useBuilderForm,\n useBuilderFormOptions,\n useBuilderForms,\n useBuilderList,\n useBuilderListOptions,\n useBuilderLists,\n useBuilderViewEntries,\n useBuilderView,\n useBuilderViews,\n useDeleteBuilderForm,\n useDeleteBuilderList,\n useDeleteBuilderView,\n useDeleteBuilderViewEntry,\n useCreateCompositeBuilderViewEntry,\n useReplicateBuilderForm,\n useReplicateBuilderList,\n useReplicateBuilderView,\n useRuntimeBuilderForm,\n useRuntimeBuilderFormFieldOptions,\n useRuntimeBuilderList,\n useRuntimeBuilderListEntries,\n useRuntimeBuilderView,\n useRunRuntimeBuilderFieldTrigger,\n useSaveBuilderForm,\n useSaveBuilderList,\n useSaveBuilderView,\n useSaveBuilderViewEntry,\n useSaveRuntimeBuilderFormEntry,\n useUpdateCompositeBuilderViewEntry,\n };\n}\n\nexport type BuilderHooks<C extends BuilderApiContracts> = ReturnType<typeof createBuilderHooks<C>>;\n"],"mappings":";;;AAEA,SAAS,kBAAkB,aAAa,UAAU,sBAAsB;AAGjE,SAAS,oBAAmD;AACjE,QAAM,cAAc;AAAA,IAClB,OAAO,CAAC,WAAW,OAAO;AAAA,IAC1B,UAAU,MAAM,CAAC,WAAW,eAAe,QAAQ;AAAA,IACnD,UAAU,CAAC,UAAsC,CAAC,GAAG,YAAY,OAAO,QAAQ,KAAK;AAAA,IAC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AAa,QAAQ,KAAK;AACxD,eAAO,gCAAgC,WAAW;AAAA,MACpD;AAAA,IACF,CAAC;AAAA,EACH;AAEA,WAAS,0BAA0B,IAAY;AAC7C,UAAM,cAAc,eAAe;AACnC,WAAO,YAAY;AAAA,MACjB,YAAY,CAAC,YAAoB,OAAO,uBAAuB,IAAI,OAAO;AAAA,MAC1E,WAAW,MAAM,6BAA6B,aAAa,EAAE;AAAA,IAC/D,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,13 +5,14 @@ import { BuilderApiContracts, BuilderApiClient, BuilderApiTransport, BuilderFiel
|
|
|
5
5
|
export { BuilderApiClientOptions, BuilderApiQuery, BuilderApiQueryValue, createBuilderApiClient } from './api/index.js';
|
|
6
6
|
import { BuilderHooks } from './hooks/index.js';
|
|
7
7
|
export { createBuilderHooks, createBuilderKeys } from './hooks/index.js';
|
|
8
|
-
import { BuilderDbTable, BuilderForm as BuilderForm$1, BuilderList, BuilderView as BuilderView$1, BuilderViewEntry, ListBuilderFormsQuery, ListBuilderFormsResponse, CreateBuilderFormInput, UpdateBuilderFormInput, ListBuilderListsQuery, ListBuilderListsResponse, CreateBuilderListInput, UpdateBuilderListInput, ListBuilderViewsQuery, ListBuilderViewsResponse, CreateBuilderViewInput, UpdateBuilderViewInput, ReplicateBuilderEntityInput, CreateBuilderViewEntryInput, CreateCompositeBuilderViewEntryInput, UpdateCompositeBuilderViewEntryInput, UpdateBuilderViewEntryInput, ListBuilderFieldOptionsQuery, ListBuilderFieldOptionsResponse, RunBuilderFieldTriggerInput, BuilderFieldTriggerEvent, BuilderFieldTriggerResponse, ListBuilderViewEntriesQuery, ListBuilderViewEntriesResponse } from '@duke333/builder-contracts';
|
|
9
|
-
|
|
8
|
+
import { BuilderDbTable, BuilderForm as BuilderForm$1, BuilderList, BuilderView as BuilderView$1, BuilderViewEntry, ListBuilderFormsQuery, ListBuilderFormsResponse, CreateBuilderFormInput, UpdateBuilderFormInput, ListBuilderListsQuery, ListBuilderListsResponse, CreateBuilderListInput, UpdateBuilderListInput, ListBuilderViewsQuery, ListBuilderViewsResponse, CreateBuilderViewInput, UpdateBuilderViewInput, ReplicateBuilderEntityInput, CreateBuilderViewEntryInput, CreateCompositeBuilderViewEntryInput, UpdateCompositeBuilderViewEntryInput, UpdateBuilderViewEntryInput, ListBuilderFieldOptionsQuery, ListBuilderFieldOptionsResponse, RunBuilderFieldTriggerInput, BuilderFieldTriggerEvent, BuilderFieldTriggerResponse, ListBuilderViewEntriesQuery, ListBuilderViewEntriesResponse, BuilderFileUploadRequest, BuilderFileUploadResponse, BuilderFilePresignResponse, BuilderField } from '@duke333/builder-contracts';
|
|
9
|
+
import { FieldValues, Path } from 'react-hook-form';
|
|
10
|
+
export { richTextToPlainText, toRichTextDocument } from './runtime/index.js';
|
|
11
|
+
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 BuilderListEditorOrderByValues, z as BuilderListEditorPageDependencies, A as BuilderListEditorValues, C as BuilderViewEditorEntity, D as BuilderViewEditorValues, E as builderEditorOptionsToText, F as builderEditorSearchFieldsToText, G as builderEditorTextToOptions, H as builderEditorTextToSearchFields, I as builderFormEditorFieldsFromTable, J as builderFormEditorInputFromValues, K as builderFormEditorValuesFromEntity, L as builderListEditorColumnsFromTable, M as builderListEditorInputFromValues, N as builderListEditorValuesFromEntity, O as builderViewEditorInputFromValues, P as builderViewEditorValuesFromEntity, Q as createBuilderAdminPages, R as createBuilderDefaultEntityManagerComponent, S as createBuilderDefaultFormEditorBody, T as createBuilderDefaultListEditorBody, U as createBuilderFormEditorPageComponent, V as createBuilderListEditorPageComponent, W as getBuilderEditorTriggerRoute } from './BuilderAdminPages-DwwdA8Dv.js';
|
|
10
12
|
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';
|
|
11
|
-
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 DynamicViewInteractionEvent, v as DynamicViewProps, w as RuntimeEntryDialogActionsProps, x as RuntimeEntryDialogDependencies, y as RuntimeEntryDialogFieldsProps, z as RuntimeEntryDialogNotifications, A as RuntimeEntryDialogProps, B as RuntimeEntryDialogSaveArgs, C as RuntimeEntryDialogShellProps, E as RuntimeEntryDialogViewLike, F as createDynamicFormComponent, G as createDynamicListComponent, H as createDynamicViewComponent, I as createRuntimeEntryDialogComponent, J as shouldHandleDynamicViewRowClick } from './RuntimeEntryDialog-
|
|
12
|
-
export { BuilderRuntimeEntryLike, BuilderRuntimeEntryValues, BuilderRuntimeFieldLike, BuilderRuntimeFormSchemaLike, BuilderRuntimeFormValues, BuilderRuntimePresentation, BuilderRuntimeViewLike, createBuilderEntryDefaultValues, createBuilderFormDefaultValues, formatBuilderRuntimeValue } from './
|
|
13
|
+
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 DynamicViewInteractionEvent, v as DynamicViewProps, w as RuntimeEntryDialogActionsProps, x as RuntimeEntryDialogDependencies, y as RuntimeEntryDialogFieldsProps, z as RuntimeEntryDialogNotifications, A as RuntimeEntryDialogProps, B as RuntimeEntryDialogSaveArgs, C as RuntimeEntryDialogShellProps, E as RuntimeEntryDialogViewLike, F as createDynamicFormComponent, G as createDynamicListComponent, H as createDynamicViewComponent, I as createRuntimeEntryDialogComponent, J as shouldHandleDynamicViewRowClick } from './RuntimeEntryDialog-B4TbF8os.js';
|
|
14
|
+
export { b as BuilderRuntimeEntryLike, c as BuilderRuntimeEntryValues, f as BuilderRuntimeFieldLike, a as BuilderRuntimeFormSchemaLike, d as BuilderRuntimeFormValues, B as BuilderRuntimePresentation, e as BuilderRuntimeViewLike, g as createBuilderEntryDefaultValues, h as createBuilderFormDefaultValues, i as formatBuilderRuntimeValue } from './runtimeUtils-CCtLyIf1.js';
|
|
13
15
|
export { BuilderFrontendSetupValidation, BuilderIntegration, BuilderIntegrationConfig, BuilderIntegrationRoutes, createBuilderIntegration, createBuilderPortalIntegration, validateBuilderFrontendSetup } from './integration/index.js';
|
|
14
|
-
import 'react-hook-form';
|
|
15
16
|
|
|
16
17
|
type BuilderFormProps = {
|
|
17
18
|
formId: string;
|
|
@@ -58,6 +59,9 @@ type ReadyBuilderContracts = BuilderApiContracts & {
|
|
|
58
59
|
BuilderFieldTriggerResponse: BuilderFieldTriggerResponse;
|
|
59
60
|
ListBuilderViewEntriesQuery: ListBuilderViewEntriesQuery;
|
|
60
61
|
ListBuilderViewEntriesResponse: ListBuilderViewEntriesResponse;
|
|
62
|
+
BuilderFileUploadRequest: BuilderFileUploadRequest;
|
|
63
|
+
BuilderFileUploadResponse: BuilderFileUploadResponse;
|
|
64
|
+
BuilderFilePresignResponse: BuilderFilePresignResponse;
|
|
61
65
|
};
|
|
62
66
|
|
|
63
67
|
type BuilderNotification = {
|
|
@@ -100,7 +104,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
100
104
|
fields: {
|
|
101
105
|
key: string;
|
|
102
106
|
label: string;
|
|
103
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
107
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
104
108
|
required: boolean;
|
|
105
109
|
hidden: boolean;
|
|
106
110
|
disabled: boolean;
|
|
@@ -111,6 +115,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
111
115
|
debounceMs: number;
|
|
112
116
|
config: Record<string, unknown>;
|
|
113
117
|
}[];
|
|
118
|
+
defaultValue?: string | number | boolean | undefined;
|
|
119
|
+
storage?: "s3" | "server" | undefined;
|
|
120
|
+
contentKind?: "file" | "image" | undefined;
|
|
121
|
+
multiple?: boolean | undefined;
|
|
122
|
+
maxBytes?: number | undefined;
|
|
114
123
|
placeholder?: string | undefined;
|
|
115
124
|
description?: string | undefined;
|
|
116
125
|
options?: {
|
|
@@ -209,7 +218,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
209
218
|
fields: {
|
|
210
219
|
key: string;
|
|
211
220
|
label: string;
|
|
212
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
221
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
213
222
|
required: boolean;
|
|
214
223
|
hidden: boolean;
|
|
215
224
|
disabled: boolean;
|
|
@@ -220,6 +229,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
220
229
|
debounceMs: number;
|
|
221
230
|
config: Record<string, unknown>;
|
|
222
231
|
}[];
|
|
232
|
+
defaultValue?: string | number | boolean | undefined;
|
|
233
|
+
storage?: "s3" | "server" | undefined;
|
|
234
|
+
contentKind?: "file" | "image" | undefined;
|
|
235
|
+
multiple?: boolean | undefined;
|
|
236
|
+
maxBytes?: number | undefined;
|
|
223
237
|
placeholder?: string | undefined;
|
|
224
238
|
description?: string | undefined;
|
|
225
239
|
options?: {
|
|
@@ -294,7 +308,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
294
308
|
fields: {
|
|
295
309
|
key: string;
|
|
296
310
|
label: string;
|
|
297
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
311
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
298
312
|
required: boolean;
|
|
299
313
|
hidden: boolean;
|
|
300
314
|
disabled: boolean;
|
|
@@ -305,6 +319,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
305
319
|
debounceMs: number;
|
|
306
320
|
config: Record<string, unknown>;
|
|
307
321
|
}[];
|
|
322
|
+
defaultValue?: string | number | boolean | undefined;
|
|
323
|
+
storage?: "s3" | "server" | undefined;
|
|
324
|
+
contentKind?: "file" | "image" | undefined;
|
|
325
|
+
multiple?: boolean | undefined;
|
|
326
|
+
maxBytes?: number | undefined;
|
|
308
327
|
placeholder?: string | undefined;
|
|
309
328
|
description?: string | undefined;
|
|
310
329
|
options?: {
|
|
@@ -360,7 +379,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
360
379
|
fields: {
|
|
361
380
|
key: string;
|
|
362
381
|
label: string;
|
|
363
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
382
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
364
383
|
required: boolean;
|
|
365
384
|
hidden: boolean;
|
|
366
385
|
disabled: boolean;
|
|
@@ -371,6 +390,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
371
390
|
debounceMs: number;
|
|
372
391
|
config: Record<string, unknown>;
|
|
373
392
|
}[];
|
|
393
|
+
defaultValue?: string | number | boolean | undefined;
|
|
394
|
+
storage?: "s3" | "server" | undefined;
|
|
395
|
+
contentKind?: "file" | "image" | undefined;
|
|
396
|
+
multiple?: boolean | undefined;
|
|
397
|
+
maxBytes?: number | undefined;
|
|
374
398
|
placeholder?: string | undefined;
|
|
375
399
|
description?: string | undefined;
|
|
376
400
|
options?: {
|
|
@@ -456,7 +480,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
456
480
|
fields: {
|
|
457
481
|
key: string;
|
|
458
482
|
label: string;
|
|
459
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
483
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
460
484
|
required: boolean;
|
|
461
485
|
hidden: boolean;
|
|
462
486
|
disabled: boolean;
|
|
@@ -467,6 +491,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
467
491
|
debounceMs: number;
|
|
468
492
|
config: Record<string, unknown>;
|
|
469
493
|
}[];
|
|
494
|
+
defaultValue?: string | number | boolean | undefined;
|
|
495
|
+
storage?: "s3" | "server" | undefined;
|
|
496
|
+
contentKind?: "file" | "image" | undefined;
|
|
497
|
+
multiple?: boolean | undefined;
|
|
498
|
+
maxBytes?: number | undefined;
|
|
470
499
|
placeholder?: string | undefined;
|
|
471
500
|
description?: string | undefined;
|
|
472
501
|
options?: {
|
|
@@ -522,7 +551,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
522
551
|
fields: {
|
|
523
552
|
key: string;
|
|
524
553
|
label: string;
|
|
525
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
554
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
526
555
|
required: boolean;
|
|
527
556
|
hidden: boolean;
|
|
528
557
|
disabled: boolean;
|
|
@@ -533,6 +562,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
533
562
|
debounceMs: number;
|
|
534
563
|
config: Record<string, unknown>;
|
|
535
564
|
}[];
|
|
565
|
+
defaultValue?: string | number | boolean | undefined;
|
|
566
|
+
storage?: "s3" | "server" | undefined;
|
|
567
|
+
contentKind?: "file" | "image" | undefined;
|
|
568
|
+
multiple?: boolean | undefined;
|
|
569
|
+
maxBytes?: number | undefined;
|
|
536
570
|
placeholder?: string | undefined;
|
|
537
571
|
description?: string | undefined;
|
|
538
572
|
options?: {
|
|
@@ -619,7 +653,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
619
653
|
fields: {
|
|
620
654
|
key: string;
|
|
621
655
|
label: string;
|
|
622
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
656
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
623
657
|
required: boolean;
|
|
624
658
|
hidden: boolean;
|
|
625
659
|
disabled: boolean;
|
|
@@ -630,6 +664,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
630
664
|
debounceMs: number;
|
|
631
665
|
config: Record<string, unknown>;
|
|
632
666
|
}[];
|
|
667
|
+
defaultValue?: string | number | boolean | undefined;
|
|
668
|
+
storage?: "s3" | "server" | undefined;
|
|
669
|
+
contentKind?: "file" | "image" | undefined;
|
|
670
|
+
multiple?: boolean | undefined;
|
|
671
|
+
maxBytes?: number | undefined;
|
|
633
672
|
placeholder?: string | undefined;
|
|
634
673
|
description?: string | undefined;
|
|
635
674
|
options?: {
|
|
@@ -706,7 +745,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
706
745
|
fields: {
|
|
707
746
|
key: string;
|
|
708
747
|
label: string;
|
|
709
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
748
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
710
749
|
required: boolean;
|
|
711
750
|
hidden: boolean;
|
|
712
751
|
disabled: boolean;
|
|
@@ -717,6 +756,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
717
756
|
debounceMs: number;
|
|
718
757
|
config: Record<string, unknown>;
|
|
719
758
|
}[];
|
|
759
|
+
defaultValue?: string | number | boolean | undefined;
|
|
760
|
+
storage?: "s3" | "server" | undefined;
|
|
761
|
+
contentKind?: "file" | "image" | undefined;
|
|
762
|
+
multiple?: boolean | undefined;
|
|
763
|
+
maxBytes?: number | undefined;
|
|
720
764
|
placeholder?: string | undefined;
|
|
721
765
|
description?: string | undefined;
|
|
722
766
|
options?: {
|
|
@@ -1144,7 +1188,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1144
1188
|
fields: {
|
|
1145
1189
|
key: string;
|
|
1146
1190
|
label: string;
|
|
1147
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
1191
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
1148
1192
|
required: boolean;
|
|
1149
1193
|
hidden: boolean;
|
|
1150
1194
|
disabled: boolean;
|
|
@@ -1155,6 +1199,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1155
1199
|
debounceMs: number;
|
|
1156
1200
|
config: Record<string, unknown>;
|
|
1157
1201
|
}[];
|
|
1202
|
+
defaultValue?: string | number | boolean | undefined;
|
|
1203
|
+
storage?: "s3" | "server" | undefined;
|
|
1204
|
+
contentKind?: "file" | "image" | undefined;
|
|
1205
|
+
multiple?: boolean | undefined;
|
|
1206
|
+
maxBytes?: number | undefined;
|
|
1158
1207
|
placeholder?: string | undefined;
|
|
1159
1208
|
description?: string | undefined;
|
|
1160
1209
|
options?: {
|
|
@@ -1292,7 +1341,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1292
1341
|
fields: {
|
|
1293
1342
|
key: string;
|
|
1294
1343
|
label: string;
|
|
1295
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
1344
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
1296
1345
|
required: boolean;
|
|
1297
1346
|
hidden: boolean;
|
|
1298
1347
|
disabled: boolean;
|
|
@@ -1303,6 +1352,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1303
1352
|
debounceMs: number;
|
|
1304
1353
|
config: Record<string, unknown>;
|
|
1305
1354
|
}[];
|
|
1355
|
+
defaultValue?: string | number | boolean | undefined;
|
|
1356
|
+
storage?: "s3" | "server" | undefined;
|
|
1357
|
+
contentKind?: "file" | "image" | undefined;
|
|
1358
|
+
multiple?: boolean | undefined;
|
|
1359
|
+
maxBytes?: number | undefined;
|
|
1306
1360
|
placeholder?: string | undefined;
|
|
1307
1361
|
description?: string | undefined;
|
|
1308
1362
|
options?: {
|
|
@@ -1450,7 +1504,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1450
1504
|
fields: {
|
|
1451
1505
|
key: string;
|
|
1452
1506
|
label: string;
|
|
1453
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
1507
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
1454
1508
|
required: boolean;
|
|
1455
1509
|
hidden: boolean;
|
|
1456
1510
|
disabled: boolean;
|
|
@@ -1461,6 +1515,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1461
1515
|
debounceMs: number;
|
|
1462
1516
|
config: Record<string, unknown>;
|
|
1463
1517
|
}[];
|
|
1518
|
+
defaultValue?: string | number | boolean | undefined;
|
|
1519
|
+
storage?: "s3" | "server" | undefined;
|
|
1520
|
+
contentKind?: "file" | "image" | undefined;
|
|
1521
|
+
multiple?: boolean | undefined;
|
|
1522
|
+
maxBytes?: number | undefined;
|
|
1464
1523
|
placeholder?: string | undefined;
|
|
1465
1524
|
description?: string | undefined;
|
|
1466
1525
|
options?: {
|
|
@@ -1609,7 +1668,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1609
1668
|
fields: {
|
|
1610
1669
|
key: string;
|
|
1611
1670
|
label: string;
|
|
1612
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
1671
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
1613
1672
|
required: boolean;
|
|
1614
1673
|
hidden: boolean;
|
|
1615
1674
|
disabled: boolean;
|
|
@@ -1620,6 +1679,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1620
1679
|
debounceMs: number;
|
|
1621
1680
|
config: Record<string, unknown>;
|
|
1622
1681
|
}[];
|
|
1682
|
+
defaultValue?: string | number | boolean | undefined;
|
|
1683
|
+
storage?: "s3" | "server" | undefined;
|
|
1684
|
+
contentKind?: "file" | "image" | undefined;
|
|
1685
|
+
multiple?: boolean | undefined;
|
|
1686
|
+
maxBytes?: number | undefined;
|
|
1623
1687
|
placeholder?: string | undefined;
|
|
1624
1688
|
description?: string | undefined;
|
|
1625
1689
|
options?: {
|
|
@@ -1755,7 +1819,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1755
1819
|
fields: {
|
|
1756
1820
|
key: string;
|
|
1757
1821
|
label: string;
|
|
1758
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
1822
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
1759
1823
|
required: boolean;
|
|
1760
1824
|
hidden: boolean;
|
|
1761
1825
|
disabled: boolean;
|
|
@@ -1766,6 +1830,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1766
1830
|
debounceMs: number;
|
|
1767
1831
|
config: Record<string, unknown>;
|
|
1768
1832
|
}[];
|
|
1833
|
+
defaultValue?: string | number | boolean | undefined;
|
|
1834
|
+
storage?: "s3" | "server" | undefined;
|
|
1835
|
+
contentKind?: "file" | "image" | undefined;
|
|
1836
|
+
multiple?: boolean | undefined;
|
|
1837
|
+
maxBytes?: number | undefined;
|
|
1769
1838
|
placeholder?: string | undefined;
|
|
1770
1839
|
description?: string | undefined;
|
|
1771
1840
|
options?: {
|
|
@@ -1884,7 +1953,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1884
1953
|
fields: {
|
|
1885
1954
|
key: string;
|
|
1886
1955
|
label: string;
|
|
1887
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
1956
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
1888
1957
|
required: boolean;
|
|
1889
1958
|
hidden: boolean;
|
|
1890
1959
|
disabled: boolean;
|
|
@@ -1895,6 +1964,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1895
1964
|
debounceMs: number;
|
|
1896
1965
|
config: Record<string, unknown>;
|
|
1897
1966
|
}[];
|
|
1967
|
+
defaultValue?: string | number | boolean | undefined;
|
|
1968
|
+
storage?: "s3" | "server" | undefined;
|
|
1969
|
+
contentKind?: "file" | "image" | undefined;
|
|
1970
|
+
multiple?: boolean | undefined;
|
|
1971
|
+
maxBytes?: number | undefined;
|
|
1898
1972
|
placeholder?: string | undefined;
|
|
1899
1973
|
description?: string | undefined;
|
|
1900
1974
|
options?: {
|
|
@@ -1968,6 +2042,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
1968
2042
|
runRuntimeBuilderFormFieldTrigger: (formId: string, fieldKey: string, event: "onChange" | "onBlur", input: {
|
|
1969
2043
|
values: Record<string, unknown>;
|
|
1970
2044
|
value?: unknown;
|
|
2045
|
+
parentValues?: Record<string, unknown> | undefined;
|
|
1971
2046
|
}) => Promise<{
|
|
1972
2047
|
schema: {
|
|
1973
2048
|
field: string;
|
|
@@ -2084,7 +2159,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
2084
2159
|
fields: {
|
|
2085
2160
|
key: string;
|
|
2086
2161
|
label: string;
|
|
2087
|
-
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "textarea";
|
|
2162
|
+
type: "number" | "select" | "date" | "text" | "money" | "checkbox" | "file" | "textarea" | "richtext";
|
|
2088
2163
|
required: boolean;
|
|
2089
2164
|
hidden: boolean;
|
|
2090
2165
|
disabled: boolean;
|
|
@@ -2095,6 +2170,11 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
2095
2170
|
debounceMs: number;
|
|
2096
2171
|
config: Record<string, unknown>;
|
|
2097
2172
|
}[];
|
|
2173
|
+
defaultValue?: string | number | boolean | undefined;
|
|
2174
|
+
storage?: "s3" | "server" | undefined;
|
|
2175
|
+
contentKind?: "file" | "image" | undefined;
|
|
2176
|
+
multiple?: boolean | undefined;
|
|
2177
|
+
maxBytes?: number | undefined;
|
|
2098
2178
|
placeholder?: string | undefined;
|
|
2099
2179
|
description?: string | undefined;
|
|
2100
2180
|
options?: {
|
|
@@ -2189,6 +2269,7 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
2189
2269
|
runRuntimeBuilderViewFieldTrigger: (viewId: string, fieldKey: string, event: "onChange" | "onBlur", input: {
|
|
2190
2270
|
values: Record<string, unknown>;
|
|
2191
2271
|
value?: unknown;
|
|
2272
|
+
parentValues?: Record<string, unknown> | undefined;
|
|
2192
2273
|
}) => Promise<{
|
|
2193
2274
|
schema: {
|
|
2194
2275
|
field: string;
|
|
@@ -2273,6 +2354,25 @@ declare function createBuilderClient({ transport, apiBasePath }: CreateBuilderCl
|
|
|
2273
2354
|
updatedAt: string;
|
|
2274
2355
|
}>;
|
|
2275
2356
|
deleteBuilderViewEntry: (viewId: string, id: string) => Promise<void>;
|
|
2357
|
+
presignRuntimeBuilderFile: (context: {
|
|
2358
|
+
formId?: string;
|
|
2359
|
+
viewId?: string;
|
|
2360
|
+
}, fieldKey: string, input: {
|
|
2361
|
+
contentType: string;
|
|
2362
|
+
contentLength: number;
|
|
2363
|
+
}) => Promise<{
|
|
2364
|
+
url: string;
|
|
2365
|
+
key: string;
|
|
2366
|
+
uploadUrl: string;
|
|
2367
|
+
expiresInSeconds: number;
|
|
2368
|
+
}>;
|
|
2369
|
+
uploadRuntimeBuilderFile: (context: {
|
|
2370
|
+
formId?: string;
|
|
2371
|
+
viewId?: string;
|
|
2372
|
+
}, fieldKey: string, file: Blob) => Promise<{
|
|
2373
|
+
url: string;
|
|
2374
|
+
key: string;
|
|
2375
|
+
}>;
|
|
2276
2376
|
};
|
|
2277
2377
|
type BuilderContextValue = {
|
|
2278
2378
|
client: BuilderClient;
|
|
@@ -2297,9 +2397,29 @@ declare function BuilderForm(props: BuilderFormProps): react.JSX.Element;
|
|
|
2297
2397
|
declare function BuilderGrid(props: BuilderGridProps): react.JSX.Element;
|
|
2298
2398
|
declare function BuilderView(props: BuilderViewProps): react.JSX.Element;
|
|
2299
2399
|
|
|
2400
|
+
type Props$1<T extends FieldValues> = {
|
|
2401
|
+
field: BuilderField;
|
|
2402
|
+
formId?: string;
|
|
2403
|
+
viewId?: string;
|
|
2404
|
+
name: Path<T>;
|
|
2405
|
+
};
|
|
2406
|
+
declare function ReadyFileField<T extends FieldValues>({ field, formId, viewId, name }: Props$1<T>): react.JSX.Element;
|
|
2407
|
+
|
|
2408
|
+
type Props<T extends FieldValues> = {
|
|
2409
|
+
field: BuilderField;
|
|
2410
|
+
name: Path<T>;
|
|
2411
|
+
};
|
|
2412
|
+
declare function ReadyRichTextField<T extends FieldValues>({ field, name }: Props<T>): react.JSX.Element;
|
|
2413
|
+
|
|
2414
|
+
type RichTextContentProps = {
|
|
2415
|
+
className?: string;
|
|
2416
|
+
value: unknown;
|
|
2417
|
+
};
|
|
2418
|
+
declare function RichTextContent({ className, value }: RichTextContentProps): react.JSX.Element;
|
|
2419
|
+
|
|
2300
2420
|
declare const builderUiPackage: {
|
|
2301
2421
|
readonly name: "@duke333/builder-ui";
|
|
2302
|
-
readonly version: "0.2.
|
|
2422
|
+
readonly version: "0.2.4";
|
|
2303
2423
|
};
|
|
2304
2424
|
|
|
2305
|
-
export { BuilderApiClient, BuilderApiContracts, BuilderApiTransport, type BuilderClient, BuilderFieldOptionsQuery, BuilderForm, type BuilderFormProps, BuilderGrid, type BuilderGridProps, BuilderHooks, type BuilderNotification, BuilderProvider, type BuilderProviderProps, type BuilderRuntimeComponents, BuilderView, type BuilderViewProps, type CreateBuilderClientOptions, type ReadyBuilderContracts, builderErrorMessage, builderUiPackage, createBuilderClient, useBuilderRuntime };
|
|
2425
|
+
export { BuilderApiClient, BuilderApiContracts, BuilderApiTransport, type BuilderClient, BuilderFieldOptionsQuery, BuilderForm, type BuilderFormProps, BuilderGrid, type BuilderGridProps, BuilderHooks, type BuilderNotification, BuilderProvider, type BuilderProviderProps, type BuilderRuntimeComponents, BuilderView, type BuilderViewProps, type CreateBuilderClientOptions, type ReadyBuilderContracts, ReadyFileField, ReadyRichTextField, RichTextContent, type RichTextContentProps, builderErrorMessage, builderUiPackage, createBuilderClient, useBuilderRuntime };
|