@fctc/sme-widget-ui 2.9.6 → 2.9.8
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/index.js +211 -221
- package/dist/index.mjs +272 -282
- package/dist/utils.js +4 -2
- package/dist/utils.mjs +4 -2
- package/dist/widgets.d.mts +9 -8
- package/dist/widgets.d.ts +9 -8
- package/dist/widgets.js +211 -242
- package/dist/widgets.mjs +272 -303
- package/package.json +1 -1
package/dist/widgets.mjs
CHANGED
|
@@ -7725,7 +7725,8 @@ var vi_default = {
|
|
|
7725
7725
|
"message-text-error": " kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 {{max}} k\xFD t\u1EF1",
|
|
7726
7726
|
upcase: ", {{count}} ch\u1EEF in hoa",
|
|
7727
7727
|
digit: ", {{count}} s\u1ED1",
|
|
7728
|
-
special: ", {{count}} k\xFD t\u1EF1 \u0111\u1EB7c bi\u1EC7t"
|
|
7728
|
+
special: ", {{count}} k\xFD t\u1EF1 \u0111\u1EB7c bi\u1EC7t",
|
|
7729
|
+
upload_files_accept: "Ch\u1EC9 ch\u1EA5p nh\u1EADn c\xE1c \u0111\u1ECBnh d\u1EA1ng JPEG, PNG, PDF, MP4, XLS, XLXS, ZIP"
|
|
7729
7730
|
};
|
|
7730
7731
|
|
|
7731
7732
|
// src/locales/en.json
|
|
@@ -7784,7 +7785,8 @@ var en_default = {
|
|
|
7784
7785
|
"message-text-error": " must not exceed {{max}} characters",
|
|
7785
7786
|
upcase: ", {{count}} uppercase letter",
|
|
7786
7787
|
digit: ", {{count}} digit",
|
|
7787
|
-
special: ", {{count}} special character"
|
|
7788
|
+
special: ", {{count}} special character",
|
|
7789
|
+
upload_files_accept: "Only JPEG, PNG, PDF, MP4, XLS, XLXS, ZIP, JSON formats are allowed"
|
|
7788
7790
|
};
|
|
7789
7791
|
|
|
7790
7792
|
// src/utils/i18n.ts
|
|
@@ -9464,27 +9466,6 @@ var PaidIcon = () => /* @__PURE__ */ jsxs18(
|
|
|
9464
9466
|
|
|
9465
9467
|
// src/icons/placeholder-icon.tsx
|
|
9466
9468
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
9467
|
-
var PlaceHolderIcon = () => {
|
|
9468
|
-
return /* @__PURE__ */ jsx37(
|
|
9469
|
-
"svg",
|
|
9470
|
-
{
|
|
9471
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
9472
|
-
version: "1.0",
|
|
9473
|
-
width: "256.000000pt",
|
|
9474
|
-
height: "256.000000pt",
|
|
9475
|
-
viewBox: "0 0 256.000000 256.000000",
|
|
9476
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
9477
|
-
children: /* @__PURE__ */ jsx37(
|
|
9478
|
-
"g",
|
|
9479
|
-
{
|
|
9480
|
-
transform: "translate(0.000000,256.000000) scale(0.100000,-0.100000)",
|
|
9481
|
-
fill: "#000000",
|
|
9482
|
-
stroke: "none"
|
|
9483
|
-
}
|
|
9484
|
-
)
|
|
9485
|
-
}
|
|
9486
|
-
);
|
|
9487
|
-
};
|
|
9488
9469
|
|
|
9489
9470
|
// src/icons/google-icon.tsx
|
|
9490
9471
|
import { jsx as jsx38, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
@@ -15850,7 +15831,7 @@ var ButtonSelectFiles = ({
|
|
|
15850
15831
|
isText
|
|
15851
15832
|
}) => {
|
|
15852
15833
|
const { t: t3 } = useI18n();
|
|
15853
|
-
const
|
|
15834
|
+
const ALLOWED_TYPES2 = [
|
|
15854
15835
|
"image/jpeg",
|
|
15855
15836
|
"image/png",
|
|
15856
15837
|
"application/pdf",
|
|
@@ -15867,7 +15848,7 @@ var ButtonSelectFiles = ({
|
|
|
15867
15848
|
const { mutate, isPending } = isBinary ? useUploadFile() : useUploadImage();
|
|
15868
15849
|
const dataUser = user?.userProfile?.data;
|
|
15869
15850
|
const validateFile = (file) => {
|
|
15870
|
-
if (!
|
|
15851
|
+
if (!ALLOWED_TYPES2.includes(file.type)) {
|
|
15871
15852
|
setUploadError(t3("file_accept_single"));
|
|
15872
15853
|
return false;
|
|
15873
15854
|
}
|
|
@@ -16080,125 +16061,117 @@ var AvatarField = (props) => {
|
|
|
16080
16061
|
};
|
|
16081
16062
|
|
|
16082
16063
|
// src/widgets/basic/binary-field/binary.tsx
|
|
16083
|
-
import {
|
|
16064
|
+
import { useState as useState10, useRef as useRef6 } from "react";
|
|
16084
16065
|
import { Fragment as Fragment16, jsx as jsx75, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
16066
|
+
var ALLOWED_TYPES = [
|
|
16067
|
+
"image/jpeg",
|
|
16068
|
+
"image/png",
|
|
16069
|
+
"application/pdf",
|
|
16070
|
+
"video/mp4",
|
|
16071
|
+
"application/zip",
|
|
16072
|
+
"application/x-zip-compressed",
|
|
16073
|
+
"application/vnd.ms-excel",
|
|
16074
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
16075
|
+
"application/json"
|
|
16076
|
+
];
|
|
16085
16077
|
var BinaryField = (props) => {
|
|
16086
16078
|
const {
|
|
16079
|
+
value,
|
|
16087
16080
|
name,
|
|
16088
|
-
methods,
|
|
16089
|
-
readonly = false,
|
|
16090
|
-
placeholder,
|
|
16091
|
-
required = false,
|
|
16092
|
-
invisible = false,
|
|
16093
|
-
filename,
|
|
16094
|
-
formValues,
|
|
16095
16081
|
isEditTable,
|
|
16096
16082
|
widget,
|
|
16097
|
-
|
|
16098
|
-
value,
|
|
16099
|
-
// from hook
|
|
16083
|
+
readonly,
|
|
16100
16084
|
placeHolderImage,
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
|
|
16105
|
-
|
|
16106
|
-
|
|
16085
|
+
placeholder,
|
|
16086
|
+
required,
|
|
16087
|
+
invisible,
|
|
16088
|
+
methods,
|
|
16089
|
+
string,
|
|
16090
|
+
isForm,
|
|
16107
16091
|
onDownload,
|
|
16108
|
-
|
|
16092
|
+
onUploadFile,
|
|
16093
|
+
onDeleteFile,
|
|
16094
|
+
url,
|
|
16095
|
+
fileInfor
|
|
16109
16096
|
} = props;
|
|
16110
16097
|
const { t: t3 } = useI18n();
|
|
16111
|
-
const [
|
|
16098
|
+
const [loading, setLoading] = useState10(false);
|
|
16099
|
+
const hasFetchedMeta = useRef6(false);
|
|
16112
16100
|
const onlyImage = widget === "image" || widget === "image_url";
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16122
|
-
}
|
|
16123
|
-
try {
|
|
16124
|
-
let type = "application/octet-stream";
|
|
16125
|
-
let size4 = 0;
|
|
16126
|
-
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16127
|
-
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16128
|
-
type = "image/*";
|
|
16129
|
-
} else {
|
|
16130
|
-
const response = await fetch(initialFile);
|
|
16131
|
-
console.log("responsessss", response);
|
|
16132
|
-
const responseBlob = await response.blob();
|
|
16133
|
-
if (responseBlob) {
|
|
16134
|
-
type = responseBlob?.type;
|
|
16135
|
-
size4 = responseBlob.size;
|
|
16136
|
-
}
|
|
16137
|
-
}
|
|
16138
|
-
setFileInfo({
|
|
16139
|
-
name: name2,
|
|
16140
|
-
type,
|
|
16141
|
-
url: initialFile,
|
|
16142
|
-
size: size4,
|
|
16143
|
-
source: "link"
|
|
16144
|
-
});
|
|
16145
|
-
} catch (error2) {
|
|
16146
|
-
console.warn("Cannot load link info:", error2);
|
|
16147
|
-
}
|
|
16148
|
-
};
|
|
16149
|
-
loadFromLink();
|
|
16150
|
-
}, [initialFile]);
|
|
16151
|
-
const handleChange = (e3, onChange2) => {
|
|
16152
|
-
const file = e3.target.files?.[0];
|
|
16101
|
+
const acceptType = !onlyImage ? `.pdf,.json,.mp4,.zip,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,.jpeg,.jpg,.png` : ".jpeg,.jpg,.png";
|
|
16102
|
+
const validateFile = (file) => {
|
|
16103
|
+
if (!ALLOWED_TYPES.includes(file.type)) {
|
|
16104
|
+
return t3("upload_files_accept");
|
|
16105
|
+
}
|
|
16106
|
+
return true;
|
|
16107
|
+
};
|
|
16108
|
+
const handleUpload = async (e3) => {
|
|
16109
|
+
const file = e3.target.files[0];
|
|
16153
16110
|
if (!file) return;
|
|
16154
16111
|
if (onlyImage && !file.type.startsWith("image/")) {
|
|
16155
|
-
methods?.setError(
|
|
16112
|
+
methods?.setError(name, {
|
|
16113
|
+
type: "manual",
|
|
16114
|
+
message: t3("only_image_accept")
|
|
16115
|
+
});
|
|
16156
16116
|
e3.target.value = "";
|
|
16157
16117
|
return;
|
|
16158
16118
|
}
|
|
16159
|
-
const
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16166
|
-
|
|
16167
|
-
|
|
16168
|
-
|
|
16169
|
-
|
|
16170
|
-
|
|
16171
|
-
|
|
16119
|
+
const valid = validateFile(file);
|
|
16120
|
+
if (valid !== true) {
|
|
16121
|
+
methods?.setError(name, { type: "manual", message: valid });
|
|
16122
|
+
return;
|
|
16123
|
+
}
|
|
16124
|
+
methods?.clearErrors(name);
|
|
16125
|
+
const formData = new FormData();
|
|
16126
|
+
formData.append("file", file);
|
|
16127
|
+
setLoading(true);
|
|
16128
|
+
try {
|
|
16129
|
+
onUploadFile?.(formData);
|
|
16130
|
+
} catch (error2) {
|
|
16131
|
+
console.error(error2);
|
|
16132
|
+
}
|
|
16133
|
+
setLoading(false);
|
|
16172
16134
|
};
|
|
16173
|
-
const
|
|
16174
|
-
|
|
16175
|
-
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
|
|
16135
|
+
const handleDelete = () => {
|
|
16136
|
+
onDeleteFile && onDeleteFile();
|
|
16137
|
+
hasFetchedMeta.current = false;
|
|
16138
|
+
};
|
|
16139
|
+
const renderPreview = () => {
|
|
16140
|
+
if (!url) return null;
|
|
16141
|
+
const type = fileInfor?.type;
|
|
16142
|
+
const date = fileInfor?.date;
|
|
16143
|
+
const size4 = fileInfor?.size;
|
|
16144
|
+
if (type?.includes("image")) {
|
|
16145
|
+
return /* @__PURE__ */ jsxs49("div", { className: "flex gap-2 items-center", children: [
|
|
16146
|
+
/* @__PURE__ */ jsx75(
|
|
16147
|
+
"img",
|
|
16148
|
+
{
|
|
16149
|
+
src: url,
|
|
16150
|
+
alt: name,
|
|
16151
|
+
className: `image-value w-full h-full object-contain ${onlyImage ? "rounded-lg" : "rounded-[4px]"} ${isEditTable ? "max-h-10 max-w-10 h-10 w-10" : "max-w-32 max-h-32"}`,
|
|
16152
|
+
style: {
|
|
16153
|
+
maxWidth: isEditTable ? "40px" : "128px",
|
|
16154
|
+
maxHeight: isEditTable ? "40px" : "128px",
|
|
16155
|
+
height: isEditTable ? "40px" : "128px",
|
|
16156
|
+
width: isEditTable ? "40px" : "128px"
|
|
16157
|
+
}
|
|
16186
16158
|
}
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
|
|
16200
|
-
}
|
|
16201
|
-
);
|
|
16159
|
+
),
|
|
16160
|
+
!onlyImage && /* @__PURE__ */ jsxs49("div", { children: [
|
|
16161
|
+
/* @__PURE__ */ jsx75(
|
|
16162
|
+
"p",
|
|
16163
|
+
{
|
|
16164
|
+
style: {
|
|
16165
|
+
maxWidth: "120px"
|
|
16166
|
+
},
|
|
16167
|
+
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16168
|
+
children: url?.split("/").pop()
|
|
16169
|
+
}
|
|
16170
|
+
),
|
|
16171
|
+
/* @__PURE__ */ jsx75("span", { className: "text-xs text-[#666] font-semibold", children: size4 })
|
|
16172
|
+
] })
|
|
16173
|
+
] });
|
|
16174
|
+
}
|
|
16202
16175
|
const getFileIcon = () => {
|
|
16203
16176
|
if (type === "application/pdf") return /* @__PURE__ */ jsx75(PdfIcon, {});
|
|
16204
16177
|
if (type?.includes("excel") || type?.includes("spreadsheet"))
|
|
@@ -16207,7 +16180,6 @@ var BinaryField = (props) => {
|
|
|
16207
16180
|
if (type === "application/json") return /* @__PURE__ */ jsx75(JSONFileIcon, {});
|
|
16208
16181
|
return /* @__PURE__ */ jsx75(DefaultFileIcon, {});
|
|
16209
16182
|
};
|
|
16210
|
-
const isShowSize = !isNaN(size4);
|
|
16211
16183
|
return /* @__PURE__ */ jsxs49("div", { className: "flex items-center gap-2", children: [
|
|
16212
16184
|
getFileIcon(),
|
|
16213
16185
|
/* @__PURE__ */ jsxs49("div", { children: [
|
|
@@ -16218,10 +16190,10 @@ var BinaryField = (props) => {
|
|
|
16218
16190
|
maxWidth: "120px"
|
|
16219
16191
|
},
|
|
16220
16192
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16221
|
-
children:
|
|
16193
|
+
children: url?.split("/").pop()
|
|
16222
16194
|
}
|
|
16223
16195
|
),
|
|
16224
|
-
|
|
16196
|
+
/* @__PURE__ */ jsx75("span", { className: "text-xs text-[#666] font-semibold", children: size4 })
|
|
16225
16197
|
] })
|
|
16226
16198
|
] });
|
|
16227
16199
|
};
|
|
@@ -16231,139 +16203,136 @@ var BinaryField = (props) => {
|
|
|
16231
16203
|
name: name ?? "",
|
|
16232
16204
|
control: methods?.control,
|
|
16233
16205
|
rules: {
|
|
16234
|
-
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
16206
|
+
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
16207
|
+
validate: {
|
|
16208
|
+
fileValidate: (value2) => {
|
|
16209
|
+
if (!value2) return true;
|
|
16210
|
+
return validateFile(value2);
|
|
16211
|
+
}
|
|
16212
|
+
}
|
|
16235
16213
|
},
|
|
16236
|
-
render: ({
|
|
16237
|
-
|
|
16214
|
+
render: ({ fieldState: { error: error2 } }) => {
|
|
16215
|
+
console.log("error", error2);
|
|
16238
16216
|
return /* @__PURE__ */ jsxs49(Fragment16, { children: [
|
|
16239
16217
|
/* @__PURE__ */ jsx75(
|
|
16240
16218
|
"div",
|
|
16241
16219
|
{
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
children: hasFile ? /* @__PURE__ */ jsx75(
|
|
16220
|
+
className: `widget binary-field flex w-fit items-center gap-4 ${onlyImage ? "shadow-md rounded-[12px]" : ""} ${isEditTable ? "p-2" : ""}`,
|
|
16221
|
+
children: /* @__PURE__ */ jsx75("div", { className: "relative group", children: /* @__PURE__ */ jsxs49(
|
|
16245
16222
|
"div",
|
|
16246
16223
|
{
|
|
16247
|
-
className: `relative
|
|
16248
|
-
children: /* @__PURE__ */ jsxs49(
|
|
16249
|
-
"div",
|
|
16250
|
-
{
|
|
16251
|
-
className: `flex gap-2 items-center bg-[#FAFAFA] rounded-[8px] p-[6px] ${onlyImage ? "h-32 w-32" : "max-h-fit max-w-fit"}`,
|
|
16252
|
-
children: [
|
|
16253
|
-
renderPreview(fileInfo),
|
|
16254
|
-
/* @__PURE__ */ jsxs49(
|
|
16255
|
-
"div",
|
|
16256
|
-
{
|
|
16257
|
-
style: {
|
|
16258
|
-
display: "flex",
|
|
16259
|
-
alignItems: "center",
|
|
16260
|
-
borderRadius: "8px",
|
|
16261
|
-
padding: "4px",
|
|
16262
|
-
gap: "8px",
|
|
16263
|
-
backgroundColor: onlyImage ? "rgba(0,0,0,0.03)" : "white",
|
|
16264
|
-
boxShadow: "0 2px 4px 0 rgba(27, 28, 29, 0.04)",
|
|
16265
|
-
position: onlyImage ? "absolute" : "relative",
|
|
16266
|
-
bottom: onlyImage ? "0" : "none",
|
|
16267
|
-
right: onlyImage ? "0" : "none"
|
|
16268
|
-
},
|
|
16269
|
-
children: [
|
|
16270
|
-
/* @__PURE__ */ jsx75(
|
|
16271
|
-
"span",
|
|
16272
|
-
{
|
|
16273
|
-
className: "cursor-pointer",
|
|
16274
|
-
onClick: () => onDownload && onDownload(
|
|
16275
|
-
fileInfo?.url || fileInfo?.data,
|
|
16276
|
-
fileInfo?.name || fileInfo?.display_name
|
|
16277
|
-
),
|
|
16278
|
-
children: /* @__PURE__ */ jsx75(DownloadIcon, {})
|
|
16279
|
-
}
|
|
16280
|
-
),
|
|
16281
|
-
!readonly && /* @__PURE__ */ jsx75(
|
|
16282
|
-
"span",
|
|
16283
|
-
{
|
|
16284
|
-
className: "cursor-pointer",
|
|
16285
|
-
onClick: () => {
|
|
16286
|
-
setFileInfo(null);
|
|
16287
|
-
handleRemoveFile(field.onChange);
|
|
16288
|
-
},
|
|
16289
|
-
children: /* @__PURE__ */ jsx75(DeleteIconDanger, {})
|
|
16290
|
-
}
|
|
16291
|
-
)
|
|
16292
|
-
]
|
|
16293
|
-
}
|
|
16294
|
-
)
|
|
16295
|
-
]
|
|
16296
|
-
}
|
|
16297
|
-
)
|
|
16298
|
-
}
|
|
16299
|
-
) : /* @__PURE__ */ jsxs49(
|
|
16300
|
-
"label",
|
|
16301
|
-
{
|
|
16302
|
-
htmlFor: inputId,
|
|
16303
|
-
className: `relative p-2 flex cursor-pointer items-center justify-center rounded-[12px] transition-colors duration-300 ${readonly && "pointer-events-none"} ${onlyImage ? "h-32 w-32 border border-gray-300 hover:border-primary bg-white" : "w-fit h-fit "}`,
|
|
16224
|
+
className: `flex items-center gap-2 bg-[#FAFAFA] relative ${onlyImage ? `h-32 w-32 rounded-[12px] ${value ? "" : "p-2"}` : `max-h-fit max-w-fit rounded-[8px] border ${!value ? "hover:border-[var(--color-primary)]" : ""} ${isEditTable && value || isForm && !isEditTable && !value ? "p-2" : ""} `} ${error2 && isForm && isEditTable && "widget-error"} `,
|
|
16304
16225
|
children: [
|
|
16305
|
-
|
|
16306
|
-
|
|
16307
|
-
{
|
|
16308
|
-
id: inputId,
|
|
16309
|
-
type: "file",
|
|
16310
|
-
readOnly: readonly,
|
|
16311
|
-
placeholder,
|
|
16312
|
-
required: !invisible && required,
|
|
16313
|
-
onChange: (e3) => handleChange(e3, field.onChange),
|
|
16314
|
-
className: "hidden",
|
|
16315
|
-
accept: ".jpeg,.jpg,.png,.pdf,.json,.mp4,.zip,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
|
|
16316
|
-
}
|
|
16317
|
-
),
|
|
16318
|
-
onlyImage && /* @__PURE__ */ jsx75(
|
|
16319
|
-
"img",
|
|
16320
|
-
{
|
|
16321
|
-
src: placeHolderImage,
|
|
16322
|
-
alt: "",
|
|
16323
|
-
className: "z-0 relative"
|
|
16324
|
-
}
|
|
16325
|
-
),
|
|
16326
|
-
/* @__PURE__ */ jsx75(
|
|
16226
|
+
renderPreview(),
|
|
16227
|
+
value ? /* @__PURE__ */ jsxs49(
|
|
16327
16228
|
"div",
|
|
16328
16229
|
{
|
|
16329
|
-
className: "
|
|
16230
|
+
className: "widget",
|
|
16330
16231
|
style: {
|
|
16232
|
+
display: "flex",
|
|
16233
|
+
alignItems: "center",
|
|
16234
|
+
borderRadius: "8px",
|
|
16235
|
+
padding: "4px",
|
|
16236
|
+
gap: "8px",
|
|
16237
|
+
backgroundColor: onlyImage ? "rgba(0,0,0,0.03)" : "white",
|
|
16238
|
+
boxShadow: "0 2px 4px 0 rgba(27, 28, 29, 0.04)",
|
|
16331
16239
|
position: onlyImage ? "absolute" : "relative",
|
|
16332
|
-
bottom: onlyImage ? "
|
|
16333
|
-
|
|
16334
|
-
boxShadow: "0 1px 2px 0 rgba(228, 229, 231, 0.24)",
|
|
16335
|
-
width: "2rem",
|
|
16336
|
-
height: "2rem",
|
|
16337
|
-
border: onlyImage ? "1px solid transparent" : "1px solid var(--color-primary)",
|
|
16338
|
-
borderRadius: onlyImage ? "100%" : "8px"
|
|
16240
|
+
bottom: onlyImage ? "0" : "none",
|
|
16241
|
+
right: onlyImage ? "0" : "none"
|
|
16339
16242
|
},
|
|
16340
|
-
children:
|
|
16341
|
-
|
|
16342
|
-
|
|
16343
|
-
|
|
16344
|
-
|
|
16345
|
-
|
|
16346
|
-
|
|
16347
|
-
|
|
16348
|
-
|
|
16349
|
-
|
|
16350
|
-
|
|
16351
|
-
|
|
16352
|
-
|
|
16353
|
-
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
|
|
16357
|
-
|
|
16358
|
-
|
|
16243
|
+
children: [
|
|
16244
|
+
/* @__PURE__ */ jsx75(
|
|
16245
|
+
"span",
|
|
16246
|
+
{
|
|
16247
|
+
onClick: () => onDownload && onDownload(url || "", url?.split("/").pop()),
|
|
16248
|
+
className: "cursor-pointer",
|
|
16249
|
+
children: /* @__PURE__ */ jsx75(DownloadIcon, {})
|
|
16250
|
+
}
|
|
16251
|
+
),
|
|
16252
|
+
!readonly && /* @__PURE__ */ jsx75("span", { onClick: handleDelete, className: "cursor-pointer", children: /* @__PURE__ */ jsx75(DeleteIconDanger, {}) })
|
|
16253
|
+
]
|
|
16254
|
+
}
|
|
16255
|
+
) : /* @__PURE__ */ jsxs49(
|
|
16256
|
+
"label",
|
|
16257
|
+
{
|
|
16258
|
+
style: {
|
|
16259
|
+
maxWidth: "180px",
|
|
16260
|
+
maxHeight: "180px"
|
|
16261
|
+
},
|
|
16262
|
+
className: `relative flex cursor-pointer items-center justify-center rounded-[12px] transition-colors duration-300 ${readonly && "pointer-events-none"} ${onlyImage ? "border border-gray-300 hover:border-primary bg-white" : "w-fit h-fit "}`,
|
|
16263
|
+
children: [
|
|
16264
|
+
/* @__PURE__ */ jsx75(
|
|
16265
|
+
"input",
|
|
16266
|
+
{
|
|
16267
|
+
type: "file",
|
|
16268
|
+
readOnly: readonly,
|
|
16269
|
+
placeholder,
|
|
16270
|
+
required: !invisible && required,
|
|
16271
|
+
onChange: handleUpload,
|
|
16272
|
+
className: "hidden",
|
|
16273
|
+
accept: acceptType
|
|
16274
|
+
}
|
|
16275
|
+
),
|
|
16276
|
+
onlyImage && /* @__PURE__ */ jsx75(
|
|
16277
|
+
"img",
|
|
16278
|
+
{
|
|
16279
|
+
src: placeHolderImage,
|
|
16280
|
+
alt: "",
|
|
16281
|
+
className: "z-0 relative"
|
|
16282
|
+
}
|
|
16283
|
+
),
|
|
16284
|
+
/* @__PURE__ */ jsx75(
|
|
16285
|
+
"div",
|
|
16286
|
+
{
|
|
16287
|
+
className: " size-8 bg-white rounded-lg flex justify-center items-center z-20",
|
|
16288
|
+
style: {
|
|
16289
|
+
position: onlyImage ? "absolute" : "relative",
|
|
16290
|
+
bottom: onlyImage ? "-8px" : "auto",
|
|
16291
|
+
left: onlyImage ? "-8px" : "auto",
|
|
16292
|
+
boxShadow: "0 1px 2px 0 rgba(228, 229, 231, 0.24)",
|
|
16293
|
+
width: "2rem",
|
|
16294
|
+
height: "2rem",
|
|
16295
|
+
borderRadius: onlyImage ? "100%" : "8px"
|
|
16296
|
+
},
|
|
16297
|
+
children: /* @__PURE__ */ jsx75(
|
|
16298
|
+
"svg",
|
|
16299
|
+
{
|
|
16300
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16301
|
+
width: "14",
|
|
16302
|
+
height: "14",
|
|
16303
|
+
viewBox: "0 0 14 14",
|
|
16304
|
+
fill: "none",
|
|
16305
|
+
children: /* @__PURE__ */ jsx75(
|
|
16306
|
+
"path",
|
|
16307
|
+
{
|
|
16308
|
+
"fill-rule": "evenodd",
|
|
16309
|
+
"clip-rule": "evenodd",
|
|
16310
|
+
d: "M13.1868 0.813097C12.7961 0.422532 12.2663 0.203125 11.7139 0.203125C11.1615 0.203125 10.6317 0.422532 10.241 0.813097L9.35765 1.69726L12.3035 4.64393L12.0085 4.9381L11.7143 5.2331L8.76765 2.28643L1.40182 9.65226C1.34395 9.7104 1.30452 9.78432 1.28848 9.86476L0.698483 12.8114C0.685057 12.8787 0.688459 12.9483 0.708387 13.014C0.728316 13.0796 0.764154 13.1394 0.812719 13.1878C0.861283 13.2363 0.92107 13.2721 0.986769 13.2919C1.05247 13.3117 1.12204 13.315 1.18932 13.3014L4.13515 12.7123C4.21599 12.6961 4.29023 12.6564 4.34848 12.5981L13.1868 3.75976C13.3803 3.5663 13.5338 3.33661 13.6386 3.08381C13.7433 2.83102 13.7972 2.56006 13.7972 2.28643C13.7972 2.0128 13.7433 1.74184 13.6386 1.48905C13.5338 1.23625 13.3803 1.00656 13.1868 0.813097Z",
|
|
16311
|
+
fill: "black"
|
|
16312
|
+
}
|
|
16313
|
+
)
|
|
16314
|
+
}
|
|
16315
|
+
)
|
|
16316
|
+
}
|
|
16317
|
+
)
|
|
16318
|
+
]
|
|
16359
16319
|
}
|
|
16360
16320
|
)
|
|
16361
16321
|
]
|
|
16362
16322
|
}
|
|
16363
|
-
)
|
|
16323
|
+
) })
|
|
16364
16324
|
}
|
|
16365
16325
|
),
|
|
16366
|
-
error2 && !isEditTable && /* @__PURE__ */ jsx75(
|
|
16326
|
+
error2 && !isEditTable && /* @__PURE__ */ jsx75(
|
|
16327
|
+
"p",
|
|
16328
|
+
{
|
|
16329
|
+
style: {
|
|
16330
|
+
maxWidth: "180px"
|
|
16331
|
+
},
|
|
16332
|
+
className: "text-[#de4747] text-sm mt-1",
|
|
16333
|
+
children: error2.message
|
|
16334
|
+
}
|
|
16335
|
+
)
|
|
16367
16336
|
] });
|
|
16368
16337
|
}
|
|
16369
16338
|
}
|
|
@@ -16516,7 +16485,7 @@ var ButtonField = (props) => {
|
|
|
16516
16485
|
};
|
|
16517
16486
|
|
|
16518
16487
|
// src/widgets/basic/char-field/char.tsx
|
|
16519
|
-
import { useEffect as
|
|
16488
|
+
import { useEffect as useEffect10, useMemo as useMemo4 } from "react";
|
|
16520
16489
|
import { Fragment as Fragment18, jsx as jsx78, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
16521
16490
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
16522
16491
|
var CharField = (props) => {
|
|
@@ -16577,12 +16546,12 @@ var CharField = (props) => {
|
|
|
16577
16546
|
fieldState: { error: error2, isDirty }
|
|
16578
16547
|
}) => {
|
|
16579
16548
|
const { setError, clearErrors } = methods;
|
|
16580
|
-
|
|
16549
|
+
useEffect10(() => {
|
|
16581
16550
|
if (value2) {
|
|
16582
16551
|
clearErrors(name);
|
|
16583
16552
|
}
|
|
16584
16553
|
}, [value2, clearErrors, name]);
|
|
16585
|
-
|
|
16554
|
+
useEffect10(() => {
|
|
16586
16555
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
16587
16556
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
16588
16557
|
const currentValue = methods?.getValues(name);
|
|
@@ -16671,7 +16640,7 @@ var CharField = (props) => {
|
|
|
16671
16640
|
};
|
|
16672
16641
|
|
|
16673
16642
|
// src/widgets/basic/char-field/secure-field.tsx
|
|
16674
|
-
import { useEffect as
|
|
16643
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useState as useState11 } from "react";
|
|
16675
16644
|
|
|
16676
16645
|
// src/icons/eye-hidden-icon.tsx
|
|
16677
16646
|
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
@@ -16772,10 +16741,10 @@ var SecureField = (props) => {
|
|
|
16772
16741
|
const shouldMask = isSensitive(widget) && !showPlain;
|
|
16773
16742
|
const isCappedToken = widget === "access_token" || widget === "refresh_token";
|
|
16774
16743
|
const maskedDisplay = isCappedToken && shouldMask ? "\u2022".repeat(Math.min(realValue.length, 20)) : "";
|
|
16775
|
-
|
|
16744
|
+
useEffect11(() => {
|
|
16776
16745
|
if (canToggle) setShowPlain(false);
|
|
16777
16746
|
}, [canToggle]);
|
|
16778
|
-
|
|
16747
|
+
useEffect11(() => {
|
|
16779
16748
|
if (value2) clearErrors(name);
|
|
16780
16749
|
}, [value2, clearErrors, name]);
|
|
16781
16750
|
return /* @__PURE__ */ jsxs52("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
@@ -16936,21 +16905,21 @@ var CheckboxField = (props) => {
|
|
|
16936
16905
|
};
|
|
16937
16906
|
|
|
16938
16907
|
// src/widgets/basic/color-field/color-wrapper.tsx
|
|
16939
|
-
import { useEffect as
|
|
16908
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState12 } from "react";
|
|
16940
16909
|
import { Fragment as Fragment19, jsx as jsx82, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
16941
16910
|
var ColorWrapper = (props) => {
|
|
16942
16911
|
const { colors: colors2, defaultColor, savePickColor } = props;
|
|
16943
16912
|
const { t: t3 } = useI18n();
|
|
16944
16913
|
const [selectedColor, setSelectedColor] = useState12(colors2[defaultColor]);
|
|
16945
16914
|
const [showFullColors, setIsShowFullColor] = useState12(false);
|
|
16946
|
-
const pickColorsRef =
|
|
16947
|
-
|
|
16915
|
+
const pickColorsRef = useRef7(null);
|
|
16916
|
+
useEffect12(() => {
|
|
16948
16917
|
setSelectedColor(colors2[defaultColor]);
|
|
16949
16918
|
}, [defaultColor]);
|
|
16950
16919
|
const handleShowFullColors = () => {
|
|
16951
16920
|
setIsShowFullColor(!showFullColors);
|
|
16952
16921
|
};
|
|
16953
|
-
|
|
16922
|
+
useEffect12(() => {
|
|
16954
16923
|
const handleClickOutside = (event) => {
|
|
16955
16924
|
if (pickColorsRef.current && !pickColorsRef.current.contains(event.target)) {
|
|
16956
16925
|
setIsShowFullColor(false);
|
|
@@ -17041,7 +17010,7 @@ var ColorField = (props) => {
|
|
|
17041
17010
|
};
|
|
17042
17011
|
|
|
17043
17012
|
// src/widgets/basic/copy-link-buttton/copy-link.tsx
|
|
17044
|
-
import { useEffect as
|
|
17013
|
+
import { useEffect as useEffect13 } from "react";
|
|
17045
17014
|
import { jsx as jsx84, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
17046
17015
|
var CopyLinkButtonField = (props) => {
|
|
17047
17016
|
const {
|
|
@@ -17078,7 +17047,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17078
17047
|
fieldState: { error: error2 }
|
|
17079
17048
|
}) => {
|
|
17080
17049
|
const { setError, clearErrors } = methods;
|
|
17081
|
-
|
|
17050
|
+
useEffect13(() => {
|
|
17082
17051
|
if (value) {
|
|
17083
17052
|
clearErrors(name);
|
|
17084
17053
|
}
|
|
@@ -17151,10 +17120,10 @@ var CopyLinkButtonField = (props) => {
|
|
|
17151
17120
|
};
|
|
17152
17121
|
|
|
17153
17122
|
// src/widgets/basic/date-field/date.tsx
|
|
17154
|
-
import { forwardRef as forwardRef6, useEffect as
|
|
17123
|
+
import { forwardRef as forwardRef6, useEffect as useEffect17 } from "react";
|
|
17155
17124
|
|
|
17156
17125
|
// node_modules/react-datepicker/dist/index.es.js
|
|
17157
|
-
import React10, { useRef as
|
|
17126
|
+
import React10, { useRef as useRef11, useCallback as useCallback5, useEffect as useEffect15, cloneElement as cloneElement3, Component, createRef, createElement as createElement5 } from "react";
|
|
17158
17127
|
|
|
17159
17128
|
// node_modules/date-fns/constants.js
|
|
17160
17129
|
var daysInYear = 365.2425;
|
|
@@ -21724,8 +21693,8 @@ var CalendarContainer = function(_a2) {
|
|
|
21724
21693
|
return React10.createElement("div", { className, role: "dialog", "aria-label": ariaLabel, "aria-modal": "true" }, children);
|
|
21725
21694
|
};
|
|
21726
21695
|
var useDetectClickOutside = function(onClickOutside, ignoreClass) {
|
|
21727
|
-
var ref =
|
|
21728
|
-
var onClickOutsideRef =
|
|
21696
|
+
var ref = useRef11(null);
|
|
21697
|
+
var onClickOutsideRef = useRef11(onClickOutside);
|
|
21729
21698
|
onClickOutsideRef.current = onClickOutside;
|
|
21730
21699
|
var handleClickOutside = useCallback5(function(event) {
|
|
21731
21700
|
var _a2;
|
|
@@ -21738,7 +21707,7 @@ var useDetectClickOutside = function(onClickOutside, ignoreClass) {
|
|
|
21738
21707
|
}
|
|
21739
21708
|
}
|
|
21740
21709
|
}, [ignoreClass]);
|
|
21741
|
-
|
|
21710
|
+
useEffect15(function() {
|
|
21742
21711
|
document.addEventListener("mousedown", handleClickOutside);
|
|
21743
21712
|
return function() {
|
|
21744
21713
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
@@ -24979,7 +24948,7 @@ function withFloating(Component3) {
|
|
|
24979
24948
|
var WithFloating = function(props) {
|
|
24980
24949
|
var _a2;
|
|
24981
24950
|
var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
|
|
24982
|
-
var arrowRef =
|
|
24951
|
+
var arrowRef = useRef11(null);
|
|
24983
24952
|
var floatingProps = useFloating2(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
|
|
24984
24953
|
flip3({ padding: 15 }),
|
|
24985
24954
|
offset3(10),
|
|
@@ -26158,7 +26127,7 @@ function _toConsumableArray(r4) {
|
|
|
26158
26127
|
|
|
26159
26128
|
// node_modules/react-select/dist/Select-ef7c0426.esm.js
|
|
26160
26129
|
import * as React14 from "react";
|
|
26161
|
-
import { useMemo as useMemo9, Fragment as Fragment23, useRef as
|
|
26130
|
+
import { useMemo as useMemo9, Fragment as Fragment23, useRef as useRef14, useCallback as useCallback8, useEffect as useEffect16, Component as Component2 } from "react";
|
|
26162
26131
|
|
|
26163
26132
|
// node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
|
|
26164
26133
|
import * as React12 from "react";
|
|
@@ -27490,7 +27459,7 @@ function _taggedTemplateLiteral(e3, t3) {
|
|
|
27490
27459
|
}
|
|
27491
27460
|
|
|
27492
27461
|
// node_modules/react-select/dist/index-641ee5b8.esm.js
|
|
27493
|
-
import { useContext as useContext9, useRef as
|
|
27462
|
+
import { useContext as useContext9, useRef as useRef13, useState as useState16, useMemo as useMemo8, useCallback as useCallback7, createContext as createContext5 } from "react";
|
|
27494
27463
|
import { createPortal as createPortal4 } from "react-dom";
|
|
27495
27464
|
|
|
27496
27465
|
// node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
|
|
@@ -27836,7 +27805,7 @@ var PortalPlacementContext = /* @__PURE__ */ createContext5(null);
|
|
|
27836
27805
|
var MenuPlacer = function MenuPlacer2(props) {
|
|
27837
27806
|
var children = props.children, minMenuHeight = props.minMenuHeight, maxMenuHeight = props.maxMenuHeight, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition, menuShouldScrollIntoView = props.menuShouldScrollIntoView, theme = props.theme;
|
|
27838
27807
|
var _ref3 = useContext9(PortalPlacementContext) || {}, setPortalPlacement = _ref3.setPortalPlacement;
|
|
27839
|
-
var ref =
|
|
27808
|
+
var ref = useRef13(null);
|
|
27840
27809
|
var _useState = useState16(maxMenuHeight), _useState2 = _slicedToArray(_useState, 2), maxHeight = _useState2[0], setMaxHeight = _useState2[1];
|
|
27841
27810
|
var _useState3 = useState16(null), _useState4 = _slicedToArray(_useState3, 2), placement = _useState4[0], setPlacement = _useState4[1];
|
|
27842
27811
|
var controlHeight2 = theme.spacing.controlHeight;
|
|
@@ -27940,8 +27909,8 @@ var menuPortalCSS = function menuPortalCSS2(_ref8) {
|
|
|
27940
27909
|
};
|
|
27941
27910
|
var MenuPortal = function MenuPortal2(props) {
|
|
27942
27911
|
var appendTo = props.appendTo, children = props.children, controlElement = props.controlElement, innerProps = props.innerProps, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition;
|
|
27943
|
-
var menuPortalRef =
|
|
27944
|
-
var cleanupRef =
|
|
27912
|
+
var menuPortalRef = useRef13(null);
|
|
27913
|
+
var cleanupRef = useRef13(null);
|
|
27945
27914
|
var _useState5 = useState16(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
|
|
27946
27915
|
var portalPlacementContext = useMemo8(function() {
|
|
27947
27916
|
return {
|
|
@@ -29079,10 +29048,10 @@ var cancelScroll = function cancelScroll2(event) {
|
|
|
29079
29048
|
};
|
|
29080
29049
|
function useScrollCapture(_ref3) {
|
|
29081
29050
|
var isEnabled = _ref3.isEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave;
|
|
29082
|
-
var isBottom =
|
|
29083
|
-
var isTop =
|
|
29084
|
-
var touchStart =
|
|
29085
|
-
var scrollTarget =
|
|
29051
|
+
var isBottom = useRef14(false);
|
|
29052
|
+
var isTop = useRef14(false);
|
|
29053
|
+
var touchStart = useRef14(0);
|
|
29054
|
+
var scrollTarget = useRef14(null);
|
|
29086
29055
|
var handleEventDelta = useCallback8(function(event, delta) {
|
|
29087
29056
|
if (scrollTarget.current === null) return;
|
|
29088
29057
|
var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight;
|
|
@@ -29142,7 +29111,7 @@ function useScrollCapture(_ref3) {
|
|
|
29142
29111
|
el.removeEventListener("touchstart", onTouchStart, false);
|
|
29143
29112
|
el.removeEventListener("touchmove", onTouchMove, false);
|
|
29144
29113
|
}, [onTouchMove, onTouchStart, onWheel]);
|
|
29145
|
-
|
|
29114
|
+
useEffect16(function() {
|
|
29146
29115
|
if (!isEnabled) return;
|
|
29147
29116
|
var element = scrollTarget.current;
|
|
29148
29117
|
startListening(element);
|
|
@@ -29189,8 +29158,8 @@ var listenerOptions = {
|
|
|
29189
29158
|
};
|
|
29190
29159
|
function useScrollLock(_ref3) {
|
|
29191
29160
|
var isEnabled = _ref3.isEnabled, _ref$accountForScroll = _ref3.accountForScrollbars, accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
|
|
29192
|
-
var originalStyles =
|
|
29193
|
-
var scrollTarget =
|
|
29161
|
+
var originalStyles = useRef14({});
|
|
29162
|
+
var scrollTarget = useRef14(null);
|
|
29194
29163
|
var addScrollLock = useCallback8(function(touchScrollTarget) {
|
|
29195
29164
|
if (!canUseDOM) return;
|
|
29196
29165
|
var target = document.body;
|
|
@@ -29245,7 +29214,7 @@ function useScrollLock(_ref3) {
|
|
|
29245
29214
|
}
|
|
29246
29215
|
}
|
|
29247
29216
|
}, [accountForScrollbars]);
|
|
29248
|
-
|
|
29217
|
+
useEffect16(function() {
|
|
29249
29218
|
if (!isEnabled) return;
|
|
29250
29219
|
var element = scrollTarget.current;
|
|
29251
29220
|
addScrollLock(element);
|
|
@@ -30964,7 +30933,7 @@ var DateField = (props) => {
|
|
|
30964
30933
|
},
|
|
30965
30934
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
30966
30935
|
const { setError, clearErrors } = methods;
|
|
30967
|
-
|
|
30936
|
+
useEffect17(() => {
|
|
30968
30937
|
if (value) {
|
|
30969
30938
|
clearErrors(name);
|
|
30970
30939
|
}
|
|
@@ -31319,7 +31288,7 @@ var FeeField = (props) => {
|
|
|
31319
31288
|
};
|
|
31320
31289
|
|
|
31321
31290
|
// src/widgets/basic/file-upload-field/file-upload.tsx
|
|
31322
|
-
import { useEffect as
|
|
31291
|
+
import { useEffect as useEffect18, useRef as useRef15, useState as useState18 } from "react";
|
|
31323
31292
|
import { jsx as jsx93, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
31324
31293
|
var RenderFile = ({
|
|
31325
31294
|
file,
|
|
@@ -31384,10 +31353,10 @@ var FileUploadField = (props) => {
|
|
|
31384
31353
|
downloadFunction
|
|
31385
31354
|
} = props;
|
|
31386
31355
|
const { t: t3 } = useI18n();
|
|
31387
|
-
const fileInputRef =
|
|
31356
|
+
const fileInputRef = useRef15(null);
|
|
31388
31357
|
const [selectedFiles, setSelectedFiles] = useState18([]);
|
|
31389
31358
|
const [uploadError, setUploadError] = useState18();
|
|
31390
|
-
|
|
31359
|
+
useEffect18(() => {
|
|
31391
31360
|
if (selectedFiles?.length === 0 && value) {
|
|
31392
31361
|
setSelectedFiles([
|
|
31393
31362
|
{
|
|
@@ -31405,7 +31374,7 @@ var FileUploadField = (props) => {
|
|
|
31405
31374
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
31406
31375
|
},
|
|
31407
31376
|
render: ({ field: { onChange: onChange2 }, fieldState: { error: error2 } }) => {
|
|
31408
|
-
|
|
31377
|
+
useEffect18(() => {
|
|
31409
31378
|
let data = widget === "many2many_binary" ? selectedFiles : selectedFiles?.[0]?.data;
|
|
31410
31379
|
if (widget !== "many2many_binary" && data && isBase64File(data)) {
|
|
31411
31380
|
data = data.split(",")[1];
|
|
@@ -31461,7 +31430,7 @@ var FileUploadField = (props) => {
|
|
|
31461
31430
|
};
|
|
31462
31431
|
|
|
31463
31432
|
// src/widgets/basic/float-field/float.tsx
|
|
31464
|
-
import { useEffect as
|
|
31433
|
+
import { useEffect as useEffect19, useRef as useRef16, useState as useState19 } from "react";
|
|
31465
31434
|
import { Fragment as Fragment26, jsx as jsx94, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
31466
31435
|
var FloatField = (props) => {
|
|
31467
31436
|
const {
|
|
@@ -31497,9 +31466,9 @@ var FloatField = (props) => {
|
|
|
31497
31466
|
const [inputValue, setInputValue] = useState19(
|
|
31498
31467
|
value !== void 0 && value !== null ? formatFloatNumber(value) : ""
|
|
31499
31468
|
);
|
|
31500
|
-
const isDirtyRef =
|
|
31501
|
-
const lastCommittedValueRef =
|
|
31502
|
-
|
|
31469
|
+
const isDirtyRef = useRef16(false);
|
|
31470
|
+
const lastCommittedValueRef = useRef16(null);
|
|
31471
|
+
useEffect19(() => {
|
|
31503
31472
|
if (isDirtyRef.current) return;
|
|
31504
31473
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
31505
31474
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
@@ -31725,7 +31694,7 @@ var FloatTimeField = (props) => {
|
|
|
31725
31694
|
};
|
|
31726
31695
|
|
|
31727
31696
|
// src/widgets/basic/html-field/html.tsx
|
|
31728
|
-
import { useEffect as
|
|
31697
|
+
import { useEffect as useEffect20, useRef as useRef17 } from "react";
|
|
31729
31698
|
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
31730
31699
|
var HtmlField = (props) => {
|
|
31731
31700
|
const {
|
|
@@ -31739,7 +31708,7 @@ var HtmlField = (props) => {
|
|
|
31739
31708
|
isEditTable,
|
|
31740
31709
|
baseClassName
|
|
31741
31710
|
} = props;
|
|
31742
|
-
const divRef =
|
|
31711
|
+
const divRef = useRef17(null);
|
|
31743
31712
|
if (!isForm && !isEditTable) {
|
|
31744
31713
|
return /* @__PURE__ */ jsx96("div", { dangerouslySetInnerHTML: { __html: value || defaultValue || "" } });
|
|
31745
31714
|
}
|
|
@@ -31750,7 +31719,7 @@ var HtmlField = (props) => {
|
|
|
31750
31719
|
control: methods?.control,
|
|
31751
31720
|
defaultValue,
|
|
31752
31721
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
31753
|
-
|
|
31722
|
+
useEffect20(() => {
|
|
31754
31723
|
if (divRef.current && divRef.current.innerHTML !== value2) {
|
|
31755
31724
|
divRef.current.innerHTML = value2 || "";
|
|
31756
31725
|
}
|
|
@@ -31788,7 +31757,7 @@ var ImageField = (props) => {
|
|
|
31788
31757
|
};
|
|
31789
31758
|
|
|
31790
31759
|
// src/widgets/basic/many2many-tags-field/many2many-tags.tsx
|
|
31791
|
-
import React17, { useEffect as
|
|
31760
|
+
import React17, { useEffect as useEffect21, useMemo as useMemo11 } from "react";
|
|
31792
31761
|
|
|
31793
31762
|
// src/widgets/basic/information-field/information.tsx
|
|
31794
31763
|
import { Fragment as Fragment28, jsx as jsx98, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
@@ -31932,7 +31901,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31932
31901
|
},
|
|
31933
31902
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
31934
31903
|
const { clearErrors } = methods;
|
|
31935
|
-
|
|
31904
|
+
useEffect21(() => {
|
|
31936
31905
|
if (field.value) {
|
|
31937
31906
|
clearErrors(name);
|
|
31938
31907
|
}
|
|
@@ -32083,7 +32052,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32083
32052
|
};
|
|
32084
32053
|
|
|
32085
32054
|
// src/widgets/basic/monetary-field/monetary.tsx
|
|
32086
|
-
import { useEffect as
|
|
32055
|
+
import { useEffect as useEffect22 } from "react";
|
|
32087
32056
|
import { Fragment as Fragment29, jsx as jsx100, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
32088
32057
|
var MonetaryField = (props) => {
|
|
32089
32058
|
const { t: t3 } = useI18n();
|
|
@@ -32133,7 +32102,7 @@ var MonetaryField = (props) => {
|
|
|
32133
32102
|
fieldState: { error: error2 }
|
|
32134
32103
|
}) => {
|
|
32135
32104
|
const { setError, clearErrors } = methods;
|
|
32136
|
-
|
|
32105
|
+
useEffect22(() => {
|
|
32137
32106
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32138
32107
|
clearErrors(name);
|
|
32139
32108
|
}
|
|
@@ -32189,7 +32158,7 @@ var PaidBadgedField = () => {
|
|
|
32189
32158
|
};
|
|
32190
32159
|
|
|
32191
32160
|
// src/widgets/basic/priority-field/rating-star.tsx
|
|
32192
|
-
import React18, { useEffect as
|
|
32161
|
+
import React18, { useEffect as useEffect23, useState as useState21 } from "react";
|
|
32193
32162
|
import { jsx as jsx102, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
32194
32163
|
var RatingStarField = (props) => {
|
|
32195
32164
|
const {
|
|
@@ -32201,7 +32170,7 @@ var RatingStarField = (props) => {
|
|
|
32201
32170
|
} = props;
|
|
32202
32171
|
const [rating, setRating] = useState21(defaultValue);
|
|
32203
32172
|
const [hover, setHover] = useState21(0);
|
|
32204
|
-
|
|
32173
|
+
useEffect23(() => {
|
|
32205
32174
|
setRating(defaultValue);
|
|
32206
32175
|
}, [defaultValue]);
|
|
32207
32176
|
const handleClick = (value) => {
|
|
@@ -32316,7 +32285,7 @@ var PriorityField = (props) => {
|
|
|
32316
32285
|
};
|
|
32317
32286
|
|
|
32318
32287
|
// src/widgets/basic/radio-group-field/radio-group.tsx
|
|
32319
|
-
import { useEffect as
|
|
32288
|
+
import { useEffect as useEffect24 } from "react";
|
|
32320
32289
|
import { jsx as jsx104, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
32321
32290
|
var RadioGroupField = (props) => {
|
|
32322
32291
|
const {
|
|
@@ -32330,7 +32299,7 @@ var RadioGroupField = (props) => {
|
|
|
32330
32299
|
onChange: onChange2,
|
|
32331
32300
|
setValue
|
|
32332
32301
|
} = props;
|
|
32333
|
-
|
|
32302
|
+
useEffect24(() => {
|
|
32334
32303
|
if (selection?.length > 0) {
|
|
32335
32304
|
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
32336
32305
|
}
|
|
@@ -32636,7 +32605,7 @@ var ToggleButtonField = (props) => {
|
|
|
32636
32605
|
};
|
|
32637
32606
|
|
|
32638
32607
|
// src/widgets/basic/integer-field/integer.tsx
|
|
32639
|
-
import { useEffect as
|
|
32608
|
+
import { useEffect as useEffect25, useRef as useRef18, useState as useState22 } from "react";
|
|
32640
32609
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
32641
32610
|
var IntegerField = (props) => {
|
|
32642
32611
|
const {
|
|
@@ -32673,13 +32642,13 @@ var IntegerField = (props) => {
|
|
|
32673
32642
|
fieldState: { error: error2 }
|
|
32674
32643
|
}) => {
|
|
32675
32644
|
const { setError, clearErrors } = methods;
|
|
32676
|
-
const isDirtyRef =
|
|
32677
|
-
const inputRef =
|
|
32678
|
-
const lastCommittedValueRef =
|
|
32645
|
+
const isDirtyRef = useRef18(false);
|
|
32646
|
+
const inputRef = useRef18(null);
|
|
32647
|
+
const lastCommittedValueRef = useRef18(null);
|
|
32679
32648
|
const [inputValue, setInputValue] = useState22(
|
|
32680
32649
|
value2 !== void 0 && value2 !== null ? String(value2) : ""
|
|
32681
32650
|
);
|
|
32682
|
-
|
|
32651
|
+
useEffect25(() => {
|
|
32683
32652
|
if (value2 !== void 0 && value2 !== null) {
|
|
32684
32653
|
setInputValue(String(value2));
|
|
32685
32654
|
clearErrors(name);
|
|
@@ -32835,7 +32804,7 @@ var StatusDropdownField = (props) => {
|
|
|
32835
32804
|
|
|
32836
32805
|
// src/widgets/basic/many2many-field/many2many.tsx
|
|
32837
32806
|
import { createPortal as createPortal5 } from "react-dom";
|
|
32838
|
-
import { useEffect as
|
|
32807
|
+
import { useEffect as useEffect26 } from "react";
|
|
32839
32808
|
import { jsx as jsx111, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
32840
32809
|
var Many2ManyField = (props) => {
|
|
32841
32810
|
const { t: t3 } = useI18n();
|
|
@@ -32890,7 +32859,7 @@ var Many2ManyField = (props) => {
|
|
|
32890
32859
|
setGroupBy,
|
|
32891
32860
|
clearSearch
|
|
32892
32861
|
} = searchController;
|
|
32893
|
-
|
|
32862
|
+
useEffect26(() => {
|
|
32894
32863
|
const groupItems = Array.isArray(selectedTags) ? selectedTags.filter((item) => item.type === "group_by") : [];
|
|
32895
32864
|
if (groupItems?.length > 0) {
|
|
32896
32865
|
typeof setPageLimit === "function" && setPageLimit(80);
|
|
@@ -33045,7 +33014,7 @@ var Many2ManyField = (props) => {
|
|
|
33045
33014
|
};
|
|
33046
33015
|
|
|
33047
33016
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
33048
|
-
import React19, { useEffect as
|
|
33017
|
+
import React19, { useEffect as useEffect27, useState as useState23 } from "react";
|
|
33049
33018
|
import { Fragment as Fragment32, jsx as jsx112, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
33050
33019
|
var CustomMenuList2 = (props) => {
|
|
33051
33020
|
const { t: t3 } = useI18n();
|
|
@@ -33152,7 +33121,7 @@ var Many2OneField = (props) => {
|
|
|
33152
33121
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length ? options2.find(
|
|
33153
33122
|
(o3) => o3?.value === tempSelectedOption.value
|
|
33154
33123
|
) ?? currentValue : currentValue ?? null;
|
|
33155
|
-
|
|
33124
|
+
useEffect27(() => {
|
|
33156
33125
|
if (error2 && selectedOption) {
|
|
33157
33126
|
methods?.clearErrors(name);
|
|
33158
33127
|
}
|