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