remoraid 1.1.0 → 2.0.0
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/LICENSE +1 -1
- package/README.md +12 -0
- package/dist/core/index.cjs +1206 -0
- package/dist/core/index.d.ts +264 -0
- package/dist/core/index.js +1237 -0
- package/dist/{styles.css → core/styles.css} +5 -0
- package/dist/jsonforms/index.cjs +721 -0
- package/dist/jsonforms/index.d.ts +28 -0
- package/dist/jsonforms/index.js +724 -0
- package/dist/{ssc.cjs → server/index.cjs} +11 -7
- package/dist/server/index.d.ts +11 -0
- package/dist/{ssc.js → server/index.js} +7 -3
- package/package.json +24 -14
- package/dist/index.cjs +0 -412
- package/dist/index.d.ts +0 -51
- package/dist/index.js +0 -395
- package/dist/ssc.d.ts +0 -10
@@ -0,0 +1,724 @@
|
|
1
|
+
"use client";
|
2
|
+
// src/jsonforms/renderers/AnyOfControl.tsx
|
3
|
+
import {
|
4
|
+
JsonForms,
|
5
|
+
useJsonForms,
|
6
|
+
withJsonFormsControlProps
|
7
|
+
} from "@jsonforms/react";
|
8
|
+
import { Input, Paper, Select } from "@mantine/core";
|
9
|
+
|
10
|
+
// src/jsonforms/components/FormOptionsProvider/index.tsx
|
11
|
+
import React, {
|
12
|
+
useContext,
|
13
|
+
useState
|
14
|
+
} from "react";
|
15
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
16
|
+
var defaultFormOptions = {
|
17
|
+
withDescriptions: false
|
18
|
+
};
|
19
|
+
var formOptionsContext = React.createContext({
|
20
|
+
formOptions: defaultFormOptions,
|
21
|
+
updateFormOptions: () => {}
|
22
|
+
});
|
23
|
+
var useFormOptions = () => useContext(formOptionsContext);
|
24
|
+
function FormOptionsProvider({
|
25
|
+
children,
|
26
|
+
initialValue
|
27
|
+
}) {
|
28
|
+
const [formOptions, setFormOptions] = useState({
|
29
|
+
...defaultFormOptions,
|
30
|
+
...initialValue
|
31
|
+
});
|
32
|
+
const updateFormOptions = (newFormOptions) => {
|
33
|
+
setFormOptions((prev) => ({ ...prev, ...newFormOptions }));
|
34
|
+
};
|
35
|
+
return /* @__PURE__ */ jsxDEV(formOptionsContext.Provider, {
|
36
|
+
value: { formOptions, updateFormOptions },
|
37
|
+
children
|
38
|
+
}, undefined, false, undefined, this);
|
39
|
+
}
|
40
|
+
|
41
|
+
// src/jsonforms/renderers/AnyOfControl.tsx
|
42
|
+
import { jsxDEV as jsxDEV2, Fragment } from "react/jsx-dev-runtime";
|
43
|
+
function PlainAnyOfControl(props) {
|
44
|
+
const { data, schema, label, required, handleChange, path } = props;
|
45
|
+
const {
|
46
|
+
formOptions: { withDescriptions }
|
47
|
+
} = useFormOptions();
|
48
|
+
const { renderers, cells } = useJsonForms();
|
49
|
+
const defaultValues = {
|
50
|
+
number: 0,
|
51
|
+
integer: 0,
|
52
|
+
string: "",
|
53
|
+
array: [],
|
54
|
+
object: {},
|
55
|
+
null: null,
|
56
|
+
boolean: false
|
57
|
+
};
|
58
|
+
let type = undefined;
|
59
|
+
if (typeof data === "number") {
|
60
|
+
if (Number.isInteger(data) && schema.anyOf && schema.anyOf.find((a) => a.type && a.type === "integer")) {
|
61
|
+
type = "integer";
|
62
|
+
} else {
|
63
|
+
type = "number";
|
64
|
+
}
|
65
|
+
} else if (typeof data === "string") {
|
66
|
+
type = "string";
|
67
|
+
} else if (data === null) {
|
68
|
+
type = "null";
|
69
|
+
} else if (typeof data === "object" && Array.isArray(data)) {
|
70
|
+
type = "array";
|
71
|
+
} else if (typeof data === "object") {
|
72
|
+
type = "object";
|
73
|
+
} else if (typeof data === "boolean") {
|
74
|
+
type = "boolean";
|
75
|
+
}
|
76
|
+
const typeProperties = schema.anyOf ? schema.anyOf.find((a) => a.type === type) || {} : {};
|
77
|
+
return /* @__PURE__ */ jsxDEV2(Fragment, {
|
78
|
+
children: /* @__PURE__ */ jsxDEV2(Input.Wrapper, {
|
79
|
+
label,
|
80
|
+
description: withDescriptions ? schema.description || null : null,
|
81
|
+
withAsterisk: required,
|
82
|
+
children: /* @__PURE__ */ jsxDEV2(Paper, {
|
83
|
+
withBorder: true,
|
84
|
+
shadow: "0",
|
85
|
+
p: "sm",
|
86
|
+
mt: withDescriptions && schema.description && schema.description.length > 0 ? 4 : 0,
|
87
|
+
children: [
|
88
|
+
/* @__PURE__ */ jsxDEV2(Select, {
|
89
|
+
label: `Value Type`,
|
90
|
+
data: schema.anyOf ? schema.anyOf.map((a) => String(a.type)) : [],
|
91
|
+
value: type,
|
92
|
+
onChange: (newValue) => {
|
93
|
+
handleChange(path, newValue ? defaultValues[newValue] : undefined);
|
94
|
+
},
|
95
|
+
allowDeselect: true,
|
96
|
+
required,
|
97
|
+
placeholder: "Select Value Type",
|
98
|
+
variant: "default",
|
99
|
+
mb: type && type !== "null" ? "sm" : undefined
|
100
|
+
}, undefined, false, undefined, this),
|
101
|
+
type && type !== "null" && /* @__PURE__ */ jsxDEV2(JsonForms, {
|
102
|
+
schema: {
|
103
|
+
...typeProperties,
|
104
|
+
$schema: undefined
|
105
|
+
},
|
106
|
+
data,
|
107
|
+
renderers: renderers ?? [],
|
108
|
+
cells: cells ?? [],
|
109
|
+
onChange: ({ data: newData }) => {
|
110
|
+
handleChange(path, newData);
|
111
|
+
},
|
112
|
+
validationMode: "NoValidation"
|
113
|
+
}, undefined, false, undefined, this)
|
114
|
+
]
|
115
|
+
}, undefined, true, undefined, this)
|
116
|
+
}, undefined, false, undefined, this)
|
117
|
+
}, undefined, false, undefined, this);
|
118
|
+
}
|
119
|
+
var AnyOfControl = withJsonFormsControlProps(PlainAnyOfControl);
|
120
|
+
var AnyOfControl_default = AnyOfControl;
|
121
|
+
|
122
|
+
// src/jsonforms/renderers/ArrayControl.tsx
|
123
|
+
import {
|
124
|
+
JsonForms as JsonForms2,
|
125
|
+
useJsonForms as useJsonForms2,
|
126
|
+
withJsonFormsControlProps as withJsonFormsControlProps2
|
127
|
+
} from "@jsonforms/react";
|
128
|
+
import {
|
129
|
+
ActionIcon,
|
130
|
+
Button,
|
131
|
+
Flex,
|
132
|
+
Input as Input2,
|
133
|
+
Paper as Paper2,
|
134
|
+
Stack,
|
135
|
+
Tooltip,
|
136
|
+
useMantineTheme as useMantineTheme2
|
137
|
+
} from "@mantine/core";
|
138
|
+
import { IconPlus, IconTrash } from "@tabler/icons-react";
|
139
|
+
import { useState as useState2 } from "react";
|
140
|
+
|
141
|
+
// src/core/lib/utils.ts
|
142
|
+
var co = (condition, value, fallback) => condition(value) ? value : fallback;
|
143
|
+
|
144
|
+
// src/core/components/RemoraidProvider/ThemeProvider/index.tsx
|
145
|
+
import {
|
146
|
+
px,
|
147
|
+
rgba,
|
148
|
+
useMantineColorScheme,
|
149
|
+
useMantineTheme
|
150
|
+
} from "@mantine/core";
|
151
|
+
import {
|
152
|
+
IconAlertCircle,
|
153
|
+
IconCircleCheck,
|
154
|
+
IconInfoCircle
|
155
|
+
} from "@tabler/icons-react";
|
156
|
+
import React2, {
|
157
|
+
useContext as useContext2,
|
158
|
+
useMemo
|
159
|
+
} from "react";
|
160
|
+
import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
|
161
|
+
var isMantinePrimaryShade = (primaryShade) => {
|
162
|
+
if (isNaN(Number(primaryShade))) {
|
163
|
+
return true;
|
164
|
+
}
|
165
|
+
return false;
|
166
|
+
};
|
167
|
+
var createRemoraidTheme = (customTheme, mantineTheme, colorScheme) => {
|
168
|
+
const defaultMediumIconProps = { size: "1.125em" };
|
169
|
+
let transparentBackground;
|
170
|
+
let primaryColor;
|
171
|
+
let spacingPx;
|
172
|
+
if (mantineTheme && colorScheme) {
|
173
|
+
transparentBackground = colorScheme === "dark" ? rgba(mantineTheme.colors.dark[8], 0.8) : rgba(mantineTheme.white, 0.8);
|
174
|
+
primaryColor = mantineTheme.colors[mantineTheme.primaryColor][isMantinePrimaryShade(mantineTheme.primaryShade) ? mantineTheme.primaryShade[colorScheme === "auto" ? "light" : colorScheme] : mantineTheme.primaryShade];
|
175
|
+
spacingPx = {
|
176
|
+
xs: Number(co((v) => !Number.isNaN(v), Number(px(mantineTheme.spacing.xs)), 0)),
|
177
|
+
sm: Number(co((v) => !Number.isNaN(v), Number(px(mantineTheme.spacing.sm)), 0)),
|
178
|
+
md: Number(co((v) => !Number.isNaN(v), Number(px(mantineTheme.spacing.md)), 0)),
|
179
|
+
lg: Number(co((v) => !Number.isNaN(v), Number(px(mantineTheme.spacing.lg)), 0)),
|
180
|
+
xl: Number(co((v) => !Number.isNaN(v), Number(px(mantineTheme.spacing.xl)), 0))
|
181
|
+
};
|
182
|
+
}
|
183
|
+
return {
|
184
|
+
complete: true,
|
185
|
+
transitionDurations: {
|
186
|
+
short: 200,
|
187
|
+
medium: 350,
|
188
|
+
long: 500
|
189
|
+
},
|
190
|
+
breakpoints: {
|
191
|
+
buttonCollapse: "md",
|
192
|
+
badgeGroupCollapse: "md"
|
193
|
+
},
|
194
|
+
scrollAreaProps: {
|
195
|
+
scrollbarSize: 8,
|
196
|
+
scrollHideDelay: 20,
|
197
|
+
type: "hover"
|
198
|
+
},
|
199
|
+
containerSize: 1300,
|
200
|
+
alertProps: {
|
201
|
+
negative: {
|
202
|
+
icon: /* @__PURE__ */ jsxDEV3(IconAlertCircle, {
|
203
|
+
...defaultMediumIconProps
|
204
|
+
}, undefined, false, undefined, this),
|
205
|
+
variant: "light",
|
206
|
+
color: "red",
|
207
|
+
title: "Attention!"
|
208
|
+
},
|
209
|
+
neutral: {
|
210
|
+
icon: /* @__PURE__ */ jsxDEV3(IconInfoCircle, {
|
211
|
+
...defaultMediumIconProps
|
212
|
+
}, undefined, false, undefined, this),
|
213
|
+
variant: "light",
|
214
|
+
color: mantineTheme?.primaryColor,
|
215
|
+
title: "Information"
|
216
|
+
},
|
217
|
+
positive: {
|
218
|
+
icon: /* @__PURE__ */ jsxDEV3(IconCircleCheck, {
|
219
|
+
...defaultMediumIconProps
|
220
|
+
}, undefined, false, undefined, this),
|
221
|
+
variant: "light",
|
222
|
+
color: "green",
|
223
|
+
title: "Success"
|
224
|
+
}
|
225
|
+
},
|
226
|
+
iconProps: {
|
227
|
+
medium: defaultMediumIconProps,
|
228
|
+
tiny: { size: 14, stroke: 3 }
|
229
|
+
},
|
230
|
+
transparentBackground,
|
231
|
+
primaryColor,
|
232
|
+
spacingPx,
|
233
|
+
...customTheme
|
234
|
+
};
|
235
|
+
};
|
236
|
+
var themeContext = React2.createContext(createRemoraidTheme());
|
237
|
+
var useRemoraidTheme = () => {
|
238
|
+
return useContext2(themeContext);
|
239
|
+
};
|
240
|
+
|
241
|
+
// src/jsonforms/renderers/ArrayControl.tsx
|
242
|
+
import { jsxDEV as jsxDEV4, Fragment as Fragment2 } from "react/jsx-dev-runtime";
|
243
|
+
function PlainArrayControl(props) {
|
244
|
+
const mantineTheme = useMantineTheme2();
|
245
|
+
const theme = useRemoraidTheme();
|
246
|
+
const { label, schema, data, handleChange, path, required } = props;
|
247
|
+
const {
|
248
|
+
formOptions: { withDescriptions }
|
249
|
+
} = useFormOptions();
|
250
|
+
const { renderers, cells } = useJsonForms2();
|
251
|
+
const [isHoveringDelete, setIsHoveringDelete] = useState2(null);
|
252
|
+
let schemaItems;
|
253
|
+
if (schema.items && !Array.isArray(schema.items)) {
|
254
|
+
schemaItems = schema.items;
|
255
|
+
} else {
|
256
|
+
return /* @__PURE__ */ jsxDEV4(Fragment2, {
|
257
|
+
children: [
|
258
|
+
"No applicable renderer found for '",
|
259
|
+
label,
|
260
|
+
"'."
|
261
|
+
]
|
262
|
+
}, undefined, true, undefined, this);
|
263
|
+
}
|
264
|
+
return /* @__PURE__ */ jsxDEV4(Fragment2, {
|
265
|
+
children: /* @__PURE__ */ jsxDEV4(Input2.Wrapper, {
|
266
|
+
label,
|
267
|
+
description: withDescriptions ? schema.description : undefined,
|
268
|
+
withAsterisk: required,
|
269
|
+
children: /* @__PURE__ */ jsxDEV4(Paper2, {
|
270
|
+
withBorder: Array.isArray(data) && data.length > 0,
|
271
|
+
shadow: "0",
|
272
|
+
p: Array.isArray(data) && data.length > 0 ? "sm" : 0,
|
273
|
+
mt: withDescriptions && schema.description && schema.description.length > 0 ? 4 : 0,
|
274
|
+
children: /* @__PURE__ */ jsxDEV4(Stack, {
|
275
|
+
align: "stretch",
|
276
|
+
justify: "flex-start",
|
277
|
+
gap: "sm",
|
278
|
+
children: [
|
279
|
+
Array.isArray(data) ? data.map((item, i) => {
|
280
|
+
return /* @__PURE__ */ jsxDEV4(Flex, {
|
281
|
+
gap: "xs",
|
282
|
+
justify: "flex-start",
|
283
|
+
align: "center",
|
284
|
+
direction: "row",
|
285
|
+
wrap: "nowrap",
|
286
|
+
children: [
|
287
|
+
/* @__PURE__ */ jsxDEV4(Paper2, {
|
288
|
+
p: schemaItems.type === "object" ? "sm" : 0,
|
289
|
+
withBorder: schemaItems.type === "object",
|
290
|
+
style: {
|
291
|
+
borderColor: isHoveringDelete === i ? mantineTheme.colors.red[6] : undefined
|
292
|
+
},
|
293
|
+
flex: 1,
|
294
|
+
children: /* @__PURE__ */ jsxDEV4(JsonForms2, {
|
295
|
+
schema: {
|
296
|
+
...schemaItems,
|
297
|
+
$schema: undefined
|
298
|
+
},
|
299
|
+
data: item,
|
300
|
+
renderers: renderers ?? [],
|
301
|
+
cells: cells ?? [],
|
302
|
+
onChange: ({ data: newData }) => {
|
303
|
+
const dataCopy = [...data];
|
304
|
+
dataCopy[i] = newData;
|
305
|
+
handleChange(path, dataCopy);
|
306
|
+
},
|
307
|
+
validationMode: "NoValidation"
|
308
|
+
}, undefined, false, undefined, this)
|
309
|
+
}, undefined, false, undefined, this),
|
310
|
+
/* @__PURE__ */ jsxDEV4(Tooltip, {
|
311
|
+
label: "Delete Item",
|
312
|
+
children: /* @__PURE__ */ jsxDEV4(ActionIcon, {
|
313
|
+
variant: "default",
|
314
|
+
onClick: () => {
|
315
|
+
const dataCopy = [...data];
|
316
|
+
dataCopy.splice(i, 1);
|
317
|
+
handleChange(path, dataCopy);
|
318
|
+
setIsHoveringDelete(null);
|
319
|
+
},
|
320
|
+
size: "input-sm",
|
321
|
+
"aria-label": "Delete Item",
|
322
|
+
onMouseEnter: () => {
|
323
|
+
setIsHoveringDelete(i);
|
324
|
+
},
|
325
|
+
onMouseLeave: () => {
|
326
|
+
setIsHoveringDelete(null);
|
327
|
+
},
|
328
|
+
children: /* @__PURE__ */ jsxDEV4(IconTrash, {
|
329
|
+
...theme.iconProps.medium
|
330
|
+
}, undefined, false, undefined, this)
|
331
|
+
}, undefined, false, undefined, this)
|
332
|
+
}, undefined, false, undefined, this)
|
333
|
+
]
|
334
|
+
}, i, true, undefined, this);
|
335
|
+
}) : /* @__PURE__ */ jsxDEV4(Fragment2, {}, undefined, false, undefined, this),
|
336
|
+
/* @__PURE__ */ jsxDEV4(Button, {
|
337
|
+
variant: "default",
|
338
|
+
leftSection: /* @__PURE__ */ jsxDEV4(IconPlus, {
|
339
|
+
...theme.iconProps.medium
|
340
|
+
}, undefined, false, undefined, this),
|
341
|
+
onClick: () => {
|
342
|
+
let defaultValue = "";
|
343
|
+
if (schemaItems.type === "string" && schemaItems.enum) {
|
344
|
+
if (schemaItems.enum.length > 0) {
|
345
|
+
defaultValue = schemaItems.enum[0];
|
346
|
+
}
|
347
|
+
} else if (schemaItems.type === "string") {
|
348
|
+
defaultValue = "";
|
349
|
+
} else if (schemaItems.type === "object") {
|
350
|
+
defaultValue = {};
|
351
|
+
}
|
352
|
+
handleChange(path, [...data || [], defaultValue]);
|
353
|
+
},
|
354
|
+
children: "Add Item"
|
355
|
+
}, undefined, false, undefined, this)
|
356
|
+
]
|
357
|
+
}, undefined, true, undefined, this)
|
358
|
+
}, undefined, false, undefined, this)
|
359
|
+
}, undefined, false, undefined, this)
|
360
|
+
}, undefined, false, undefined, this);
|
361
|
+
}
|
362
|
+
var ArrayControl = withJsonFormsControlProps2(PlainArrayControl);
|
363
|
+
var ArrayControl_default = ArrayControl;
|
364
|
+
|
365
|
+
// src/jsonforms/renderers/CheckboxControl.tsx
|
366
|
+
import { withJsonFormsControlProps as withJsonFormsControlProps3 } from "@jsonforms/react";
|
367
|
+
import { Checkbox } from "@mantine/core";
|
368
|
+
import { jsxDEV as jsxDEV5, Fragment as Fragment3 } from "react/jsx-dev-runtime";
|
369
|
+
function PlainCheckboxControl({
|
370
|
+
data,
|
371
|
+
handleChange,
|
372
|
+
path,
|
373
|
+
label,
|
374
|
+
required,
|
375
|
+
schema
|
376
|
+
}) {
|
377
|
+
const {
|
378
|
+
formOptions: { withDescriptions }
|
379
|
+
} = useFormOptions();
|
380
|
+
return /* @__PURE__ */ jsxDEV5(Fragment3, {
|
381
|
+
children: /* @__PURE__ */ jsxDEV5(Checkbox, {
|
382
|
+
label,
|
383
|
+
py: "sm",
|
384
|
+
size: "sm",
|
385
|
+
labelPosition: "left",
|
386
|
+
checked: data,
|
387
|
+
onChange: (event) => {
|
388
|
+
handleChange(path, event.target.checked);
|
389
|
+
},
|
390
|
+
required,
|
391
|
+
description: withDescriptions ? schema.description || null : null
|
392
|
+
}, undefined, false, undefined, this)
|
393
|
+
}, undefined, false, undefined, this);
|
394
|
+
}
|
395
|
+
var CheckboxControl = withJsonFormsControlProps3(PlainCheckboxControl);
|
396
|
+
var CheckboxControl_default = CheckboxControl;
|
397
|
+
|
398
|
+
// src/jsonforms/renderers/NumberControl.tsx
|
399
|
+
import { withJsonFormsControlProps as withJsonFormsControlProps4 } from "@jsonforms/react";
|
400
|
+
import { NumberInput } from "@mantine/core";
|
401
|
+
import { jsxDEV as jsxDEV6, Fragment as Fragment4 } from "react/jsx-dev-runtime";
|
402
|
+
function PlainNumberControl({
|
403
|
+
data,
|
404
|
+
handleChange,
|
405
|
+
path,
|
406
|
+
label,
|
407
|
+
required,
|
408
|
+
schema
|
409
|
+
}) {
|
410
|
+
const {
|
411
|
+
formOptions: { withDescriptions }
|
412
|
+
} = useFormOptions();
|
413
|
+
return /* @__PURE__ */ jsxDEV6(Fragment4, {
|
414
|
+
children: /* @__PURE__ */ jsxDEV6(NumberInput, {
|
415
|
+
label,
|
416
|
+
variant: "filled",
|
417
|
+
value: data,
|
418
|
+
onChange: (newValue) => {
|
419
|
+
if (newValue === "") {
|
420
|
+
handleChange(path, undefined);
|
421
|
+
}
|
422
|
+
handleChange(path, Number(newValue));
|
423
|
+
},
|
424
|
+
required,
|
425
|
+
description: withDescriptions ? schema.description || null : null
|
426
|
+
}, undefined, false, undefined, this)
|
427
|
+
}, undefined, false, undefined, this);
|
428
|
+
}
|
429
|
+
var NumberControl = withJsonFormsControlProps4(PlainNumberControl);
|
430
|
+
var NumberControl_default = NumberControl;
|
431
|
+
|
432
|
+
// src/jsonforms/renderers/ObjectControl.tsx
|
433
|
+
import {
|
434
|
+
JsonForms as JsonForms3,
|
435
|
+
useJsonForms as useJsonForms3,
|
436
|
+
withJsonFormsControlProps as withJsonFormsControlProps5
|
437
|
+
} from "@jsonforms/react";
|
438
|
+
import { Input as Input3, Paper as Paper3 } from "@mantine/core";
|
439
|
+
import { jsxDEV as jsxDEV7, Fragment as Fragment5 } from "react/jsx-dev-runtime";
|
440
|
+
function PlainObjectControl(props) {
|
441
|
+
const { label, schema, data, handleChange, path, required } = props;
|
442
|
+
const {
|
443
|
+
formOptions: { withDescriptions }
|
444
|
+
} = useFormOptions();
|
445
|
+
const { renderers, cells } = useJsonForms3();
|
446
|
+
return /* @__PURE__ */ jsxDEV7(Fragment5, {
|
447
|
+
children: /* @__PURE__ */ jsxDEV7(Input3.Wrapper, {
|
448
|
+
label,
|
449
|
+
description: withDescriptions ? schema.description : undefined,
|
450
|
+
withAsterisk: required,
|
451
|
+
children: /* @__PURE__ */ jsxDEV7(Paper3, {
|
452
|
+
withBorder: true,
|
453
|
+
shadow: "0",
|
454
|
+
p: "sm",
|
455
|
+
mt: withDescriptions && schema.description && schema.description.length > 0 ? 4 : 0,
|
456
|
+
children: /* @__PURE__ */ jsxDEV7(JsonForms3, {
|
457
|
+
schema: {
|
458
|
+
...schema,
|
459
|
+
$schema: undefined
|
460
|
+
},
|
461
|
+
data,
|
462
|
+
renderers: renderers ?? [],
|
463
|
+
cells: cells ?? [],
|
464
|
+
onChange: ({ data: newData }) => {
|
465
|
+
handleChange(path, newData);
|
466
|
+
},
|
467
|
+
validationMode: "NoValidation"
|
468
|
+
}, undefined, false, undefined, this)
|
469
|
+
}, undefined, false, undefined, this)
|
470
|
+
}, undefined, false, undefined, this)
|
471
|
+
}, undefined, false, undefined, this);
|
472
|
+
}
|
473
|
+
var ObjectControl = withJsonFormsControlProps5(PlainObjectControl);
|
474
|
+
var ObjectControl_default = ObjectControl;
|
475
|
+
|
476
|
+
// src/jsonforms/renderers/StringSelectControl.tsx
|
477
|
+
import { withJsonFormsControlProps as withJsonFormsControlProps6 } from "@jsonforms/react";
|
478
|
+
import { Select as Select2 } from "@mantine/core";
|
479
|
+
import { jsxDEV as jsxDEV8, Fragment as Fragment6 } from "react/jsx-dev-runtime";
|
480
|
+
function PlainTimestampControl({
|
481
|
+
data,
|
482
|
+
handleChange,
|
483
|
+
path,
|
484
|
+
label,
|
485
|
+
schema,
|
486
|
+
required
|
487
|
+
}) {
|
488
|
+
const {
|
489
|
+
formOptions: { withDescriptions }
|
490
|
+
} = useFormOptions();
|
491
|
+
return /* @__PURE__ */ jsxDEV8(Fragment6, {
|
492
|
+
children: /* @__PURE__ */ jsxDEV8(Select2, {
|
493
|
+
label,
|
494
|
+
data: schema.enum,
|
495
|
+
value: data,
|
496
|
+
onChange: (newValue) => {
|
497
|
+
handleChange(path, newValue);
|
498
|
+
},
|
499
|
+
required,
|
500
|
+
placeholder: "Select an option",
|
501
|
+
variant: "filled",
|
502
|
+
description: withDescriptions ? schema.description || null : null
|
503
|
+
}, undefined, false, undefined, this)
|
504
|
+
}, undefined, false, undefined, this);
|
505
|
+
}
|
506
|
+
var TimestampControl = withJsonFormsControlProps6(PlainTimestampControl);
|
507
|
+
var StringSelectControl_default = TimestampControl;
|
508
|
+
|
509
|
+
// src/jsonforms/renderers/testers/anyOfTester.ts
|
510
|
+
import { rankWith, uiTypeIs, and, isAnyOfControl } from "@jsonforms/core";
|
511
|
+
var anyOfTester_default = rankWith(10, and(uiTypeIs("Control"), isAnyOfControl));
|
512
|
+
|
513
|
+
// src/jsonforms/renderers/testers/arrayControlTester.ts
|
514
|
+
import { rankWith as rankWith2, uiTypeIs as uiTypeIs2, and as and2, schemaTypeIs } from "@jsonforms/core";
|
515
|
+
var arrayControlTester_default = rankWith2(10, and2(uiTypeIs2("Control"), schemaTypeIs("array")));
|
516
|
+
|
517
|
+
// src/jsonforms/renderers/testers/checkboxControlTester.ts
|
518
|
+
import { rankWith as rankWith3, uiTypeIs as uiTypeIs3, and as and3, schemaTypeIs as schemaTypeIs2 } from "@jsonforms/core";
|
519
|
+
var checkboxControlTester_default = rankWith3(10, and3(uiTypeIs3("Control"), schemaTypeIs2("boolean")));
|
520
|
+
|
521
|
+
// src/jsonforms/renderers/testers/numberControlTester.ts
|
522
|
+
import { rankWith as rankWith4, uiTypeIs as uiTypeIs4, and as and4, schemaTypeIs as schemaTypeIs3, or } from "@jsonforms/core";
|
523
|
+
var numberControlTester_default = rankWith4(8, (a, b, c) => {
|
524
|
+
if (b.type === "integer") {
|
525
|
+
return true;
|
526
|
+
}
|
527
|
+
return and4(uiTypeIs4("Control"), or(schemaTypeIs3("number"), schemaTypeIs3("integer")))(a, b, c);
|
528
|
+
});
|
529
|
+
|
530
|
+
// src/jsonforms/renderers/testers/objectControlTester.ts
|
531
|
+
import { rankWith as rankWith5, uiTypeIs as uiTypeIs5, and as and5, schemaTypeIs as schemaTypeIs4 } from "@jsonforms/core";
|
532
|
+
var objectControlTester_default = rankWith5(10, and5(uiTypeIs5("Control"), schemaTypeIs4("object")));
|
533
|
+
|
534
|
+
// src/jsonforms/renderers/testers/stringSelectControlTester.ts
|
535
|
+
import {
|
536
|
+
rankWith as rankWith6,
|
537
|
+
uiTypeIs as uiTypeIs6,
|
538
|
+
and as and6,
|
539
|
+
schemaTypeIs as schemaTypeIs5,
|
540
|
+
isEnumControl
|
541
|
+
} from "@jsonforms/core";
|
542
|
+
var stringSelectControlTester_default = rankWith6(11, and6(uiTypeIs6("Control"), schemaTypeIs5("string"), isEnumControl));
|
543
|
+
|
544
|
+
// src/jsonforms/renderers/testers/textControlTester.ts
|
545
|
+
import { rankWith as rankWith7, uiTypeIs as uiTypeIs7, and as and7, schemaTypeIs as schemaTypeIs6 } from "@jsonforms/core";
|
546
|
+
var textControlTester_default = rankWith7(10, and7(uiTypeIs7("Control"), schemaTypeIs6("string")));
|
547
|
+
|
548
|
+
// src/jsonforms/renderers/testers/timestampControlTester.ts
|
549
|
+
import {
|
550
|
+
rankWith as rankWith8,
|
551
|
+
uiTypeIs as uiTypeIs8,
|
552
|
+
and as and8,
|
553
|
+
schemaTypeIs as schemaTypeIs7,
|
554
|
+
scopeEndsWith
|
555
|
+
} from "@jsonforms/core";
|
556
|
+
var timestampControlTester_default = rankWith8(11, and8(uiTypeIs8("Control"), schemaTypeIs7("integer"), scopeEndsWith("startTime")));
|
557
|
+
|
558
|
+
// src/jsonforms/renderers/testers/verticalLayoutTester.ts
|
559
|
+
import { rankWith as rankWith9, uiTypeIs as uiTypeIs9 } from "@jsonforms/core";
|
560
|
+
var verticalLayoutTester_default = rankWith9(2, uiTypeIs9("VerticalLayout"));
|
561
|
+
|
562
|
+
// src/jsonforms/renderers/TextControl.tsx
|
563
|
+
import { withJsonFormsControlProps as withJsonFormsControlProps7 } from "@jsonforms/react";
|
564
|
+
import { TextInput } from "@mantine/core";
|
565
|
+
import { jsxDEV as jsxDEV9, Fragment as Fragment7 } from "react/jsx-dev-runtime";
|
566
|
+
function PlainTextControl({
|
567
|
+
data,
|
568
|
+
handleChange,
|
569
|
+
path,
|
570
|
+
label,
|
571
|
+
required,
|
572
|
+
schema
|
573
|
+
}) {
|
574
|
+
const {
|
575
|
+
formOptions: { withDescriptions }
|
576
|
+
} = useFormOptions();
|
577
|
+
return /* @__PURE__ */ jsxDEV9(Fragment7, {
|
578
|
+
children: /* @__PURE__ */ jsxDEV9(TextInput, {
|
579
|
+
label,
|
580
|
+
variant: "filled",
|
581
|
+
placeholder: "",
|
582
|
+
value: data,
|
583
|
+
onChange: (event) => {
|
584
|
+
handleChange(path, event.currentTarget.value);
|
585
|
+
},
|
586
|
+
required,
|
587
|
+
description: withDescriptions ? schema.description || null : null
|
588
|
+
}, undefined, false, undefined, this)
|
589
|
+
}, undefined, false, undefined, this);
|
590
|
+
}
|
591
|
+
var TextControl = withJsonFormsControlProps7(PlainTextControl);
|
592
|
+
var TextControl_default = TextControl;
|
593
|
+
|
594
|
+
// src/jsonforms/renderers/TimestampControl.tsx
|
595
|
+
import { withJsonFormsControlProps as withJsonFormsControlProps8 } from "@jsonforms/react";
|
596
|
+
import { DatePickerInput } from "@mantine/dates";
|
597
|
+
import { jsxDEV as jsxDEV10, Fragment as Fragment8 } from "react/jsx-dev-runtime";
|
598
|
+
function PlainTimestampControl2({
|
599
|
+
data,
|
600
|
+
handleChange,
|
601
|
+
path,
|
602
|
+
label,
|
603
|
+
required,
|
604
|
+
schema
|
605
|
+
}) {
|
606
|
+
const {
|
607
|
+
formOptions: { withDescriptions }
|
608
|
+
} = useFormOptions();
|
609
|
+
return /* @__PURE__ */ jsxDEV10(Fragment8, {
|
610
|
+
children: /* @__PURE__ */ jsxDEV10(DatePickerInput, {
|
611
|
+
label,
|
612
|
+
placeholder: "Pick a date",
|
613
|
+
value: new Date(data * 1000),
|
614
|
+
onChange: (newValue) => {
|
615
|
+
if (newValue) {
|
616
|
+
handleChange(path, newValue.getTime() / 1000);
|
617
|
+
}
|
618
|
+
},
|
619
|
+
required,
|
620
|
+
description: withDescriptions ? schema.description || null : null
|
621
|
+
}, undefined, false, undefined, this)
|
622
|
+
}, undefined, false, undefined, this);
|
623
|
+
}
|
624
|
+
var TimestampControl2 = withJsonFormsControlProps8(PlainTimestampControl2);
|
625
|
+
var TimestampControl_default = TimestampControl2;
|
626
|
+
|
627
|
+
// src/jsonforms/renderers/VerticalLayout.tsx
|
628
|
+
import React3 from "react";
|
629
|
+
import { withJsonFormsLayoutProps } from "@jsonforms/react";
|
630
|
+
import { JsonFormsDispatch, useJsonForms as useJsonForms4 } from "@jsonforms/react";
|
631
|
+
import { useMantineTheme as useMantineTheme3 } from "@mantine/core";
|
632
|
+
import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
|
633
|
+
"use client";
|
634
|
+
var JsonFormsLayout = ({
|
635
|
+
className,
|
636
|
+
children,
|
637
|
+
visible
|
638
|
+
}) => {
|
639
|
+
return /* @__PURE__ */ jsxDEV11("div", {
|
640
|
+
className,
|
641
|
+
hidden: visible === undefined || visible === null ? false : !visible,
|
642
|
+
children
|
643
|
+
}, undefined, false, undefined, this);
|
644
|
+
};
|
645
|
+
var renderChildren = (layout, schema, className, path, enabled) => {
|
646
|
+
const { renderers, cells } = useJsonForms4();
|
647
|
+
const theme = useMantineTheme3();
|
648
|
+
return layout.elements.map((child, index) => {
|
649
|
+
return /* @__PURE__ */ jsxDEV11("div", {
|
650
|
+
className,
|
651
|
+
style: { marginTop: index === 0 ? 0 : theme.spacing.xs },
|
652
|
+
children: /* @__PURE__ */ jsxDEV11(JsonFormsDispatch, {
|
653
|
+
renderers,
|
654
|
+
cells,
|
655
|
+
uischema: child,
|
656
|
+
schema,
|
657
|
+
path,
|
658
|
+
enabled
|
659
|
+
}, undefined, false, undefined, this)
|
660
|
+
}, `${path}-${index}`, false, undefined, this);
|
661
|
+
});
|
662
|
+
};
|
663
|
+
var VerticalLayoutRenderer = (props) => {
|
664
|
+
const { data: _data, ...otherProps } = props;
|
665
|
+
return /* @__PURE__ */ jsxDEV11(VerticalLayoutRendererComponent, {
|
666
|
+
...otherProps
|
667
|
+
}, undefined, false, undefined, this);
|
668
|
+
};
|
669
|
+
var VerticalLayoutRendererComponent = React3.memo(function VerticalLayoutRendererComponent2({
|
670
|
+
schema,
|
671
|
+
uischema,
|
672
|
+
path,
|
673
|
+
visible,
|
674
|
+
enabled
|
675
|
+
}) {
|
676
|
+
const verticalLayout = uischema;
|
677
|
+
const layoutClassName = "";
|
678
|
+
const childClassNames = "";
|
679
|
+
return /* @__PURE__ */ jsxDEV11(JsonFormsLayout, {
|
680
|
+
className: layoutClassName,
|
681
|
+
uischema,
|
682
|
+
schema,
|
683
|
+
visible,
|
684
|
+
enabled,
|
685
|
+
path,
|
686
|
+
children: renderChildren(verticalLayout, schema, childClassNames, path, enabled)
|
687
|
+
}, undefined, false, undefined, this);
|
688
|
+
});
|
689
|
+
var VerticalLayout = withJsonFormsLayoutProps(VerticalLayoutRenderer, false);
|
690
|
+
var VerticalLayout_default = VerticalLayout;
|
691
|
+
|
692
|
+
// src/jsonforms/renderers/index.ts
|
693
|
+
var remoraidControlRenderers = [
|
694
|
+
{ renderer: ArrayControl_default, tester: arrayControlTester_default },
|
695
|
+
{ renderer: CheckboxControl_default, tester: checkboxControlTester_default },
|
696
|
+
{ renderer: NumberControl_default, tester: numberControlTester_default },
|
697
|
+
{ renderer: StringSelectControl_default, tester: stringSelectControlTester_default },
|
698
|
+
{ renderer: TextControl_default, tester: textControlTester_default },
|
699
|
+
{ renderer: TimestampControl_default, tester: timestampControlTester_default },
|
700
|
+
{ renderer: ObjectControl_default, tester: objectControlTester_default },
|
701
|
+
{ renderer: AnyOfControl_default, tester: anyOfTester_default }
|
702
|
+
];
|
703
|
+
var remoraidLayoutRenderers = [
|
704
|
+
{ renderer: VerticalLayout_default, tester: verticalLayoutTester_default }
|
705
|
+
];
|
706
|
+
var remoraidRenderers = [
|
707
|
+
...remoraidControlRenderers,
|
708
|
+
...remoraidLayoutRenderers
|
709
|
+
];
|
710
|
+
// src/jsonforms/lib/utils.ts
|
711
|
+
import { vanillaRenderers } from "@jsonforms/vanilla-renderers";
|
712
|
+
var renderers = [
|
713
|
+
...vanillaRenderers,
|
714
|
+
...remoraidRenderers
|
715
|
+
];
|
716
|
+
export {
|
717
|
+
useFormOptions,
|
718
|
+
renderers,
|
719
|
+
remoraidRenderers,
|
720
|
+
remoraidLayoutRenderers,
|
721
|
+
remoraidControlRenderers,
|
722
|
+
defaultFormOptions,
|
723
|
+
FormOptionsProvider
|
724
|
+
};
|