@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/index.mjs
CHANGED
|
@@ -9868,7 +9868,8 @@ var vi_default = {
|
|
|
9868
9868
|
"message-text-error": " kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 {{max}} k\xFD t\u1EF1",
|
|
9869
9869
|
upcase: ", {{count}} ch\u1EEF in hoa",
|
|
9870
9870
|
digit: ", {{count}} s\u1ED1",
|
|
9871
|
-
special: ", {{count}} k\xFD t\u1EF1 \u0111\u1EB7c bi\u1EC7t"
|
|
9871
|
+
special: ", {{count}} k\xFD t\u1EF1 \u0111\u1EB7c bi\u1EC7t",
|
|
9872
|
+
upload_files_accept: "Ch\u1EC9 ch\u1EA5p nh\u1EADn c\xE1c \u0111\u1ECBnh d\u1EA1ng JPEG, PNG, PDF, MP4, XLS, XLXS, ZIP"
|
|
9872
9873
|
};
|
|
9873
9874
|
|
|
9874
9875
|
// src/locales/en.json
|
|
@@ -9927,7 +9928,8 @@ var en_default = {
|
|
|
9927
9928
|
"message-text-error": " must not exceed {{max}} characters",
|
|
9928
9929
|
upcase: ", {{count}} uppercase letter",
|
|
9929
9930
|
digit: ", {{count}} digit",
|
|
9930
|
-
special: ", {{count}} special character"
|
|
9931
|
+
special: ", {{count}} special character",
|
|
9932
|
+
upload_files_accept: "Only JPEG, PNG, PDF, MP4, XLS, XLXS, ZIP, JSON formats are allowed"
|
|
9931
9933
|
};
|
|
9932
9934
|
|
|
9933
9935
|
// src/utils/i18n.ts
|
|
@@ -16537,7 +16539,7 @@ var ButtonSelectFiles = ({
|
|
|
16537
16539
|
isText
|
|
16538
16540
|
}) => {
|
|
16539
16541
|
const { t: t3 } = useI18n();
|
|
16540
|
-
const
|
|
16542
|
+
const ALLOWED_TYPES2 = [
|
|
16541
16543
|
"image/jpeg",
|
|
16542
16544
|
"image/png",
|
|
16543
16545
|
"application/pdf",
|
|
@@ -16554,7 +16556,7 @@ var ButtonSelectFiles = ({
|
|
|
16554
16556
|
const { mutate, isPending } = isBinary ? useUploadFile() : useUploadImage();
|
|
16555
16557
|
const dataUser = user?.userProfile?.data;
|
|
16556
16558
|
const validateFile = (file) => {
|
|
16557
|
-
if (!
|
|
16559
|
+
if (!ALLOWED_TYPES2.includes(file.type)) {
|
|
16558
16560
|
setUploadError(t3("file_accept_single"));
|
|
16559
16561
|
return false;
|
|
16560
16562
|
}
|
|
@@ -16767,125 +16769,117 @@ var AvatarField = (props) => {
|
|
|
16767
16769
|
};
|
|
16768
16770
|
|
|
16769
16771
|
// src/widgets/basic/binary-field/binary.tsx
|
|
16770
|
-
import {
|
|
16772
|
+
import { useState as useState10, useRef as useRef6 } from "react";
|
|
16771
16773
|
import { Fragment as Fragment16, jsx as jsx75, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
16774
|
+
var ALLOWED_TYPES = [
|
|
16775
|
+
"image/jpeg",
|
|
16776
|
+
"image/png",
|
|
16777
|
+
"application/pdf",
|
|
16778
|
+
"video/mp4",
|
|
16779
|
+
"application/zip",
|
|
16780
|
+
"application/x-zip-compressed",
|
|
16781
|
+
"application/vnd.ms-excel",
|
|
16782
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
16783
|
+
"application/json"
|
|
16784
|
+
];
|
|
16772
16785
|
var BinaryField = (props) => {
|
|
16773
16786
|
const {
|
|
16787
|
+
value,
|
|
16774
16788
|
name,
|
|
16775
|
-
methods,
|
|
16776
|
-
readonly = false,
|
|
16777
|
-
placeholder,
|
|
16778
|
-
required = false,
|
|
16779
|
-
invisible = false,
|
|
16780
|
-
filename,
|
|
16781
|
-
formValues,
|
|
16782
16789
|
isEditTable,
|
|
16783
16790
|
widget,
|
|
16784
|
-
|
|
16785
|
-
value,
|
|
16786
|
-
// from hook
|
|
16791
|
+
readonly,
|
|
16787
16792
|
placeHolderImage,
|
|
16788
|
-
|
|
16789
|
-
|
|
16790
|
-
|
|
16791
|
-
|
|
16792
|
-
|
|
16793
|
-
|
|
16793
|
+
placeholder,
|
|
16794
|
+
required,
|
|
16795
|
+
invisible,
|
|
16796
|
+
methods,
|
|
16797
|
+
string,
|
|
16798
|
+
isForm,
|
|
16794
16799
|
onDownload,
|
|
16795
|
-
|
|
16800
|
+
onUploadFile,
|
|
16801
|
+
onDeleteFile,
|
|
16802
|
+
url,
|
|
16803
|
+
fileInfor
|
|
16796
16804
|
} = props;
|
|
16797
16805
|
const { t: t3 } = useI18n();
|
|
16798
|
-
const [
|
|
16806
|
+
const [loading, setLoading] = useState10(false);
|
|
16807
|
+
const hasFetchedMeta = useRef6(false);
|
|
16799
16808
|
const onlyImage = widget === "image" || widget === "image_url";
|
|
16800
|
-
|
|
16801
|
-
|
|
16802
|
-
|
|
16803
|
-
|
|
16804
|
-
|
|
16805
|
-
|
|
16806
|
-
|
|
16807
|
-
|
|
16808
|
-
|
|
16809
|
-
}
|
|
16810
|
-
try {
|
|
16811
|
-
let type = "application/octet-stream";
|
|
16812
|
-
let size4 = 0;
|
|
16813
|
-
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16814
|
-
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16815
|
-
type = "image/*";
|
|
16816
|
-
} else {
|
|
16817
|
-
const response = await fetch(initialFile);
|
|
16818
|
-
console.log("responsessss", response);
|
|
16819
|
-
const responseBlob = await response.blob();
|
|
16820
|
-
if (responseBlob) {
|
|
16821
|
-
type = responseBlob?.type;
|
|
16822
|
-
size4 = responseBlob.size;
|
|
16823
|
-
}
|
|
16824
|
-
}
|
|
16825
|
-
setFileInfo({
|
|
16826
|
-
name: name2,
|
|
16827
|
-
type,
|
|
16828
|
-
url: initialFile,
|
|
16829
|
-
size: size4,
|
|
16830
|
-
source: "link"
|
|
16831
|
-
});
|
|
16832
|
-
} catch (error2) {
|
|
16833
|
-
console.warn("Cannot load link info:", error2);
|
|
16834
|
-
}
|
|
16835
|
-
};
|
|
16836
|
-
loadFromLink();
|
|
16837
|
-
}, [initialFile]);
|
|
16838
|
-
const handleChange = (e3, onChange2) => {
|
|
16839
|
-
const file = e3.target.files?.[0];
|
|
16809
|
+
const acceptType = !onlyImage ? `.pdf,.json,.mp4,.zip,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,.jpeg,.jpg,.png` : ".jpeg,.jpg,.png";
|
|
16810
|
+
const validateFile = (file) => {
|
|
16811
|
+
if (!ALLOWED_TYPES.includes(file.type)) {
|
|
16812
|
+
return t3("upload_files_accept");
|
|
16813
|
+
}
|
|
16814
|
+
return true;
|
|
16815
|
+
};
|
|
16816
|
+
const handleUpload = async (e3) => {
|
|
16817
|
+
const file = e3.target.files[0];
|
|
16840
16818
|
if (!file) return;
|
|
16841
16819
|
if (onlyImage && !file.type.startsWith("image/")) {
|
|
16842
|
-
methods?.setError(
|
|
16820
|
+
methods?.setError(name, {
|
|
16821
|
+
type: "manual",
|
|
16822
|
+
message: t3("only_image_accept")
|
|
16823
|
+
});
|
|
16843
16824
|
e3.target.value = "";
|
|
16844
16825
|
return;
|
|
16845
16826
|
}
|
|
16846
|
-
const
|
|
16847
|
-
|
|
16848
|
-
|
|
16849
|
-
|
|
16850
|
-
|
|
16851
|
-
|
|
16852
|
-
|
|
16853
|
-
|
|
16854
|
-
|
|
16855
|
-
|
|
16856
|
-
|
|
16857
|
-
|
|
16858
|
-
|
|
16827
|
+
const valid = validateFile(file);
|
|
16828
|
+
if (valid !== true) {
|
|
16829
|
+
methods?.setError(name, { type: "manual", message: valid });
|
|
16830
|
+
return;
|
|
16831
|
+
}
|
|
16832
|
+
methods?.clearErrors(name);
|
|
16833
|
+
const formData = new FormData();
|
|
16834
|
+
formData.append("file", file);
|
|
16835
|
+
setLoading(true);
|
|
16836
|
+
try {
|
|
16837
|
+
onUploadFile?.(formData);
|
|
16838
|
+
} catch (error2) {
|
|
16839
|
+
console.error(error2);
|
|
16840
|
+
}
|
|
16841
|
+
setLoading(false);
|
|
16859
16842
|
};
|
|
16860
|
-
const
|
|
16861
|
-
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
|
|
16865
|
-
|
|
16866
|
-
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
16872
|
-
|
|
16843
|
+
const handleDelete = () => {
|
|
16844
|
+
onDeleteFile && onDeleteFile();
|
|
16845
|
+
hasFetchedMeta.current = false;
|
|
16846
|
+
};
|
|
16847
|
+
const renderPreview = () => {
|
|
16848
|
+
if (!url) return null;
|
|
16849
|
+
const type = fileInfor?.type;
|
|
16850
|
+
const date = fileInfor?.date;
|
|
16851
|
+
const size4 = fileInfor?.size;
|
|
16852
|
+
if (type?.includes("image")) {
|
|
16853
|
+
return /* @__PURE__ */ jsxs49("div", { className: "flex gap-2 items-center", children: [
|
|
16854
|
+
/* @__PURE__ */ jsx75(
|
|
16855
|
+
"img",
|
|
16856
|
+
{
|
|
16857
|
+
src: url,
|
|
16858
|
+
alt: name,
|
|
16859
|
+
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"}`,
|
|
16860
|
+
style: {
|
|
16861
|
+
maxWidth: isEditTable ? "40px" : "128px",
|
|
16862
|
+
maxHeight: isEditTable ? "40px" : "128px",
|
|
16863
|
+
height: isEditTable ? "40px" : "128px",
|
|
16864
|
+
width: isEditTable ? "40px" : "128px"
|
|
16865
|
+
}
|
|
16873
16866
|
}
|
|
16874
|
-
|
|
16875
|
-
|
|
16876
|
-
|
|
16877
|
-
|
|
16878
|
-
|
|
16879
|
-
|
|
16880
|
-
|
|
16881
|
-
|
|
16882
|
-
|
|
16883
|
-
|
|
16884
|
-
|
|
16885
|
-
|
|
16886
|
-
|
|
16887
|
-
}
|
|
16888
|
-
);
|
|
16867
|
+
),
|
|
16868
|
+
!onlyImage && /* @__PURE__ */ jsxs49("div", { children: [
|
|
16869
|
+
/* @__PURE__ */ jsx75(
|
|
16870
|
+
"p",
|
|
16871
|
+
{
|
|
16872
|
+
style: {
|
|
16873
|
+
maxWidth: "120px"
|
|
16874
|
+
},
|
|
16875
|
+
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16876
|
+
children: url?.split("/").pop()
|
|
16877
|
+
}
|
|
16878
|
+
),
|
|
16879
|
+
/* @__PURE__ */ jsx75("span", { className: "text-xs text-[#666] font-semibold", children: size4 })
|
|
16880
|
+
] })
|
|
16881
|
+
] });
|
|
16882
|
+
}
|
|
16889
16883
|
const getFileIcon = () => {
|
|
16890
16884
|
if (type === "application/pdf") return /* @__PURE__ */ jsx75(PdfIcon, {});
|
|
16891
16885
|
if (type?.includes("excel") || type?.includes("spreadsheet"))
|
|
@@ -16894,7 +16888,6 @@ var BinaryField = (props) => {
|
|
|
16894
16888
|
if (type === "application/json") return /* @__PURE__ */ jsx75(JSONFileIcon, {});
|
|
16895
16889
|
return /* @__PURE__ */ jsx75(DefaultFileIcon, {});
|
|
16896
16890
|
};
|
|
16897
|
-
const isShowSize = !isNaN(size4);
|
|
16898
16891
|
return /* @__PURE__ */ jsxs49("div", { className: "flex items-center gap-2", children: [
|
|
16899
16892
|
getFileIcon(),
|
|
16900
16893
|
/* @__PURE__ */ jsxs49("div", { children: [
|
|
@@ -16905,10 +16898,10 @@ var BinaryField = (props) => {
|
|
|
16905
16898
|
maxWidth: "120px"
|
|
16906
16899
|
},
|
|
16907
16900
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16908
|
-
children:
|
|
16901
|
+
children: url?.split("/").pop()
|
|
16909
16902
|
}
|
|
16910
16903
|
),
|
|
16911
|
-
|
|
16904
|
+
/* @__PURE__ */ jsx75("span", { className: "text-xs text-[#666] font-semibold", children: size4 })
|
|
16912
16905
|
] })
|
|
16913
16906
|
] });
|
|
16914
16907
|
};
|
|
@@ -16918,139 +16911,136 @@ var BinaryField = (props) => {
|
|
|
16918
16911
|
name: name ?? "",
|
|
16919
16912
|
control: methods?.control,
|
|
16920
16913
|
rules: {
|
|
16921
|
-
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
16914
|
+
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
16915
|
+
validate: {
|
|
16916
|
+
fileValidate: (value2) => {
|
|
16917
|
+
if (!value2) return true;
|
|
16918
|
+
return validateFile(value2);
|
|
16919
|
+
}
|
|
16920
|
+
}
|
|
16922
16921
|
},
|
|
16923
|
-
render: ({
|
|
16924
|
-
|
|
16922
|
+
render: ({ fieldState: { error: error2 } }) => {
|
|
16923
|
+
console.log("error", error2);
|
|
16925
16924
|
return /* @__PURE__ */ jsxs49(Fragment16, { children: [
|
|
16926
16925
|
/* @__PURE__ */ jsx75(
|
|
16927
16926
|
"div",
|
|
16928
16927
|
{
|
|
16929
|
-
|
|
16930
|
-
|
|
16931
|
-
children: hasFile ? /* @__PURE__ */ jsx75(
|
|
16928
|
+
className: `widget binary-field flex w-fit items-center gap-4 ${onlyImage ? "shadow-md rounded-[12px]" : ""} ${isEditTable ? "p-2" : ""}`,
|
|
16929
|
+
children: /* @__PURE__ */ jsx75("div", { className: "relative group", children: /* @__PURE__ */ jsxs49(
|
|
16932
16930
|
"div",
|
|
16933
16931
|
{
|
|
16934
|
-
className: `relative
|
|
16935
|
-
children: /* @__PURE__ */ jsxs49(
|
|
16936
|
-
"div",
|
|
16937
|
-
{
|
|
16938
|
-
className: `flex gap-2 items-center bg-[#FAFAFA] rounded-[8px] p-[6px] ${onlyImage ? "h-32 w-32" : "max-h-fit max-w-fit"}`,
|
|
16939
|
-
children: [
|
|
16940
|
-
renderPreview(fileInfo),
|
|
16941
|
-
/* @__PURE__ */ jsxs49(
|
|
16942
|
-
"div",
|
|
16943
|
-
{
|
|
16944
|
-
style: {
|
|
16945
|
-
display: "flex",
|
|
16946
|
-
alignItems: "center",
|
|
16947
|
-
borderRadius: "8px",
|
|
16948
|
-
padding: "4px",
|
|
16949
|
-
gap: "8px",
|
|
16950
|
-
backgroundColor: onlyImage ? "rgba(0,0,0,0.03)" : "white",
|
|
16951
|
-
boxShadow: "0 2px 4px 0 rgba(27, 28, 29, 0.04)",
|
|
16952
|
-
position: onlyImage ? "absolute" : "relative",
|
|
16953
|
-
bottom: onlyImage ? "0" : "none",
|
|
16954
|
-
right: onlyImage ? "0" : "none"
|
|
16955
|
-
},
|
|
16956
|
-
children: [
|
|
16957
|
-
/* @__PURE__ */ jsx75(
|
|
16958
|
-
"span",
|
|
16959
|
-
{
|
|
16960
|
-
className: "cursor-pointer",
|
|
16961
|
-
onClick: () => onDownload && onDownload(
|
|
16962
|
-
fileInfo?.url || fileInfo?.data,
|
|
16963
|
-
fileInfo?.name || fileInfo?.display_name
|
|
16964
|
-
),
|
|
16965
|
-
children: /* @__PURE__ */ jsx75(DownloadIcon, {})
|
|
16966
|
-
}
|
|
16967
|
-
),
|
|
16968
|
-
!readonly && /* @__PURE__ */ jsx75(
|
|
16969
|
-
"span",
|
|
16970
|
-
{
|
|
16971
|
-
className: "cursor-pointer",
|
|
16972
|
-
onClick: () => {
|
|
16973
|
-
setFileInfo(null);
|
|
16974
|
-
handleRemoveFile(field.onChange);
|
|
16975
|
-
},
|
|
16976
|
-
children: /* @__PURE__ */ jsx75(DeleteIconDanger, {})
|
|
16977
|
-
}
|
|
16978
|
-
)
|
|
16979
|
-
]
|
|
16980
|
-
}
|
|
16981
|
-
)
|
|
16982
|
-
]
|
|
16983
|
-
}
|
|
16984
|
-
)
|
|
16985
|
-
}
|
|
16986
|
-
) : /* @__PURE__ */ jsxs49(
|
|
16987
|
-
"label",
|
|
16988
|
-
{
|
|
16989
|
-
htmlFor: inputId,
|
|
16990
|
-
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 "}`,
|
|
16932
|
+
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"} `,
|
|
16991
16933
|
children: [
|
|
16992
|
-
|
|
16993
|
-
|
|
16994
|
-
{
|
|
16995
|
-
id: inputId,
|
|
16996
|
-
type: "file",
|
|
16997
|
-
readOnly: readonly,
|
|
16998
|
-
placeholder,
|
|
16999
|
-
required: !invisible && required,
|
|
17000
|
-
onChange: (e3) => handleChange(e3, field.onChange),
|
|
17001
|
-
className: "hidden",
|
|
17002
|
-
accept: ".jpeg,.jpg,.png,.pdf,.json,.mp4,.zip,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
|
|
17003
|
-
}
|
|
17004
|
-
),
|
|
17005
|
-
onlyImage && /* @__PURE__ */ jsx75(
|
|
17006
|
-
"img",
|
|
17007
|
-
{
|
|
17008
|
-
src: placeHolderImage,
|
|
17009
|
-
alt: "",
|
|
17010
|
-
className: "z-0 relative"
|
|
17011
|
-
}
|
|
17012
|
-
),
|
|
17013
|
-
/* @__PURE__ */ jsx75(
|
|
16934
|
+
renderPreview(),
|
|
16935
|
+
value ? /* @__PURE__ */ jsxs49(
|
|
17014
16936
|
"div",
|
|
17015
16937
|
{
|
|
17016
|
-
className: "
|
|
16938
|
+
className: "widget",
|
|
17017
16939
|
style: {
|
|
16940
|
+
display: "flex",
|
|
16941
|
+
alignItems: "center",
|
|
16942
|
+
borderRadius: "8px",
|
|
16943
|
+
padding: "4px",
|
|
16944
|
+
gap: "8px",
|
|
16945
|
+
backgroundColor: onlyImage ? "rgba(0,0,0,0.03)" : "white",
|
|
16946
|
+
boxShadow: "0 2px 4px 0 rgba(27, 28, 29, 0.04)",
|
|
17018
16947
|
position: onlyImage ? "absolute" : "relative",
|
|
17019
|
-
bottom: onlyImage ? "
|
|
17020
|
-
|
|
17021
|
-
boxShadow: "0 1px 2px 0 rgba(228, 229, 231, 0.24)",
|
|
17022
|
-
width: "2rem",
|
|
17023
|
-
height: "2rem",
|
|
17024
|
-
border: onlyImage ? "1px solid transparent" : "1px solid var(--color-primary)",
|
|
17025
|
-
borderRadius: onlyImage ? "100%" : "8px"
|
|
16948
|
+
bottom: onlyImage ? "0" : "none",
|
|
16949
|
+
right: onlyImage ? "0" : "none"
|
|
17026
16950
|
},
|
|
17027
|
-
children:
|
|
17028
|
-
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
|
|
17032
|
-
|
|
17033
|
-
|
|
17034
|
-
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17038
|
-
|
|
17039
|
-
|
|
17040
|
-
|
|
17041
|
-
|
|
17042
|
-
|
|
17043
|
-
|
|
17044
|
-
|
|
17045
|
-
|
|
16951
|
+
children: [
|
|
16952
|
+
/* @__PURE__ */ jsx75(
|
|
16953
|
+
"span",
|
|
16954
|
+
{
|
|
16955
|
+
onClick: () => onDownload && onDownload(url || "", url?.split("/").pop()),
|
|
16956
|
+
className: "cursor-pointer",
|
|
16957
|
+
children: /* @__PURE__ */ jsx75(DownloadIcon, {})
|
|
16958
|
+
}
|
|
16959
|
+
),
|
|
16960
|
+
!readonly && /* @__PURE__ */ jsx75("span", { onClick: handleDelete, className: "cursor-pointer", children: /* @__PURE__ */ jsx75(DeleteIconDanger, {}) })
|
|
16961
|
+
]
|
|
16962
|
+
}
|
|
16963
|
+
) : /* @__PURE__ */ jsxs49(
|
|
16964
|
+
"label",
|
|
16965
|
+
{
|
|
16966
|
+
style: {
|
|
16967
|
+
maxWidth: "180px",
|
|
16968
|
+
maxHeight: "180px"
|
|
16969
|
+
},
|
|
16970
|
+
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 "}`,
|
|
16971
|
+
children: [
|
|
16972
|
+
/* @__PURE__ */ jsx75(
|
|
16973
|
+
"input",
|
|
16974
|
+
{
|
|
16975
|
+
type: "file",
|
|
16976
|
+
readOnly: readonly,
|
|
16977
|
+
placeholder,
|
|
16978
|
+
required: !invisible && required,
|
|
16979
|
+
onChange: handleUpload,
|
|
16980
|
+
className: "hidden",
|
|
16981
|
+
accept: acceptType
|
|
16982
|
+
}
|
|
16983
|
+
),
|
|
16984
|
+
onlyImage && /* @__PURE__ */ jsx75(
|
|
16985
|
+
"img",
|
|
16986
|
+
{
|
|
16987
|
+
src: placeHolderImage,
|
|
16988
|
+
alt: "",
|
|
16989
|
+
className: "z-0 relative"
|
|
16990
|
+
}
|
|
16991
|
+
),
|
|
16992
|
+
/* @__PURE__ */ jsx75(
|
|
16993
|
+
"div",
|
|
16994
|
+
{
|
|
16995
|
+
className: " size-8 bg-white rounded-lg flex justify-center items-center z-20",
|
|
16996
|
+
style: {
|
|
16997
|
+
position: onlyImage ? "absolute" : "relative",
|
|
16998
|
+
bottom: onlyImage ? "-8px" : "auto",
|
|
16999
|
+
left: onlyImage ? "-8px" : "auto",
|
|
17000
|
+
boxShadow: "0 1px 2px 0 rgba(228, 229, 231, 0.24)",
|
|
17001
|
+
width: "2rem",
|
|
17002
|
+
height: "2rem",
|
|
17003
|
+
borderRadius: onlyImage ? "100%" : "8px"
|
|
17004
|
+
},
|
|
17005
|
+
children: /* @__PURE__ */ jsx75(
|
|
17006
|
+
"svg",
|
|
17007
|
+
{
|
|
17008
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
17009
|
+
width: "14",
|
|
17010
|
+
height: "14",
|
|
17011
|
+
viewBox: "0 0 14 14",
|
|
17012
|
+
fill: "none",
|
|
17013
|
+
children: /* @__PURE__ */ jsx75(
|
|
17014
|
+
"path",
|
|
17015
|
+
{
|
|
17016
|
+
"fill-rule": "evenodd",
|
|
17017
|
+
"clip-rule": "evenodd",
|
|
17018
|
+
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",
|
|
17019
|
+
fill: "black"
|
|
17020
|
+
}
|
|
17021
|
+
)
|
|
17022
|
+
}
|
|
17023
|
+
)
|
|
17024
|
+
}
|
|
17025
|
+
)
|
|
17026
|
+
]
|
|
17046
17027
|
}
|
|
17047
17028
|
)
|
|
17048
17029
|
]
|
|
17049
17030
|
}
|
|
17050
|
-
)
|
|
17031
|
+
) })
|
|
17051
17032
|
}
|
|
17052
17033
|
),
|
|
17053
|
-
error2 && !isEditTable && /* @__PURE__ */ jsx75(
|
|
17034
|
+
error2 && !isEditTable && /* @__PURE__ */ jsx75(
|
|
17035
|
+
"p",
|
|
17036
|
+
{
|
|
17037
|
+
style: {
|
|
17038
|
+
maxWidth: "180px"
|
|
17039
|
+
},
|
|
17040
|
+
className: "text-[#de4747] text-sm mt-1",
|
|
17041
|
+
children: error2.message
|
|
17042
|
+
}
|
|
17043
|
+
)
|
|
17054
17044
|
] });
|
|
17055
17045
|
}
|
|
17056
17046
|
}
|
|
@@ -17203,7 +17193,7 @@ var ButtonField = (props) => {
|
|
|
17203
17193
|
};
|
|
17204
17194
|
|
|
17205
17195
|
// src/widgets/basic/char-field/char.tsx
|
|
17206
|
-
import { useEffect as
|
|
17196
|
+
import { useEffect as useEffect10, useMemo as useMemo4 } from "react";
|
|
17207
17197
|
import { Fragment as Fragment18, jsx as jsx78, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
17208
17198
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
17209
17199
|
var CharField = (props) => {
|
|
@@ -17264,12 +17254,12 @@ var CharField = (props) => {
|
|
|
17264
17254
|
fieldState: { error: error2, isDirty }
|
|
17265
17255
|
}) => {
|
|
17266
17256
|
const { setError, clearErrors } = methods;
|
|
17267
|
-
|
|
17257
|
+
useEffect10(() => {
|
|
17268
17258
|
if (value2) {
|
|
17269
17259
|
clearErrors(name);
|
|
17270
17260
|
}
|
|
17271
17261
|
}, [value2, clearErrors, name]);
|
|
17272
|
-
|
|
17262
|
+
useEffect10(() => {
|
|
17273
17263
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
17274
17264
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
17275
17265
|
const currentValue = methods?.getValues(name);
|
|
@@ -17358,7 +17348,7 @@ var CharField = (props) => {
|
|
|
17358
17348
|
};
|
|
17359
17349
|
|
|
17360
17350
|
// src/widgets/basic/char-field/secure-field.tsx
|
|
17361
|
-
import { useEffect as
|
|
17351
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useState as useState11 } from "react";
|
|
17362
17352
|
|
|
17363
17353
|
// src/icons/eye-hidden-icon.tsx
|
|
17364
17354
|
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
@@ -17459,10 +17449,10 @@ var SecureField = (props) => {
|
|
|
17459
17449
|
const shouldMask = isSensitive(widget) && !showPlain;
|
|
17460
17450
|
const isCappedToken = widget === "access_token" || widget === "refresh_token";
|
|
17461
17451
|
const maskedDisplay = isCappedToken && shouldMask ? "\u2022".repeat(Math.min(realValue.length, 20)) : "";
|
|
17462
|
-
|
|
17452
|
+
useEffect11(() => {
|
|
17463
17453
|
if (canToggle) setShowPlain(false);
|
|
17464
17454
|
}, [canToggle]);
|
|
17465
|
-
|
|
17455
|
+
useEffect11(() => {
|
|
17466
17456
|
if (value2) clearErrors(name);
|
|
17467
17457
|
}, [value2, clearErrors, name]);
|
|
17468
17458
|
return /* @__PURE__ */ jsxs52("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
@@ -17623,21 +17613,21 @@ var CheckboxField = (props) => {
|
|
|
17623
17613
|
};
|
|
17624
17614
|
|
|
17625
17615
|
// src/widgets/basic/color-field/color-wrapper.tsx
|
|
17626
|
-
import { useEffect as
|
|
17616
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState12 } from "react";
|
|
17627
17617
|
import { Fragment as Fragment19, jsx as jsx82, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
17628
17618
|
var ColorWrapper = (props) => {
|
|
17629
17619
|
const { colors: colors2, defaultColor, savePickColor } = props;
|
|
17630
17620
|
const { t: t3 } = useI18n();
|
|
17631
17621
|
const [selectedColor, setSelectedColor] = useState12(colors2[defaultColor]);
|
|
17632
17622
|
const [showFullColors, setIsShowFullColor] = useState12(false);
|
|
17633
|
-
const pickColorsRef =
|
|
17634
|
-
|
|
17623
|
+
const pickColorsRef = useRef7(null);
|
|
17624
|
+
useEffect12(() => {
|
|
17635
17625
|
setSelectedColor(colors2[defaultColor]);
|
|
17636
17626
|
}, [defaultColor]);
|
|
17637
17627
|
const handleShowFullColors = () => {
|
|
17638
17628
|
setIsShowFullColor(!showFullColors);
|
|
17639
17629
|
};
|
|
17640
|
-
|
|
17630
|
+
useEffect12(() => {
|
|
17641
17631
|
const handleClickOutside = (event) => {
|
|
17642
17632
|
if (pickColorsRef.current && !pickColorsRef.current.contains(event.target)) {
|
|
17643
17633
|
setIsShowFullColor(false);
|
|
@@ -17728,7 +17718,7 @@ var ColorField = (props) => {
|
|
|
17728
17718
|
};
|
|
17729
17719
|
|
|
17730
17720
|
// src/widgets/basic/copy-link-buttton/copy-link.tsx
|
|
17731
|
-
import { useEffect as
|
|
17721
|
+
import { useEffect as useEffect13 } from "react";
|
|
17732
17722
|
import { jsx as jsx84, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
17733
17723
|
var CopyLinkButtonField = (props) => {
|
|
17734
17724
|
const {
|
|
@@ -17765,7 +17755,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17765
17755
|
fieldState: { error: error2 }
|
|
17766
17756
|
}) => {
|
|
17767
17757
|
const { setError, clearErrors } = methods;
|
|
17768
|
-
|
|
17758
|
+
useEffect13(() => {
|
|
17769
17759
|
if (value) {
|
|
17770
17760
|
clearErrors(name);
|
|
17771
17761
|
}
|
|
@@ -17838,10 +17828,10 @@ var CopyLinkButtonField = (props) => {
|
|
|
17838
17828
|
};
|
|
17839
17829
|
|
|
17840
17830
|
// src/widgets/basic/date-field/date.tsx
|
|
17841
|
-
import { forwardRef as forwardRef6, useEffect as
|
|
17831
|
+
import { forwardRef as forwardRef6, useEffect as useEffect17 } from "react";
|
|
17842
17832
|
|
|
17843
17833
|
// node_modules/react-datepicker/dist/index.es.js
|
|
17844
|
-
import React10, { useRef as
|
|
17834
|
+
import React10, { useRef as useRef11, useCallback as useCallback5, useEffect as useEffect15, cloneElement as cloneElement3, Component, createRef, createElement as createElement5 } from "react";
|
|
17845
17835
|
|
|
17846
17836
|
// node_modules/date-fns/constants.js
|
|
17847
17837
|
var daysInYear = 365.2425;
|
|
@@ -22411,8 +22401,8 @@ var CalendarContainer = function(_a2) {
|
|
|
22411
22401
|
return React10.createElement("div", { className, role: "dialog", "aria-label": ariaLabel, "aria-modal": "true" }, children);
|
|
22412
22402
|
};
|
|
22413
22403
|
var useDetectClickOutside = function(onClickOutside, ignoreClass) {
|
|
22414
|
-
var ref =
|
|
22415
|
-
var onClickOutsideRef =
|
|
22404
|
+
var ref = useRef11(null);
|
|
22405
|
+
var onClickOutsideRef = useRef11(onClickOutside);
|
|
22416
22406
|
onClickOutsideRef.current = onClickOutside;
|
|
22417
22407
|
var handleClickOutside = useCallback5(function(event) {
|
|
22418
22408
|
var _a2;
|
|
@@ -22425,7 +22415,7 @@ var useDetectClickOutside = function(onClickOutside, ignoreClass) {
|
|
|
22425
22415
|
}
|
|
22426
22416
|
}
|
|
22427
22417
|
}, [ignoreClass]);
|
|
22428
|
-
|
|
22418
|
+
useEffect15(function() {
|
|
22429
22419
|
document.addEventListener("mousedown", handleClickOutside);
|
|
22430
22420
|
return function() {
|
|
22431
22421
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
@@ -25666,7 +25656,7 @@ function withFloating(Component3) {
|
|
|
25666
25656
|
var WithFloating = function(props) {
|
|
25667
25657
|
var _a2;
|
|
25668
25658
|
var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
|
|
25669
|
-
var arrowRef =
|
|
25659
|
+
var arrowRef = useRef11(null);
|
|
25670
25660
|
var floatingProps = useFloating2(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
|
|
25671
25661
|
flip3({ padding: 15 }),
|
|
25672
25662
|
offset3(10),
|
|
@@ -26845,7 +26835,7 @@ function _toConsumableArray(r4) {
|
|
|
26845
26835
|
|
|
26846
26836
|
// node_modules/react-select/dist/Select-ef7c0426.esm.js
|
|
26847
26837
|
import * as React14 from "react";
|
|
26848
|
-
import { useMemo as useMemo9, Fragment as Fragment23, useRef as
|
|
26838
|
+
import { useMemo as useMemo9, Fragment as Fragment23, useRef as useRef14, useCallback as useCallback8, useEffect as useEffect16, Component as Component2 } from "react";
|
|
26849
26839
|
|
|
26850
26840
|
// node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
|
|
26851
26841
|
import * as React12 from "react";
|
|
@@ -28177,7 +28167,7 @@ function _taggedTemplateLiteral(e3, t3) {
|
|
|
28177
28167
|
}
|
|
28178
28168
|
|
|
28179
28169
|
// node_modules/react-select/dist/index-641ee5b8.esm.js
|
|
28180
|
-
import { useContext as useContext9, useRef as
|
|
28170
|
+
import { useContext as useContext9, useRef as useRef13, useState as useState16, useMemo as useMemo8, useCallback as useCallback7, createContext as createContext5 } from "react";
|
|
28181
28171
|
import { createPortal as createPortal4 } from "react-dom";
|
|
28182
28172
|
|
|
28183
28173
|
// node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
|
|
@@ -28523,7 +28513,7 @@ var PortalPlacementContext = /* @__PURE__ */ createContext5(null);
|
|
|
28523
28513
|
var MenuPlacer = function MenuPlacer2(props) {
|
|
28524
28514
|
var children = props.children, minMenuHeight = props.minMenuHeight, maxMenuHeight = props.maxMenuHeight, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition, menuShouldScrollIntoView = props.menuShouldScrollIntoView, theme = props.theme;
|
|
28525
28515
|
var _ref3 = useContext9(PortalPlacementContext) || {}, setPortalPlacement = _ref3.setPortalPlacement;
|
|
28526
|
-
var ref =
|
|
28516
|
+
var ref = useRef13(null);
|
|
28527
28517
|
var _useState = useState16(maxMenuHeight), _useState2 = _slicedToArray(_useState, 2), maxHeight = _useState2[0], setMaxHeight = _useState2[1];
|
|
28528
28518
|
var _useState3 = useState16(null), _useState4 = _slicedToArray(_useState3, 2), placement = _useState4[0], setPlacement = _useState4[1];
|
|
28529
28519
|
var controlHeight2 = theme.spacing.controlHeight;
|
|
@@ -28627,8 +28617,8 @@ var menuPortalCSS = function menuPortalCSS2(_ref8) {
|
|
|
28627
28617
|
};
|
|
28628
28618
|
var MenuPortal = function MenuPortal2(props) {
|
|
28629
28619
|
var appendTo = props.appendTo, children = props.children, controlElement = props.controlElement, innerProps = props.innerProps, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition;
|
|
28630
|
-
var menuPortalRef =
|
|
28631
|
-
var cleanupRef =
|
|
28620
|
+
var menuPortalRef = useRef13(null);
|
|
28621
|
+
var cleanupRef = useRef13(null);
|
|
28632
28622
|
var _useState5 = useState16(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
|
|
28633
28623
|
var portalPlacementContext = useMemo8(function() {
|
|
28634
28624
|
return {
|
|
@@ -29766,10 +29756,10 @@ var cancelScroll = function cancelScroll2(event) {
|
|
|
29766
29756
|
};
|
|
29767
29757
|
function useScrollCapture(_ref3) {
|
|
29768
29758
|
var isEnabled = _ref3.isEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave;
|
|
29769
|
-
var isBottom =
|
|
29770
|
-
var isTop =
|
|
29771
|
-
var touchStart =
|
|
29772
|
-
var scrollTarget =
|
|
29759
|
+
var isBottom = useRef14(false);
|
|
29760
|
+
var isTop = useRef14(false);
|
|
29761
|
+
var touchStart = useRef14(0);
|
|
29762
|
+
var scrollTarget = useRef14(null);
|
|
29773
29763
|
var handleEventDelta = useCallback8(function(event, delta) {
|
|
29774
29764
|
if (scrollTarget.current === null) return;
|
|
29775
29765
|
var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight;
|
|
@@ -29829,7 +29819,7 @@ function useScrollCapture(_ref3) {
|
|
|
29829
29819
|
el.removeEventListener("touchstart", onTouchStart, false);
|
|
29830
29820
|
el.removeEventListener("touchmove", onTouchMove, false);
|
|
29831
29821
|
}, [onTouchMove, onTouchStart, onWheel]);
|
|
29832
|
-
|
|
29822
|
+
useEffect16(function() {
|
|
29833
29823
|
if (!isEnabled) return;
|
|
29834
29824
|
var element = scrollTarget.current;
|
|
29835
29825
|
startListening(element);
|
|
@@ -29876,8 +29866,8 @@ var listenerOptions = {
|
|
|
29876
29866
|
};
|
|
29877
29867
|
function useScrollLock(_ref3) {
|
|
29878
29868
|
var isEnabled = _ref3.isEnabled, _ref$accountForScroll = _ref3.accountForScrollbars, accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
|
|
29879
|
-
var originalStyles =
|
|
29880
|
-
var scrollTarget =
|
|
29869
|
+
var originalStyles = useRef14({});
|
|
29870
|
+
var scrollTarget = useRef14(null);
|
|
29881
29871
|
var addScrollLock = useCallback8(function(touchScrollTarget) {
|
|
29882
29872
|
if (!canUseDOM) return;
|
|
29883
29873
|
var target = document.body;
|
|
@@ -29932,7 +29922,7 @@ function useScrollLock(_ref3) {
|
|
|
29932
29922
|
}
|
|
29933
29923
|
}
|
|
29934
29924
|
}, [accountForScrollbars]);
|
|
29935
|
-
|
|
29925
|
+
useEffect16(function() {
|
|
29936
29926
|
if (!isEnabled) return;
|
|
29937
29927
|
var element = scrollTarget.current;
|
|
29938
29928
|
addScrollLock(element);
|
|
@@ -31651,7 +31641,7 @@ var DateField = (props) => {
|
|
|
31651
31641
|
},
|
|
31652
31642
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
31653
31643
|
const { setError, clearErrors } = methods;
|
|
31654
|
-
|
|
31644
|
+
useEffect17(() => {
|
|
31655
31645
|
if (value) {
|
|
31656
31646
|
clearErrors(name);
|
|
31657
31647
|
}
|
|
@@ -32006,7 +31996,7 @@ var FeeField = (props) => {
|
|
|
32006
31996
|
};
|
|
32007
31997
|
|
|
32008
31998
|
// src/widgets/basic/file-upload-field/file-upload.tsx
|
|
32009
|
-
import { useEffect as
|
|
31999
|
+
import { useEffect as useEffect18, useRef as useRef15, useState as useState18 } from "react";
|
|
32010
32000
|
import { jsx as jsx93, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
32011
32001
|
var RenderFile = ({
|
|
32012
32002
|
file,
|
|
@@ -32071,10 +32061,10 @@ var FileUploadField = (props) => {
|
|
|
32071
32061
|
downloadFunction
|
|
32072
32062
|
} = props;
|
|
32073
32063
|
const { t: t3 } = useI18n();
|
|
32074
|
-
const fileInputRef =
|
|
32064
|
+
const fileInputRef = useRef15(null);
|
|
32075
32065
|
const [selectedFiles, setSelectedFiles] = useState18([]);
|
|
32076
32066
|
const [uploadError, setUploadError] = useState18();
|
|
32077
|
-
|
|
32067
|
+
useEffect18(() => {
|
|
32078
32068
|
if (selectedFiles?.length === 0 && value) {
|
|
32079
32069
|
setSelectedFiles([
|
|
32080
32070
|
{
|
|
@@ -32092,7 +32082,7 @@ var FileUploadField = (props) => {
|
|
|
32092
32082
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
32093
32083
|
},
|
|
32094
32084
|
render: ({ field: { onChange: onChange2 }, fieldState: { error: error2 } }) => {
|
|
32095
|
-
|
|
32085
|
+
useEffect18(() => {
|
|
32096
32086
|
let data = widget === "many2many_binary" ? selectedFiles : selectedFiles?.[0]?.data;
|
|
32097
32087
|
if (widget !== "many2many_binary" && data && isBase64File(data)) {
|
|
32098
32088
|
data = data.split(",")[1];
|
|
@@ -32148,7 +32138,7 @@ var FileUploadField = (props) => {
|
|
|
32148
32138
|
};
|
|
32149
32139
|
|
|
32150
32140
|
// src/widgets/basic/float-field/float.tsx
|
|
32151
|
-
import { useEffect as
|
|
32141
|
+
import { useEffect as useEffect19, useRef as useRef16, useState as useState19 } from "react";
|
|
32152
32142
|
import { Fragment as Fragment26, jsx as jsx94, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
32153
32143
|
var FloatField = (props) => {
|
|
32154
32144
|
const {
|
|
@@ -32184,9 +32174,9 @@ var FloatField = (props) => {
|
|
|
32184
32174
|
const [inputValue, setInputValue] = useState19(
|
|
32185
32175
|
value !== void 0 && value !== null ? formatFloatNumber(value) : ""
|
|
32186
32176
|
);
|
|
32187
|
-
const isDirtyRef =
|
|
32188
|
-
const lastCommittedValueRef =
|
|
32189
|
-
|
|
32177
|
+
const isDirtyRef = useRef16(false);
|
|
32178
|
+
const lastCommittedValueRef = useRef16(null);
|
|
32179
|
+
useEffect19(() => {
|
|
32190
32180
|
if (isDirtyRef.current) return;
|
|
32191
32181
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
32192
32182
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
@@ -32412,7 +32402,7 @@ var FloatTimeField = (props) => {
|
|
|
32412
32402
|
};
|
|
32413
32403
|
|
|
32414
32404
|
// src/widgets/basic/html-field/html.tsx
|
|
32415
|
-
import { useEffect as
|
|
32405
|
+
import { useEffect as useEffect20, useRef as useRef17 } from "react";
|
|
32416
32406
|
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
32417
32407
|
var HtmlField = (props) => {
|
|
32418
32408
|
const {
|
|
@@ -32426,7 +32416,7 @@ var HtmlField = (props) => {
|
|
|
32426
32416
|
isEditTable,
|
|
32427
32417
|
baseClassName
|
|
32428
32418
|
} = props;
|
|
32429
|
-
const divRef =
|
|
32419
|
+
const divRef = useRef17(null);
|
|
32430
32420
|
if (!isForm && !isEditTable) {
|
|
32431
32421
|
return /* @__PURE__ */ jsx96("div", { dangerouslySetInnerHTML: { __html: value || defaultValue || "" } });
|
|
32432
32422
|
}
|
|
@@ -32437,7 +32427,7 @@ var HtmlField = (props) => {
|
|
|
32437
32427
|
control: methods?.control,
|
|
32438
32428
|
defaultValue,
|
|
32439
32429
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
32440
|
-
|
|
32430
|
+
useEffect20(() => {
|
|
32441
32431
|
if (divRef.current && divRef.current.innerHTML !== value2) {
|
|
32442
32432
|
divRef.current.innerHTML = value2 || "";
|
|
32443
32433
|
}
|
|
@@ -32475,7 +32465,7 @@ var ImageField = (props) => {
|
|
|
32475
32465
|
};
|
|
32476
32466
|
|
|
32477
32467
|
// src/widgets/basic/many2many-tags-field/many2many-tags.tsx
|
|
32478
|
-
import React17, { useEffect as
|
|
32468
|
+
import React17, { useEffect as useEffect21, useMemo as useMemo11 } from "react";
|
|
32479
32469
|
|
|
32480
32470
|
// src/widgets/basic/information-field/information.tsx
|
|
32481
32471
|
import { Fragment as Fragment28, jsx as jsx98, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
@@ -32619,7 +32609,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32619
32609
|
},
|
|
32620
32610
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
32621
32611
|
const { clearErrors } = methods;
|
|
32622
|
-
|
|
32612
|
+
useEffect21(() => {
|
|
32623
32613
|
if (field.value) {
|
|
32624
32614
|
clearErrors(name);
|
|
32625
32615
|
}
|
|
@@ -32770,7 +32760,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32770
32760
|
};
|
|
32771
32761
|
|
|
32772
32762
|
// src/widgets/basic/monetary-field/monetary.tsx
|
|
32773
|
-
import { useEffect as
|
|
32763
|
+
import { useEffect as useEffect22 } from "react";
|
|
32774
32764
|
import { Fragment as Fragment29, jsx as jsx100, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
32775
32765
|
var MonetaryField = (props) => {
|
|
32776
32766
|
const { t: t3 } = useI18n();
|
|
@@ -32820,7 +32810,7 @@ var MonetaryField = (props) => {
|
|
|
32820
32810
|
fieldState: { error: error2 }
|
|
32821
32811
|
}) => {
|
|
32822
32812
|
const { setError, clearErrors } = methods;
|
|
32823
|
-
|
|
32813
|
+
useEffect22(() => {
|
|
32824
32814
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32825
32815
|
clearErrors(name);
|
|
32826
32816
|
}
|
|
@@ -32876,7 +32866,7 @@ var PaidBadgedField = () => {
|
|
|
32876
32866
|
};
|
|
32877
32867
|
|
|
32878
32868
|
// src/widgets/basic/priority-field/rating-star.tsx
|
|
32879
|
-
import React18, { useEffect as
|
|
32869
|
+
import React18, { useEffect as useEffect23, useState as useState21 } from "react";
|
|
32880
32870
|
import { jsx as jsx102, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
32881
32871
|
var RatingStarField = (props) => {
|
|
32882
32872
|
const {
|
|
@@ -32888,7 +32878,7 @@ var RatingStarField = (props) => {
|
|
|
32888
32878
|
} = props;
|
|
32889
32879
|
const [rating, setRating] = useState21(defaultValue);
|
|
32890
32880
|
const [hover, setHover] = useState21(0);
|
|
32891
|
-
|
|
32881
|
+
useEffect23(() => {
|
|
32892
32882
|
setRating(defaultValue);
|
|
32893
32883
|
}, [defaultValue]);
|
|
32894
32884
|
const handleClick = (value) => {
|
|
@@ -33003,7 +32993,7 @@ var PriorityField = (props) => {
|
|
|
33003
32993
|
};
|
|
33004
32994
|
|
|
33005
32995
|
// src/widgets/basic/radio-group-field/radio-group.tsx
|
|
33006
|
-
import { useEffect as
|
|
32996
|
+
import { useEffect as useEffect24 } from "react";
|
|
33007
32997
|
import { jsx as jsx104, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
33008
32998
|
var RadioGroupField = (props) => {
|
|
33009
32999
|
const {
|
|
@@ -33017,7 +33007,7 @@ var RadioGroupField = (props) => {
|
|
|
33017
33007
|
onChange: onChange2,
|
|
33018
33008
|
setValue
|
|
33019
33009
|
} = props;
|
|
33020
|
-
|
|
33010
|
+
useEffect24(() => {
|
|
33021
33011
|
if (selection?.length > 0) {
|
|
33022
33012
|
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
33023
33013
|
}
|
|
@@ -33323,7 +33313,7 @@ var ToggleButtonField = (props) => {
|
|
|
33323
33313
|
};
|
|
33324
33314
|
|
|
33325
33315
|
// src/widgets/basic/integer-field/integer.tsx
|
|
33326
|
-
import { useEffect as
|
|
33316
|
+
import { useEffect as useEffect25, useRef as useRef18, useState as useState22 } from "react";
|
|
33327
33317
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
33328
33318
|
var IntegerField = (props) => {
|
|
33329
33319
|
const {
|
|
@@ -33360,13 +33350,13 @@ var IntegerField = (props) => {
|
|
|
33360
33350
|
fieldState: { error: error2 }
|
|
33361
33351
|
}) => {
|
|
33362
33352
|
const { setError, clearErrors } = methods;
|
|
33363
|
-
const isDirtyRef =
|
|
33364
|
-
const inputRef =
|
|
33365
|
-
const lastCommittedValueRef =
|
|
33353
|
+
const isDirtyRef = useRef18(false);
|
|
33354
|
+
const inputRef = useRef18(null);
|
|
33355
|
+
const lastCommittedValueRef = useRef18(null);
|
|
33366
33356
|
const [inputValue, setInputValue] = useState22(
|
|
33367
33357
|
value2 !== void 0 && value2 !== null ? String(value2) : ""
|
|
33368
33358
|
);
|
|
33369
|
-
|
|
33359
|
+
useEffect25(() => {
|
|
33370
33360
|
if (value2 !== void 0 && value2 !== null) {
|
|
33371
33361
|
setInputValue(String(value2));
|
|
33372
33362
|
clearErrors(name);
|
|
@@ -33522,7 +33512,7 @@ var StatusDropdownField = (props) => {
|
|
|
33522
33512
|
|
|
33523
33513
|
// src/widgets/basic/many2many-field/many2many.tsx
|
|
33524
33514
|
import { createPortal as createPortal5 } from "react-dom";
|
|
33525
|
-
import { useEffect as
|
|
33515
|
+
import { useEffect as useEffect26 } from "react";
|
|
33526
33516
|
import { jsx as jsx111, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
33527
33517
|
var Many2ManyField = (props) => {
|
|
33528
33518
|
const { t: t3 } = useI18n();
|
|
@@ -33577,7 +33567,7 @@ var Many2ManyField = (props) => {
|
|
|
33577
33567
|
setGroupBy,
|
|
33578
33568
|
clearSearch
|
|
33579
33569
|
} = searchController;
|
|
33580
|
-
|
|
33570
|
+
useEffect26(() => {
|
|
33581
33571
|
const groupItems = Array.isArray(selectedTags) ? selectedTags.filter((item) => item.type === "group_by") : [];
|
|
33582
33572
|
if (groupItems?.length > 0) {
|
|
33583
33573
|
typeof setPageLimit === "function" && setPageLimit(80);
|
|
@@ -33732,7 +33722,7 @@ var Many2ManyField = (props) => {
|
|
|
33732
33722
|
};
|
|
33733
33723
|
|
|
33734
33724
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
33735
|
-
import React19, { useEffect as
|
|
33725
|
+
import React19, { useEffect as useEffect27, useState as useState23 } from "react";
|
|
33736
33726
|
import { Fragment as Fragment32, jsx as jsx112, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
33737
33727
|
var CustomMenuList2 = (props) => {
|
|
33738
33728
|
const { t: t3 } = useI18n();
|
|
@@ -33839,7 +33829,7 @@ var Many2OneField = (props) => {
|
|
|
33839
33829
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length ? options2.find(
|
|
33840
33830
|
(o3) => o3?.value === tempSelectedOption.value
|
|
33841
33831
|
) ?? currentValue : currentValue ?? null;
|
|
33842
|
-
|
|
33832
|
+
useEffect27(() => {
|
|
33843
33833
|
if (error2 && selectedOption) {
|
|
33844
33834
|
methods?.clearErrors(name);
|
|
33845
33835
|
}
|