@overmap-ai/forms 1.0.32-react-flow-david-fixes.41 → 1.0.33-toast-migration.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/dist/form/Observable/index.d.ts +1 -0
- package/dist/form/UUIDFile/UUIDFile.d.ts +5 -0
- package/dist/form/UUIDFile/index.d.ts +1 -0
- package/dist/form/{fields/UploadField → UUIDPromise}/UUIDPromise.d.ts +3 -3
- package/dist/form/UUIDPromise/index.d.ts +2 -0
- package/dist/form/UUIDPromise/utils.d.ts +4 -0
- package/dist/form/builder/Root.d.ts +1 -1
- package/dist/form/builder/components/CreateFieldDropdownMenu.d.ts +8 -0
- package/dist/form/builder/components/FieldBuilder.d.ts +2 -2
- package/dist/form/builder/components/FieldBuilderWithActions.d.ts +9 -0
- package/dist/form/builder/components/index.d.ts +2 -1
- package/dist/form/builder/hooks.d.ts +1 -1
- package/dist/form/builder/list/FieldSectionWithActions.d.ts +1 -1
- package/dist/form/builder/utils.d.ts +2 -2
- package/dist/form/components/DisplayFile.d.ts +9 -0
- package/dist/form/components/index.d.ts +1 -0
- package/dist/form/conditions/BaseCondition/BaseCondition.d.ts +7 -8
- package/dist/form/conditions/BaseCondition/typings.d.ts +4 -4
- package/dist/form/conditions/BooleanFieldCondition/BooleanFieldCondition.d.ts +4 -6
- package/dist/form/conditions/CheckboxListFieldCondition/CheckboxListFieldCondition.d.ts +4 -6
- package/dist/form/conditions/ConditionManager/ConditionManager.d.ts +15 -0
- package/dist/form/conditions/ConditionManager/hooks.d.ts +4 -0
- package/dist/form/conditions/ConditionManager/index.d.ts +3 -0
- package/dist/form/conditions/ConditionManager/typings.d.ts +2 -0
- package/dist/form/conditions/DateFieldCondition/DateFieldCondition.d.ts +5 -7
- package/dist/form/conditions/MultiSelectFieldCondition/MultiSelectFieldCondition.d.ts +4 -14
- package/dist/form/conditions/MultiStringFieldCondition/MultiStringFieldCondition.d.ts +4 -6
- package/dist/form/conditions/NumberFieldCondition/NumberFieldCondition.d.ts +4 -17
- package/dist/form/conditions/OTPFieldCondition/OTPFieldCondition.d.ts +4 -6
- package/dist/form/conditions/PassFailFieldCondition/PassFailFieldCondition.d.ts +18 -0
- package/dist/form/conditions/PassFailFieldCondition/PassFailFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/PassFailFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/PassFailFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/RadioFieldCondition/RadioFieldCondition.d.ts +4 -6
- package/dist/form/conditions/RatingFieldCondition/RatingFieldCondition.d.ts +21 -0
- package/dist/form/conditions/RatingFieldCondition/RatingFieldConditionCell.d.ts +6 -0
- package/dist/form/conditions/RatingFieldCondition/index.d.ts +3 -0
- package/dist/form/conditions/RatingFieldCondition/typings.d.ts +4 -0
- package/dist/form/conditions/ScanFieldCondition/ScanFieldCondition.d.ts +4 -6
- package/dist/form/conditions/SelectFieldCondition/SelectFieldCondition.d.ts +4 -6
- package/dist/form/conditions/StringFieldCondition/StringFieldCondition.d.ts +4 -6
- package/dist/form/conditions/TextFieldCondition/TextFieldCondition.d.ts +4 -6
- package/dist/form/conditions/UploadFieldCondition/UploadFieldCondition.d.ts +8 -8
- package/dist/form/conditions/constants.d.ts +32 -0
- package/dist/form/conditions/index.d.ts +3 -0
- package/dist/form/conditions/typings.d.ts +6 -3
- package/dist/form/conditions/utils.d.ts +4 -5
- package/dist/form/fields/BaseField/BaseField.d.ts +6 -7
- package/dist/form/fields/BaseField/typings.d.ts +3 -4
- package/dist/form/fields/BaseFormElement/BaseFormElement.d.ts +9 -9
- package/dist/form/fields/BaseFormElement/typings.d.ts +3 -3
- package/dist/form/fields/BaseOptionsField/BaseOptionsField.d.ts +7 -7
- package/dist/form/fields/BaseOptionsField/typings.d.ts +2 -2
- package/dist/form/fields/BaseStringField/BaseStringField.d.ts +4 -4
- package/dist/form/fields/BaseStringField/typings.d.ts +1 -1
- package/dist/form/fields/BooleanField/BooleanField.d.ts +3 -4
- package/dist/form/fields/BooleanField/BooleanInput.d.ts +1 -1
- package/dist/form/fields/CheckboxListField/CheckboxListField.d.ts +2 -2
- package/dist/form/fields/DateField/DateField.d.ts +2 -2
- package/dist/form/fields/DateField/DateInput.d.ts +1 -1
- package/dist/form/fields/FieldSection/FieldSection.d.ts +6 -8
- package/dist/form/fields/FieldSection/typings.d.ts +2 -2
- package/dist/form/fields/MultiSelectField/MultiSelectField.d.ts +2 -2
- package/dist/form/fields/MultiSelectField/MultiSelectInput.d.ts +1 -1
- package/dist/form/fields/MultiStringField/MultiStringField.d.ts +2 -2
- package/dist/form/fields/MultiStringField/MultiStringInput.d.ts +1 -1
- package/dist/form/fields/NumberField/NumberField.d.ts +2 -2
- package/dist/form/fields/NumberField/NumberInput.d.ts +1 -1
- package/dist/form/fields/OneTimePasswordField/OTPField.d.ts +2 -2
- package/dist/form/fields/OneTimePasswordField/typings.d.ts +1 -1
- package/dist/form/fields/PassFailField/PassFailField.d.ts +30 -0
- package/dist/form/fields/PassFailField/PassFailInput.d.ts +7 -0
- package/dist/form/fields/PassFailField/constants.d.ts +7 -0
- package/dist/form/fields/PassFailField/index.d.ts +5 -0
- package/dist/form/fields/PassFailField/typings.d.ts +17 -0
- package/dist/form/fields/PassFailField/utils.d.ts +7 -0
- package/dist/form/fields/RadioField/RadioField.d.ts +2 -2
- package/dist/form/fields/RadioField/RadioInput.d.ts +1 -1
- package/dist/form/fields/RatingField/RatingField.d.ts +32 -0
- package/dist/form/fields/RatingField/RatingInput.d.ts +7 -0
- package/dist/form/fields/RatingField/index.d.ts +3 -0
- package/dist/form/fields/RatingField/typings.d.ts +4 -0
- package/dist/form/fields/ScanField/ScanField.d.ts +2 -2
- package/dist/form/fields/ScanField/ScanInput.d.ts +1 -1
- package/dist/form/fields/SelectField/SelectField.d.ts +2 -2
- package/dist/form/fields/SelectField/SelectInput.d.ts +1 -1
- package/dist/form/fields/StringField/StringField.d.ts +1 -1
- package/dist/form/fields/StringField/StringInput.d.ts +1 -1
- package/dist/form/fields/TextField/TextField.d.ts +1 -1
- package/dist/form/fields/TextField/TextInput.d.ts +1 -1
- package/dist/form/fields/UploadField/UploadField.d.ts +11 -10
- package/dist/form/fields/UploadField/UploadInput.d.ts +1 -1
- package/dist/form/fields/UploadField/index.d.ts +0 -1
- package/dist/form/fields/UploadField/utils.d.ts +0 -3
- package/dist/form/fields/components/InputWithLabel.d.ts +1 -1
- package/dist/form/fields/constants.d.ts +7 -3
- package/dist/form/fields/hooks.d.ts +1 -1
- package/dist/form/fields/index.d.ts +2 -0
- package/dist/form/fields/typings.d.ts +14 -16
- package/dist/form/fields/utils.d.ts +7 -2
- package/dist/form/index.d.ts +3 -0
- package/dist/form/modifiers/file.d.ts +3 -2
- package/dist/form/modifiers/index.d.ts +1 -0
- package/dist/form/modifiers/passFailStatus.d.ts +6 -0
- package/dist/form/modifiers/utils.d.ts +1 -1
- package/dist/form/schema/FieldSchema.d.ts +7 -6
- package/dist/form/typings.d.ts +6 -2
- package/dist/form/utils.d.ts +5 -11
- package/dist/forms.js +2185 -742
- package/dist/forms.js.map +1 -0
- package/dist/forms.umd.cjs +2183 -740
- package/dist/forms.umd.cjs.map +1 -0
- package/package.json +37 -51
- package/dist/form/builder/components/FieldWithActions.d.ts +0 -10
- /package/dist/form/{observable → Observable}/Observable.d.ts +0 -0
package/dist/forms.js
CHANGED
|
@@ -2,9 +2,9 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
5
|
-
import { Card, LuIcon, Text, Spinner, Overlay, ButtonGroup, Tooltip, IconButton, Separator, Input, Badge, Checkbox, CheckboxGroup, Popover, Button, DayPicker, Menu, OneTimePasswordField, RadioGroup, TextArea, stopPropagation, Heading,
|
|
5
|
+
import { Card, LuIcon, Text, Spinner, Overlay, ButtonGroup, Tooltip, IconButton, Separator, Input, Badge, Checkbox, CheckboxGroup, Popover, Button, DayPicker, Menu, OneTimePasswordField, RadioGroup, TextArea, Rating, stopPropagation, Heading, toast, ToggleGroup } from "@overmap-ai/blocks";
|
|
6
6
|
import { cx } from "class-variance-authority";
|
|
7
|
-
import {
|
|
7
|
+
import { forwardRef, createElement, memo, createContext, useContext, useRef, useCallback, useState, useEffect, useMemo, Fragment, use, useLayoutEffect, useId } from "react";
|
|
8
8
|
import "@xyflow/react/dist/style.css";
|
|
9
9
|
import { getBezierPath, Position, BaseEdge, EdgeLabelRenderer, NodeToolbar, Handle, MarkerType, useNodesState, useEdgesState, ReactFlow, Panel } from "@xyflow/react";
|
|
10
10
|
import { useField, useFormikContext, useFormik, FormikProvider } from "formik";
|
|
@@ -17,11 +17,609 @@ import { DecodeHintType as DecodeHintType$2, useZxing } from "react-zxing";
|
|
|
17
17
|
import get from "lodash.get";
|
|
18
18
|
import Dagre from "@dagrejs/dagre";
|
|
19
19
|
import set from "lodash.set";
|
|
20
|
+
/**
|
|
21
|
+
* @license lucide-react v0.542.0 - ISC
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the ISC license.
|
|
24
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/
|
|
26
|
+
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
27
|
+
const toCamelCase = (string) => string.replace(
|
|
28
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
29
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
30
|
+
);
|
|
31
|
+
const toPascalCase = (string) => {
|
|
32
|
+
const camelCase = toCamelCase(string);
|
|
33
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
34
|
+
};
|
|
35
|
+
const mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
36
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
37
|
+
}).join(" ").trim();
|
|
38
|
+
const hasA11yProp = (props) => {
|
|
39
|
+
for (const prop in props) {
|
|
40
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @license lucide-react v0.542.0 - ISC
|
|
47
|
+
*
|
|
48
|
+
* This source code is licensed under the ISC license.
|
|
49
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
+
*/
|
|
51
|
+
var defaultAttributes = {
|
|
52
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
53
|
+
width: 24,
|
|
54
|
+
height: 24,
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
fill: "none",
|
|
57
|
+
stroke: "currentColor",
|
|
58
|
+
strokeWidth: 2,
|
|
59
|
+
strokeLinecap: "round",
|
|
60
|
+
strokeLinejoin: "round"
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* @license lucide-react v0.542.0 - ISC
|
|
64
|
+
*
|
|
65
|
+
* This source code is licensed under the ISC license.
|
|
66
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
+
*/
|
|
68
|
+
const Icon = forwardRef(
|
|
69
|
+
({
|
|
70
|
+
color = "currentColor",
|
|
71
|
+
size = 24,
|
|
72
|
+
strokeWidth = 2,
|
|
73
|
+
absoluteStrokeWidth,
|
|
74
|
+
className = "",
|
|
75
|
+
children,
|
|
76
|
+
iconNode,
|
|
77
|
+
...rest
|
|
78
|
+
}, ref) => createElement(
|
|
79
|
+
"svg",
|
|
80
|
+
{
|
|
81
|
+
ref,
|
|
82
|
+
...defaultAttributes,
|
|
83
|
+
width: size,
|
|
84
|
+
height: size,
|
|
85
|
+
stroke: color,
|
|
86
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
87
|
+
className: mergeClasses("lucide", className),
|
|
88
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
89
|
+
...rest
|
|
90
|
+
},
|
|
91
|
+
[
|
|
92
|
+
...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
|
|
93
|
+
...Array.isArray(children) ? children : [children]
|
|
94
|
+
]
|
|
95
|
+
)
|
|
96
|
+
);
|
|
97
|
+
/**
|
|
98
|
+
* @license lucide-react v0.542.0 - ISC
|
|
99
|
+
*
|
|
100
|
+
* This source code is licensed under the ISC license.
|
|
101
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
+
*/
|
|
103
|
+
const createLucideIcon = (iconName, iconNode) => {
|
|
104
|
+
const Component = forwardRef(
|
|
105
|
+
({ className, ...props }, ref) => createElement(Icon, {
|
|
106
|
+
ref,
|
|
107
|
+
iconNode,
|
|
108
|
+
className: mergeClasses(
|
|
109
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
110
|
+
`lucide-${iconName}`,
|
|
111
|
+
className
|
|
112
|
+
),
|
|
113
|
+
...props
|
|
114
|
+
})
|
|
115
|
+
);
|
|
116
|
+
Component.displayName = toPascalCase(iconName);
|
|
117
|
+
return Component;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* @license lucide-react v0.542.0 - ISC
|
|
121
|
+
*
|
|
122
|
+
* This source code is licensed under the ISC license.
|
|
123
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
124
|
+
*/
|
|
125
|
+
const __iconNode$D = [
|
|
126
|
+
["path", { d: "M3 12h18", key: "1i2n21" }],
|
|
127
|
+
["path", { d: "M3 18h18", key: "1h113x" }],
|
|
128
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }]
|
|
129
|
+
];
|
|
130
|
+
const AlignJustify = createLucideIcon("align-justify", __iconNode$D);
|
|
131
|
+
/**
|
|
132
|
+
* @license lucide-react v0.542.0 - ISC
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the ISC license.
|
|
135
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
+
*/
|
|
137
|
+
const __iconNode$C = [
|
|
138
|
+
["path", { d: "m3 16 4 4 4-4", key: "1co6wj" }],
|
|
139
|
+
["path", { d: "M7 20V4", key: "1yoxec" }],
|
|
140
|
+
["path", { d: "m21 8-4-4-4 4", key: "1c9v7m" }],
|
|
141
|
+
["path", { d: "M17 4v16", key: "7dpous" }]
|
|
142
|
+
];
|
|
143
|
+
const ArrowDownUp = createLucideIcon("arrow-down-up", __iconNode$C);
|
|
144
|
+
/**
|
|
145
|
+
* @license lucide-react v0.542.0 - ISC
|
|
146
|
+
*
|
|
147
|
+
* This source code is licensed under the ISC license.
|
|
148
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
+
*/
|
|
150
|
+
const __iconNode$B = [
|
|
151
|
+
["path", { d: "M8 3 4 7l4 4", key: "9rb6wj" }],
|
|
152
|
+
["path", { d: "M4 7h16", key: "6tx8e3" }],
|
|
153
|
+
["path", { d: "m16 21 4-4-4-4", key: "siv7j2" }],
|
|
154
|
+
["path", { d: "M20 17H4", key: "h6l3hr" }]
|
|
155
|
+
];
|
|
156
|
+
const ArrowLeftRight = createLucideIcon("arrow-left-right", __iconNode$B);
|
|
157
|
+
/**
|
|
158
|
+
* @license lucide-react v0.542.0 - ISC
|
|
159
|
+
*
|
|
160
|
+
* This source code is licensed under the ISC license.
|
|
161
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
+
*/
|
|
163
|
+
const __iconNode$A = [
|
|
164
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
165
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
166
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
167
|
+
["path", { d: "M3 10h18", key: "8toen8" }]
|
|
168
|
+
];
|
|
169
|
+
const Calendar = createLucideIcon("calendar", __iconNode$A);
|
|
170
|
+
/**
|
|
171
|
+
* @license lucide-react v0.542.0 - ISC
|
|
172
|
+
*
|
|
173
|
+
* This source code is licensed under the ISC license.
|
|
174
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
+
*/
|
|
176
|
+
const __iconNode$z = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
177
|
+
const Check = createLucideIcon("check", __iconNode$z);
|
|
178
|
+
/**
|
|
179
|
+
* @license lucide-react v0.542.0 - ISC
|
|
180
|
+
*
|
|
181
|
+
* This source code is licensed under the ISC license.
|
|
182
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
+
*/
|
|
184
|
+
const __iconNode$y = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
185
|
+
const ChevronDown = createLucideIcon("chevron-down", __iconNode$y);
|
|
186
|
+
/**
|
|
187
|
+
* @license lucide-react v0.542.0 - ISC
|
|
188
|
+
*
|
|
189
|
+
* This source code is licensed under the ISC license.
|
|
190
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
+
*/
|
|
192
|
+
const __iconNode$x = [
|
|
193
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
194
|
+
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
195
|
+
];
|
|
196
|
+
const CircleCheck = createLucideIcon("circle-check", __iconNode$x);
|
|
197
|
+
/**
|
|
198
|
+
* @license lucide-react v0.542.0 - ISC
|
|
199
|
+
*
|
|
200
|
+
* This source code is licensed under the ISC license.
|
|
201
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
+
*/
|
|
203
|
+
const __iconNode$w = [
|
|
204
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
205
|
+
["circle", { cx: "12", cy: "12", r: "1", key: "41hilf" }]
|
|
206
|
+
];
|
|
207
|
+
const CircleDot = createLucideIcon("circle-dot", __iconNode$w);
|
|
208
|
+
/**
|
|
209
|
+
* @license lucide-react v0.542.0 - ISC
|
|
210
|
+
*
|
|
211
|
+
* This source code is licensed under the ISC license.
|
|
212
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
213
|
+
*/
|
|
214
|
+
const __iconNode$v = [
|
|
215
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
216
|
+
["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
|
|
217
|
+
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
218
|
+
];
|
|
219
|
+
const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$v);
|
|
220
|
+
/**
|
|
221
|
+
* @license lucide-react v0.542.0 - ISC
|
|
222
|
+
*
|
|
223
|
+
* This source code is licensed under the ISC license.
|
|
224
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
+
*/
|
|
226
|
+
const __iconNode$u = [
|
|
227
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
228
|
+
["path", { d: "m15 9-6 6", key: "1uzhvr" }],
|
|
229
|
+
["path", { d: "m9 9 6 6", key: "z0biqf" }]
|
|
230
|
+
];
|
|
231
|
+
const CircleX = createLucideIcon("circle-x", __iconNode$u);
|
|
232
|
+
/**
|
|
233
|
+
* @license lucide-react v0.542.0 - ISC
|
|
234
|
+
*
|
|
235
|
+
* This source code is licensed under the ISC license.
|
|
236
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
237
|
+
*/
|
|
238
|
+
const __iconNode$t = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]];
|
|
239
|
+
const Circle = createLucideIcon("circle", __iconNode$t);
|
|
240
|
+
/**
|
|
241
|
+
* @license lucide-react v0.542.0 - ISC
|
|
242
|
+
*
|
|
243
|
+
* This source code is licensed under the ISC license.
|
|
244
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
+
*/
|
|
246
|
+
const __iconNode$s = [
|
|
247
|
+
["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
|
|
248
|
+
[
|
|
249
|
+
"path",
|
|
250
|
+
{
|
|
251
|
+
d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
|
|
252
|
+
key: "116196"
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
["path", { d: "M12 11h4", key: "1jrz19" }],
|
|
256
|
+
["path", { d: "M12 16h4", key: "n85exb" }],
|
|
257
|
+
["path", { d: "M8 11h.01", key: "1dfujw" }],
|
|
258
|
+
["path", { d: "M8 16h.01", key: "18s6g9" }]
|
|
259
|
+
];
|
|
260
|
+
const ClipboardList = createLucideIcon("clipboard-list", __iconNode$s);
|
|
261
|
+
/**
|
|
262
|
+
* @license lucide-react v0.542.0 - ISC
|
|
263
|
+
*
|
|
264
|
+
* This source code is licensed under the ISC license.
|
|
265
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
+
*/
|
|
267
|
+
const __iconNode$r = [
|
|
268
|
+
["path", { d: "m12 15 2 2 4-4", key: "2c609p" }],
|
|
269
|
+
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
270
|
+
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
271
|
+
];
|
|
272
|
+
const CopyCheck = createLucideIcon("copy-check", __iconNode$r);
|
|
273
|
+
/**
|
|
274
|
+
* @license lucide-react v0.542.0 - ISC
|
|
275
|
+
*
|
|
276
|
+
* This source code is licensed under the ISC license.
|
|
277
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
278
|
+
*/
|
|
279
|
+
const __iconNode$q = [
|
|
280
|
+
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
281
|
+
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
282
|
+
];
|
|
283
|
+
const Copy = createLucideIcon("copy", __iconNode$q);
|
|
284
|
+
/**
|
|
285
|
+
* @license lucide-react v0.542.0 - ISC
|
|
286
|
+
*
|
|
287
|
+
* This source code is licensed under the ISC license.
|
|
288
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
289
|
+
*/
|
|
290
|
+
const __iconNode$p = [
|
|
291
|
+
["path", { d: "M12 15V3", key: "m9g1x1" }],
|
|
292
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
293
|
+
["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
|
|
294
|
+
];
|
|
295
|
+
const Download = createLucideIcon("download", __iconNode$p);
|
|
296
|
+
/**
|
|
297
|
+
* @license lucide-react v0.542.0 - ISC
|
|
298
|
+
*
|
|
299
|
+
* This source code is licensed under the ISC license.
|
|
300
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
301
|
+
*/
|
|
302
|
+
const __iconNode$o = [
|
|
303
|
+
["path", { d: "M12 17h.01", key: "p32p05" }],
|
|
304
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z", key: "1mlx9k" }],
|
|
305
|
+
["path", { d: "M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3", key: "mhlwft" }]
|
|
306
|
+
];
|
|
307
|
+
const FileQuestionMark = createLucideIcon("file-question-mark", __iconNode$o);
|
|
308
|
+
/**
|
|
309
|
+
* @license lucide-react v0.542.0 - ISC
|
|
310
|
+
*
|
|
311
|
+
* This source code is licensed under the ISC license.
|
|
312
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
313
|
+
*/
|
|
314
|
+
const __iconNode$n = [
|
|
315
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
316
|
+
["path", { d: "M12 9v4", key: "juzpu7" }],
|
|
317
|
+
["path", { d: "M12 17h.01", key: "p32p05" }]
|
|
318
|
+
];
|
|
319
|
+
const FileWarning = createLucideIcon("file-warning", __iconNode$n);
|
|
320
|
+
/**
|
|
321
|
+
* @license lucide-react v0.542.0 - ISC
|
|
322
|
+
*
|
|
323
|
+
* This source code is licensed under the ISC license.
|
|
324
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
+
*/
|
|
326
|
+
const __iconNode$m = [
|
|
327
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
328
|
+
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }]
|
|
329
|
+
];
|
|
330
|
+
const File$1 = createLucideIcon("file", __iconNode$m);
|
|
331
|
+
/**
|
|
332
|
+
* @license lucide-react v0.542.0 - ISC
|
|
333
|
+
*
|
|
334
|
+
* This source code is licensed under the ISC license.
|
|
335
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
336
|
+
*/
|
|
337
|
+
const __iconNode$l = [
|
|
338
|
+
["line", { x1: "6", x2: "6", y1: "3", y2: "15", key: "17qcm7" }],
|
|
339
|
+
["circle", { cx: "18", cy: "6", r: "3", key: "1h7g24" }],
|
|
340
|
+
["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
|
|
341
|
+
["path", { d: "M18 9a9 9 0 0 1-9 9", key: "n2h4wq" }]
|
|
342
|
+
];
|
|
343
|
+
const GitBranch = createLucideIcon("git-branch", __iconNode$l);
|
|
344
|
+
/**
|
|
345
|
+
* @license lucide-react v0.542.0 - ISC
|
|
346
|
+
*
|
|
347
|
+
* This source code is licensed under the ISC license.
|
|
348
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
349
|
+
*/
|
|
350
|
+
const __iconNode$k = [
|
|
351
|
+
["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "4lhtct" }],
|
|
352
|
+
["line", { x1: "4", x2: "20", y1: "15", y2: "15", key: "vyu0kd" }],
|
|
353
|
+
["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
|
|
354
|
+
["line", { x1: "16", x2: "14", y1: "3", y2: "21", key: "weycgp" }]
|
|
355
|
+
];
|
|
356
|
+
const Hash = createLucideIcon("hash", __iconNode$k);
|
|
357
|
+
/**
|
|
358
|
+
* @license lucide-react v0.542.0 - ISC
|
|
359
|
+
*
|
|
360
|
+
* This source code is licensed under the ISC license.
|
|
361
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
362
|
+
*/
|
|
363
|
+
const __iconNode$j = [
|
|
364
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
365
|
+
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
366
|
+
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
367
|
+
];
|
|
368
|
+
const Image = createLucideIcon("image", __iconNode$j);
|
|
369
|
+
/**
|
|
370
|
+
* @license lucide-react v0.542.0 - ISC
|
|
371
|
+
*
|
|
372
|
+
* This source code is licensed under the ISC license.
|
|
373
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
374
|
+
*/
|
|
375
|
+
const __iconNode$i = [
|
|
376
|
+
["rect", { width: "18", height: "7", x: "3", y: "3", rx: "1", key: "f1a2em" }],
|
|
377
|
+
["rect", { width: "7", height: "7", x: "3", y: "14", rx: "1", key: "1bb6yr" }],
|
|
378
|
+
["rect", { width: "7", height: "7", x: "14", y: "14", rx: "1", key: "nxv5o0" }]
|
|
379
|
+
];
|
|
380
|
+
const LayoutPanelTop = createLucideIcon("layout-panel-top", __iconNode$i);
|
|
381
|
+
/**
|
|
382
|
+
* @license lucide-react v0.542.0 - ISC
|
|
383
|
+
*
|
|
384
|
+
* This source code is licensed under the ISC license.
|
|
385
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
386
|
+
*/
|
|
387
|
+
const __iconNode$h = [
|
|
388
|
+
["path", { d: "m3 17 2 2 4-4", key: "1jhpwq" }],
|
|
389
|
+
["path", { d: "m3 7 2 2 4-4", key: "1obspn" }],
|
|
390
|
+
["path", { d: "M13 6h8", key: "15sg57" }],
|
|
391
|
+
["path", { d: "M13 12h8", key: "h98zly" }],
|
|
392
|
+
["path", { d: "M13 18h8", key: "oe0vm4" }]
|
|
393
|
+
];
|
|
394
|
+
const ListChecks = createLucideIcon("list-checks", __iconNode$h);
|
|
395
|
+
/**
|
|
396
|
+
* @license lucide-react v0.542.0 - ISC
|
|
397
|
+
*
|
|
398
|
+
* This source code is licensed under the ISC license.
|
|
399
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
+
*/
|
|
401
|
+
const __iconNode$g = [
|
|
402
|
+
["rect", { x: "3", y: "5", width: "6", height: "6", rx: "1", key: "1defrl" }],
|
|
403
|
+
["path", { d: "m3 17 2 2 4-4", key: "1jhpwq" }],
|
|
404
|
+
["path", { d: "M13 6h8", key: "15sg57" }],
|
|
405
|
+
["path", { d: "M13 12h8", key: "h98zly" }],
|
|
406
|
+
["path", { d: "M13 18h8", key: "oe0vm4" }]
|
|
407
|
+
];
|
|
408
|
+
const ListTodo = createLucideIcon("list-todo", __iconNode$g);
|
|
409
|
+
/**
|
|
410
|
+
* @license lucide-react v0.542.0 - ISC
|
|
411
|
+
*
|
|
412
|
+
* This source code is licensed under the ISC license.
|
|
413
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
414
|
+
*/
|
|
415
|
+
const __iconNode$f = [
|
|
416
|
+
["path", { d: "M3 12h.01", key: "nlz23k" }],
|
|
417
|
+
["path", { d: "M3 18h.01", key: "1tta3j" }],
|
|
418
|
+
["path", { d: "M3 6h.01", key: "1rqtza" }],
|
|
419
|
+
["path", { d: "M8 12h13", key: "1za7za" }],
|
|
420
|
+
["path", { d: "M8 18h13", key: "1lx6n3" }],
|
|
421
|
+
["path", { d: "M8 6h13", key: "ik3vkj" }]
|
|
422
|
+
];
|
|
423
|
+
const List = createLucideIcon("list", __iconNode$f);
|
|
424
|
+
/**
|
|
425
|
+
* @license lucide-react v0.542.0 - ISC
|
|
426
|
+
*
|
|
427
|
+
* This source code is licensed under the ISC license.
|
|
428
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
429
|
+
*/
|
|
430
|
+
const __iconNode$e = [
|
|
431
|
+
["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
|
|
432
|
+
["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
|
|
433
|
+
["path", { d: "M3 16v3a2 2 0 0 0 2 2h3", key: "wsl5sc" }],
|
|
434
|
+
["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3", key: "18trek" }]
|
|
435
|
+
];
|
|
436
|
+
const Maximize = createLucideIcon("maximize", __iconNode$e);
|
|
437
|
+
/**
|
|
438
|
+
* @license lucide-react v0.542.0 - ISC
|
|
439
|
+
*
|
|
440
|
+
* This source code is licensed under the ISC license.
|
|
441
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
442
|
+
*/
|
|
443
|
+
const __iconNode$d = [["path", { d: "M5 12h14", key: "1ays0h" }]];
|
|
444
|
+
const Minus = createLucideIcon("minus", __iconNode$d);
|
|
445
|
+
/**
|
|
446
|
+
* @license lucide-react v0.542.0 - ISC
|
|
447
|
+
*
|
|
448
|
+
* This source code is licensed under the ISC license.
|
|
449
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
450
|
+
*/
|
|
451
|
+
const __iconNode$c = [
|
|
452
|
+
["path", { d: "M8 18L12 22L16 18", key: "cskvfv" }],
|
|
453
|
+
["path", { d: "M12 2V22", key: "r89rzk" }]
|
|
454
|
+
];
|
|
455
|
+
const MoveDown = createLucideIcon("move-down", __iconNode$c);
|
|
456
|
+
/**
|
|
457
|
+
* @license lucide-react v0.542.0 - ISC
|
|
458
|
+
*
|
|
459
|
+
* This source code is licensed under the ISC license.
|
|
460
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
461
|
+
*/
|
|
462
|
+
const __iconNode$b = [
|
|
463
|
+
["path", { d: "M8 6L12 2L16 6", key: "1yvkyx" }],
|
|
464
|
+
["path", { d: "M12 2V22", key: "r89rzk" }]
|
|
465
|
+
];
|
|
466
|
+
const MoveUp = createLucideIcon("move-up", __iconNode$b);
|
|
467
|
+
/**
|
|
468
|
+
* @license lucide-react v0.542.0 - ISC
|
|
469
|
+
*
|
|
470
|
+
* This source code is licensed under the ISC license.
|
|
471
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
472
|
+
*/
|
|
473
|
+
const __iconNode$a = [
|
|
474
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
475
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
476
|
+
];
|
|
477
|
+
const Plus = createLucideIcon("plus", __iconNode$a);
|
|
478
|
+
/**
|
|
479
|
+
* @license lucide-react v0.542.0 - ISC
|
|
480
|
+
*
|
|
481
|
+
* This source code is licensed under the ISC license.
|
|
482
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
483
|
+
*/
|
|
484
|
+
const __iconNode$9 = [
|
|
485
|
+
["rect", { width: "20", height: "12", x: "2", y: "6", rx: "2", key: "9lu3g6" }],
|
|
486
|
+
["path", { d: "M12 12h.01", key: "1mp3jc" }],
|
|
487
|
+
["path", { d: "M17 12h.01", key: "1m0b6t" }],
|
|
488
|
+
["path", { d: "M7 12h.01", key: "eqddd0" }]
|
|
489
|
+
];
|
|
490
|
+
const RectangleEllipsis = createLucideIcon("rectangle-ellipsis", __iconNode$9);
|
|
491
|
+
/**
|
|
492
|
+
* @license lucide-react v0.542.0 - ISC
|
|
493
|
+
*
|
|
494
|
+
* This source code is licensed under the ISC license.
|
|
495
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
496
|
+
*/
|
|
497
|
+
const __iconNode$8 = [
|
|
498
|
+
["path", { d: "M3 7V5a2 2 0 0 1 2-2h2", key: "aa7l1z" }],
|
|
499
|
+
["path", { d: "M17 3h2a2 2 0 0 1 2 2v2", key: "4qcy5o" }],
|
|
500
|
+
["path", { d: "M21 17v2a2 2 0 0 1-2 2h-2", key: "6vwrx8" }],
|
|
501
|
+
["path", { d: "M7 21H5a2 2 0 0 1-2-2v-2", key: "ioqczr" }]
|
|
502
|
+
];
|
|
503
|
+
const Scan = createLucideIcon("scan", __iconNode$8);
|
|
504
|
+
/**
|
|
505
|
+
* @license lucide-react v0.542.0 - ISC
|
|
506
|
+
*
|
|
507
|
+
* This source code is licensed under the ISC license.
|
|
508
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
509
|
+
*/
|
|
510
|
+
const __iconNode$7 = [
|
|
511
|
+
[
|
|
512
|
+
"path",
|
|
513
|
+
{
|
|
514
|
+
d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
|
|
515
|
+
key: "1i5ecw"
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
519
|
+
];
|
|
520
|
+
const Settings = createLucideIcon("settings", __iconNode$7);
|
|
521
|
+
/**
|
|
522
|
+
* @license lucide-react v0.542.0 - ISC
|
|
523
|
+
*
|
|
524
|
+
* This source code is licensed under the ISC license.
|
|
525
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
526
|
+
*/
|
|
527
|
+
const __iconNode$6 = [
|
|
528
|
+
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
529
|
+
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
530
|
+
];
|
|
531
|
+
const SquareCheck = createLucideIcon("square-check", __iconNode$6);
|
|
532
|
+
/**
|
|
533
|
+
* @license lucide-react v0.542.0 - ISC
|
|
534
|
+
*
|
|
535
|
+
* This source code is licensed under the ISC license.
|
|
536
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
537
|
+
*/
|
|
538
|
+
const __iconNode$5 = [
|
|
539
|
+
["path", { d: "M5 3a2 2 0 0 0-2 2", key: "y57alp" }],
|
|
540
|
+
["path", { d: "M19 3a2 2 0 0 1 2 2", key: "18rm91" }],
|
|
541
|
+
["path", { d: "M21 19a2 2 0 0 1-2 2", key: "1j7049" }],
|
|
542
|
+
["path", { d: "M5 21a2 2 0 0 1-2-2", key: "sbafld" }],
|
|
543
|
+
["path", { d: "M9 3h1", key: "1yesri" }],
|
|
544
|
+
["path", { d: "M9 21h1", key: "15o7lz" }],
|
|
545
|
+
["path", { d: "M14 3h1", key: "1ec4yj" }],
|
|
546
|
+
["path", { d: "M14 21h1", key: "v9vybs" }],
|
|
547
|
+
["path", { d: "M3 9v1", key: "1r0deq" }],
|
|
548
|
+
["path", { d: "M21 9v1", key: "mxsmne" }],
|
|
549
|
+
["path", { d: "M3 14v1", key: "vnatye" }],
|
|
550
|
+
["path", { d: "M21 14v1", key: "169vum" }]
|
|
551
|
+
];
|
|
552
|
+
const SquareDashed = createLucideIcon("square-dashed", __iconNode$5);
|
|
553
|
+
/**
|
|
554
|
+
* @license lucide-react v0.542.0 - ISC
|
|
555
|
+
*
|
|
556
|
+
* This source code is licensed under the ISC license.
|
|
557
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
558
|
+
*/
|
|
559
|
+
const __iconNode$4 = [
|
|
560
|
+
[
|
|
561
|
+
"path",
|
|
562
|
+
{
|
|
563
|
+
d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",
|
|
564
|
+
key: "r04s7s"
|
|
565
|
+
}
|
|
566
|
+
]
|
|
567
|
+
];
|
|
568
|
+
const Star = createLucideIcon("star", __iconNode$4);
|
|
569
|
+
/**
|
|
570
|
+
* @license lucide-react v0.542.0 - ISC
|
|
571
|
+
*
|
|
572
|
+
* This source code is licensed under the ISC license.
|
|
573
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
574
|
+
*/
|
|
575
|
+
const __iconNode$3 = [
|
|
576
|
+
["path", { d: "M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6", key: "1528k5" }],
|
|
577
|
+
["path", { d: "M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7", key: "13ksps" }],
|
|
578
|
+
["path", { d: "M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1", key: "1n9rhb" }],
|
|
579
|
+
["path", { d: "M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1", key: "1mj8rg" }],
|
|
580
|
+
["path", { d: "M9 6v12", key: "velyjx" }]
|
|
581
|
+
];
|
|
582
|
+
const TextCursorInput = createLucideIcon("text-cursor-input", __iconNode$3);
|
|
583
|
+
/**
|
|
584
|
+
* @license lucide-react v0.542.0 - ISC
|
|
585
|
+
*
|
|
586
|
+
* This source code is licensed under the ISC license.
|
|
587
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
588
|
+
*/
|
|
589
|
+
const __iconNode$2 = [
|
|
590
|
+
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
591
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
592
|
+
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
593
|
+
];
|
|
594
|
+
const Trash = createLucideIcon("trash", __iconNode$2);
|
|
595
|
+
/**
|
|
596
|
+
* @license lucide-react v0.542.0 - ISC
|
|
597
|
+
*
|
|
598
|
+
* This source code is licensed under the ISC license.
|
|
599
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
600
|
+
*/
|
|
601
|
+
const __iconNode$1 = [
|
|
602
|
+
["path", { d: "M12 3v12", key: "1x0j5s" }],
|
|
603
|
+
["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
|
|
604
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
|
|
605
|
+
];
|
|
606
|
+
const Upload = createLucideIcon("upload", __iconNode$1);
|
|
607
|
+
/**
|
|
608
|
+
* @license lucide-react v0.542.0 - ISC
|
|
609
|
+
*
|
|
610
|
+
* This source code is licensed under the ISC license.
|
|
611
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
612
|
+
*/
|
|
613
|
+
const __iconNode = [
|
|
614
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
615
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
616
|
+
];
|
|
617
|
+
const X = createLucideIcon("x", __iconNode);
|
|
20
618
|
const FileCard = memo(
|
|
21
619
|
forwardRef((props, ref) => {
|
|
22
620
|
const { file, className, error, rightSlot, ...rest } = props;
|
|
23
621
|
return /* @__PURE__ */ jsxs(Card, { className: cx(className, "flex w-full items-center gap-2 text-sm"), ref, ...rest, children: [
|
|
24
|
-
error ? /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
622
|
+
error ? /* @__PURE__ */ jsx(LuIcon, { icon: FileQuestionMark }) : /* @__PURE__ */ jsx(LuIcon, { icon: File$1, color: "var(--base-a11)" }),
|
|
25
623
|
!error ? file ? /* @__PURE__ */ jsx(Text, { className: "truncate", children: file.name }) : /* @__PURE__ */ jsx("div", { className: "flex w-full justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(Text, { accentColor: "danger", className: "truncate", children: error }),
|
|
26
624
|
rightSlot
|
|
27
625
|
] });
|
|
@@ -79,12 +677,11 @@ class BaseFormElement extends Observable {
|
|
|
79
677
|
}
|
|
80
678
|
class BaseField extends BaseFormElement {
|
|
81
679
|
constructor(options) {
|
|
82
|
-
const { label, description = null, required, image,
|
|
680
|
+
const { label, description = null, required, image, ...base } = options;
|
|
83
681
|
super(base);
|
|
84
682
|
__publicField(this, "label");
|
|
85
683
|
__publicField(this, "description");
|
|
86
684
|
__publicField(this, "required");
|
|
87
|
-
__publicField(this, "fieldValidators");
|
|
88
685
|
__publicField(this, "image");
|
|
89
686
|
/**
|
|
90
687
|
* By default, validation doesn't execute on `onChange` events when editing fields
|
|
@@ -97,7 +694,6 @@ class BaseField extends BaseFormElement {
|
|
|
97
694
|
this.description = description;
|
|
98
695
|
this.required = required;
|
|
99
696
|
this.image = image;
|
|
100
|
-
this.fieldValidators = fieldValidators;
|
|
101
697
|
}
|
|
102
698
|
getError(value) {
|
|
103
699
|
if (this.required && this.isValueBlank(value)) {
|
|
@@ -123,24 +719,22 @@ class BaseField extends BaseFormElement {
|
|
|
123
719
|
label: this.label,
|
|
124
720
|
description: this.description,
|
|
125
721
|
required: this.required,
|
|
126
|
-
image: this.image
|
|
127
|
-
fieldValidators: this.fieldValidators
|
|
722
|
+
image: this.image
|
|
128
723
|
};
|
|
129
724
|
}
|
|
130
725
|
setOptions(options) {
|
|
131
|
-
const { label, description = null, required, image,
|
|
726
|
+
const { label, description = null, required, image, ...base } = options;
|
|
132
727
|
this.label = label ?? this.label;
|
|
133
728
|
this.description = description ?? this.description;
|
|
134
729
|
this.required = required ?? this.required;
|
|
135
730
|
this.image = image ?? this.image;
|
|
136
|
-
this.fieldValidators = fieldValidators ?? this.fieldValidators;
|
|
137
731
|
super.setOptions(base);
|
|
138
732
|
}
|
|
139
733
|
isValueBlank(value) {
|
|
140
734
|
return this.areValuesEqual(value, this.blankValue());
|
|
141
735
|
}
|
|
142
736
|
getFieldValidators() {
|
|
143
|
-
return [
|
|
737
|
+
return [];
|
|
144
738
|
}
|
|
145
739
|
}
|
|
146
740
|
__publicField(BaseField, "fieldTypeName");
|
|
@@ -184,15 +778,15 @@ const ImageViewer = memo((props) => {
|
|
|
184
778
|
variant: "ghost",
|
|
185
779
|
children: [
|
|
186
780
|
/* @__PURE__ */ jsxs(Tooltip.Root, { children: [
|
|
187
|
-
/* @__PURE__ */ jsx(Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleCopy, "aria-label": "copy to clipboard", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
781
|
+
/* @__PURE__ */ jsx(Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleCopy, "aria-label": "copy to clipboard", children: /* @__PURE__ */ jsx(LuIcon, { icon: Copy }) }) }),
|
|
188
782
|
/* @__PURE__ */ jsx(Tooltip.Content, { size: "sm", children: "Copy" })
|
|
189
783
|
] }),
|
|
190
784
|
/* @__PURE__ */ jsxs(Tooltip.Root, { children: [
|
|
191
|
-
/* @__PURE__ */ jsx(Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleDownload, "aria-label": "download", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
785
|
+
/* @__PURE__ */ jsx(Tooltip.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleDownload, "aria-label": "download", children: /* @__PURE__ */ jsx(LuIcon, { icon: Download }) }) }),
|
|
192
786
|
/* @__PURE__ */ jsx(Tooltip.Content, { size: "sm", children: "Download" })
|
|
193
787
|
] }),
|
|
194
788
|
/* @__PURE__ */ jsx(Separator, { orientation: "vertical", size: "sm" }),
|
|
195
|
-
/* @__PURE__ */ jsx(Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: onClose, "aria-label": "close", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
789
|
+
/* @__PURE__ */ jsx(Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { onClick: onClose, "aria-label": "close", children: /* @__PURE__ */ jsx(LuIcon, { icon: X }) }) })
|
|
196
790
|
]
|
|
197
791
|
}
|
|
198
792
|
),
|
|
@@ -231,7 +825,7 @@ const ImageViewerProvider = memo((props) => {
|
|
|
231
825
|
] });
|
|
232
826
|
});
|
|
233
827
|
ImageViewerProvider.displayName = "FileViewerProvider";
|
|
234
|
-
const InputWithLabel = (props) => {
|
|
828
|
+
const InputWithLabel = memo((props) => {
|
|
235
829
|
const { className, label, children, severity, inputId, labelId, image } = props;
|
|
236
830
|
const [resolvedImage, setResolvedImage] = useState(void 0);
|
|
237
831
|
const openImageViewer = useImageViewer();
|
|
@@ -263,7 +857,7 @@ const InputWithLabel = (props) => {
|
|
|
263
857
|
!!label && /* @__PURE__ */ jsx("label", { className: cx(className, "w-max max-w-full"), htmlFor: inputId, children: /* @__PURE__ */ jsx(Text, { accentColor: color, size: "sm", id: labelId, className: "text-wrap", children: label }) }),
|
|
264
858
|
children
|
|
265
859
|
] });
|
|
266
|
-
};
|
|
860
|
+
});
|
|
267
861
|
const InputWithLabelAndHelpText = (props) => {
|
|
268
862
|
const { children, ...restProps } = props;
|
|
269
863
|
return /* @__PURE__ */ jsx(InputWithHelpText, { ...restProps, children });
|
|
@@ -290,14 +884,14 @@ const useFormikInput = (props) => {
|
|
|
290
884
|
const label = field.required ? `${field.label} *` : field.label;
|
|
291
885
|
const fieldPropsWithValidation = useMemo(() => {
|
|
292
886
|
const handleChange = (value) => {
|
|
293
|
-
helpers.setValue(value, false)
|
|
887
|
+
void helpers.setValue(value, false);
|
|
294
888
|
onValuesChange == null ? void 0 : onValuesChange(field.identifier, value);
|
|
295
889
|
if (touched || !field.onlyValidateAfterTouched) {
|
|
296
890
|
helpers.setError(field.getError(value));
|
|
297
891
|
}
|
|
298
892
|
};
|
|
299
893
|
const handleBlur = (value) => {
|
|
300
|
-
void helpers.setTouched(true, false)
|
|
894
|
+
void helpers.setTouched(true, false);
|
|
301
895
|
helpers.setError(field.getError(value));
|
|
302
896
|
};
|
|
303
897
|
return {
|
|
@@ -430,7 +1024,7 @@ const MultiStringInput = memo((props) => {
|
|
|
430
1024
|
"aria-label": "Add option",
|
|
431
1025
|
disabled: !!internalError || disabled,
|
|
432
1026
|
onClick: addOption,
|
|
433
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1027
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Plus })
|
|
434
1028
|
}
|
|
435
1029
|
)
|
|
436
1030
|
] })
|
|
@@ -477,7 +1071,7 @@ const MultiStringInput = memo((props) => {
|
|
|
477
1071
|
onClick: () => {
|
|
478
1072
|
handleDeleteOption(index);
|
|
479
1073
|
},
|
|
480
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1074
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: X })
|
|
481
1075
|
}
|
|
482
1076
|
)
|
|
483
1077
|
]
|
|
@@ -665,7 +1259,7 @@ const BooleanInput = memo((props) => {
|
|
|
665
1259
|
accentColor: "primary",
|
|
666
1260
|
variant: "surface",
|
|
667
1261
|
disabled,
|
|
668
|
-
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1262
|
+
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) })
|
|
669
1263
|
}
|
|
670
1264
|
)
|
|
671
1265
|
}
|
|
@@ -694,7 +1288,6 @@ const _BooleanField = class _BooleanField extends BaseField {
|
|
|
694
1288
|
});
|
|
695
1289
|
}
|
|
696
1290
|
static deserialize(data) {
|
|
697
|
-
if (data.type !== "boolean") throw new Error("Type mismatch.");
|
|
698
1291
|
return new _BooleanField(data);
|
|
699
1292
|
}
|
|
700
1293
|
serializeValue(value) {
|
|
@@ -807,8 +1400,7 @@ const _NumberField = class _NumberField extends BaseField {
|
|
|
807
1400
|
description: "Minimum value",
|
|
808
1401
|
integers: true,
|
|
809
1402
|
required: false,
|
|
810
|
-
identifier: `${path}minimum
|
|
811
|
-
fieldValidators: []
|
|
1403
|
+
identifier: `${path}minimum`
|
|
812
1404
|
}),
|
|
813
1405
|
showDirectly: false
|
|
814
1406
|
},
|
|
@@ -818,8 +1410,7 @@ const _NumberField = class _NumberField extends BaseField {
|
|
|
818
1410
|
description: "Maximum value",
|
|
819
1411
|
integers: true,
|
|
820
1412
|
required: false,
|
|
821
|
-
identifier: `${path}maximum
|
|
822
|
-
fieldValidators: []
|
|
1413
|
+
identifier: `${path}maximum`
|
|
823
1414
|
}),
|
|
824
1415
|
showDirectly: false
|
|
825
1416
|
},
|
|
@@ -944,7 +1535,6 @@ class BaseStringField extends BaseField {
|
|
|
944
1535
|
identifier: `${path}minimum_length`,
|
|
945
1536
|
minimum: 0,
|
|
946
1537
|
maximum: 100,
|
|
947
|
-
fieldValidators: [],
|
|
948
1538
|
integers: true
|
|
949
1539
|
}),
|
|
950
1540
|
showDirectly: false
|
|
@@ -958,7 +1548,6 @@ class BaseStringField extends BaseField {
|
|
|
958
1548
|
minimum: 1,
|
|
959
1549
|
maximum: LONG_TEXT_FIELD_MAX_LENGTH,
|
|
960
1550
|
// TODO: depends on short vs long text
|
|
961
|
-
fieldValidators: [],
|
|
962
1551
|
// TODO: default: 500 (see: "Short text fields can hold up to 500 characters on a single line.")
|
|
963
1552
|
integers: true
|
|
964
1553
|
}),
|
|
@@ -1061,7 +1650,7 @@ const CheckboxListInput = memo((props) => {
|
|
|
1061
1650
|
onValuesChange: handleChange,
|
|
1062
1651
|
disabled,
|
|
1063
1652
|
children: field.options.map((option, index) => /* @__PURE__ */ jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
1064
|
-
/* @__PURE__ */ jsx(CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1653
|
+
/* @__PURE__ */ jsx(CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) }) }),
|
|
1065
1654
|
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
|
|
1066
1655
|
] }, `${inputId}-${option.value}-${index}`))
|
|
1067
1656
|
}
|
|
@@ -1163,7 +1752,7 @@ const DateInput = memo((props) => {
|
|
|
1163
1752
|
month: "2-digit",
|
|
1164
1753
|
day: "2-digit"
|
|
1165
1754
|
}) : "yyyy-mm-dd",
|
|
1166
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1755
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: ChevronDown })
|
|
1167
1756
|
]
|
|
1168
1757
|
}
|
|
1169
1758
|
) }),
|
|
@@ -1274,13 +1863,13 @@ const MultiSelectInput = memo((props) => {
|
|
|
1274
1863
|
disabled,
|
|
1275
1864
|
children: [
|
|
1276
1865
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: value && value.length > 0 ? value.join(", ") : field.placeholder ?? "Select one or more..." }),
|
|
1277
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1866
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: ChevronDown })
|
|
1278
1867
|
]
|
|
1279
1868
|
}
|
|
1280
1869
|
) }),
|
|
1281
1870
|
/* @__PURE__ */ jsx(Menu.Content, { children: /* @__PURE__ */ jsx(Menu.Scroll, { children: /* @__PURE__ */ jsxs(Menu.MultiSelectGroup, { values: value, onValuesChange: handleChange, children: [
|
|
1282
1871
|
/* @__PURE__ */ jsxs(Menu.SelectAllItem, { children: [
|
|
1283
|
-
/* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1872
|
+
/* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon: Minus }) : /* @__PURE__ */ jsx(LuIcon, { icon: Check }) }),
|
|
1284
1873
|
"Select all"
|
|
1285
1874
|
] }),
|
|
1286
1875
|
field.options.map((option, index) => /* @__PURE__ */ jsxs(
|
|
@@ -1288,7 +1877,7 @@ const MultiSelectInput = memo((props) => {
|
|
|
1288
1877
|
{
|
|
1289
1878
|
value: option.value,
|
|
1290
1879
|
children: [
|
|
1291
|
-
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1880
|
+
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) }),
|
|
1292
1881
|
option.label
|
|
1293
1882
|
]
|
|
1294
1883
|
},
|
|
@@ -1394,12 +1983,12 @@ const SelectInput = memo((props) => {
|
|
|
1394
1983
|
disabled,
|
|
1395
1984
|
children: [
|
|
1396
1985
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: currentOption ? currentOption.label : field.placeholder ?? "Select one..." }),
|
|
1397
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1986
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: ChevronDown })
|
|
1398
1987
|
]
|
|
1399
1988
|
}
|
|
1400
1989
|
) }),
|
|
1401
1990
|
/* @__PURE__ */ jsx(Menu.Content, { children: /* @__PURE__ */ jsx(Menu.Scroll, { children: /* @__PURE__ */ jsx(Menu.SelectGroup, { required: false, value: value ?? void 0, onValueChange: handleChange, children: field.options.map((option, index) => /* @__PURE__ */ jsxs(Menu.SelectItem, { value: option.value, children: [
|
|
1402
|
-
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1991
|
+
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) }),
|
|
1403
1992
|
option.label
|
|
1404
1993
|
] }, `${inputId}-${option.value}-${index}`)) }) }) })
|
|
1405
1994
|
] })
|
|
@@ -1485,17 +2074,10 @@ const OTPInput = memo((props) => {
|
|
|
1485
2074
|
},
|
|
1486
2075
|
[field, helpers, touched]
|
|
1487
2076
|
);
|
|
1488
|
-
const handleBlur = useCallback(
|
|
1489
|
-
(
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
return;
|
|
1493
|
-
}
|
|
1494
|
-
onChange(internalValue);
|
|
1495
|
-
onBlur(internalValue);
|
|
1496
|
-
},
|
|
1497
|
-
[inputUuids, internalValue, onBlur, onChange]
|
|
1498
|
-
);
|
|
2077
|
+
const handleBlur = useCallback(() => {
|
|
2078
|
+
onChange(internalValue);
|
|
2079
|
+
onBlur(internalValue);
|
|
2080
|
+
}, [internalValue, onBlur, onChange]);
|
|
1499
2081
|
return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsx(
|
|
1500
2082
|
InputWithLabel,
|
|
1501
2083
|
{
|
|
@@ -1525,8 +2107,9 @@ const OTPInput = memo((props) => {
|
|
|
1525
2107
|
accentColor: "base",
|
|
1526
2108
|
variant: "surface",
|
|
1527
2109
|
size: "sm",
|
|
2110
|
+
onBlur: handleBlur,
|
|
1528
2111
|
children: [
|
|
1529
|
-
inputUuids.map((inputUuid) => /* @__PURE__ */ jsx(OneTimePasswordField.Input, { id: inputUuid
|
|
2112
|
+
inputUuids.map((inputUuid) => /* @__PURE__ */ jsx(OneTimePasswordField.Input, { id: inputUuid }, inputUuid)),
|
|
1530
2113
|
/* @__PURE__ */ jsx(OneTimePasswordField.HiddenInput, {})
|
|
1531
2114
|
]
|
|
1532
2115
|
}
|
|
@@ -1556,8 +2139,7 @@ const _OTPField = class _OTPField extends BaseField {
|
|
|
1556
2139
|
required: false,
|
|
1557
2140
|
minimum: 1,
|
|
1558
2141
|
maximum: 16,
|
|
1559
|
-
identifier: `${path}length
|
|
1560
|
-
fieldValidators: []
|
|
2142
|
+
identifier: `${path}length`
|
|
1561
2143
|
}),
|
|
1562
2144
|
showDirectly: false
|
|
1563
2145
|
},
|
|
@@ -1593,7 +2175,7 @@ const _OTPField = class _OTPField extends BaseField {
|
|
|
1593
2175
|
const validators = super.getFieldValidators();
|
|
1594
2176
|
const length = this.length;
|
|
1595
2177
|
validators.push((value) => {
|
|
1596
|
-
if (!this.isValueBlank(value) &&
|
|
2178
|
+
if (!this.isValueBlank(value) && value.length != length) {
|
|
1597
2179
|
return `Must be ${length} characters.`;
|
|
1598
2180
|
}
|
|
1599
2181
|
});
|
|
@@ -1653,6 +2235,565 @@ const _OTPField = class _OTPField extends BaseField {
|
|
|
1653
2235
|
__publicField(_OTPField, "fieldTypeName", "OTP");
|
|
1654
2236
|
__publicField(_OTPField, "fieldTypeDescription", "Allows specifying a number within a given range.");
|
|
1655
2237
|
let OTPField = _OTPField;
|
|
2238
|
+
const passFailFieldStatusMapping = {
|
|
2239
|
+
pass: {
|
|
2240
|
+
label: "Pass",
|
|
2241
|
+
icon: CircleCheck
|
|
2242
|
+
},
|
|
2243
|
+
fail: {
|
|
2244
|
+
label: "Fail",
|
|
2245
|
+
icon: CircleX
|
|
2246
|
+
},
|
|
2247
|
+
na: {
|
|
2248
|
+
label: "N/A",
|
|
2249
|
+
icon: CircleQuestionMark
|
|
2250
|
+
}
|
|
2251
|
+
};
|
|
2252
|
+
const passFailFieldStatuses = Object.keys(passFailFieldStatusMapping);
|
|
2253
|
+
class UUIDFile extends File {
|
|
2254
|
+
constructor(uuid, ...args) {
|
|
2255
|
+
super(...args);
|
|
2256
|
+
__publicField(this, "uuid");
|
|
2257
|
+
this.uuid = uuid;
|
|
2258
|
+
}
|
|
2259
|
+
static from(uuid, file) {
|
|
2260
|
+
return new UUIDFile(uuid, [file], file.name, {
|
|
2261
|
+
lastModified: file.lastModified,
|
|
2262
|
+
type: file.type
|
|
2263
|
+
});
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
class UUIDPromise extends Promise {
|
|
2267
|
+
constructor(executor, uuid) {
|
|
2268
|
+
super(executor);
|
|
2269
|
+
__publicField(this, "_uuid");
|
|
2270
|
+
this._uuid = uuid;
|
|
2271
|
+
}
|
|
2272
|
+
get uuid() {
|
|
2273
|
+
return this._uuid;
|
|
2274
|
+
}
|
|
2275
|
+
set uuid(uuid) {
|
|
2276
|
+
this._uuid = uuid;
|
|
2277
|
+
}
|
|
2278
|
+
static from(promise, uuid) {
|
|
2279
|
+
return new UUIDPromise((resolve, reject) => {
|
|
2280
|
+
Promise.resolve(promise).then(resolve).catch(reject);
|
|
2281
|
+
}, uuid);
|
|
2282
|
+
}
|
|
2283
|
+
// oxlint-disable-next-line no-thenable
|
|
2284
|
+
then(onFulfilled, onRejected) {
|
|
2285
|
+
const promise = super.then(onFulfilled, onRejected);
|
|
2286
|
+
promise.uuid = this.uuid;
|
|
2287
|
+
return promise;
|
|
2288
|
+
}
|
|
2289
|
+
catch(onRejected) {
|
|
2290
|
+
const promise = super.catch(onRejected);
|
|
2291
|
+
promise.uuid = this.uuid;
|
|
2292
|
+
return promise;
|
|
2293
|
+
}
|
|
2294
|
+
finally(onFinally) {
|
|
2295
|
+
const promise = super.finally(onFinally);
|
|
2296
|
+
promise.uuid = this.uuid;
|
|
2297
|
+
return promise;
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
function isFileAndPromiseArray(value) {
|
|
2301
|
+
if (!Array.isArray(value)) return false;
|
|
2302
|
+
return value.every((item) => item instanceof UUIDPromise || item instanceof UUIDFile);
|
|
2303
|
+
}
|
|
2304
|
+
function areFileAndPromiseArraysEqual(value1, value2) {
|
|
2305
|
+
if (!value1.every((promise1) => value2.some((promise2) => promise1.uuid === promise2.uuid))) return false;
|
|
2306
|
+
if (!value2.every((promise2) => value1.some((promise1) => promise1.uuid === promise2.uuid))) return false;
|
|
2307
|
+
return true;
|
|
2308
|
+
}
|
|
2309
|
+
const ImageCard = memo(
|
|
2310
|
+
forwardRef((props, forwardedRef) => {
|
|
2311
|
+
const { file, alt, error, rightSlot, className, ...rest } = props;
|
|
2312
|
+
return /* @__PURE__ */ jsxs(
|
|
2313
|
+
Card,
|
|
2314
|
+
{
|
|
2315
|
+
className: cx(className, "relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),
|
|
2316
|
+
ref: forwardedRef,
|
|
2317
|
+
...rest,
|
|
2318
|
+
children: [
|
|
2319
|
+
!file && !error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 grow flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }),
|
|
2320
|
+
!!file && !error && /* @__PURE__ */ jsx(Card, { className: "flex max-w-full grow items-center !p-0 justify-center overflow-hidden bg-clip-padding", children: /* @__PURE__ */ jsx(
|
|
2321
|
+
"img",
|
|
2322
|
+
{
|
|
2323
|
+
className: "max-w-full object-cover",
|
|
2324
|
+
src: URL.createObjectURL(file),
|
|
2325
|
+
alt: alt ?? file.name
|
|
2326
|
+
}
|
|
2327
|
+
) }),
|
|
2328
|
+
(!!file || !!error) && /* @__PURE__ */ jsxs(
|
|
2329
|
+
"div",
|
|
2330
|
+
{
|
|
2331
|
+
className: cx("flex w-full items-center gap-2 self-end", {
|
|
2332
|
+
"bg-transparent": !file
|
|
2333
|
+
}),
|
|
2334
|
+
children: [
|
|
2335
|
+
error ? /* @__PURE__ */ jsx(LuIcon, { icon: FileWarning }) : file && /* @__PURE__ */ jsx(LuIcon, { icon: File$1 }),
|
|
2336
|
+
/* @__PURE__ */ jsx(Text, { className: "truncate", size: "sm", children: error ?? (file == null ? void 0 : file.name) }),
|
|
2337
|
+
rightSlot
|
|
2338
|
+
]
|
|
2339
|
+
}
|
|
2340
|
+
)
|
|
2341
|
+
]
|
|
2342
|
+
}
|
|
2343
|
+
);
|
|
2344
|
+
})
|
|
2345
|
+
);
|
|
2346
|
+
const convertBytesToLargestUnit = (bytes) => {
|
|
2347
|
+
const units = ["byte", "kilobyte", "megabyte"];
|
|
2348
|
+
let sizeInUnit = bytes;
|
|
2349
|
+
let unitIndex = 0;
|
|
2350
|
+
while (sizeInUnit > 1e3 && unitIndex < units.length - 1) {
|
|
2351
|
+
sizeInUnit /= 1e3;
|
|
2352
|
+
unitIndex++;
|
|
2353
|
+
}
|
|
2354
|
+
const formatter = new Intl.NumberFormat([], {
|
|
2355
|
+
// 0 for bytes and kilobytes, 1 for megabytes
|
|
2356
|
+
maximumFractionDigits: Math.max(0, unitIndex - 1),
|
|
2357
|
+
style: "unit",
|
|
2358
|
+
unit: units[unitIndex]
|
|
2359
|
+
});
|
|
2360
|
+
return formatter.format(sizeInUnit);
|
|
2361
|
+
};
|
|
2362
|
+
const DisplayFile = memo((props) => {
|
|
2363
|
+
const { file, onRemove, disabled } = props;
|
|
2364
|
+
const [resolvedFile, setResolvedFile] = useState(null);
|
|
2365
|
+
const [error, setError] = useState(null);
|
|
2366
|
+
const openImageViewer = useImageViewer();
|
|
2367
|
+
const { url, name } = useMemo(() => {
|
|
2368
|
+
let url2 = null;
|
|
2369
|
+
let name2;
|
|
2370
|
+
let size;
|
|
2371
|
+
if (resolvedFile == null ? void 0 : resolvedFile.type.startsWith("image/")) {
|
|
2372
|
+
url2 = URL.createObjectURL(resolvedFile);
|
|
2373
|
+
}
|
|
2374
|
+
if (resolvedFile) {
|
|
2375
|
+
name2 = resolvedFile.name;
|
|
2376
|
+
size = convertBytesToLargestUnit(resolvedFile.size);
|
|
2377
|
+
} else {
|
|
2378
|
+
name2 = "Downloading...";
|
|
2379
|
+
size = "...";
|
|
2380
|
+
}
|
|
2381
|
+
return { url: url2, name: name2, size };
|
|
2382
|
+
}, [resolvedFile]);
|
|
2383
|
+
useEffect(() => {
|
|
2384
|
+
if (file instanceof UUIDPromise) {
|
|
2385
|
+
file.then((file2) => {
|
|
2386
|
+
setResolvedFile(file2);
|
|
2387
|
+
}).catch((err) => {
|
|
2388
|
+
setError(err instanceof Error ? err.message : "Unknown error");
|
|
2389
|
+
});
|
|
2390
|
+
} else {
|
|
2391
|
+
setResolvedFile(file);
|
|
2392
|
+
}
|
|
2393
|
+
}, [file]);
|
|
2394
|
+
const handleDownload = useCallback(
|
|
2395
|
+
(event) => {
|
|
2396
|
+
event.stopPropagation();
|
|
2397
|
+
if (!resolvedFile) {
|
|
2398
|
+
throw new Error("Cannot download a file that is not resolved.");
|
|
2399
|
+
}
|
|
2400
|
+
const blob = new Blob([resolvedFile]);
|
|
2401
|
+
saveAs(blob, name);
|
|
2402
|
+
},
|
|
2403
|
+
[name, resolvedFile]
|
|
2404
|
+
);
|
|
2405
|
+
const handleDelete = useCallback(
|
|
2406
|
+
(e) => {
|
|
2407
|
+
e.stopPropagation();
|
|
2408
|
+
onRemove();
|
|
2409
|
+
},
|
|
2410
|
+
[onRemove]
|
|
2411
|
+
);
|
|
2412
|
+
const handleImageCardClick = useCallback(() => {
|
|
2413
|
+
if (!resolvedFile) return;
|
|
2414
|
+
openImageViewer((closeFileViewer) => ({
|
|
2415
|
+
file: resolvedFile,
|
|
2416
|
+
onDelete: !disabled ? () => {
|
|
2417
|
+
onRemove();
|
|
2418
|
+
closeFileViewer();
|
|
2419
|
+
} : void 0
|
|
2420
|
+
}));
|
|
2421
|
+
}, [disabled, onRemove, openImageViewer, resolvedFile]);
|
|
2422
|
+
const rightSlotContent = useMemo(
|
|
2423
|
+
() => /* @__PURE__ */ jsxs(ButtonGroup, { className: "flex grow justify-end", variant: "ghost", accentColor: "base", size: "sm", children: [
|
|
2424
|
+
/* @__PURE__ */ jsx(
|
|
2425
|
+
IconButton,
|
|
2426
|
+
{
|
|
2427
|
+
"aria-label": `Download ${name}`,
|
|
2428
|
+
type: "button",
|
|
2429
|
+
onClick: handleDownload,
|
|
2430
|
+
disabled: !resolvedFile,
|
|
2431
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Download })
|
|
2432
|
+
}
|
|
2433
|
+
),
|
|
2434
|
+
!disabled && /* @__PURE__ */ jsx(IconButton, { type: "button", "aria-label": `Remove ${name}`, disabled, onClick: handleDelete, children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash }) })
|
|
2435
|
+
] }),
|
|
2436
|
+
[disabled, handleDelete, handleDownload, name, resolvedFile]
|
|
2437
|
+
);
|
|
2438
|
+
return url ? /* @__PURE__ */ jsx(
|
|
2439
|
+
ImageCard,
|
|
2440
|
+
{
|
|
2441
|
+
className: "cursor-pointer",
|
|
2442
|
+
onClick: handleImageCardClick,
|
|
2443
|
+
file: resolvedFile,
|
|
2444
|
+
error: error ?? void 0,
|
|
2445
|
+
rightSlot: rightSlotContent
|
|
2446
|
+
}
|
|
2447
|
+
) : /* @__PURE__ */ jsx(FileCard, { file: resolvedFile, error: error ?? void 0, rightSlot: rightSlotContent });
|
|
2448
|
+
});
|
|
2449
|
+
DisplayFile.displayName = "DisplayFile";
|
|
2450
|
+
const PassFailInput = memo((props) => {
|
|
2451
|
+
const [
|
|
2452
|
+
{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
|
|
2453
|
+
{ disabled }
|
|
2454
|
+
] = useFormikInput(props);
|
|
2455
|
+
const { value, onChange, onBlur, name } = fieldProps;
|
|
2456
|
+
const [internalNotes, setInternalNotes] = useState("");
|
|
2457
|
+
const input = useRef(null);
|
|
2458
|
+
const computedHelpText = showInputOnly ? null : helpText;
|
|
2459
|
+
const computedLabel = showInputOnly ? "" : label;
|
|
2460
|
+
const showNotesAndFiles = value.status && field.showNotesAndFilesOn.includes(value.status);
|
|
2461
|
+
const handleStatusChange = useCallback(
|
|
2462
|
+
(status) => {
|
|
2463
|
+
const newValue = field.cleanValue({
|
|
2464
|
+
...value,
|
|
2465
|
+
status
|
|
2466
|
+
});
|
|
2467
|
+
onChange(newValue);
|
|
2468
|
+
onBlur(newValue);
|
|
2469
|
+
},
|
|
2470
|
+
[field, onBlur, onChange, value]
|
|
2471
|
+
);
|
|
2472
|
+
useEffect(() => {
|
|
2473
|
+
setInternalNotes(value.notes);
|
|
2474
|
+
}, [value]);
|
|
2475
|
+
const handleNotesChange = useCallback(
|
|
2476
|
+
(e) => {
|
|
2477
|
+
const notes = e.target.value;
|
|
2478
|
+
setInternalNotes(notes);
|
|
2479
|
+
if (touched || !field.onlyValidateAfterTouched) {
|
|
2480
|
+
helpers.setError(
|
|
2481
|
+
field.getError({
|
|
2482
|
+
...value,
|
|
2483
|
+
notes: internalNotes
|
|
2484
|
+
})
|
|
2485
|
+
);
|
|
2486
|
+
}
|
|
2487
|
+
},
|
|
2488
|
+
[field, helpers, internalNotes, touched, value]
|
|
2489
|
+
);
|
|
2490
|
+
const handleNotesBlur = useCallback(() => {
|
|
2491
|
+
const newValue = {
|
|
2492
|
+
...value,
|
|
2493
|
+
notes: internalNotes
|
|
2494
|
+
};
|
|
2495
|
+
onChange(newValue);
|
|
2496
|
+
onBlur(newValue);
|
|
2497
|
+
}, [internalNotes, onBlur, onChange, value]);
|
|
2498
|
+
const handleRemoveFile = useCallback(
|
|
2499
|
+
(index) => {
|
|
2500
|
+
const files = [...value.files];
|
|
2501
|
+
void files.splice(index, 1);
|
|
2502
|
+
onChange({
|
|
2503
|
+
...value,
|
|
2504
|
+
files
|
|
2505
|
+
});
|
|
2506
|
+
},
|
|
2507
|
+
[onChange, value]
|
|
2508
|
+
);
|
|
2509
|
+
const handleFileButtonClick = useCallback(() => {
|
|
2510
|
+
var _a2;
|
|
2511
|
+
(_a2 = input.current) == null ? void 0 : _a2.click();
|
|
2512
|
+
}, []);
|
|
2513
|
+
const handleFilesChange = useCallback(
|
|
2514
|
+
(e) => {
|
|
2515
|
+
const files = Array.from(e.target.files ?? []).map((file) => UUIDFile.from(v4(), file));
|
|
2516
|
+
const newValue = {
|
|
2517
|
+
...value,
|
|
2518
|
+
files: [...value.files, ...files]
|
|
2519
|
+
};
|
|
2520
|
+
onChange(newValue);
|
|
2521
|
+
onBlur(newValue);
|
|
2522
|
+
},
|
|
2523
|
+
[onBlur, onChange, value]
|
|
2524
|
+
);
|
|
2525
|
+
useEffect(() => {
|
|
2526
|
+
if (!input.current) return;
|
|
2527
|
+
const abortController = new AbortController();
|
|
2528
|
+
input.current.addEventListener(
|
|
2529
|
+
"cancel",
|
|
2530
|
+
() => {
|
|
2531
|
+
onBlur(value);
|
|
2532
|
+
},
|
|
2533
|
+
{
|
|
2534
|
+
signal: abortController.signal
|
|
2535
|
+
}
|
|
2536
|
+
);
|
|
2537
|
+
return () => {
|
|
2538
|
+
abortController.abort();
|
|
2539
|
+
};
|
|
2540
|
+
}, [onBlur, value]);
|
|
2541
|
+
const statusInputId = `${inputId}-status`;
|
|
2542
|
+
const notesInputId = `${inputId}-notes`;
|
|
2543
|
+
const filesInputId = `${inputId}-files`;
|
|
2544
|
+
return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsx(
|
|
2545
|
+
InputWithLabel,
|
|
2546
|
+
{
|
|
2547
|
+
size,
|
|
2548
|
+
severity,
|
|
2549
|
+
inputId,
|
|
2550
|
+
labelId,
|
|
2551
|
+
label: computedLabel,
|
|
2552
|
+
image: showInputOnly ? void 0 : field.image,
|
|
2553
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
2554
|
+
/* @__PURE__ */ jsx(
|
|
2555
|
+
RadioGroup.Root,
|
|
2556
|
+
{
|
|
2557
|
+
id: statusInputId,
|
|
2558
|
+
className: "flex gap-2",
|
|
2559
|
+
name,
|
|
2560
|
+
value: value.status,
|
|
2561
|
+
disabled,
|
|
2562
|
+
accentColor: "base",
|
|
2563
|
+
variant: "surface",
|
|
2564
|
+
size: "sm",
|
|
2565
|
+
onValueChange: handleStatusChange,
|
|
2566
|
+
children: passFailFieldStatuses.map((status) => {
|
|
2567
|
+
const { label: label2 } = passFailFieldStatusMapping[status];
|
|
2568
|
+
return /* @__PURE__ */ jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
2569
|
+
/* @__PURE__ */ jsx(RadioGroup.Item, { value: status, children: /* @__PURE__ */ jsx(RadioGroup.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Circle, className: "fill-current" }) }) }),
|
|
2570
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: label2 })
|
|
2571
|
+
] }, `${inputId}-${status}`);
|
|
2572
|
+
})
|
|
2573
|
+
}
|
|
2574
|
+
),
|
|
2575
|
+
showNotesAndFiles && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2576
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
2577
|
+
TextArea,
|
|
2578
|
+
{
|
|
2579
|
+
id: notesInputId,
|
|
2580
|
+
value: internalNotes,
|
|
2581
|
+
name,
|
|
2582
|
+
onChange: handleNotesChange,
|
|
2583
|
+
onBlur: handleNotesBlur,
|
|
2584
|
+
className: "field-sizing-content w-full min-h-12",
|
|
2585
|
+
placeholder: "Notes",
|
|
2586
|
+
resize: "vertical",
|
|
2587
|
+
accentColor: "base",
|
|
2588
|
+
variant: "surface",
|
|
2589
|
+
size: "sm",
|
|
2590
|
+
disabled
|
|
2591
|
+
}
|
|
2592
|
+
) }),
|
|
2593
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
2594
|
+
/* @__PURE__ */ jsxs(
|
|
2595
|
+
Button,
|
|
2596
|
+
{
|
|
2597
|
+
className: "w-max",
|
|
2598
|
+
size: "sm",
|
|
2599
|
+
variant: "soft",
|
|
2600
|
+
accentColor: "base",
|
|
2601
|
+
onClick: handleFileButtonClick,
|
|
2602
|
+
type: "button",
|
|
2603
|
+
disabled,
|
|
2604
|
+
children: [
|
|
2605
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Upload }),
|
|
2606
|
+
"Select files"
|
|
2607
|
+
]
|
|
2608
|
+
}
|
|
2609
|
+
),
|
|
2610
|
+
/* @__PURE__ */ jsx(
|
|
2611
|
+
"input",
|
|
2612
|
+
{
|
|
2613
|
+
id: filesInputId,
|
|
2614
|
+
name,
|
|
2615
|
+
type: "file",
|
|
2616
|
+
ref: input,
|
|
2617
|
+
multiple: true,
|
|
2618
|
+
className: "hidden",
|
|
2619
|
+
onChange: handleFilesChange,
|
|
2620
|
+
value: ""
|
|
2621
|
+
}
|
|
2622
|
+
),
|
|
2623
|
+
value.files.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex h-max flex-col gap-2", children: value.files.map((file, index) => /* @__PURE__ */ jsx(
|
|
2624
|
+
DisplayFile,
|
|
2625
|
+
{
|
|
2626
|
+
file,
|
|
2627
|
+
onRemove: () => {
|
|
2628
|
+
handleRemoveFile(index);
|
|
2629
|
+
},
|
|
2630
|
+
disabled
|
|
2631
|
+
},
|
|
2632
|
+
index
|
|
2633
|
+
)) })
|
|
2634
|
+
] })
|
|
2635
|
+
] })
|
|
2636
|
+
] })
|
|
2637
|
+
}
|
|
2638
|
+
) });
|
|
2639
|
+
});
|
|
2640
|
+
PassFailInput.displayName = "PassFailInput";
|
|
2641
|
+
const isPassFailFieldStatus = (value) => {
|
|
2642
|
+
return typeof value === "string" && passFailFieldStatuses.includes(value);
|
|
2643
|
+
};
|
|
2644
|
+
const isSerializedPassFailFieldValue = (value) => {
|
|
2645
|
+
if (value === null || typeof value !== "object") return false;
|
|
2646
|
+
if (!("status" in value) || !isPassFailFieldStatus(value.status)) return false;
|
|
2647
|
+
if (!("notes" in value) || !(typeof value.notes === "string")) return false;
|
|
2648
|
+
if (!("files" in value) || !(Array.isArray(value.files) && value.files.length === 0)) return false;
|
|
2649
|
+
return true;
|
|
2650
|
+
};
|
|
2651
|
+
const isPassFailFieldValue = (value) => {
|
|
2652
|
+
if (value === null || typeof value !== "object") return false;
|
|
2653
|
+
if (!("status" in value) || !isPassFailFieldStatus(value.status)) return false;
|
|
2654
|
+
if (!("notes" in value) || !(typeof value.notes === "string")) return false;
|
|
2655
|
+
if (!("files" in value) || !isFileAndPromiseArray(value.files)) return false;
|
|
2656
|
+
return true;
|
|
2657
|
+
};
|
|
2658
|
+
const serializePassFailFieldValue = (value) => {
|
|
2659
|
+
return {
|
|
2660
|
+
status: value.status,
|
|
2661
|
+
notes: value.notes,
|
|
2662
|
+
files: []
|
|
2663
|
+
};
|
|
2664
|
+
};
|
|
2665
|
+
const deserializePassFailFieldValue = (value) => {
|
|
2666
|
+
return {
|
|
2667
|
+
status: value.status,
|
|
2668
|
+
notes: value.notes,
|
|
2669
|
+
files: []
|
|
2670
|
+
};
|
|
2671
|
+
};
|
|
2672
|
+
const arePassFieldValuesEqual = (value1, value2) => {
|
|
2673
|
+
if (value1.status !== value2.status) return false;
|
|
2674
|
+
if (value1.notes !== value2.notes) return false;
|
|
2675
|
+
if (!areFileAndPromiseArraysEqual(value1.files, value2.files)) return false;
|
|
2676
|
+
return true;
|
|
2677
|
+
};
|
|
2678
|
+
const _PassFailField = class _PassFailField extends BaseField {
|
|
2679
|
+
constructor(options) {
|
|
2680
|
+
const { showNotesAndFilesOn, ...rest } = options;
|
|
2681
|
+
super(rest);
|
|
2682
|
+
__publicField(this, "type", "pass-fail");
|
|
2683
|
+
__publicField(this, "onlyValidateAfterTouched", false);
|
|
2684
|
+
__publicField(this, "showNotesAndFilesOn");
|
|
2685
|
+
this.showNotesAndFilesOn = showNotesAndFilesOn;
|
|
2686
|
+
}
|
|
2687
|
+
static getFieldCreationSchema(parentPath = "") {
|
|
2688
|
+
const path = parentPath && `${parentPath}.`;
|
|
2689
|
+
return [
|
|
2690
|
+
{
|
|
2691
|
+
field: new MultiSelectField({
|
|
2692
|
+
identifier: `${path}showNotesAndFilesOn`,
|
|
2693
|
+
label: "Show notes and files on",
|
|
2694
|
+
description: "Show the notes and files on desired statuses.",
|
|
2695
|
+
options: passFailFieldStatuses.map((status) => {
|
|
2696
|
+
const { label } = passFailFieldStatusMapping[status];
|
|
2697
|
+
return {
|
|
2698
|
+
value: status,
|
|
2699
|
+
label
|
|
2700
|
+
};
|
|
2701
|
+
}),
|
|
2702
|
+
required: false
|
|
2703
|
+
}),
|
|
2704
|
+
showDirectly: false
|
|
2705
|
+
}
|
|
2706
|
+
];
|
|
2707
|
+
}
|
|
2708
|
+
serialize() {
|
|
2709
|
+
return {
|
|
2710
|
+
...super.serialize(),
|
|
2711
|
+
showNotesAndFilesOn: this.showNotesAndFilesOn
|
|
2712
|
+
};
|
|
2713
|
+
}
|
|
2714
|
+
getOptions() {
|
|
2715
|
+
return {
|
|
2716
|
+
...super.getOptions(),
|
|
2717
|
+
showNotesAndFilesOn: this.showNotesAndFilesOn
|
|
2718
|
+
};
|
|
2719
|
+
}
|
|
2720
|
+
duplicate(identifier) {
|
|
2721
|
+
return new _PassFailField({
|
|
2722
|
+
...this.getOptions(),
|
|
2723
|
+
identifier
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
setOptions(options) {
|
|
2727
|
+
const { showNotesAndFilesOn, ...rest } = options;
|
|
2728
|
+
this.showNotesAndFilesOn = showNotesAndFilesOn ?? this.showNotesAndFilesOn;
|
|
2729
|
+
super.setOptions(rest);
|
|
2730
|
+
}
|
|
2731
|
+
getFieldValidators() {
|
|
2732
|
+
const validators = super.getFieldValidators();
|
|
2733
|
+
const showNotesAndFileOn = this.showNotesAndFilesOn;
|
|
2734
|
+
const blankValue = this.blankValue();
|
|
2735
|
+
if (showNotesAndFileOn.length > 0) {
|
|
2736
|
+
validators.push((value) => {
|
|
2737
|
+
if (!value.status || !showNotesAndFileOn.includes(value.status)) return;
|
|
2738
|
+
if (blankValue.notes === value.notes) {
|
|
2739
|
+
return "Notes is required.";
|
|
2740
|
+
}
|
|
2741
|
+
});
|
|
2742
|
+
validators.push((value) => {
|
|
2743
|
+
if (!value.status || !showNotesAndFileOn.includes(value.status)) return;
|
|
2744
|
+
if (areFileAndPromiseArraysEqual(blankValue.files, value.files)) {
|
|
2745
|
+
return "Files is required.";
|
|
2746
|
+
}
|
|
2747
|
+
});
|
|
2748
|
+
}
|
|
2749
|
+
return validators;
|
|
2750
|
+
}
|
|
2751
|
+
static deserialize(data) {
|
|
2752
|
+
return new _PassFailField({
|
|
2753
|
+
...data,
|
|
2754
|
+
showNotesAndFilesOn: data.showNotesAndFilesOn ?? false
|
|
2755
|
+
});
|
|
2756
|
+
}
|
|
2757
|
+
serializeValue(value) {
|
|
2758
|
+
return serializePassFailFieldValue(value);
|
|
2759
|
+
}
|
|
2760
|
+
deserializeValue(value) {
|
|
2761
|
+
return deserializePassFailFieldValue(value);
|
|
2762
|
+
}
|
|
2763
|
+
render(props) {
|
|
2764
|
+
return /* @__PURE__ */ jsx(PassFailInput, { field: this, ...props });
|
|
2765
|
+
}
|
|
2766
|
+
isSerializedValueValid(value) {
|
|
2767
|
+
return isSerializedPassFailFieldValue(value);
|
|
2768
|
+
}
|
|
2769
|
+
isValueValid(value) {
|
|
2770
|
+
return isPassFailFieldValue(value);
|
|
2771
|
+
}
|
|
2772
|
+
areValuesEqual(value1, value2) {
|
|
2773
|
+
return arePassFieldValuesEqual(value1, value2);
|
|
2774
|
+
}
|
|
2775
|
+
blankValue() {
|
|
2776
|
+
return {
|
|
2777
|
+
status: null,
|
|
2778
|
+
notes: "",
|
|
2779
|
+
files: []
|
|
2780
|
+
};
|
|
2781
|
+
}
|
|
2782
|
+
cleanValue(value) {
|
|
2783
|
+
if (value.status && this.showNotesAndFilesOn.includes(value.status)) {
|
|
2784
|
+
return value;
|
|
2785
|
+
} else {
|
|
2786
|
+
return {
|
|
2787
|
+
status: value.status,
|
|
2788
|
+
notes: "",
|
|
2789
|
+
files: []
|
|
2790
|
+
};
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
};
|
|
2794
|
+
__publicField(_PassFailField, "fieldTypeName", "Pass - Fail");
|
|
2795
|
+
__publicField(_PassFailField, "fieldTypeDescription", "Track pass, fail, or N/A outcome.");
|
|
2796
|
+
let PassFailField = _PassFailField;
|
|
1656
2797
|
const RadioInput = memo((props) => {
|
|
1657
2798
|
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1658
2799
|
const { name, onChange, onBlur, value } = fieldProps;
|
|
@@ -1678,68 +2819,207 @@ const RadioInput = memo((props) => {
|
|
|
1678
2819
|
labelId,
|
|
1679
2820
|
label: computedLabel,
|
|
1680
2821
|
image: showInputOnly ? void 0 : field.image,
|
|
1681
|
-
children: /* @__PURE__ */ jsxs(
|
|
1682
|
-
RadioGroup.Root,
|
|
1683
|
-
{
|
|
1684
|
-
id: inputId,
|
|
1685
|
-
name,
|
|
1686
|
-
className: "flex flex-col gap-1",
|
|
1687
|
-
accentColor: "base",
|
|
1688
|
-
variant: "surface",
|
|
1689
|
-
size: "sm",
|
|
1690
|
-
value: value ?? "",
|
|
1691
|
-
onValueChange: handleChange,
|
|
1692
|
-
disabled,
|
|
1693
|
-
children: [
|
|
1694
|
-
field.options.map((option, index) => /* @__PURE__ */ jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
1695
|
-
/* @__PURE__ */ jsx(RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(RadioGroup.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1696
|
-
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
|
|
1697
|
-
] }, `${inputId}-${option.value}-${index}`)),
|
|
1698
|
-
!!value && /* @__PURE__ */ jsxs(
|
|
1699
|
-
Button,
|
|
2822
|
+
children: /* @__PURE__ */ jsxs(
|
|
2823
|
+
RadioGroup.Root,
|
|
2824
|
+
{
|
|
2825
|
+
id: inputId,
|
|
2826
|
+
name,
|
|
2827
|
+
className: "flex flex-col gap-1",
|
|
2828
|
+
accentColor: "base",
|
|
2829
|
+
variant: "surface",
|
|
2830
|
+
size: "sm",
|
|
2831
|
+
value: value ?? "",
|
|
2832
|
+
onValueChange: handleChange,
|
|
2833
|
+
disabled,
|
|
2834
|
+
children: [
|
|
2835
|
+
field.options.map((option, index) => /* @__PURE__ */ jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
2836
|
+
/* @__PURE__ */ jsx(RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(RadioGroup.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Circle, className: "fill-current" }) }) }),
|
|
2837
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
|
|
2838
|
+
] }, `${inputId}-${option.value}-${index}`)),
|
|
2839
|
+
!!value && /* @__PURE__ */ jsxs(
|
|
2840
|
+
Button,
|
|
2841
|
+
{
|
|
2842
|
+
onClick: handleClear,
|
|
2843
|
+
className: "w-max -mx-2",
|
|
2844
|
+
type: "button",
|
|
2845
|
+
variant: "ghost",
|
|
2846
|
+
accentColor: "base",
|
|
2847
|
+
size: "sm",
|
|
2848
|
+
children: [
|
|
2849
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: X }),
|
|
2850
|
+
"Clear"
|
|
2851
|
+
]
|
|
2852
|
+
}
|
|
2853
|
+
)
|
|
2854
|
+
]
|
|
2855
|
+
}
|
|
2856
|
+
)
|
|
2857
|
+
}
|
|
2858
|
+
) });
|
|
2859
|
+
});
|
|
2860
|
+
RadioInput.displayName = "SelectInput";
|
|
2861
|
+
const _RadioField = class _RadioField extends BaseOptionsField {
|
|
2862
|
+
constructor(options) {
|
|
2863
|
+
super(options);
|
|
2864
|
+
__publicField(this, "type", "radio");
|
|
2865
|
+
__publicField(this, "onlyValidateAfterTouched", false);
|
|
2866
|
+
}
|
|
2867
|
+
serialize() {
|
|
2868
|
+
return super.serialize();
|
|
2869
|
+
}
|
|
2870
|
+
getOptions() {
|
|
2871
|
+
return super.getOptions();
|
|
2872
|
+
}
|
|
2873
|
+
duplicate(identifier) {
|
|
2874
|
+
return new _RadioField({
|
|
2875
|
+
...this.getOptions(),
|
|
2876
|
+
identifier
|
|
2877
|
+
});
|
|
2878
|
+
}
|
|
2879
|
+
setOptions(options) {
|
|
2880
|
+
super.setOptions(options);
|
|
2881
|
+
}
|
|
2882
|
+
static deserialize(data) {
|
|
2883
|
+
return new _RadioField(data);
|
|
2884
|
+
}
|
|
2885
|
+
serializeValue(value) {
|
|
2886
|
+
return value;
|
|
2887
|
+
}
|
|
2888
|
+
deserializeValue(value) {
|
|
2889
|
+
return value;
|
|
2890
|
+
}
|
|
2891
|
+
render(props) {
|
|
2892
|
+
return /* @__PURE__ */ jsx(RadioInput, { field: this, ...props });
|
|
2893
|
+
}
|
|
2894
|
+
isSerializedValueValid(value) {
|
|
2895
|
+
return typeof value === "string" || value === "null";
|
|
2896
|
+
}
|
|
2897
|
+
isValueValid(value) {
|
|
2898
|
+
return typeof value === "string" || value === "null";
|
|
2899
|
+
}
|
|
2900
|
+
blankValue() {
|
|
2901
|
+
return null;
|
|
2902
|
+
}
|
|
2903
|
+
areValuesEqual(value1, value2) {
|
|
2904
|
+
return value1 === value2;
|
|
2905
|
+
}
|
|
2906
|
+
};
|
|
2907
|
+
__publicField(_RadioField, "fieldTypeName", "Option list");
|
|
2908
|
+
__publicField(_RadioField, "fieldTypeDescription", "Allows the user to select a single option from a list of options.");
|
|
2909
|
+
let RadioField = _RadioField;
|
|
2910
|
+
const RatingInput = memo((props) => {
|
|
2911
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
2912
|
+
const { name, onChange, onBlur, value } = fieldProps;
|
|
2913
|
+
const computedHelpText = showInputOnly ? null : helpText;
|
|
2914
|
+
const computedLabel = showInputOnly ? "" : label;
|
|
2915
|
+
const handleChange = useCallback(
|
|
2916
|
+
(value2) => {
|
|
2917
|
+
onChange(value2);
|
|
2918
|
+
onBlur(value2);
|
|
2919
|
+
},
|
|
2920
|
+
[onBlur, onChange]
|
|
2921
|
+
);
|
|
2922
|
+
const handleClear = useCallback(() => {
|
|
2923
|
+
onChange(null);
|
|
2924
|
+
onBlur(null);
|
|
2925
|
+
}, [onBlur, onChange]);
|
|
2926
|
+
const ratingOptions = Array.from({ length: field.maxRating }, (_, i) => i + 1);
|
|
2927
|
+
return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsx(
|
|
2928
|
+
InputWithLabel,
|
|
2929
|
+
{
|
|
2930
|
+
size,
|
|
2931
|
+
severity,
|
|
2932
|
+
inputId,
|
|
2933
|
+
labelId,
|
|
2934
|
+
label: computedLabel,
|
|
2935
|
+
image: showInputOnly ? void 0 : field.image,
|
|
2936
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-1 items-center", children: [
|
|
2937
|
+
/* @__PURE__ */ jsx(
|
|
2938
|
+
Rating.Root,
|
|
2939
|
+
{
|
|
2940
|
+
id: inputId,
|
|
2941
|
+
name,
|
|
2942
|
+
className: "flex items-center gap-0.5",
|
|
2943
|
+
value,
|
|
2944
|
+
onValueChange: handleChange,
|
|
2945
|
+
disabled,
|
|
2946
|
+
children: ratingOptions.map((rating) => /* @__PURE__ */ jsx(
|
|
2947
|
+
Rating.Item,
|
|
1700
2948
|
{
|
|
1701
|
-
|
|
1702
|
-
className: "
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
}
|
|
1712
|
-
)
|
|
1713
|
-
]
|
|
1714
|
-
}
|
|
1715
|
-
)
|
|
2949
|
+
value: rating,
|
|
2950
|
+
className: "group size-7 flex cursor-pointer disabled:opacity-50 disabled:pointer-events-none items-center justify-center text-yellow-500 transition-colors",
|
|
2951
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Star, className: "group-data-[active=true]:fill-current size-full" })
|
|
2952
|
+
},
|
|
2953
|
+
`${inputId}-${rating}`
|
|
2954
|
+
))
|
|
2955
|
+
}
|
|
2956
|
+
),
|
|
2957
|
+
!disabled && value !== null && /* @__PURE__ */ jsx(IconButton, { onClick: handleClear, type: "button", variant: "ghost", accentColor: "base", size: "sm", children: /* @__PURE__ */ jsx(LuIcon, { icon: X }) })
|
|
2958
|
+
] })
|
|
1716
2959
|
}
|
|
1717
2960
|
) });
|
|
1718
2961
|
});
|
|
1719
|
-
|
|
1720
|
-
const
|
|
2962
|
+
RatingInput.displayName = "RatingInput";
|
|
2963
|
+
const _RatingField = class _RatingField extends BaseField {
|
|
1721
2964
|
constructor(options) {
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
__publicField(this, "
|
|
2965
|
+
const { maxRating, ...rest } = options;
|
|
2966
|
+
super(rest);
|
|
2967
|
+
__publicField(this, "type", "rating");
|
|
2968
|
+
__publicField(this, "maxRating");
|
|
2969
|
+
this.maxRating = maxRating;
|
|
2970
|
+
}
|
|
2971
|
+
static getFieldCreationSchema(parentPath = "") {
|
|
2972
|
+
const path = parentPath && `${parentPath}.`;
|
|
2973
|
+
return [
|
|
2974
|
+
{
|
|
2975
|
+
field: new NumberField({
|
|
2976
|
+
label: "Max Rating",
|
|
2977
|
+
description: "Maximum rating value",
|
|
2978
|
+
integers: true,
|
|
2979
|
+
required: false,
|
|
2980
|
+
minimum: 1,
|
|
2981
|
+
maximum: 10,
|
|
2982
|
+
identifier: `${path}maxRating`
|
|
2983
|
+
}),
|
|
2984
|
+
showDirectly: false
|
|
2985
|
+
}
|
|
2986
|
+
];
|
|
2987
|
+
}
|
|
2988
|
+
getFieldValidators() {
|
|
2989
|
+
const validators = super.getFieldValidators();
|
|
2990
|
+
const max = this.maxRating;
|
|
2991
|
+
validators.push((value) => {
|
|
2992
|
+
if (typeof value === "number" && (value < 1 || value > max)) {
|
|
2993
|
+
return `Rating must be between 1 and ${max}.`;
|
|
2994
|
+
}
|
|
2995
|
+
});
|
|
2996
|
+
return validators;
|
|
1725
2997
|
}
|
|
1726
2998
|
serialize() {
|
|
1727
|
-
return
|
|
2999
|
+
return {
|
|
3000
|
+
...super.serialize(),
|
|
3001
|
+
maxRating: this.maxRating
|
|
3002
|
+
};
|
|
1728
3003
|
}
|
|
1729
3004
|
getOptions() {
|
|
1730
|
-
return
|
|
3005
|
+
return {
|
|
3006
|
+
...super.getOptions(),
|
|
3007
|
+
maxRating: this.maxRating
|
|
3008
|
+
};
|
|
1731
3009
|
}
|
|
1732
3010
|
duplicate(identifier) {
|
|
1733
|
-
return new
|
|
3011
|
+
return new _RatingField({
|
|
1734
3012
|
...this.getOptions(),
|
|
1735
3013
|
identifier
|
|
1736
3014
|
});
|
|
1737
3015
|
}
|
|
1738
3016
|
setOptions(options) {
|
|
1739
|
-
|
|
3017
|
+
const { maxRating, ...rest } = options;
|
|
3018
|
+
this.maxRating = maxRating ?? this.maxRating;
|
|
3019
|
+
super.setOptions(rest);
|
|
1740
3020
|
}
|
|
1741
3021
|
static deserialize(data) {
|
|
1742
|
-
return new
|
|
3022
|
+
return new _RatingField(data);
|
|
1743
3023
|
}
|
|
1744
3024
|
serializeValue(value) {
|
|
1745
3025
|
return value;
|
|
@@ -1748,24 +3028,24 @@ const _RadioField = class _RadioField extends BaseOptionsField {
|
|
|
1748
3028
|
return value;
|
|
1749
3029
|
}
|
|
1750
3030
|
render(props) {
|
|
1751
|
-
return /* @__PURE__ */ jsx(
|
|
3031
|
+
return /* @__PURE__ */ jsx(RatingInput, { field: this, ...props });
|
|
1752
3032
|
}
|
|
1753
3033
|
isSerializedValueValid(value) {
|
|
1754
|
-
return typeof value === "
|
|
3034
|
+
return typeof value === "number" || value === null;
|
|
1755
3035
|
}
|
|
1756
3036
|
isValueValid(value) {
|
|
1757
|
-
return typeof value === "
|
|
1758
|
-
}
|
|
1759
|
-
blankValue() {
|
|
1760
|
-
return null;
|
|
3037
|
+
return typeof value === "number" || value === null;
|
|
1761
3038
|
}
|
|
1762
3039
|
areValuesEqual(value1, value2) {
|
|
1763
3040
|
return value1 === value2;
|
|
1764
3041
|
}
|
|
3042
|
+
blankValue() {
|
|
3043
|
+
return null;
|
|
3044
|
+
}
|
|
1765
3045
|
};
|
|
1766
|
-
__publicField(
|
|
1767
|
-
__publicField(
|
|
1768
|
-
let
|
|
3046
|
+
__publicField(_RatingField, "fieldTypeName", "Rating");
|
|
3047
|
+
__publicField(_RatingField, "fieldTypeDescription", "Allows users to select a rating value.");
|
|
3048
|
+
let RatingField = _RatingField;
|
|
1769
3049
|
const ScannerContext = createContext(() => {
|
|
1770
3050
|
throw new Error("No ScannerProvider found");
|
|
1771
3051
|
});
|
|
@@ -24092,7 +25372,6 @@ var PDF417CodewordDecoder = (
|
|
|
24092
25372
|
return PDF417CodewordDecoder2;
|
|
24093
25373
|
}()
|
|
24094
25374
|
);
|
|
24095
|
-
const global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
24096
25375
|
var PDF417ResultMetadata = (
|
|
24097
25376
|
/** @class */
|
|
24098
25377
|
function() {
|
|
@@ -24387,8 +25666,8 @@ function getBigIntConstructor() {
|
|
|
24387
25666
|
if (typeof window !== "undefined") {
|
|
24388
25667
|
return window["BigInt"] || null;
|
|
24389
25668
|
}
|
|
24390
|
-
if (typeof global
|
|
24391
|
-
return global
|
|
25669
|
+
if (typeof global !== "undefined") {
|
|
25670
|
+
return global["BigInt"] || null;
|
|
24392
25671
|
}
|
|
24393
25672
|
if (typeof self !== "undefined") {
|
|
24394
25673
|
return self["BigInt"] || null;
|
|
@@ -29882,7 +31161,15 @@ const SCANNER_HINTS = /* @__PURE__ */ new Map([
|
|
|
29882
31161
|
]
|
|
29883
31162
|
]);
|
|
29884
31163
|
const Scanner = memo((props) => {
|
|
29885
|
-
const {
|
|
31164
|
+
const {
|
|
31165
|
+
children,
|
|
31166
|
+
open,
|
|
31167
|
+
onOpenChange,
|
|
31168
|
+
// oxlint-disable-line unbound-method
|
|
31169
|
+
defaultOpen,
|
|
31170
|
+
modal,
|
|
31171
|
+
...rest
|
|
31172
|
+
} = props;
|
|
29886
31173
|
return /* @__PURE__ */ jsxs(Overlay.Root, { open, onOpenChange, defaultOpen, modal, children: [
|
|
29887
31174
|
!!children && /* @__PURE__ */ jsx(Overlay.Trigger, { asChild: true, children }),
|
|
29888
31175
|
/* @__PURE__ */ jsxs(Overlay.Content, { children: [
|
|
@@ -29904,7 +31191,7 @@ const ScannerInternal = memo((props) => {
|
|
|
29904
31191
|
hints: SCANNER_HINTS
|
|
29905
31192
|
});
|
|
29906
31193
|
return /* @__PURE__ */ jsxs("div", { className: "flex size-full flex-col justify-center overflow-hidden bg-(--color-background)", children: [
|
|
29907
|
-
/* @__PURE__ */ jsx("div", { className: "flex w-full justify-end p-4", children: /* @__PURE__ */ jsx(Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
31194
|
+
/* @__PURE__ */ jsx("div", { className: "flex w-full justify-end p-4", children: /* @__PURE__ */ jsx(Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsx(LuIcon, { icon: X }) }) }) }),
|
|
29908
31195
|
/* @__PURE__ */ jsx("div", { className: "grow w-full max-h-full overflow-hidden p-4", children: /* @__PURE__ */ jsx("video", { className: "size-full", ref }) })
|
|
29909
31196
|
] });
|
|
29910
31197
|
});
|
|
@@ -30011,7 +31298,7 @@ const ScanInput = memo((props) => {
|
|
|
30011
31298
|
accentColor: "base",
|
|
30012
31299
|
disabled,
|
|
30013
31300
|
children: [
|
|
30014
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
31301
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Maximize }),
|
|
30015
31302
|
"Scan"
|
|
30016
31303
|
]
|
|
30017
31304
|
}
|
|
@@ -30149,7 +31436,6 @@ const _StringField = class _StringField extends BaseStringField {
|
|
|
30149
31436
|
super.setOptions(options);
|
|
30150
31437
|
}
|
|
30151
31438
|
static deserialize(data) {
|
|
30152
|
-
if (data.type !== "string") throw new Error("Type mismatch.");
|
|
30153
31439
|
const { maximum_length, minimum_length, ...rest } = data;
|
|
30154
31440
|
return new _StringField({
|
|
30155
31441
|
...rest,
|
|
@@ -30259,107 +31545,6 @@ const _TextField = class _TextField extends BaseStringField {
|
|
|
30259
31545
|
__publicField(_TextField, "fieldTypeName", "Paragraph");
|
|
30260
31546
|
__publicField(_TextField, "fieldTypeDescription", `Paragraph fields can hold up to ${LONG_TEXT_FIELD_MAX_LENGTH} characters and can have multiple lines.`);
|
|
30261
31547
|
let TextField = _TextField;
|
|
30262
|
-
const ImageCard = memo(
|
|
30263
|
-
forwardRef((props, forwardedRef) => {
|
|
30264
|
-
const { file, alt, error, rightSlot, className, ...rest } = props;
|
|
30265
|
-
return /* @__PURE__ */ jsxs(
|
|
30266
|
-
Card,
|
|
30267
|
-
{
|
|
30268
|
-
className: cx(className, "relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),
|
|
30269
|
-
ref: forwardedRef,
|
|
30270
|
-
...rest,
|
|
30271
|
-
children: [
|
|
30272
|
-
!file && !error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 grow flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }),
|
|
30273
|
-
!!file && !error && /* @__PURE__ */ jsx(Card, { className: "flex max-w-full grow items-center !p-0 justify-center overflow-hidden bg-clip-padding", children: /* @__PURE__ */ jsx(
|
|
30274
|
-
"img",
|
|
30275
|
-
{
|
|
30276
|
-
className: "max-w-full object-cover",
|
|
30277
|
-
src: URL.createObjectURL(file),
|
|
30278
|
-
alt: alt ?? file.name
|
|
30279
|
-
}
|
|
30280
|
-
) }),
|
|
30281
|
-
(!!file || !!error) && /* @__PURE__ */ jsxs(
|
|
30282
|
-
"div",
|
|
30283
|
-
{
|
|
30284
|
-
className: cx("flex w-full items-center gap-2 self-end", {
|
|
30285
|
-
"bg-transparent": !file
|
|
30286
|
-
}),
|
|
30287
|
-
children: [
|
|
30288
|
-
error ? /* @__PURE__ */ jsx(LuIcon, { icon: "file-warning" }) : file && /* @__PURE__ */ jsx(LuIcon, { icon: "file" }),
|
|
30289
|
-
/* @__PURE__ */ jsx(Text, { className: "truncate", size: "sm", children: error ?? (file == null ? void 0 : file.name) }),
|
|
30290
|
-
rightSlot
|
|
30291
|
-
]
|
|
30292
|
-
}
|
|
30293
|
-
)
|
|
30294
|
-
]
|
|
30295
|
-
}
|
|
30296
|
-
);
|
|
30297
|
-
})
|
|
30298
|
-
);
|
|
30299
|
-
class UUIDPromise extends Promise {
|
|
30300
|
-
constructor(executor, uuid) {
|
|
30301
|
-
super(executor);
|
|
30302
|
-
__publicField(this, "_uuid");
|
|
30303
|
-
this._uuid = uuid;
|
|
30304
|
-
}
|
|
30305
|
-
get uuid() {
|
|
30306
|
-
return this._uuid;
|
|
30307
|
-
}
|
|
30308
|
-
set uuid(uuid) {
|
|
30309
|
-
this._uuid = uuid;
|
|
30310
|
-
}
|
|
30311
|
-
static from(promise, uuid) {
|
|
30312
|
-
return new UUIDPromise((resolve, reject) => {
|
|
30313
|
-
Promise.resolve(promise).then(resolve).catch(reject);
|
|
30314
|
-
}, uuid);
|
|
30315
|
-
}
|
|
30316
|
-
then(onFulfilled, onRejected) {
|
|
30317
|
-
const promise = super.then(onFulfilled, onRejected);
|
|
30318
|
-
promise.uuid = this.uuid;
|
|
30319
|
-
return promise;
|
|
30320
|
-
}
|
|
30321
|
-
catch(onRejected) {
|
|
30322
|
-
const promise = super.catch(onRejected);
|
|
30323
|
-
promise.uuid = this.uuid;
|
|
30324
|
-
return promise;
|
|
30325
|
-
}
|
|
30326
|
-
finally(onFinally) {
|
|
30327
|
-
const promise = super.finally(onFinally);
|
|
30328
|
-
promise.uuid = this.uuid;
|
|
30329
|
-
return promise;
|
|
30330
|
-
}
|
|
30331
|
-
}
|
|
30332
|
-
const convertBytesToLargestUnit = (bytes) => {
|
|
30333
|
-
const units = ["byte", "kilobyte", "megabyte"];
|
|
30334
|
-
let sizeInUnit = bytes;
|
|
30335
|
-
let unitIndex = 0;
|
|
30336
|
-
while (sizeInUnit > 1e3 && unitIndex < units.length - 1) {
|
|
30337
|
-
sizeInUnit /= 1e3;
|
|
30338
|
-
unitIndex++;
|
|
30339
|
-
}
|
|
30340
|
-
const formatter = new Intl.NumberFormat([], {
|
|
30341
|
-
// 0 for bytes and kilobytes, 1 for megabytes
|
|
30342
|
-
maximumFractionDigits: Math.max(0, unitIndex - 1),
|
|
30343
|
-
style: "unit",
|
|
30344
|
-
unit: units[unitIndex]
|
|
30345
|
-
});
|
|
30346
|
-
return formatter.format(sizeInUnit);
|
|
30347
|
-
};
|
|
30348
|
-
function areFilesEqual(file1, file2) {
|
|
30349
|
-
return file1.name === file2.name && file1.size === file2.size && file1.type === file2.type;
|
|
30350
|
-
}
|
|
30351
|
-
function separateFilesFromPromises(filesOrPromises) {
|
|
30352
|
-
const files = [];
|
|
30353
|
-
const promises = [];
|
|
30354
|
-
for (const fileOrPromise of filesOrPromises) {
|
|
30355
|
-
if (fileOrPromise instanceof UUIDPromise) {
|
|
30356
|
-
promises.push(fileOrPromise);
|
|
30357
|
-
} else {
|
|
30358
|
-
files.push(fileOrPromise);
|
|
30359
|
-
}
|
|
30360
|
-
}
|
|
30361
|
-
return [files, promises];
|
|
30362
|
-
}
|
|
30363
31548
|
const UploadInput = memo((props) => {
|
|
30364
31549
|
var _a2;
|
|
30365
31550
|
const [{ inputId, labelId, label, size, severity, helpText, showInputOnly, field, fieldProps }, { disabled }] = useFormikInput(props);
|
|
@@ -30384,7 +31569,7 @@ const UploadInput = memo((props) => {
|
|
|
30384
31569
|
onBlur([]);
|
|
30385
31570
|
return;
|
|
30386
31571
|
}
|
|
30387
|
-
const fileArray = Array.from(files);
|
|
31572
|
+
const fileArray = Array.from(files).map((file) => UUIDFile.from(v4(), file));
|
|
30388
31573
|
const newValue = [...value, ...fileArray];
|
|
30389
31574
|
onChange(newValue);
|
|
30390
31575
|
onBlur(newValue);
|
|
@@ -30392,7 +31577,7 @@ const UploadInput = memo((props) => {
|
|
|
30392
31577
|
const handleRemove = useCallback(
|
|
30393
31578
|
(index) => {
|
|
30394
31579
|
const files = [...value];
|
|
30395
|
-
files.splice(index, 1);
|
|
31580
|
+
void files.splice(index, 1);
|
|
30396
31581
|
onChange(files);
|
|
30397
31582
|
},
|
|
30398
31583
|
[value, onChange]
|
|
@@ -30439,7 +31624,7 @@ const UploadInput = memo((props) => {
|
|
|
30439
31624
|
type: "button",
|
|
30440
31625
|
disabled,
|
|
30441
31626
|
children: [
|
|
30442
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
31627
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Upload }),
|
|
30443
31628
|
buttonText
|
|
30444
31629
|
]
|
|
30445
31630
|
}
|
|
@@ -30464,7 +31649,6 @@ const UploadInput = memo((props) => {
|
|
|
30464
31649
|
Array.isArray(value) && value.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex h-max flex-col gap-2", children: value.map((file, index) => /* @__PURE__ */ jsx(
|
|
30465
31650
|
DisplayFile,
|
|
30466
31651
|
{
|
|
30467
|
-
field,
|
|
30468
31652
|
file,
|
|
30469
31653
|
onRemove: () => {
|
|
30470
31654
|
handleRemove(index);
|
|
@@ -30476,92 +31660,6 @@ const UploadInput = memo((props) => {
|
|
|
30476
31660
|
] });
|
|
30477
31661
|
});
|
|
30478
31662
|
UploadInput.displayName = "UploadInput";
|
|
30479
|
-
const DisplayFile = memo((props) => {
|
|
30480
|
-
const { file, field, onRemove, disabled } = props;
|
|
30481
|
-
const [resolvedFile, setResolvedFile] = useState(null);
|
|
30482
|
-
const openImageViewer = useImageViewer();
|
|
30483
|
-
const error = useMemo(() => resolvedFile && field.getError([resolvedFile]), [field, resolvedFile]);
|
|
30484
|
-
const { url, name } = useMemo(() => {
|
|
30485
|
-
let url2 = null;
|
|
30486
|
-
let name2;
|
|
30487
|
-
let size;
|
|
30488
|
-
if (resolvedFile == null ? void 0 : resolvedFile.type.startsWith("image/")) {
|
|
30489
|
-
url2 = URL.createObjectURL(resolvedFile);
|
|
30490
|
-
}
|
|
30491
|
-
if (resolvedFile) {
|
|
30492
|
-
name2 = resolvedFile.name;
|
|
30493
|
-
size = convertBytesToLargestUnit(resolvedFile.size);
|
|
30494
|
-
} else {
|
|
30495
|
-
name2 = "Downloading...";
|
|
30496
|
-
size = "...";
|
|
30497
|
-
}
|
|
30498
|
-
return { url: url2, name: name2, size };
|
|
30499
|
-
}, [resolvedFile]);
|
|
30500
|
-
useEffect(() => {
|
|
30501
|
-
if (file instanceof UUIDPromise) {
|
|
30502
|
-
file.then((file2) => {
|
|
30503
|
-
setResolvedFile(file2);
|
|
30504
|
-
}).catch(console.error);
|
|
30505
|
-
} else {
|
|
30506
|
-
setResolvedFile(file);
|
|
30507
|
-
}
|
|
30508
|
-
}, [file]);
|
|
30509
|
-
const handleDownload = useCallback(
|
|
30510
|
-
(event) => {
|
|
30511
|
-
event.stopPropagation();
|
|
30512
|
-
if (!resolvedFile) {
|
|
30513
|
-
throw new Error("Cannot download a file that is not resolved.");
|
|
30514
|
-
}
|
|
30515
|
-
const blob = new Blob([resolvedFile]);
|
|
30516
|
-
saveAs(blob, name);
|
|
30517
|
-
},
|
|
30518
|
-
[name, resolvedFile]
|
|
30519
|
-
);
|
|
30520
|
-
const handleDelete = useCallback(
|
|
30521
|
-
(e) => {
|
|
30522
|
-
e.stopPropagation();
|
|
30523
|
-
onRemove();
|
|
30524
|
-
},
|
|
30525
|
-
[onRemove]
|
|
30526
|
-
);
|
|
30527
|
-
const handleImageCardClick = useCallback(() => {
|
|
30528
|
-
if (!resolvedFile) return;
|
|
30529
|
-
openImageViewer((closeFileViewer) => ({
|
|
30530
|
-
file: resolvedFile,
|
|
30531
|
-
onDelete: !disabled ? () => {
|
|
30532
|
-
onRemove();
|
|
30533
|
-
closeFileViewer();
|
|
30534
|
-
} : void 0
|
|
30535
|
-
}));
|
|
30536
|
-
}, [disabled, onRemove, openImageViewer, resolvedFile]);
|
|
30537
|
-
const rightSlotContent = useMemo(
|
|
30538
|
-
() => /* @__PURE__ */ jsxs(ButtonGroup, { className: "flex grow justify-end", variant: "ghost", accentColor: "base", size: "sm", children: [
|
|
30539
|
-
/* @__PURE__ */ jsx(
|
|
30540
|
-
IconButton,
|
|
30541
|
-
{
|
|
30542
|
-
"aria-label": `Download ${name}`,
|
|
30543
|
-
type: "button",
|
|
30544
|
-
onClick: handleDownload,
|
|
30545
|
-
disabled: !resolvedFile,
|
|
30546
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon: "download" })
|
|
30547
|
-
}
|
|
30548
|
-
),
|
|
30549
|
-
!disabled && /* @__PURE__ */ jsx(IconButton, { type: "button", "aria-label": `Remove ${name}`, disabled, onClick: handleDelete, children: /* @__PURE__ */ jsx(LuIcon, { icon: "trash" }) })
|
|
30550
|
-
] }),
|
|
30551
|
-
[disabled, handleDelete, handleDownload, name, resolvedFile]
|
|
30552
|
-
);
|
|
30553
|
-
return url ? /* @__PURE__ */ jsx(
|
|
30554
|
-
ImageCard,
|
|
30555
|
-
{
|
|
30556
|
-
className: "cursor-pointer",
|
|
30557
|
-
onClick: handleImageCardClick,
|
|
30558
|
-
file: resolvedFile,
|
|
30559
|
-
error: error ?? void 0,
|
|
30560
|
-
rightSlot: rightSlotContent
|
|
30561
|
-
}
|
|
30562
|
-
) : /* @__PURE__ */ jsx(FileCard, { file: resolvedFile, error: error ?? void 0, rightSlot: rightSlotContent });
|
|
30563
|
-
});
|
|
30564
|
-
DisplayFile.displayName = "DisplayFile";
|
|
30565
31663
|
const _UploadField = class _UploadField extends BaseField {
|
|
30566
31664
|
constructor(options) {
|
|
30567
31665
|
const { extensions, maximum_files, maximum_size, ...base } = options;
|
|
@@ -30641,7 +31739,7 @@ const _UploadField = class _UploadField extends BaseField {
|
|
|
30641
31739
|
const maxFileSizeInB = maxFileSizeInMB * 1e3 * 1e3;
|
|
30642
31740
|
const maxFiles = this.maxFiles || 1;
|
|
30643
31741
|
validators.push((value) => {
|
|
30644
|
-
if (value && value.some((file) => file instanceof
|
|
31742
|
+
if (value && value.some((file) => file instanceof UUIDFile && file.size > maxFileSizeInB)) {
|
|
30645
31743
|
return `Files must be at most ${maxFileSizeInMB}MB.`;
|
|
30646
31744
|
}
|
|
30647
31745
|
});
|
|
@@ -30698,16 +31796,10 @@ const _UploadField = class _UploadField extends BaseField {
|
|
|
30698
31796
|
}
|
|
30699
31797
|
isValueValid(value) {
|
|
30700
31798
|
if (!Array.isArray(value)) return false;
|
|
30701
|
-
return value.every((item) => item instanceof UUIDPromise || item instanceof
|
|
31799
|
+
return value.every((item) => item instanceof UUIDPromise || item instanceof UUIDFile);
|
|
30702
31800
|
}
|
|
30703
31801
|
areValuesEqual(value1, value2) {
|
|
30704
|
-
|
|
30705
|
-
const [files2, promises2] = separateFilesFromPromises(value2);
|
|
30706
|
-
if (!files1.every((file1) => files2.some((file2) => areFilesEqual(file1, file2)))) return false;
|
|
30707
|
-
if (!files2.every((file2) => files1.some((file1) => areFilesEqual(file1, file2)))) return false;
|
|
30708
|
-
if (!promises1.every((promise1) => promises2.some((promise2) => promise1.uuid === promise2.uuid))) return false;
|
|
30709
|
-
if (!promises2.every((promise2) => promises1.some((promise1) => promise1.uuid === promise2.uuid))) return false;
|
|
30710
|
-
return true;
|
|
31802
|
+
return areFileAndPromiseArraysEqual(value1, value2);
|
|
30711
31803
|
}
|
|
30712
31804
|
blankValue() {
|
|
30713
31805
|
return [];
|
|
@@ -30729,23 +31821,27 @@ const FieldTypeToClsMapping = {
|
|
|
30729
31821
|
"multi-select": MultiSelectField,
|
|
30730
31822
|
radio: RadioField,
|
|
30731
31823
|
"checkbox-list": CheckboxListField,
|
|
30732
|
-
|
|
31824
|
+
"pass-fail": PassFailField,
|
|
31825
|
+
otp: OTPField,
|
|
31826
|
+
rating: RatingField
|
|
30733
31827
|
};
|
|
30734
31828
|
const fieldIcons = {
|
|
30735
|
-
boolean:
|
|
30736
|
-
date:
|
|
30737
|
-
"multi-string":
|
|
30738
|
-
number:
|
|
30739
|
-
qr:
|
|
30740
|
-
"multi-select":
|
|
30741
|
-
select:
|
|
30742
|
-
string:
|
|
30743
|
-
text:
|
|
30744
|
-
upload:
|
|
30745
|
-
section:
|
|
30746
|
-
radio:
|
|
30747
|
-
"checkbox-list":
|
|
30748
|
-
|
|
31829
|
+
boolean: SquareCheck,
|
|
31830
|
+
date: Calendar,
|
|
31831
|
+
"multi-string": List,
|
|
31832
|
+
number: Hash,
|
|
31833
|
+
qr: Scan,
|
|
31834
|
+
"multi-select": ListChecks,
|
|
31835
|
+
select: ListTodo,
|
|
31836
|
+
string: TextCursorInput,
|
|
31837
|
+
text: AlignJustify,
|
|
31838
|
+
upload: Upload,
|
|
31839
|
+
section: LayoutPanelTop,
|
|
31840
|
+
radio: CircleDot,
|
|
31841
|
+
"checkbox-list": CopyCheck,
|
|
31842
|
+
"pass-fail": ClipboardList,
|
|
31843
|
+
otp: RectangleEllipsis,
|
|
31844
|
+
rating: Star
|
|
30749
31845
|
};
|
|
30750
31846
|
const maxFileSizeMB = 50;
|
|
30751
31847
|
const maxFileSizeKB = maxFileSizeMB * 1e3;
|
|
@@ -30952,6 +32048,42 @@ const NumberRangeNotInConditionModifier = ConditionModifier.create({
|
|
|
30952
32048
|
serialize: (filterValue) => filterValue,
|
|
30953
32049
|
deserialize: (filterValue) => filterValue
|
|
30954
32050
|
});
|
|
32051
|
+
const PassFailEqualsConditionModifier = ConditionModifier.create({
|
|
32052
|
+
id: "pass-fail-equals",
|
|
32053
|
+
modifierFn: (value, filterValue) => {
|
|
32054
|
+
return value === filterValue;
|
|
32055
|
+
},
|
|
32056
|
+
label: "is",
|
|
32057
|
+
serialize: (filterValue) => filterValue,
|
|
32058
|
+
deserialize: (filterValue) => filterValue
|
|
32059
|
+
});
|
|
32060
|
+
const PassFailNotEqualsConditionModifier = ConditionModifier.create({
|
|
32061
|
+
id: "pass-fail-not-equals",
|
|
32062
|
+
modifierFn: (value, filterValue) => {
|
|
32063
|
+
return value !== filterValue;
|
|
32064
|
+
},
|
|
32065
|
+
label: "is not",
|
|
32066
|
+
serialize: (filterValue) => filterValue,
|
|
32067
|
+
deserialize: (filterValue) => filterValue
|
|
32068
|
+
});
|
|
32069
|
+
const PassFailArrayIncludesConditionModifier = ConditionModifier.create({
|
|
32070
|
+
id: "pass-fail-array-includes",
|
|
32071
|
+
modifierFn: (value, filterValue) => {
|
|
32072
|
+
return filterValue.includes(value);
|
|
32073
|
+
},
|
|
32074
|
+
label: "is any of",
|
|
32075
|
+
serialize: (filterValue) => filterValue,
|
|
32076
|
+
deserialize: (filterValue) => filterValue
|
|
32077
|
+
});
|
|
32078
|
+
const PassFailArrayExcludesConditionModifier = ConditionModifier.create({
|
|
32079
|
+
id: "pass-fail-array-excludes",
|
|
32080
|
+
modifierFn: (value, filterValue) => {
|
|
32081
|
+
return !filterValue.includes(value);
|
|
32082
|
+
},
|
|
32083
|
+
label: "is none of",
|
|
32084
|
+
serialize: (filterValue) => filterValue,
|
|
32085
|
+
deserialize: (filterValue) => filterValue
|
|
32086
|
+
});
|
|
30955
32087
|
const StringEqualsConditionModifier = ConditionModifier.create({
|
|
30956
32088
|
id: "nullable-string-equals",
|
|
30957
32089
|
modifierFn: (value, filterValue) => {
|
|
@@ -31091,9 +32223,11 @@ class BaseCondition extends Observable {
|
|
|
31091
32223
|
__publicField(this, "apply", (value) => {
|
|
31092
32224
|
const modifier = this.modifiers[this.conditionModifier];
|
|
31093
32225
|
const conditionValue = this.getConditionValue();
|
|
31094
|
-
if (conditionValue
|
|
31095
|
-
if (!modifier.
|
|
31096
|
-
|
|
32226
|
+
if (conditionValue == void 0) return true;
|
|
32227
|
+
if (!modifier.isConditionValueValid(conditionValue)) return true;
|
|
32228
|
+
const transformedValue = this.transformValue(value);
|
|
32229
|
+
if (!modifier.isValueValid(transformedValue)) return false;
|
|
32230
|
+
return modifier.modifier.modifierFn(transformedValue, conditionValue);
|
|
31097
32231
|
});
|
|
31098
32232
|
this.id = id;
|
|
31099
32233
|
this.field = field;
|
|
@@ -31109,6 +32243,9 @@ class BaseCondition extends Observable {
|
|
|
31109
32243
|
conditionModifier: this.conditionModifier
|
|
31110
32244
|
};
|
|
31111
32245
|
}
|
|
32246
|
+
transformValue(value) {
|
|
32247
|
+
return value;
|
|
32248
|
+
}
|
|
31112
32249
|
}
|
|
31113
32250
|
const formId = "form-builder";
|
|
31114
32251
|
const UNLABELLED_FIELD_LABEL = "Unlabelled";
|
|
@@ -31121,12 +32258,12 @@ const SelectItemTemplate = genericMemo(function(props) {
|
|
|
31121
32258
|
if (typeof children === "function") {
|
|
31122
32259
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
31123
32260
|
children(meta),
|
|
31124
|
-
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-[auto]", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
32261
|
+
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-[auto]", children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) })
|
|
31125
32262
|
] });
|
|
31126
32263
|
} else {
|
|
31127
32264
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
31128
32265
|
children,
|
|
31129
|
-
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-[auto]", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
32266
|
+
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-[auto]", children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) })
|
|
31130
32267
|
] });
|
|
31131
32268
|
}
|
|
31132
32269
|
},
|
|
@@ -31141,12 +32278,12 @@ const MultiSelectItemTemplate = genericMemo(function(props) {
|
|
|
31141
32278
|
if (typeof children === "function") {
|
|
31142
32279
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
31143
32280
|
children(meta),
|
|
31144
|
-
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-auto", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
32281
|
+
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-auto", children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) })
|
|
31145
32282
|
] });
|
|
31146
32283
|
} else {
|
|
31147
32284
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
31148
32285
|
children,
|
|
31149
|
-
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-auto", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
32286
|
+
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { className: "ml-auto", children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) })
|
|
31150
32287
|
] });
|
|
31151
32288
|
}
|
|
31152
32289
|
},
|
|
@@ -31161,12 +32298,12 @@ const SelectAllItemTemplate = memo((props) => {
|
|
|
31161
32298
|
if (typeof children === "function") {
|
|
31162
32299
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
31163
32300
|
children(meta),
|
|
31164
|
-
/* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { className: "ml-[auto]", children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
32301
|
+
/* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { className: "ml-[auto]", children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon: Minus }) : /* @__PURE__ */ jsx(LuIcon, { icon: Check }) })
|
|
31165
32302
|
] });
|
|
31166
32303
|
} else {
|
|
31167
32304
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
31168
32305
|
children,
|
|
31169
|
-
/* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { className: "ml-[auto]", children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
32306
|
+
/* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { className: "ml-[auto]", children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon: Minus }) : /* @__PURE__ */ jsx(LuIcon, { icon: Check }) })
|
|
31170
32307
|
] });
|
|
31171
32308
|
}
|
|
31172
32309
|
},
|
|
@@ -31260,7 +32397,7 @@ const MultiStringPopover = memo((props) => {
|
|
|
31260
32397
|
variant: "soft",
|
|
31261
32398
|
type: "button",
|
|
31262
32399
|
onClick: handleAddValueClick,
|
|
31263
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
32400
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Plus })
|
|
31264
32401
|
}
|
|
31265
32402
|
)
|
|
31266
32403
|
] }),
|
|
@@ -31283,7 +32420,7 @@ const MultiStringPopover = memo((props) => {
|
|
|
31283
32420
|
onClick: () => {
|
|
31284
32421
|
handleRemoveValueClick(index);
|
|
31285
32422
|
},
|
|
31286
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
32423
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: X })
|
|
31287
32424
|
}
|
|
31288
32425
|
)
|
|
31289
32426
|
]
|
|
@@ -31343,7 +32480,7 @@ const RemoveConditionButton = (props) => {
|
|
|
31343
32480
|
const handleRemoveFilter = useCallback(() => {
|
|
31344
32481
|
onClick(condition);
|
|
31345
32482
|
}, [condition, onClick]);
|
|
31346
|
-
return /* @__PURE__ */ jsx(IconButton, { onClick: handleRemoveFilter, ...rest, children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
32483
|
+
return /* @__PURE__ */ jsx(IconButton, { onClick: handleRemoveFilter, ...rest, children: /* @__PURE__ */ jsx(LuIcon, { icon: X }) });
|
|
31347
32484
|
};
|
|
31348
32485
|
RemoveConditionButton.displayName = "RemoveConditionButton";
|
|
31349
32486
|
const SelectFieldOptionMultiSelectGroup = memo((props) => {
|
|
@@ -31458,7 +32595,7 @@ const BooleanFieldConditionCell = (props) => {
|
|
|
31458
32595
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
31459
32596
|
] });
|
|
31460
32597
|
};
|
|
31461
|
-
const modifiers$
|
|
32598
|
+
const modifiers$e = {
|
|
31462
32599
|
equals: createConditionModifierConfig({
|
|
31463
32600
|
modifier: BooleanEqualsConditionModifier,
|
|
31464
32601
|
isValueValid: (_value) => true,
|
|
@@ -31475,13 +32612,11 @@ const modifiers$c = {
|
|
|
31475
32612
|
class BooleanFieldCondition extends BaseCondition {
|
|
31476
32613
|
constructor(options) {
|
|
31477
32614
|
super(options);
|
|
31478
|
-
__publicField(this, "
|
|
31479
|
-
__publicField(this, "defaultConditionValue");
|
|
31480
|
-
__publicField(this, "modifiers", modifiers$c);
|
|
32615
|
+
__publicField(this, "modifiers", modifiers$e);
|
|
31481
32616
|
}
|
|
31482
32617
|
static deserialize(serializedCondition, field) {
|
|
31483
32618
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
31484
|
-
const modifierConfig = modifiers$
|
|
32619
|
+
const modifierConfig = modifiers$e[conditionModifier];
|
|
31485
32620
|
let deserializedValue = void 0;
|
|
31486
32621
|
if (conditionValue !== void 0) {
|
|
31487
32622
|
deserializedValue = modifierConfig.modifier.deserialize(conditionValue);
|
|
@@ -31537,7 +32672,7 @@ const CheckboxListFieldConditionCell = (props) => {
|
|
|
31537
32672
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
31538
32673
|
] });
|
|
31539
32674
|
};
|
|
31540
|
-
const modifiers$
|
|
32675
|
+
const modifiers$d = {
|
|
31541
32676
|
equals: createConditionModifierConfig({
|
|
31542
32677
|
modifier: StringArrayEqualsConditionModifier,
|
|
31543
32678
|
isValueValid: (_value) => true,
|
|
@@ -31572,13 +32707,11 @@ const modifiers$b = {
|
|
|
31572
32707
|
class CheckboxListFieldCondition extends BaseCondition {
|
|
31573
32708
|
constructor(options) {
|
|
31574
32709
|
super(options);
|
|
31575
|
-
__publicField(this, "
|
|
31576
|
-
__publicField(this, "defaultConditionValue");
|
|
31577
|
-
__publicField(this, "modifiers", modifiers$b);
|
|
32710
|
+
__publicField(this, "modifiers", modifiers$d);
|
|
31578
32711
|
}
|
|
31579
32712
|
static deserialize(serializedCondition, field) {
|
|
31580
32713
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
31581
|
-
const modifierConfig = modifiers$
|
|
32714
|
+
const modifierConfig = modifiers$d[conditionModifier];
|
|
31582
32715
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
|
|
31583
32716
|
return new CheckboxListFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
31584
32717
|
}
|
|
@@ -31653,7 +32786,7 @@ const DateFieldConditionCell = (props) => {
|
|
|
31653
32786
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
31654
32787
|
] });
|
|
31655
32788
|
};
|
|
31656
|
-
const modifiers$
|
|
32789
|
+
const modifiers$c = {
|
|
31657
32790
|
equals: createConditionModifierConfig({
|
|
31658
32791
|
modifier: DateEqualsConditionModifier,
|
|
31659
32792
|
isValueValid: (value) => value instanceof Date,
|
|
@@ -31694,13 +32827,11 @@ const modifiers$a = {
|
|
|
31694
32827
|
class DateFieldCondition extends BaseCondition {
|
|
31695
32828
|
constructor(options) {
|
|
31696
32829
|
super(options);
|
|
31697
|
-
__publicField(this, "
|
|
31698
|
-
__publicField(this, "defaultConditionValue");
|
|
31699
|
-
__publicField(this, "modifiers", modifiers$a);
|
|
32830
|
+
__publicField(this, "modifiers", modifiers$c);
|
|
31700
32831
|
}
|
|
31701
32832
|
static deserialize(serializedCondition, field) {
|
|
31702
32833
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
31703
|
-
const modifierConfig = modifiers$
|
|
32834
|
+
const modifierConfig = modifiers$c[conditionModifier];
|
|
31704
32835
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
|
|
31705
32836
|
// @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
|
|
31706
32837
|
modifierConfig.modifier.deserialize(conditionValue)
|
|
@@ -31756,7 +32887,7 @@ const MultiSelectFieldConditionCell = (props) => {
|
|
|
31756
32887
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
31757
32888
|
] });
|
|
31758
32889
|
};
|
|
31759
|
-
const modifiers$
|
|
32890
|
+
const modifiers$b = {
|
|
31760
32891
|
equals: createConditionModifierConfig({
|
|
31761
32892
|
modifier: StringArrayEqualsConditionModifier,
|
|
31762
32893
|
isValueValid: (_value) => true,
|
|
@@ -31791,13 +32922,11 @@ const modifiers$9 = {
|
|
|
31791
32922
|
class MultiSelectFieldCondition extends BaseCondition {
|
|
31792
32923
|
constructor(options) {
|
|
31793
32924
|
super(options);
|
|
31794
|
-
__publicField(this, "
|
|
31795
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
31796
|
-
__publicField(this, "modifiers", modifiers$9);
|
|
32925
|
+
__publicField(this, "modifiers", modifiers$b);
|
|
31797
32926
|
}
|
|
31798
32927
|
static deserialize(serializedCondition, field) {
|
|
31799
32928
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
31800
|
-
const modifierConfig = modifiers$
|
|
32929
|
+
const modifierConfig = modifiers$b[conditionModifier];
|
|
31801
32930
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
|
|
31802
32931
|
return new MultiSelectFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
31803
32932
|
}
|
|
@@ -31841,7 +32970,7 @@ const MultiStringFieldConditionCell = (props) => {
|
|
|
31841
32970
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
31842
32971
|
] });
|
|
31843
32972
|
};
|
|
31844
|
-
const modifiers$
|
|
32973
|
+
const modifiers$a = {
|
|
31845
32974
|
equals: createConditionModifierConfig({
|
|
31846
32975
|
modifier: StringArrayEqualsConditionModifier,
|
|
31847
32976
|
isValueValid: (_value) => true,
|
|
@@ -31876,13 +33005,11 @@ const modifiers$8 = {
|
|
|
31876
33005
|
class MultiStringFieldCondition extends BaseCondition {
|
|
31877
33006
|
constructor(options) {
|
|
31878
33007
|
super(options);
|
|
31879
|
-
__publicField(this, "
|
|
31880
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
31881
|
-
__publicField(this, "modifiers", modifiers$8);
|
|
33008
|
+
__publicField(this, "modifiers", modifiers$a);
|
|
31882
33009
|
}
|
|
31883
33010
|
static deserialize(serializedCondition, field) {
|
|
31884
33011
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
31885
|
-
const modifierConfig = modifiers$
|
|
33012
|
+
const modifierConfig = modifiers$a[conditionModifier];
|
|
31886
33013
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
|
|
31887
33014
|
return new MultiStringFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
31888
33015
|
}
|
|
@@ -31961,7 +33088,7 @@ const NumberFieldConditionCell = (props) => {
|
|
|
31961
33088
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
31962
33089
|
] });
|
|
31963
33090
|
};
|
|
31964
|
-
const modifiers$
|
|
33091
|
+
const modifiers$9 = {
|
|
31965
33092
|
equals: createConditionModifierConfig({
|
|
31966
33093
|
modifier: NumberEqualsConditionModifier,
|
|
31967
33094
|
isValueValid: (value) => typeof value === "number",
|
|
@@ -32014,13 +33141,11 @@ const modifiers$7 = {
|
|
|
32014
33141
|
class NumberFieldCondition extends BaseCondition {
|
|
32015
33142
|
constructor(options) {
|
|
32016
33143
|
super(options);
|
|
32017
|
-
__publicField(this, "
|
|
32018
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32019
|
-
__publicField(this, "modifiers", modifiers$7);
|
|
33144
|
+
__publicField(this, "modifiers", modifiers$9);
|
|
32020
33145
|
}
|
|
32021
33146
|
static deserialize(serializedCondition, field) {
|
|
32022
33147
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
32023
|
-
const modifierConfig = modifiers$
|
|
33148
|
+
const modifierConfig = modifiers$9[conditionModifier];
|
|
32024
33149
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
|
|
32025
33150
|
// @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
|
|
32026
33151
|
modifierConfig.modifier.deserialize(conditionValue)
|
|
@@ -32064,7 +33189,7 @@ const OTPFieldConditionCell = (props) => {
|
|
|
32064
33189
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
32065
33190
|
] });
|
|
32066
33191
|
};
|
|
32067
|
-
const modifiers$
|
|
33192
|
+
const modifiers$8 = {
|
|
32068
33193
|
equals: createConditionModifierConfig({
|
|
32069
33194
|
modifier: StringEqualsConditionModifier,
|
|
32070
33195
|
isValueValid: (_value) => true,
|
|
@@ -32093,13 +33218,11 @@ const modifiers$6 = {
|
|
|
32093
33218
|
class OTPFieldCondition extends BaseCondition {
|
|
32094
33219
|
constructor(options) {
|
|
32095
33220
|
super(options);
|
|
32096
|
-
__publicField(this, "
|
|
32097
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32098
|
-
__publicField(this, "modifiers", modifiers$6);
|
|
33221
|
+
__publicField(this, "modifiers", modifiers$8);
|
|
32099
33222
|
}
|
|
32100
33223
|
static deserialize(serializedCondition, field) {
|
|
32101
33224
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
32102
|
-
const modifierConfig = modifiers$
|
|
33225
|
+
const modifierConfig = modifiers$8[conditionModifier];
|
|
32103
33226
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
|
|
32104
33227
|
return new OTPFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
32105
33228
|
}
|
|
@@ -32107,6 +33230,117 @@ class OTPFieldCondition extends BaseCondition {
|
|
|
32107
33230
|
return /* @__PURE__ */ jsx(OTPFieldConditionCell, { condition: this, ...props }, this.id);
|
|
32108
33231
|
}
|
|
32109
33232
|
}
|
|
33233
|
+
const PassFailFieldConditionCell = (props) => {
|
|
33234
|
+
const { condition, onRemove } = props;
|
|
33235
|
+
const field = condition.field;
|
|
33236
|
+
const conditionValue = condition.getConditionValue();
|
|
33237
|
+
const conditionModifier = condition.getConditionModifier();
|
|
33238
|
+
const getFilterValueUi = () => {
|
|
33239
|
+
switch (conditionModifier) {
|
|
33240
|
+
case "equals":
|
|
33241
|
+
case "notEquals": {
|
|
33242
|
+
const equalsModifier = condition.modifiers.equals;
|
|
33243
|
+
const equalsFilterValue = conditionValue !== void 0 && equalsModifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
|
|
33244
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
33245
|
+
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children: /* @__PURE__ */ jsx(Button, { type: "button", className: "min-w-0 shrink-1 grow", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: equalsFilterValue !== void 0 ? equalsFilterValue ? passFailFieldStatusMapping[equalsFilterValue].label : "empty" : "..." }) }) }),
|
|
33246
|
+
/* @__PURE__ */ jsx(Menu.Content, { size: "sm", children: /* @__PURE__ */ jsx(
|
|
33247
|
+
Menu.SelectGroup,
|
|
33248
|
+
{
|
|
33249
|
+
required: false,
|
|
33250
|
+
value: equalsFilterValue,
|
|
33251
|
+
onValueChange: condition.setConditionValue,
|
|
33252
|
+
children: passFailFieldStatuses.map((status) => {
|
|
33253
|
+
const { label } = passFailFieldStatusMapping[status];
|
|
33254
|
+
return /* @__PURE__ */ jsx(SelectItemTemplate, { value: status, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: label }) }, status);
|
|
33255
|
+
})
|
|
33256
|
+
}
|
|
33257
|
+
) })
|
|
33258
|
+
] });
|
|
33259
|
+
}
|
|
33260
|
+
case "includes":
|
|
33261
|
+
case "excludes": {
|
|
33262
|
+
const includesModifier = condition.modifiers.includes;
|
|
33263
|
+
const includesModifierFilterValue = conditionValue !== void 0 && includesModifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
|
|
33264
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
33265
|
+
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children: /* @__PURE__ */ jsx(Button, { type: "button", children: includesModifierFilterValue ? `${includesModifierFilterValue.length} statuses` : "..." }) }),
|
|
33266
|
+
/* @__PURE__ */ jsx(Menu.Content, { size: "sm", children: /* @__PURE__ */ jsxs(
|
|
33267
|
+
Menu.MultiSelectGroup,
|
|
33268
|
+
{
|
|
33269
|
+
values: includesModifierFilterValue ?? EMPTY_ARRAY,
|
|
33270
|
+
onValuesChange: condition.setConditionValue,
|
|
33271
|
+
children: [
|
|
33272
|
+
/* @__PURE__ */ jsx(SelectAllItemTemplate, { children: "Select all" }),
|
|
33273
|
+
passFailFieldStatuses.map((status) => {
|
|
33274
|
+
const { label, icon } = passFailFieldStatusMapping[status];
|
|
33275
|
+
return /* @__PURE__ */ jsxs(MultiSelectItemTemplate, { value: status, children: [
|
|
33276
|
+
/* @__PURE__ */ jsx(LuIcon, { icon }),
|
|
33277
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: label })
|
|
33278
|
+
] }, status);
|
|
33279
|
+
})
|
|
33280
|
+
]
|
|
33281
|
+
}
|
|
33282
|
+
) })
|
|
33283
|
+
] });
|
|
33284
|
+
}
|
|
33285
|
+
}
|
|
33286
|
+
};
|
|
33287
|
+
return /* @__PURE__ */ jsxs(ButtonGroup, { className: "flex w-max max-w-full min-w-0 gap-0.5", size: "sm", variant: "fill", accentColor: "base", children: [
|
|
33288
|
+
/* @__PURE__ */ jsxs(Badge, { className: "min-w-0 shrink-1", size: "sm", variant: "fill", accentColor: "base", children: [
|
|
33289
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[field.type] }),
|
|
33290
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: field.label || UNLABELLED_FIELD_LABEL })
|
|
33291
|
+
] }),
|
|
33292
|
+
/* @__PURE__ */ jsx(ConditionModifierDropdown, { condition, children: /* @__PURE__ */ jsx(Button, { type: "button", children: condition.modifiers[conditionModifier].modifier.label }) }),
|
|
33293
|
+
getFilterValueUi(),
|
|
33294
|
+
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
33295
|
+
] });
|
|
33296
|
+
};
|
|
33297
|
+
const modifiers$7 = {
|
|
33298
|
+
equals: createConditionModifierConfig({
|
|
33299
|
+
modifier: PassFailEqualsConditionModifier,
|
|
33300
|
+
isValueValid: (value) => value !== null,
|
|
33301
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "string",
|
|
33302
|
+
isSerializedValueValid: (serializedConditionValue) => typeof serializedConditionValue === "string"
|
|
33303
|
+
}),
|
|
33304
|
+
notEquals: createConditionModifierConfig({
|
|
33305
|
+
modifier: PassFailNotEqualsConditionModifier,
|
|
33306
|
+
isValueValid: (value) => value !== null,
|
|
33307
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "string",
|
|
33308
|
+
isSerializedValueValid: (serializedConditionValue) => typeof serializedConditionValue === "string"
|
|
33309
|
+
}),
|
|
33310
|
+
includes: createConditionModifierConfig({
|
|
33311
|
+
modifier: PassFailArrayIncludesConditionModifier,
|
|
33312
|
+
isValueValid: (value) => value !== null,
|
|
33313
|
+
isConditionValueValid: (conditionValue) => Array.isArray(conditionValue),
|
|
33314
|
+
isSerializedValueValid: (serializedConditionValue) => Array.isArray(serializedConditionValue)
|
|
33315
|
+
}),
|
|
33316
|
+
excludes: createConditionModifierConfig({
|
|
33317
|
+
modifier: PassFailArrayExcludesConditionModifier,
|
|
33318
|
+
isValueValid: (value) => value !== null,
|
|
33319
|
+
isConditionValueValid: (conditionValue) => Array.isArray(conditionValue),
|
|
33320
|
+
isSerializedValueValid: (serializedConditionValue) => Array.isArray(serializedConditionValue)
|
|
33321
|
+
})
|
|
33322
|
+
};
|
|
33323
|
+
class PassFailFieldCondition extends BaseCondition {
|
|
33324
|
+
constructor(options) {
|
|
33325
|
+
super(options);
|
|
33326
|
+
__publicField(this, "modifiers", modifiers$7);
|
|
33327
|
+
}
|
|
33328
|
+
static deserialize(serializedCondition, field) {
|
|
33329
|
+
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
33330
|
+
const modifierConfig = modifiers$7[conditionModifier];
|
|
33331
|
+
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
|
|
33332
|
+
// @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
|
|
33333
|
+
modifierConfig.modifier.deserialize(conditionValue)
|
|
33334
|
+
) : void 0;
|
|
33335
|
+
return new PassFailFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
33336
|
+
}
|
|
33337
|
+
transformValue(value) {
|
|
33338
|
+
return value.status;
|
|
33339
|
+
}
|
|
33340
|
+
render(props) {
|
|
33341
|
+
return /* @__PURE__ */ jsx(PassFailFieldConditionCell, { condition: this, ...props }, this.id);
|
|
33342
|
+
}
|
|
33343
|
+
}
|
|
32110
33344
|
const RadioFieldConditionCell = (props) => {
|
|
32111
33345
|
const { condition, onRemove } = props;
|
|
32112
33346
|
const field = condition.field;
|
|
@@ -32127,16 +33361,6 @@ const RadioFieldConditionCell = (props) => {
|
|
|
32127
33361
|
}
|
|
32128
33362
|
return mapping;
|
|
32129
33363
|
}, [normalizedOptions]);
|
|
32130
|
-
const handleValuesChange = useCallback(
|
|
32131
|
-
(values) => {
|
|
32132
|
-
if (values.length > 0) {
|
|
32133
|
-
condition.setConditionValue(values);
|
|
32134
|
-
} else {
|
|
32135
|
-
condition.setConditionValue([]);
|
|
32136
|
-
}
|
|
32137
|
-
},
|
|
32138
|
-
[condition]
|
|
32139
|
-
);
|
|
32140
33364
|
const getFilterValueUi = () => {
|
|
32141
33365
|
switch (conditionModifier) {
|
|
32142
33366
|
case "equals":
|
|
@@ -32166,8 +33390,8 @@ const RadioFieldConditionCell = (props) => {
|
|
|
32166
33390
|
SelectFieldOptionMultiSelectGroup,
|
|
32167
33391
|
{
|
|
32168
33392
|
selectFieldOptions: field.options,
|
|
32169
|
-
values: includesModifierFilterValue ??
|
|
32170
|
-
onValuesChange:
|
|
33393
|
+
values: includesModifierFilterValue ?? EMPTY_ARRAY,
|
|
33394
|
+
onValuesChange: condition.setConditionValue
|
|
32171
33395
|
}
|
|
32172
33396
|
) })
|
|
32173
33397
|
] });
|
|
@@ -32184,7 +33408,7 @@ const RadioFieldConditionCell = (props) => {
|
|
|
32184
33408
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
32185
33409
|
] });
|
|
32186
33410
|
};
|
|
32187
|
-
const modifiers$
|
|
33411
|
+
const modifiers$6 = {
|
|
32188
33412
|
equals: createConditionModifierConfig({
|
|
32189
33413
|
modifier: StringEqualsConditionModifier,
|
|
32190
33414
|
isValueValid: (value) => typeof value === "string",
|
|
@@ -32213,13 +33437,11 @@ const modifiers$5 = {
|
|
|
32213
33437
|
class RadioFieldCondition extends BaseCondition {
|
|
32214
33438
|
constructor(options) {
|
|
32215
33439
|
super(options);
|
|
32216
|
-
__publicField(this, "
|
|
32217
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32218
|
-
__publicField(this, "modifiers", modifiers$5);
|
|
33440
|
+
__publicField(this, "modifiers", modifiers$6);
|
|
32219
33441
|
}
|
|
32220
33442
|
static deserialize(serializedCondition, field) {
|
|
32221
33443
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
32222
|
-
const modifierConfig = modifiers$
|
|
33444
|
+
const modifierConfig = modifiers$6[conditionModifier];
|
|
32223
33445
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
|
|
32224
33446
|
// @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
|
|
32225
33447
|
modifierConfig.modifier.deserialize(conditionValue)
|
|
@@ -32230,6 +33452,146 @@ class RadioFieldCondition extends BaseCondition {
|
|
|
32230
33452
|
return /* @__PURE__ */ jsx(RadioFieldConditionCell, { condition: this, ...props }, this.id);
|
|
32231
33453
|
}
|
|
32232
33454
|
}
|
|
33455
|
+
const RatingFieldConditionCell = (props) => {
|
|
33456
|
+
const { condition, onRemove } = props;
|
|
33457
|
+
const field = condition.field;
|
|
33458
|
+
const conditionValue = condition.getConditionValue();
|
|
33459
|
+
const conditionModifier = condition.getConditionModifier();
|
|
33460
|
+
const getFilterValueUi = () => {
|
|
33461
|
+
switch (conditionModifier) {
|
|
33462
|
+
case "equals":
|
|
33463
|
+
case "notEquals":
|
|
33464
|
+
case "greaterThanOrEquals":
|
|
33465
|
+
case "lessThanOrEquals":
|
|
33466
|
+
case "greaterThan":
|
|
33467
|
+
case "lessThan": {
|
|
33468
|
+
const modifier = condition.modifiers[conditionModifier];
|
|
33469
|
+
const filterValue = conditionValue !== void 0 && modifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
|
|
33470
|
+
return /* @__PURE__ */ jsx(
|
|
33471
|
+
NumberInputPopover,
|
|
33472
|
+
{
|
|
33473
|
+
value: filterValue ?? null,
|
|
33474
|
+
onValueChange: (value) => condition.setConditionValue(value ?? void 0),
|
|
33475
|
+
size: "sm",
|
|
33476
|
+
children: /* @__PURE__ */ jsx(Button, { type: "button", className: "truncate", children: filterValue !== void 0 ? filterValue : "..." })
|
|
33477
|
+
}
|
|
33478
|
+
);
|
|
33479
|
+
}
|
|
33480
|
+
case "inRange":
|
|
33481
|
+
case "notInRange": {
|
|
33482
|
+
const inRangeModifier = condition.modifiers.inRange;
|
|
33483
|
+
const rangeFilterValue = conditionValue !== void 0 && inRangeModifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
|
|
33484
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
33485
|
+
/* @__PURE__ */ jsx(
|
|
33486
|
+
NumberInputPopover,
|
|
33487
|
+
{
|
|
33488
|
+
value: (rangeFilterValue == null ? void 0 : rangeFilterValue.from) ?? null,
|
|
33489
|
+
onValueChange: (value) => {
|
|
33490
|
+
condition.setConditionValue({
|
|
33491
|
+
from: value,
|
|
33492
|
+
to: (rangeFilterValue == null ? void 0 : rangeFilterValue.to) ?? null
|
|
33493
|
+
});
|
|
33494
|
+
},
|
|
33495
|
+
size: "sm",
|
|
33496
|
+
children: /* @__PURE__ */ jsx(Button, { className: "truncate", children: (rangeFilterValue == null ? void 0 : rangeFilterValue.from) ?? "..." })
|
|
33497
|
+
}
|
|
33498
|
+
),
|
|
33499
|
+
/* @__PURE__ */ jsx(
|
|
33500
|
+
NumberInputPopover,
|
|
33501
|
+
{
|
|
33502
|
+
value: (rangeFilterValue == null ? void 0 : rangeFilterValue.to) ?? null,
|
|
33503
|
+
onValueChange: (value) => {
|
|
33504
|
+
condition.setConditionValue({
|
|
33505
|
+
from: (rangeFilterValue == null ? void 0 : rangeFilterValue.from) ?? null,
|
|
33506
|
+
to: value
|
|
33507
|
+
});
|
|
33508
|
+
},
|
|
33509
|
+
size: "sm",
|
|
33510
|
+
children: /* @__PURE__ */ jsx(Button, { className: "truncate", children: (rangeFilterValue == null ? void 0 : rangeFilterValue.to) ?? "..." })
|
|
33511
|
+
}
|
|
33512
|
+
)
|
|
33513
|
+
] });
|
|
33514
|
+
}
|
|
33515
|
+
}
|
|
33516
|
+
};
|
|
33517
|
+
return /* @__PURE__ */ jsxs(ButtonGroup, { className: "flex w-max max-w-full min-w-0 gap-0.5", size: "sm", variant: "fill", accentColor: "base", children: [
|
|
33518
|
+
/* @__PURE__ */ jsxs(Badge, { className: "min-w-0 shrink-1", size: "sm", variant: "fill", accentColor: "base", children: [
|
|
33519
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[field.type] }),
|
|
33520
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: field.label || UNLABELLED_FIELD_LABEL })
|
|
33521
|
+
] }),
|
|
33522
|
+
/* @__PURE__ */ jsx(ConditionModifierDropdown, { condition, children: /* @__PURE__ */ jsx(Button, { type: "button", children: condition.modifiers[conditionModifier].modifier.label }) }),
|
|
33523
|
+
getFilterValueUi(),
|
|
33524
|
+
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
33525
|
+
] });
|
|
33526
|
+
};
|
|
33527
|
+
const modifiers$5 = {
|
|
33528
|
+
equals: createConditionModifierConfig({
|
|
33529
|
+
modifier: NumberEqualsConditionModifier,
|
|
33530
|
+
isValueValid: (value) => typeof value === "number",
|
|
33531
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33532
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33533
|
+
}),
|
|
33534
|
+
notEquals: createConditionModifierConfig({
|
|
33535
|
+
modifier: NumberNotEqualsConditionModifier,
|
|
33536
|
+
isValueValid: (value) => typeof value === "number",
|
|
33537
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33538
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33539
|
+
}),
|
|
33540
|
+
lessThan: createConditionModifierConfig({
|
|
33541
|
+
modifier: NumberLessThanConditionModifier,
|
|
33542
|
+
isValueValid: (value) => typeof value === "number",
|
|
33543
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33544
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33545
|
+
}),
|
|
33546
|
+
lessThanOrEquals: createConditionModifierConfig({
|
|
33547
|
+
modifier: NumberLessThanOrEqualsConditionModifier,
|
|
33548
|
+
isValueValid: (value) => typeof value === "number",
|
|
33549
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33550
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33551
|
+
}),
|
|
33552
|
+
greaterThan: createConditionModifierConfig({
|
|
33553
|
+
modifier: NumberGreaterThanConditionModifier,
|
|
33554
|
+
isValueValid: (value) => typeof value === "number",
|
|
33555
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33556
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33557
|
+
}),
|
|
33558
|
+
greaterThanOrEquals: createConditionModifierConfig({
|
|
33559
|
+
modifier: NumberGreaterThanOrEqualsConditionModifier,
|
|
33560
|
+
isValueValid: (value) => typeof value === "number",
|
|
33561
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33562
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33563
|
+
}),
|
|
33564
|
+
inRange: createConditionModifierConfig({
|
|
33565
|
+
modifier: NumberRangeInConditionModifier,
|
|
33566
|
+
isValueValid: (value) => typeof value === "number",
|
|
33567
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "object",
|
|
33568
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "object"
|
|
33569
|
+
}),
|
|
33570
|
+
notInRange: createConditionModifierConfig({
|
|
33571
|
+
modifier: NumberRangeNotInConditionModifier,
|
|
33572
|
+
isValueValid: (value) => typeof value === "number",
|
|
33573
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "object",
|
|
33574
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "object"
|
|
33575
|
+
})
|
|
33576
|
+
};
|
|
33577
|
+
class RatingFieldCondition extends BaseCondition {
|
|
33578
|
+
constructor(options) {
|
|
33579
|
+
super(options);
|
|
33580
|
+
__publicField(this, "modifiers", modifiers$5);
|
|
33581
|
+
}
|
|
33582
|
+
static deserialize(serializedCondition, field) {
|
|
33583
|
+
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
33584
|
+
const modifierConfig = modifiers$5[conditionModifier];
|
|
33585
|
+
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
|
|
33586
|
+
// @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
|
|
33587
|
+
modifierConfig.modifier.deserialize(conditionValue)
|
|
33588
|
+
) : void 0;
|
|
33589
|
+
return new RatingFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
33590
|
+
}
|
|
33591
|
+
render(props) {
|
|
33592
|
+
return /* @__PURE__ */ jsx(RatingFieldConditionCell, { condition: this, ...props }, this.id);
|
|
33593
|
+
}
|
|
33594
|
+
}
|
|
32233
33595
|
const ScanFieldConditionCell = (props) => {
|
|
32234
33596
|
const { condition, onRemove } = props;
|
|
32235
33597
|
const field = condition.field;
|
|
@@ -32292,8 +33654,6 @@ const modifiers$4 = {
|
|
|
32292
33654
|
class ScanFieldCondition extends BaseCondition {
|
|
32293
33655
|
constructor(options) {
|
|
32294
33656
|
super(options);
|
|
32295
|
-
__publicField(this, "defaultConditionValue");
|
|
32296
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32297
33657
|
__publicField(this, "modifiers", modifiers$4);
|
|
32298
33658
|
}
|
|
32299
33659
|
static deserialize(serializedCondition, field) {
|
|
@@ -32412,8 +33772,6 @@ const modifiers$3 = {
|
|
|
32412
33772
|
class SelectFieldCondition extends BaseCondition {
|
|
32413
33773
|
constructor(options) {
|
|
32414
33774
|
super(options);
|
|
32415
|
-
__publicField(this, "defaultConditionValue");
|
|
32416
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32417
33775
|
__publicField(this, "modifiers", modifiers$3);
|
|
32418
33776
|
}
|
|
32419
33777
|
static deserialize(serializedCondition, field) {
|
|
@@ -32491,8 +33849,6 @@ const modifiers$2 = {
|
|
|
32491
33849
|
class StringFieldCondition extends BaseCondition {
|
|
32492
33850
|
constructor(options) {
|
|
32493
33851
|
super(options);
|
|
32494
|
-
__publicField(this, "defaultConditionValue");
|
|
32495
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32496
33852
|
__publicField(this, "modifiers", modifiers$2);
|
|
32497
33853
|
}
|
|
32498
33854
|
static deserialize(serializedCondition, field) {
|
|
@@ -32567,8 +33923,6 @@ const modifiers$1 = {
|
|
|
32567
33923
|
class TextFieldCondition extends BaseCondition {
|
|
32568
33924
|
constructor(options) {
|
|
32569
33925
|
super(options);
|
|
32570
|
-
__publicField(this, "defaultConditionValue");
|
|
32571
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32572
33926
|
__publicField(this, "modifiers", modifiers$1);
|
|
32573
33927
|
}
|
|
32574
33928
|
static deserialize(serializedCondition, field) {
|
|
@@ -32639,8 +33993,6 @@ const modifiers = {
|
|
|
32639
33993
|
class UploadFieldCondition extends BaseCondition {
|
|
32640
33994
|
constructor(options) {
|
|
32641
33995
|
super(options);
|
|
32642
|
-
__publicField(this, "defaultConditionValue");
|
|
32643
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32644
33996
|
__publicField(this, "modifiers", modifiers);
|
|
32645
33997
|
}
|
|
32646
33998
|
static deserialize(serializedCondition, field) {
|
|
@@ -32653,43 +34005,35 @@ class UploadFieldCondition extends BaseCondition {
|
|
|
32653
34005
|
return /* @__PURE__ */ jsx(UploadFieldConditionCell, { condition: this, ...props }, this.id);
|
|
32654
34006
|
}
|
|
32655
34007
|
}
|
|
32656
|
-
const
|
|
32657
|
-
|
|
32658
|
-
|
|
32659
|
-
|
|
32660
|
-
|
|
32661
|
-
|
|
32662
|
-
|
|
32663
|
-
|
|
32664
|
-
|
|
32665
|
-
|
|
32666
|
-
|
|
32667
|
-
|
|
32668
|
-
|
|
32669
|
-
|
|
32670
|
-
|
|
32671
|
-
|
|
32672
|
-
|
|
32673
|
-
|
|
32674
|
-
|
|
32675
|
-
|
|
32676
|
-
|
|
32677
|
-
return ScanFieldCondition.deserialize(serializedCondition, field);
|
|
32678
|
-
case "radio":
|
|
32679
|
-
return RadioFieldCondition.deserialize(serializedCondition, field);
|
|
32680
|
-
case "checkbox-list":
|
|
32681
|
-
return CheckboxListFieldCondition.deserialize(serializedCondition, field);
|
|
32682
|
-
case "otp":
|
|
32683
|
-
return OTPFieldCondition.deserialize(serializedCondition, field);
|
|
32684
|
-
}
|
|
34008
|
+
const ConditionTypeToClsMapping = {
|
|
34009
|
+
date: DateFieldCondition,
|
|
34010
|
+
number: NumberFieldCondition,
|
|
34011
|
+
boolean: BooleanFieldCondition,
|
|
34012
|
+
select: SelectFieldCondition,
|
|
34013
|
+
string: StringFieldCondition,
|
|
34014
|
+
text: TextFieldCondition,
|
|
34015
|
+
upload: UploadFieldCondition,
|
|
34016
|
+
qr: ScanFieldCondition,
|
|
34017
|
+
"multi-string": MultiStringFieldCondition,
|
|
34018
|
+
"multi-select": MultiSelectFieldCondition,
|
|
34019
|
+
radio: RadioFieldCondition,
|
|
34020
|
+
"checkbox-list": CheckboxListFieldCondition,
|
|
34021
|
+
"pass-fail": PassFailFieldCondition,
|
|
34022
|
+
otp: OTPFieldCondition,
|
|
34023
|
+
rating: RatingFieldCondition
|
|
34024
|
+
};
|
|
34025
|
+
const deserializeCondition = (field, serializedCondition) => {
|
|
34026
|
+
if (field.type !== serializedCondition.type)
|
|
34027
|
+
throw new Error(`field and condition type mismatch ${field.type} !== ${serializedCondition.type}`);
|
|
34028
|
+
return ConditionTypeToClsMapping[serializedCondition.type].deserialize(serializedCondition, field);
|
|
32685
34029
|
};
|
|
32686
|
-
const deserializeConditions = (
|
|
34030
|
+
const deserializeConditions = (fields, serializedConditions) => {
|
|
32687
34031
|
const fieldsMapping = {};
|
|
32688
34032
|
for (const field of fields) {
|
|
32689
34033
|
fieldsMapping[field.identifier] = field;
|
|
32690
34034
|
}
|
|
32691
34035
|
return serializedConditions.map(
|
|
32692
|
-
(serializedCondition) => deserializeCondition(
|
|
34036
|
+
(serializedCondition) => deserializeCondition(fieldsMapping[serializedCondition.fieldId], serializedCondition)
|
|
32693
34037
|
);
|
|
32694
34038
|
};
|
|
32695
34039
|
const applyConditions = (conditions, values) => {
|
|
@@ -32697,35 +34041,53 @@ const applyConditions = (conditions, values) => {
|
|
|
32697
34041
|
return condition.apply(values[condition.field.identifier]);
|
|
32698
34042
|
}) : true;
|
|
32699
34043
|
};
|
|
32700
|
-
|
|
32701
|
-
|
|
32702
|
-
|
|
32703
|
-
|
|
32704
|
-
|
|
32705
|
-
|
|
32706
|
-
|
|
32707
|
-
|
|
32708
|
-
|
|
32709
|
-
|
|
32710
|
-
|
|
32711
|
-
|
|
32712
|
-
|
|
32713
|
-
return MultiStringField.deserialize(serializedField);
|
|
32714
|
-
case "multi-select":
|
|
32715
|
-
return MultiSelectField.deserialize(serializedField);
|
|
32716
|
-
case "upload":
|
|
32717
|
-
return UploadField.deserialize(serializedField);
|
|
32718
|
-
case "qr":
|
|
32719
|
-
return ScanField.deserialize(serializedField);
|
|
32720
|
-
case "radio":
|
|
32721
|
-
return RadioField.deserialize(serializedField);
|
|
32722
|
-
case "checkbox-list":
|
|
32723
|
-
return CheckboxListField.deserialize(serializedField);
|
|
32724
|
-
case "string":
|
|
32725
|
-
return StringField.deserialize(serializedField);
|
|
32726
|
-
case "otp":
|
|
32727
|
-
return OTPField.deserialize(serializedField);
|
|
34044
|
+
class ConditionManager extends Observable {
|
|
34045
|
+
constructor(conditions) {
|
|
34046
|
+
super();
|
|
34047
|
+
__publicField(this, "conditions");
|
|
34048
|
+
__publicField(this, "conditionObserver", () => {
|
|
34049
|
+
this.conditions = [...this.conditions];
|
|
34050
|
+
this.notify(this);
|
|
34051
|
+
});
|
|
34052
|
+
__publicField(this, "initConditions", (conditions) => {
|
|
34053
|
+
for (const c of conditions) c.observe(this.conditionObserver);
|
|
34054
|
+
return conditions;
|
|
34055
|
+
});
|
|
34056
|
+
this.conditions = this.initConditions(conditions);
|
|
32728
34057
|
}
|
|
34058
|
+
getConditions() {
|
|
34059
|
+
return this.conditions;
|
|
34060
|
+
}
|
|
34061
|
+
addCondition(condition) {
|
|
34062
|
+
this.conditions = this.initConditions([...this.conditions, condition]);
|
|
34063
|
+
this.notify(this);
|
|
34064
|
+
}
|
|
34065
|
+
addConditions(conditions) {
|
|
34066
|
+
this.conditions = this.initConditions([...this.conditions, ...conditions]);
|
|
34067
|
+
this.notify(this);
|
|
34068
|
+
}
|
|
34069
|
+
removeCondition(condition) {
|
|
34070
|
+
this.conditions = this.initConditions(this.conditions.filter((c) => c.id !== condition.id));
|
|
34071
|
+
this.notify(this);
|
|
34072
|
+
}
|
|
34073
|
+
removeConditions(conditions) {
|
|
34074
|
+
const conditionIds = new Set(conditions.map((c) => c.id));
|
|
34075
|
+
this.conditions = this.initConditions(this.conditions.filter((c) => !conditionIds.has(c.id)));
|
|
34076
|
+
this.notify(this);
|
|
34077
|
+
}
|
|
34078
|
+
applyConditions(values) {
|
|
34079
|
+
return applyConditions(this.conditions, values);
|
|
34080
|
+
}
|
|
34081
|
+
}
|
|
34082
|
+
const useConditionManager = (conditions, onConditionsChange) => {
|
|
34083
|
+
return useMemo(() => {
|
|
34084
|
+
const ret = new ConditionManager(conditions);
|
|
34085
|
+
ret.observe((conditionManager) => onConditionsChange(conditionManager.getConditions()));
|
|
34086
|
+
return ret;
|
|
34087
|
+
}, [conditions, onConditionsChange]);
|
|
34088
|
+
};
|
|
34089
|
+
const deserializeField = (serializedField) => {
|
|
34090
|
+
return FieldTypeToClsMapping[serializedField.type].deserialize(serializedField);
|
|
32729
34091
|
};
|
|
32730
34092
|
function deserializeFields(fields) {
|
|
32731
34093
|
return fields.map(deserialize);
|
|
@@ -32800,6 +34162,85 @@ function cleanSerializedFieldValues(fields, values) {
|
|
|
32800
34162
|
}
|
|
32801
34163
|
return ret;
|
|
32802
34164
|
}
|
|
34165
|
+
function extractFilesAndPromisesFromFieldValues(fields, values) {
|
|
34166
|
+
const cleanValues = cleanFieldValues(fields, values);
|
|
34167
|
+
const valuesRet = {};
|
|
34168
|
+
const filesRet = {};
|
|
34169
|
+
for (const field of fields) {
|
|
34170
|
+
if (!(field.identifier in cleanValues)) continue;
|
|
34171
|
+
const value = cleanValues[field.identifier];
|
|
34172
|
+
switch (field.type) {
|
|
34173
|
+
case "upload":
|
|
34174
|
+
if (!field.isValueValid(value)) break;
|
|
34175
|
+
filesRet[field.identifier] = value;
|
|
34176
|
+
valuesRet[field.identifier] = [];
|
|
34177
|
+
break;
|
|
34178
|
+
case "pass-fail":
|
|
34179
|
+
if (!field.isValueValid(value)) break;
|
|
34180
|
+
filesRet[field.identifier] = value.files;
|
|
34181
|
+
valuesRet[field.identifier] = {
|
|
34182
|
+
...value,
|
|
34183
|
+
files: []
|
|
34184
|
+
};
|
|
34185
|
+
break;
|
|
34186
|
+
default:
|
|
34187
|
+
valuesRet[field.identifier] = values[field.identifier];
|
|
34188
|
+
}
|
|
34189
|
+
}
|
|
34190
|
+
return [valuesRet, filesRet];
|
|
34191
|
+
}
|
|
34192
|
+
function insertFilesAndPromisesToFieldValues(fields, values, filesAndPromises) {
|
|
34193
|
+
const ret = {};
|
|
34194
|
+
for (const field of fields) {
|
|
34195
|
+
if (!(field.identifier in values)) continue;
|
|
34196
|
+
const value = values[field.identifier];
|
|
34197
|
+
switch (field.type) {
|
|
34198
|
+
case "upload":
|
|
34199
|
+
if (!field.isValueValid(value)) break;
|
|
34200
|
+
ret[field.identifier] = filesAndPromises[field.identifier] ?? [];
|
|
34201
|
+
break;
|
|
34202
|
+
case "pass-fail":
|
|
34203
|
+
if (!field.isValueValid(value)) break;
|
|
34204
|
+
ret[field.identifier] = {
|
|
34205
|
+
...value,
|
|
34206
|
+
files: filesAndPromises[field.identifier] ?? []
|
|
34207
|
+
};
|
|
34208
|
+
break;
|
|
34209
|
+
default:
|
|
34210
|
+
if (!field.isValueValid(value)) break;
|
|
34211
|
+
ret[field.identifier] = value;
|
|
34212
|
+
}
|
|
34213
|
+
}
|
|
34214
|
+
return ret;
|
|
34215
|
+
}
|
|
34216
|
+
const initializeFieldValues = (fields, values) => {
|
|
34217
|
+
const ret = {};
|
|
34218
|
+
for (const field of fields) {
|
|
34219
|
+
const value = values[field.identifier];
|
|
34220
|
+
ret[field.identifier] = value !== void 0 ? value : field.blankValue();
|
|
34221
|
+
}
|
|
34222
|
+
return ret;
|
|
34223
|
+
};
|
|
34224
|
+
const changedFieldValues = (fields, values1, values2) => {
|
|
34225
|
+
const ret = {};
|
|
34226
|
+
for (const field of fields) {
|
|
34227
|
+
const value1 = values1[field.identifier];
|
|
34228
|
+
const value2 = values2[field.identifier];
|
|
34229
|
+
if (field.areValuesEqual(value1, value2)) continue;
|
|
34230
|
+
ret[field.identifier] = value2;
|
|
34231
|
+
}
|
|
34232
|
+
return ret;
|
|
34233
|
+
};
|
|
34234
|
+
const unchangedFieldValues = (fields, values1, values2) => {
|
|
34235
|
+
const ret = {};
|
|
34236
|
+
for (const field of fields) {
|
|
34237
|
+
const value1 = values1[field.identifier];
|
|
34238
|
+
const value2 = values2[field.identifier];
|
|
34239
|
+
if (!field.areValuesEqual(value1, value2)) continue;
|
|
34240
|
+
ret[field.identifier] = value2;
|
|
34241
|
+
}
|
|
34242
|
+
return ret;
|
|
34243
|
+
};
|
|
32803
34244
|
const RendererContext = createContext({});
|
|
32804
34245
|
const FieldSectionLayout = memo((props) => {
|
|
32805
34246
|
const { fieldSection: section, ...rest } = props;
|
|
@@ -32876,14 +34317,6 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
32876
34317
|
fields: this.fields.map((field) => field.serialize())
|
|
32877
34318
|
};
|
|
32878
34319
|
}
|
|
32879
|
-
static deserialize(data) {
|
|
32880
|
-
const fields = data.fields.map(deserializeField);
|
|
32881
|
-
const conditions = {};
|
|
32882
|
-
for (const [sectionId, serializedConditions] of Object.entries(data.conditions)) {
|
|
32883
|
-
conditions[sectionId] = deserializeConditions(serializedConditions, fields);
|
|
32884
|
-
}
|
|
32885
|
-
return new _FieldSection({ ...data, fields, conditions });
|
|
32886
|
-
}
|
|
32887
34320
|
getOptions() {
|
|
32888
34321
|
return {
|
|
32889
34322
|
...super.getOptions(),
|
|
@@ -32921,12 +34354,10 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
32921
34354
|
getFields() {
|
|
32922
34355
|
return this.fields;
|
|
32923
34356
|
}
|
|
32924
|
-
addField(field) {
|
|
32925
|
-
|
|
32926
|
-
|
|
32927
|
-
|
|
32928
|
-
addFields(fields) {
|
|
32929
|
-
this.fields = this.initFields([...this.fields, ...fields]);
|
|
34357
|
+
addField(field, index) {
|
|
34358
|
+
const copy = [...this.fields];
|
|
34359
|
+
copy.splice(index ?? this.fields.length, 0, field);
|
|
34360
|
+
this.fields = this.initFields(copy);
|
|
32930
34361
|
this.notify(this);
|
|
32931
34362
|
}
|
|
32932
34363
|
moveField(sourceIndex, targetIndex) {
|
|
@@ -32945,16 +34376,6 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
32945
34376
|
this.conditions = newConditions;
|
|
32946
34377
|
this.notify(this);
|
|
32947
34378
|
}
|
|
32948
|
-
removeFields(fields) {
|
|
32949
|
-
const fieldIdentifiers = new Set(fields.map(({ identifier }) => identifier));
|
|
32950
|
-
this.fields = this.initFields(this.fields.filter(({ identifier }) => !fieldIdentifiers.has(identifier)));
|
|
32951
|
-
const newConditions = {};
|
|
32952
|
-
for (const [sectionId, conditions] of Object.entries(this.conditions)) {
|
|
32953
|
-
newConditions[sectionId] = conditions.filter(({ field }) => !fieldIdentifiers.has(field.identifier));
|
|
32954
|
-
}
|
|
32955
|
-
this.conditions = newConditions;
|
|
32956
|
-
this.notify(this);
|
|
32957
|
-
}
|
|
32958
34379
|
getConditions(identifier) {
|
|
32959
34380
|
return this.conditions[identifier];
|
|
32960
34381
|
}
|
|
@@ -32991,7 +34412,10 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
32991
34412
|
return new Set(Object.keys(this.conditions));
|
|
32992
34413
|
}
|
|
32993
34414
|
addConditional(identifier) {
|
|
32994
|
-
this.conditions = this.initConditions({
|
|
34415
|
+
this.conditions = this.initConditions({
|
|
34416
|
+
...this.conditions,
|
|
34417
|
+
[identifier]: []
|
|
34418
|
+
});
|
|
32995
34419
|
this.notify(this);
|
|
32996
34420
|
}
|
|
32997
34421
|
removeConditional(identifier) {
|
|
@@ -33007,6 +34431,14 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
33007
34431
|
};
|
|
33008
34432
|
__publicField(_FieldSection, "fieldTypeName", "Section");
|
|
33009
34433
|
__publicField(_FieldSection, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
|
|
34434
|
+
__publicField(_FieldSection, "deserialize", (data) => {
|
|
34435
|
+
const fields = data.fields.map(deserializeField);
|
|
34436
|
+
const conditions = {};
|
|
34437
|
+
for (const [sectionId, serializedConditions] of Object.entries(data.conditions)) {
|
|
34438
|
+
conditions[sectionId] = deserializeConditions(fields, serializedConditions);
|
|
34439
|
+
}
|
|
34440
|
+
return new _FieldSection({ ...data, fields, conditions });
|
|
34441
|
+
});
|
|
33010
34442
|
let FieldSection = _FieldSection;
|
|
33011
34443
|
class FieldSchema extends Observable {
|
|
33012
34444
|
constructor(fields) {
|
|
@@ -33034,27 +34466,20 @@ class FieldSchema extends Observable {
|
|
|
33034
34466
|
getFieldSections() {
|
|
33035
34467
|
return this.fieldSections;
|
|
33036
34468
|
}
|
|
33037
|
-
addFieldSection(
|
|
33038
|
-
|
|
33039
|
-
|
|
33040
|
-
|
|
33041
|
-
addFieldSections(fields) {
|
|
33042
|
-
this.fieldSections = this.initFields([...this.fieldSections, ...fields]);
|
|
34469
|
+
addFieldSection(fieldSection, index) {
|
|
34470
|
+
const copy = [...this.fieldSections];
|
|
34471
|
+
copy.splice(index ?? this.fieldSections.length, 0, fieldSection);
|
|
34472
|
+
this.fieldSections = this.initFields(copy);
|
|
33043
34473
|
this.notify(this);
|
|
33044
34474
|
}
|
|
33045
|
-
removeFieldSection(
|
|
33046
|
-
const newFields = this.fieldSections.filter((f) => f.identifier !==
|
|
33047
|
-
for (const
|
|
33048
|
-
|
|
34475
|
+
removeFieldSection(fieldSection) {
|
|
34476
|
+
const newFields = this.fieldSections.filter((f) => f.identifier !== fieldSection.identifier);
|
|
34477
|
+
for (const field of newFields) {
|
|
34478
|
+
field.removeConditional(field.identifier);
|
|
33049
34479
|
}
|
|
33050
34480
|
this.fieldSections = this.initFields(newFields);
|
|
33051
34481
|
this.notify(this);
|
|
33052
34482
|
}
|
|
33053
|
-
removeFieldSections(fields) {
|
|
33054
|
-
const fieldsIds = new Set(fields.map((f) => f.identifier));
|
|
33055
|
-
this.fieldSections = this.initFields(this.fieldSections.filter((f) => !fieldsIds.has(f.identifier)));
|
|
33056
|
-
this.notify(this);
|
|
33057
|
-
}
|
|
33058
34483
|
moveFieldSection(sourceIndex, targetIndex) {
|
|
33059
34484
|
const newFields = [...this.fieldSections];
|
|
33060
34485
|
const [removedElement] = newFields.splice(sourceIndex, 1);
|
|
@@ -33068,44 +34493,70 @@ class FieldSchema extends Observable {
|
|
|
33068
34493
|
serializeValues(values) {
|
|
33069
34494
|
return serializeFieldValues(this.getFields(), values);
|
|
33070
34495
|
}
|
|
34496
|
+
deserializeConditions(conditions) {
|
|
34497
|
+
return deserializeConditions(this.getFields(), conditions);
|
|
34498
|
+
}
|
|
34499
|
+
initializeValues(values) {
|
|
34500
|
+
return initializeFieldValues(this.getFields(), values);
|
|
34501
|
+
}
|
|
33071
34502
|
}
|
|
33072
34503
|
const FieldSchemaContext = createContext(new FieldSchema([]));
|
|
33073
34504
|
const FormBuilderContext = createContext({});
|
|
34505
|
+
const useFieldTypeItems = (onSelect = () => null) => {
|
|
34506
|
+
return useMemo(() => {
|
|
34507
|
+
const entries = Object.entries(FieldTypeToClsMapping);
|
|
34508
|
+
return entries.map(([type, fieldClass]) => ({
|
|
34509
|
+
children: fieldClass.fieldTypeName,
|
|
34510
|
+
icon: /* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[type] }),
|
|
34511
|
+
value: type,
|
|
34512
|
+
onSelect: () => {
|
|
34513
|
+
onSelect(type);
|
|
34514
|
+
}
|
|
34515
|
+
}));
|
|
34516
|
+
}, [onSelect]);
|
|
34517
|
+
};
|
|
34518
|
+
const CreateFieldDropdownMenu = memo((props) => {
|
|
34519
|
+
const { children, variant, size, accentColor, onSelectFieldType, ...rest } = props;
|
|
34520
|
+
const fieldTypeItems = useFieldTypeItems(onSelectFieldType);
|
|
34521
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { ...rest, children: [
|
|
34522
|
+
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children }),
|
|
34523
|
+
/* @__PURE__ */ jsx(Menu.Content, { variant, size, accentColor, children: /* @__PURE__ */ jsx(Menu.Scroll, { children: fieldTypeItems.flat().map((item) => /* @__PURE__ */ jsxs(Menu.Item, { onSelect: item.onSelect, children: [
|
|
34524
|
+
item.icon,
|
|
34525
|
+
item.children
|
|
34526
|
+
] }, item.value)) }) })
|
|
34527
|
+
] });
|
|
34528
|
+
});
|
|
34529
|
+
CreateFieldDropdownMenu.displayName = "CreateFieldDropdownMenu";
|
|
33074
34530
|
const createField = (type) => {
|
|
33075
34531
|
switch (type) {
|
|
33076
34532
|
case "text":
|
|
33077
|
-
return new TextField({
|
|
34533
|
+
return new TextField({ label: "", required: false, identifier: v4() });
|
|
33078
34534
|
case "boolean":
|
|
33079
34535
|
return new BooleanField({
|
|
33080
|
-
fieldValidators: [],
|
|
33081
34536
|
label: "",
|
|
33082
34537
|
required: false,
|
|
33083
34538
|
identifier: v4()
|
|
33084
34539
|
});
|
|
33085
34540
|
case "number":
|
|
33086
34541
|
return new NumberField({
|
|
33087
|
-
fieldValidators: [],
|
|
33088
34542
|
label: "",
|
|
33089
34543
|
required: false,
|
|
33090
34544
|
identifier: v4()
|
|
33091
34545
|
});
|
|
33092
34546
|
case "date":
|
|
33093
34547
|
return new DateField({
|
|
33094
|
-
fieldValidators: [],
|
|
33095
34548
|
label: "",
|
|
33096
34549
|
required: false,
|
|
33097
34550
|
identifier: v4()
|
|
33098
34551
|
});
|
|
33099
34552
|
case "string":
|
|
33100
34553
|
return new StringField({
|
|
33101
|
-
fieldValidators: [],
|
|
33102
34554
|
label: "",
|
|
33103
34555
|
required: false,
|
|
33104
34556
|
identifier: v4()
|
|
33105
34557
|
});
|
|
33106
34558
|
case "select":
|
|
33107
34559
|
return new SelectField({
|
|
33108
|
-
fieldValidators: [],
|
|
33109
34560
|
label: "",
|
|
33110
34561
|
options: [],
|
|
33111
34562
|
required: false,
|
|
@@ -33113,14 +34564,12 @@ const createField = (type) => {
|
|
|
33113
34564
|
});
|
|
33114
34565
|
case "multi-string":
|
|
33115
34566
|
return new MultiStringField({
|
|
33116
|
-
fieldValidators: [],
|
|
33117
34567
|
label: "",
|
|
33118
34568
|
required: false,
|
|
33119
34569
|
identifier: v4()
|
|
33120
34570
|
});
|
|
33121
34571
|
case "multi-select":
|
|
33122
34572
|
return new MultiSelectField({
|
|
33123
|
-
fieldValidators: [],
|
|
33124
34573
|
label: "",
|
|
33125
34574
|
options: [],
|
|
33126
34575
|
required: false,
|
|
@@ -33128,21 +34577,20 @@ const createField = (type) => {
|
|
|
33128
34577
|
});
|
|
33129
34578
|
case "upload":
|
|
33130
34579
|
return new UploadField({
|
|
33131
|
-
fieldValidators: [],
|
|
33132
34580
|
label: "",
|
|
33133
34581
|
required: false,
|
|
33134
|
-
identifier: v4()
|
|
34582
|
+
identifier: v4(),
|
|
34583
|
+
maximum_files: 6,
|
|
34584
|
+
maximum_size: maxFileSizeMB
|
|
33135
34585
|
});
|
|
33136
34586
|
case "qr":
|
|
33137
34587
|
return new ScanField({
|
|
33138
|
-
fieldValidators: [],
|
|
33139
34588
|
label: "",
|
|
33140
34589
|
required: false,
|
|
33141
34590
|
identifier: v4()
|
|
33142
34591
|
});
|
|
33143
34592
|
case "radio":
|
|
33144
34593
|
return new RadioField({
|
|
33145
|
-
fieldValidators: [],
|
|
33146
34594
|
label: "",
|
|
33147
34595
|
options: [],
|
|
33148
34596
|
required: false,
|
|
@@ -33150,21 +34598,34 @@ const createField = (type) => {
|
|
|
33150
34598
|
});
|
|
33151
34599
|
case "checkbox-list":
|
|
33152
34600
|
return new CheckboxListField({
|
|
33153
|
-
fieldValidators: [],
|
|
33154
34601
|
label: "",
|
|
33155
34602
|
options: [],
|
|
33156
34603
|
required: false,
|
|
33157
34604
|
identifier: v4()
|
|
33158
34605
|
});
|
|
34606
|
+
case "pass-fail":
|
|
34607
|
+
return new PassFailField({
|
|
34608
|
+
label: "",
|
|
34609
|
+
required: false,
|
|
34610
|
+
identifier: v4(),
|
|
34611
|
+
showNotesAndFilesOn: ["fail"]
|
|
34612
|
+
// TODO: what defaults
|
|
34613
|
+
});
|
|
33159
34614
|
case "otp":
|
|
33160
34615
|
return new OTPField({
|
|
33161
|
-
fieldValidators: [],
|
|
33162
34616
|
label: "",
|
|
33163
34617
|
validationType: "none",
|
|
33164
34618
|
required: false,
|
|
33165
34619
|
identifier: v4(),
|
|
33166
34620
|
length: 6
|
|
33167
34621
|
});
|
|
34622
|
+
case "rating":
|
|
34623
|
+
return new RatingField({
|
|
34624
|
+
label: "",
|
|
34625
|
+
required: false,
|
|
34626
|
+
identifier: v4(),
|
|
34627
|
+
maxRating: 5
|
|
34628
|
+
});
|
|
33168
34629
|
}
|
|
33169
34630
|
};
|
|
33170
34631
|
const createCondition = (field) => {
|
|
@@ -33248,6 +34709,13 @@ const createCondition = (field) => {
|
|
|
33248
34709
|
conditionModifier: "equals",
|
|
33249
34710
|
field
|
|
33250
34711
|
});
|
|
34712
|
+
case "pass-fail":
|
|
34713
|
+
return new PassFailFieldCondition({
|
|
34714
|
+
id: v4(),
|
|
34715
|
+
conditionValue: void 0,
|
|
34716
|
+
conditionModifier: "equals",
|
|
34717
|
+
field
|
|
34718
|
+
});
|
|
33251
34719
|
case "otp":
|
|
33252
34720
|
return new OTPFieldCondition({
|
|
33253
34721
|
id: v4(),
|
|
@@ -33255,6 +34723,13 @@ const createCondition = (field) => {
|
|
|
33255
34723
|
conditionModifier: "equals",
|
|
33256
34724
|
field
|
|
33257
34725
|
});
|
|
34726
|
+
case "rating":
|
|
34727
|
+
return new RatingFieldCondition({
|
|
34728
|
+
id: v4(),
|
|
34729
|
+
conditionValue: void 0,
|
|
34730
|
+
conditionModifier: "equals",
|
|
34731
|
+
field
|
|
34732
|
+
});
|
|
33258
34733
|
}
|
|
33259
34734
|
};
|
|
33260
34735
|
const getFieldCreationSchema = (type, path) => {
|
|
@@ -33275,8 +34750,12 @@ const getFieldCreationSchema = (type, path) => {
|
|
|
33275
34750
|
return TextField.getFieldCreationSchema(path);
|
|
33276
34751
|
case "upload":
|
|
33277
34752
|
return UploadField.getFieldCreationSchema(path);
|
|
34753
|
+
case "pass-fail":
|
|
34754
|
+
return PassFailField.getFieldCreationSchema(path);
|
|
33278
34755
|
case "otp":
|
|
33279
34756
|
return OTPField.getFieldCreationSchema(path);
|
|
34757
|
+
case "rating":
|
|
34758
|
+
return RatingField.getFieldCreationSchema(path);
|
|
33280
34759
|
default:
|
|
33281
34760
|
return;
|
|
33282
34761
|
}
|
|
@@ -33294,7 +34773,7 @@ const FieldSettingsPopover = memo((props) => {
|
|
|
33294
34773
|
accentColor: "base",
|
|
33295
34774
|
...hasError && { color: SEVERITY_COLOR_MAPPING.danger },
|
|
33296
34775
|
children: [
|
|
33297
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
34776
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Settings }),
|
|
33298
34777
|
"Settings"
|
|
33299
34778
|
]
|
|
33300
34779
|
},
|
|
@@ -33305,7 +34784,7 @@ const FieldSettingsPopover = memo((props) => {
|
|
|
33305
34784
|
});
|
|
33306
34785
|
FieldSettingsPopover.displayName = "FieldSettingsPopover";
|
|
33307
34786
|
const FieldBuilder = memo((props) => {
|
|
33308
|
-
const { parentPath,
|
|
34787
|
+
const { parentPath, fieldIndex, field } = props;
|
|
33309
34788
|
const { errors } = useFormikContext();
|
|
33310
34789
|
const openImageViewer = useImageViewer();
|
|
33311
34790
|
const { disableRequiredFields } = use(FormBuilderContext);
|
|
@@ -33321,17 +34800,16 @@ const FieldBuilder = memo((props) => {
|
|
|
33321
34800
|
const handleImageDelete = useCallback(() => {
|
|
33322
34801
|
field.setOptions({ image: void 0 });
|
|
33323
34802
|
}, [field]);
|
|
33324
|
-
const type = field.type;
|
|
33325
34803
|
const [directlyShownFields, popoverFields] = useMemo(() => {
|
|
33326
34804
|
const directlyShownFields2 = [];
|
|
33327
34805
|
const popoverFields2 = [];
|
|
33328
|
-
const fieldObject = getFieldCreationSchema(field.type, `${parentPath}.${
|
|
34806
|
+
const fieldObject = getFieldCreationSchema(field.type, `${parentPath}.${fieldIndex}`) ?? [];
|
|
33329
34807
|
for (const item of fieldObject) {
|
|
33330
34808
|
if (item.showDirectly) directlyShownFields2.push(item.field);
|
|
33331
34809
|
else popoverFields2.push(item.field);
|
|
33332
34810
|
}
|
|
33333
34811
|
return [directlyShownFields2, popoverFields2];
|
|
33334
|
-
}, [field, parentPath,
|
|
34812
|
+
}, [field, parentPath, fieldIndex]);
|
|
33335
34813
|
const directlyShownInputs = useFieldInputs(directlyShownFields, {
|
|
33336
34814
|
formId,
|
|
33337
34815
|
disabled: false
|
|
@@ -33356,7 +34834,7 @@ const FieldBuilder = memo((props) => {
|
|
|
33356
34834
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 w-full justify-between", children: [
|
|
33357
34835
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
33358
34836
|
/* @__PURE__ */ jsxs(Badge, { accentColor: "base", variant: "soft", size: "sm", children: [
|
|
33359
|
-
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[type] }),
|
|
34837
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[field.type] }),
|
|
33360
34838
|
fieldTypeName
|
|
33361
34839
|
] }),
|
|
33362
34840
|
!disableRequiredFields && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -33366,7 +34844,7 @@ const FieldBuilder = memo((props) => {
|
|
|
33366
34844
|
checked: field.required,
|
|
33367
34845
|
onCheckedChange: (required) => field.setOptions({ required: !!required }),
|
|
33368
34846
|
size: "sm",
|
|
33369
|
-
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
34847
|
+
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) })
|
|
33370
34848
|
}
|
|
33371
34849
|
),
|
|
33372
34850
|
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", children: "Required" })
|
|
@@ -33394,7 +34872,7 @@ const FieldBuilder = memo((props) => {
|
|
|
33394
34872
|
"aria-label": "delete",
|
|
33395
34873
|
onClick: handleImageDelete,
|
|
33396
34874
|
size: "sm",
|
|
33397
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
34875
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash })
|
|
33398
34876
|
}
|
|
33399
34877
|
)
|
|
33400
34878
|
] }),
|
|
@@ -33425,46 +34903,25 @@ const FieldBuilder = memo((props) => {
|
|
|
33425
34903
|
] });
|
|
33426
34904
|
});
|
|
33427
34905
|
FieldBuilder.displayName = "FieldBuilder";
|
|
33428
|
-
const
|
|
33429
|
-
const {
|
|
33430
|
-
return /* @__PURE__ */ jsxs(Menu.Root, { ...rest, children: [
|
|
33431
|
-
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children }),
|
|
33432
|
-
/* @__PURE__ */ jsx(Menu.Content, { variant, size, accentColor, children: fields.map((field) => {
|
|
33433
|
-
return /* @__PURE__ */ jsxs(Menu.Item, { onSelect: () => onSelectField(field), children: [
|
|
33434
|
-
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[field.type] }),
|
|
33435
|
-
field.label || UNLABELLED_FIELD_LABEL
|
|
33436
|
-
] }, field.identifier);
|
|
33437
|
-
}) })
|
|
33438
|
-
] });
|
|
33439
|
-
});
|
|
33440
|
-
FieldDropdownMenu.displayName = "IssueDataFilterMenu";
|
|
33441
|
-
const FieldSectionDropdownMenu = memo((props) => {
|
|
33442
|
-
const { children, variant, size, accentColor, fieldSections, onSelectFieldCondition, ...rest } = props;
|
|
33443
|
-
return /* @__PURE__ */ jsxs(Menu.Root, { ...rest, children: [
|
|
33444
|
-
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children }),
|
|
33445
|
-
/* @__PURE__ */ jsx(Menu.Content, { variant, size, accentColor, children: fieldSections.map((fieldSection) => {
|
|
33446
|
-
return /* @__PURE__ */ jsxs(Menu.Item, { onSelect: () => onSelectFieldCondition(fieldSection), children: [
|
|
33447
|
-
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[fieldSection.type] }),
|
|
33448
|
-
fieldSection.label || UNLABELLED_SECTION_LABEL
|
|
33449
|
-
] }, fieldSection.identifier);
|
|
33450
|
-
}) })
|
|
33451
|
-
] });
|
|
33452
|
-
});
|
|
33453
|
-
FieldSectionDropdownMenu.displayName = "IssueDataFilterMenu";
|
|
33454
|
-
const FieldWithActions = memo((props) => {
|
|
33455
|
-
const { field, fieldSection, index, sectionIndex, remove } = props;
|
|
33456
|
-
const { showError } = useToast();
|
|
34906
|
+
const FieldBuilderWithActions = memo((props) => {
|
|
34907
|
+
const { field, fieldSection, fieldIndex, sectionIndex } = props;
|
|
33457
34908
|
const fileInputRef = useRef(null);
|
|
33458
34909
|
const parentPath = `fields.${sectionIndex}.fields`;
|
|
34910
|
+
const handleAddField = useCallback(
|
|
34911
|
+
(type) => {
|
|
34912
|
+
fieldSection.addField(createField(type), fieldIndex + 1);
|
|
34913
|
+
},
|
|
34914
|
+
[fieldIndex, fieldSection]
|
|
34915
|
+
);
|
|
33459
34916
|
const duplicateField = useCallback(() => {
|
|
33460
34917
|
fieldSection.addField(field.duplicate(v4()));
|
|
33461
34918
|
}, [field, fieldSection]);
|
|
33462
34919
|
const moveField = useCallback(
|
|
33463
34920
|
(direction) => {
|
|
33464
34921
|
const targetIndex = direction === "up" ? sectionIndex - 1 : sectionIndex + 1;
|
|
33465
|
-
fieldSection.moveField(
|
|
34922
|
+
fieldSection.moveField(fieldIndex, targetIndex);
|
|
33466
34923
|
},
|
|
33467
|
-
[fieldSection,
|
|
34924
|
+
[fieldSection, fieldIndex, sectionIndex]
|
|
33468
34925
|
);
|
|
33469
34926
|
const uploadImage = useCallback(
|
|
33470
34927
|
(event) => {
|
|
@@ -33473,7 +34930,7 @@ const FieldWithActions = memo((props) => {
|
|
|
33473
34930
|
const file = files.item(0);
|
|
33474
34931
|
if (!file) return;
|
|
33475
34932
|
if (file.size > maxFileSizeB) {
|
|
33476
|
-
|
|
34933
|
+
toast.error({
|
|
33477
34934
|
title: "File upload error",
|
|
33478
34935
|
description: `The file ${file.name} exceeded the maximum file size`
|
|
33479
34936
|
});
|
|
@@ -33483,7 +34940,7 @@ const FieldWithActions = memo((props) => {
|
|
|
33483
34940
|
image: file
|
|
33484
34941
|
});
|
|
33485
34942
|
},
|
|
33486
|
-
[field
|
|
34943
|
+
[field]
|
|
33487
34944
|
);
|
|
33488
34945
|
const handleMoveUp = useCallback(() => {
|
|
33489
34946
|
moveField("up");
|
|
@@ -33496,21 +34953,48 @@ const FieldWithActions = memo((props) => {
|
|
|
33496
34953
|
(_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
33497
34954
|
}, []);
|
|
33498
34955
|
const handleRemove = useCallback(() => {
|
|
33499
|
-
|
|
33500
|
-
}, [field,
|
|
34956
|
+
fieldSection.removeField(field);
|
|
34957
|
+
}, [field, fieldSection]);
|
|
33501
34958
|
return /* @__PURE__ */ jsxs(Card, { className: "flex items-center justify-between gap-4 w-full", children: [
|
|
33502
|
-
/* @__PURE__ */ jsx(FieldBuilder, {
|
|
34959
|
+
/* @__PURE__ */ jsx(FieldBuilder, { fieldIndex, field, parentPath }),
|
|
33503
34960
|
/* @__PURE__ */ jsxs(ButtonGroup, { className: "flex-col gap-0.5 flex", variant: "ghost", accentColor: "base", size: "sm", children: [
|
|
33504
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button",
|
|
33505
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick:
|
|
33506
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick:
|
|
33507
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick:
|
|
33508
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick:
|
|
34961
|
+
/* @__PURE__ */ jsx(CreateFieldDropdownMenu, { onSelectFieldType: handleAddField, children: /* @__PURE__ */ jsx(IconButton, { type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: Plus }) }) }),
|
|
34962
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsx(LuIcon, { icon: MoveUp }) }),
|
|
34963
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsx(LuIcon, { icon: MoveDown }) }),
|
|
34964
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: duplicateField, children: /* @__PURE__ */ jsx(LuIcon, { icon: Copy }) }),
|
|
34965
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleUploadImage, children: /* @__PURE__ */ jsx(LuIcon, { icon: Image }) }),
|
|
34966
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleRemove, children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash }) })
|
|
33509
34967
|
] }),
|
|
33510
34968
|
/* @__PURE__ */ jsx("input", { className: "hidden", ref: fileInputRef, type: "file", accept: "image/*", onChange: uploadImage })
|
|
33511
34969
|
] });
|
|
33512
34970
|
});
|
|
33513
|
-
|
|
34971
|
+
FieldBuilderWithActions.displayName = "FieldBuilderWithActions";
|
|
34972
|
+
const FieldDropdownMenu = memo((props) => {
|
|
34973
|
+
const { children, variant, size, accentColor, fields, onSelectField, ...rest } = props;
|
|
34974
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { ...rest, children: [
|
|
34975
|
+
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children }),
|
|
34976
|
+
/* @__PURE__ */ jsx(Menu.Content, { variant, size, accentColor, children: /* @__PURE__ */ jsx(Menu.Scroll, { children: fields.map((field) => {
|
|
34977
|
+
return /* @__PURE__ */ jsxs(Menu.Item, { onSelect: () => onSelectField(field), children: [
|
|
34978
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[field.type] }),
|
|
34979
|
+
field.label || UNLABELLED_FIELD_LABEL
|
|
34980
|
+
] }, field.identifier);
|
|
34981
|
+
}) }) })
|
|
34982
|
+
] });
|
|
34983
|
+
});
|
|
34984
|
+
FieldDropdownMenu.displayName = "IssueDataFilterMenu";
|
|
34985
|
+
const FieldSectionDropdownMenu = memo((props) => {
|
|
34986
|
+
const { children, variant, size, accentColor, fieldSections, onSelectFieldCondition, ...rest } = props;
|
|
34987
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { ...rest, children: [
|
|
34988
|
+
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children }),
|
|
34989
|
+
/* @__PURE__ */ jsx(Menu.Content, { variant, size, accentColor, children: fieldSections.map((fieldSection) => {
|
|
34990
|
+
return /* @__PURE__ */ jsxs(Menu.Item, { onSelect: () => onSelectFieldCondition(fieldSection), children: [
|
|
34991
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[fieldSection.type] }),
|
|
34992
|
+
fieldSection.label || UNLABELLED_SECTION_LABEL
|
|
34993
|
+
] }, fieldSection.identifier);
|
|
34994
|
+
}) })
|
|
34995
|
+
] });
|
|
34996
|
+
});
|
|
34997
|
+
FieldSectionDropdownMenu.displayName = "IssueDataFilterMenu";
|
|
33514
34998
|
const FieldSectionConditionEdgeComponent = memo((props) => {
|
|
33515
34999
|
const { id, sourceX, sourceY, targetX, targetY, style, markerEnd, data } = props;
|
|
33516
35000
|
const { targetSection, sourceSection, layoutDirection } = data;
|
|
@@ -33564,7 +35048,7 @@ const FieldSectionConditionEdgeComponent = memo((props) => {
|
|
|
33564
35048
|
variant: "surface",
|
|
33565
35049
|
size: "xs",
|
|
33566
35050
|
accentColor: "base",
|
|
33567
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35051
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Plus })
|
|
33568
35052
|
}
|
|
33569
35053
|
) }),
|
|
33570
35054
|
/* @__PURE__ */ jsxs(Tooltip.Root, { children: [
|
|
@@ -33578,7 +35062,7 @@ const FieldSectionConditionEdgeComponent = memo((props) => {
|
|
|
33578
35062
|
accentColor: "base",
|
|
33579
35063
|
color: "danger",
|
|
33580
35064
|
onClick: handleDelete,
|
|
33581
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35065
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash })
|
|
33582
35066
|
}
|
|
33583
35067
|
) }),
|
|
33584
35068
|
/* @__PURE__ */ jsx(Tooltip.Content, { size: "sm", children: "Remove conditional logic" })
|
|
@@ -33594,27 +35078,14 @@ const FieldSectionConditionEdgeComponent = memo((props) => {
|
|
|
33594
35078
|
] });
|
|
33595
35079
|
});
|
|
33596
35080
|
FieldSectionConditionEdgeComponent.displayName = "FieldSectionConditionEdgeComponent";
|
|
33597
|
-
const useFieldTypeItems = (onSelect = () => null) => {
|
|
33598
|
-
return useMemo(() => {
|
|
33599
|
-
const entries = Object.entries(FieldTypeToClsMapping);
|
|
33600
|
-
return entries.map(([type, fieldClass]) => ({
|
|
33601
|
-
children: fieldClass.fieldTypeName,
|
|
33602
|
-
icon: /* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[type] }),
|
|
33603
|
-
value: type,
|
|
33604
|
-
onSelect: () => {
|
|
33605
|
-
onSelect(type);
|
|
33606
|
-
}
|
|
33607
|
-
}));
|
|
33608
|
-
}, [onSelect]);
|
|
33609
|
-
};
|
|
33610
35081
|
const FieldSectionNodeComponent = memo((props) => {
|
|
33611
35082
|
const { data, selected } = props;
|
|
33612
35083
|
const { fieldSection, index: sectionIndex, layoutDirection } = data;
|
|
33613
35084
|
const fieldSchema = use(FieldSchemaContext);
|
|
33614
|
-
const
|
|
35085
|
+
const handleRemoveSection = useCallback(() => {
|
|
33615
35086
|
fieldSchema.removeFieldSection(fieldSection);
|
|
33616
35087
|
}, [fieldSchema, fieldSection]);
|
|
33617
|
-
const
|
|
35088
|
+
const handleAddField = useCallback(
|
|
33618
35089
|
(type) => {
|
|
33619
35090
|
fieldSection.addField(createField(type));
|
|
33620
35091
|
},
|
|
@@ -33628,13 +35099,6 @@ const FieldSectionNodeComponent = memo((props) => {
|
|
|
33628
35099
|
const handleDuplicate = useCallback(() => {
|
|
33629
35100
|
fieldSchema.addFieldSection(fieldSection.duplicate(v4()));
|
|
33630
35101
|
}, [fieldSchema, fieldSection]);
|
|
33631
|
-
const fieldTypeItems = useFieldTypeItems(addField);
|
|
33632
|
-
const removeField = useCallback(
|
|
33633
|
-
(field) => {
|
|
33634
|
-
fieldSection.removeField(field);
|
|
33635
|
-
},
|
|
33636
|
-
[fieldSection]
|
|
33637
|
-
);
|
|
33638
35102
|
return /* @__PURE__ */ jsxs(
|
|
33639
35103
|
Card,
|
|
33640
35104
|
{
|
|
@@ -33668,25 +35132,18 @@ const FieldSectionNodeComponent = memo((props) => {
|
|
|
33668
35132
|
] }),
|
|
33669
35133
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
33670
35134
|
/* @__PURE__ */ jsx(Text, { weight: "bold", children: "Fields" }),
|
|
33671
|
-
/* @__PURE__ */ jsxs(
|
|
33672
|
-
/* @__PURE__ */ jsx(
|
|
33673
|
-
|
|
33674
|
-
|
|
33675
|
-
] }) }),
|
|
33676
|
-
/* @__PURE__ */ jsx(Menu.Content, { children: /* @__PURE__ */ jsx(Menu.Scroll, { children: fieldTypeItems.flat().map((item) => /* @__PURE__ */ jsxs(Menu.Item, { onSelect: item.onSelect, children: [
|
|
33677
|
-
item.icon,
|
|
33678
|
-
item.children
|
|
33679
|
-
] }, item.value)) }) })
|
|
33680
|
-
] })
|
|
35135
|
+
/* @__PURE__ */ jsx(CreateFieldDropdownMenu, { onSelectFieldType: handleAddField, children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "soft", size: "sm", accentColor: "base", children: [
|
|
35136
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Plus }),
|
|
35137
|
+
" Add field"
|
|
35138
|
+
] }) })
|
|
33681
35139
|
] }),
|
|
33682
35140
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: fieldSection.fields.map((child, index) => /* @__PURE__ */ jsx(
|
|
33683
|
-
|
|
35141
|
+
FieldBuilderWithActions,
|
|
33684
35142
|
{
|
|
33685
35143
|
field: child,
|
|
33686
35144
|
fieldSection,
|
|
33687
|
-
index,
|
|
33688
|
-
sectionIndex
|
|
33689
|
-
remove: removeField
|
|
35145
|
+
fieldIndex: index,
|
|
35146
|
+
sectionIndex
|
|
33690
35147
|
},
|
|
33691
35148
|
child.identifier
|
|
33692
35149
|
)) })
|
|
@@ -33707,9 +35164,9 @@ const FieldSectionNodeComponent = memo((props) => {
|
|
|
33707
35164
|
size: "xs",
|
|
33708
35165
|
onClick: (e) => e.stopPropagation(),
|
|
33709
35166
|
children: /* @__PURE__ */ jsxs(ButtonGroup, { className: "flex flex-col gap-2", variant: "surface", size: "xs", accentColor: "base", children: [
|
|
33710
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleAddBranch, children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
33711
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleDuplicate, children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
33712
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick:
|
|
35167
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleAddBranch, children: /* @__PURE__ */ jsx(LuIcon, { icon: GitBranch }) }),
|
|
35168
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleDuplicate, children: /* @__PURE__ */ jsx(LuIcon, { icon: Copy }) }),
|
|
35169
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleRemoveSection, children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash }) })
|
|
33713
35170
|
] })
|
|
33714
35171
|
}
|
|
33715
35172
|
)
|
|
@@ -33926,7 +35383,7 @@ const FormBuilderFlowBuilder = memo(() => {
|
|
|
33926
35383
|
}
|
|
33927
35384
|
),
|
|
33928
35385
|
/* @__PURE__ */ jsx(Panel, { position: "top-left", children: /* @__PURE__ */ jsx(ButtonGroup, { className: "flex items-center justify-end gap-2", size: "sm", children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "surface", onClick: handleAddSection, children: [
|
|
33929
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35386
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Plus }),
|
|
33930
35387
|
" Add section"
|
|
33931
35388
|
] }) }) }),
|
|
33932
35389
|
/* @__PURE__ */ jsxs(Panel, { position: "top-right", className: "flex flex-col items-center gap-2", children: [
|
|
@@ -33940,16 +35397,16 @@ const FormBuilderFlowBuilder = memo(() => {
|
|
|
33940
35397
|
value: layoutDirection,
|
|
33941
35398
|
onValueChange: setLayoutDirection,
|
|
33942
35399
|
children: [
|
|
33943
|
-
/* @__PURE__ */ jsx(ToggleGroup.IconItem, { className: "rounded-b-none", value: "LR", type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
33944
|
-
/* @__PURE__ */ jsx(ToggleGroup.IconItem, { className: "rounded-t-none", value: "TB", type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35400
|
+
/* @__PURE__ */ jsx(ToggleGroup.IconItem, { className: "rounded-b-none", value: "LR", type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: ArrowLeftRight }) }),
|
|
35401
|
+
/* @__PURE__ */ jsx(ToggleGroup.IconItem, { className: "rounded-t-none", value: "TB", type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: ArrowDownUp }) })
|
|
33945
35402
|
]
|
|
33946
35403
|
}
|
|
33947
35404
|
),
|
|
33948
35405
|
/* @__PURE__ */ jsx(Separator, { size: "sm" }),
|
|
33949
35406
|
/* @__PURE__ */ jsxs(ButtonGroup, { className: "flex flex-col ", size: "sm", accentColor: "base", variant: "soft", children: [
|
|
33950
|
-
/* @__PURE__ */ jsx(IconButton, { className: "rounded-b-none", onClick: () => reactFlow == null ? void 0 : reactFlow.zoomIn(), type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
33951
|
-
/* @__PURE__ */ jsx(IconButton, { onClick: () => reactFlow == null ? void 0 : reactFlow.zoomOut(), radius: "none", type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
33952
|
-
/* @__PURE__ */ jsx(IconButton, { className: "rounded-t-none", onClick: () => reactFlow == null ? void 0 : reactFlow.fitView(), type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35407
|
+
/* @__PURE__ */ jsx(IconButton, { className: "rounded-b-none", onClick: () => reactFlow == null ? void 0 : reactFlow.zoomIn(), type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: Plus }) }),
|
|
35408
|
+
/* @__PURE__ */ jsx(IconButton, { onClick: () => reactFlow == null ? void 0 : reactFlow.zoomOut(), radius: "none", type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: Minus }) }),
|
|
35409
|
+
/* @__PURE__ */ jsx(IconButton, { className: "rounded-t-none", onClick: () => reactFlow == null ? void 0 : reactFlow.fitView(), type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: SquareDashed }) })
|
|
33953
35410
|
] })
|
|
33954
35411
|
] }),
|
|
33955
35412
|
/* @__PURE__ */ jsx(Panel, { position: "bottom-right", children: /* @__PURE__ */ jsxs(ButtonGroup, { className: "flex items-center justify-end gap-2", size: "sm", children: [
|
|
@@ -33987,7 +35444,7 @@ const FieldSectionConditionalItem = memo((props) => {
|
|
|
33987
35444
|
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons.section }),
|
|
33988
35445
|
sourceFieldSection.label ?? UNLABELLED_SECTION_LABEL
|
|
33989
35446
|
] }),
|
|
33990
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleDelete, variant: "ghost", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35447
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleDelete, variant: "ghost", children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash }) })
|
|
33991
35448
|
] }),
|
|
33992
35449
|
/* @__PURE__ */ jsxs("div", { className: "flex h-max w-full flex-wrap gap-2", children: [
|
|
33993
35450
|
conditions.map((condition) => {
|
|
@@ -33995,7 +35452,7 @@ const FieldSectionConditionalItem = memo((props) => {
|
|
|
33995
35452
|
onRemove: handleDeleteCondition
|
|
33996
35453
|
});
|
|
33997
35454
|
}),
|
|
33998
|
-
/* @__PURE__ */ jsx(FieldDropdownMenu, { fields: sourceFieldSection.fields, onSelectField: handleSelectField, align: "start", children: /* @__PURE__ */ jsx(IconButton, { type: "button", size: "sm", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35455
|
+
/* @__PURE__ */ jsx(FieldDropdownMenu, { fields: sourceFieldSection.fields, onSelectField: handleSelectField, align: "start", children: /* @__PURE__ */ jsx(IconButton, { type: "button", size: "sm", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsx(LuIcon, { icon: Plus }) }) })
|
|
33999
35456
|
] })
|
|
34000
35457
|
] });
|
|
34001
35458
|
});
|
|
@@ -34057,7 +35514,7 @@ const FieldSectionBuilder = memo((props) => {
|
|
|
34057
35514
|
fieldSections: validFieldSections,
|
|
34058
35515
|
onSelectFieldCondition: handleAddConditional,
|
|
34059
35516
|
children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "soft", size: "sm", className: "w-max", children: [
|
|
34060
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35517
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Plus }),
|
|
34061
35518
|
"Add condition"
|
|
34062
35519
|
] })
|
|
34063
35520
|
}
|
|
@@ -34077,15 +35534,9 @@ const FieldSectionBuilder = memo((props) => {
|
|
|
34077
35534
|
});
|
|
34078
35535
|
FieldSectionBuilder.displayName = "FieldSectionBuilder";
|
|
34079
35536
|
const FieldSectionWithActions = memo((props) => {
|
|
34080
|
-
const { fieldSection,
|
|
35537
|
+
const { fieldSection, sectionIndex } = props;
|
|
34081
35538
|
const fieldSchema = use(FieldSchemaContext);
|
|
34082
|
-
const
|
|
34083
|
-
(field) => {
|
|
34084
|
-
fieldSection.removeField(field);
|
|
34085
|
-
},
|
|
34086
|
-
[fieldSection]
|
|
34087
|
-
);
|
|
34088
|
-
const removeSection = useCallback(() => {
|
|
35539
|
+
const handleRemoveSection = useCallback(() => {
|
|
34089
35540
|
fieldSchema.removeFieldSection(fieldSection);
|
|
34090
35541
|
}, [fieldSchema, fieldSection]);
|
|
34091
35542
|
const moveSection = useCallback(
|
|
@@ -34098,7 +35549,7 @@ const FieldSectionWithActions = memo((props) => {
|
|
|
34098
35549
|
const duplicateSection = useCallback(() => {
|
|
34099
35550
|
fieldSchema.addFieldSection(fieldSection.duplicate(v4()));
|
|
34100
35551
|
}, [fieldSchema, fieldSection]);
|
|
34101
|
-
const
|
|
35552
|
+
const handleAddField = useCallback(
|
|
34102
35553
|
(type) => {
|
|
34103
35554
|
fieldSection.addField(createField(type));
|
|
34104
35555
|
},
|
|
@@ -34110,42 +35561,34 @@ const FieldSectionWithActions = memo((props) => {
|
|
|
34110
35561
|
const handleMoveDown = useCallback(() => {
|
|
34111
35562
|
moveSection("down");
|
|
34112
35563
|
}, [moveSection]);
|
|
34113
|
-
const fieldTypeItems = useFieldTypeItems(handleCreateField);
|
|
34114
35564
|
return /* @__PURE__ */ jsxs(Card, { variant: "outline", className: "flex items-center justify-between gap-4 w-full", children: [
|
|
34115
35565
|
/* @__PURE__ */ jsxs("div", { className: "flex grow flex-col gap-4 w-full", children: [
|
|
34116
35566
|
/* @__PURE__ */ jsx(FieldSectionBuilder, { fieldSection }),
|
|
34117
35567
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 w-full", children: [
|
|
34118
35568
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 justify-between", children: [
|
|
34119
35569
|
/* @__PURE__ */ jsx(Text, { accentColor: "base", size: "md", children: "Fields" }),
|
|
34120
|
-
/* @__PURE__ */ jsxs(
|
|
34121
|
-
/* @__PURE__ */ jsx(
|
|
34122
|
-
|
|
34123
|
-
|
|
34124
|
-
] }) }),
|
|
34125
|
-
/* @__PURE__ */ jsx(Menu.Content, { children: /* @__PURE__ */ jsx(Menu.Scroll, { children: fieldTypeItems.flat().map((item) => /* @__PURE__ */ jsxs(Menu.Item, { onSelect: item.onSelect, children: [
|
|
34126
|
-
item.icon,
|
|
34127
|
-
item.children
|
|
34128
|
-
] }, item.value)) }) })
|
|
34129
|
-
] })
|
|
35570
|
+
/* @__PURE__ */ jsx(CreateFieldDropdownMenu, { onSelectFieldType: handleAddField, children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "soft", size: "sm", children: [
|
|
35571
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Plus }),
|
|
35572
|
+
" Add field"
|
|
35573
|
+
] }) })
|
|
34130
35574
|
] }),
|
|
34131
35575
|
fieldSection.fields.map((child, index) => /* @__PURE__ */ jsx(
|
|
34132
|
-
|
|
35576
|
+
FieldBuilderWithActions,
|
|
34133
35577
|
{
|
|
34134
35578
|
field: child,
|
|
34135
35579
|
fieldSection,
|
|
34136
|
-
index,
|
|
34137
|
-
sectionIndex
|
|
34138
|
-
remove: removeField
|
|
35580
|
+
fieldIndex: index,
|
|
35581
|
+
sectionIndex
|
|
34139
35582
|
},
|
|
34140
35583
|
child.identifier
|
|
34141
35584
|
))
|
|
34142
35585
|
] })
|
|
34143
35586
|
] }),
|
|
34144
35587
|
/* @__PURE__ */ jsxs(ButtonGroup, { className: "flex-col gap-0.5 flex", variant: "ghost", accentColor: "base", size: "sm", children: [
|
|
34145
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
34146
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
34147
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: duplicateSection, children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
34148
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick:
|
|
35588
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsx(LuIcon, { icon: MoveUp }) }),
|
|
35589
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsx(LuIcon, { icon: MoveDown }) }),
|
|
35590
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: duplicateSection, children: /* @__PURE__ */ jsx(LuIcon, { icon: Copy }) }),
|
|
35591
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleRemoveSection, children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash }) })
|
|
34149
35592
|
] })
|
|
34150
35593
|
] });
|
|
34151
35594
|
});
|
|
@@ -34194,7 +35637,14 @@ const FormBuilderListBuilder = memo(() => {
|
|
|
34194
35637
|
}
|
|
34195
35638
|
),
|
|
34196
35639
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
34197
|
-
fieldSchema.fieldSections.map((fieldSection, index) => /* @__PURE__ */ jsx(
|
|
35640
|
+
fieldSchema.fieldSections.map((fieldSection, index) => /* @__PURE__ */ jsx(
|
|
35641
|
+
FieldSectionWithActions,
|
|
35642
|
+
{
|
|
35643
|
+
fieldSection,
|
|
35644
|
+
sectionIndex: index
|
|
35645
|
+
},
|
|
35646
|
+
fieldSection.identifier
|
|
35647
|
+
)),
|
|
34198
35648
|
/* @__PURE__ */ jsxs(
|
|
34199
35649
|
Button,
|
|
34200
35650
|
{
|
|
@@ -34205,7 +35655,7 @@ const FormBuilderListBuilder = memo(() => {
|
|
|
34205
35655
|
size: "sm",
|
|
34206
35656
|
onClick: handleCreateEmptySection,
|
|
34207
35657
|
children: [
|
|
34208
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35658
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Plus }),
|
|
34209
35659
|
" Add section"
|
|
34210
35660
|
]
|
|
34211
35661
|
}
|
|
@@ -34241,59 +35691,31 @@ const validateFields = (fields, values) => {
|
|
|
34241
35691
|
}
|
|
34242
35692
|
if (Object.keys(errors).length > 0) return errors;
|
|
34243
35693
|
};
|
|
34244
|
-
const
|
|
34245
|
-
const
|
|
34246
|
-
|
|
34247
|
-
const value = values[field.identifier];
|
|
34248
|
-
ret[field.identifier] = value !== void 0 ? value : field.blankValue();
|
|
34249
|
-
}
|
|
34250
|
-
return ret;
|
|
34251
|
-
};
|
|
34252
|
-
const changedFieldValues = (fields, values1, values2) => {
|
|
34253
|
-
const ret = {};
|
|
34254
|
-
for (const field of fields) {
|
|
34255
|
-
const value1 = values1[field.identifier];
|
|
34256
|
-
const value2 = values2[field.identifier];
|
|
34257
|
-
if (field.areValuesEqual(value1, value2)) continue;
|
|
34258
|
-
ret[field.identifier] = value2;
|
|
34259
|
-
}
|
|
34260
|
-
return ret;
|
|
34261
|
-
};
|
|
34262
|
-
const unchangedFieldValues = (fields, values1, values2) => {
|
|
34263
|
-
const ret = {};
|
|
35694
|
+
const cleanFields = (fields, values) => {
|
|
35695
|
+
const errors = {};
|
|
35696
|
+
const sectionElements = fields.filter((f) => f instanceof FieldSection);
|
|
34264
35697
|
for (const field of fields) {
|
|
34265
|
-
|
|
34266
|
-
|
|
34267
|
-
|
|
34268
|
-
|
|
35698
|
+
if (field instanceof FieldSection) {
|
|
35699
|
+
const conditionalSections = sectionElements.filter((section) => field.identifier in section.conditions);
|
|
35700
|
+
const conditionMet = conditionalSections.length > 0 ? conditionalSections.some(
|
|
35701
|
+
(conditionalSection) => applyConditions(conditionalSection.getConditions(field.identifier), values)
|
|
35702
|
+
) : true;
|
|
35703
|
+
if (conditionMet) continue;
|
|
35704
|
+
} else {
|
|
35705
|
+
if (!(field instanceof BaseField)) {
|
|
35706
|
+
throw new Error("Invalid field type");
|
|
35707
|
+
}
|
|
35708
|
+
const id = field.identifier;
|
|
35709
|
+
const error = field.getError(get(values, id));
|
|
35710
|
+
if (error) set(errors, id, error);
|
|
35711
|
+
}
|
|
34269
35712
|
}
|
|
34270
|
-
return
|
|
34271
|
-
};
|
|
34272
|
-
const isArrayOfFiles = (value) => {
|
|
34273
|
-
return Array.isArray(value) && value[0] instanceof File;
|
|
34274
|
-
};
|
|
34275
|
-
const separateFilesFromFieldValues = (values) => {
|
|
34276
|
-
const files = {};
|
|
34277
|
-
const newValues = {};
|
|
34278
|
-
for (const key in values) {
|
|
34279
|
-
const value = values[key];
|
|
34280
|
-
if (value instanceof File) {
|
|
34281
|
-
files[key] = [value];
|
|
34282
|
-
} else if (isArrayOfFiles(value)) {
|
|
34283
|
-
files[key] = value;
|
|
34284
|
-
} else if (value !== void 0) {
|
|
34285
|
-
newValues[key] = value;
|
|
34286
|
-
}
|
|
34287
|
-
}
|
|
34288
|
-
return { values: newValues, files };
|
|
35713
|
+
if (Object.keys(errors).length > 0) return errors;
|
|
34289
35714
|
};
|
|
34290
|
-
const
|
|
35715
|
+
const separateImagesFromFields = async (fields) => {
|
|
34291
35716
|
const images = {};
|
|
34292
35717
|
const newFields = [];
|
|
34293
35718
|
for (const section of fields) {
|
|
34294
|
-
if (section.type !== "section") {
|
|
34295
|
-
throw new Error(`Expected ISerializedField type to be a section. Got ${section.type} instead.`);
|
|
34296
|
-
}
|
|
34297
35719
|
const { fields: sectionFields } = section;
|
|
34298
35720
|
const newSectionFields = [];
|
|
34299
35721
|
for (const field of sectionFields) {
|
|
@@ -34315,16 +35737,12 @@ const separateFilesFromFields = async (fields) => {
|
|
|
34315
35737
|
}
|
|
34316
35738
|
return { fields: newFields, images };
|
|
34317
35739
|
};
|
|
34318
|
-
async function
|
|
34319
|
-
const
|
|
35740
|
+
async function awaitFilesAndPromises(values) {
|
|
35741
|
+
const ret = {};
|
|
34320
35742
|
for (const [key, value] of Object.entries(values)) {
|
|
34321
|
-
|
|
34322
|
-
valuesWithoutFiles[key] = await Promise.all(value);
|
|
34323
|
-
} else {
|
|
34324
|
-
valuesWithoutFiles[key] = value;
|
|
34325
|
-
}
|
|
35743
|
+
ret[key] = await Promise.all(value);
|
|
34326
35744
|
}
|
|
34327
|
-
return
|
|
35745
|
+
return ret;
|
|
34328
35746
|
}
|
|
34329
35747
|
const FormRenderer = memo(
|
|
34330
35748
|
forwardRef((props, ref) => {
|
|
@@ -34353,9 +35771,9 @@ const FormRenderer = memo(
|
|
|
34353
35771
|
}, [schema.fields, values]);
|
|
34354
35772
|
const handleSubmit = useCallback(
|
|
34355
35773
|
(values2) => {
|
|
34356
|
-
onSubmit == null ? void 0 : onSubmit(
|
|
35774
|
+
void (onSubmit == null ? void 0 : onSubmit(
|
|
34357
35775
|
excludeUnchangedFields ? changedFieldValues(flattenFields(schema.fields), initialValues, values2) : values2
|
|
34358
|
-
);
|
|
35776
|
+
));
|
|
34359
35777
|
},
|
|
34360
35778
|
[excludeUnchangedFields, initialValues, onSubmit, schema.fields]
|
|
34361
35779
|
);
|
|
@@ -34420,13 +35838,13 @@ const FormRenderer = memo(
|
|
|
34420
35838
|
variant: "soft",
|
|
34421
35839
|
onClick: onCancel,
|
|
34422
35840
|
children: [
|
|
34423
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35841
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: X }),
|
|
34424
35842
|
cancelText
|
|
34425
35843
|
]
|
|
34426
35844
|
}
|
|
34427
35845
|
),
|
|
34428
35846
|
/* @__PURE__ */ jsxs(Button, { ...buttonProps, type: "submit", accentColor: "primary", variant: "surface", children: [
|
|
34429
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35847
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Check }),
|
|
34430
35848
|
submitText
|
|
34431
35849
|
] })
|
|
34432
35850
|
] })
|
|
@@ -34465,43 +35883,39 @@ const FormBuilderRoot = memo((props) => {
|
|
|
34465
35883
|
enableReinitialize = false,
|
|
34466
35884
|
disableRequiredFields = false
|
|
34467
35885
|
} = props;
|
|
34468
|
-
const
|
|
34469
|
-
|
|
34470
|
-
|
|
34471
|
-
|
|
34472
|
-
|
|
34473
|
-
|
|
34474
|
-
|
|
34475
|
-
|
|
34476
|
-
|
|
34477
|
-
|
|
34478
|
-
|
|
34479
|
-
const
|
|
34480
|
-
|
|
34481
|
-
|
|
34482
|
-
|
|
34483
|
-
|
|
34484
|
-
|
|
34485
|
-
|
|
34486
|
-
|
|
34487
|
-
|
|
34488
|
-
|
|
34489
|
-
|
|
34490
|
-
|
|
34491
|
-
|
|
34492
|
-
|
|
34493
|
-
|
|
34494
|
-
|
|
34495
|
-
|
|
34496
|
-
|
|
34497
|
-
|
|
34498
|
-
|
|
34499
|
-
|
|
34500
|
-
|
|
34501
|
-
}
|
|
34502
|
-
},
|
|
34503
|
-
[showError]
|
|
34504
|
-
);
|
|
35886
|
+
const validate = useCallback((form) => {
|
|
35887
|
+
var _a2;
|
|
35888
|
+
const errors = {};
|
|
35889
|
+
if (!form.title) {
|
|
35890
|
+
errors.title = "Title is required.";
|
|
35891
|
+
}
|
|
35892
|
+
if (!form.fields || form.fields.length === 0) {
|
|
35893
|
+
errors.fields = "At least one field is required.";
|
|
35894
|
+
}
|
|
35895
|
+
const fieldsToValidate = [];
|
|
35896
|
+
for (const [sectionIndex, section] of form.fields.entries())
|
|
35897
|
+
for (const [fieldIndex, field] of section.fields.entries()) {
|
|
35898
|
+
const fieldSettings = ((_a2 = getFieldCreationSchema(field.type, `fields.${sectionIndex}.fields.${fieldIndex}`)) == null ? void 0 : _a2.map(
|
|
35899
|
+
({ field: field2 }) => field2
|
|
35900
|
+
)) ?? [];
|
|
35901
|
+
fieldsToValidate.push(...fieldSettings);
|
|
35902
|
+
}
|
|
35903
|
+
const values = {};
|
|
35904
|
+
for (const field of fieldsToValidate) {
|
|
35905
|
+
values[field.identifier] = get(form, field.identifier);
|
|
35906
|
+
}
|
|
35907
|
+
const fieldErrors = validateFields(fieldsToValidate, values);
|
|
35908
|
+
if (fieldErrors) {
|
|
35909
|
+
errors.fields = fieldErrors.fields;
|
|
35910
|
+
}
|
|
35911
|
+
if (Object.keys(errors).length > 0) {
|
|
35912
|
+
toast.error({
|
|
35913
|
+
title: "Some form settings are invalid",
|
|
35914
|
+
description: "Please check settings highlighted in red."
|
|
35915
|
+
});
|
|
35916
|
+
return errors;
|
|
35917
|
+
}
|
|
35918
|
+
}, []);
|
|
34505
35919
|
const initialValues = useMemo(
|
|
34506
35920
|
() => ({
|
|
34507
35921
|
title: initialTitle ?? "",
|
|
@@ -34520,7 +35934,7 @@ const FormBuilderRoot = memo((props) => {
|
|
|
34520
35934
|
});
|
|
34521
35935
|
const observer = useCallback(
|
|
34522
35936
|
(fieldSchema) => {
|
|
34523
|
-
formik.setFieldValue("fields", fieldSchema.serialize());
|
|
35937
|
+
void formik.setFieldValue("fields", fieldSchema.serialize());
|
|
34524
35938
|
},
|
|
34525
35939
|
[formik]
|
|
34526
35940
|
);
|
|
@@ -34562,6 +35976,7 @@ export {
|
|
|
34562
35976
|
CheckboxListFieldCondition,
|
|
34563
35977
|
CheckboxListFieldConditionCell,
|
|
34564
35978
|
CheckboxListInput,
|
|
35979
|
+
ConditionManager,
|
|
34565
35980
|
DateAfterConditionModifier,
|
|
34566
35981
|
DateBeforeConditionModifier,
|
|
34567
35982
|
DateEqualsConditionModifier,
|
|
@@ -34612,10 +36027,23 @@ export {
|
|
|
34612
36027
|
OTPFieldCondition,
|
|
34613
36028
|
OTPFieldConditionCell,
|
|
34614
36029
|
OTPInput,
|
|
36030
|
+
Observable,
|
|
36031
|
+
PassFailArrayExcludesConditionModifier,
|
|
36032
|
+
PassFailArrayIncludesConditionModifier,
|
|
36033
|
+
PassFailEqualsConditionModifier,
|
|
36034
|
+
PassFailField,
|
|
36035
|
+
PassFailFieldCondition,
|
|
36036
|
+
PassFailFieldConditionCell,
|
|
36037
|
+
PassFailInput,
|
|
36038
|
+
PassFailNotEqualsConditionModifier,
|
|
34615
36039
|
RadioField,
|
|
34616
36040
|
RadioFieldCondition,
|
|
34617
36041
|
RadioFieldConditionCell,
|
|
34618
36042
|
RadioInput,
|
|
36043
|
+
RatingField,
|
|
36044
|
+
RatingFieldCondition,
|
|
36045
|
+
RatingFieldConditionCell,
|
|
36046
|
+
RatingInput,
|
|
34619
36047
|
SEVERITY_COLOR_MAPPING,
|
|
34620
36048
|
SHORT_TEXT_FIELD_MAX_LENGTH,
|
|
34621
36049
|
ScanField,
|
|
@@ -34647,15 +36075,19 @@ export {
|
|
|
34647
36075
|
TextFieldCondition,
|
|
34648
36076
|
TextFieldConditionCell,
|
|
34649
36077
|
TextInput,
|
|
36078
|
+
UUIDFile,
|
|
34650
36079
|
UUIDPromise,
|
|
34651
36080
|
UploadField,
|
|
34652
36081
|
UploadFieldCondition,
|
|
34653
36082
|
UploadFieldConditionCell,
|
|
34654
36083
|
UploadInput,
|
|
34655
36084
|
applyConditions,
|
|
34656
|
-
|
|
36085
|
+
areFileAndPromiseArraysEqual,
|
|
36086
|
+
arePassFieldValuesEqual,
|
|
36087
|
+
awaitFilesAndPromises,
|
|
34657
36088
|
changedFieldValues,
|
|
34658
36089
|
cleanFieldValues,
|
|
36090
|
+
cleanFields,
|
|
34659
36091
|
cleanSerializedFieldValues,
|
|
34660
36092
|
createCondition,
|
|
34661
36093
|
createConditionModifierConfig,
|
|
@@ -34667,18 +36099,28 @@ export {
|
|
|
34667
36099
|
deserializeFieldValues,
|
|
34668
36100
|
deserializeFields,
|
|
34669
36101
|
deserializeOnlyFields,
|
|
36102
|
+
deserializePassFailFieldValue,
|
|
36103
|
+
extractFilesAndPromisesFromFieldValues,
|
|
34670
36104
|
fieldIcons,
|
|
34671
36105
|
flattenFields,
|
|
34672
36106
|
getFieldsMapping,
|
|
34673
36107
|
initializeFieldValues,
|
|
36108
|
+
insertFilesAndPromisesToFieldValues,
|
|
36109
|
+
isFileAndPromiseArray,
|
|
36110
|
+
isPassFailFieldStatus,
|
|
36111
|
+
isPassFailFieldValue,
|
|
36112
|
+
isSerializedPassFailFieldValue,
|
|
34674
36113
|
isStringArray,
|
|
34675
36114
|
maxFileSizeB,
|
|
34676
36115
|
maxFileSizeKB,
|
|
34677
36116
|
maxFileSizeMB,
|
|
34678
|
-
|
|
34679
|
-
|
|
36117
|
+
passFailFieldStatusMapping,
|
|
36118
|
+
passFailFieldStatuses,
|
|
36119
|
+
separateImagesFromFields,
|
|
34680
36120
|
serializeFieldValues,
|
|
36121
|
+
serializePassFailFieldValue,
|
|
34681
36122
|
unchangedFieldValues,
|
|
36123
|
+
useConditionManager,
|
|
34682
36124
|
useFieldInput,
|
|
34683
36125
|
useFieldInputs,
|
|
34684
36126
|
useFormikInput,
|
|
@@ -34686,3 +36128,4 @@ export {
|
|
|
34686
36128
|
useScanner,
|
|
34687
36129
|
validateFields
|
|
34688
36130
|
};
|
|
36131
|
+
//# sourceMappingURL=forms.js.map
|