@fctc/sme-widget-ui 2.9.6 → 2.9.7
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 +201 -220
- package/dist/index.mjs +262 -281
- 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 +201 -241
- package/dist/widgets.mjs +262 -302
- 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,136 +16203,124 @@ 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 ? "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
16326
|
error2 && !isEditTable && /* @__PURE__ */ jsx75("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
@@ -16516,7 +16476,7 @@ var ButtonField = (props) => {
|
|
|
16516
16476
|
};
|
|
16517
16477
|
|
|
16518
16478
|
// src/widgets/basic/char-field/char.tsx
|
|
16519
|
-
import { useEffect as
|
|
16479
|
+
import { useEffect as useEffect10, useMemo as useMemo4 } from "react";
|
|
16520
16480
|
import { Fragment as Fragment18, jsx as jsx78, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
16521
16481
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
16522
16482
|
var CharField = (props) => {
|
|
@@ -16577,12 +16537,12 @@ var CharField = (props) => {
|
|
|
16577
16537
|
fieldState: { error: error2, isDirty }
|
|
16578
16538
|
}) => {
|
|
16579
16539
|
const { setError, clearErrors } = methods;
|
|
16580
|
-
|
|
16540
|
+
useEffect10(() => {
|
|
16581
16541
|
if (value2) {
|
|
16582
16542
|
clearErrors(name);
|
|
16583
16543
|
}
|
|
16584
16544
|
}, [value2, clearErrors, name]);
|
|
16585
|
-
|
|
16545
|
+
useEffect10(() => {
|
|
16586
16546
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
16587
16547
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
16588
16548
|
const currentValue = methods?.getValues(name);
|
|
@@ -16671,7 +16631,7 @@ var CharField = (props) => {
|
|
|
16671
16631
|
};
|
|
16672
16632
|
|
|
16673
16633
|
// src/widgets/basic/char-field/secure-field.tsx
|
|
16674
|
-
import { useEffect as
|
|
16634
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useState as useState11 } from "react";
|
|
16675
16635
|
|
|
16676
16636
|
// src/icons/eye-hidden-icon.tsx
|
|
16677
16637
|
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
@@ -16772,10 +16732,10 @@ var SecureField = (props) => {
|
|
|
16772
16732
|
const shouldMask = isSensitive(widget) && !showPlain;
|
|
16773
16733
|
const isCappedToken = widget === "access_token" || widget === "refresh_token";
|
|
16774
16734
|
const maskedDisplay = isCappedToken && shouldMask ? "\u2022".repeat(Math.min(realValue.length, 20)) : "";
|
|
16775
|
-
|
|
16735
|
+
useEffect11(() => {
|
|
16776
16736
|
if (canToggle) setShowPlain(false);
|
|
16777
16737
|
}, [canToggle]);
|
|
16778
|
-
|
|
16738
|
+
useEffect11(() => {
|
|
16779
16739
|
if (value2) clearErrors(name);
|
|
16780
16740
|
}, [value2, clearErrors, name]);
|
|
16781
16741
|
return /* @__PURE__ */ jsxs52("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
@@ -16936,21 +16896,21 @@ var CheckboxField = (props) => {
|
|
|
16936
16896
|
};
|
|
16937
16897
|
|
|
16938
16898
|
// src/widgets/basic/color-field/color-wrapper.tsx
|
|
16939
|
-
import { useEffect as
|
|
16899
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState12 } from "react";
|
|
16940
16900
|
import { Fragment as Fragment19, jsx as jsx82, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
16941
16901
|
var ColorWrapper = (props) => {
|
|
16942
16902
|
const { colors: colors2, defaultColor, savePickColor } = props;
|
|
16943
16903
|
const { t: t3 } = useI18n();
|
|
16944
16904
|
const [selectedColor, setSelectedColor] = useState12(colors2[defaultColor]);
|
|
16945
16905
|
const [showFullColors, setIsShowFullColor] = useState12(false);
|
|
16946
|
-
const pickColorsRef =
|
|
16947
|
-
|
|
16906
|
+
const pickColorsRef = useRef7(null);
|
|
16907
|
+
useEffect12(() => {
|
|
16948
16908
|
setSelectedColor(colors2[defaultColor]);
|
|
16949
16909
|
}, [defaultColor]);
|
|
16950
16910
|
const handleShowFullColors = () => {
|
|
16951
16911
|
setIsShowFullColor(!showFullColors);
|
|
16952
16912
|
};
|
|
16953
|
-
|
|
16913
|
+
useEffect12(() => {
|
|
16954
16914
|
const handleClickOutside = (event) => {
|
|
16955
16915
|
if (pickColorsRef.current && !pickColorsRef.current.contains(event.target)) {
|
|
16956
16916
|
setIsShowFullColor(false);
|
|
@@ -17041,7 +17001,7 @@ var ColorField = (props) => {
|
|
|
17041
17001
|
};
|
|
17042
17002
|
|
|
17043
17003
|
// src/widgets/basic/copy-link-buttton/copy-link.tsx
|
|
17044
|
-
import { useEffect as
|
|
17004
|
+
import { useEffect as useEffect13 } from "react";
|
|
17045
17005
|
import { jsx as jsx84, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
17046
17006
|
var CopyLinkButtonField = (props) => {
|
|
17047
17007
|
const {
|
|
@@ -17078,7 +17038,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17078
17038
|
fieldState: { error: error2 }
|
|
17079
17039
|
}) => {
|
|
17080
17040
|
const { setError, clearErrors } = methods;
|
|
17081
|
-
|
|
17041
|
+
useEffect13(() => {
|
|
17082
17042
|
if (value) {
|
|
17083
17043
|
clearErrors(name);
|
|
17084
17044
|
}
|
|
@@ -17151,10 +17111,10 @@ var CopyLinkButtonField = (props) => {
|
|
|
17151
17111
|
};
|
|
17152
17112
|
|
|
17153
17113
|
// src/widgets/basic/date-field/date.tsx
|
|
17154
|
-
import { forwardRef as forwardRef6, useEffect as
|
|
17114
|
+
import { forwardRef as forwardRef6, useEffect as useEffect17 } from "react";
|
|
17155
17115
|
|
|
17156
17116
|
// node_modules/react-datepicker/dist/index.es.js
|
|
17157
|
-
import React10, { useRef as
|
|
17117
|
+
import React10, { useRef as useRef11, useCallback as useCallback5, useEffect as useEffect15, cloneElement as cloneElement3, Component, createRef, createElement as createElement5 } from "react";
|
|
17158
17118
|
|
|
17159
17119
|
// node_modules/date-fns/constants.js
|
|
17160
17120
|
var daysInYear = 365.2425;
|
|
@@ -21724,8 +21684,8 @@ var CalendarContainer = function(_a2) {
|
|
|
21724
21684
|
return React10.createElement("div", { className, role: "dialog", "aria-label": ariaLabel, "aria-modal": "true" }, children);
|
|
21725
21685
|
};
|
|
21726
21686
|
var useDetectClickOutside = function(onClickOutside, ignoreClass) {
|
|
21727
|
-
var ref =
|
|
21728
|
-
var onClickOutsideRef =
|
|
21687
|
+
var ref = useRef11(null);
|
|
21688
|
+
var onClickOutsideRef = useRef11(onClickOutside);
|
|
21729
21689
|
onClickOutsideRef.current = onClickOutside;
|
|
21730
21690
|
var handleClickOutside = useCallback5(function(event) {
|
|
21731
21691
|
var _a2;
|
|
@@ -21738,7 +21698,7 @@ var useDetectClickOutside = function(onClickOutside, ignoreClass) {
|
|
|
21738
21698
|
}
|
|
21739
21699
|
}
|
|
21740
21700
|
}, [ignoreClass]);
|
|
21741
|
-
|
|
21701
|
+
useEffect15(function() {
|
|
21742
21702
|
document.addEventListener("mousedown", handleClickOutside);
|
|
21743
21703
|
return function() {
|
|
21744
21704
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
@@ -24979,7 +24939,7 @@ function withFloating(Component3) {
|
|
|
24979
24939
|
var WithFloating = function(props) {
|
|
24980
24940
|
var _a2;
|
|
24981
24941
|
var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
|
|
24982
|
-
var arrowRef =
|
|
24942
|
+
var arrowRef = useRef11(null);
|
|
24983
24943
|
var floatingProps = useFloating2(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
|
|
24984
24944
|
flip3({ padding: 15 }),
|
|
24985
24945
|
offset3(10),
|
|
@@ -26158,7 +26118,7 @@ function _toConsumableArray(r4) {
|
|
|
26158
26118
|
|
|
26159
26119
|
// node_modules/react-select/dist/Select-ef7c0426.esm.js
|
|
26160
26120
|
import * as React14 from "react";
|
|
26161
|
-
import { useMemo as useMemo9, Fragment as Fragment23, useRef as
|
|
26121
|
+
import { useMemo as useMemo9, Fragment as Fragment23, useRef as useRef14, useCallback as useCallback8, useEffect as useEffect16, Component as Component2 } from "react";
|
|
26162
26122
|
|
|
26163
26123
|
// node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
|
|
26164
26124
|
import * as React12 from "react";
|
|
@@ -27490,7 +27450,7 @@ function _taggedTemplateLiteral(e3, t3) {
|
|
|
27490
27450
|
}
|
|
27491
27451
|
|
|
27492
27452
|
// node_modules/react-select/dist/index-641ee5b8.esm.js
|
|
27493
|
-
import { useContext as useContext9, useRef as
|
|
27453
|
+
import { useContext as useContext9, useRef as useRef13, useState as useState16, useMemo as useMemo8, useCallback as useCallback7, createContext as createContext5 } from "react";
|
|
27494
27454
|
import { createPortal as createPortal4 } from "react-dom";
|
|
27495
27455
|
|
|
27496
27456
|
// node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
|
|
@@ -27836,7 +27796,7 @@ var PortalPlacementContext = /* @__PURE__ */ createContext5(null);
|
|
|
27836
27796
|
var MenuPlacer = function MenuPlacer2(props) {
|
|
27837
27797
|
var children = props.children, minMenuHeight = props.minMenuHeight, maxMenuHeight = props.maxMenuHeight, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition, menuShouldScrollIntoView = props.menuShouldScrollIntoView, theme = props.theme;
|
|
27838
27798
|
var _ref3 = useContext9(PortalPlacementContext) || {}, setPortalPlacement = _ref3.setPortalPlacement;
|
|
27839
|
-
var ref =
|
|
27799
|
+
var ref = useRef13(null);
|
|
27840
27800
|
var _useState = useState16(maxMenuHeight), _useState2 = _slicedToArray(_useState, 2), maxHeight = _useState2[0], setMaxHeight = _useState2[1];
|
|
27841
27801
|
var _useState3 = useState16(null), _useState4 = _slicedToArray(_useState3, 2), placement = _useState4[0], setPlacement = _useState4[1];
|
|
27842
27802
|
var controlHeight2 = theme.spacing.controlHeight;
|
|
@@ -27940,8 +27900,8 @@ var menuPortalCSS = function menuPortalCSS2(_ref8) {
|
|
|
27940
27900
|
};
|
|
27941
27901
|
var MenuPortal = function MenuPortal2(props) {
|
|
27942
27902
|
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 =
|
|
27903
|
+
var menuPortalRef = useRef13(null);
|
|
27904
|
+
var cleanupRef = useRef13(null);
|
|
27945
27905
|
var _useState5 = useState16(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
|
|
27946
27906
|
var portalPlacementContext = useMemo8(function() {
|
|
27947
27907
|
return {
|
|
@@ -29079,10 +29039,10 @@ var cancelScroll = function cancelScroll2(event) {
|
|
|
29079
29039
|
};
|
|
29080
29040
|
function useScrollCapture(_ref3) {
|
|
29081
29041
|
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 =
|
|
29042
|
+
var isBottom = useRef14(false);
|
|
29043
|
+
var isTop = useRef14(false);
|
|
29044
|
+
var touchStart = useRef14(0);
|
|
29045
|
+
var scrollTarget = useRef14(null);
|
|
29086
29046
|
var handleEventDelta = useCallback8(function(event, delta) {
|
|
29087
29047
|
if (scrollTarget.current === null) return;
|
|
29088
29048
|
var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight;
|
|
@@ -29142,7 +29102,7 @@ function useScrollCapture(_ref3) {
|
|
|
29142
29102
|
el.removeEventListener("touchstart", onTouchStart, false);
|
|
29143
29103
|
el.removeEventListener("touchmove", onTouchMove, false);
|
|
29144
29104
|
}, [onTouchMove, onTouchStart, onWheel]);
|
|
29145
|
-
|
|
29105
|
+
useEffect16(function() {
|
|
29146
29106
|
if (!isEnabled) return;
|
|
29147
29107
|
var element = scrollTarget.current;
|
|
29148
29108
|
startListening(element);
|
|
@@ -29189,8 +29149,8 @@ var listenerOptions = {
|
|
|
29189
29149
|
};
|
|
29190
29150
|
function useScrollLock(_ref3) {
|
|
29191
29151
|
var isEnabled = _ref3.isEnabled, _ref$accountForScroll = _ref3.accountForScrollbars, accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
|
|
29192
|
-
var originalStyles =
|
|
29193
|
-
var scrollTarget =
|
|
29152
|
+
var originalStyles = useRef14({});
|
|
29153
|
+
var scrollTarget = useRef14(null);
|
|
29194
29154
|
var addScrollLock = useCallback8(function(touchScrollTarget) {
|
|
29195
29155
|
if (!canUseDOM) return;
|
|
29196
29156
|
var target = document.body;
|
|
@@ -29245,7 +29205,7 @@ function useScrollLock(_ref3) {
|
|
|
29245
29205
|
}
|
|
29246
29206
|
}
|
|
29247
29207
|
}, [accountForScrollbars]);
|
|
29248
|
-
|
|
29208
|
+
useEffect16(function() {
|
|
29249
29209
|
if (!isEnabled) return;
|
|
29250
29210
|
var element = scrollTarget.current;
|
|
29251
29211
|
addScrollLock(element);
|
|
@@ -30964,7 +30924,7 @@ var DateField = (props) => {
|
|
|
30964
30924
|
},
|
|
30965
30925
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
30966
30926
|
const { setError, clearErrors } = methods;
|
|
30967
|
-
|
|
30927
|
+
useEffect17(() => {
|
|
30968
30928
|
if (value) {
|
|
30969
30929
|
clearErrors(name);
|
|
30970
30930
|
}
|
|
@@ -31319,7 +31279,7 @@ var FeeField = (props) => {
|
|
|
31319
31279
|
};
|
|
31320
31280
|
|
|
31321
31281
|
// src/widgets/basic/file-upload-field/file-upload.tsx
|
|
31322
|
-
import { useEffect as
|
|
31282
|
+
import { useEffect as useEffect18, useRef as useRef15, useState as useState18 } from "react";
|
|
31323
31283
|
import { jsx as jsx93, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
31324
31284
|
var RenderFile = ({
|
|
31325
31285
|
file,
|
|
@@ -31384,10 +31344,10 @@ var FileUploadField = (props) => {
|
|
|
31384
31344
|
downloadFunction
|
|
31385
31345
|
} = props;
|
|
31386
31346
|
const { t: t3 } = useI18n();
|
|
31387
|
-
const fileInputRef =
|
|
31347
|
+
const fileInputRef = useRef15(null);
|
|
31388
31348
|
const [selectedFiles, setSelectedFiles] = useState18([]);
|
|
31389
31349
|
const [uploadError, setUploadError] = useState18();
|
|
31390
|
-
|
|
31350
|
+
useEffect18(() => {
|
|
31391
31351
|
if (selectedFiles?.length === 0 && value) {
|
|
31392
31352
|
setSelectedFiles([
|
|
31393
31353
|
{
|
|
@@ -31405,7 +31365,7 @@ var FileUploadField = (props) => {
|
|
|
31405
31365
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
31406
31366
|
},
|
|
31407
31367
|
render: ({ field: { onChange: onChange2 }, fieldState: { error: error2 } }) => {
|
|
31408
|
-
|
|
31368
|
+
useEffect18(() => {
|
|
31409
31369
|
let data = widget === "many2many_binary" ? selectedFiles : selectedFiles?.[0]?.data;
|
|
31410
31370
|
if (widget !== "many2many_binary" && data && isBase64File(data)) {
|
|
31411
31371
|
data = data.split(",")[1];
|
|
@@ -31461,7 +31421,7 @@ var FileUploadField = (props) => {
|
|
|
31461
31421
|
};
|
|
31462
31422
|
|
|
31463
31423
|
// src/widgets/basic/float-field/float.tsx
|
|
31464
|
-
import { useEffect as
|
|
31424
|
+
import { useEffect as useEffect19, useRef as useRef16, useState as useState19 } from "react";
|
|
31465
31425
|
import { Fragment as Fragment26, jsx as jsx94, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
31466
31426
|
var FloatField = (props) => {
|
|
31467
31427
|
const {
|
|
@@ -31497,9 +31457,9 @@ var FloatField = (props) => {
|
|
|
31497
31457
|
const [inputValue, setInputValue] = useState19(
|
|
31498
31458
|
value !== void 0 && value !== null ? formatFloatNumber(value) : ""
|
|
31499
31459
|
);
|
|
31500
|
-
const isDirtyRef =
|
|
31501
|
-
const lastCommittedValueRef =
|
|
31502
|
-
|
|
31460
|
+
const isDirtyRef = useRef16(false);
|
|
31461
|
+
const lastCommittedValueRef = useRef16(null);
|
|
31462
|
+
useEffect19(() => {
|
|
31503
31463
|
if (isDirtyRef.current) return;
|
|
31504
31464
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
31505
31465
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
@@ -31725,7 +31685,7 @@ var FloatTimeField = (props) => {
|
|
|
31725
31685
|
};
|
|
31726
31686
|
|
|
31727
31687
|
// src/widgets/basic/html-field/html.tsx
|
|
31728
|
-
import { useEffect as
|
|
31688
|
+
import { useEffect as useEffect20, useRef as useRef17 } from "react";
|
|
31729
31689
|
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
31730
31690
|
var HtmlField = (props) => {
|
|
31731
31691
|
const {
|
|
@@ -31739,7 +31699,7 @@ var HtmlField = (props) => {
|
|
|
31739
31699
|
isEditTable,
|
|
31740
31700
|
baseClassName
|
|
31741
31701
|
} = props;
|
|
31742
|
-
const divRef =
|
|
31702
|
+
const divRef = useRef17(null);
|
|
31743
31703
|
if (!isForm && !isEditTable) {
|
|
31744
31704
|
return /* @__PURE__ */ jsx96("div", { dangerouslySetInnerHTML: { __html: value || defaultValue || "" } });
|
|
31745
31705
|
}
|
|
@@ -31750,7 +31710,7 @@ var HtmlField = (props) => {
|
|
|
31750
31710
|
control: methods?.control,
|
|
31751
31711
|
defaultValue,
|
|
31752
31712
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
31753
|
-
|
|
31713
|
+
useEffect20(() => {
|
|
31754
31714
|
if (divRef.current && divRef.current.innerHTML !== value2) {
|
|
31755
31715
|
divRef.current.innerHTML = value2 || "";
|
|
31756
31716
|
}
|
|
@@ -31788,7 +31748,7 @@ var ImageField = (props) => {
|
|
|
31788
31748
|
};
|
|
31789
31749
|
|
|
31790
31750
|
// src/widgets/basic/many2many-tags-field/many2many-tags.tsx
|
|
31791
|
-
import React17, { useEffect as
|
|
31751
|
+
import React17, { useEffect as useEffect21, useMemo as useMemo11 } from "react";
|
|
31792
31752
|
|
|
31793
31753
|
// src/widgets/basic/information-field/information.tsx
|
|
31794
31754
|
import { Fragment as Fragment28, jsx as jsx98, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
@@ -31932,7 +31892,7 @@ var Many2ManyTagField = (props) => {
|
|
|
31932
31892
|
},
|
|
31933
31893
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
31934
31894
|
const { clearErrors } = methods;
|
|
31935
|
-
|
|
31895
|
+
useEffect21(() => {
|
|
31936
31896
|
if (field.value) {
|
|
31937
31897
|
clearErrors(name);
|
|
31938
31898
|
}
|
|
@@ -32083,7 +32043,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32083
32043
|
};
|
|
32084
32044
|
|
|
32085
32045
|
// src/widgets/basic/monetary-field/monetary.tsx
|
|
32086
|
-
import { useEffect as
|
|
32046
|
+
import { useEffect as useEffect22 } from "react";
|
|
32087
32047
|
import { Fragment as Fragment29, jsx as jsx100, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
32088
32048
|
var MonetaryField = (props) => {
|
|
32089
32049
|
const { t: t3 } = useI18n();
|
|
@@ -32133,7 +32093,7 @@ var MonetaryField = (props) => {
|
|
|
32133
32093
|
fieldState: { error: error2 }
|
|
32134
32094
|
}) => {
|
|
32135
32095
|
const { setError, clearErrors } = methods;
|
|
32136
|
-
|
|
32096
|
+
useEffect22(() => {
|
|
32137
32097
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32138
32098
|
clearErrors(name);
|
|
32139
32099
|
}
|
|
@@ -32189,7 +32149,7 @@ var PaidBadgedField = () => {
|
|
|
32189
32149
|
};
|
|
32190
32150
|
|
|
32191
32151
|
// src/widgets/basic/priority-field/rating-star.tsx
|
|
32192
|
-
import React18, { useEffect as
|
|
32152
|
+
import React18, { useEffect as useEffect23, useState as useState21 } from "react";
|
|
32193
32153
|
import { jsx as jsx102, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
32194
32154
|
var RatingStarField = (props) => {
|
|
32195
32155
|
const {
|
|
@@ -32201,7 +32161,7 @@ var RatingStarField = (props) => {
|
|
|
32201
32161
|
} = props;
|
|
32202
32162
|
const [rating, setRating] = useState21(defaultValue);
|
|
32203
32163
|
const [hover, setHover] = useState21(0);
|
|
32204
|
-
|
|
32164
|
+
useEffect23(() => {
|
|
32205
32165
|
setRating(defaultValue);
|
|
32206
32166
|
}, [defaultValue]);
|
|
32207
32167
|
const handleClick = (value) => {
|
|
@@ -32316,7 +32276,7 @@ var PriorityField = (props) => {
|
|
|
32316
32276
|
};
|
|
32317
32277
|
|
|
32318
32278
|
// src/widgets/basic/radio-group-field/radio-group.tsx
|
|
32319
|
-
import { useEffect as
|
|
32279
|
+
import { useEffect as useEffect24 } from "react";
|
|
32320
32280
|
import { jsx as jsx104, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
32321
32281
|
var RadioGroupField = (props) => {
|
|
32322
32282
|
const {
|
|
@@ -32330,7 +32290,7 @@ var RadioGroupField = (props) => {
|
|
|
32330
32290
|
onChange: onChange2,
|
|
32331
32291
|
setValue
|
|
32332
32292
|
} = props;
|
|
32333
|
-
|
|
32293
|
+
useEffect24(() => {
|
|
32334
32294
|
if (selection?.length > 0) {
|
|
32335
32295
|
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
32336
32296
|
}
|
|
@@ -32636,7 +32596,7 @@ var ToggleButtonField = (props) => {
|
|
|
32636
32596
|
};
|
|
32637
32597
|
|
|
32638
32598
|
// src/widgets/basic/integer-field/integer.tsx
|
|
32639
|
-
import { useEffect as
|
|
32599
|
+
import { useEffect as useEffect25, useRef as useRef18, useState as useState22 } from "react";
|
|
32640
32600
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
32641
32601
|
var IntegerField = (props) => {
|
|
32642
32602
|
const {
|
|
@@ -32673,13 +32633,13 @@ var IntegerField = (props) => {
|
|
|
32673
32633
|
fieldState: { error: error2 }
|
|
32674
32634
|
}) => {
|
|
32675
32635
|
const { setError, clearErrors } = methods;
|
|
32676
|
-
const isDirtyRef =
|
|
32677
|
-
const inputRef =
|
|
32678
|
-
const lastCommittedValueRef =
|
|
32636
|
+
const isDirtyRef = useRef18(false);
|
|
32637
|
+
const inputRef = useRef18(null);
|
|
32638
|
+
const lastCommittedValueRef = useRef18(null);
|
|
32679
32639
|
const [inputValue, setInputValue] = useState22(
|
|
32680
32640
|
value2 !== void 0 && value2 !== null ? String(value2) : ""
|
|
32681
32641
|
);
|
|
32682
|
-
|
|
32642
|
+
useEffect25(() => {
|
|
32683
32643
|
if (value2 !== void 0 && value2 !== null) {
|
|
32684
32644
|
setInputValue(String(value2));
|
|
32685
32645
|
clearErrors(name);
|
|
@@ -32835,7 +32795,7 @@ var StatusDropdownField = (props) => {
|
|
|
32835
32795
|
|
|
32836
32796
|
// src/widgets/basic/many2many-field/many2many.tsx
|
|
32837
32797
|
import { createPortal as createPortal5 } from "react-dom";
|
|
32838
|
-
import { useEffect as
|
|
32798
|
+
import { useEffect as useEffect26 } from "react";
|
|
32839
32799
|
import { jsx as jsx111, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
32840
32800
|
var Many2ManyField = (props) => {
|
|
32841
32801
|
const { t: t3 } = useI18n();
|
|
@@ -32890,7 +32850,7 @@ var Many2ManyField = (props) => {
|
|
|
32890
32850
|
setGroupBy,
|
|
32891
32851
|
clearSearch
|
|
32892
32852
|
} = searchController;
|
|
32893
|
-
|
|
32853
|
+
useEffect26(() => {
|
|
32894
32854
|
const groupItems = Array.isArray(selectedTags) ? selectedTags.filter((item) => item.type === "group_by") : [];
|
|
32895
32855
|
if (groupItems?.length > 0) {
|
|
32896
32856
|
typeof setPageLimit === "function" && setPageLimit(80);
|
|
@@ -33045,7 +33005,7 @@ var Many2ManyField = (props) => {
|
|
|
33045
33005
|
};
|
|
33046
33006
|
|
|
33047
33007
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
33048
|
-
import React19, { useEffect as
|
|
33008
|
+
import React19, { useEffect as useEffect27, useState as useState23 } from "react";
|
|
33049
33009
|
import { Fragment as Fragment32, jsx as jsx112, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
33050
33010
|
var CustomMenuList2 = (props) => {
|
|
33051
33011
|
const { t: t3 } = useI18n();
|
|
@@ -33152,7 +33112,7 @@ var Many2OneField = (props) => {
|
|
|
33152
33112
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length ? options2.find(
|
|
33153
33113
|
(o3) => o3?.value === tempSelectedOption.value
|
|
33154
33114
|
) ?? currentValue : currentValue ?? null;
|
|
33155
|
-
|
|
33115
|
+
useEffect27(() => {
|
|
33156
33116
|
if (error2 && selectedOption) {
|
|
33157
33117
|
methods?.clearErrors(name);
|
|
33158
33118
|
}
|