@dappworks/kit 0.4.68 → 0.4.69
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/{PromiseState-2a8c856c.d.ts → PromiseState-b0cc408e.d.ts} +3 -0
- package/dist/{chunk-N4XCPX4L.mjs → chunk-4YCP5CJ4.mjs} +9 -2
- package/dist/chunk-4YCP5CJ4.mjs.map +1 -0
- package/dist/{chunk-CFVG66F4.mjs → chunk-66N3D7MI.mjs} +1 -1
- package/dist/chunk-66N3D7MI.mjs.map +1 -0
- package/dist/{chunk-SXQEYWUP.mjs → chunk-DZMNL4BZ.mjs} +1 -1
- package/dist/chunk-DZMNL4BZ.mjs.map +1 -0
- package/dist/{chunk-WAYJJYKN.mjs → chunk-OZ3JSH5J.mjs} +2 -2
- package/dist/{chunk-I5WU3NZO.mjs → chunk-PPYYRQDD.mjs} +26 -15
- package/dist/chunk-PPYYRQDD.mjs.map +1 -0
- package/dist/chunk-Y23EH2XR.mjs +24 -0
- package/dist/chunk-Y23EH2XR.mjs.map +1 -0
- package/dist/{chunk-VB62FUWK.mjs → chunk-YOCDMBRI.mjs} +2 -2
- package/dist/dev.mjs +111 -29
- package/dist/dev.mjs.map +1 -1
- package/dist/experimental.mjs +2 -2
- package/dist/form.d.mts +2 -105
- package/dist/form.mjs +72 -78
- package/dist/form.mjs.map +1 -1
- package/dist/index.d.mts +8 -28
- package/dist/index.mjs +24 -72
- package/dist/index.mjs.map +1 -1
- package/dist/jsontable.mjs +3 -3
- package/dist/metrics.mjs +20 -37
- package/dist/metrics.mjs.map +1 -1
- package/dist/plugins.d.mts +5 -5
- package/dist/plugins.mjs +4 -4
- package/dist/ui.d.mts +10 -1
- package/dist/ui.mjs +2 -1
- package/dist/ui.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CFVG66F4.mjs.map +0 -1
- package/dist/chunk-I5WU3NZO.mjs.map +0 -1
- package/dist/chunk-N4XCPX4L.mjs.map +0 -1
- package/dist/chunk-SXQEYWUP.mjs.map +0 -1
- package/dist/chunk-ZPPKSMXO.mjs +0 -90
- package/dist/chunk-ZPPKSMXO.mjs.map +0 -1
- /package/dist/{chunk-WAYJJYKN.mjs.map → chunk-OZ3JSH5J.mjs.map} +0 -0
- /package/dist/{chunk-VB62FUWK.mjs.map → chunk-YOCDMBRI.mjs.map} +0 -0
package/dist/experimental.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PromiseState } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
import { PromiseState } from './chunk-PPYYRQDD.mjs';
|
|
2
|
+
import './chunk-4YCP5CJ4.mjs';
|
|
3
3
|
import { RootStore } from './chunk-HRWHDF2F.mjs';
|
|
4
4
|
import { _ } from './chunk-MGU3KYGC.mjs';
|
|
5
5
|
import { __objRest, __spreadValues, __spreadProps } from './chunk-6F7H4PAA.mjs';
|
package/dist/form.d.mts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { LegacyRef, Ref, Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { ButtonProps, TabsProps, SlotsToClasses, ModalSlots } from '@nextui-org/react';
|
|
3
|
-
import { UiSchema, RJSFSchema
|
|
3
|
+
import { UiSchema, RJSFSchema } from '@rjsf/utils';
|
|
4
4
|
import * as _rjsf_validator_ajv8_lib_validator from '@rjsf/validator-ajv8/lib/validator';
|
|
5
5
|
import Form, { IChangeEvent } from '@rjsf/core';
|
|
6
|
-
import { EditorProps } from '@monaco-editor/react';
|
|
7
6
|
import { S as Store, R as RootStore } from './root-766ae985.js';
|
|
8
7
|
import EventEmitter from 'events';
|
|
9
|
-
export { P as PaginationState } from './PaginationState-c19e621a.js';
|
|
10
8
|
import 'typed-emitter';
|
|
11
9
|
|
|
12
10
|
declare class JSONSchemaFormState<T, U = UiSchema> {
|
|
@@ -124,107 +122,6 @@ type JSONFormProps<T = FormDataType> = {
|
|
|
124
122
|
};
|
|
125
123
|
declare const JSONForm: <T extends FormDataType>(props: JSONFormProps<T>) => React.JSX.Element;
|
|
126
124
|
|
|
127
|
-
declare const JSONEditor: ({ className, height, initialJson, onChange, onSubmit }: {
|
|
128
|
-
className?: string;
|
|
129
|
-
height?: string | number;
|
|
130
|
-
initialJson: string;
|
|
131
|
-
onChange?: (value: Record<string, any>) => void;
|
|
132
|
-
onSubmit?: (value: Record<string, any>) => void;
|
|
133
|
-
}) => React.JSX.Element;
|
|
134
|
-
|
|
135
|
-
type Options$5 = {
|
|
136
|
-
className?: string;
|
|
137
|
-
size: 'sm' | 'md' | 'lg';
|
|
138
|
-
color: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
139
|
-
};
|
|
140
|
-
interface CheckboxWidgetProps extends WidgetProps {
|
|
141
|
-
options: Options$5;
|
|
142
|
-
}
|
|
143
|
-
interface CheckboxWidgetUIOptions {
|
|
144
|
-
"ui:widget": (props: CheckboxWidgetProps) => JSX.Element;
|
|
145
|
-
"ui:options": Options$5;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
type Options$4 = {
|
|
149
|
-
editorHeight?: string;
|
|
150
|
-
readOnly?: boolean;
|
|
151
|
-
language?: string;
|
|
152
|
-
languageSelectorOptions?: {
|
|
153
|
-
label: string;
|
|
154
|
-
value: string;
|
|
155
|
-
}[];
|
|
156
|
-
onChangeLanguage?: (v: string) => void;
|
|
157
|
-
onRun?: (v: string) => void;
|
|
158
|
-
onMount?: EditorProps['onMount'];
|
|
159
|
-
jsonStrSpace?: number;
|
|
160
|
-
};
|
|
161
|
-
interface EditorWidgetProps extends WidgetProps {
|
|
162
|
-
options: Options$4;
|
|
163
|
-
}
|
|
164
|
-
type EditorWidgetUIOptions = {
|
|
165
|
-
"ui:widget": (props: EditorWidgetProps) => JSX.Element;
|
|
166
|
-
"ui:options": Options$4;
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
type Options$3 = {
|
|
170
|
-
className?: string;
|
|
171
|
-
selectOptions: {
|
|
172
|
-
icon: JSX.Element;
|
|
173
|
-
label: string;
|
|
174
|
-
value: string;
|
|
175
|
-
}[];
|
|
176
|
-
};
|
|
177
|
-
interface IconSelectWidgetProps extends WidgetProps {
|
|
178
|
-
options: Options$3;
|
|
179
|
-
}
|
|
180
|
-
interface IconSelectWidgetUIOptions {
|
|
181
|
-
"ui:widget": (props: IconSelectWidgetProps) => JSX.Element;
|
|
182
|
-
"ui:options": Options$3;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
type Options$2 = {
|
|
186
|
-
className?: string;
|
|
187
|
-
labelPlacement?: "inside" | "outside" | "outside-left";
|
|
188
|
-
size: "sm" | "md" | "lg";
|
|
189
|
-
placeholder?: string;
|
|
190
|
-
};
|
|
191
|
-
interface InputWidgetProps extends WidgetProps {
|
|
192
|
-
options: Options$2;
|
|
193
|
-
}
|
|
194
|
-
interface InputWidgetUIOptions {
|
|
195
|
-
"ui:widget": (props: InputWidgetProps) => JSX.Element;
|
|
196
|
-
"ui:options": Options$2;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
type Options$1 = {
|
|
200
|
-
className?: string;
|
|
201
|
-
labelPlacement?: "top" | "left";
|
|
202
|
-
size: "sm" | "md" | "lg";
|
|
203
|
-
placeholder?: string;
|
|
204
|
-
};
|
|
205
|
-
interface SelectWidgetProps extends WidgetProps {
|
|
206
|
-
options: Options$1;
|
|
207
|
-
}
|
|
208
|
-
interface SelectWidgetUIOptions {
|
|
209
|
-
"ui:widget": (props: SelectWidgetProps) => JSX.Element;
|
|
210
|
-
"ui:options": Options$1;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
type Options = {
|
|
214
|
-
className?: string;
|
|
215
|
-
labelPlacement?: 'inside' | 'outside' | 'outside-left';
|
|
216
|
-
size: 'sm' | 'md' | 'lg';
|
|
217
|
-
maxRows?: number;
|
|
218
|
-
placeholder?: string;
|
|
219
|
-
};
|
|
220
|
-
interface TextareaWidgetProps extends WidgetProps {
|
|
221
|
-
options: Options;
|
|
222
|
-
}
|
|
223
|
-
interface TextareaWidgetUIOptions {
|
|
224
|
-
'ui:widget': (props: TextareaWidgetProps) => JSX.Element;
|
|
225
|
-
'ui:options': Options;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
125
|
interface Props {
|
|
229
126
|
formState: JSONSchemaFormState<any>;
|
|
230
127
|
children?: any;
|
|
@@ -347,4 +244,4 @@ declare class JSONViewPlugin implements Store {
|
|
|
347
244
|
static JSONView: (props: JSONViewType) => React.JSX.Element;
|
|
348
245
|
}
|
|
349
246
|
|
|
350
|
-
export {
|
|
247
|
+
export { FieldLayoutType, FormConfigType, FormDataOfKey, FormDataType, FormKey, FormLayoutType, FormModalStore, FormPlugin, JSONDataType, JSONForm, JSONFormProps, JSONSchemaForm, JSONViewPlugin, JSONViewType, LayoutConfigType, LayoutType, getComplexFormData, getFormData, getFormState, getSimpleFormData };
|
package/dist/form.mjs
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
export { PaginationState } from './chunk-ONVPCAMQ.mjs';
|
|
4
|
-
import { useStore } from './chunk-SXQEYWUP.mjs';
|
|
1
|
+
import { helper } from './chunk-66N3D7MI.mjs';
|
|
2
|
+
import { useStore } from './chunk-DZMNL4BZ.mjs';
|
|
5
3
|
import { RootStore } from './chunk-HRWHDF2F.mjs';
|
|
6
4
|
import { _ } from './chunk-MGU3KYGC.mjs';
|
|
7
5
|
import { cn } from './chunk-6UHBBDKI.mjs';
|
|
8
6
|
import { __objRest, __spreadValues, __spreadProps } from './chunk-6F7H4PAA.mjs';
|
|
9
|
-
import
|
|
7
|
+
import React6, { useEffect, useMemo, useState, createRef } from 'react';
|
|
10
8
|
import { Modal, ModalContent, ModalHeader, ModalBody, Button, Checkbox, Input, Card, Tabs, Tab } from '@nextui-org/react';
|
|
11
9
|
import { ChevronUp, ChevronDown, Check } from 'lucide-react';
|
|
12
10
|
import MonacoEditor from '@monaco-editor/react';
|
|
@@ -21,7 +19,6 @@ import EventEmitter from 'events';
|
|
|
21
19
|
function CheckboxWidget({
|
|
22
20
|
onChange,
|
|
23
21
|
options,
|
|
24
|
-
id,
|
|
25
22
|
label,
|
|
26
23
|
value,
|
|
27
24
|
disabled,
|
|
@@ -29,10 +26,9 @@ function CheckboxWidget({
|
|
|
29
26
|
}) {
|
|
30
27
|
const { size = "sm", color = "primary" } = options;
|
|
31
28
|
const { description } = schema;
|
|
32
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
|
|
33
30
|
Checkbox,
|
|
34
31
|
{
|
|
35
|
-
id,
|
|
36
32
|
classNames: {
|
|
37
33
|
base: cn(
|
|
38
34
|
"m-0 flex items-center justify-start w-full",
|
|
@@ -42,7 +38,7 @@ function CheckboxWidget({
|
|
|
42
38
|
},
|
|
43
39
|
defaultSelected: value,
|
|
44
40
|
isDisabled: disabled,
|
|
45
|
-
icon: /* @__PURE__ */
|
|
41
|
+
icon: /* @__PURE__ */ React6.createElement(Check, { className: "bg-white dark:bg-black" }),
|
|
46
42
|
color,
|
|
47
43
|
size,
|
|
48
44
|
onChange: (e) => {
|
|
@@ -51,14 +47,13 @@ function CheckboxWidget({
|
|
|
51
47
|
}
|
|
52
48
|
},
|
|
53
49
|
label
|
|
54
|
-
), description && /* @__PURE__ */
|
|
50
|
+
), description && /* @__PURE__ */ React6.createElement("div", { className: "mt-1 text-xs text-[#A1A1A9] dark:text-[#717179]" }, description));
|
|
55
51
|
}
|
|
56
52
|
var CheckboxWidget_default = CheckboxWidget;
|
|
57
53
|
function InputWidget(props) {
|
|
58
54
|
const {
|
|
59
55
|
onChange,
|
|
60
56
|
options,
|
|
61
|
-
id,
|
|
62
57
|
label,
|
|
63
58
|
value,
|
|
64
59
|
required,
|
|
@@ -67,10 +62,9 @@ function InputWidget(props) {
|
|
|
67
62
|
} = props;
|
|
68
63
|
const { className, labelPlacement = "inside", size = "sm" } = options;
|
|
69
64
|
const placeholder = props.placeholder || options.placeholder;
|
|
70
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ React6.createElement(
|
|
71
66
|
Input,
|
|
72
67
|
{
|
|
73
|
-
id,
|
|
74
68
|
className: cn("w-full", className),
|
|
75
69
|
label,
|
|
76
70
|
placeholder,
|
|
@@ -88,20 +82,19 @@ function InputWidget(props) {
|
|
|
88
82
|
}
|
|
89
83
|
var InputWidget_default = InputWidget;
|
|
90
84
|
function SelectWidget(props) {
|
|
91
|
-
const { onChange, options,
|
|
85
|
+
const { onChange, options, label, value, required, disabled, schema } = props;
|
|
92
86
|
const { className, labelPlacement = "top", placeholder = "Select an option" } = options;
|
|
93
87
|
const { selectOptions = [], description } = schema;
|
|
94
88
|
const labelText = label == null ? void 0 : label.trim();
|
|
95
89
|
const placeholderText = props.placeholder || placeholder;
|
|
96
|
-
return /* @__PURE__ */
|
|
90
|
+
return /* @__PURE__ */ React6.createElement("div", { className: cn("", className) }, /* @__PURE__ */ React6.createElement(
|
|
97
91
|
"div",
|
|
98
92
|
{
|
|
99
93
|
className: cn("flex flex-col", {
|
|
100
94
|
"flex-row items-center": labelPlacement === "left"
|
|
101
|
-
})
|
|
102
|
-
id
|
|
95
|
+
})
|
|
103
96
|
},
|
|
104
|
-
labelText && /* @__PURE__ */
|
|
97
|
+
labelText && /* @__PURE__ */ React6.createElement(
|
|
105
98
|
"label",
|
|
106
99
|
{
|
|
107
100
|
className: cn("flex items-center text-sm whitespace-nowrap", {
|
|
@@ -110,27 +103,28 @@ function SelectWidget(props) {
|
|
|
110
103
|
})
|
|
111
104
|
},
|
|
112
105
|
labelText,
|
|
113
|
-
required && /* @__PURE__ */
|
|
106
|
+
required && /* @__PURE__ */ React6.createElement("span", { className: "ml-[2px] font-bold text-red-600" }, "*")
|
|
114
107
|
),
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
|
|
108
|
+
description && /* @__PURE__ */ React6.createElement("div", { className: "my-1 text-xs text-[#A1A1A9] dark:text-[#717179]" }, description),
|
|
109
|
+
/* @__PURE__ */ React6.createElement("select", { className: "w-full p-3 text-sm rounded-md bg-[#F4F4F5] dark:bg-[#27272A]", defaultValue: value, disabled, onChange: (event) => onChange(event.target.value) }, /* @__PURE__ */ React6.createElement("option", { value: "", disabled: true, selected: true }, placeholderText), selectOptions.map((item) => {
|
|
110
|
+
return /* @__PURE__ */ React6.createElement("option", { key: item.value, value: item.value }, item.label);
|
|
117
111
|
}))
|
|
118
|
-
)
|
|
112
|
+
));
|
|
119
113
|
}
|
|
120
114
|
var SelectWidget_default = SelectWidget;
|
|
121
|
-
var EditorWidget = ({
|
|
115
|
+
var EditorWidget = ({ label, options = {}, value, required, schema, disabled, onChange }) => {
|
|
122
116
|
const { editorHeight = "200px", readOnly = false, language = "json", jsonStrSpace, languageSelectorOptions = [], onChangeLanguage, onRun, onMount } = options;
|
|
123
117
|
const [selectedLanguage, setSelectedLanguage] = useState("");
|
|
124
118
|
const [runLoading, setRunLoading] = useState(false);
|
|
125
119
|
const showLanguageSelector = languageSelectorOptions.length > 0;
|
|
126
|
-
return /* @__PURE__ */
|
|
120
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "flex flex-col relative" }, /* @__PURE__ */ React6.createElement("div", { className: cn("flex justify-between items-center", { "mb-[10px]": label.trim() || showLanguageSelector }) }, label && /* @__PURE__ */ React6.createElement(
|
|
127
121
|
"label",
|
|
128
122
|
{
|
|
129
123
|
className: "mr-2 flex items-center text-sm"
|
|
130
124
|
},
|
|
131
125
|
label,
|
|
132
|
-
required && /* @__PURE__ */
|
|
133
|
-
), showLanguageSelector && /* @__PURE__ */
|
|
126
|
+
required && /* @__PURE__ */ React6.createElement("span", { className: "font-bold text-red-600" }, "*")
|
|
127
|
+
), showLanguageSelector && /* @__PURE__ */ React6.createElement(
|
|
134
128
|
"select",
|
|
135
129
|
{
|
|
136
130
|
className: "w-full p-3 text-sm rounded-md bg-[#F4F4F5] dark:bg-[#27272A]",
|
|
@@ -142,9 +136,9 @@ var EditorWidget = ({ id, label, options = {}, value, required, schema, disabled
|
|
|
142
136
|
}
|
|
143
137
|
},
|
|
144
138
|
languageSelectorOptions.map((item) => {
|
|
145
|
-
return /* @__PURE__ */
|
|
139
|
+
return /* @__PURE__ */ React6.createElement("option", { key: item.value, value: item.value }, item.label);
|
|
146
140
|
})
|
|
147
|
-
)), schema.description && /* @__PURE__ */
|
|
141
|
+
)), schema.description && /* @__PURE__ */ React6.createElement("div", { className: "mb-2 text-xs text-[#A1A1A9]" }, schema.description), /* @__PURE__ */ React6.createElement("div", { className: "rounded-lg overflow-hidden relative" }, /* @__PURE__ */ React6.createElement(
|
|
148
142
|
MonacoEditor,
|
|
149
143
|
{
|
|
150
144
|
options: { readOnly: readOnly || disabled, minimap: { enabled: false } },
|
|
@@ -161,7 +155,7 @@ var EditorWidget = ({ id, label, options = {}, value, required, schema, disabled
|
|
|
161
155
|
}
|
|
162
156
|
}
|
|
163
157
|
}
|
|
164
|
-
)), onRun && /* @__PURE__ */
|
|
158
|
+
)), onRun && /* @__PURE__ */ React6.createElement(
|
|
165
159
|
Button,
|
|
166
160
|
{
|
|
167
161
|
className: "absolute bottom-2 right-4",
|
|
@@ -379,7 +373,7 @@ var getFormState = (props, formLayout = {}) => {
|
|
|
379
373
|
var BatchSubmitButton = ({ formStates, onSubmit, buttonProps }) => {
|
|
380
374
|
const _a = buttonProps || {}, { className, onClick, children, isLoading, onBatchSubmit } = _a, rest = __objRest(_a, ["className", "onClick", "children", "isLoading", "onBatchSubmit"]);
|
|
381
375
|
const [loading, setLoading] = useState(false);
|
|
382
|
-
return /* @__PURE__ */
|
|
376
|
+
return /* @__PURE__ */ React6.createElement(
|
|
383
377
|
Button,
|
|
384
378
|
__spreadValues({
|
|
385
379
|
className: cn("mt-4 ml-auto", className),
|
|
@@ -421,7 +415,7 @@ var BatchSubmitButton = ({ formStates, onSubmit, buttonProps }) => {
|
|
|
421
415
|
var SubmitButton = ({ formKey, formState, buttonProps }) => {
|
|
422
416
|
const _a = buttonProps || {}, { className, onClick, children, isLoading, onAfterSubmit } = _a, rest = __objRest(_a, ["className", "onClick", "children", "isLoading", "onAfterSubmit"]);
|
|
423
417
|
const [loading, setLoading] = useState(false);
|
|
424
|
-
return /* @__PURE__ */
|
|
418
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React6.createElement(
|
|
425
419
|
Button,
|
|
426
420
|
__spreadValues({
|
|
427
421
|
className: cn("mt-4 ml-auto", className),
|
|
@@ -461,51 +455,51 @@ function FieldTemplate(props) {
|
|
|
461
455
|
const isDateTime = uiSchema && uiSchema["ui:widget"] === "date-time";
|
|
462
456
|
const isTime = uiSchema && uiSchema["ui:widget"] === "time";
|
|
463
457
|
const showLabel = isDate || isDateTime || isTime;
|
|
464
|
-
return /* @__PURE__ */
|
|
458
|
+
return /* @__PURE__ */ React6.createElement("div", { className: cn(classNames) }, showLabel && /* @__PURE__ */ React6.createElement("label", { htmlFor: id, className: cn("flex items-center h-8") }, /* @__PURE__ */ React6.createElement("span", { className: "text-sm" }, label), required && /* @__PURE__ */ React6.createElement("span", { className: "font-bold text-red-600" }, "*")), children);
|
|
465
459
|
}
|
|
466
460
|
var renderLayout = (layout, fields, n = 1) => {
|
|
467
461
|
n++;
|
|
468
462
|
return layout.map((item, index) => {
|
|
469
463
|
if (Array.isArray(item)) {
|
|
470
464
|
const even = (n & 1) === 0;
|
|
471
|
-
return /* @__PURE__ */
|
|
465
|
+
return /* @__PURE__ */ React6.createElement("div", { key: index, className: cn("w-full flex justify-between items-center space-x-2", even ? "flex-row items-end" : "flex-col") }, renderLayout(item, fields, n));
|
|
472
466
|
} else {
|
|
473
|
-
return /* @__PURE__ */
|
|
467
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "w-full", key: index }, fields[item]);
|
|
474
468
|
}
|
|
475
469
|
});
|
|
476
470
|
};
|
|
477
471
|
var ObjectFieldTemplate = ({ title, idSchema: { $id }, properties, uiSchema: { layout } }) => {
|
|
478
472
|
const [opened, setOpened] = useState(false);
|
|
479
473
|
const fields = Object.fromEntries(properties.map((item) => [item.name, item.content]));
|
|
480
|
-
return /* @__PURE__ */
|
|
481
|
-
return /* @__PURE__ */
|
|
482
|
-
}) : /* @__PURE__ */
|
|
474
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "w-full space-y-2.5" }, $id === "root" ? layout ? renderLayout(layout, fields) : properties.map((element) => {
|
|
475
|
+
return /* @__PURE__ */ React6.createElement("div", { key: element.content.key }, element.content);
|
|
476
|
+
}) : /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
|
|
483
477
|
"div",
|
|
484
478
|
{
|
|
485
479
|
className: "mt-5 mb-[10px] flex justify-between items-center cursor-pointer border-t-[1px solid #E5E5EA] py-[5px] hover:bg-[#F2F2F7] dark:hover:bg-gray-900",
|
|
486
480
|
onClick: () => setOpened((o) => !o)
|
|
487
481
|
},
|
|
488
|
-
/* @__PURE__ */
|
|
489
|
-
opened ? /* @__PURE__ */
|
|
490
|
-
), /* @__PURE__ */
|
|
491
|
-
return /* @__PURE__ */
|
|
482
|
+
/* @__PURE__ */ React6.createElement("div", { className: "text-gray-900 dark:text-gray-100 font-bold text-base" }, title),
|
|
483
|
+
opened ? /* @__PURE__ */ React6.createElement(ChevronUp, null) : /* @__PURE__ */ React6.createElement(ChevronDown, null)
|
|
484
|
+
), /* @__PURE__ */ React6.createElement("div", { className: cn("mt-2 space-y-2.5", opened ? "block" : "hidden") }, layout ? renderLayout(layout, fields) : properties.map((element) => {
|
|
485
|
+
return /* @__PURE__ */ React6.createElement("div", { key: element.content.key }, element.content);
|
|
492
486
|
}))));
|
|
493
487
|
};
|
|
494
488
|
var ErrorListTemplate = ({ errors }) => {
|
|
495
|
-
return /* @__PURE__ */
|
|
489
|
+
return /* @__PURE__ */ React6.createElement("div", null, /* @__PURE__ */ React6.createElement("div", { className: "font-bold" }, "Errors"), /* @__PURE__ */ React6.createElement("div", { className: "mt-[10px]" }, errors.map((error) => /* @__PURE__ */ React6.createElement("div", { className: "mb-[10px]", color: "red", key: error.property }, error.stack))));
|
|
496
490
|
};
|
|
497
491
|
var SubmitButton2 = ({ uiSchema }) => {
|
|
498
492
|
const { submitText, norender, props: submitButtonProps = {} } = Utils.getSubmitButtonOptions(uiSchema);
|
|
499
493
|
if (norender) {
|
|
500
494
|
return null;
|
|
501
495
|
}
|
|
502
|
-
return /* @__PURE__ */
|
|
496
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ React6.createElement(Button, { type: "submit", color: "primary", size: "sm" }, submitText));
|
|
503
497
|
};
|
|
504
498
|
var JSONSchemaForm = observer(({ children, formState }) => {
|
|
505
499
|
var _a;
|
|
506
500
|
if (!((_a = formState == null ? void 0 : formState.dynamicData) == null ? void 0 : _a.ready))
|
|
507
|
-
return /* @__PURE__ */
|
|
508
|
-
return /* @__PURE__ */
|
|
501
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null);
|
|
502
|
+
return /* @__PURE__ */ React6.createElement(
|
|
509
503
|
Form,
|
|
510
504
|
{
|
|
511
505
|
showErrorList: "bottom",
|
|
@@ -652,7 +646,7 @@ var colSpanLg = {
|
|
|
652
646
|
};
|
|
653
647
|
|
|
654
648
|
// components/ui/grid/col.tsx
|
|
655
|
-
var Col =
|
|
649
|
+
var Col = React6.forwardRef((props, ref) => {
|
|
656
650
|
const _a = props, { numColSpan = 1, numColSpanSm, numColSpanMd, numColSpanLg, children, className } = _a, other = __objRest(_a, ["numColSpan", "numColSpanSm", "numColSpanMd", "numColSpanLg", "children", "className"]);
|
|
657
651
|
const getColSpan = (numColSpan2, colSpanMapping) => {
|
|
658
652
|
if (!numColSpan2)
|
|
@@ -668,7 +662,7 @@ var Col = React7.forwardRef((props, ref) => {
|
|
|
668
662
|
const spanLg = getColSpan(numColSpanLg, colSpanLg);
|
|
669
663
|
return cn(spanBase, spanSm, spanMd, spanLg);
|
|
670
664
|
};
|
|
671
|
-
return /* @__PURE__ */
|
|
665
|
+
return /* @__PURE__ */ React6.createElement("div", __spreadValues({ ref, className: cn(getColSpanClassNames(), className) }, other), children);
|
|
672
666
|
});
|
|
673
667
|
Col.displayName = "Col";
|
|
674
668
|
var col_default = Col;
|
|
@@ -679,14 +673,14 @@ var getGridCols = (numCols, gridColsMapping) => {
|
|
|
679
673
|
return "";
|
|
680
674
|
return gridColsMapping[numCols];
|
|
681
675
|
};
|
|
682
|
-
var Grid =
|
|
676
|
+
var Grid = React6.forwardRef((props, ref) => {
|
|
683
677
|
const _a = props, { numItems = 1, numItemsSm, numItemsMd, numItemsLg, children, className } = _a, other = __objRest(_a, ["numItems", "numItemsSm", "numItemsMd", "numItemsLg", "children", "className"]);
|
|
684
678
|
const colsBase = getGridCols(numItems, gridCols);
|
|
685
679
|
const colsSm = getGridCols(numItemsSm, gridColsSm);
|
|
686
680
|
const colsMd = getGridCols(numItemsMd, gridColsMd);
|
|
687
681
|
const colsLg = getGridCols(numItemsLg, gridColsLg);
|
|
688
682
|
const colClassNames = cn(colsBase, colsSm, colsMd, colsLg);
|
|
689
|
-
return /* @__PURE__ */
|
|
683
|
+
return /* @__PURE__ */ React6.createElement("div", __spreadValues({ ref, className: cn("grid", colClassNames, className) }, other), children);
|
|
690
684
|
});
|
|
691
685
|
Grid.displayName = "Grid";
|
|
692
686
|
var grid_default = Grid;
|
|
@@ -701,23 +695,23 @@ var GridLayout = (props) => {
|
|
|
701
695
|
onReady(formStates);
|
|
702
696
|
}
|
|
703
697
|
}, [formStates]);
|
|
704
|
-
return /* @__PURE__ */
|
|
698
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(grid_default, { numItems: $gridColumn != null ? $gridColumn : 1, className: "gap-2" }, Object.keys(formStates).map((key) => {
|
|
705
699
|
var _a2;
|
|
706
700
|
const layout = formLayout[key];
|
|
707
|
-
return /* @__PURE__ */
|
|
708
|
-
})), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ React6.createElement(col_default, { numColSpan: (_a2 = layout == null ? void 0 : layout.colSpan) != null ? _a2 : 1, key, id: `form-${key}` }, /* @__PURE__ */ React6.createElement(Card, { className: cn("h-full m-0 p-4 shadow-sm border-1", layout == null ? void 0 : layout.cardCss) }, /* @__PURE__ */ React6.createElement("div", { className: cn("mb-2 font-bold text-center", layout == null ? void 0 : layout.titleBoxCss) }, (layout == null ? void 0 : layout.title) || key), /* @__PURE__ */ React6.createElement(JSONSchemaForm, { formState: formStates[key] }, (layout == null ? void 0 : layout.submitButtonProps) && /* @__PURE__ */ React6.createElement(SubmitButton, { formKey: key, formState: formStates[key], buttonProps: layout.submitButtonProps }))));
|
|
702
|
+
})), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React6.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React6.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
|
|
709
703
|
};
|
|
710
704
|
var CollapsibleBox = ({ formKey, title, titleBoxCss, formState, submitButtonProps }) => {
|
|
711
705
|
const [opened, setOpened] = useState(true);
|
|
712
|
-
return /* @__PURE__ */
|
|
706
|
+
return /* @__PURE__ */ React6.createElement("div", { id: `form-${formKey}` }, /* @__PURE__ */ React6.createElement(
|
|
713
707
|
"div",
|
|
714
708
|
{
|
|
715
709
|
className: "mt-5 mb-[10px] flex justify-between items-center cursor-pointer border-t-[1px solid #E5E5EA] py-[5px] hover:bg-[#F2F2F7] dark:hover:bg-gray-900",
|
|
716
710
|
onClick: () => setOpened((o) => !o)
|
|
717
711
|
},
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
opened ? /* @__PURE__ */
|
|
720
|
-
), /* @__PURE__ */
|
|
712
|
+
/* @__PURE__ */ React6.createElement("div", { className: cn("text-gray-900 dark:text-gray-100 font-bold text-base", titleBoxCss) }, title),
|
|
713
|
+
opened ? /* @__PURE__ */ React6.createElement(ChevronUp, null) : /* @__PURE__ */ React6.createElement(ChevronDown, null)
|
|
714
|
+
), /* @__PURE__ */ React6.createElement("div", { className: cn("mt-2", opened ? "block" : "hidden") }, /* @__PURE__ */ React6.createElement(JSONSchemaForm, { formState }, submitButtonProps && /* @__PURE__ */ React6.createElement(SubmitButton, { formKey, formState, buttonProps: submitButtonProps }))));
|
|
721
715
|
};
|
|
722
716
|
var ListLayout = (props) => {
|
|
723
717
|
const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady } = props;
|
|
@@ -728,11 +722,11 @@ var ListLayout = (props) => {
|
|
|
728
722
|
onReady(formStates);
|
|
729
723
|
}
|
|
730
724
|
}, [formStates]);
|
|
731
|
-
return /* @__PURE__ */
|
|
725
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, Object.keys(formStates).map((key) => {
|
|
732
726
|
const layout = formLayout[key];
|
|
733
727
|
const formState = formStates[key];
|
|
734
|
-
return /* @__PURE__ */
|
|
735
|
-
}), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */
|
|
728
|
+
return /* @__PURE__ */ React6.createElement(CollapsibleBox, { key, formKey: key, title: (layout == null ? void 0 : layout.title) || key, titleBoxCss: layout == null ? void 0 : layout.titleBoxCss, formState, submitButtonProps: layout == null ? void 0 : layout.submitButtonProps });
|
|
729
|
+
}), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React6.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React6.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
|
|
736
730
|
};
|
|
737
731
|
var SimpleLayout = (props) => {
|
|
738
732
|
const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady } = props;
|
|
@@ -743,10 +737,10 @@ var SimpleLayout = (props) => {
|
|
|
743
737
|
onReady(formStates);
|
|
744
738
|
}
|
|
745
739
|
}, [formStates]);
|
|
746
|
-
return /* @__PURE__ */
|
|
740
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement("div", { className: "space-y-2" }, Object.keys(formStates).map((key) => {
|
|
747
741
|
const layout = formLayout[key];
|
|
748
|
-
return /* @__PURE__ */
|
|
749
|
-
})), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */
|
|
742
|
+
return /* @__PURE__ */ React6.createElement("div", { key, id: `form-${key}` }, /* @__PURE__ */ React6.createElement(JSONSchemaForm, { formState: formStates[key] }, (layout == null ? void 0 : layout.submitButtonProps) && /* @__PURE__ */ React6.createElement(SubmitButton, { formKey: key, formState: formStates[key], buttonProps: layout.submitButtonProps })));
|
|
743
|
+
})), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React6.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React6.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
|
|
750
744
|
};
|
|
751
745
|
var TabLayout = (props) => {
|
|
752
746
|
const { layoutConfig = {}, onBatchSubmit, batchSubmitButtonProps, onReady } = props;
|
|
@@ -767,7 +761,7 @@ var TabLayout = (props) => {
|
|
|
767
761
|
onReady(formStates);
|
|
768
762
|
}
|
|
769
763
|
}, [formStates]);
|
|
770
|
-
return /* @__PURE__ */
|
|
764
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
|
|
771
765
|
Tabs,
|
|
772
766
|
__spreadProps(__spreadValues({}, $tabsProps), {
|
|
773
767
|
selectedKey: selectedTab,
|
|
@@ -777,20 +771,20 @@ var TabLayout = (props) => {
|
|
|
777
771
|
}),
|
|
778
772
|
formKeys.map((key) => {
|
|
779
773
|
const layout = formLayout[key];
|
|
780
|
-
return /* @__PURE__ */
|
|
774
|
+
return /* @__PURE__ */ React6.createElement(Tab, { id: `form-${key}-tab-menu`, key, title: /* @__PURE__ */ React6.createElement("div", { className: layout == null ? void 0 : layout.titleBoxCss }, (layout == null ? void 0 : layout.title) || key) });
|
|
781
775
|
})
|
|
782
776
|
), formKeys.map((key) => {
|
|
783
777
|
const layout = formLayout[key];
|
|
784
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ React6.createElement(
|
|
785
779
|
"div",
|
|
786
780
|
{
|
|
787
781
|
key,
|
|
788
782
|
id: `form-${key}-tab-content`,
|
|
789
783
|
className: cn("mt-4", selectedTab === key ? "" : "hidden")
|
|
790
784
|
},
|
|
791
|
-
/* @__PURE__ */
|
|
785
|
+
/* @__PURE__ */ React6.createElement(JSONSchemaForm, { formState: formStates[key] }, (layout == null ? void 0 : layout.submitButtonProps) && /* @__PURE__ */ React6.createElement(SubmitButton, { formKey: key, formState: formStates[key], buttonProps: layout.submitButtonProps }))
|
|
792
786
|
);
|
|
793
|
-
}), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */
|
|
787
|
+
}), (onBatchSubmit || (batchSubmitButtonProps == null ? void 0 : batchSubmitButtonProps.onBatchSubmit)) && /* @__PURE__ */ React6.createElement("div", { className: "w-full flex" }, /* @__PURE__ */ React6.createElement(BatchSubmitButton, { formStates, onSubmit: onBatchSubmit, buttonProps: batchSubmitButtonProps })));
|
|
794
788
|
};
|
|
795
789
|
|
|
796
790
|
// components/JSONForm/index.tsx
|
|
@@ -804,11 +798,11 @@ var JSONForm = (props) => {
|
|
|
804
798
|
var _a;
|
|
805
799
|
const type = ((_a = props.layoutConfig) == null ? void 0 : _a.$type) || "SimpleLayout";
|
|
806
800
|
const Component = components[type];
|
|
807
|
-
return /* @__PURE__ */
|
|
801
|
+
return /* @__PURE__ */ React6.createElement(
|
|
808
802
|
"div",
|
|
809
803
|
{ className: props.className },
|
|
810
804
|
// @ts-ignore
|
|
811
|
-
/* @__PURE__ */
|
|
805
|
+
/* @__PURE__ */ React6.createElement(Component, __spreadValues({}, props))
|
|
812
806
|
);
|
|
813
807
|
};
|
|
814
808
|
var JSONViewModal = observer(() => {
|
|
@@ -842,7 +836,7 @@ var JSONViewModal = observer(() => {
|
|
|
842
836
|
}
|
|
843
837
|
});
|
|
844
838
|
}
|
|
845
|
-
return /* @__PURE__ */
|
|
839
|
+
return /* @__PURE__ */ React6.createElement(
|
|
846
840
|
Modal,
|
|
847
841
|
{
|
|
848
842
|
className: complexFormModal.className,
|
|
@@ -857,7 +851,7 @@ var JSONViewModal = observer(() => {
|
|
|
857
851
|
}
|
|
858
852
|
}
|
|
859
853
|
},
|
|
860
|
-
/* @__PURE__ */
|
|
854
|
+
/* @__PURE__ */ React6.createElement("div", { className: "z-50 fixed top-0 left-0 w-screen h-screen" }, /* @__PURE__ */ React6.createElement(Draggable, { handle: ".draggable-handle" }, /* @__PURE__ */ React6.createElement(ModalContent, null, complexFormModal.title && /* @__PURE__ */ React6.createElement(ModalHeader, { className: "flex flex-col gap-1 draggable-handle cursor-move" }, complexFormModal.title), /* @__PURE__ */ React6.createElement(ModalBody, { className: cn("max-h-[90vh] overflow-auto") }, /* @__PURE__ */ React6.createElement(
|
|
861
855
|
JSONForm,
|
|
862
856
|
{
|
|
863
857
|
formData,
|
|
@@ -880,7 +874,7 @@ var Provider_default = JSONViewModal;
|
|
|
880
874
|
var FormPlugin = class {
|
|
881
875
|
constructor(args) {
|
|
882
876
|
this.sid = "FormPlugin";
|
|
883
|
-
this.provider = () => /* @__PURE__ */
|
|
877
|
+
this.provider = () => /* @__PURE__ */ React6.createElement(Provider_default, null);
|
|
884
878
|
this.isOpen = false;
|
|
885
879
|
this.title = "";
|
|
886
880
|
this.className = "";
|
|
@@ -939,7 +933,7 @@ var JSONFormModal = observer(() => {
|
|
|
939
933
|
if (!form) {
|
|
940
934
|
return null;
|
|
941
935
|
}
|
|
942
|
-
return /* @__PURE__ */
|
|
936
|
+
return /* @__PURE__ */ React6.createElement(
|
|
943
937
|
Modal,
|
|
944
938
|
{
|
|
945
939
|
className: formModal.className,
|
|
@@ -954,7 +948,7 @@ var JSONFormModal = observer(() => {
|
|
|
954
948
|
}
|
|
955
949
|
}
|
|
956
950
|
},
|
|
957
|
-
/* @__PURE__ */
|
|
951
|
+
/* @__PURE__ */ React6.createElement("div", { className: "z-50 fixed top-0 left-0 w-screen h-screen flex items-center justify-center" }, /* @__PURE__ */ React6.createElement(Draggable, { handle: ".draggable-handle" }, /* @__PURE__ */ React6.createElement(ModalContent, null, formModal.title && /* @__PURE__ */ React6.createElement(ModalHeader, { className: "flex flex-col gap-1 draggable-handle cursor-move" }, formModal.title), /* @__PURE__ */ React6.createElement(ModalBody, { className: "max-h-[90vh] overflow-auto" }, /* @__PURE__ */ React6.createElement(JSONSchemaForm, { formState: form })))))
|
|
958
952
|
);
|
|
959
953
|
});
|
|
960
954
|
var Provider_default2 = JSONFormModal;
|
|
@@ -963,7 +957,7 @@ var Provider_default2 = JSONFormModal;
|
|
|
963
957
|
var FormModalStore = class {
|
|
964
958
|
constructor(args) {
|
|
965
959
|
this.sid = "FormModalStore";
|
|
966
|
-
this.provider = () => /* @__PURE__ */
|
|
960
|
+
this.provider = () => /* @__PURE__ */ React6.createElement(Provider_default2, null);
|
|
967
961
|
this.isOpen = false;
|
|
968
962
|
this.title = "";
|
|
969
963
|
//@ts-ignore
|
|
@@ -1118,7 +1112,7 @@ var _JSONViewPlugin = class _JSONViewPlugin {
|
|
|
1118
1112
|
this.JSONView = {
|
|
1119
1113
|
Test: {
|
|
1120
1114
|
name: "Test",
|
|
1121
|
-
render: () => /* @__PURE__ */
|
|
1115
|
+
render: () => /* @__PURE__ */ React6.createElement("div", null, "Test")
|
|
1122
1116
|
}
|
|
1123
1117
|
};
|
|
1124
1118
|
}
|
|
@@ -1136,7 +1130,7 @@ var _JSONViewPlugin = class _JSONViewPlugin {
|
|
|
1136
1130
|
};
|
|
1137
1131
|
_JSONViewPlugin.JSONView = (props) => {
|
|
1138
1132
|
const jsonviewplugin = RootStore.Get(_JSONViewPlugin);
|
|
1139
|
-
return /* @__PURE__ */
|
|
1133
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, Object.keys(props.uiConfigs).map((key) => {
|
|
1140
1134
|
const config = props.uiConfigs[key];
|
|
1141
1135
|
const data = _.get(props.datas, key);
|
|
1142
1136
|
const Component = jsonviewplugin.JSONView[config.type].render;
|
|
@@ -1148,7 +1142,7 @@ _JSONViewPlugin.JSONView = (props) => {
|
|
|
1148
1142
|
});
|
|
1149
1143
|
}
|
|
1150
1144
|
});
|
|
1151
|
-
return /* @__PURE__ */
|
|
1145
|
+
return /* @__PURE__ */ React6.createElement(Component, { key, data, uiConfig: config });
|
|
1152
1146
|
}));
|
|
1153
1147
|
};
|
|
1154
1148
|
var JSONViewPlugin = _JSONViewPlugin;
|