@overmap-ai/forms 1.0.32-react-flow-david-fixes.41 → 1.0.33-condition-optimizations.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 +10 -9
- 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 +3 -6
- 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/conditionModifier.d.ts +3 -3
- 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/typings.d.ts +2 -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 +4 -11
- package/dist/forms.js +2256 -832
- package/dist/forms.js.map +1 -0
- package/dist/forms.umd.cjs +2254 -830
- 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
|
]
|
|
@@ -571,7 +1165,9 @@ const _MultiStringField = class _MultiStringField extends BaseField {
|
|
|
571
1165
|
return [];
|
|
572
1166
|
}
|
|
573
1167
|
areValuesEqual(value1, value2) {
|
|
574
|
-
|
|
1168
|
+
const value1Set = new Set(value1);
|
|
1169
|
+
const value2Set = new Set(value2);
|
|
1170
|
+
return value1Set.size === value2Set.size && value1Set.isSubsetOf(value2Set);
|
|
575
1171
|
}
|
|
576
1172
|
};
|
|
577
1173
|
__publicField(_MultiStringField, "fieldTypeName", "Multi-string");
|
|
@@ -665,7 +1261,7 @@ const BooleanInput = memo((props) => {
|
|
|
665
1261
|
accentColor: "primary",
|
|
666
1262
|
variant: "surface",
|
|
667
1263
|
disabled,
|
|
668
|
-
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1264
|
+
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) })
|
|
669
1265
|
}
|
|
670
1266
|
)
|
|
671
1267
|
}
|
|
@@ -694,7 +1290,6 @@ const _BooleanField = class _BooleanField extends BaseField {
|
|
|
694
1290
|
});
|
|
695
1291
|
}
|
|
696
1292
|
static deserialize(data) {
|
|
697
|
-
if (data.type !== "boolean") throw new Error("Type mismatch.");
|
|
698
1293
|
return new _BooleanField(data);
|
|
699
1294
|
}
|
|
700
1295
|
serializeValue(value) {
|
|
@@ -807,8 +1402,7 @@ const _NumberField = class _NumberField extends BaseField {
|
|
|
807
1402
|
description: "Minimum value",
|
|
808
1403
|
integers: true,
|
|
809
1404
|
required: false,
|
|
810
|
-
identifier: `${path}minimum
|
|
811
|
-
fieldValidators: []
|
|
1405
|
+
identifier: `${path}minimum`
|
|
812
1406
|
}),
|
|
813
1407
|
showDirectly: false
|
|
814
1408
|
},
|
|
@@ -818,8 +1412,7 @@ const _NumberField = class _NumberField extends BaseField {
|
|
|
818
1412
|
description: "Maximum value",
|
|
819
1413
|
integers: true,
|
|
820
1414
|
required: false,
|
|
821
|
-
identifier: `${path}maximum
|
|
822
|
-
fieldValidators: []
|
|
1415
|
+
identifier: `${path}maximum`
|
|
823
1416
|
}),
|
|
824
1417
|
showDirectly: false
|
|
825
1418
|
},
|
|
@@ -944,7 +1537,6 @@ class BaseStringField extends BaseField {
|
|
|
944
1537
|
identifier: `${path}minimum_length`,
|
|
945
1538
|
minimum: 0,
|
|
946
1539
|
maximum: 100,
|
|
947
|
-
fieldValidators: [],
|
|
948
1540
|
integers: true
|
|
949
1541
|
}),
|
|
950
1542
|
showDirectly: false
|
|
@@ -958,7 +1550,6 @@ class BaseStringField extends BaseField {
|
|
|
958
1550
|
minimum: 1,
|
|
959
1551
|
maximum: LONG_TEXT_FIELD_MAX_LENGTH,
|
|
960
1552
|
// TODO: depends on short vs long text
|
|
961
|
-
fieldValidators: [],
|
|
962
1553
|
// TODO: default: 500 (see: "Short text fields can hold up to 500 characters on a single line.")
|
|
963
1554
|
integers: true
|
|
964
1555
|
}),
|
|
@@ -1061,7 +1652,7 @@ const CheckboxListInput = memo((props) => {
|
|
|
1061
1652
|
onValuesChange: handleChange,
|
|
1062
1653
|
disabled,
|
|
1063
1654
|
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:
|
|
1655
|
+
/* @__PURE__ */ jsx(CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) }) }),
|
|
1065
1656
|
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
|
|
1066
1657
|
] }, `${inputId}-${option.value}-${index}`))
|
|
1067
1658
|
}
|
|
@@ -1110,7 +1701,9 @@ const _CheckboxListField = class _CheckboxListField extends BaseOptionsField {
|
|
|
1110
1701
|
return [];
|
|
1111
1702
|
}
|
|
1112
1703
|
areValuesEqual(value1, value2) {
|
|
1113
|
-
|
|
1704
|
+
const value1Set = new Set(value1);
|
|
1705
|
+
const value2Set = new Set(value2);
|
|
1706
|
+
return value1Set.size === value2Set.size && value1Set.isSubsetOf(value2Set);
|
|
1114
1707
|
}
|
|
1115
1708
|
};
|
|
1116
1709
|
__publicField(_CheckboxListField, "fieldTypeName", "Checkbox list");
|
|
@@ -1163,7 +1756,7 @@ const DateInput = memo((props) => {
|
|
|
1163
1756
|
month: "2-digit",
|
|
1164
1757
|
day: "2-digit"
|
|
1165
1758
|
}) : "yyyy-mm-dd",
|
|
1166
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1759
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: ChevronDown })
|
|
1167
1760
|
]
|
|
1168
1761
|
}
|
|
1169
1762
|
) }),
|
|
@@ -1274,13 +1867,13 @@ const MultiSelectInput = memo((props) => {
|
|
|
1274
1867
|
disabled,
|
|
1275
1868
|
children: [
|
|
1276
1869
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: value && value.length > 0 ? value.join(", ") : field.placeholder ?? "Select one or more..." }),
|
|
1277
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1870
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: ChevronDown })
|
|
1278
1871
|
]
|
|
1279
1872
|
}
|
|
1280
1873
|
) }),
|
|
1281
1874
|
/* @__PURE__ */ jsx(Menu.Content, { children: /* @__PURE__ */ jsx(Menu.Scroll, { children: /* @__PURE__ */ jsxs(Menu.MultiSelectGroup, { values: value, onValuesChange: handleChange, children: [
|
|
1282
1875
|
/* @__PURE__ */ jsxs(Menu.SelectAllItem, { children: [
|
|
1283
|
-
/* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1876
|
+
/* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, { children: (indeterminate) => indeterminate ? /* @__PURE__ */ jsx(LuIcon, { icon: Minus }) : /* @__PURE__ */ jsx(LuIcon, { icon: Check }) }),
|
|
1284
1877
|
"Select all"
|
|
1285
1878
|
] }),
|
|
1286
1879
|
field.options.map((option, index) => /* @__PURE__ */ jsxs(
|
|
@@ -1288,7 +1881,7 @@ const MultiSelectInput = memo((props) => {
|
|
|
1288
1881
|
{
|
|
1289
1882
|
value: option.value,
|
|
1290
1883
|
children: [
|
|
1291
|
-
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1884
|
+
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) }),
|
|
1292
1885
|
option.label
|
|
1293
1886
|
]
|
|
1294
1887
|
},
|
|
@@ -1350,7 +1943,9 @@ const _MultiSelectField = class _MultiSelectField extends BaseOptionsField {
|
|
|
1350
1943
|
return [];
|
|
1351
1944
|
}
|
|
1352
1945
|
areValuesEqual(value1, value2) {
|
|
1353
|
-
|
|
1946
|
+
const value1Set = new Set(value1);
|
|
1947
|
+
const value2Set = new Set(value2);
|
|
1948
|
+
return value1Set.size === value2Set.size && value1Set.isSubsetOf(value2Set);
|
|
1354
1949
|
}
|
|
1355
1950
|
};
|
|
1356
1951
|
__publicField(_MultiSelectField, "fieldTypeName", "Multi-select");
|
|
@@ -1394,12 +1989,12 @@ const SelectInput = memo((props) => {
|
|
|
1394
1989
|
disabled,
|
|
1395
1990
|
children: [
|
|
1396
1991
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: currentOption ? currentOption.label : field.placeholder ?? "Select one..." }),
|
|
1397
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
1992
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: ChevronDown })
|
|
1398
1993
|
]
|
|
1399
1994
|
}
|
|
1400
1995
|
) }),
|
|
1401
1996
|
/* @__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:
|
|
1997
|
+
/* @__PURE__ */ jsx(Menu.SelectedIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) }),
|
|
1403
1998
|
option.label
|
|
1404
1999
|
] }, `${inputId}-${option.value}-${index}`)) }) }) })
|
|
1405
2000
|
] })
|
|
@@ -1485,17 +2080,10 @@ const OTPInput = memo((props) => {
|
|
|
1485
2080
|
},
|
|
1486
2081
|
[field, helpers, touched]
|
|
1487
2082
|
);
|
|
1488
|
-
const handleBlur = useCallback(
|
|
1489
|
-
(
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
return;
|
|
1493
|
-
}
|
|
1494
|
-
onChange(internalValue);
|
|
1495
|
-
onBlur(internalValue);
|
|
1496
|
-
},
|
|
1497
|
-
[inputUuids, internalValue, onBlur, onChange]
|
|
1498
|
-
);
|
|
2083
|
+
const handleBlur = useCallback(() => {
|
|
2084
|
+
onChange(internalValue);
|
|
2085
|
+
onBlur(internalValue);
|
|
2086
|
+
}, [internalValue, onBlur, onChange]);
|
|
1499
2087
|
return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsx(
|
|
1500
2088
|
InputWithLabel,
|
|
1501
2089
|
{
|
|
@@ -1525,8 +2113,9 @@ const OTPInput = memo((props) => {
|
|
|
1525
2113
|
accentColor: "base",
|
|
1526
2114
|
variant: "surface",
|
|
1527
2115
|
size: "sm",
|
|
2116
|
+
onBlur: handleBlur,
|
|
1528
2117
|
children: [
|
|
1529
|
-
inputUuids.map((inputUuid) => /* @__PURE__ */ jsx(OneTimePasswordField.Input, { id: inputUuid
|
|
2118
|
+
inputUuids.map((inputUuid) => /* @__PURE__ */ jsx(OneTimePasswordField.Input, { id: inputUuid }, inputUuid)),
|
|
1530
2119
|
/* @__PURE__ */ jsx(OneTimePasswordField.HiddenInput, {})
|
|
1531
2120
|
]
|
|
1532
2121
|
}
|
|
@@ -1556,8 +2145,7 @@ const _OTPField = class _OTPField extends BaseField {
|
|
|
1556
2145
|
required: false,
|
|
1557
2146
|
minimum: 1,
|
|
1558
2147
|
maximum: 16,
|
|
1559
|
-
identifier: `${path}length
|
|
1560
|
-
fieldValidators: []
|
|
2148
|
+
identifier: `${path}length`
|
|
1561
2149
|
}),
|
|
1562
2150
|
showDirectly: false
|
|
1563
2151
|
},
|
|
@@ -1593,7 +2181,7 @@ const _OTPField = class _OTPField extends BaseField {
|
|
|
1593
2181
|
const validators = super.getFieldValidators();
|
|
1594
2182
|
const length = this.length;
|
|
1595
2183
|
validators.push((value) => {
|
|
1596
|
-
if (!this.isValueBlank(value) &&
|
|
2184
|
+
if (!this.isValueBlank(value) && value.length != length) {
|
|
1597
2185
|
return `Must be ${length} characters.`;
|
|
1598
2186
|
}
|
|
1599
2187
|
});
|
|
@@ -1653,6 +2241,565 @@ const _OTPField = class _OTPField extends BaseField {
|
|
|
1653
2241
|
__publicField(_OTPField, "fieldTypeName", "OTP");
|
|
1654
2242
|
__publicField(_OTPField, "fieldTypeDescription", "Allows specifying a number within a given range.");
|
|
1655
2243
|
let OTPField = _OTPField;
|
|
2244
|
+
const passFailFieldStatusMapping = {
|
|
2245
|
+
pass: {
|
|
2246
|
+
label: "Pass",
|
|
2247
|
+
icon: CircleCheck
|
|
2248
|
+
},
|
|
2249
|
+
fail: {
|
|
2250
|
+
label: "Fail",
|
|
2251
|
+
icon: CircleX
|
|
2252
|
+
},
|
|
2253
|
+
na: {
|
|
2254
|
+
label: "N/A",
|
|
2255
|
+
icon: CircleQuestionMark
|
|
2256
|
+
}
|
|
2257
|
+
};
|
|
2258
|
+
const passFailFieldStatuses = Object.keys(passFailFieldStatusMapping);
|
|
2259
|
+
class UUIDFile extends File {
|
|
2260
|
+
constructor(uuid, ...args) {
|
|
2261
|
+
super(...args);
|
|
2262
|
+
__publicField(this, "uuid");
|
|
2263
|
+
this.uuid = uuid;
|
|
2264
|
+
}
|
|
2265
|
+
static from(uuid, file) {
|
|
2266
|
+
return new UUIDFile(uuid, [file], file.name, {
|
|
2267
|
+
lastModified: file.lastModified,
|
|
2268
|
+
type: file.type
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
class UUIDPromise extends Promise {
|
|
2273
|
+
constructor(executor, uuid) {
|
|
2274
|
+
super(executor);
|
|
2275
|
+
__publicField(this, "_uuid");
|
|
2276
|
+
this._uuid = uuid;
|
|
2277
|
+
}
|
|
2278
|
+
get uuid() {
|
|
2279
|
+
return this._uuid;
|
|
2280
|
+
}
|
|
2281
|
+
set uuid(uuid) {
|
|
2282
|
+
this._uuid = uuid;
|
|
2283
|
+
}
|
|
2284
|
+
static from(promise, uuid) {
|
|
2285
|
+
return new UUIDPromise((resolve, reject) => {
|
|
2286
|
+
Promise.resolve(promise).then(resolve).catch(reject);
|
|
2287
|
+
}, uuid);
|
|
2288
|
+
}
|
|
2289
|
+
// oxlint-disable-next-line no-thenable
|
|
2290
|
+
then(onFulfilled, onRejected) {
|
|
2291
|
+
const promise = super.then(onFulfilled, onRejected);
|
|
2292
|
+
promise.uuid = this.uuid;
|
|
2293
|
+
return promise;
|
|
2294
|
+
}
|
|
2295
|
+
catch(onRejected) {
|
|
2296
|
+
const promise = super.catch(onRejected);
|
|
2297
|
+
promise.uuid = this.uuid;
|
|
2298
|
+
return promise;
|
|
2299
|
+
}
|
|
2300
|
+
finally(onFinally) {
|
|
2301
|
+
const promise = super.finally(onFinally);
|
|
2302
|
+
promise.uuid = this.uuid;
|
|
2303
|
+
return promise;
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
function isFileAndPromiseArray(value) {
|
|
2307
|
+
if (!Array.isArray(value)) return false;
|
|
2308
|
+
return value.every((item) => item instanceof UUIDPromise || item instanceof UUIDFile);
|
|
2309
|
+
}
|
|
2310
|
+
function areFileAndPromiseArraysEqual(value1, value2) {
|
|
2311
|
+
const value1Set = new Set(value1.map(({ uuid }) => uuid));
|
|
2312
|
+
const value2Set = new Set(value2.map(({ uuid }) => uuid));
|
|
2313
|
+
return value1Set.size === value2Set.size && value1Set.isSubsetOf(value2Set);
|
|
2314
|
+
}
|
|
2315
|
+
const ImageCard = memo(
|
|
2316
|
+
forwardRef((props, forwardedRef) => {
|
|
2317
|
+
const { file, alt, error, rightSlot, className, ...rest } = props;
|
|
2318
|
+
return /* @__PURE__ */ jsxs(
|
|
2319
|
+
Card,
|
|
2320
|
+
{
|
|
2321
|
+
className: cx(className, "relative flex h-[200px] w-full flex-col gap-2 overflow-hidden items-center"),
|
|
2322
|
+
ref: forwardedRef,
|
|
2323
|
+
...rest,
|
|
2324
|
+
children: [
|
|
2325
|
+
!file && !error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 grow flex items-center justify-center", children: /* @__PURE__ */ jsx(Spinner, {}) }),
|
|
2326
|
+
!!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(
|
|
2327
|
+
"img",
|
|
2328
|
+
{
|
|
2329
|
+
className: "max-w-full object-cover",
|
|
2330
|
+
src: URL.createObjectURL(file),
|
|
2331
|
+
alt: alt ?? file.name
|
|
2332
|
+
}
|
|
2333
|
+
) }),
|
|
2334
|
+
(!!file || !!error) && /* @__PURE__ */ jsxs(
|
|
2335
|
+
"div",
|
|
2336
|
+
{
|
|
2337
|
+
className: cx("flex w-full items-center gap-2 self-end", {
|
|
2338
|
+
"bg-transparent": !file
|
|
2339
|
+
}),
|
|
2340
|
+
children: [
|
|
2341
|
+
error ? /* @__PURE__ */ jsx(LuIcon, { icon: FileWarning }) : file && /* @__PURE__ */ jsx(LuIcon, { icon: File$1 }),
|
|
2342
|
+
/* @__PURE__ */ jsx(Text, { className: "truncate", size: "sm", children: error ?? (file == null ? void 0 : file.name) }),
|
|
2343
|
+
rightSlot
|
|
2344
|
+
]
|
|
2345
|
+
}
|
|
2346
|
+
)
|
|
2347
|
+
]
|
|
2348
|
+
}
|
|
2349
|
+
);
|
|
2350
|
+
})
|
|
2351
|
+
);
|
|
2352
|
+
const convertBytesToLargestUnit = (bytes) => {
|
|
2353
|
+
const units = ["byte", "kilobyte", "megabyte"];
|
|
2354
|
+
let sizeInUnit = bytes;
|
|
2355
|
+
let unitIndex = 0;
|
|
2356
|
+
while (sizeInUnit > 1e3 && unitIndex < units.length - 1) {
|
|
2357
|
+
sizeInUnit /= 1e3;
|
|
2358
|
+
unitIndex++;
|
|
2359
|
+
}
|
|
2360
|
+
const formatter = new Intl.NumberFormat([], {
|
|
2361
|
+
// 0 for bytes and kilobytes, 1 for megabytes
|
|
2362
|
+
maximumFractionDigits: Math.max(0, unitIndex - 1),
|
|
2363
|
+
style: "unit",
|
|
2364
|
+
unit: units[unitIndex]
|
|
2365
|
+
});
|
|
2366
|
+
return formatter.format(sizeInUnit);
|
|
2367
|
+
};
|
|
2368
|
+
const DisplayFile = memo((props) => {
|
|
2369
|
+
const { file, onRemove, disabled } = props;
|
|
2370
|
+
const [resolvedFile, setResolvedFile] = useState(null);
|
|
2371
|
+
const [error, setError] = useState(null);
|
|
2372
|
+
const openImageViewer = useImageViewer();
|
|
2373
|
+
const { url, name } = useMemo(() => {
|
|
2374
|
+
let url2 = null;
|
|
2375
|
+
let name2;
|
|
2376
|
+
let size;
|
|
2377
|
+
if (resolvedFile == null ? void 0 : resolvedFile.type.startsWith("image/")) {
|
|
2378
|
+
url2 = URL.createObjectURL(resolvedFile);
|
|
2379
|
+
}
|
|
2380
|
+
if (resolvedFile) {
|
|
2381
|
+
name2 = resolvedFile.name;
|
|
2382
|
+
size = convertBytesToLargestUnit(resolvedFile.size);
|
|
2383
|
+
} else {
|
|
2384
|
+
name2 = "Downloading...";
|
|
2385
|
+
size = "...";
|
|
2386
|
+
}
|
|
2387
|
+
return { url: url2, name: name2, size };
|
|
2388
|
+
}, [resolvedFile]);
|
|
2389
|
+
useEffect(() => {
|
|
2390
|
+
if (file instanceof UUIDPromise) {
|
|
2391
|
+
file.then((file2) => {
|
|
2392
|
+
setResolvedFile(file2);
|
|
2393
|
+
}).catch((err) => {
|
|
2394
|
+
setError(err instanceof Error ? err.message : "Unknown error");
|
|
2395
|
+
});
|
|
2396
|
+
} else {
|
|
2397
|
+
setResolvedFile(file);
|
|
2398
|
+
}
|
|
2399
|
+
}, [file]);
|
|
2400
|
+
const handleDownload = useCallback(
|
|
2401
|
+
(event) => {
|
|
2402
|
+
event.stopPropagation();
|
|
2403
|
+
if (!resolvedFile) {
|
|
2404
|
+
throw new Error("Cannot download a file that is not resolved.");
|
|
2405
|
+
}
|
|
2406
|
+
const blob = new Blob([resolvedFile]);
|
|
2407
|
+
saveAs(blob, name);
|
|
2408
|
+
},
|
|
2409
|
+
[name, resolvedFile]
|
|
2410
|
+
);
|
|
2411
|
+
const handleDelete = useCallback(
|
|
2412
|
+
(e) => {
|
|
2413
|
+
e.stopPropagation();
|
|
2414
|
+
onRemove();
|
|
2415
|
+
},
|
|
2416
|
+
[onRemove]
|
|
2417
|
+
);
|
|
2418
|
+
const handleImageCardClick = useCallback(() => {
|
|
2419
|
+
if (!resolvedFile) return;
|
|
2420
|
+
openImageViewer((closeFileViewer) => ({
|
|
2421
|
+
file: resolvedFile,
|
|
2422
|
+
onDelete: !disabled ? () => {
|
|
2423
|
+
onRemove();
|
|
2424
|
+
closeFileViewer();
|
|
2425
|
+
} : void 0
|
|
2426
|
+
}));
|
|
2427
|
+
}, [disabled, onRemove, openImageViewer, resolvedFile]);
|
|
2428
|
+
const rightSlotContent = useMemo(
|
|
2429
|
+
() => /* @__PURE__ */ jsxs(ButtonGroup, { className: "flex grow justify-end", variant: "ghost", accentColor: "base", size: "sm", children: [
|
|
2430
|
+
/* @__PURE__ */ jsx(
|
|
2431
|
+
IconButton,
|
|
2432
|
+
{
|
|
2433
|
+
"aria-label": `Download ${name}`,
|
|
2434
|
+
type: "button",
|
|
2435
|
+
onClick: handleDownload,
|
|
2436
|
+
disabled: !resolvedFile,
|
|
2437
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Download })
|
|
2438
|
+
}
|
|
2439
|
+
),
|
|
2440
|
+
!disabled && /* @__PURE__ */ jsx(IconButton, { type: "button", "aria-label": `Remove ${name}`, disabled, onClick: handleDelete, children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash }) })
|
|
2441
|
+
] }),
|
|
2442
|
+
[disabled, handleDelete, handleDownload, name, resolvedFile]
|
|
2443
|
+
);
|
|
2444
|
+
return url ? /* @__PURE__ */ jsx(
|
|
2445
|
+
ImageCard,
|
|
2446
|
+
{
|
|
2447
|
+
className: "cursor-pointer",
|
|
2448
|
+
onClick: handleImageCardClick,
|
|
2449
|
+
file: resolvedFile,
|
|
2450
|
+
error: error ?? void 0,
|
|
2451
|
+
rightSlot: rightSlotContent
|
|
2452
|
+
}
|
|
2453
|
+
) : /* @__PURE__ */ jsx(FileCard, { file: resolvedFile, error: error ?? void 0, rightSlot: rightSlotContent });
|
|
2454
|
+
});
|
|
2455
|
+
DisplayFile.displayName = "DisplayFile";
|
|
2456
|
+
const PassFailInput = memo((props) => {
|
|
2457
|
+
const [
|
|
2458
|
+
{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
|
|
2459
|
+
{ disabled }
|
|
2460
|
+
] = useFormikInput(props);
|
|
2461
|
+
const { value, onChange, onBlur, name } = fieldProps;
|
|
2462
|
+
const [internalNotes, setInternalNotes] = useState("");
|
|
2463
|
+
const input = useRef(null);
|
|
2464
|
+
const computedHelpText = showInputOnly ? null : helpText;
|
|
2465
|
+
const computedLabel = showInputOnly ? "" : label;
|
|
2466
|
+
const showNotesAndFiles = value.status && field.showNotesAndFilesOn.includes(value.status);
|
|
2467
|
+
const handleStatusChange = useCallback(
|
|
2468
|
+
(status) => {
|
|
2469
|
+
const newValue = field.cleanValue({
|
|
2470
|
+
...value,
|
|
2471
|
+
status
|
|
2472
|
+
});
|
|
2473
|
+
onChange(newValue);
|
|
2474
|
+
onBlur(newValue);
|
|
2475
|
+
},
|
|
2476
|
+
[field, onBlur, onChange, value]
|
|
2477
|
+
);
|
|
2478
|
+
useEffect(() => {
|
|
2479
|
+
setInternalNotes(value.notes);
|
|
2480
|
+
}, [value]);
|
|
2481
|
+
const handleNotesChange = useCallback(
|
|
2482
|
+
(e) => {
|
|
2483
|
+
const notes = e.target.value;
|
|
2484
|
+
setInternalNotes(notes);
|
|
2485
|
+
if (touched || !field.onlyValidateAfterTouched) {
|
|
2486
|
+
helpers.setError(
|
|
2487
|
+
field.getError({
|
|
2488
|
+
...value,
|
|
2489
|
+
notes: internalNotes
|
|
2490
|
+
})
|
|
2491
|
+
);
|
|
2492
|
+
}
|
|
2493
|
+
},
|
|
2494
|
+
[field, helpers, internalNotes, touched, value]
|
|
2495
|
+
);
|
|
2496
|
+
const handleNotesBlur = useCallback(() => {
|
|
2497
|
+
const newValue = {
|
|
2498
|
+
...value,
|
|
2499
|
+
notes: internalNotes
|
|
2500
|
+
};
|
|
2501
|
+
onChange(newValue);
|
|
2502
|
+
onBlur(newValue);
|
|
2503
|
+
}, [internalNotes, onBlur, onChange, value]);
|
|
2504
|
+
const handleRemoveFile = useCallback(
|
|
2505
|
+
(index) => {
|
|
2506
|
+
const files = [...value.files];
|
|
2507
|
+
void files.splice(index, 1);
|
|
2508
|
+
onChange({
|
|
2509
|
+
...value,
|
|
2510
|
+
files
|
|
2511
|
+
});
|
|
2512
|
+
},
|
|
2513
|
+
[onChange, value]
|
|
2514
|
+
);
|
|
2515
|
+
const handleFileButtonClick = useCallback(() => {
|
|
2516
|
+
var _a2;
|
|
2517
|
+
(_a2 = input.current) == null ? void 0 : _a2.click();
|
|
2518
|
+
}, []);
|
|
2519
|
+
const handleFilesChange = useCallback(
|
|
2520
|
+
(e) => {
|
|
2521
|
+
const files = Array.from(e.target.files ?? []).map((file) => UUIDFile.from(v4(), file));
|
|
2522
|
+
const newValue = {
|
|
2523
|
+
...value,
|
|
2524
|
+
files: [...value.files, ...files]
|
|
2525
|
+
};
|
|
2526
|
+
onChange(newValue);
|
|
2527
|
+
onBlur(newValue);
|
|
2528
|
+
},
|
|
2529
|
+
[onBlur, onChange, value]
|
|
2530
|
+
);
|
|
2531
|
+
useEffect(() => {
|
|
2532
|
+
if (!input.current) return;
|
|
2533
|
+
const abortController = new AbortController();
|
|
2534
|
+
input.current.addEventListener(
|
|
2535
|
+
"cancel",
|
|
2536
|
+
() => {
|
|
2537
|
+
onBlur(value);
|
|
2538
|
+
},
|
|
2539
|
+
{
|
|
2540
|
+
signal: abortController.signal
|
|
2541
|
+
}
|
|
2542
|
+
);
|
|
2543
|
+
return () => {
|
|
2544
|
+
abortController.abort();
|
|
2545
|
+
};
|
|
2546
|
+
}, [onBlur, value]);
|
|
2547
|
+
const statusInputId = `${inputId}-status`;
|
|
2548
|
+
const notesInputId = `${inputId}-notes`;
|
|
2549
|
+
const filesInputId = `${inputId}-files`;
|
|
2550
|
+
return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsx(
|
|
2551
|
+
InputWithLabel,
|
|
2552
|
+
{
|
|
2553
|
+
size,
|
|
2554
|
+
severity,
|
|
2555
|
+
inputId,
|
|
2556
|
+
labelId,
|
|
2557
|
+
label: computedLabel,
|
|
2558
|
+
image: showInputOnly ? void 0 : field.image,
|
|
2559
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
2560
|
+
/* @__PURE__ */ jsx(
|
|
2561
|
+
RadioGroup.Root,
|
|
2562
|
+
{
|
|
2563
|
+
id: statusInputId,
|
|
2564
|
+
className: "flex gap-2",
|
|
2565
|
+
name,
|
|
2566
|
+
value: value.status,
|
|
2567
|
+
disabled,
|
|
2568
|
+
accentColor: "base",
|
|
2569
|
+
variant: "surface",
|
|
2570
|
+
size: "sm",
|
|
2571
|
+
onValueChange: handleStatusChange,
|
|
2572
|
+
children: passFailFieldStatuses.map((status) => {
|
|
2573
|
+
const { label: label2 } = passFailFieldStatusMapping[status];
|
|
2574
|
+
return /* @__PURE__ */ jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
2575
|
+
/* @__PURE__ */ jsx(RadioGroup.Item, { value: status, children: /* @__PURE__ */ jsx(RadioGroup.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Circle, className: "fill-current" }) }) }),
|
|
2576
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: label2 })
|
|
2577
|
+
] }, `${inputId}-${status}`);
|
|
2578
|
+
})
|
|
2579
|
+
}
|
|
2580
|
+
),
|
|
2581
|
+
showNotesAndFiles && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2582
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
2583
|
+
TextArea,
|
|
2584
|
+
{
|
|
2585
|
+
id: notesInputId,
|
|
2586
|
+
value: internalNotes,
|
|
2587
|
+
name,
|
|
2588
|
+
onChange: handleNotesChange,
|
|
2589
|
+
onBlur: handleNotesBlur,
|
|
2590
|
+
className: "field-sizing-content w-full min-h-12",
|
|
2591
|
+
placeholder: "Notes",
|
|
2592
|
+
resize: "vertical",
|
|
2593
|
+
accentColor: "base",
|
|
2594
|
+
variant: "surface",
|
|
2595
|
+
size: "sm",
|
|
2596
|
+
disabled
|
|
2597
|
+
}
|
|
2598
|
+
) }),
|
|
2599
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
2600
|
+
/* @__PURE__ */ jsxs(
|
|
2601
|
+
Button,
|
|
2602
|
+
{
|
|
2603
|
+
className: "w-max",
|
|
2604
|
+
size: "sm",
|
|
2605
|
+
variant: "soft",
|
|
2606
|
+
accentColor: "base",
|
|
2607
|
+
onClick: handleFileButtonClick,
|
|
2608
|
+
type: "button",
|
|
2609
|
+
disabled,
|
|
2610
|
+
children: [
|
|
2611
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Upload }),
|
|
2612
|
+
"Select files"
|
|
2613
|
+
]
|
|
2614
|
+
}
|
|
2615
|
+
),
|
|
2616
|
+
/* @__PURE__ */ jsx(
|
|
2617
|
+
"input",
|
|
2618
|
+
{
|
|
2619
|
+
id: filesInputId,
|
|
2620
|
+
name,
|
|
2621
|
+
type: "file",
|
|
2622
|
+
ref: input,
|
|
2623
|
+
multiple: true,
|
|
2624
|
+
className: "hidden",
|
|
2625
|
+
onChange: handleFilesChange,
|
|
2626
|
+
value: ""
|
|
2627
|
+
}
|
|
2628
|
+
),
|
|
2629
|
+
value.files.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex h-max flex-col gap-2", children: value.files.map((file, index) => /* @__PURE__ */ jsx(
|
|
2630
|
+
DisplayFile,
|
|
2631
|
+
{
|
|
2632
|
+
file,
|
|
2633
|
+
onRemove: () => {
|
|
2634
|
+
handleRemoveFile(index);
|
|
2635
|
+
},
|
|
2636
|
+
disabled
|
|
2637
|
+
},
|
|
2638
|
+
index
|
|
2639
|
+
)) })
|
|
2640
|
+
] })
|
|
2641
|
+
] })
|
|
2642
|
+
] })
|
|
2643
|
+
}
|
|
2644
|
+
) });
|
|
2645
|
+
});
|
|
2646
|
+
PassFailInput.displayName = "PassFailInput";
|
|
2647
|
+
const isPassFailFieldStatus = (value) => {
|
|
2648
|
+
return typeof value === "string" && passFailFieldStatuses.includes(value);
|
|
2649
|
+
};
|
|
2650
|
+
const isSerializedPassFailFieldValue = (value) => {
|
|
2651
|
+
if (value === null || typeof value !== "object") return false;
|
|
2652
|
+
if (!("status" in value) || !isPassFailFieldStatus(value.status)) return false;
|
|
2653
|
+
if (!("notes" in value) || !(typeof value.notes === "string")) return false;
|
|
2654
|
+
if (!("files" in value) || !(Array.isArray(value.files) && value.files.length === 0)) return false;
|
|
2655
|
+
return true;
|
|
2656
|
+
};
|
|
2657
|
+
const isPassFailFieldValue = (value) => {
|
|
2658
|
+
if (value === null || typeof value !== "object") return false;
|
|
2659
|
+
if (!("status" in value) || !isPassFailFieldStatus(value.status)) return false;
|
|
2660
|
+
if (!("notes" in value) || !(typeof value.notes === "string")) return false;
|
|
2661
|
+
if (!("files" in value) || !isFileAndPromiseArray(value.files)) return false;
|
|
2662
|
+
return true;
|
|
2663
|
+
};
|
|
2664
|
+
const serializePassFailFieldValue = (value) => {
|
|
2665
|
+
return {
|
|
2666
|
+
status: value.status,
|
|
2667
|
+
notes: value.notes,
|
|
2668
|
+
files: []
|
|
2669
|
+
};
|
|
2670
|
+
};
|
|
2671
|
+
const deserializePassFailFieldValue = (value) => {
|
|
2672
|
+
return {
|
|
2673
|
+
status: value.status,
|
|
2674
|
+
notes: value.notes,
|
|
2675
|
+
files: []
|
|
2676
|
+
};
|
|
2677
|
+
};
|
|
2678
|
+
const arePassFieldValuesEqual = (value1, value2) => {
|
|
2679
|
+
if (value1.status !== value2.status) return false;
|
|
2680
|
+
if (value1.notes !== value2.notes) return false;
|
|
2681
|
+
if (!areFileAndPromiseArraysEqual(value1.files, value2.files)) return false;
|
|
2682
|
+
return true;
|
|
2683
|
+
};
|
|
2684
|
+
const _PassFailField = class _PassFailField extends BaseField {
|
|
2685
|
+
constructor(options) {
|
|
2686
|
+
const { showNotesAndFilesOn, ...rest } = options;
|
|
2687
|
+
super(rest);
|
|
2688
|
+
__publicField(this, "type", "pass-fail");
|
|
2689
|
+
__publicField(this, "onlyValidateAfterTouched", false);
|
|
2690
|
+
__publicField(this, "showNotesAndFilesOn");
|
|
2691
|
+
this.showNotesAndFilesOn = showNotesAndFilesOn;
|
|
2692
|
+
}
|
|
2693
|
+
static getFieldCreationSchema(parentPath = "") {
|
|
2694
|
+
const path = parentPath && `${parentPath}.`;
|
|
2695
|
+
return [
|
|
2696
|
+
{
|
|
2697
|
+
field: new MultiSelectField({
|
|
2698
|
+
identifier: `${path}showNotesAndFilesOn`,
|
|
2699
|
+
label: "Show notes and files on",
|
|
2700
|
+
description: "Show the notes and files on desired statuses.",
|
|
2701
|
+
options: passFailFieldStatuses.map((status) => {
|
|
2702
|
+
const { label } = passFailFieldStatusMapping[status];
|
|
2703
|
+
return {
|
|
2704
|
+
value: status,
|
|
2705
|
+
label
|
|
2706
|
+
};
|
|
2707
|
+
}),
|
|
2708
|
+
required: false
|
|
2709
|
+
}),
|
|
2710
|
+
showDirectly: false
|
|
2711
|
+
}
|
|
2712
|
+
];
|
|
2713
|
+
}
|
|
2714
|
+
serialize() {
|
|
2715
|
+
return {
|
|
2716
|
+
...super.serialize(),
|
|
2717
|
+
showNotesAndFilesOn: this.showNotesAndFilesOn
|
|
2718
|
+
};
|
|
2719
|
+
}
|
|
2720
|
+
getOptions() {
|
|
2721
|
+
return {
|
|
2722
|
+
...super.getOptions(),
|
|
2723
|
+
showNotesAndFilesOn: this.showNotesAndFilesOn
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2726
|
+
duplicate(identifier) {
|
|
2727
|
+
return new _PassFailField({
|
|
2728
|
+
...this.getOptions(),
|
|
2729
|
+
identifier
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2732
|
+
setOptions(options) {
|
|
2733
|
+
const { showNotesAndFilesOn, ...rest } = options;
|
|
2734
|
+
this.showNotesAndFilesOn = showNotesAndFilesOn ?? this.showNotesAndFilesOn;
|
|
2735
|
+
super.setOptions(rest);
|
|
2736
|
+
}
|
|
2737
|
+
getFieldValidators() {
|
|
2738
|
+
const validators = super.getFieldValidators();
|
|
2739
|
+
const showNotesAndFileOn = this.showNotesAndFilesOn;
|
|
2740
|
+
const blankValue = this.blankValue();
|
|
2741
|
+
if (showNotesAndFileOn.length > 0) {
|
|
2742
|
+
validators.push((value) => {
|
|
2743
|
+
if (!value.status || !showNotesAndFileOn.includes(value.status)) return;
|
|
2744
|
+
if (blankValue.notes === value.notes) {
|
|
2745
|
+
return "Notes is required.";
|
|
2746
|
+
}
|
|
2747
|
+
});
|
|
2748
|
+
validators.push((value) => {
|
|
2749
|
+
if (!value.status || !showNotesAndFileOn.includes(value.status)) return;
|
|
2750
|
+
if (areFileAndPromiseArraysEqual(blankValue.files, value.files)) {
|
|
2751
|
+
return "Files is required.";
|
|
2752
|
+
}
|
|
2753
|
+
});
|
|
2754
|
+
}
|
|
2755
|
+
return validators;
|
|
2756
|
+
}
|
|
2757
|
+
static deserialize(data) {
|
|
2758
|
+
return new _PassFailField({
|
|
2759
|
+
...data,
|
|
2760
|
+
showNotesAndFilesOn: data.showNotesAndFilesOn ?? false
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
serializeValue(value) {
|
|
2764
|
+
return serializePassFailFieldValue(value);
|
|
2765
|
+
}
|
|
2766
|
+
deserializeValue(value) {
|
|
2767
|
+
return deserializePassFailFieldValue(value);
|
|
2768
|
+
}
|
|
2769
|
+
render(props) {
|
|
2770
|
+
return /* @__PURE__ */ jsx(PassFailInput, { field: this, ...props });
|
|
2771
|
+
}
|
|
2772
|
+
isSerializedValueValid(value) {
|
|
2773
|
+
return isSerializedPassFailFieldValue(value);
|
|
2774
|
+
}
|
|
2775
|
+
isValueValid(value) {
|
|
2776
|
+
return isPassFailFieldValue(value);
|
|
2777
|
+
}
|
|
2778
|
+
areValuesEqual(value1, value2) {
|
|
2779
|
+
return arePassFieldValuesEqual(value1, value2);
|
|
2780
|
+
}
|
|
2781
|
+
blankValue() {
|
|
2782
|
+
return {
|
|
2783
|
+
status: null,
|
|
2784
|
+
notes: "",
|
|
2785
|
+
files: []
|
|
2786
|
+
};
|
|
2787
|
+
}
|
|
2788
|
+
cleanValue(value) {
|
|
2789
|
+
if (value.status && this.showNotesAndFilesOn.includes(value.status)) {
|
|
2790
|
+
return value;
|
|
2791
|
+
} else {
|
|
2792
|
+
return {
|
|
2793
|
+
status: value.status,
|
|
2794
|
+
notes: "",
|
|
2795
|
+
files: []
|
|
2796
|
+
};
|
|
2797
|
+
}
|
|
2798
|
+
}
|
|
2799
|
+
};
|
|
2800
|
+
__publicField(_PassFailField, "fieldTypeName", "Pass - Fail");
|
|
2801
|
+
__publicField(_PassFailField, "fieldTypeDescription", "Track pass, fail, or N/A outcome.");
|
|
2802
|
+
let PassFailField = _PassFailField;
|
|
1656
2803
|
const RadioInput = memo((props) => {
|
|
1657
2804
|
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1658
2805
|
const { name, onChange, onBlur, value } = fieldProps;
|
|
@@ -1678,68 +2825,207 @@ const RadioInput = memo((props) => {
|
|
|
1678
2825
|
labelId,
|
|
1679
2826
|
label: computedLabel,
|
|
1680
2827
|
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,
|
|
2828
|
+
children: /* @__PURE__ */ jsxs(
|
|
2829
|
+
RadioGroup.Root,
|
|
2830
|
+
{
|
|
2831
|
+
id: inputId,
|
|
2832
|
+
name,
|
|
2833
|
+
className: "flex flex-col gap-1",
|
|
2834
|
+
accentColor: "base",
|
|
2835
|
+
variant: "surface",
|
|
2836
|
+
size: "sm",
|
|
2837
|
+
value: value ?? "",
|
|
2838
|
+
onValueChange: handleChange,
|
|
2839
|
+
disabled,
|
|
2840
|
+
children: [
|
|
2841
|
+
field.options.map((option, index) => /* @__PURE__ */ jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
2842
|
+
/* @__PURE__ */ jsx(RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(RadioGroup.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Circle, className: "fill-current" }) }) }),
|
|
2843
|
+
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
|
|
2844
|
+
] }, `${inputId}-${option.value}-${index}`)),
|
|
2845
|
+
!!value && /* @__PURE__ */ jsxs(
|
|
2846
|
+
Button,
|
|
2847
|
+
{
|
|
2848
|
+
onClick: handleClear,
|
|
2849
|
+
className: "w-max -mx-2",
|
|
2850
|
+
type: "button",
|
|
2851
|
+
variant: "ghost",
|
|
2852
|
+
accentColor: "base",
|
|
2853
|
+
size: "sm",
|
|
2854
|
+
children: [
|
|
2855
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: X }),
|
|
2856
|
+
"Clear"
|
|
2857
|
+
]
|
|
2858
|
+
}
|
|
2859
|
+
)
|
|
2860
|
+
]
|
|
2861
|
+
}
|
|
2862
|
+
)
|
|
2863
|
+
}
|
|
2864
|
+
) });
|
|
2865
|
+
});
|
|
2866
|
+
RadioInput.displayName = "SelectInput";
|
|
2867
|
+
const _RadioField = class _RadioField extends BaseOptionsField {
|
|
2868
|
+
constructor(options) {
|
|
2869
|
+
super(options);
|
|
2870
|
+
__publicField(this, "type", "radio");
|
|
2871
|
+
__publicField(this, "onlyValidateAfterTouched", false);
|
|
2872
|
+
}
|
|
2873
|
+
serialize() {
|
|
2874
|
+
return super.serialize();
|
|
2875
|
+
}
|
|
2876
|
+
getOptions() {
|
|
2877
|
+
return super.getOptions();
|
|
2878
|
+
}
|
|
2879
|
+
duplicate(identifier) {
|
|
2880
|
+
return new _RadioField({
|
|
2881
|
+
...this.getOptions(),
|
|
2882
|
+
identifier
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2885
|
+
setOptions(options) {
|
|
2886
|
+
super.setOptions(options);
|
|
2887
|
+
}
|
|
2888
|
+
static deserialize(data) {
|
|
2889
|
+
return new _RadioField(data);
|
|
2890
|
+
}
|
|
2891
|
+
serializeValue(value) {
|
|
2892
|
+
return value;
|
|
2893
|
+
}
|
|
2894
|
+
deserializeValue(value) {
|
|
2895
|
+
return value;
|
|
2896
|
+
}
|
|
2897
|
+
render(props) {
|
|
2898
|
+
return /* @__PURE__ */ jsx(RadioInput, { field: this, ...props });
|
|
2899
|
+
}
|
|
2900
|
+
isSerializedValueValid(value) {
|
|
2901
|
+
return typeof value === "string" || value === "null";
|
|
2902
|
+
}
|
|
2903
|
+
isValueValid(value) {
|
|
2904
|
+
return typeof value === "string" || value === "null";
|
|
2905
|
+
}
|
|
2906
|
+
blankValue() {
|
|
2907
|
+
return null;
|
|
2908
|
+
}
|
|
2909
|
+
areValuesEqual(value1, value2) {
|
|
2910
|
+
return value1 === value2;
|
|
2911
|
+
}
|
|
2912
|
+
};
|
|
2913
|
+
__publicField(_RadioField, "fieldTypeName", "Option list");
|
|
2914
|
+
__publicField(_RadioField, "fieldTypeDescription", "Allows the user to select a single option from a list of options.");
|
|
2915
|
+
let RadioField = _RadioField;
|
|
2916
|
+
const RatingInput = memo((props) => {
|
|
2917
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
2918
|
+
const { name, onChange, onBlur, value } = fieldProps;
|
|
2919
|
+
const computedHelpText = showInputOnly ? null : helpText;
|
|
2920
|
+
const computedLabel = showInputOnly ? "" : label;
|
|
2921
|
+
const handleChange = useCallback(
|
|
2922
|
+
(value2) => {
|
|
2923
|
+
onChange(value2);
|
|
2924
|
+
onBlur(value2);
|
|
2925
|
+
},
|
|
2926
|
+
[onBlur, onChange]
|
|
2927
|
+
);
|
|
2928
|
+
const handleClear = useCallback(() => {
|
|
2929
|
+
onChange(null);
|
|
2930
|
+
onBlur(null);
|
|
2931
|
+
}, [onBlur, onChange]);
|
|
2932
|
+
const ratingOptions = Array.from({ length: field.maxRating }, (_, i) => i + 1);
|
|
2933
|
+
return /* @__PURE__ */ jsx(InputWithLabelAndHelpText, { helpText: computedHelpText, severity, children: /* @__PURE__ */ jsx(
|
|
2934
|
+
InputWithLabel,
|
|
2935
|
+
{
|
|
2936
|
+
size,
|
|
2937
|
+
severity,
|
|
2938
|
+
inputId,
|
|
2939
|
+
labelId,
|
|
2940
|
+
label: computedLabel,
|
|
2941
|
+
image: showInputOnly ? void 0 : field.image,
|
|
2942
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-1 items-center", children: [
|
|
2943
|
+
/* @__PURE__ */ jsx(
|
|
2944
|
+
Rating.Root,
|
|
2945
|
+
{
|
|
2946
|
+
id: inputId,
|
|
2947
|
+
name,
|
|
2948
|
+
className: "flex items-center gap-0.5",
|
|
2949
|
+
value,
|
|
2950
|
+
onValueChange: handleChange,
|
|
2951
|
+
disabled,
|
|
2952
|
+
children: ratingOptions.map((rating) => /* @__PURE__ */ jsx(
|
|
2953
|
+
Rating.Item,
|
|
1700
2954
|
{
|
|
1701
|
-
|
|
1702
|
-
className: "
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
}
|
|
1712
|
-
)
|
|
1713
|
-
]
|
|
1714
|
-
}
|
|
1715
|
-
)
|
|
2955
|
+
value: rating,
|
|
2956
|
+
className: "group size-7 flex cursor-pointer disabled:opacity-50 disabled:pointer-events-none items-center justify-center text-yellow-500 transition-colors",
|
|
2957
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Star, className: "group-data-[active=true]:fill-current size-full" })
|
|
2958
|
+
},
|
|
2959
|
+
`${inputId}-${rating}`
|
|
2960
|
+
))
|
|
2961
|
+
}
|
|
2962
|
+
),
|
|
2963
|
+
!disabled && value !== null && /* @__PURE__ */ jsx(IconButton, { onClick: handleClear, type: "button", variant: "ghost", accentColor: "base", size: "sm", children: /* @__PURE__ */ jsx(LuIcon, { icon: X }) })
|
|
2964
|
+
] })
|
|
1716
2965
|
}
|
|
1717
2966
|
) });
|
|
1718
2967
|
});
|
|
1719
|
-
|
|
1720
|
-
const
|
|
2968
|
+
RatingInput.displayName = "RatingInput";
|
|
2969
|
+
const _RatingField = class _RatingField extends BaseField {
|
|
1721
2970
|
constructor(options) {
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
__publicField(this, "
|
|
2971
|
+
const { maxRating, ...rest } = options;
|
|
2972
|
+
super(rest);
|
|
2973
|
+
__publicField(this, "type", "rating");
|
|
2974
|
+
__publicField(this, "maxRating");
|
|
2975
|
+
this.maxRating = maxRating;
|
|
2976
|
+
}
|
|
2977
|
+
static getFieldCreationSchema(parentPath = "") {
|
|
2978
|
+
const path = parentPath && `${parentPath}.`;
|
|
2979
|
+
return [
|
|
2980
|
+
{
|
|
2981
|
+
field: new NumberField({
|
|
2982
|
+
label: "Max Rating",
|
|
2983
|
+
description: "Maximum rating value",
|
|
2984
|
+
integers: true,
|
|
2985
|
+
required: false,
|
|
2986
|
+
minimum: 1,
|
|
2987
|
+
maximum: 10,
|
|
2988
|
+
identifier: `${path}maxRating`
|
|
2989
|
+
}),
|
|
2990
|
+
showDirectly: false
|
|
2991
|
+
}
|
|
2992
|
+
];
|
|
2993
|
+
}
|
|
2994
|
+
getFieldValidators() {
|
|
2995
|
+
const validators = super.getFieldValidators();
|
|
2996
|
+
const max = this.maxRating;
|
|
2997
|
+
validators.push((value) => {
|
|
2998
|
+
if (typeof value === "number" && (value < 1 || value > max)) {
|
|
2999
|
+
return `Rating must be between 1 and ${max}.`;
|
|
3000
|
+
}
|
|
3001
|
+
});
|
|
3002
|
+
return validators;
|
|
1725
3003
|
}
|
|
1726
3004
|
serialize() {
|
|
1727
|
-
return
|
|
3005
|
+
return {
|
|
3006
|
+
...super.serialize(),
|
|
3007
|
+
maxRating: this.maxRating
|
|
3008
|
+
};
|
|
1728
3009
|
}
|
|
1729
3010
|
getOptions() {
|
|
1730
|
-
return
|
|
3011
|
+
return {
|
|
3012
|
+
...super.getOptions(),
|
|
3013
|
+
maxRating: this.maxRating
|
|
3014
|
+
};
|
|
1731
3015
|
}
|
|
1732
3016
|
duplicate(identifier) {
|
|
1733
|
-
return new
|
|
3017
|
+
return new _RatingField({
|
|
1734
3018
|
...this.getOptions(),
|
|
1735
3019
|
identifier
|
|
1736
3020
|
});
|
|
1737
3021
|
}
|
|
1738
3022
|
setOptions(options) {
|
|
1739
|
-
|
|
3023
|
+
const { maxRating, ...rest } = options;
|
|
3024
|
+
this.maxRating = maxRating ?? this.maxRating;
|
|
3025
|
+
super.setOptions(rest);
|
|
1740
3026
|
}
|
|
1741
3027
|
static deserialize(data) {
|
|
1742
|
-
return new
|
|
3028
|
+
return new _RatingField(data);
|
|
1743
3029
|
}
|
|
1744
3030
|
serializeValue(value) {
|
|
1745
3031
|
return value;
|
|
@@ -1748,24 +3034,24 @@ const _RadioField = class _RadioField extends BaseOptionsField {
|
|
|
1748
3034
|
return value;
|
|
1749
3035
|
}
|
|
1750
3036
|
render(props) {
|
|
1751
|
-
return /* @__PURE__ */ jsx(
|
|
3037
|
+
return /* @__PURE__ */ jsx(RatingInput, { field: this, ...props });
|
|
1752
3038
|
}
|
|
1753
3039
|
isSerializedValueValid(value) {
|
|
1754
|
-
return typeof value === "
|
|
3040
|
+
return typeof value === "number" || value === null;
|
|
1755
3041
|
}
|
|
1756
3042
|
isValueValid(value) {
|
|
1757
|
-
return typeof value === "
|
|
1758
|
-
}
|
|
1759
|
-
blankValue() {
|
|
1760
|
-
return null;
|
|
3043
|
+
return typeof value === "number" || value === null;
|
|
1761
3044
|
}
|
|
1762
3045
|
areValuesEqual(value1, value2) {
|
|
1763
3046
|
return value1 === value2;
|
|
1764
3047
|
}
|
|
3048
|
+
blankValue() {
|
|
3049
|
+
return null;
|
|
3050
|
+
}
|
|
1765
3051
|
};
|
|
1766
|
-
__publicField(
|
|
1767
|
-
__publicField(
|
|
1768
|
-
let
|
|
3052
|
+
__publicField(_RatingField, "fieldTypeName", "Rating");
|
|
3053
|
+
__publicField(_RatingField, "fieldTypeDescription", "Allows users to select a rating value.");
|
|
3054
|
+
let RatingField = _RatingField;
|
|
1769
3055
|
const ScannerContext = createContext(() => {
|
|
1770
3056
|
throw new Error("No ScannerProvider found");
|
|
1771
3057
|
});
|
|
@@ -24092,7 +25378,6 @@ var PDF417CodewordDecoder = (
|
|
|
24092
25378
|
return PDF417CodewordDecoder2;
|
|
24093
25379
|
}()
|
|
24094
25380
|
);
|
|
24095
|
-
const global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
|
|
24096
25381
|
var PDF417ResultMetadata = (
|
|
24097
25382
|
/** @class */
|
|
24098
25383
|
function() {
|
|
@@ -24387,8 +25672,8 @@ function getBigIntConstructor() {
|
|
|
24387
25672
|
if (typeof window !== "undefined") {
|
|
24388
25673
|
return window["BigInt"] || null;
|
|
24389
25674
|
}
|
|
24390
|
-
if (typeof global
|
|
24391
|
-
return global
|
|
25675
|
+
if (typeof global !== "undefined") {
|
|
25676
|
+
return global["BigInt"] || null;
|
|
24392
25677
|
}
|
|
24393
25678
|
if (typeof self !== "undefined") {
|
|
24394
25679
|
return self["BigInt"] || null;
|
|
@@ -29882,7 +31167,15 @@ const SCANNER_HINTS = /* @__PURE__ */ new Map([
|
|
|
29882
31167
|
]
|
|
29883
31168
|
]);
|
|
29884
31169
|
const Scanner = memo((props) => {
|
|
29885
|
-
const {
|
|
31170
|
+
const {
|
|
31171
|
+
children,
|
|
31172
|
+
open,
|
|
31173
|
+
onOpenChange,
|
|
31174
|
+
// oxlint-disable-line unbound-method
|
|
31175
|
+
defaultOpen,
|
|
31176
|
+
modal,
|
|
31177
|
+
...rest
|
|
31178
|
+
} = props;
|
|
29886
31179
|
return /* @__PURE__ */ jsxs(Overlay.Root, { open, onOpenChange, defaultOpen, modal, children: [
|
|
29887
31180
|
!!children && /* @__PURE__ */ jsx(Overlay.Trigger, { asChild: true, children }),
|
|
29888
31181
|
/* @__PURE__ */ jsxs(Overlay.Content, { children: [
|
|
@@ -29904,7 +31197,7 @@ const ScannerInternal = memo((props) => {
|
|
|
29904
31197
|
hints: SCANNER_HINTS
|
|
29905
31198
|
});
|
|
29906
31199
|
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:
|
|
31200
|
+
/* @__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
31201
|
/* @__PURE__ */ jsx("div", { className: "grow w-full max-h-full overflow-hidden p-4", children: /* @__PURE__ */ jsx("video", { className: "size-full", ref }) })
|
|
29909
31202
|
] });
|
|
29910
31203
|
});
|
|
@@ -30011,7 +31304,7 @@ const ScanInput = memo((props) => {
|
|
|
30011
31304
|
accentColor: "base",
|
|
30012
31305
|
disabled,
|
|
30013
31306
|
children: [
|
|
30014
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
31307
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Maximize }),
|
|
30015
31308
|
"Scan"
|
|
30016
31309
|
]
|
|
30017
31310
|
}
|
|
@@ -30149,7 +31442,6 @@ const _StringField = class _StringField extends BaseStringField {
|
|
|
30149
31442
|
super.setOptions(options);
|
|
30150
31443
|
}
|
|
30151
31444
|
static deserialize(data) {
|
|
30152
|
-
if (data.type !== "string") throw new Error("Type mismatch.");
|
|
30153
31445
|
const { maximum_length, minimum_length, ...rest } = data;
|
|
30154
31446
|
return new _StringField({
|
|
30155
31447
|
...rest,
|
|
@@ -30259,107 +31551,6 @@ const _TextField = class _TextField extends BaseStringField {
|
|
|
30259
31551
|
__publicField(_TextField, "fieldTypeName", "Paragraph");
|
|
30260
31552
|
__publicField(_TextField, "fieldTypeDescription", `Paragraph fields can hold up to ${LONG_TEXT_FIELD_MAX_LENGTH} characters and can have multiple lines.`);
|
|
30261
31553
|
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
31554
|
const UploadInput = memo((props) => {
|
|
30364
31555
|
var _a2;
|
|
30365
31556
|
const [{ inputId, labelId, label, size, severity, helpText, showInputOnly, field, fieldProps }, { disabled }] = useFormikInput(props);
|
|
@@ -30384,7 +31575,7 @@ const UploadInput = memo((props) => {
|
|
|
30384
31575
|
onBlur([]);
|
|
30385
31576
|
return;
|
|
30386
31577
|
}
|
|
30387
|
-
const fileArray = Array.from(files);
|
|
31578
|
+
const fileArray = Array.from(files).map((file) => UUIDFile.from(v4(), file));
|
|
30388
31579
|
const newValue = [...value, ...fileArray];
|
|
30389
31580
|
onChange(newValue);
|
|
30390
31581
|
onBlur(newValue);
|
|
@@ -30392,7 +31583,7 @@ const UploadInput = memo((props) => {
|
|
|
30392
31583
|
const handleRemove = useCallback(
|
|
30393
31584
|
(index) => {
|
|
30394
31585
|
const files = [...value];
|
|
30395
|
-
files.splice(index, 1);
|
|
31586
|
+
void files.splice(index, 1);
|
|
30396
31587
|
onChange(files);
|
|
30397
31588
|
},
|
|
30398
31589
|
[value, onChange]
|
|
@@ -30439,7 +31630,7 @@ const UploadInput = memo((props) => {
|
|
|
30439
31630
|
type: "button",
|
|
30440
31631
|
disabled,
|
|
30441
31632
|
children: [
|
|
30442
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
31633
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Upload }),
|
|
30443
31634
|
buttonText
|
|
30444
31635
|
]
|
|
30445
31636
|
}
|
|
@@ -30464,7 +31655,6 @@ const UploadInput = memo((props) => {
|
|
|
30464
31655
|
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
31656
|
DisplayFile,
|
|
30466
31657
|
{
|
|
30467
|
-
field,
|
|
30468
31658
|
file,
|
|
30469
31659
|
onRemove: () => {
|
|
30470
31660
|
handleRemove(index);
|
|
@@ -30476,92 +31666,6 @@ const UploadInput = memo((props) => {
|
|
|
30476
31666
|
] });
|
|
30477
31667
|
});
|
|
30478
31668
|
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
31669
|
const _UploadField = class _UploadField extends BaseField {
|
|
30566
31670
|
constructor(options) {
|
|
30567
31671
|
const { extensions, maximum_files, maximum_size, ...base } = options;
|
|
@@ -30641,7 +31745,7 @@ const _UploadField = class _UploadField extends BaseField {
|
|
|
30641
31745
|
const maxFileSizeInB = maxFileSizeInMB * 1e3 * 1e3;
|
|
30642
31746
|
const maxFiles = this.maxFiles || 1;
|
|
30643
31747
|
validators.push((value) => {
|
|
30644
|
-
if (value && value.some((file) => file instanceof
|
|
31748
|
+
if (value && value.some((file) => file instanceof UUIDFile && file.size > maxFileSizeInB)) {
|
|
30645
31749
|
return `Files must be at most ${maxFileSizeInMB}MB.`;
|
|
30646
31750
|
}
|
|
30647
31751
|
});
|
|
@@ -30698,16 +31802,10 @@ const _UploadField = class _UploadField extends BaseField {
|
|
|
30698
31802
|
}
|
|
30699
31803
|
isValueValid(value) {
|
|
30700
31804
|
if (!Array.isArray(value)) return false;
|
|
30701
|
-
return value.every((item) => item instanceof UUIDPromise || item instanceof
|
|
31805
|
+
return value.every((item) => item instanceof UUIDPromise || item instanceof UUIDFile);
|
|
30702
31806
|
}
|
|
30703
31807
|
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;
|
|
31808
|
+
return areFileAndPromiseArraysEqual(value1, value2);
|
|
30711
31809
|
}
|
|
30712
31810
|
blankValue() {
|
|
30713
31811
|
return [];
|
|
@@ -30729,23 +31827,27 @@ const FieldTypeToClsMapping = {
|
|
|
30729
31827
|
"multi-select": MultiSelectField,
|
|
30730
31828
|
radio: RadioField,
|
|
30731
31829
|
"checkbox-list": CheckboxListField,
|
|
30732
|
-
|
|
31830
|
+
"pass-fail": PassFailField,
|
|
31831
|
+
otp: OTPField,
|
|
31832
|
+
rating: RatingField
|
|
30733
31833
|
};
|
|
30734
31834
|
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
|
-
|
|
31835
|
+
boolean: SquareCheck,
|
|
31836
|
+
date: Calendar,
|
|
31837
|
+
"multi-string": List,
|
|
31838
|
+
number: Hash,
|
|
31839
|
+
qr: Scan,
|
|
31840
|
+
"multi-select": ListChecks,
|
|
31841
|
+
select: ListTodo,
|
|
31842
|
+
string: TextCursorInput,
|
|
31843
|
+
text: AlignJustify,
|
|
31844
|
+
upload: Upload,
|
|
31845
|
+
section: LayoutPanelTop,
|
|
31846
|
+
radio: CircleDot,
|
|
31847
|
+
"checkbox-list": CopyCheck,
|
|
31848
|
+
"pass-fail": ClipboardList,
|
|
31849
|
+
otp: RectangleEllipsis,
|
|
31850
|
+
rating: Star
|
|
30749
31851
|
};
|
|
30750
31852
|
const maxFileSizeMB = 50;
|
|
30751
31853
|
const maxFileSizeKB = maxFileSizeMB * 1e3;
|
|
@@ -30754,12 +31856,12 @@ class ConditionModifier {
|
|
|
30754
31856
|
constructor(config) {
|
|
30755
31857
|
__publicField(this, "id");
|
|
30756
31858
|
__publicField(this, "label");
|
|
30757
|
-
__publicField(this, "
|
|
31859
|
+
__publicField(this, "getApplyFn");
|
|
30758
31860
|
__publicField(this, "serialize");
|
|
30759
31861
|
__publicField(this, "deserialize");
|
|
30760
|
-
const { id,
|
|
31862
|
+
const { id, getApplyFn, label, serialize, deserialize: deserialize2 } = config;
|
|
30761
31863
|
this.id = id;
|
|
30762
|
-
this.
|
|
31864
|
+
this.getApplyFn = getApplyFn;
|
|
30763
31865
|
this.label = label;
|
|
30764
31866
|
this.serialize = serialize;
|
|
30765
31867
|
this.deserialize = deserialize2;
|
|
@@ -30771,40 +31873,34 @@ class ConditionModifier {
|
|
|
30771
31873
|
const BooleanEqualsConditionModifier = ConditionModifier.create({
|
|
30772
31874
|
id: "nullable-boolean-equals",
|
|
30773
31875
|
label: "is",
|
|
30774
|
-
|
|
31876
|
+
getApplyFn: (filterValue) => (value) => value === filterValue,
|
|
30775
31877
|
serialize: (filterValue) => filterValue,
|
|
30776
31878
|
deserialize: (filterValue) => filterValue
|
|
30777
31879
|
});
|
|
30778
31880
|
const BooleanNotEqualsConditionModifier = ConditionModifier.create({
|
|
30779
31881
|
id: "nullable-boolean-not-equals",
|
|
30780
31882
|
label: "is not",
|
|
30781
|
-
|
|
31883
|
+
getApplyFn: (filterValue) => (value) => value !== filterValue,
|
|
30782
31884
|
serialize: (filterValue) => filterValue,
|
|
30783
31885
|
deserialize: (filterValue) => filterValue
|
|
30784
31886
|
});
|
|
30785
31887
|
const DateEqualsConditionModifier = ConditionModifier.create({
|
|
30786
31888
|
id: "date-equals",
|
|
30787
|
-
|
|
30788
|
-
return value.getTime() === filterValue.getTime();
|
|
30789
|
-
},
|
|
31889
|
+
getApplyFn: (filterValue) => (value) => value.getTime() === filterValue.getTime(),
|
|
30790
31890
|
label: "is",
|
|
30791
31891
|
serialize: (filterValue) => filterValue.toISOString(),
|
|
30792
31892
|
deserialize: (filterValue) => new Date(filterValue)
|
|
30793
31893
|
});
|
|
30794
31894
|
const DateNotEqualsConditionModifier = ConditionModifier.create({
|
|
30795
31895
|
id: "date-not-equals",
|
|
30796
|
-
|
|
30797
|
-
return value.getTime() !== filterValue.getTime();
|
|
30798
|
-
},
|
|
31896
|
+
getApplyFn: (filterValue) => (value) => value.getTime() !== filterValue.getTime(),
|
|
30799
31897
|
label: "is not",
|
|
30800
31898
|
serialize: (filterValue) => filterValue.toISOString(),
|
|
30801
31899
|
deserialize: (filterValue) => new Date(filterValue)
|
|
30802
31900
|
});
|
|
30803
31901
|
const DateBeforeConditionModifier = ConditionModifier.create({
|
|
30804
31902
|
id: "date-before",
|
|
30805
|
-
|
|
30806
|
-
return value.getTime() < filterValue.getTime();
|
|
30807
|
-
},
|
|
31903
|
+
getApplyFn: (filterValue) => (value) => value.getTime() < filterValue.getTime(),
|
|
30808
31904
|
label: "before",
|
|
30809
31905
|
serialize: (filterValue) => filterValue.toISOString(),
|
|
30810
31906
|
deserialize: (filterValue) => new Date(filterValue)
|
|
@@ -30812,16 +31908,14 @@ const DateBeforeConditionModifier = ConditionModifier.create({
|
|
|
30812
31908
|
const DateAfterConditionModifier = ConditionModifier.create({
|
|
30813
31909
|
id: "date-after",
|
|
30814
31910
|
label: "after",
|
|
30815
|
-
|
|
30816
|
-
return value.getTime() > filterValue.getTime();
|
|
30817
|
-
},
|
|
31911
|
+
getApplyFn: (filterValue) => (value) => value.getTime() > filterValue.getTime(),
|
|
30818
31912
|
serialize: (filterValue) => filterValue.toISOString(),
|
|
30819
31913
|
deserialize: (filterValue) => new Date(filterValue)
|
|
30820
31914
|
});
|
|
30821
31915
|
const DateRangeInConditionModifier = ConditionModifier.create({
|
|
30822
31916
|
id: "date-range-in",
|
|
30823
31917
|
label: "in between",
|
|
30824
|
-
|
|
31918
|
+
getApplyFn: (filterValue) => (value) => {
|
|
30825
31919
|
if ((filterValue == null ? void 0 : filterValue.from) && filterValue.from.getTime() > value.getTime()) return false;
|
|
30826
31920
|
if ((filterValue == null ? void 0 : filterValue.to) && filterValue.to.getTime() < value.getTime()) return false;
|
|
30827
31921
|
return true;
|
|
@@ -30843,7 +31937,7 @@ const DateRangeInConditionModifier = ConditionModifier.create({
|
|
|
30843
31937
|
const DateRangeNotInConditionModifier = ConditionModifier.create({
|
|
30844
31938
|
id: "date-range-not-in",
|
|
30845
31939
|
label: "not in between",
|
|
30846
|
-
|
|
31940
|
+
getApplyFn: (filterValue) => (value) => {
|
|
30847
31941
|
if ((filterValue == null ? void 0 : filterValue.from) && filterValue.from.getTime() > value.getTime()) return true;
|
|
30848
31942
|
if ((filterValue == null ? void 0 : filterValue.to) && filterValue.to.getTime() < value.getTime()) return true;
|
|
30849
31943
|
return false;
|
|
@@ -30865,74 +31959,62 @@ const DateRangeNotInConditionModifier = ConditionModifier.create({
|
|
|
30865
31959
|
const HasFilesConditionModifier = ConditionModifier.create({
|
|
30866
31960
|
id: "has-files",
|
|
30867
31961
|
label: "is",
|
|
30868
|
-
|
|
31962
|
+
getApplyFn: (_filterValue) => (value) => value.length > 0,
|
|
30869
31963
|
serialize: (filterValue) => filterValue,
|
|
30870
31964
|
deserialize: (filterValue) => filterValue
|
|
30871
31965
|
});
|
|
30872
31966
|
const DoesNotHaveFilesConditionModifier = ConditionModifier.create({
|
|
30873
31967
|
id: "does-not-have-files",
|
|
30874
31968
|
label: "is not",
|
|
30875
|
-
|
|
31969
|
+
getApplyFn: (_filterValue) => (value) => value.length === 0,
|
|
30876
31970
|
serialize: (filterValue) => filterValue,
|
|
30877
31971
|
deserialize: (filterValue) => filterValue
|
|
30878
31972
|
});
|
|
30879
31973
|
const NumberEqualsConditionModifier = ConditionModifier.create({
|
|
30880
31974
|
id: "number-equals",
|
|
30881
|
-
|
|
30882
|
-
return value === filterValue;
|
|
30883
|
-
},
|
|
31975
|
+
getApplyFn: (filterValue) => (value) => value === filterValue,
|
|
30884
31976
|
label: "is",
|
|
30885
31977
|
serialize: (filterValue) => filterValue,
|
|
30886
31978
|
deserialize: (filterValue) => filterValue
|
|
30887
31979
|
});
|
|
30888
31980
|
const NumberNotEqualsConditionModifier = ConditionModifier.create({
|
|
30889
31981
|
id: "number-not-equals",
|
|
30890
|
-
|
|
30891
|
-
return value !== filterValue;
|
|
30892
|
-
},
|
|
31982
|
+
getApplyFn: (filterValue) => (value) => value !== filterValue,
|
|
30893
31983
|
label: "is not",
|
|
30894
31984
|
serialize: (filterValue) => filterValue,
|
|
30895
31985
|
deserialize: (filterValue) => filterValue
|
|
30896
31986
|
});
|
|
30897
31987
|
const NumberLessThanConditionModifier = ConditionModifier.create({
|
|
30898
31988
|
id: "number-less-than",
|
|
30899
|
-
|
|
30900
|
-
return value < filterValue;
|
|
30901
|
-
},
|
|
31989
|
+
getApplyFn: (filterValue) => (value) => value < filterValue,
|
|
30902
31990
|
label: "is less than",
|
|
30903
31991
|
serialize: (filterValue) => filterValue,
|
|
30904
31992
|
deserialize: (filterValue) => filterValue
|
|
30905
31993
|
});
|
|
30906
31994
|
const NumberLessThanOrEqualsConditionModifier = ConditionModifier.create({
|
|
30907
31995
|
id: "number-less-than-or-equals",
|
|
30908
|
-
|
|
30909
|
-
return value <= filterValue;
|
|
30910
|
-
},
|
|
31996
|
+
getApplyFn: (filterValue) => (value) => value <= filterValue,
|
|
30911
31997
|
label: "is less than or equal to",
|
|
30912
31998
|
serialize: (filterValue) => filterValue,
|
|
30913
31999
|
deserialize: (filterValue) => filterValue
|
|
30914
32000
|
});
|
|
30915
32001
|
const NumberGreaterThanConditionModifier = ConditionModifier.create({
|
|
30916
32002
|
id: "number-greater-than",
|
|
30917
|
-
|
|
30918
|
-
return value > filterValue;
|
|
30919
|
-
},
|
|
32003
|
+
getApplyFn: (filterValue) => (value) => value > filterValue,
|
|
30920
32004
|
label: "is greater than",
|
|
30921
32005
|
serialize: (filterValue) => filterValue,
|
|
30922
32006
|
deserialize: (filterValue) => filterValue
|
|
30923
32007
|
});
|
|
30924
32008
|
const NumberGreaterThanOrEqualsConditionModifier = ConditionModifier.create({
|
|
30925
32009
|
id: "number-greater-than-or-equals",
|
|
30926
|
-
|
|
30927
|
-
return value >= filterValue;
|
|
30928
|
-
},
|
|
32010
|
+
getApplyFn: (filterValue) => (value) => value >= filterValue,
|
|
30929
32011
|
label: "is greater than or equal to",
|
|
30930
32012
|
serialize: (filterValue) => filterValue,
|
|
30931
32013
|
deserialize: (filterValue) => filterValue
|
|
30932
32014
|
});
|
|
30933
32015
|
const NumberRangeInConditionModifier = ConditionModifier.create({
|
|
30934
32016
|
id: "number-range-in",
|
|
30935
|
-
|
|
32017
|
+
getApplyFn: (filterValue) => (value) => {
|
|
30936
32018
|
if (filterValue.to && value > filterValue.to) return false;
|
|
30937
32019
|
if (filterValue.from && value < filterValue.from) return false;
|
|
30938
32020
|
return true;
|
|
@@ -30943,7 +32025,7 @@ const NumberRangeInConditionModifier = ConditionModifier.create({
|
|
|
30943
32025
|
});
|
|
30944
32026
|
const NumberRangeNotInConditionModifier = ConditionModifier.create({
|
|
30945
32027
|
id: "number-range-not-in",
|
|
30946
|
-
|
|
32028
|
+
getApplyFn: (filterValue) => (value) => {
|
|
30947
32029
|
if (filterValue.to && value > filterValue.to) return true;
|
|
30948
32030
|
if (filterValue.from && value < filterValue.from) return true;
|
|
30949
32031
|
return false;
|
|
@@ -30952,46 +32034,73 @@ const NumberRangeNotInConditionModifier = ConditionModifier.create({
|
|
|
30952
32034
|
serialize: (filterValue) => filterValue,
|
|
30953
32035
|
deserialize: (filterValue) => filterValue
|
|
30954
32036
|
});
|
|
32037
|
+
const PassFailEqualsConditionModifier = ConditionModifier.create({
|
|
32038
|
+
id: "pass-fail-equals",
|
|
32039
|
+
getApplyFn: (filterValue) => (value) => value === filterValue,
|
|
32040
|
+
label: "is",
|
|
32041
|
+
serialize: (filterValue) => filterValue,
|
|
32042
|
+
deserialize: (filterValue) => filterValue
|
|
32043
|
+
});
|
|
32044
|
+
const PassFailNotEqualsConditionModifier = ConditionModifier.create({
|
|
32045
|
+
id: "pass-fail-not-equals",
|
|
32046
|
+
getApplyFn: (filterValue) => (value) => value !== filterValue,
|
|
32047
|
+
label: "is not",
|
|
32048
|
+
serialize: (filterValue) => filterValue,
|
|
32049
|
+
deserialize: (filterValue) => filterValue
|
|
32050
|
+
});
|
|
32051
|
+
const PassFailArrayIncludesConditionModifier = ConditionModifier.create({
|
|
32052
|
+
id: "pass-fail-array-includes",
|
|
32053
|
+
getApplyFn: (filterValue) => {
|
|
32054
|
+
const filterValueSet = new Set(filterValue);
|
|
32055
|
+
return (value) => filterValueSet.has(value);
|
|
32056
|
+
},
|
|
32057
|
+
label: "is any of",
|
|
32058
|
+
serialize: (filterValue) => filterValue,
|
|
32059
|
+
deserialize: (filterValue) => filterValue
|
|
32060
|
+
});
|
|
32061
|
+
const PassFailArrayExcludesConditionModifier = ConditionModifier.create({
|
|
32062
|
+
id: "pass-fail-array-excludes",
|
|
32063
|
+
getApplyFn: (filterValue) => {
|
|
32064
|
+
const filterValueSet = new Set(filterValue);
|
|
32065
|
+
return (value) => !filterValueSet.has(value);
|
|
32066
|
+
},
|
|
32067
|
+
label: "is none of",
|
|
32068
|
+
serialize: (filterValue) => filterValue,
|
|
32069
|
+
deserialize: (filterValue) => filterValue
|
|
32070
|
+
});
|
|
30955
32071
|
const StringEqualsConditionModifier = ConditionModifier.create({
|
|
30956
32072
|
id: "nullable-string-equals",
|
|
30957
|
-
|
|
30958
|
-
return value === filterValue;
|
|
30959
|
-
},
|
|
32073
|
+
getApplyFn: (filterValue) => (value) => value === filterValue,
|
|
30960
32074
|
label: "is",
|
|
30961
32075
|
serialize: (filterValue) => filterValue,
|
|
30962
32076
|
deserialize: (filterValue) => filterValue
|
|
30963
32077
|
});
|
|
30964
32078
|
const StringNotEqualsConditionModifier = ConditionModifier.create({
|
|
30965
32079
|
id: "nullable-string-not-equals",
|
|
30966
|
-
|
|
30967
|
-
return value !== filterValue;
|
|
30968
|
-
},
|
|
32080
|
+
getApplyFn: (filterValue) => (value) => value !== filterValue,
|
|
30969
32081
|
label: "is not",
|
|
30970
32082
|
serialize: (filterValue) => filterValue,
|
|
30971
32083
|
deserialize: (filterValue) => filterValue
|
|
30972
32084
|
});
|
|
30973
32085
|
const StringIncludesConditionModifier = ConditionModifier.create({
|
|
30974
32086
|
id: "string-includes",
|
|
30975
|
-
|
|
30976
|
-
return value.includes(filterValue);
|
|
30977
|
-
},
|
|
32087
|
+
getApplyFn: (filterValue) => (value) => value.includes(filterValue),
|
|
30978
32088
|
label: "includes",
|
|
30979
32089
|
serialize: (filterValue) => filterValue,
|
|
30980
32090
|
deserialize: (filterValue) => filterValue
|
|
30981
32091
|
});
|
|
30982
32092
|
const StringExcludesConditionModifier = ConditionModifier.create({
|
|
30983
32093
|
id: "string-excludes",
|
|
30984
|
-
|
|
30985
|
-
return !value.includes(filterValue);
|
|
30986
|
-
},
|
|
32094
|
+
getApplyFn: (filterValue) => (value) => !value.includes(filterValue),
|
|
30987
32095
|
label: "does not include",
|
|
30988
32096
|
serialize: (filterValue) => filterValue,
|
|
30989
32097
|
deserialize: (filterValue) => filterValue
|
|
30990
32098
|
});
|
|
30991
32099
|
const StringArrayIncludesConditionModifier = ConditionModifier.create({
|
|
30992
32100
|
id: "string-array-includes",
|
|
30993
|
-
|
|
30994
|
-
|
|
32101
|
+
getApplyFn: (filterValue) => {
|
|
32102
|
+
const filterValueSet = new Set(filterValue);
|
|
32103
|
+
return (value) => filterValueSet.has(value);
|
|
30995
32104
|
},
|
|
30996
32105
|
label: "is any of",
|
|
30997
32106
|
serialize: (filterValue) => filterValue,
|
|
@@ -30999,8 +32108,9 @@ const StringArrayIncludesConditionModifier = ConditionModifier.create({
|
|
|
30999
32108
|
});
|
|
31000
32109
|
const StringArrayExcludesConditionModifier = ConditionModifier.create({
|
|
31001
32110
|
id: "string-array-excludes",
|
|
31002
|
-
|
|
31003
|
-
|
|
32111
|
+
getApplyFn: (filterValue) => {
|
|
32112
|
+
const filterValueSet = new Set(filterValue);
|
|
32113
|
+
return (value) => !filterValueSet.has(value);
|
|
31004
32114
|
},
|
|
31005
32115
|
label: "is none of",
|
|
31006
32116
|
serialize: (filterValue) => filterValue,
|
|
@@ -31008,8 +32118,12 @@ const StringArrayExcludesConditionModifier = ConditionModifier.create({
|
|
|
31008
32118
|
});
|
|
31009
32119
|
const StringArrayEveryConditionModifier = ConditionModifier.create({
|
|
31010
32120
|
id: "string-array-every",
|
|
31011
|
-
|
|
31012
|
-
|
|
32121
|
+
getApplyFn: (filterValue) => {
|
|
32122
|
+
const filterValueSet = new Set(filterValue);
|
|
32123
|
+
return (value) => {
|
|
32124
|
+
const valueSet = new Set(value);
|
|
32125
|
+
return filterValueSet.isSubsetOf(valueSet);
|
|
32126
|
+
};
|
|
31013
32127
|
},
|
|
31014
32128
|
label: "has all of",
|
|
31015
32129
|
serialize: (filterValue) => filterValue,
|
|
@@ -31017,8 +32131,12 @@ const StringArrayEveryConditionModifier = ConditionModifier.create({
|
|
|
31017
32131
|
});
|
|
31018
32132
|
const StringArraySomeConditionModifier = ConditionModifier.create({
|
|
31019
32133
|
id: "string-array-some",
|
|
31020
|
-
|
|
31021
|
-
|
|
32134
|
+
getApplyFn: (filterValue) => {
|
|
32135
|
+
const filterValueSet = new Set(filterValue);
|
|
32136
|
+
return (value) => {
|
|
32137
|
+
const valueSet = new Set(value);
|
|
32138
|
+
return !filterValueSet.isDisjointFrom(valueSet);
|
|
32139
|
+
};
|
|
31022
32140
|
},
|
|
31023
32141
|
label: "has any of",
|
|
31024
32142
|
serialize: (filterValue) => filterValue,
|
|
@@ -31026,8 +32144,12 @@ const StringArraySomeConditionModifier = ConditionModifier.create({
|
|
|
31026
32144
|
});
|
|
31027
32145
|
const StringArrayNoneConditionModifier = ConditionModifier.create({
|
|
31028
32146
|
id: "string-array-none",
|
|
31029
|
-
|
|
31030
|
-
|
|
32147
|
+
getApplyFn: (filterValue) => {
|
|
32148
|
+
const filterValueSet = new Set(filterValue);
|
|
32149
|
+
return (value) => {
|
|
32150
|
+
const valueSet = new Set(value);
|
|
32151
|
+
return filterValueSet.isDisjointFrom(valueSet);
|
|
32152
|
+
};
|
|
31031
32153
|
},
|
|
31032
32154
|
label: "has none of",
|
|
31033
32155
|
serialize: (filterValue) => filterValue,
|
|
@@ -31035,10 +32157,12 @@ const StringArrayNoneConditionModifier = ConditionModifier.create({
|
|
|
31035
32157
|
});
|
|
31036
32158
|
const StringArrayEqualsConditionModifier = ConditionModifier.create({
|
|
31037
32159
|
id: "string-array-equals",
|
|
31038
|
-
|
|
31039
|
-
|
|
31040
|
-
|
|
31041
|
-
|
|
32160
|
+
getApplyFn: (filterValue) => {
|
|
32161
|
+
const filterValueSet = new Set(filterValue);
|
|
32162
|
+
return (value) => {
|
|
32163
|
+
const valueSet = new Set(value);
|
|
32164
|
+
return filterValueSet.size === valueSet.size && valueSet.isSubsetOf(filterValueSet);
|
|
32165
|
+
};
|
|
31042
32166
|
},
|
|
31043
32167
|
label: "is",
|
|
31044
32168
|
serialize: (filterValue) => filterValue,
|
|
@@ -31046,10 +32170,12 @@ const StringArrayEqualsConditionModifier = ConditionModifier.create({
|
|
|
31046
32170
|
});
|
|
31047
32171
|
const StringArrayNotEqualsConditionModifier = ConditionModifier.create({
|
|
31048
32172
|
id: "string-array-not-equals",
|
|
31049
|
-
|
|
31050
|
-
|
|
31051
|
-
|
|
31052
|
-
|
|
32173
|
+
getApplyFn: (filterValue) => {
|
|
32174
|
+
const filterValueSet = new Set(filterValue);
|
|
32175
|
+
return (value) => {
|
|
32176
|
+
const valueSet = new Set(value);
|
|
32177
|
+
return filterValueSet.size !== valueSet.size || !valueSet.isSubsetOf(filterValueSet);
|
|
32178
|
+
};
|
|
31053
32179
|
},
|
|
31054
32180
|
label: "is not",
|
|
31055
32181
|
serialize: (filterValue) => filterValue,
|
|
@@ -31088,12 +32214,20 @@ class BaseCondition extends Observable {
|
|
|
31088
32214
|
__publicField(this, "getConditionModifiers", () => {
|
|
31089
32215
|
return Object.entries(this.modifiers);
|
|
31090
32216
|
});
|
|
31091
|
-
__publicField(this, "
|
|
32217
|
+
__publicField(this, "accessorFn", (values) => {
|
|
32218
|
+
return values[this.field.identifier];
|
|
32219
|
+
});
|
|
32220
|
+
__publicField(this, "getApplyFn", () => {
|
|
31092
32221
|
const modifier = this.modifiers[this.conditionModifier];
|
|
31093
32222
|
const conditionValue = this.getConditionValue();
|
|
31094
|
-
|
|
31095
|
-
|
|
31096
|
-
return
|
|
32223
|
+
const conditionValueInvalid = conditionValue === void 0 || !modifier.isConditionValueValid(conditionValue);
|
|
32224
|
+
const applyFn = modifier.modifier.getApplyFn(conditionValue);
|
|
32225
|
+
return (value) => {
|
|
32226
|
+
if (conditionValueInvalid) return true;
|
|
32227
|
+
const transformedValue = this.transformValue(value);
|
|
32228
|
+
if (!modifier.isValueValid(transformedValue)) return false;
|
|
32229
|
+
return applyFn(transformedValue);
|
|
32230
|
+
};
|
|
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
|
}
|
|
@@ -31586,6 +32719,55 @@ class CheckboxListFieldCondition extends BaseCondition {
|
|
|
31586
32719
|
return /* @__PURE__ */ jsx(CheckboxListFieldConditionCell, { condition: this, ...props }, this.id);
|
|
31587
32720
|
}
|
|
31588
32721
|
}
|
|
32722
|
+
class ConditionManager extends Observable {
|
|
32723
|
+
constructor(conditions) {
|
|
32724
|
+
super();
|
|
32725
|
+
__publicField(this, "conditions");
|
|
32726
|
+
__publicField(this, "conditionObserver", () => {
|
|
32727
|
+
this.conditions = [...this.conditions];
|
|
32728
|
+
this.notify(this);
|
|
32729
|
+
});
|
|
32730
|
+
__publicField(this, "initConditions", (conditions) => {
|
|
32731
|
+
for (const c of conditions) c.observe(this.conditionObserver);
|
|
32732
|
+
return conditions;
|
|
32733
|
+
});
|
|
32734
|
+
this.conditions = this.initConditions(conditions);
|
|
32735
|
+
}
|
|
32736
|
+
getConditions() {
|
|
32737
|
+
return this.conditions;
|
|
32738
|
+
}
|
|
32739
|
+
addCondition(condition) {
|
|
32740
|
+
this.conditions = this.initConditions([...this.conditions, condition]);
|
|
32741
|
+
this.notify(this);
|
|
32742
|
+
}
|
|
32743
|
+
addConditions(conditions) {
|
|
32744
|
+
this.conditions = this.initConditions([...this.conditions, ...conditions]);
|
|
32745
|
+
this.notify(this);
|
|
32746
|
+
}
|
|
32747
|
+
removeCondition(condition) {
|
|
32748
|
+
this.conditions = this.initConditions(this.conditions.filter((c) => c.id !== condition.id));
|
|
32749
|
+
this.notify(this);
|
|
32750
|
+
}
|
|
32751
|
+
removeConditions(conditions) {
|
|
32752
|
+
const conditionIds = new Set(conditions.map((c) => c.id));
|
|
32753
|
+
this.conditions = this.initConditions(this.conditions.filter((c) => !conditionIds.has(c.id)));
|
|
32754
|
+
this.notify(this);
|
|
32755
|
+
}
|
|
32756
|
+
applyConditions(values) {
|
|
32757
|
+
if (this.conditions.length === 0) return true;
|
|
32758
|
+
const applyAndAccessorFns = this.conditions.map((condition) => [condition.getApplyFn(), condition.accessorFn]);
|
|
32759
|
+
return applyAndAccessorFns.every(([applyFn, accessorFn]) => {
|
|
32760
|
+
return applyFn(accessorFn(values));
|
|
32761
|
+
});
|
|
32762
|
+
}
|
|
32763
|
+
}
|
|
32764
|
+
const useConditionManager = (conditions, onConditionsChange) => {
|
|
32765
|
+
return useMemo(() => {
|
|
32766
|
+
const ret = new ConditionManager(conditions);
|
|
32767
|
+
ret.observe((conditionManager) => onConditionsChange(conditionManager.getConditions()));
|
|
32768
|
+
return ret;
|
|
32769
|
+
}, [conditions, onConditionsChange]);
|
|
32770
|
+
};
|
|
31589
32771
|
const DateFieldConditionCell = (props) => {
|
|
31590
32772
|
const { condition, onRemove } = props;
|
|
31591
32773
|
const conditionValue = condition.getConditionValue();
|
|
@@ -31653,7 +32835,7 @@ const DateFieldConditionCell = (props) => {
|
|
|
31653
32835
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
31654
32836
|
] });
|
|
31655
32837
|
};
|
|
31656
|
-
const modifiers$
|
|
32838
|
+
const modifiers$c = {
|
|
31657
32839
|
equals: createConditionModifierConfig({
|
|
31658
32840
|
modifier: DateEqualsConditionModifier,
|
|
31659
32841
|
isValueValid: (value) => value instanceof Date,
|
|
@@ -31694,13 +32876,11 @@ const modifiers$a = {
|
|
|
31694
32876
|
class DateFieldCondition extends BaseCondition {
|
|
31695
32877
|
constructor(options) {
|
|
31696
32878
|
super(options);
|
|
31697
|
-
__publicField(this, "
|
|
31698
|
-
__publicField(this, "defaultConditionValue");
|
|
31699
|
-
__publicField(this, "modifiers", modifiers$a);
|
|
32879
|
+
__publicField(this, "modifiers", modifiers$c);
|
|
31700
32880
|
}
|
|
31701
32881
|
static deserialize(serializedCondition, field) {
|
|
31702
32882
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
31703
|
-
const modifierConfig = modifiers$
|
|
32883
|
+
const modifierConfig = modifiers$c[conditionModifier];
|
|
31704
32884
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
|
|
31705
32885
|
// @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
|
|
31706
32886
|
modifierConfig.modifier.deserialize(conditionValue)
|
|
@@ -31756,7 +32936,7 @@ const MultiSelectFieldConditionCell = (props) => {
|
|
|
31756
32936
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
31757
32937
|
] });
|
|
31758
32938
|
};
|
|
31759
|
-
const modifiers$
|
|
32939
|
+
const modifiers$b = {
|
|
31760
32940
|
equals: createConditionModifierConfig({
|
|
31761
32941
|
modifier: StringArrayEqualsConditionModifier,
|
|
31762
32942
|
isValueValid: (_value) => true,
|
|
@@ -31791,13 +32971,11 @@ const modifiers$9 = {
|
|
|
31791
32971
|
class MultiSelectFieldCondition extends BaseCondition {
|
|
31792
32972
|
constructor(options) {
|
|
31793
32973
|
super(options);
|
|
31794
|
-
__publicField(this, "
|
|
31795
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
31796
|
-
__publicField(this, "modifiers", modifiers$9);
|
|
32974
|
+
__publicField(this, "modifiers", modifiers$b);
|
|
31797
32975
|
}
|
|
31798
32976
|
static deserialize(serializedCondition, field) {
|
|
31799
32977
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
31800
|
-
const modifierConfig = modifiers$
|
|
32978
|
+
const modifierConfig = modifiers$b[conditionModifier];
|
|
31801
32979
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
|
|
31802
32980
|
return new MultiSelectFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
31803
32981
|
}
|
|
@@ -31841,7 +33019,7 @@ const MultiStringFieldConditionCell = (props) => {
|
|
|
31841
33019
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
31842
33020
|
] });
|
|
31843
33021
|
};
|
|
31844
|
-
const modifiers$
|
|
33022
|
+
const modifiers$a = {
|
|
31845
33023
|
equals: createConditionModifierConfig({
|
|
31846
33024
|
modifier: StringArrayEqualsConditionModifier,
|
|
31847
33025
|
isValueValid: (_value) => true,
|
|
@@ -31876,13 +33054,11 @@ const modifiers$8 = {
|
|
|
31876
33054
|
class MultiStringFieldCondition extends BaseCondition {
|
|
31877
33055
|
constructor(options) {
|
|
31878
33056
|
super(options);
|
|
31879
|
-
__publicField(this, "
|
|
31880
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
31881
|
-
__publicField(this, "modifiers", modifiers$8);
|
|
33057
|
+
__publicField(this, "modifiers", modifiers$a);
|
|
31882
33058
|
}
|
|
31883
33059
|
static deserialize(serializedCondition, field) {
|
|
31884
33060
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
31885
|
-
const modifierConfig = modifiers$
|
|
33061
|
+
const modifierConfig = modifiers$a[conditionModifier];
|
|
31886
33062
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
|
|
31887
33063
|
return new MultiStringFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
31888
33064
|
}
|
|
@@ -31961,7 +33137,7 @@ const NumberFieldConditionCell = (props) => {
|
|
|
31961
33137
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
31962
33138
|
] });
|
|
31963
33139
|
};
|
|
31964
|
-
const modifiers$
|
|
33140
|
+
const modifiers$9 = {
|
|
31965
33141
|
equals: createConditionModifierConfig({
|
|
31966
33142
|
modifier: NumberEqualsConditionModifier,
|
|
31967
33143
|
isValueValid: (value) => typeof value === "number",
|
|
@@ -32014,13 +33190,11 @@ const modifiers$7 = {
|
|
|
32014
33190
|
class NumberFieldCondition extends BaseCondition {
|
|
32015
33191
|
constructor(options) {
|
|
32016
33192
|
super(options);
|
|
32017
|
-
__publicField(this, "
|
|
32018
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32019
|
-
__publicField(this, "modifiers", modifiers$7);
|
|
33193
|
+
__publicField(this, "modifiers", modifiers$9);
|
|
32020
33194
|
}
|
|
32021
33195
|
static deserialize(serializedCondition, field) {
|
|
32022
33196
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
32023
|
-
const modifierConfig = modifiers$
|
|
33197
|
+
const modifierConfig = modifiers$9[conditionModifier];
|
|
32024
33198
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
|
|
32025
33199
|
// @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
|
|
32026
33200
|
modifierConfig.modifier.deserialize(conditionValue)
|
|
@@ -32064,7 +33238,7 @@ const OTPFieldConditionCell = (props) => {
|
|
|
32064
33238
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
32065
33239
|
] });
|
|
32066
33240
|
};
|
|
32067
|
-
const modifiers$
|
|
33241
|
+
const modifiers$8 = {
|
|
32068
33242
|
equals: createConditionModifierConfig({
|
|
32069
33243
|
modifier: StringEqualsConditionModifier,
|
|
32070
33244
|
isValueValid: (_value) => true,
|
|
@@ -32093,13 +33267,11 @@ const modifiers$6 = {
|
|
|
32093
33267
|
class OTPFieldCondition extends BaseCondition {
|
|
32094
33268
|
constructor(options) {
|
|
32095
33269
|
super(options);
|
|
32096
|
-
__publicField(this, "
|
|
32097
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32098
|
-
__publicField(this, "modifiers", modifiers$6);
|
|
33270
|
+
__publicField(this, "modifiers", modifiers$8);
|
|
32099
33271
|
}
|
|
32100
33272
|
static deserialize(serializedCondition, field) {
|
|
32101
33273
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
32102
|
-
const modifierConfig = modifiers$
|
|
33274
|
+
const modifierConfig = modifiers$8[conditionModifier];
|
|
32103
33275
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? modifierConfig.modifier.deserialize(conditionValue) : void 0;
|
|
32104
33276
|
return new OTPFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
32105
33277
|
}
|
|
@@ -32107,6 +33279,117 @@ class OTPFieldCondition extends BaseCondition {
|
|
|
32107
33279
|
return /* @__PURE__ */ jsx(OTPFieldConditionCell, { condition: this, ...props }, this.id);
|
|
32108
33280
|
}
|
|
32109
33281
|
}
|
|
33282
|
+
const PassFailFieldConditionCell = (props) => {
|
|
33283
|
+
const { condition, onRemove } = props;
|
|
33284
|
+
const field = condition.field;
|
|
33285
|
+
const conditionValue = condition.getConditionValue();
|
|
33286
|
+
const conditionModifier = condition.getConditionModifier();
|
|
33287
|
+
const getFilterValueUi = () => {
|
|
33288
|
+
switch (conditionModifier) {
|
|
33289
|
+
case "equals":
|
|
33290
|
+
case "notEquals": {
|
|
33291
|
+
const equalsModifier = condition.modifiers.equals;
|
|
33292
|
+
const equalsFilterValue = conditionValue !== void 0 && equalsModifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
|
|
33293
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
33294
|
+
/* @__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" : "..." }) }) }),
|
|
33295
|
+
/* @__PURE__ */ jsx(Menu.Content, { size: "sm", children: /* @__PURE__ */ jsx(
|
|
33296
|
+
Menu.SelectGroup,
|
|
33297
|
+
{
|
|
33298
|
+
required: false,
|
|
33299
|
+
value: equalsFilterValue,
|
|
33300
|
+
onValueChange: condition.setConditionValue,
|
|
33301
|
+
children: passFailFieldStatuses.map((status) => {
|
|
33302
|
+
const { label } = passFailFieldStatusMapping[status];
|
|
33303
|
+
return /* @__PURE__ */ jsx(SelectItemTemplate, { value: status, children: /* @__PURE__ */ jsx("span", { className: "truncate", children: label }) }, status);
|
|
33304
|
+
})
|
|
33305
|
+
}
|
|
33306
|
+
) })
|
|
33307
|
+
] });
|
|
33308
|
+
}
|
|
33309
|
+
case "includes":
|
|
33310
|
+
case "excludes": {
|
|
33311
|
+
const includesModifier = condition.modifiers.includes;
|
|
33312
|
+
const includesModifierFilterValue = conditionValue !== void 0 && includesModifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
|
|
33313
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { children: [
|
|
33314
|
+
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children: /* @__PURE__ */ jsx(Button, { type: "button", children: includesModifierFilterValue ? `${includesModifierFilterValue.length} statuses` : "..." }) }),
|
|
33315
|
+
/* @__PURE__ */ jsx(Menu.Content, { size: "sm", children: /* @__PURE__ */ jsxs(
|
|
33316
|
+
Menu.MultiSelectGroup,
|
|
33317
|
+
{
|
|
33318
|
+
values: includesModifierFilterValue ?? EMPTY_ARRAY,
|
|
33319
|
+
onValuesChange: condition.setConditionValue,
|
|
33320
|
+
children: [
|
|
33321
|
+
/* @__PURE__ */ jsx(SelectAllItemTemplate, { children: "Select all" }),
|
|
33322
|
+
passFailFieldStatuses.map((status) => {
|
|
33323
|
+
const { label, icon } = passFailFieldStatusMapping[status];
|
|
33324
|
+
return /* @__PURE__ */ jsxs(MultiSelectItemTemplate, { value: status, children: [
|
|
33325
|
+
/* @__PURE__ */ jsx(LuIcon, { icon }),
|
|
33326
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: label })
|
|
33327
|
+
] }, status);
|
|
33328
|
+
})
|
|
33329
|
+
]
|
|
33330
|
+
}
|
|
33331
|
+
) })
|
|
33332
|
+
] });
|
|
33333
|
+
}
|
|
33334
|
+
}
|
|
33335
|
+
};
|
|
33336
|
+
return /* @__PURE__ */ jsxs(ButtonGroup, { className: "flex w-max max-w-full min-w-0 gap-0.5", size: "sm", variant: "fill", accentColor: "base", children: [
|
|
33337
|
+
/* @__PURE__ */ jsxs(Badge, { className: "min-w-0 shrink-1", size: "sm", variant: "fill", accentColor: "base", children: [
|
|
33338
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[field.type] }),
|
|
33339
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: field.label || UNLABELLED_FIELD_LABEL })
|
|
33340
|
+
] }),
|
|
33341
|
+
/* @__PURE__ */ jsx(ConditionModifierDropdown, { condition, children: /* @__PURE__ */ jsx(Button, { type: "button", children: condition.modifiers[conditionModifier].modifier.label }) }),
|
|
33342
|
+
getFilterValueUi(),
|
|
33343
|
+
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
33344
|
+
] });
|
|
33345
|
+
};
|
|
33346
|
+
const modifiers$7 = {
|
|
33347
|
+
equals: createConditionModifierConfig({
|
|
33348
|
+
modifier: PassFailEqualsConditionModifier,
|
|
33349
|
+
isValueValid: (value) => value !== null,
|
|
33350
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "string",
|
|
33351
|
+
isSerializedValueValid: (serializedConditionValue) => typeof serializedConditionValue === "string"
|
|
33352
|
+
}),
|
|
33353
|
+
notEquals: createConditionModifierConfig({
|
|
33354
|
+
modifier: PassFailNotEqualsConditionModifier,
|
|
33355
|
+
isValueValid: (value) => value !== null,
|
|
33356
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "string",
|
|
33357
|
+
isSerializedValueValid: (serializedConditionValue) => typeof serializedConditionValue === "string"
|
|
33358
|
+
}),
|
|
33359
|
+
includes: createConditionModifierConfig({
|
|
33360
|
+
modifier: PassFailArrayIncludesConditionModifier,
|
|
33361
|
+
isValueValid: (value) => value !== null,
|
|
33362
|
+
isConditionValueValid: (conditionValue) => Array.isArray(conditionValue),
|
|
33363
|
+
isSerializedValueValid: (serializedConditionValue) => Array.isArray(serializedConditionValue)
|
|
33364
|
+
}),
|
|
33365
|
+
excludes: createConditionModifierConfig({
|
|
33366
|
+
modifier: PassFailArrayExcludesConditionModifier,
|
|
33367
|
+
isValueValid: (value) => value !== null,
|
|
33368
|
+
isConditionValueValid: (conditionValue) => Array.isArray(conditionValue),
|
|
33369
|
+
isSerializedValueValid: (serializedConditionValue) => Array.isArray(serializedConditionValue)
|
|
33370
|
+
})
|
|
33371
|
+
};
|
|
33372
|
+
class PassFailFieldCondition extends BaseCondition {
|
|
33373
|
+
constructor(options) {
|
|
33374
|
+
super(options);
|
|
33375
|
+
__publicField(this, "modifiers", modifiers$7);
|
|
33376
|
+
}
|
|
33377
|
+
static deserialize(serializedCondition, field) {
|
|
33378
|
+
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
33379
|
+
const modifierConfig = modifiers$7[conditionModifier];
|
|
33380
|
+
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
|
|
33381
|
+
// @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
|
|
33382
|
+
modifierConfig.modifier.deserialize(conditionValue)
|
|
33383
|
+
) : void 0;
|
|
33384
|
+
return new PassFailFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
33385
|
+
}
|
|
33386
|
+
transformValue(value) {
|
|
33387
|
+
return value.status;
|
|
33388
|
+
}
|
|
33389
|
+
render(props) {
|
|
33390
|
+
return /* @__PURE__ */ jsx(PassFailFieldConditionCell, { condition: this, ...props }, this.id);
|
|
33391
|
+
}
|
|
33392
|
+
}
|
|
32110
33393
|
const RadioFieldConditionCell = (props) => {
|
|
32111
33394
|
const { condition, onRemove } = props;
|
|
32112
33395
|
const field = condition.field;
|
|
@@ -32127,16 +33410,6 @@ const RadioFieldConditionCell = (props) => {
|
|
|
32127
33410
|
}
|
|
32128
33411
|
return mapping;
|
|
32129
33412
|
}, [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
33413
|
const getFilterValueUi = () => {
|
|
32141
33414
|
switch (conditionModifier) {
|
|
32142
33415
|
case "equals":
|
|
@@ -32166,8 +33439,8 @@ const RadioFieldConditionCell = (props) => {
|
|
|
32166
33439
|
SelectFieldOptionMultiSelectGroup,
|
|
32167
33440
|
{
|
|
32168
33441
|
selectFieldOptions: field.options,
|
|
32169
|
-
values: includesModifierFilterValue ??
|
|
32170
|
-
onValuesChange:
|
|
33442
|
+
values: includesModifierFilterValue ?? EMPTY_ARRAY,
|
|
33443
|
+
onValuesChange: condition.setConditionValue
|
|
32171
33444
|
}
|
|
32172
33445
|
) })
|
|
32173
33446
|
] });
|
|
@@ -32184,7 +33457,7 @@ const RadioFieldConditionCell = (props) => {
|
|
|
32184
33457
|
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
32185
33458
|
] });
|
|
32186
33459
|
};
|
|
32187
|
-
const modifiers$
|
|
33460
|
+
const modifiers$6 = {
|
|
32188
33461
|
equals: createConditionModifierConfig({
|
|
32189
33462
|
modifier: StringEqualsConditionModifier,
|
|
32190
33463
|
isValueValid: (value) => typeof value === "string",
|
|
@@ -32213,13 +33486,11 @@ const modifiers$5 = {
|
|
|
32213
33486
|
class RadioFieldCondition extends BaseCondition {
|
|
32214
33487
|
constructor(options) {
|
|
32215
33488
|
super(options);
|
|
32216
|
-
__publicField(this, "
|
|
32217
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32218
|
-
__publicField(this, "modifiers", modifiers$5);
|
|
33489
|
+
__publicField(this, "modifiers", modifiers$6);
|
|
32219
33490
|
}
|
|
32220
33491
|
static deserialize(serializedCondition, field) {
|
|
32221
33492
|
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
32222
|
-
const modifierConfig = modifiers$
|
|
33493
|
+
const modifierConfig = modifiers$6[conditionModifier];
|
|
32223
33494
|
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
|
|
32224
33495
|
// @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
|
|
32225
33496
|
modifierConfig.modifier.deserialize(conditionValue)
|
|
@@ -32230,6 +33501,146 @@ class RadioFieldCondition extends BaseCondition {
|
|
|
32230
33501
|
return /* @__PURE__ */ jsx(RadioFieldConditionCell, { condition: this, ...props }, this.id);
|
|
32231
33502
|
}
|
|
32232
33503
|
}
|
|
33504
|
+
const RatingFieldConditionCell = (props) => {
|
|
33505
|
+
const { condition, onRemove } = props;
|
|
33506
|
+
const field = condition.field;
|
|
33507
|
+
const conditionValue = condition.getConditionValue();
|
|
33508
|
+
const conditionModifier = condition.getConditionModifier();
|
|
33509
|
+
const getFilterValueUi = () => {
|
|
33510
|
+
switch (conditionModifier) {
|
|
33511
|
+
case "equals":
|
|
33512
|
+
case "notEquals":
|
|
33513
|
+
case "greaterThanOrEquals":
|
|
33514
|
+
case "lessThanOrEquals":
|
|
33515
|
+
case "greaterThan":
|
|
33516
|
+
case "lessThan": {
|
|
33517
|
+
const modifier = condition.modifiers[conditionModifier];
|
|
33518
|
+
const filterValue = conditionValue !== void 0 && modifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
|
|
33519
|
+
return /* @__PURE__ */ jsx(
|
|
33520
|
+
NumberInputPopover,
|
|
33521
|
+
{
|
|
33522
|
+
value: filterValue ?? null,
|
|
33523
|
+
onValueChange: (value) => condition.setConditionValue(value ?? void 0),
|
|
33524
|
+
size: "sm",
|
|
33525
|
+
children: /* @__PURE__ */ jsx(Button, { type: "button", className: "truncate", children: filterValue !== void 0 ? filterValue : "..." })
|
|
33526
|
+
}
|
|
33527
|
+
);
|
|
33528
|
+
}
|
|
33529
|
+
case "inRange":
|
|
33530
|
+
case "notInRange": {
|
|
33531
|
+
const inRangeModifier = condition.modifiers.inRange;
|
|
33532
|
+
const rangeFilterValue = conditionValue !== void 0 && inRangeModifier.isConditionValueValid(conditionValue) ? conditionValue : void 0;
|
|
33533
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
33534
|
+
/* @__PURE__ */ jsx(
|
|
33535
|
+
NumberInputPopover,
|
|
33536
|
+
{
|
|
33537
|
+
value: (rangeFilterValue == null ? void 0 : rangeFilterValue.from) ?? null,
|
|
33538
|
+
onValueChange: (value) => {
|
|
33539
|
+
condition.setConditionValue({
|
|
33540
|
+
from: value,
|
|
33541
|
+
to: (rangeFilterValue == null ? void 0 : rangeFilterValue.to) ?? null
|
|
33542
|
+
});
|
|
33543
|
+
},
|
|
33544
|
+
size: "sm",
|
|
33545
|
+
children: /* @__PURE__ */ jsx(Button, { className: "truncate", children: (rangeFilterValue == null ? void 0 : rangeFilterValue.from) ?? "..." })
|
|
33546
|
+
}
|
|
33547
|
+
),
|
|
33548
|
+
/* @__PURE__ */ jsx(
|
|
33549
|
+
NumberInputPopover,
|
|
33550
|
+
{
|
|
33551
|
+
value: (rangeFilterValue == null ? void 0 : rangeFilterValue.to) ?? null,
|
|
33552
|
+
onValueChange: (value) => {
|
|
33553
|
+
condition.setConditionValue({
|
|
33554
|
+
from: (rangeFilterValue == null ? void 0 : rangeFilterValue.from) ?? null,
|
|
33555
|
+
to: value
|
|
33556
|
+
});
|
|
33557
|
+
},
|
|
33558
|
+
size: "sm",
|
|
33559
|
+
children: /* @__PURE__ */ jsx(Button, { className: "truncate", children: (rangeFilterValue == null ? void 0 : rangeFilterValue.to) ?? "..." })
|
|
33560
|
+
}
|
|
33561
|
+
)
|
|
33562
|
+
] });
|
|
33563
|
+
}
|
|
33564
|
+
}
|
|
33565
|
+
};
|
|
33566
|
+
return /* @__PURE__ */ jsxs(ButtonGroup, { className: "flex w-max max-w-full min-w-0 gap-0.5", size: "sm", variant: "fill", accentColor: "base", children: [
|
|
33567
|
+
/* @__PURE__ */ jsxs(Badge, { className: "min-w-0 shrink-1", size: "sm", variant: "fill", accentColor: "base", children: [
|
|
33568
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[field.type] }),
|
|
33569
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: field.label || UNLABELLED_FIELD_LABEL })
|
|
33570
|
+
] }),
|
|
33571
|
+
/* @__PURE__ */ jsx(ConditionModifierDropdown, { condition, children: /* @__PURE__ */ jsx(Button, { type: "button", children: condition.modifiers[conditionModifier].modifier.label }) }),
|
|
33572
|
+
getFilterValueUi(),
|
|
33573
|
+
/* @__PURE__ */ jsx(RemoveConditionButton, { condition, onClick: onRemove })
|
|
33574
|
+
] });
|
|
33575
|
+
};
|
|
33576
|
+
const modifiers$5 = {
|
|
33577
|
+
equals: createConditionModifierConfig({
|
|
33578
|
+
modifier: NumberEqualsConditionModifier,
|
|
33579
|
+
isValueValid: (value) => typeof value === "number",
|
|
33580
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33581
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33582
|
+
}),
|
|
33583
|
+
notEquals: createConditionModifierConfig({
|
|
33584
|
+
modifier: NumberNotEqualsConditionModifier,
|
|
33585
|
+
isValueValid: (value) => typeof value === "number",
|
|
33586
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33587
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33588
|
+
}),
|
|
33589
|
+
lessThan: createConditionModifierConfig({
|
|
33590
|
+
modifier: NumberLessThanConditionModifier,
|
|
33591
|
+
isValueValid: (value) => typeof value === "number",
|
|
33592
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33593
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33594
|
+
}),
|
|
33595
|
+
lessThanOrEquals: createConditionModifierConfig({
|
|
33596
|
+
modifier: NumberLessThanOrEqualsConditionModifier,
|
|
33597
|
+
isValueValid: (value) => typeof value === "number",
|
|
33598
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33599
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33600
|
+
}),
|
|
33601
|
+
greaterThan: createConditionModifierConfig({
|
|
33602
|
+
modifier: NumberGreaterThanConditionModifier,
|
|
33603
|
+
isValueValid: (value) => typeof value === "number",
|
|
33604
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33605
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33606
|
+
}),
|
|
33607
|
+
greaterThanOrEquals: createConditionModifierConfig({
|
|
33608
|
+
modifier: NumberGreaterThanOrEqualsConditionModifier,
|
|
33609
|
+
isValueValid: (value) => typeof value === "number",
|
|
33610
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "number",
|
|
33611
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "number"
|
|
33612
|
+
}),
|
|
33613
|
+
inRange: createConditionModifierConfig({
|
|
33614
|
+
modifier: NumberRangeInConditionModifier,
|
|
33615
|
+
isValueValid: (value) => typeof value === "number",
|
|
33616
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "object",
|
|
33617
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "object"
|
|
33618
|
+
}),
|
|
33619
|
+
notInRange: createConditionModifierConfig({
|
|
33620
|
+
modifier: NumberRangeNotInConditionModifier,
|
|
33621
|
+
isValueValid: (value) => typeof value === "number",
|
|
33622
|
+
isConditionValueValid: (conditionValue) => typeof conditionValue === "object",
|
|
33623
|
+
isSerializedValueValid: (conditionValue) => typeof conditionValue === "object"
|
|
33624
|
+
})
|
|
33625
|
+
};
|
|
33626
|
+
class RatingFieldCondition extends BaseCondition {
|
|
33627
|
+
constructor(options) {
|
|
33628
|
+
super(options);
|
|
33629
|
+
__publicField(this, "modifiers", modifiers$5);
|
|
33630
|
+
}
|
|
33631
|
+
static deserialize(serializedCondition, field) {
|
|
33632
|
+
const { conditionValue, conditionModifier, ...rest } = serializedCondition;
|
|
33633
|
+
const modifierConfig = modifiers$5[conditionModifier];
|
|
33634
|
+
const deserializedValue = conditionValue !== void 0 && modifierConfig.isSerializedValueValid(conditionValue) ? (
|
|
33635
|
+
// @ts-expect-error calling isSerializedValueValid means conditionValue is of appropriate type
|
|
33636
|
+
modifierConfig.modifier.deserialize(conditionValue)
|
|
33637
|
+
) : void 0;
|
|
33638
|
+
return new RatingFieldCondition({ field, conditionModifier, conditionValue: deserializedValue, ...rest });
|
|
33639
|
+
}
|
|
33640
|
+
render(props) {
|
|
33641
|
+
return /* @__PURE__ */ jsx(RatingFieldConditionCell, { condition: this, ...props }, this.id);
|
|
33642
|
+
}
|
|
33643
|
+
}
|
|
32233
33644
|
const ScanFieldConditionCell = (props) => {
|
|
32234
33645
|
const { condition, onRemove } = props;
|
|
32235
33646
|
const field = condition.field;
|
|
@@ -32292,8 +33703,6 @@ const modifiers$4 = {
|
|
|
32292
33703
|
class ScanFieldCondition extends BaseCondition {
|
|
32293
33704
|
constructor(options) {
|
|
32294
33705
|
super(options);
|
|
32295
|
-
__publicField(this, "defaultConditionValue");
|
|
32296
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32297
33706
|
__publicField(this, "modifiers", modifiers$4);
|
|
32298
33707
|
}
|
|
32299
33708
|
static deserialize(serializedCondition, field) {
|
|
@@ -32412,8 +33821,6 @@ const modifiers$3 = {
|
|
|
32412
33821
|
class SelectFieldCondition extends BaseCondition {
|
|
32413
33822
|
constructor(options) {
|
|
32414
33823
|
super(options);
|
|
32415
|
-
__publicField(this, "defaultConditionValue");
|
|
32416
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32417
33824
|
__publicField(this, "modifiers", modifiers$3);
|
|
32418
33825
|
}
|
|
32419
33826
|
static deserialize(serializedCondition, field) {
|
|
@@ -32491,8 +33898,6 @@ const modifiers$2 = {
|
|
|
32491
33898
|
class StringFieldCondition extends BaseCondition {
|
|
32492
33899
|
constructor(options) {
|
|
32493
33900
|
super(options);
|
|
32494
|
-
__publicField(this, "defaultConditionValue");
|
|
32495
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32496
33901
|
__publicField(this, "modifiers", modifiers$2);
|
|
32497
33902
|
}
|
|
32498
33903
|
static deserialize(serializedCondition, field) {
|
|
@@ -32567,8 +33972,6 @@ const modifiers$1 = {
|
|
|
32567
33972
|
class TextFieldCondition extends BaseCondition {
|
|
32568
33973
|
constructor(options) {
|
|
32569
33974
|
super(options);
|
|
32570
|
-
__publicField(this, "defaultConditionValue");
|
|
32571
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32572
33975
|
__publicField(this, "modifiers", modifiers$1);
|
|
32573
33976
|
}
|
|
32574
33977
|
static deserialize(serializedCondition, field) {
|
|
@@ -32639,8 +34042,6 @@ const modifiers = {
|
|
|
32639
34042
|
class UploadFieldCondition extends BaseCondition {
|
|
32640
34043
|
constructor(options) {
|
|
32641
34044
|
super(options);
|
|
32642
|
-
__publicField(this, "defaultConditionValue");
|
|
32643
|
-
__publicField(this, "defaultConditionModifier", "equals");
|
|
32644
34045
|
__publicField(this, "modifiers", modifiers);
|
|
32645
34046
|
}
|
|
32646
34047
|
static deserialize(serializedCondition, field) {
|
|
@@ -32653,79 +34054,39 @@ class UploadFieldCondition extends BaseCondition {
|
|
|
32653
34054
|
return /* @__PURE__ */ jsx(UploadFieldConditionCell, { condition: this, ...props }, this.id);
|
|
32654
34055
|
}
|
|
32655
34056
|
}
|
|
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
|
-
}
|
|
34057
|
+
const ConditionTypeToClsMapping = {
|
|
34058
|
+
date: DateFieldCondition,
|
|
34059
|
+
number: NumberFieldCondition,
|
|
34060
|
+
boolean: BooleanFieldCondition,
|
|
34061
|
+
select: SelectFieldCondition,
|
|
34062
|
+
string: StringFieldCondition,
|
|
34063
|
+
text: TextFieldCondition,
|
|
34064
|
+
upload: UploadFieldCondition,
|
|
34065
|
+
qr: ScanFieldCondition,
|
|
34066
|
+
"multi-string": MultiStringFieldCondition,
|
|
34067
|
+
"multi-select": MultiSelectFieldCondition,
|
|
34068
|
+
radio: RadioFieldCondition,
|
|
34069
|
+
"checkbox-list": CheckboxListFieldCondition,
|
|
34070
|
+
"pass-fail": PassFailFieldCondition,
|
|
34071
|
+
otp: OTPFieldCondition,
|
|
34072
|
+
rating: RatingFieldCondition
|
|
34073
|
+
};
|
|
34074
|
+
const deserializeCondition = (field, serializedCondition) => {
|
|
34075
|
+
if (field.type !== serializedCondition.type)
|
|
34076
|
+
throw new Error(`field and condition type mismatch ${field.type} !== ${serializedCondition.type}`);
|
|
34077
|
+
return ConditionTypeToClsMapping[serializedCondition.type].deserialize(serializedCondition, field);
|
|
32685
34078
|
};
|
|
32686
|
-
const deserializeConditions = (
|
|
34079
|
+
const deserializeConditions = (fields, serializedConditions) => {
|
|
32687
34080
|
const fieldsMapping = {};
|
|
32688
34081
|
for (const field of fields) {
|
|
32689
34082
|
fieldsMapping[field.identifier] = field;
|
|
32690
34083
|
}
|
|
32691
34084
|
return serializedConditions.map(
|
|
32692
|
-
(serializedCondition) => deserializeCondition(
|
|
34085
|
+
(serializedCondition) => deserializeCondition(fieldsMapping[serializedCondition.fieldId], serializedCondition)
|
|
32693
34086
|
);
|
|
32694
34087
|
};
|
|
32695
|
-
const applyConditions = (conditions, values) => {
|
|
32696
|
-
return conditions.length > 0 ? conditions.every((condition) => {
|
|
32697
|
-
return condition.apply(values[condition.field.identifier]);
|
|
32698
|
-
}) : true;
|
|
32699
|
-
};
|
|
32700
34088
|
const deserializeField = (serializedField) => {
|
|
32701
|
-
|
|
32702
|
-
case "boolean":
|
|
32703
|
-
return BooleanField.deserialize(serializedField);
|
|
32704
|
-
case "text":
|
|
32705
|
-
return TextField.deserialize(serializedField);
|
|
32706
|
-
case "number":
|
|
32707
|
-
return NumberField.deserialize(serializedField);
|
|
32708
|
-
case "date":
|
|
32709
|
-
return DateField.deserialize(serializedField);
|
|
32710
|
-
case "select":
|
|
32711
|
-
return SelectField.deserialize(serializedField);
|
|
32712
|
-
case "multi-string":
|
|
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);
|
|
32728
|
-
}
|
|
34089
|
+
return FieldTypeToClsMapping[serializedField.type].deserialize(serializedField);
|
|
32729
34090
|
};
|
|
32730
34091
|
function deserializeFields(fields) {
|
|
32731
34092
|
return fields.map(deserialize);
|
|
@@ -32800,6 +34161,85 @@ function cleanSerializedFieldValues(fields, values) {
|
|
|
32800
34161
|
}
|
|
32801
34162
|
return ret;
|
|
32802
34163
|
}
|
|
34164
|
+
function extractFilesAndPromisesFromFieldValues(fields, values) {
|
|
34165
|
+
const cleanValues = cleanFieldValues(fields, values);
|
|
34166
|
+
const valuesRet = {};
|
|
34167
|
+
const filesRet = {};
|
|
34168
|
+
for (const field of fields) {
|
|
34169
|
+
if (!(field.identifier in cleanValues)) continue;
|
|
34170
|
+
const value = cleanValues[field.identifier];
|
|
34171
|
+
switch (field.type) {
|
|
34172
|
+
case "upload":
|
|
34173
|
+
if (!field.isValueValid(value)) break;
|
|
34174
|
+
filesRet[field.identifier] = value;
|
|
34175
|
+
valuesRet[field.identifier] = [];
|
|
34176
|
+
break;
|
|
34177
|
+
case "pass-fail":
|
|
34178
|
+
if (!field.isValueValid(value)) break;
|
|
34179
|
+
filesRet[field.identifier] = value.files;
|
|
34180
|
+
valuesRet[field.identifier] = {
|
|
34181
|
+
...value,
|
|
34182
|
+
files: []
|
|
34183
|
+
};
|
|
34184
|
+
break;
|
|
34185
|
+
default:
|
|
34186
|
+
valuesRet[field.identifier] = values[field.identifier];
|
|
34187
|
+
}
|
|
34188
|
+
}
|
|
34189
|
+
return [valuesRet, filesRet];
|
|
34190
|
+
}
|
|
34191
|
+
function insertFilesAndPromisesToFieldValues(fields, values, filesAndPromises) {
|
|
34192
|
+
const ret = {};
|
|
34193
|
+
for (const field of fields) {
|
|
34194
|
+
if (!(field.identifier in values)) continue;
|
|
34195
|
+
const value = values[field.identifier];
|
|
34196
|
+
switch (field.type) {
|
|
34197
|
+
case "upload":
|
|
34198
|
+
if (!field.isValueValid(value)) break;
|
|
34199
|
+
ret[field.identifier] = filesAndPromises[field.identifier] ?? [];
|
|
34200
|
+
break;
|
|
34201
|
+
case "pass-fail":
|
|
34202
|
+
if (!field.isValueValid(value)) break;
|
|
34203
|
+
ret[field.identifier] = {
|
|
34204
|
+
...value,
|
|
34205
|
+
files: filesAndPromises[field.identifier] ?? []
|
|
34206
|
+
};
|
|
34207
|
+
break;
|
|
34208
|
+
default:
|
|
34209
|
+
if (!field.isValueValid(value)) break;
|
|
34210
|
+
ret[field.identifier] = value;
|
|
34211
|
+
}
|
|
34212
|
+
}
|
|
34213
|
+
return ret;
|
|
34214
|
+
}
|
|
34215
|
+
const initializeFieldValues = (fields, values) => {
|
|
34216
|
+
const ret = {};
|
|
34217
|
+
for (const field of fields) {
|
|
34218
|
+
const value = values[field.identifier];
|
|
34219
|
+
ret[field.identifier] = value !== void 0 ? value : field.blankValue();
|
|
34220
|
+
}
|
|
34221
|
+
return ret;
|
|
34222
|
+
};
|
|
34223
|
+
const changedFieldValues = (fields, values1, values2) => {
|
|
34224
|
+
const ret = {};
|
|
34225
|
+
for (const field of fields) {
|
|
34226
|
+
const value1 = values1[field.identifier];
|
|
34227
|
+
const value2 = values2[field.identifier];
|
|
34228
|
+
if (field.areValuesEqual(value1, value2)) continue;
|
|
34229
|
+
ret[field.identifier] = value2;
|
|
34230
|
+
}
|
|
34231
|
+
return ret;
|
|
34232
|
+
};
|
|
34233
|
+
const unchangedFieldValues = (fields, values1, values2) => {
|
|
34234
|
+
const ret = {};
|
|
34235
|
+
for (const field of fields) {
|
|
34236
|
+
const value1 = values1[field.identifier];
|
|
34237
|
+
const value2 = values2[field.identifier];
|
|
34238
|
+
if (!field.areValuesEqual(value1, value2)) continue;
|
|
34239
|
+
ret[field.identifier] = value2;
|
|
34240
|
+
}
|
|
34241
|
+
return ret;
|
|
34242
|
+
};
|
|
32803
34243
|
const RendererContext = createContext({});
|
|
32804
34244
|
const FieldSectionLayout = memo((props) => {
|
|
32805
34245
|
const { fieldSection: section, ...rest } = props;
|
|
@@ -32814,9 +34254,11 @@ const FieldSectionLayout = memo((props) => {
|
|
|
32814
34254
|
}, [fieldSections, section.identifier]);
|
|
32815
34255
|
const conditionMet = useMemo(() => {
|
|
32816
34256
|
if (conditionalSections.length === 0) return true;
|
|
32817
|
-
return conditionalSections.some(
|
|
32818
|
-
|
|
32819
|
-
|
|
34257
|
+
return conditionalSections.some((conditionalSection) => {
|
|
34258
|
+
const conditions = conditionalSection.getConditions(section.identifier);
|
|
34259
|
+
const conditionManager = new ConditionManager(conditions);
|
|
34260
|
+
return conditionManager.applyConditions(values);
|
|
34261
|
+
});
|
|
32820
34262
|
}, [conditionalSections, section, values]);
|
|
32821
34263
|
const inputs = useFieldInputs(section.fields, rest);
|
|
32822
34264
|
if (!conditionMet) return null;
|
|
@@ -32876,14 +34318,6 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
32876
34318
|
fields: this.fields.map((field) => field.serialize())
|
|
32877
34319
|
};
|
|
32878
34320
|
}
|
|
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
34321
|
getOptions() {
|
|
32888
34322
|
return {
|
|
32889
34323
|
...super.getOptions(),
|
|
@@ -32921,12 +34355,10 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
32921
34355
|
getFields() {
|
|
32922
34356
|
return this.fields;
|
|
32923
34357
|
}
|
|
32924
|
-
addField(field) {
|
|
32925
|
-
|
|
32926
|
-
|
|
32927
|
-
|
|
32928
|
-
addFields(fields) {
|
|
32929
|
-
this.fields = this.initFields([...this.fields, ...fields]);
|
|
34358
|
+
addField(field, index) {
|
|
34359
|
+
const copy = [...this.fields];
|
|
34360
|
+
copy.splice(index ?? this.fields.length, 0, field);
|
|
34361
|
+
this.fields = this.initFields(copy);
|
|
32930
34362
|
this.notify(this);
|
|
32931
34363
|
}
|
|
32932
34364
|
moveField(sourceIndex, targetIndex) {
|
|
@@ -32945,16 +34377,6 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
32945
34377
|
this.conditions = newConditions;
|
|
32946
34378
|
this.notify(this);
|
|
32947
34379
|
}
|
|
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
34380
|
getConditions(identifier) {
|
|
32959
34381
|
return this.conditions[identifier];
|
|
32960
34382
|
}
|
|
@@ -32991,7 +34413,10 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
32991
34413
|
return new Set(Object.keys(this.conditions));
|
|
32992
34414
|
}
|
|
32993
34415
|
addConditional(identifier) {
|
|
32994
|
-
this.conditions = this.initConditions({
|
|
34416
|
+
this.conditions = this.initConditions({
|
|
34417
|
+
...this.conditions,
|
|
34418
|
+
[identifier]: []
|
|
34419
|
+
});
|
|
32995
34420
|
this.notify(this);
|
|
32996
34421
|
}
|
|
32997
34422
|
removeConditional(identifier) {
|
|
@@ -33007,6 +34432,14 @@ const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
|
33007
34432
|
};
|
|
33008
34433
|
__publicField(_FieldSection, "fieldTypeName", "Section");
|
|
33009
34434
|
__publicField(_FieldSection, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
|
|
34435
|
+
__publicField(_FieldSection, "deserialize", (data) => {
|
|
34436
|
+
const fields = data.fields.map(deserializeField);
|
|
34437
|
+
const conditions = {};
|
|
34438
|
+
for (const [sectionId, serializedConditions] of Object.entries(data.conditions)) {
|
|
34439
|
+
conditions[sectionId] = deserializeConditions(fields, serializedConditions);
|
|
34440
|
+
}
|
|
34441
|
+
return new _FieldSection({ ...data, fields, conditions });
|
|
34442
|
+
});
|
|
33010
34443
|
let FieldSection = _FieldSection;
|
|
33011
34444
|
class FieldSchema extends Observable {
|
|
33012
34445
|
constructor(fields) {
|
|
@@ -33034,27 +34467,20 @@ class FieldSchema extends Observable {
|
|
|
33034
34467
|
getFieldSections() {
|
|
33035
34468
|
return this.fieldSections;
|
|
33036
34469
|
}
|
|
33037
|
-
addFieldSection(
|
|
33038
|
-
|
|
33039
|
-
|
|
33040
|
-
|
|
33041
|
-
addFieldSections(fields) {
|
|
33042
|
-
this.fieldSections = this.initFields([...this.fieldSections, ...fields]);
|
|
34470
|
+
addFieldSection(fieldSection, index) {
|
|
34471
|
+
const copy = [...this.fieldSections];
|
|
34472
|
+
copy.splice(index ?? this.fieldSections.length, 0, fieldSection);
|
|
34473
|
+
this.fieldSections = this.initFields(copy);
|
|
33043
34474
|
this.notify(this);
|
|
33044
34475
|
}
|
|
33045
|
-
removeFieldSection(
|
|
33046
|
-
const newFields = this.fieldSections.filter((f) => f.identifier !==
|
|
33047
|
-
for (const
|
|
33048
|
-
|
|
34476
|
+
removeFieldSection(fieldSection) {
|
|
34477
|
+
const newFields = this.fieldSections.filter((f) => f.identifier !== fieldSection.identifier);
|
|
34478
|
+
for (const field of newFields) {
|
|
34479
|
+
field.removeConditional(field.identifier);
|
|
33049
34480
|
}
|
|
33050
34481
|
this.fieldSections = this.initFields(newFields);
|
|
33051
34482
|
this.notify(this);
|
|
33052
34483
|
}
|
|
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
34484
|
moveFieldSection(sourceIndex, targetIndex) {
|
|
33059
34485
|
const newFields = [...this.fieldSections];
|
|
33060
34486
|
const [removedElement] = newFields.splice(sourceIndex, 1);
|
|
@@ -33068,44 +34494,70 @@ class FieldSchema extends Observable {
|
|
|
33068
34494
|
serializeValues(values) {
|
|
33069
34495
|
return serializeFieldValues(this.getFields(), values);
|
|
33070
34496
|
}
|
|
34497
|
+
deserializeConditions(conditions) {
|
|
34498
|
+
return deserializeConditions(this.getFields(), conditions);
|
|
34499
|
+
}
|
|
34500
|
+
initializeValues(values) {
|
|
34501
|
+
return initializeFieldValues(this.getFields(), values);
|
|
34502
|
+
}
|
|
33071
34503
|
}
|
|
33072
34504
|
const FieldSchemaContext = createContext(new FieldSchema([]));
|
|
33073
34505
|
const FormBuilderContext = createContext({});
|
|
34506
|
+
const useFieldTypeItems = (onSelect = () => null) => {
|
|
34507
|
+
return useMemo(() => {
|
|
34508
|
+
const entries = Object.entries(FieldTypeToClsMapping);
|
|
34509
|
+
return entries.map(([type, fieldClass]) => ({
|
|
34510
|
+
children: fieldClass.fieldTypeName,
|
|
34511
|
+
icon: /* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[type] }),
|
|
34512
|
+
value: type,
|
|
34513
|
+
onSelect: () => {
|
|
34514
|
+
onSelect(type);
|
|
34515
|
+
}
|
|
34516
|
+
}));
|
|
34517
|
+
}, [onSelect]);
|
|
34518
|
+
};
|
|
34519
|
+
const CreateFieldDropdownMenu = memo((props) => {
|
|
34520
|
+
const { children, variant, size, accentColor, onSelectFieldType, ...rest } = props;
|
|
34521
|
+
const fieldTypeItems = useFieldTypeItems(onSelectFieldType);
|
|
34522
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { ...rest, children: [
|
|
34523
|
+
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children }),
|
|
34524
|
+
/* @__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: [
|
|
34525
|
+
item.icon,
|
|
34526
|
+
item.children
|
|
34527
|
+
] }, item.value)) }) })
|
|
34528
|
+
] });
|
|
34529
|
+
});
|
|
34530
|
+
CreateFieldDropdownMenu.displayName = "CreateFieldDropdownMenu";
|
|
33074
34531
|
const createField = (type) => {
|
|
33075
34532
|
switch (type) {
|
|
33076
34533
|
case "text":
|
|
33077
|
-
return new TextField({
|
|
34534
|
+
return new TextField({ label: "", required: false, identifier: v4() });
|
|
33078
34535
|
case "boolean":
|
|
33079
34536
|
return new BooleanField({
|
|
33080
|
-
fieldValidators: [],
|
|
33081
34537
|
label: "",
|
|
33082
34538
|
required: false,
|
|
33083
34539
|
identifier: v4()
|
|
33084
34540
|
});
|
|
33085
34541
|
case "number":
|
|
33086
34542
|
return new NumberField({
|
|
33087
|
-
fieldValidators: [],
|
|
33088
34543
|
label: "",
|
|
33089
34544
|
required: false,
|
|
33090
34545
|
identifier: v4()
|
|
33091
34546
|
});
|
|
33092
34547
|
case "date":
|
|
33093
34548
|
return new DateField({
|
|
33094
|
-
fieldValidators: [],
|
|
33095
34549
|
label: "",
|
|
33096
34550
|
required: false,
|
|
33097
34551
|
identifier: v4()
|
|
33098
34552
|
});
|
|
33099
34553
|
case "string":
|
|
33100
34554
|
return new StringField({
|
|
33101
|
-
fieldValidators: [],
|
|
33102
34555
|
label: "",
|
|
33103
34556
|
required: false,
|
|
33104
34557
|
identifier: v4()
|
|
33105
34558
|
});
|
|
33106
34559
|
case "select":
|
|
33107
34560
|
return new SelectField({
|
|
33108
|
-
fieldValidators: [],
|
|
33109
34561
|
label: "",
|
|
33110
34562
|
options: [],
|
|
33111
34563
|
required: false,
|
|
@@ -33113,14 +34565,12 @@ const createField = (type) => {
|
|
|
33113
34565
|
});
|
|
33114
34566
|
case "multi-string":
|
|
33115
34567
|
return new MultiStringField({
|
|
33116
|
-
fieldValidators: [],
|
|
33117
34568
|
label: "",
|
|
33118
34569
|
required: false,
|
|
33119
34570
|
identifier: v4()
|
|
33120
34571
|
});
|
|
33121
34572
|
case "multi-select":
|
|
33122
34573
|
return new MultiSelectField({
|
|
33123
|
-
fieldValidators: [],
|
|
33124
34574
|
label: "",
|
|
33125
34575
|
options: [],
|
|
33126
34576
|
required: false,
|
|
@@ -33128,21 +34578,20 @@ const createField = (type) => {
|
|
|
33128
34578
|
});
|
|
33129
34579
|
case "upload":
|
|
33130
34580
|
return new UploadField({
|
|
33131
|
-
fieldValidators: [],
|
|
33132
34581
|
label: "",
|
|
33133
34582
|
required: false,
|
|
33134
|
-
identifier: v4()
|
|
34583
|
+
identifier: v4(),
|
|
34584
|
+
maximum_files: 6,
|
|
34585
|
+
maximum_size: maxFileSizeMB
|
|
33135
34586
|
});
|
|
33136
34587
|
case "qr":
|
|
33137
34588
|
return new ScanField({
|
|
33138
|
-
fieldValidators: [],
|
|
33139
34589
|
label: "",
|
|
33140
34590
|
required: false,
|
|
33141
34591
|
identifier: v4()
|
|
33142
34592
|
});
|
|
33143
34593
|
case "radio":
|
|
33144
34594
|
return new RadioField({
|
|
33145
|
-
fieldValidators: [],
|
|
33146
34595
|
label: "",
|
|
33147
34596
|
options: [],
|
|
33148
34597
|
required: false,
|
|
@@ -33150,21 +34599,34 @@ const createField = (type) => {
|
|
|
33150
34599
|
});
|
|
33151
34600
|
case "checkbox-list":
|
|
33152
34601
|
return new CheckboxListField({
|
|
33153
|
-
fieldValidators: [],
|
|
33154
34602
|
label: "",
|
|
33155
34603
|
options: [],
|
|
33156
34604
|
required: false,
|
|
33157
34605
|
identifier: v4()
|
|
33158
34606
|
});
|
|
34607
|
+
case "pass-fail":
|
|
34608
|
+
return new PassFailField({
|
|
34609
|
+
label: "",
|
|
34610
|
+
required: false,
|
|
34611
|
+
identifier: v4(),
|
|
34612
|
+
showNotesAndFilesOn: ["fail"]
|
|
34613
|
+
// TODO: what defaults
|
|
34614
|
+
});
|
|
33159
34615
|
case "otp":
|
|
33160
34616
|
return new OTPField({
|
|
33161
|
-
fieldValidators: [],
|
|
33162
34617
|
label: "",
|
|
33163
34618
|
validationType: "none",
|
|
33164
34619
|
required: false,
|
|
33165
34620
|
identifier: v4(),
|
|
33166
34621
|
length: 6
|
|
33167
34622
|
});
|
|
34623
|
+
case "rating":
|
|
34624
|
+
return new RatingField({
|
|
34625
|
+
label: "",
|
|
34626
|
+
required: false,
|
|
34627
|
+
identifier: v4(),
|
|
34628
|
+
maxRating: 5
|
|
34629
|
+
});
|
|
33168
34630
|
}
|
|
33169
34631
|
};
|
|
33170
34632
|
const createCondition = (field) => {
|
|
@@ -33248,6 +34710,13 @@ const createCondition = (field) => {
|
|
|
33248
34710
|
conditionModifier: "equals",
|
|
33249
34711
|
field
|
|
33250
34712
|
});
|
|
34713
|
+
case "pass-fail":
|
|
34714
|
+
return new PassFailFieldCondition({
|
|
34715
|
+
id: v4(),
|
|
34716
|
+
conditionValue: void 0,
|
|
34717
|
+
conditionModifier: "equals",
|
|
34718
|
+
field
|
|
34719
|
+
});
|
|
33251
34720
|
case "otp":
|
|
33252
34721
|
return new OTPFieldCondition({
|
|
33253
34722
|
id: v4(),
|
|
@@ -33255,6 +34724,13 @@ const createCondition = (field) => {
|
|
|
33255
34724
|
conditionModifier: "equals",
|
|
33256
34725
|
field
|
|
33257
34726
|
});
|
|
34727
|
+
case "rating":
|
|
34728
|
+
return new RatingFieldCondition({
|
|
34729
|
+
id: v4(),
|
|
34730
|
+
conditionValue: void 0,
|
|
34731
|
+
conditionModifier: "equals",
|
|
34732
|
+
field
|
|
34733
|
+
});
|
|
33258
34734
|
}
|
|
33259
34735
|
};
|
|
33260
34736
|
const getFieldCreationSchema = (type, path) => {
|
|
@@ -33275,8 +34751,12 @@ const getFieldCreationSchema = (type, path) => {
|
|
|
33275
34751
|
return TextField.getFieldCreationSchema(path);
|
|
33276
34752
|
case "upload":
|
|
33277
34753
|
return UploadField.getFieldCreationSchema(path);
|
|
34754
|
+
case "pass-fail":
|
|
34755
|
+
return PassFailField.getFieldCreationSchema(path);
|
|
33278
34756
|
case "otp":
|
|
33279
34757
|
return OTPField.getFieldCreationSchema(path);
|
|
34758
|
+
case "rating":
|
|
34759
|
+
return RatingField.getFieldCreationSchema(path);
|
|
33280
34760
|
default:
|
|
33281
34761
|
return;
|
|
33282
34762
|
}
|
|
@@ -33294,7 +34774,7 @@ const FieldSettingsPopover = memo((props) => {
|
|
|
33294
34774
|
accentColor: "base",
|
|
33295
34775
|
...hasError && { color: SEVERITY_COLOR_MAPPING.danger },
|
|
33296
34776
|
children: [
|
|
33297
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
34777
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Settings }),
|
|
33298
34778
|
"Settings"
|
|
33299
34779
|
]
|
|
33300
34780
|
},
|
|
@@ -33305,7 +34785,7 @@ const FieldSettingsPopover = memo((props) => {
|
|
|
33305
34785
|
});
|
|
33306
34786
|
FieldSettingsPopover.displayName = "FieldSettingsPopover";
|
|
33307
34787
|
const FieldBuilder = memo((props) => {
|
|
33308
|
-
const { parentPath,
|
|
34788
|
+
const { parentPath, fieldIndex, field } = props;
|
|
33309
34789
|
const { errors } = useFormikContext();
|
|
33310
34790
|
const openImageViewer = useImageViewer();
|
|
33311
34791
|
const { disableRequiredFields } = use(FormBuilderContext);
|
|
@@ -33321,17 +34801,16 @@ const FieldBuilder = memo((props) => {
|
|
|
33321
34801
|
const handleImageDelete = useCallback(() => {
|
|
33322
34802
|
field.setOptions({ image: void 0 });
|
|
33323
34803
|
}, [field]);
|
|
33324
|
-
const type = field.type;
|
|
33325
34804
|
const [directlyShownFields, popoverFields] = useMemo(() => {
|
|
33326
34805
|
const directlyShownFields2 = [];
|
|
33327
34806
|
const popoverFields2 = [];
|
|
33328
|
-
const fieldObject = getFieldCreationSchema(field.type, `${parentPath}.${
|
|
34807
|
+
const fieldObject = getFieldCreationSchema(field.type, `${parentPath}.${fieldIndex}`) ?? [];
|
|
33329
34808
|
for (const item of fieldObject) {
|
|
33330
34809
|
if (item.showDirectly) directlyShownFields2.push(item.field);
|
|
33331
34810
|
else popoverFields2.push(item.field);
|
|
33332
34811
|
}
|
|
33333
34812
|
return [directlyShownFields2, popoverFields2];
|
|
33334
|
-
}, [field, parentPath,
|
|
34813
|
+
}, [field, parentPath, fieldIndex]);
|
|
33335
34814
|
const directlyShownInputs = useFieldInputs(directlyShownFields, {
|
|
33336
34815
|
formId,
|
|
33337
34816
|
disabled: false
|
|
@@ -33356,7 +34835,7 @@ const FieldBuilder = memo((props) => {
|
|
|
33356
34835
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 w-full justify-between", children: [
|
|
33357
34836
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center", children: [
|
|
33358
34837
|
/* @__PURE__ */ jsxs(Badge, { accentColor: "base", variant: "soft", size: "sm", children: [
|
|
33359
|
-
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[type] }),
|
|
34838
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[field.type] }),
|
|
33360
34839
|
fieldTypeName
|
|
33361
34840
|
] }),
|
|
33362
34841
|
!disableRequiredFields && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -33366,7 +34845,7 @@ const FieldBuilder = memo((props) => {
|
|
|
33366
34845
|
checked: field.required,
|
|
33367
34846
|
onCheckedChange: (required) => field.setOptions({ required: !!required }),
|
|
33368
34847
|
size: "sm",
|
|
33369
|
-
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
34848
|
+
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: Check }) })
|
|
33370
34849
|
}
|
|
33371
34850
|
),
|
|
33372
34851
|
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", children: "Required" })
|
|
@@ -33394,7 +34873,7 @@ const FieldBuilder = memo((props) => {
|
|
|
33394
34873
|
"aria-label": "delete",
|
|
33395
34874
|
onClick: handleImageDelete,
|
|
33396
34875
|
size: "sm",
|
|
33397
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
34876
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash })
|
|
33398
34877
|
}
|
|
33399
34878
|
)
|
|
33400
34879
|
] }),
|
|
@@ -33425,46 +34904,25 @@ const FieldBuilder = memo((props) => {
|
|
|
33425
34904
|
] });
|
|
33426
34905
|
});
|
|
33427
34906
|
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();
|
|
34907
|
+
const FieldBuilderWithActions = memo((props) => {
|
|
34908
|
+
const { field, fieldSection, fieldIndex, sectionIndex } = props;
|
|
33457
34909
|
const fileInputRef = useRef(null);
|
|
33458
34910
|
const parentPath = `fields.${sectionIndex}.fields`;
|
|
34911
|
+
const handleAddField = useCallback(
|
|
34912
|
+
(type) => {
|
|
34913
|
+
fieldSection.addField(createField(type), fieldIndex + 1);
|
|
34914
|
+
},
|
|
34915
|
+
[fieldIndex, fieldSection]
|
|
34916
|
+
);
|
|
33459
34917
|
const duplicateField = useCallback(() => {
|
|
33460
34918
|
fieldSection.addField(field.duplicate(v4()));
|
|
33461
34919
|
}, [field, fieldSection]);
|
|
33462
34920
|
const moveField = useCallback(
|
|
33463
34921
|
(direction) => {
|
|
33464
34922
|
const targetIndex = direction === "up" ? sectionIndex - 1 : sectionIndex + 1;
|
|
33465
|
-
fieldSection.moveField(
|
|
34923
|
+
fieldSection.moveField(fieldIndex, targetIndex);
|
|
33466
34924
|
},
|
|
33467
|
-
[fieldSection,
|
|
34925
|
+
[fieldSection, fieldIndex, sectionIndex]
|
|
33468
34926
|
);
|
|
33469
34927
|
const uploadImage = useCallback(
|
|
33470
34928
|
(event) => {
|
|
@@ -33473,7 +34931,7 @@ const FieldWithActions = memo((props) => {
|
|
|
33473
34931
|
const file = files.item(0);
|
|
33474
34932
|
if (!file) return;
|
|
33475
34933
|
if (file.size > maxFileSizeB) {
|
|
33476
|
-
|
|
34934
|
+
toast.error({
|
|
33477
34935
|
title: "File upload error",
|
|
33478
34936
|
description: `The file ${file.name} exceeded the maximum file size`
|
|
33479
34937
|
});
|
|
@@ -33483,7 +34941,7 @@ const FieldWithActions = memo((props) => {
|
|
|
33483
34941
|
image: file
|
|
33484
34942
|
});
|
|
33485
34943
|
},
|
|
33486
|
-
[field
|
|
34944
|
+
[field]
|
|
33487
34945
|
);
|
|
33488
34946
|
const handleMoveUp = useCallback(() => {
|
|
33489
34947
|
moveField("up");
|
|
@@ -33496,21 +34954,48 @@ const FieldWithActions = memo((props) => {
|
|
|
33496
34954
|
(_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
33497
34955
|
}, []);
|
|
33498
34956
|
const handleRemove = useCallback(() => {
|
|
33499
|
-
|
|
33500
|
-
}, [field,
|
|
34957
|
+
fieldSection.removeField(field);
|
|
34958
|
+
}, [field, fieldSection]);
|
|
33501
34959
|
return /* @__PURE__ */ jsxs(Card, { className: "flex items-center justify-between gap-4 w-full", children: [
|
|
33502
|
-
/* @__PURE__ */ jsx(FieldBuilder, {
|
|
34960
|
+
/* @__PURE__ */ jsx(FieldBuilder, { fieldIndex, field, parentPath }),
|
|
33503
34961
|
/* @__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:
|
|
34962
|
+
/* @__PURE__ */ jsx(CreateFieldDropdownMenu, { onSelectFieldType: handleAddField, children: /* @__PURE__ */ jsx(IconButton, { type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: Plus }) }) }),
|
|
34963
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsx(LuIcon, { icon: MoveUp }) }),
|
|
34964
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsx(LuIcon, { icon: MoveDown }) }),
|
|
34965
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: duplicateField, children: /* @__PURE__ */ jsx(LuIcon, { icon: Copy }) }),
|
|
34966
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleUploadImage, children: /* @__PURE__ */ jsx(LuIcon, { icon: Image }) }),
|
|
34967
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleRemove, children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash }) })
|
|
33509
34968
|
] }),
|
|
33510
34969
|
/* @__PURE__ */ jsx("input", { className: "hidden", ref: fileInputRef, type: "file", accept: "image/*", onChange: uploadImage })
|
|
33511
34970
|
] });
|
|
33512
34971
|
});
|
|
33513
|
-
|
|
34972
|
+
FieldBuilderWithActions.displayName = "FieldBuilderWithActions";
|
|
34973
|
+
const FieldDropdownMenu = memo((props) => {
|
|
34974
|
+
const { children, variant, size, accentColor, fields, onSelectField, ...rest } = props;
|
|
34975
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { ...rest, children: [
|
|
34976
|
+
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children }),
|
|
34977
|
+
/* @__PURE__ */ jsx(Menu.Content, { variant, size, accentColor, children: /* @__PURE__ */ jsx(Menu.Scroll, { children: fields.map((field) => {
|
|
34978
|
+
return /* @__PURE__ */ jsxs(Menu.Item, { onSelect: () => onSelectField(field), children: [
|
|
34979
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[field.type] }),
|
|
34980
|
+
field.label || UNLABELLED_FIELD_LABEL
|
|
34981
|
+
] }, field.identifier);
|
|
34982
|
+
}) }) })
|
|
34983
|
+
] });
|
|
34984
|
+
});
|
|
34985
|
+
FieldDropdownMenu.displayName = "IssueDataFilterMenu";
|
|
34986
|
+
const FieldSectionDropdownMenu = memo((props) => {
|
|
34987
|
+
const { children, variant, size, accentColor, fieldSections, onSelectFieldCondition, ...rest } = props;
|
|
34988
|
+
return /* @__PURE__ */ jsxs(Menu.Root, { ...rest, children: [
|
|
34989
|
+
/* @__PURE__ */ jsx(Menu.ClickTrigger, { children }),
|
|
34990
|
+
/* @__PURE__ */ jsx(Menu.Content, { variant, size, accentColor, children: fieldSections.map((fieldSection) => {
|
|
34991
|
+
return /* @__PURE__ */ jsxs(Menu.Item, { onSelect: () => onSelectFieldCondition(fieldSection), children: [
|
|
34992
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons[fieldSection.type] }),
|
|
34993
|
+
fieldSection.label || UNLABELLED_SECTION_LABEL
|
|
34994
|
+
] }, fieldSection.identifier);
|
|
34995
|
+
}) })
|
|
34996
|
+
] });
|
|
34997
|
+
});
|
|
34998
|
+
FieldSectionDropdownMenu.displayName = "IssueDataFilterMenu";
|
|
33514
34999
|
const FieldSectionConditionEdgeComponent = memo((props) => {
|
|
33515
35000
|
const { id, sourceX, sourceY, targetX, targetY, style, markerEnd, data } = props;
|
|
33516
35001
|
const { targetSection, sourceSection, layoutDirection } = data;
|
|
@@ -33564,7 +35049,7 @@ const FieldSectionConditionEdgeComponent = memo((props) => {
|
|
|
33564
35049
|
variant: "surface",
|
|
33565
35050
|
size: "xs",
|
|
33566
35051
|
accentColor: "base",
|
|
33567
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35052
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Plus })
|
|
33568
35053
|
}
|
|
33569
35054
|
) }),
|
|
33570
35055
|
/* @__PURE__ */ jsxs(Tooltip.Root, { children: [
|
|
@@ -33578,7 +35063,7 @@ const FieldSectionConditionEdgeComponent = memo((props) => {
|
|
|
33578
35063
|
accentColor: "base",
|
|
33579
35064
|
color: "danger",
|
|
33580
35065
|
onClick: handleDelete,
|
|
33581
|
-
children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35066
|
+
children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash })
|
|
33582
35067
|
}
|
|
33583
35068
|
) }),
|
|
33584
35069
|
/* @__PURE__ */ jsx(Tooltip.Content, { size: "sm", children: "Remove conditional logic" })
|
|
@@ -33594,27 +35079,14 @@ const FieldSectionConditionEdgeComponent = memo((props) => {
|
|
|
33594
35079
|
] });
|
|
33595
35080
|
});
|
|
33596
35081
|
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
35082
|
const FieldSectionNodeComponent = memo((props) => {
|
|
33611
35083
|
const { data, selected } = props;
|
|
33612
35084
|
const { fieldSection, index: sectionIndex, layoutDirection } = data;
|
|
33613
35085
|
const fieldSchema = use(FieldSchemaContext);
|
|
33614
|
-
const
|
|
35086
|
+
const handleRemoveSection = useCallback(() => {
|
|
33615
35087
|
fieldSchema.removeFieldSection(fieldSection);
|
|
33616
35088
|
}, [fieldSchema, fieldSection]);
|
|
33617
|
-
const
|
|
35089
|
+
const handleAddField = useCallback(
|
|
33618
35090
|
(type) => {
|
|
33619
35091
|
fieldSection.addField(createField(type));
|
|
33620
35092
|
},
|
|
@@ -33628,13 +35100,6 @@ const FieldSectionNodeComponent = memo((props) => {
|
|
|
33628
35100
|
const handleDuplicate = useCallback(() => {
|
|
33629
35101
|
fieldSchema.addFieldSection(fieldSection.duplicate(v4()));
|
|
33630
35102
|
}, [fieldSchema, fieldSection]);
|
|
33631
|
-
const fieldTypeItems = useFieldTypeItems(addField);
|
|
33632
|
-
const removeField = useCallback(
|
|
33633
|
-
(field) => {
|
|
33634
|
-
fieldSection.removeField(field);
|
|
33635
|
-
},
|
|
33636
|
-
[fieldSection]
|
|
33637
|
-
);
|
|
33638
35103
|
return /* @__PURE__ */ jsxs(
|
|
33639
35104
|
Card,
|
|
33640
35105
|
{
|
|
@@ -33668,25 +35133,18 @@ const FieldSectionNodeComponent = memo((props) => {
|
|
|
33668
35133
|
] }),
|
|
33669
35134
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
33670
35135
|
/* @__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
|
-
] })
|
|
35136
|
+
/* @__PURE__ */ jsx(CreateFieldDropdownMenu, { onSelectFieldType: handleAddField, children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "soft", size: "sm", accentColor: "base", children: [
|
|
35137
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Plus }),
|
|
35138
|
+
" Add field"
|
|
35139
|
+
] }) })
|
|
33681
35140
|
] }),
|
|
33682
35141
|
/* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: fieldSection.fields.map((child, index) => /* @__PURE__ */ jsx(
|
|
33683
|
-
|
|
35142
|
+
FieldBuilderWithActions,
|
|
33684
35143
|
{
|
|
33685
35144
|
field: child,
|
|
33686
35145
|
fieldSection,
|
|
33687
|
-
index,
|
|
33688
|
-
sectionIndex
|
|
33689
|
-
remove: removeField
|
|
35146
|
+
fieldIndex: index,
|
|
35147
|
+
sectionIndex
|
|
33690
35148
|
},
|
|
33691
35149
|
child.identifier
|
|
33692
35150
|
)) })
|
|
@@ -33707,9 +35165,9 @@ const FieldSectionNodeComponent = memo((props) => {
|
|
|
33707
35165
|
size: "xs",
|
|
33708
35166
|
onClick: (e) => e.stopPropagation(),
|
|
33709
35167
|
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:
|
|
35168
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleAddBranch, children: /* @__PURE__ */ jsx(LuIcon, { icon: GitBranch }) }),
|
|
35169
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleDuplicate, children: /* @__PURE__ */ jsx(LuIcon, { icon: Copy }) }),
|
|
35170
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleRemoveSection, children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash }) })
|
|
33713
35171
|
] })
|
|
33714
35172
|
}
|
|
33715
35173
|
)
|
|
@@ -33926,7 +35384,7 @@ const FormBuilderFlowBuilder = memo(() => {
|
|
|
33926
35384
|
}
|
|
33927
35385
|
),
|
|
33928
35386
|
/* @__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:
|
|
35387
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Plus }),
|
|
33930
35388
|
" Add section"
|
|
33931
35389
|
] }) }) }),
|
|
33932
35390
|
/* @__PURE__ */ jsxs(Panel, { position: "top-right", className: "flex flex-col items-center gap-2", children: [
|
|
@@ -33940,16 +35398,16 @@ const FormBuilderFlowBuilder = memo(() => {
|
|
|
33940
35398
|
value: layoutDirection,
|
|
33941
35399
|
onValueChange: setLayoutDirection,
|
|
33942
35400
|
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:
|
|
35401
|
+
/* @__PURE__ */ jsx(ToggleGroup.IconItem, { className: "rounded-b-none", value: "LR", type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: ArrowLeftRight }) }),
|
|
35402
|
+
/* @__PURE__ */ jsx(ToggleGroup.IconItem, { className: "rounded-t-none", value: "TB", type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: ArrowDownUp }) })
|
|
33945
35403
|
]
|
|
33946
35404
|
}
|
|
33947
35405
|
),
|
|
33948
35406
|
/* @__PURE__ */ jsx(Separator, { size: "sm" }),
|
|
33949
35407
|
/* @__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:
|
|
35408
|
+
/* @__PURE__ */ jsx(IconButton, { className: "rounded-b-none", onClick: () => reactFlow == null ? void 0 : reactFlow.zoomIn(), type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: Plus }) }),
|
|
35409
|
+
/* @__PURE__ */ jsx(IconButton, { onClick: () => reactFlow == null ? void 0 : reactFlow.zoomOut(), radius: "none", type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: Minus }) }),
|
|
35410
|
+
/* @__PURE__ */ jsx(IconButton, { className: "rounded-t-none", onClick: () => reactFlow == null ? void 0 : reactFlow.fitView(), type: "button", children: /* @__PURE__ */ jsx(LuIcon, { icon: SquareDashed }) })
|
|
33953
35411
|
] })
|
|
33954
35412
|
] }),
|
|
33955
35413
|
/* @__PURE__ */ jsx(Panel, { position: "bottom-right", children: /* @__PURE__ */ jsxs(ButtonGroup, { className: "flex items-center justify-end gap-2", size: "sm", children: [
|
|
@@ -33987,7 +35445,7 @@ const FieldSectionConditionalItem = memo((props) => {
|
|
|
33987
35445
|
/* @__PURE__ */ jsx(LuIcon, { icon: fieldIcons.section }),
|
|
33988
35446
|
sourceFieldSection.label ?? UNLABELLED_SECTION_LABEL
|
|
33989
35447
|
] }),
|
|
33990
|
-
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleDelete, variant: "ghost", children: /* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35448
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleDelete, variant: "ghost", children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash }) })
|
|
33991
35449
|
] }),
|
|
33992
35450
|
/* @__PURE__ */ jsxs("div", { className: "flex h-max w-full flex-wrap gap-2", children: [
|
|
33993
35451
|
conditions.map((condition) => {
|
|
@@ -33995,7 +35453,7 @@ const FieldSectionConditionalItem = memo((props) => {
|
|
|
33995
35453
|
onRemove: handleDeleteCondition
|
|
33996
35454
|
});
|
|
33997
35455
|
}),
|
|
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:
|
|
35456
|
+
/* @__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
35457
|
] })
|
|
34000
35458
|
] });
|
|
34001
35459
|
});
|
|
@@ -34057,7 +35515,7 @@ const FieldSectionBuilder = memo((props) => {
|
|
|
34057
35515
|
fieldSections: validFieldSections,
|
|
34058
35516
|
onSelectFieldCondition: handleAddConditional,
|
|
34059
35517
|
children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "soft", size: "sm", className: "w-max", children: [
|
|
34060
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35518
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Plus }),
|
|
34061
35519
|
"Add condition"
|
|
34062
35520
|
] })
|
|
34063
35521
|
}
|
|
@@ -34077,15 +35535,9 @@ const FieldSectionBuilder = memo((props) => {
|
|
|
34077
35535
|
});
|
|
34078
35536
|
FieldSectionBuilder.displayName = "FieldSectionBuilder";
|
|
34079
35537
|
const FieldSectionWithActions = memo((props) => {
|
|
34080
|
-
const { fieldSection,
|
|
35538
|
+
const { fieldSection, sectionIndex } = props;
|
|
34081
35539
|
const fieldSchema = use(FieldSchemaContext);
|
|
34082
|
-
const
|
|
34083
|
-
(field) => {
|
|
34084
|
-
fieldSection.removeField(field);
|
|
34085
|
-
},
|
|
34086
|
-
[fieldSection]
|
|
34087
|
-
);
|
|
34088
|
-
const removeSection = useCallback(() => {
|
|
35540
|
+
const handleRemoveSection = useCallback(() => {
|
|
34089
35541
|
fieldSchema.removeFieldSection(fieldSection);
|
|
34090
35542
|
}, [fieldSchema, fieldSection]);
|
|
34091
35543
|
const moveSection = useCallback(
|
|
@@ -34098,7 +35550,7 @@ const FieldSectionWithActions = memo((props) => {
|
|
|
34098
35550
|
const duplicateSection = useCallback(() => {
|
|
34099
35551
|
fieldSchema.addFieldSection(fieldSection.duplicate(v4()));
|
|
34100
35552
|
}, [fieldSchema, fieldSection]);
|
|
34101
|
-
const
|
|
35553
|
+
const handleAddField = useCallback(
|
|
34102
35554
|
(type) => {
|
|
34103
35555
|
fieldSection.addField(createField(type));
|
|
34104
35556
|
},
|
|
@@ -34110,42 +35562,34 @@ const FieldSectionWithActions = memo((props) => {
|
|
|
34110
35562
|
const handleMoveDown = useCallback(() => {
|
|
34111
35563
|
moveSection("down");
|
|
34112
35564
|
}, [moveSection]);
|
|
34113
|
-
const fieldTypeItems = useFieldTypeItems(handleCreateField);
|
|
34114
35565
|
return /* @__PURE__ */ jsxs(Card, { variant: "outline", className: "flex items-center justify-between gap-4 w-full", children: [
|
|
34115
35566
|
/* @__PURE__ */ jsxs("div", { className: "flex grow flex-col gap-4 w-full", children: [
|
|
34116
35567
|
/* @__PURE__ */ jsx(FieldSectionBuilder, { fieldSection }),
|
|
34117
35568
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 w-full", children: [
|
|
34118
35569
|
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 justify-between", children: [
|
|
34119
35570
|
/* @__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
|
-
] })
|
|
35571
|
+
/* @__PURE__ */ jsx(CreateFieldDropdownMenu, { onSelectFieldType: handleAddField, children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "soft", size: "sm", children: [
|
|
35572
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Plus }),
|
|
35573
|
+
" Add field"
|
|
35574
|
+
] }) })
|
|
34130
35575
|
] }),
|
|
34131
35576
|
fieldSection.fields.map((child, index) => /* @__PURE__ */ jsx(
|
|
34132
|
-
|
|
35577
|
+
FieldBuilderWithActions,
|
|
34133
35578
|
{
|
|
34134
35579
|
field: child,
|
|
34135
35580
|
fieldSection,
|
|
34136
|
-
index,
|
|
34137
|
-
sectionIndex
|
|
34138
|
-
remove: removeField
|
|
35581
|
+
fieldIndex: index,
|
|
35582
|
+
sectionIndex
|
|
34139
35583
|
},
|
|
34140
35584
|
child.identifier
|
|
34141
35585
|
))
|
|
34142
35586
|
] })
|
|
34143
35587
|
] }),
|
|
34144
35588
|
/* @__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:
|
|
35589
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleMoveUp, children: /* @__PURE__ */ jsx(LuIcon, { icon: MoveUp }) }),
|
|
35590
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleMoveDown, children: /* @__PURE__ */ jsx(LuIcon, { icon: MoveDown }) }),
|
|
35591
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: duplicateSection, children: /* @__PURE__ */ jsx(LuIcon, { icon: Copy }) }),
|
|
35592
|
+
/* @__PURE__ */ jsx(IconButton, { type: "button", onClick: handleRemoveSection, children: /* @__PURE__ */ jsx(LuIcon, { icon: Trash }) })
|
|
34149
35593
|
] })
|
|
34150
35594
|
] });
|
|
34151
35595
|
});
|
|
@@ -34194,7 +35638,14 @@ const FormBuilderListBuilder = memo(() => {
|
|
|
34194
35638
|
}
|
|
34195
35639
|
),
|
|
34196
35640
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
34197
|
-
fieldSchema.fieldSections.map((fieldSection, index) => /* @__PURE__ */ jsx(
|
|
35641
|
+
fieldSchema.fieldSections.map((fieldSection, index) => /* @__PURE__ */ jsx(
|
|
35642
|
+
FieldSectionWithActions,
|
|
35643
|
+
{
|
|
35644
|
+
fieldSection,
|
|
35645
|
+
sectionIndex: index
|
|
35646
|
+
},
|
|
35647
|
+
fieldSection.identifier
|
|
35648
|
+
)),
|
|
34198
35649
|
/* @__PURE__ */ jsxs(
|
|
34199
35650
|
Button,
|
|
34200
35651
|
{
|
|
@@ -34205,7 +35656,7 @@ const FormBuilderListBuilder = memo(() => {
|
|
|
34205
35656
|
size: "sm",
|
|
34206
35657
|
onClick: handleCreateEmptySection,
|
|
34207
35658
|
children: [
|
|
34208
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35659
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Plus }),
|
|
34209
35660
|
" Add section"
|
|
34210
35661
|
]
|
|
34211
35662
|
}
|
|
@@ -34225,9 +35676,12 @@ const validateFields = (fields, values) => {
|
|
|
34225
35676
|
for (const field of fields) {
|
|
34226
35677
|
if (field instanceof FieldSection) {
|
|
34227
35678
|
const conditionalSections = sectionElements.filter((section) => field.identifier in section.conditions);
|
|
34228
|
-
|
|
34229
|
-
|
|
34230
|
-
|
|
35679
|
+
if (conditionalSections.length === 0) continue;
|
|
35680
|
+
const conditionMet = conditionalSections.some((conditionalSection) => {
|
|
35681
|
+
const conditions = conditionalSection.getConditions(field.identifier);
|
|
35682
|
+
const conditionManager = new ConditionManager(conditions);
|
|
35683
|
+
return conditionManager.applyConditions(values);
|
|
35684
|
+
});
|
|
34231
35685
|
if (!conditionMet) continue;
|
|
34232
35686
|
Object.assign(errors, field.getErrors(values));
|
|
34233
35687
|
} else {
|
|
@@ -34241,59 +35695,10 @@ const validateFields = (fields, values) => {
|
|
|
34241
35695
|
}
|
|
34242
35696
|
if (Object.keys(errors).length > 0) return errors;
|
|
34243
35697
|
};
|
|
34244
|
-
const
|
|
34245
|
-
const ret = {};
|
|
34246
|
-
for (const field of fields) {
|
|
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 = {};
|
|
34264
|
-
for (const field of fields) {
|
|
34265
|
-
const value1 = values1[field.identifier];
|
|
34266
|
-
const value2 = values2[field.identifier];
|
|
34267
|
-
if (!field.areValuesEqual(value1, value2)) continue;
|
|
34268
|
-
ret[field.identifier] = value2;
|
|
34269
|
-
}
|
|
34270
|
-
return ret;
|
|
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 };
|
|
34289
|
-
};
|
|
34290
|
-
const separateFilesFromFields = async (fields) => {
|
|
35698
|
+
const separateImagesFromFields = async (fields) => {
|
|
34291
35699
|
const images = {};
|
|
34292
35700
|
const newFields = [];
|
|
34293
35701
|
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
35702
|
const { fields: sectionFields } = section;
|
|
34298
35703
|
const newSectionFields = [];
|
|
34299
35704
|
for (const field of sectionFields) {
|
|
@@ -34315,16 +35720,12 @@ const separateFilesFromFields = async (fields) => {
|
|
|
34315
35720
|
}
|
|
34316
35721
|
return { fields: newFields, images };
|
|
34317
35722
|
};
|
|
34318
|
-
async function
|
|
34319
|
-
const
|
|
35723
|
+
async function awaitFilesAndPromises(values) {
|
|
35724
|
+
const ret = {};
|
|
34320
35725
|
for (const [key, value] of Object.entries(values)) {
|
|
34321
|
-
|
|
34322
|
-
valuesWithoutFiles[key] = await Promise.all(value);
|
|
34323
|
-
} else {
|
|
34324
|
-
valuesWithoutFiles[key] = value;
|
|
34325
|
-
}
|
|
35726
|
+
ret[key] = await Promise.all(value);
|
|
34326
35727
|
}
|
|
34327
|
-
return
|
|
35728
|
+
return ret;
|
|
34328
35729
|
}
|
|
34329
35730
|
const FormRenderer = memo(
|
|
34330
35731
|
forwardRef((props, ref) => {
|
|
@@ -34353,9 +35754,9 @@ const FormRenderer = memo(
|
|
|
34353
35754
|
}, [schema.fields, values]);
|
|
34354
35755
|
const handleSubmit = useCallback(
|
|
34355
35756
|
(values2) => {
|
|
34356
|
-
onSubmit == null ? void 0 : onSubmit(
|
|
35757
|
+
void (onSubmit == null ? void 0 : onSubmit(
|
|
34357
35758
|
excludeUnchangedFields ? changedFieldValues(flattenFields(schema.fields), initialValues, values2) : values2
|
|
34358
|
-
);
|
|
35759
|
+
));
|
|
34359
35760
|
},
|
|
34360
35761
|
[excludeUnchangedFields, initialValues, onSubmit, schema.fields]
|
|
34361
35762
|
);
|
|
@@ -34420,13 +35821,13 @@ const FormRenderer = memo(
|
|
|
34420
35821
|
variant: "soft",
|
|
34421
35822
|
onClick: onCancel,
|
|
34422
35823
|
children: [
|
|
34423
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35824
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: X }),
|
|
34424
35825
|
cancelText
|
|
34425
35826
|
]
|
|
34426
35827
|
}
|
|
34427
35828
|
),
|
|
34428
35829
|
/* @__PURE__ */ jsxs(Button, { ...buttonProps, type: "submit", accentColor: "primary", variant: "surface", children: [
|
|
34429
|
-
/* @__PURE__ */ jsx(LuIcon, { icon:
|
|
35830
|
+
/* @__PURE__ */ jsx(LuIcon, { icon: Check }),
|
|
34430
35831
|
submitText
|
|
34431
35832
|
] })
|
|
34432
35833
|
] })
|
|
@@ -34465,43 +35866,39 @@ const FormBuilderRoot = memo((props) => {
|
|
|
34465
35866
|
enableReinitialize = false,
|
|
34466
35867
|
disableRequiredFields = false
|
|
34467
35868
|
} = 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
|
-
);
|
|
35869
|
+
const validate = useCallback((form) => {
|
|
35870
|
+
var _a2;
|
|
35871
|
+
const errors = {};
|
|
35872
|
+
if (!form.title) {
|
|
35873
|
+
errors.title = "Title is required.";
|
|
35874
|
+
}
|
|
35875
|
+
if (!form.fields || form.fields.length === 0) {
|
|
35876
|
+
errors.fields = "At least one field is required.";
|
|
35877
|
+
}
|
|
35878
|
+
const fieldsToValidate = [];
|
|
35879
|
+
for (const [sectionIndex, section] of form.fields.entries())
|
|
35880
|
+
for (const [fieldIndex, field] of section.fields.entries()) {
|
|
35881
|
+
const fieldSettings = ((_a2 = getFieldCreationSchema(field.type, `fields.${sectionIndex}.fields.${fieldIndex}`)) == null ? void 0 : _a2.map(
|
|
35882
|
+
({ field: field2 }) => field2
|
|
35883
|
+
)) ?? [];
|
|
35884
|
+
fieldsToValidate.push(...fieldSettings);
|
|
35885
|
+
}
|
|
35886
|
+
const values = {};
|
|
35887
|
+
for (const field of fieldsToValidate) {
|
|
35888
|
+
values[field.identifier] = get(form, field.identifier);
|
|
35889
|
+
}
|
|
35890
|
+
const fieldErrors = validateFields(fieldsToValidate, values);
|
|
35891
|
+
if (fieldErrors) {
|
|
35892
|
+
errors.fields = fieldErrors.fields;
|
|
35893
|
+
}
|
|
35894
|
+
if (Object.keys(errors).length > 0) {
|
|
35895
|
+
toast.error({
|
|
35896
|
+
title: "Some form settings are invalid",
|
|
35897
|
+
description: "Please check settings highlighted in red."
|
|
35898
|
+
});
|
|
35899
|
+
return errors;
|
|
35900
|
+
}
|
|
35901
|
+
}, []);
|
|
34505
35902
|
const initialValues = useMemo(
|
|
34506
35903
|
() => ({
|
|
34507
35904
|
title: initialTitle ?? "",
|
|
@@ -34520,7 +35917,7 @@ const FormBuilderRoot = memo((props) => {
|
|
|
34520
35917
|
});
|
|
34521
35918
|
const observer = useCallback(
|
|
34522
35919
|
(fieldSchema) => {
|
|
34523
|
-
formik.setFieldValue("fields", fieldSchema.serialize());
|
|
35920
|
+
void formik.setFieldValue("fields", fieldSchema.serialize());
|
|
34524
35921
|
},
|
|
34525
35922
|
[formik]
|
|
34526
35923
|
);
|
|
@@ -34562,6 +35959,7 @@ export {
|
|
|
34562
35959
|
CheckboxListFieldCondition,
|
|
34563
35960
|
CheckboxListFieldConditionCell,
|
|
34564
35961
|
CheckboxListInput,
|
|
35962
|
+
ConditionManager,
|
|
34565
35963
|
DateAfterConditionModifier,
|
|
34566
35964
|
DateBeforeConditionModifier,
|
|
34567
35965
|
DateEqualsConditionModifier,
|
|
@@ -34612,10 +36010,23 @@ export {
|
|
|
34612
36010
|
OTPFieldCondition,
|
|
34613
36011
|
OTPFieldConditionCell,
|
|
34614
36012
|
OTPInput,
|
|
36013
|
+
Observable,
|
|
36014
|
+
PassFailArrayExcludesConditionModifier,
|
|
36015
|
+
PassFailArrayIncludesConditionModifier,
|
|
36016
|
+
PassFailEqualsConditionModifier,
|
|
36017
|
+
PassFailField,
|
|
36018
|
+
PassFailFieldCondition,
|
|
36019
|
+
PassFailFieldConditionCell,
|
|
36020
|
+
PassFailInput,
|
|
36021
|
+
PassFailNotEqualsConditionModifier,
|
|
34615
36022
|
RadioField,
|
|
34616
36023
|
RadioFieldCondition,
|
|
34617
36024
|
RadioFieldConditionCell,
|
|
34618
36025
|
RadioInput,
|
|
36026
|
+
RatingField,
|
|
36027
|
+
RatingFieldCondition,
|
|
36028
|
+
RatingFieldConditionCell,
|
|
36029
|
+
RatingInput,
|
|
34619
36030
|
SEVERITY_COLOR_MAPPING,
|
|
34620
36031
|
SHORT_TEXT_FIELD_MAX_LENGTH,
|
|
34621
36032
|
ScanField,
|
|
@@ -34647,13 +36058,15 @@ export {
|
|
|
34647
36058
|
TextFieldCondition,
|
|
34648
36059
|
TextFieldConditionCell,
|
|
34649
36060
|
TextInput,
|
|
36061
|
+
UUIDFile,
|
|
34650
36062
|
UUIDPromise,
|
|
34651
36063
|
UploadField,
|
|
34652
36064
|
UploadFieldCondition,
|
|
34653
36065
|
UploadFieldConditionCell,
|
|
34654
36066
|
UploadInput,
|
|
34655
|
-
|
|
34656
|
-
|
|
36067
|
+
areFileAndPromiseArraysEqual,
|
|
36068
|
+
arePassFieldValuesEqual,
|
|
36069
|
+
awaitFilesAndPromises,
|
|
34657
36070
|
changedFieldValues,
|
|
34658
36071
|
cleanFieldValues,
|
|
34659
36072
|
cleanSerializedFieldValues,
|
|
@@ -34667,18 +36080,28 @@ export {
|
|
|
34667
36080
|
deserializeFieldValues,
|
|
34668
36081
|
deserializeFields,
|
|
34669
36082
|
deserializeOnlyFields,
|
|
36083
|
+
deserializePassFailFieldValue,
|
|
36084
|
+
extractFilesAndPromisesFromFieldValues,
|
|
34670
36085
|
fieldIcons,
|
|
34671
36086
|
flattenFields,
|
|
34672
36087
|
getFieldsMapping,
|
|
34673
36088
|
initializeFieldValues,
|
|
36089
|
+
insertFilesAndPromisesToFieldValues,
|
|
36090
|
+
isFileAndPromiseArray,
|
|
36091
|
+
isPassFailFieldStatus,
|
|
36092
|
+
isPassFailFieldValue,
|
|
36093
|
+
isSerializedPassFailFieldValue,
|
|
34674
36094
|
isStringArray,
|
|
34675
36095
|
maxFileSizeB,
|
|
34676
36096
|
maxFileSizeKB,
|
|
34677
36097
|
maxFileSizeMB,
|
|
34678
|
-
|
|
34679
|
-
|
|
36098
|
+
passFailFieldStatusMapping,
|
|
36099
|
+
passFailFieldStatuses,
|
|
36100
|
+
separateImagesFromFields,
|
|
34680
36101
|
serializeFieldValues,
|
|
36102
|
+
serializePassFailFieldValue,
|
|
34681
36103
|
unchangedFieldValues,
|
|
36104
|
+
useConditionManager,
|
|
34682
36105
|
useFieldInput,
|
|
34683
36106
|
useFieldInputs,
|
|
34684
36107
|
useFormikInput,
|
|
@@ -34686,3 +36109,4 @@ export {
|
|
|
34686
36109
|
useScanner,
|
|
34687
36110
|
validateFields
|
|
34688
36111
|
};
|
|
36112
|
+
//# sourceMappingURL=forms.js.map
|