@dappworks/kit 0.5.40 → 0.5.42
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/PaginationState-Bmrrw0ky.d.mts +17 -0
- package/dist/PromiseState-8EAu4Zv4.d.mts +57 -0
- package/dist/StorageState-qapaHguM.d.mts +48 -0
- package/dist/aiem.d.mts +167 -0
- package/dist/aiem.mjs +5 -5
- package/dist/aiem.mjs.map +1 -1
- package/dist/{chunk-MPNSYZJU.mjs → chunk-2B3FO5P6.mjs} +5 -5
- package/dist/chunk-2B3FO5P6.mjs.map +1 -0
- package/dist/{chunk-2HNXZE3X.mjs → chunk-6HA5WR5H.mjs} +372 -401
- package/dist/chunk-6HA5WR5H.mjs.map +1 -0
- package/dist/{chunk-QA3E2PJT.mjs → chunk-AFXQRBS6.mjs} +3 -3
- package/dist/chunk-AFXQRBS6.mjs.map +1 -0
- package/dist/{chunk-O3FWAAEG.mjs → chunk-FLACAHWH.mjs} +7 -8
- package/dist/chunk-FLACAHWH.mjs.map +1 -0
- package/dist/chunk-GKAU4P5I.mjs +1 -1
- package/dist/chunk-GKAU4P5I.mjs.map +1 -1
- package/dist/{chunk-B7RV4C5E.mjs → chunk-GPPSD2BO.mjs} +4 -6
- package/dist/chunk-GPPSD2BO.mjs.map +1 -0
- package/dist/chunk-IMOLRP7I.mjs +1 -1
- package/dist/chunk-IMOLRP7I.mjs.map +1 -1
- package/dist/chunk-K7LFG5BA.mjs +2 -2
- package/dist/chunk-K7LFG5BA.mjs.map +1 -1
- package/dist/{chunk-2N4HH4ZF.mjs → chunk-NCGC2KDE.mjs} +4 -6
- package/dist/chunk-NCGC2KDE.mjs.map +1 -0
- package/dist/chunk-ONVPCAMQ.mjs +1 -1
- package/dist/chunk-ONVPCAMQ.mjs.map +1 -1
- package/dist/{chunk-PZ3VSAOC.mjs → chunk-TEVYTENF.mjs} +3 -3
- package/dist/chunk-TEVYTENF.mjs.map +1 -0
- package/dist/{chunk-2WRRZVUW.mjs → chunk-UMFAEQ5S.mjs} +30 -55
- package/dist/chunk-UMFAEQ5S.mjs.map +1 -0
- package/dist/{chunk-R4N52NI2.mjs → chunk-VDDGCMCB.mjs} +38 -28
- package/dist/chunk-VDDGCMCB.mjs.map +1 -0
- package/dist/chunk-XSGTWROT.mjs +1 -1
- package/dist/chunk-XSGTWROT.mjs.map +1 -1
- package/dist/{chunk-R4SQKVDQ.mjs → chunk-YOSPWY5K.mjs} +2 -2
- package/dist/chunk-YOSPWY5K.mjs.map +1 -0
- package/dist/dev.d.mts +26 -0
- package/dist/dev.mjs +6 -8
- package/dist/dev.mjs.map +1 -1
- package/dist/experimental.d.mts +190 -0
- package/dist/experimental.mjs +6 -8
- package/dist/experimental.mjs.map +1 -1
- package/dist/form.d.mts +384 -0
- package/dist/form.mjs +15 -19
- package/dist/form.mjs.map +1 -1
- package/dist/index-CUKoRIdy.d.mts +3 -0
- package/dist/index.d.mts +90 -0
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/dist/inspector.d.mts +15 -0
- package/dist/inspector.mjs +3 -4
- package/dist/inspector.mjs.map +1 -1
- package/dist/jsoncomponent.d.mts +22 -0
- package/dist/jsoncomponent.mjs +2 -2
- package/dist/jsoncomponent.mjs.map +1 -1
- package/dist/jsontable.d.mts +126 -0
- package/dist/jsontable.mjs +5 -5
- package/dist/jsontable.mjs.map +1 -1
- package/dist/metrics.d.mts +121 -0
- package/dist/metrics.mjs +6 -6
- package/dist/metrics.mjs.map +1 -1
- package/dist/plugins.d.mts +118 -0
- package/dist/plugins.mjs +5 -5
- package/dist/plugins.mjs.map +1 -1
- package/dist/root-BPMUmS6H.d.mts +111 -0
- package/dist/ui.d.mts +29 -0
- package/dist/ui.mjs +5 -6
- package/dist/ui.mjs.map +1 -1
- package/dist/utils.d.mts +232 -0
- package/dist/utils.mjs +4 -4
- package/dist/utils.mjs.map +1 -1
- package/dist/wallet.d.mts +198 -0
- package/dist/wallet.mjs +58 -16
- package/dist/wallet.mjs.map +1 -1
- package/package.json +4 -3
- package/dist/chunk-2HNXZE3X.mjs.map +0 -1
- package/dist/chunk-2N4HH4ZF.mjs.map +0 -1
- package/dist/chunk-2WRRZVUW.mjs.map +0 -1
- package/dist/chunk-B7RV4C5E.mjs.map +0 -1
- package/dist/chunk-MPNSYZJU.mjs.map +0 -1
- package/dist/chunk-O3FWAAEG.mjs.map +0 -1
- package/dist/chunk-PZ3VSAOC.mjs.map +0 -1
- package/dist/chunk-QA3E2PJT.mjs.map +0 -1
- package/dist/chunk-R4N52NI2.mjs.map +0 -1
- package/dist/chunk-R4SQKVDQ.mjs.map +0 -1
package/dist/form.d.mts
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import React$1, { Dispatch, SetStateAction, JSX as JSX$1, ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps, TabsProps, CheckboxProps, SlotsToClasses, InputSlots, InputProps, SelectSlots, SelectProps, SelectedItems, DatePickerProps, ModalSlots } from '@nextui-org/react';
|
|
3
|
+
import { UiSchema, RJSFSchema, WidgetProps, Widget } from '@rjsf/utils';
|
|
4
|
+
import * as _rjsf_validator_ajv8_lib_validator from '@rjsf/validator-ajv8/lib/validator';
|
|
5
|
+
import Form, { IChangeEvent } from '@rjsf/core';
|
|
6
|
+
import { T as ThemeType } from './index-CUKoRIdy.mjs';
|
|
7
|
+
import { EditorProps } from '@monaco-editor/react';
|
|
8
|
+
import { S as Store } from './root-BPMUmS6H.mjs';
|
|
9
|
+
import EventEmitter from 'events';
|
|
10
|
+
import 'typed-emitter';
|
|
11
|
+
|
|
12
|
+
declare class JSONSchemaFormState<T, U = UiSchema> {
|
|
13
|
+
value: JSONSchemaValue<T>;
|
|
14
|
+
schema: RJSFSchema;
|
|
15
|
+
uiSchema: U;
|
|
16
|
+
reactive: boolean;
|
|
17
|
+
readonly: boolean;
|
|
18
|
+
liveValidate: boolean;
|
|
19
|
+
validator: _rjsf_validator_ajv8_lib_validator.default<any, RJSFSchema, any>;
|
|
20
|
+
formRef: React.RefObject<Form>;
|
|
21
|
+
get formData(): T;
|
|
22
|
+
set formData(value: T);
|
|
23
|
+
get dynamicData(): {
|
|
24
|
+
ready: boolean;
|
|
25
|
+
};
|
|
26
|
+
getDymaicData: () => {
|
|
27
|
+
ready: boolean;
|
|
28
|
+
};
|
|
29
|
+
onChange: (e: IChangeEvent<T>, id?: string) => void;
|
|
30
|
+
onSubmit: (e: IChangeEvent<T>) => void;
|
|
31
|
+
afterSubmit: (e: IChangeEvent<T>) => void;
|
|
32
|
+
afterChange: (e: IChangeEvent<T>, id?: string) => void;
|
|
33
|
+
reset({ force }?: {
|
|
34
|
+
force?: boolean;
|
|
35
|
+
}): this;
|
|
36
|
+
customValidate: (formData: T, errors: any) => any;
|
|
37
|
+
constructor(args?: Partial<JSONSchemaFormState<T, U>>);
|
|
38
|
+
}
|
|
39
|
+
declare class JSONSchemaValue<T> {
|
|
40
|
+
value?: T;
|
|
41
|
+
default?: T;
|
|
42
|
+
constructor(args?: Partial<JSONSchemaValue<T>>);
|
|
43
|
+
set(value: Partial<T>): T;
|
|
44
|
+
onSet(value: Partial<T>): Partial<T>;
|
|
45
|
+
get(): T;
|
|
46
|
+
getFormat(value: T): T;
|
|
47
|
+
reset(): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare const COMPONENTS: {
|
|
51
|
+
GridLayout: <T extends FormDataType>(props: JSONFormProps<T>) => React$1.JSX.Element;
|
|
52
|
+
TabLayout: <T_1 extends FormDataType>(props: JSONFormProps<T_1>) => React$1.JSX.Element;
|
|
53
|
+
ListLayout: <T_2 extends FormDataType>(props: JSONFormProps<T_2>) => React$1.JSX.Element;
|
|
54
|
+
SimpleLayout: <T_3 extends FormDataType>(props: JSONFormProps<T_3>) => React$1.JSX.Element;
|
|
55
|
+
};
|
|
56
|
+
type FormDataType = {
|
|
57
|
+
[key: string]: {
|
|
58
|
+
[key: string]: string | number | boolean | Record<string, string | number | boolean>;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
type FormConfigType<T extends FormDataType> = {
|
|
62
|
+
[F in keyof T]?: {
|
|
63
|
+
[X in keyof T[F]]?: {
|
|
64
|
+
title?: string;
|
|
65
|
+
required?: boolean;
|
|
66
|
+
requiredErrMsg?: string;
|
|
67
|
+
validate?: (v: any) => string | void;
|
|
68
|
+
selectOptions?: {
|
|
69
|
+
label: string;
|
|
70
|
+
value: string;
|
|
71
|
+
}[];
|
|
72
|
+
isMultipleSelect?: boolean;
|
|
73
|
+
} & UiSchema;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
type SubmitButtonProps<T extends FormDataType> = ButtonProps & {
|
|
77
|
+
onAfterSubmit?: (formKey: FormKey<T>, data: FormDataOfKey<T>, setLoading: Dispatch<SetStateAction<boolean>>) => void;
|
|
78
|
+
};
|
|
79
|
+
type CombFormsCustomRender<T extends FormDataType> = (formStates: {
|
|
80
|
+
[F in keyof T]?: JSONSchemaFormState<FormDataOfKey<T>, UiSchema>;
|
|
81
|
+
}) => React$1.ReactNode;
|
|
82
|
+
type CombFormsCustomRenderMap<T extends FormDataType> = {
|
|
83
|
+
Top?: CombFormsCustomRender<T>;
|
|
84
|
+
SubmitButtonBefore?: CombFormsCustomRender<T>;
|
|
85
|
+
SubmitButtonAfter?: CombFormsCustomRender<T>;
|
|
86
|
+
};
|
|
87
|
+
type SubformCustomRender<T extends FormDataType> = (formKey: FormKey<T>, formState: JSONSchemaFormState<FormDataOfKey<T>, UiSchema>) => React$1.ReactNode;
|
|
88
|
+
type SubformCustomRenderMap<T extends FormDataType> = {
|
|
89
|
+
Top?: SubformCustomRender<T>;
|
|
90
|
+
SubmitButtonBefore?: SubformCustomRender<T>;
|
|
91
|
+
SubmitButtonAfter?: SubformCustomRender<T>;
|
|
92
|
+
};
|
|
93
|
+
type SubformLayoutBaseConfig<T extends FormDataType, F extends keyof T> = {
|
|
94
|
+
title?: string;
|
|
95
|
+
titleBoxCss?: string;
|
|
96
|
+
fieldLayout?: Array<keyof NonNullable<T[F]>> | Array<Array<keyof NonNullable<T[F]>> | keyof NonNullable<T[F]>>;
|
|
97
|
+
submitButtonProps?: SubmitButtonProps<T>;
|
|
98
|
+
customRender?: SubformCustomRenderMap<T>;
|
|
99
|
+
};
|
|
100
|
+
interface LayoutConfigMap<T extends FormDataType> {
|
|
101
|
+
GridLayout: {
|
|
102
|
+
$type: 'GridLayout';
|
|
103
|
+
$gridColumn?: number;
|
|
104
|
+
$combFormsCustomRender?: CombFormsCustomRenderMap<T>;
|
|
105
|
+
} & {
|
|
106
|
+
[F in keyof T]?: SubformLayoutBaseConfig<T, F> & {
|
|
107
|
+
colSpan?: number;
|
|
108
|
+
cardCss?: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
TabLayout: {
|
|
112
|
+
$type: 'TabLayout';
|
|
113
|
+
$tabsProps?: TabsProps;
|
|
114
|
+
$combFormsCustomRender?: CombFormsCustomRenderMap<T>;
|
|
115
|
+
} & {
|
|
116
|
+
[F in keyof T]?: SubformLayoutBaseConfig<T, F>;
|
|
117
|
+
};
|
|
118
|
+
ListLayout: {
|
|
119
|
+
$type: 'ListLayout';
|
|
120
|
+
$combFormsCustomRender?: CombFormsCustomRenderMap<T>;
|
|
121
|
+
} & {
|
|
122
|
+
[F in keyof T]?: SubformLayoutBaseConfig<T, F>;
|
|
123
|
+
};
|
|
124
|
+
SimpleLayout: {
|
|
125
|
+
$type: 'SimpleLayout';
|
|
126
|
+
$combFormsCustomRender?: CombFormsCustomRenderMap<T>;
|
|
127
|
+
} & {
|
|
128
|
+
[F in keyof T]?: SubformLayoutBaseConfig<T, F>;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
type LayoutType = keyof typeof COMPONENTS;
|
|
132
|
+
type LayoutConfigType<T extends FormDataType, L extends LayoutType> = LayoutConfigMap<T>[L];
|
|
133
|
+
type FormKey<T extends FormDataType> = keyof T;
|
|
134
|
+
type FormDataOfKey<T extends FormDataType> = T[FormKey<T>];
|
|
135
|
+
type JSONFormProps<T extends FormDataType> = {
|
|
136
|
+
className?: string;
|
|
137
|
+
theme?: ThemeType;
|
|
138
|
+
formData: T;
|
|
139
|
+
formConfig?: FormConfigType<T>;
|
|
140
|
+
layoutConfig?: LayoutConfigType<T, LayoutType>;
|
|
141
|
+
onBatchSubmit?: (data: T, setLoading: Dispatch<SetStateAction<boolean>>) => void;
|
|
142
|
+
onSet?: (v: FormDataOfKey<T>, form: JSONSchemaFormState<FormDataOfKey<T>, UiSchema>) => FormDataOfKey<T>;
|
|
143
|
+
onChange?: (data: Partial<T>) => void;
|
|
144
|
+
onReady?: (formStates: {
|
|
145
|
+
[F in keyof T]?: JSONSchemaFormState<FormDataOfKey<T>, UiSchema>;
|
|
146
|
+
}) => void;
|
|
147
|
+
batchSubmitButtonProps?: ButtonProps & {
|
|
148
|
+
onBatchSubmit?: (formData: T, setLoading: Dispatch<SetStateAction<boolean>>) => void;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
declare const JSONForm: <T extends FormDataType>(props: JSONFormProps<T>) => React$1.JSX.Element;
|
|
152
|
+
|
|
153
|
+
type Options$6 = {
|
|
154
|
+
className?: string;
|
|
155
|
+
nextuiClassNames?: CheckboxProps["classNames"];
|
|
156
|
+
size: CheckboxProps["size"];
|
|
157
|
+
color: CheckboxProps["color"];
|
|
158
|
+
description?: string;
|
|
159
|
+
descriptionClassName?: string;
|
|
160
|
+
};
|
|
161
|
+
interface CheckboxWidgetProps extends WidgetProps {
|
|
162
|
+
options: Options$6;
|
|
163
|
+
}
|
|
164
|
+
interface CheckboxWidgetUIOptions {
|
|
165
|
+
"ui:widget": (props: CheckboxWidgetProps) => JSX$1.Element;
|
|
166
|
+
"ui:options": Options$6;
|
|
167
|
+
}
|
|
168
|
+
declare function CheckboxWidget({ onChange, options, label, value, disabled, uiSchema }: CheckboxWidgetProps): JSX$1.Element;
|
|
169
|
+
|
|
170
|
+
type Options$5 = {
|
|
171
|
+
editorHeight?: string;
|
|
172
|
+
readOnly?: boolean;
|
|
173
|
+
language?: string;
|
|
174
|
+
languageSelectorOptions?: {
|
|
175
|
+
label: string;
|
|
176
|
+
value: string;
|
|
177
|
+
}[];
|
|
178
|
+
onChangeLanguage?: (v: string) => void;
|
|
179
|
+
onRun?: (v: string) => void;
|
|
180
|
+
onMount?: EditorProps['onMount'];
|
|
181
|
+
jsonStrSpace?: number;
|
|
182
|
+
labelClassName?: string;
|
|
183
|
+
description?: string;
|
|
184
|
+
descriptionClassName?: string;
|
|
185
|
+
editorBoxClassName?: string;
|
|
186
|
+
errMsgClassName?: string;
|
|
187
|
+
};
|
|
188
|
+
interface EditorWidgetProps extends WidgetProps {
|
|
189
|
+
options: Options$5;
|
|
190
|
+
}
|
|
191
|
+
type EditorWidgetUIOptions = {
|
|
192
|
+
"ui:widget": (props: EditorWidgetProps) => JSX$1.Element;
|
|
193
|
+
"ui:options": Options$5;
|
|
194
|
+
};
|
|
195
|
+
declare const EditorWidget: ({ label, options, value, required, uiSchema, disabled, onChange }: EditorWidgetProps) => JSX$1.Element;
|
|
196
|
+
|
|
197
|
+
type Options$4 = {
|
|
198
|
+
className?: string;
|
|
199
|
+
nextuiClassNames?: SlotsToClasses<InputSlots>;
|
|
200
|
+
labelPlacement?: InputProps["labelPlacement"];
|
|
201
|
+
size: InputProps["size"];
|
|
202
|
+
placeholder?: string;
|
|
203
|
+
inputType?: 'text' | 'number' | 'password';
|
|
204
|
+
color?: InputProps["color"];
|
|
205
|
+
variant?: InputProps["variant"];
|
|
206
|
+
radius?: InputProps["radius"];
|
|
207
|
+
startContent?: ReactNode;
|
|
208
|
+
endContent?: ReactNode;
|
|
209
|
+
description?: string;
|
|
210
|
+
min?: number;
|
|
211
|
+
max?: number;
|
|
212
|
+
};
|
|
213
|
+
interface InputWidgetProps extends WidgetProps {
|
|
214
|
+
options: Options$4;
|
|
215
|
+
}
|
|
216
|
+
interface InputWidgetUIOptions {
|
|
217
|
+
"ui:widget": (props: InputWidgetProps) => JSX.Element;
|
|
218
|
+
"ui:options": Options$4;
|
|
219
|
+
}
|
|
220
|
+
declare function InputWidget(props: InputWidgetProps): React$1.JSX.Element;
|
|
221
|
+
|
|
222
|
+
type Options$3 = {
|
|
223
|
+
className?: string;
|
|
224
|
+
nextuiClassNames?: SlotsToClasses<SelectSlots>;
|
|
225
|
+
listboxProps?: SelectProps['listboxProps'];
|
|
226
|
+
labelPlacement?: SelectProps["labelPlacement"];
|
|
227
|
+
placeholder?: string;
|
|
228
|
+
size: SelectProps["size"];
|
|
229
|
+
color?: SelectProps["color"];
|
|
230
|
+
variant?: SelectProps["variant"];
|
|
231
|
+
radius?: SelectProps["radius"];
|
|
232
|
+
description?: string;
|
|
233
|
+
};
|
|
234
|
+
interface SelectWidgetProps extends WidgetProps {
|
|
235
|
+
options: Options$3;
|
|
236
|
+
}
|
|
237
|
+
interface SelectWidgetUIOptions {
|
|
238
|
+
"ui:widget": (props: SelectWidgetProps) => JSX$1.Element;
|
|
239
|
+
"ui:options": Options$3;
|
|
240
|
+
}
|
|
241
|
+
declare function SelectWidget(props: SelectWidgetProps): JSX$1.Element;
|
|
242
|
+
|
|
243
|
+
type Options$2 = {
|
|
244
|
+
className?: string;
|
|
245
|
+
nextuiClassNames?: SelectProps['classNames'];
|
|
246
|
+
labelPlacement?: SelectProps['labelPlacement'];
|
|
247
|
+
listboxProps?: SelectProps['listboxProps'];
|
|
248
|
+
size: SelectProps['size'];
|
|
249
|
+
color?: SelectProps['color'];
|
|
250
|
+
placeholder?: string;
|
|
251
|
+
description?: string;
|
|
252
|
+
renderValue?: (items: SelectedItems<{
|
|
253
|
+
label: string;
|
|
254
|
+
value: string;
|
|
255
|
+
}>) => React$1.ReactNode;
|
|
256
|
+
};
|
|
257
|
+
interface MultipleSelectWidgetProps extends WidgetProps {
|
|
258
|
+
options: Options$2;
|
|
259
|
+
}
|
|
260
|
+
interface MultipleSelectWidgetUIOptions {
|
|
261
|
+
'ui:widget': (props: MultipleSelectWidgetProps) => JSX$1.Element;
|
|
262
|
+
'ui:options': Options$2;
|
|
263
|
+
}
|
|
264
|
+
declare function MultipleSelectWidget(props: MultipleSelectWidgetProps): JSX$1.Element;
|
|
265
|
+
|
|
266
|
+
type Options$1 = {
|
|
267
|
+
className?: string;
|
|
268
|
+
nextuiClassNames?: SlotsToClasses<InputSlots>;
|
|
269
|
+
labelPlacement?: InputProps['labelPlacement'];
|
|
270
|
+
size: InputProps['size'];
|
|
271
|
+
minRows?: number;
|
|
272
|
+
maxRows?: number;
|
|
273
|
+
placeholder?: string;
|
|
274
|
+
color?: InputProps["color"];
|
|
275
|
+
variant?: InputProps["variant"];
|
|
276
|
+
radius?: InputProps["radius"];
|
|
277
|
+
startContent?: ReactNode;
|
|
278
|
+
endContent?: ReactNode;
|
|
279
|
+
description?: string;
|
|
280
|
+
};
|
|
281
|
+
interface TextareaWidgetProps extends WidgetProps {
|
|
282
|
+
options: Options$1;
|
|
283
|
+
}
|
|
284
|
+
interface TextareaWidgetUIOptions {
|
|
285
|
+
'ui:widget': (props: TextareaWidgetProps) => JSX$1.Element;
|
|
286
|
+
'ui:options': Options$1;
|
|
287
|
+
}
|
|
288
|
+
declare function TextareaWidget(props: TextareaWidgetProps): JSX$1.Element;
|
|
289
|
+
|
|
290
|
+
type Options = {
|
|
291
|
+
className?: string;
|
|
292
|
+
nextuiClassNames?: Record<"base" | "selectorButton" | "selectorIcon" | "popoverContent" | "calendar" | "calendarContent" | "timeInputLabel" | "timeInput", string>;
|
|
293
|
+
dateInputClassNames?: Record<"base" | "label" | "inputWrapper" | "innerWrapper" | "input" | "helperWrapper" | "description" | "errorMessage", string>;
|
|
294
|
+
size: DatePickerProps["size"];
|
|
295
|
+
labelPlacement?: DatePickerProps["labelPlacement"];
|
|
296
|
+
color: DatePickerProps["color"];
|
|
297
|
+
granularity?: DatePickerProps["granularity"];
|
|
298
|
+
variant?: DatePickerProps['variant'];
|
|
299
|
+
description?: string;
|
|
300
|
+
};
|
|
301
|
+
interface DatePickerWidgetProps extends WidgetProps {
|
|
302
|
+
options: Options;
|
|
303
|
+
}
|
|
304
|
+
interface DatePickerWidgetUIOptions {
|
|
305
|
+
'ui:widget': (props: DatePickerWidgetProps) => string | Widget<any, RJSFSchema, any> | undefined;
|
|
306
|
+
'ui:options': Options;
|
|
307
|
+
}
|
|
308
|
+
declare function DatePickerWidget({ label, options, value, required, disabled, uiSchema, onChange }: DatePickerWidgetProps): React$1.JSX.Element;
|
|
309
|
+
|
|
310
|
+
interface Props {
|
|
311
|
+
formState: JSONSchemaFormState<any>;
|
|
312
|
+
children?: any;
|
|
313
|
+
}
|
|
314
|
+
declare const JSONSchemaForm: (({ children, formState }: Props) => React$1.JSX.Element) & {
|
|
315
|
+
displayName: string;
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
declare class ComplexFormModalStore<T extends FormDataType> implements Store {
|
|
319
|
+
sid: string;
|
|
320
|
+
provider: () => React$1.JSX.Element;
|
|
321
|
+
isOpen: boolean;
|
|
322
|
+
title: string;
|
|
323
|
+
formData?: T;
|
|
324
|
+
formConfig?: FormConfigType<T>;
|
|
325
|
+
layoutConfig?: LayoutConfigType<T, LayoutType>;
|
|
326
|
+
className: string;
|
|
327
|
+
classNames?: SlotsToClasses<ModalSlots>;
|
|
328
|
+
theme: ThemeType;
|
|
329
|
+
modalSize: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | 'xs' | '3xl' | '4xl' | '5xl';
|
|
330
|
+
scrollBehavior?: 'normal' | 'inside' | 'outside';
|
|
331
|
+
isDismissable: boolean;
|
|
332
|
+
event: EventEmitter<[never]>;
|
|
333
|
+
onBatchSubmit?: (data: T, setLoading?: Dispatch<SetStateAction<boolean>>) => void;
|
|
334
|
+
onSet?: (v: FormDataOfKey<T>, form: JSONSchemaFormState<FormDataOfKey<T>, UiSchema>) => FormDataOfKey<T>;
|
|
335
|
+
onChange?: (data: Partial<T>) => void;
|
|
336
|
+
onReady?: (formStates: {
|
|
337
|
+
[F in keyof T]?: JSONSchemaFormState<FormDataOfKey<T>, UiSchema>;
|
|
338
|
+
}) => void;
|
|
339
|
+
batchSubmitButtonProps?: ButtonProps & {
|
|
340
|
+
onBatchSubmit?: (formData: T, setLoading: Dispatch<SetStateAction<boolean>>) => void;
|
|
341
|
+
};
|
|
342
|
+
constructor(args?: Partial<ComplexFormModalStore<T>>);
|
|
343
|
+
setData(v: Partial<ComplexFormModalStore<T>>): void;
|
|
344
|
+
close(): void;
|
|
345
|
+
}
|
|
346
|
+
declare function getComplexFormData<T extends FormDataType>(v: Partial<ComplexFormModalStore<T>>): Promise<T>;
|
|
347
|
+
|
|
348
|
+
declare class FormModalStore<T = {
|
|
349
|
+
[key: string]: any;
|
|
350
|
+
}> implements Store {
|
|
351
|
+
sid: string;
|
|
352
|
+
provider: () => React$1.JSX.Element;
|
|
353
|
+
isOpen: boolean;
|
|
354
|
+
title: string;
|
|
355
|
+
form: JSONSchemaFormState<T>;
|
|
356
|
+
className: string;
|
|
357
|
+
classNames?: SlotsToClasses<ModalSlots>;
|
|
358
|
+
theme: ThemeType;
|
|
359
|
+
modalSize: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | 'xs' | '3xl' | '4xl' | '5xl';
|
|
360
|
+
scrollBehavior?: 'normal' | 'inside' | 'outside';
|
|
361
|
+
closeOnOverlayClick: boolean;
|
|
362
|
+
event: EventEmitter<[never]>;
|
|
363
|
+
onAfterSubmit?: (data: T) => void;
|
|
364
|
+
constructor(args?: Partial<FormModalStore>);
|
|
365
|
+
setData(v: Partial<FormModalStore>): void;
|
|
366
|
+
close(): void;
|
|
367
|
+
}
|
|
368
|
+
declare function getFormData<T = {
|
|
369
|
+
[key: string]: any;
|
|
370
|
+
}>(v: Partial<FormModalStore>): Promise<T>;
|
|
371
|
+
declare function getFormState<T>({ data, metadata, onSet, onSubmit, theme, }: {
|
|
372
|
+
data: T;
|
|
373
|
+
metadata?: {
|
|
374
|
+
[key: string]: any;
|
|
375
|
+
} & Partial<JSONSchemaFormState<any>>;
|
|
376
|
+
onSet?: (v: T, form: JSONSchemaFormState<T, UiSchema>) => T;
|
|
377
|
+
onSubmit?: (data: T) => void;
|
|
378
|
+
theme: ThemeType;
|
|
379
|
+
}): JSONSchemaFormState<T, UiSchema>;
|
|
380
|
+
declare function getSimpleFormData<T>(data: T, metadata: {
|
|
381
|
+
[key: string]: any;
|
|
382
|
+
} & Partial<JSONSchemaFormState<any>>, config: Partial<FormModalStore>, onSet?: (v: T, form: JSONSchemaFormState<T, UiSchema>) => T, theme?: ThemeType): Promise<T>;
|
|
383
|
+
|
|
384
|
+
export { CheckboxWidget, type CheckboxWidgetProps, type CheckboxWidgetUIOptions, ComplexFormModalStore, DatePickerWidget, type DatePickerWidgetProps, type DatePickerWidgetUIOptions, EditorWidget, type EditorWidgetProps, type EditorWidgetUIOptions, type FormConfigType, type FormDataOfKey, type FormDataType, type FormKey, FormModalStore, InputWidget, type InputWidgetProps, type InputWidgetUIOptions, JSONForm, type JSONFormProps, JSONSchemaForm, type LayoutConfigType, type LayoutType, MultipleSelectWidget, type MultipleSelectWidgetProps, type MultipleSelectWidgetUIOptions, SelectWidget, type SelectWidgetProps, type SelectWidgetUIOptions, TextareaWidget, type TextareaWidgetProps, type TextareaWidgetUIOptions, getComplexFormData, getFormData, getFormState, getSimpleFormData };
|
package/dist/form.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { getStyle } from './chunk-GKAU4P5I.mjs';
|
|
2
2
|
import { useStore, RootStore } from './chunk-XSGTWROT.mjs';
|
|
3
|
-
import { helper } from './chunk-
|
|
3
|
+
import { helper } from './chunk-VDDGCMCB.mjs';
|
|
4
4
|
import { _ } from './chunk-K7LFG5BA.mjs';
|
|
5
|
-
import { cn } from './chunk-
|
|
6
|
-
import { __objRest, __spreadValues, __spreadProps } from './chunk-
|
|
7
|
-
import React7, { useEffect, useMemo, useState,
|
|
8
|
-
import { Modal, ModalContent, ModalHeader, ModalBody,
|
|
9
|
-
import {
|
|
5
|
+
import { cn } from './chunk-6HA5WR5H.mjs';
|
|
6
|
+
import { __objRest, __spreadValues, __spreadProps } from './chunk-YOSPWY5K.mjs';
|
|
7
|
+
import React7, { useEffect, useMemo, useState, useCallback, useRef, createRef } from 'react';
|
|
8
|
+
import { Modal, ModalContent, ModalHeader, ModalBody, Button, Tabs, Tab, Card, Select, SelectItem, Input, Checkbox, Chip, Textarea, DatePicker } from '@nextui-org/react';
|
|
9
|
+
import { ChevronUp, ChevronDown, Check } from 'lucide-react';
|
|
10
10
|
import MonacoEditor from '@monaco-editor/react';
|
|
11
11
|
import validator from '@rjsf/validator-ajv8';
|
|
12
|
-
import { toJS, makeAutoObservable, makeObservable, computed,
|
|
12
|
+
import { toJS, makeAutoObservable, makeObservable, computed, action, observable } from 'mobx';
|
|
13
13
|
import Form from '@rjsf/core';
|
|
14
14
|
import * as Utils from '@rjsf/utils';
|
|
15
15
|
import { observer, useLocalObservable } from 'mobx-react-lite';
|
|
@@ -680,7 +680,8 @@ var renderLayout = (layout, fields, n = 1) => {
|
|
|
680
680
|
}
|
|
681
681
|
});
|
|
682
682
|
};
|
|
683
|
-
var ObjectFieldTemplate = ({ title, idSchema
|
|
683
|
+
var ObjectFieldTemplate = ({ title, idSchema, properties, uiSchema: { layout } }) => {
|
|
684
|
+
const { $id } = idSchema;
|
|
684
685
|
const [opened, setOpened] = useState(false);
|
|
685
686
|
const fields = Object.fromEntries(properties.map((item) => [item.name, item.content]));
|
|
686
687
|
return /* @__PURE__ */ React7.createElement("div", { className: "w-full space-y-2.5" }, $id === "root" ? layout ? renderLayout(layout, fields) : properties.map((element) => {
|
|
@@ -709,8 +710,7 @@ var SubmitButton2 = ({ uiSchema }) => {
|
|
|
709
710
|
};
|
|
710
711
|
var JSONSchemaForm = observer(({ children, formState }) => {
|
|
711
712
|
var _a;
|
|
712
|
-
if (!((_a = formState == null ? void 0 : formState.dynamicData) == null ? void 0 : _a.ready))
|
|
713
|
-
return /* @__PURE__ */ React7.createElement(React7.Fragment, null);
|
|
713
|
+
if (!((_a = formState == null ? void 0 : formState.dynamicData) == null ? void 0 : _a.ready)) return /* @__PURE__ */ React7.createElement(React7.Fragment, null);
|
|
714
714
|
return /* @__PURE__ */ React7.createElement(
|
|
715
715
|
Form,
|
|
716
716
|
{
|
|
@@ -861,10 +861,8 @@ var colSpanLg = {
|
|
|
861
861
|
var Col = React7.forwardRef((props, ref) => {
|
|
862
862
|
const _a = props, { numColSpan = 1, numColSpanSm, numColSpanMd, numColSpanLg, children, className } = _a, other = __objRest(_a, ["numColSpan", "numColSpanSm", "numColSpanMd", "numColSpanLg", "children", "className"]);
|
|
863
863
|
const getColSpan = (numColSpan2, colSpanMapping) => {
|
|
864
|
-
if (!numColSpan2)
|
|
865
|
-
|
|
866
|
-
if (!Object.keys(colSpanMapping).includes(String(numColSpan2)))
|
|
867
|
-
return "";
|
|
864
|
+
if (!numColSpan2) return "";
|
|
865
|
+
if (!Object.keys(colSpanMapping).includes(String(numColSpan2))) return "";
|
|
868
866
|
return colSpanMapping[numColSpan2];
|
|
869
867
|
};
|
|
870
868
|
const getColSpanClassNames = () => {
|
|
@@ -879,10 +877,8 @@ var Col = React7.forwardRef((props, ref) => {
|
|
|
879
877
|
Col.displayName = "Col";
|
|
880
878
|
var col_default = Col;
|
|
881
879
|
var getGridCols = (numCols, gridColsMapping) => {
|
|
882
|
-
if (!numCols)
|
|
883
|
-
|
|
884
|
-
if (!Object.keys(gridColsMapping).includes(String(numCols)))
|
|
885
|
-
return "";
|
|
880
|
+
if (!numCols) return "";
|
|
881
|
+
if (!Object.keys(gridColsMapping).includes(String(numCols))) return "";
|
|
886
882
|
return gridColsMapping[numCols];
|
|
887
883
|
};
|
|
888
884
|
var Grid = React7.forwardRef((props, ref) => {
|
|
@@ -1475,5 +1471,5 @@ async function getSimpleFormData(data, metadata = {}, config, onSet = (v, form)
|
|
|
1475
1471
|
}
|
|
1476
1472
|
|
|
1477
1473
|
export { CheckboxWidget, ComplexFormModalStore, DatePickerWidget, EditorWidget, FormModalStore, InputWidget, JSONForm, JSONSchemaForm, MultipleSelectWidget, SelectWidget, TextareaWidget, getComplexFormData, getFormData, getFormState2 as getFormState, getSimpleFormData };
|
|
1478
|
-
//# sourceMappingURL=
|
|
1474
|
+
//# sourceMappingURL=form.mjs.map
|
|
1479
1475
|
//# sourceMappingURL=form.mjs.map
|