@aatulwork/customform-renderer 1.10.0 → 1.12.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/fields.js +52 -36
- package/dist/fields.js.map +1 -1
- package/dist/fields.mjs +54 -38
- package/dist/fields.mjs.map +1 -1
- package/dist/index.js +54 -38
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/fields.js
CHANGED
|
@@ -164,12 +164,9 @@ var SimpleSelect = ({
|
|
|
164
164
|
onRefresh
|
|
165
165
|
}) => {
|
|
166
166
|
const [filterText, setFilterText] = react.useState("");
|
|
167
|
+
const selectId = react.useId();
|
|
167
168
|
const handleChange = (event) => {
|
|
168
169
|
const val = event.target.value;
|
|
169
|
-
if (val === "__refresh__") {
|
|
170
|
-
onRefresh?.();
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
170
|
onChange(val);
|
|
174
171
|
};
|
|
175
172
|
const filteredOptions = filterable && filterText ? options.filter(
|
|
@@ -182,14 +179,25 @@ var SimpleSelect = ({
|
|
|
182
179
|
setFilterText("");
|
|
183
180
|
};
|
|
184
181
|
return /* @__PURE__ */ jsxRuntime.jsxs(material.FormControl, { fullWidth, size, required, error, disabled, children: [
|
|
185
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
182
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
183
|
+
material.FormLabel,
|
|
184
|
+
{
|
|
185
|
+
component: "label",
|
|
186
|
+
htmlFor: selectId,
|
|
187
|
+
required,
|
|
188
|
+
error,
|
|
189
|
+
sx: { mb: 0.5, display: "block" },
|
|
190
|
+
children: label
|
|
191
|
+
}
|
|
192
|
+
),
|
|
186
193
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
187
194
|
material.Select,
|
|
188
195
|
{
|
|
196
|
+
id: selectId,
|
|
189
197
|
value: value ?? (multiple ? [] : ""),
|
|
190
198
|
onChange: handleChange,
|
|
191
199
|
onClose: handleClose,
|
|
192
|
-
input: /* @__PURE__ */ jsxRuntime.jsx(material.OutlinedInput, {
|
|
200
|
+
input: /* @__PURE__ */ jsxRuntime.jsx(material.OutlinedInput, {}),
|
|
193
201
|
MenuProps: {
|
|
194
202
|
autoFocus: false
|
|
195
203
|
},
|
|
@@ -391,40 +399,48 @@ var ColorField = ({ field, control, defaultValue, rules, errors }) => {
|
|
|
391
399
|
control,
|
|
392
400
|
defaultValue,
|
|
393
401
|
rules,
|
|
394
|
-
render: ({ field: formField }) =>
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
{
|
|
398
|
-
required: field.required,
|
|
399
|
-
error: !!errors[field.name],
|
|
400
|
-
children: field.label
|
|
401
|
-
}
|
|
402
|
-
),
|
|
403
|
-
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", flexDirection: "column", flex: 1, maxWidth: 200 }, children: [
|
|
402
|
+
render: ({ field: formField }) => {
|
|
403
|
+
const inputId = `color-field-${field.name}`;
|
|
404
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", alignItems: "center", gap: 2, width: "100%" }, children: [
|
|
404
405
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
405
|
-
material.
|
|
406
|
+
material.FormLabel,
|
|
406
407
|
{
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
cursor: "pointer",
|
|
413
|
-
border: errors[field.name] ? "1px solid red" : "1px solid rgba(0, 0, 0, 0.23)",
|
|
414
|
-
borderRadius: "4px",
|
|
415
|
-
padding: "1px"
|
|
416
|
-
},
|
|
417
|
-
inputProps: {
|
|
418
|
-
style: {
|
|
419
|
-
height: "100%",
|
|
420
|
-
cursor: "pointer"
|
|
421
|
-
}
|
|
422
|
-
}
|
|
408
|
+
component: "label",
|
|
409
|
+
htmlFor: inputId,
|
|
410
|
+
required: field.required,
|
|
411
|
+
error: !!errors[field.name],
|
|
412
|
+
children: field.label
|
|
423
413
|
}
|
|
424
414
|
),
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
415
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", flexDirection: "column", flex: 1, maxWidth: 200 }, children: [
|
|
416
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
417
|
+
material.Box,
|
|
418
|
+
{
|
|
419
|
+
component: "input",
|
|
420
|
+
type: "color",
|
|
421
|
+
id: inputId,
|
|
422
|
+
ref: formField.ref,
|
|
423
|
+
name: formField.name,
|
|
424
|
+
value: formField.value ?? "#000000",
|
|
425
|
+
onChange: formField.onChange,
|
|
426
|
+
onBlur: formField.onBlur,
|
|
427
|
+
sx: {
|
|
428
|
+
width: 30,
|
|
429
|
+
height: 30,
|
|
430
|
+
padding: 0,
|
|
431
|
+
cursor: "pointer",
|
|
432
|
+
backgroundColor: "transparent",
|
|
433
|
+
border: "none",
|
|
434
|
+
"&::-webkit-color-swatch-wrapper": { padding: 0 },
|
|
435
|
+
"&::-webkit-color-swatch": { border: "none", borderRadius: "4px" },
|
|
436
|
+
"&::-moz-color-swatch": { border: "none", borderRadius: "4px" }
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
),
|
|
440
|
+
errors[field.name] && /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "caption", color: "error", sx: { mt: 0.5 }, children: errors[field.name]?.message })
|
|
441
|
+
] })
|
|
442
|
+
] });
|
|
443
|
+
}
|
|
428
444
|
},
|
|
429
445
|
field.name
|
|
430
446
|
);
|