@fctc/sme-widget-ui 2.9.5 → 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 +207 -226
- package/dist/index.mjs +268 -287
- 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 +207 -247
- package/dist/widgets.mjs +268 -308
- 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
|
|
@@ -12997,7 +12999,7 @@ var TableHead = (props) => {
|
|
|
12997
12999
|
return /* @__PURE__ */ jsx51(
|
|
12998
13000
|
"th",
|
|
12999
13001
|
{
|
|
13000
|
-
style: {
|
|
13002
|
+
style: { width: "100px" },
|
|
13001
13003
|
className: `column handle whitespace-nowrap text-left p-0 text-sm font-semibold capitalize text-[#060606]`
|
|
13002
13004
|
},
|
|
13003
13005
|
"table-head-" + index4
|
|
@@ -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,136 +16911,124 @@ 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 ? "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
17034
|
error2 && !isEditTable && /* @__PURE__ */ jsx75("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
@@ -17203,7 +17184,7 @@ var ButtonField = (props) => {
|
|
|
17203
17184
|
};
|
|
17204
17185
|
|
|
17205
17186
|
// src/widgets/basic/char-field/char.tsx
|
|
17206
|
-
import { useEffect as
|
|
17187
|
+
import { useEffect as useEffect10, useMemo as useMemo4 } from "react";
|
|
17207
17188
|
import { Fragment as Fragment18, jsx as jsx78, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
17208
17189
|
var WIDGET_AUTO_COMPUTE_DEPEND = "auto_compute_depend_field";
|
|
17209
17190
|
var CharField = (props) => {
|
|
@@ -17264,12 +17245,12 @@ var CharField = (props) => {
|
|
|
17264
17245
|
fieldState: { error: error2, isDirty }
|
|
17265
17246
|
}) => {
|
|
17266
17247
|
const { setError, clearErrors } = methods;
|
|
17267
|
-
|
|
17248
|
+
useEffect10(() => {
|
|
17268
17249
|
if (value2) {
|
|
17269
17250
|
clearErrors(name);
|
|
17270
17251
|
}
|
|
17271
17252
|
}, [value2, clearErrors, name]);
|
|
17272
|
-
|
|
17253
|
+
useEffect10(() => {
|
|
17273
17254
|
if (widget !== WIDGET_AUTO_COMPUTE_DEPEND) return;
|
|
17274
17255
|
const depValue = formValues?.[options2?.depend_field]?.[options2?.field_name];
|
|
17275
17256
|
const currentValue = methods?.getValues(name);
|
|
@@ -17358,7 +17339,7 @@ var CharField = (props) => {
|
|
|
17358
17339
|
};
|
|
17359
17340
|
|
|
17360
17341
|
// src/widgets/basic/char-field/secure-field.tsx
|
|
17361
|
-
import { useEffect as
|
|
17342
|
+
import { useEffect as useEffect11, useMemo as useMemo5, useState as useState11 } from "react";
|
|
17362
17343
|
|
|
17363
17344
|
// src/icons/eye-hidden-icon.tsx
|
|
17364
17345
|
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
@@ -17459,10 +17440,10 @@ var SecureField = (props) => {
|
|
|
17459
17440
|
const shouldMask = isSensitive(widget) && !showPlain;
|
|
17460
17441
|
const isCappedToken = widget === "access_token" || widget === "refresh_token";
|
|
17461
17442
|
const maskedDisplay = isCappedToken && shouldMask ? "\u2022".repeat(Math.min(realValue.length, 20)) : "";
|
|
17462
|
-
|
|
17443
|
+
useEffect11(() => {
|
|
17463
17444
|
if (canToggle) setShowPlain(false);
|
|
17464
17445
|
}, [canToggle]);
|
|
17465
|
-
|
|
17446
|
+
useEffect11(() => {
|
|
17466
17447
|
if (value2) clearErrors(name);
|
|
17467
17448
|
}, [value2, clearErrors, name]);
|
|
17468
17449
|
return /* @__PURE__ */ jsxs52("div", { className: `secure-widget relative w-full ${className ?? ""}`, children: [
|
|
@@ -17623,21 +17604,21 @@ var CheckboxField = (props) => {
|
|
|
17623
17604
|
};
|
|
17624
17605
|
|
|
17625
17606
|
// src/widgets/basic/color-field/color-wrapper.tsx
|
|
17626
|
-
import { useEffect as
|
|
17607
|
+
import { useEffect as useEffect12, useRef as useRef7, useState as useState12 } from "react";
|
|
17627
17608
|
import { Fragment as Fragment19, jsx as jsx82, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
17628
17609
|
var ColorWrapper = (props) => {
|
|
17629
17610
|
const { colors: colors2, defaultColor, savePickColor } = props;
|
|
17630
17611
|
const { t: t3 } = useI18n();
|
|
17631
17612
|
const [selectedColor, setSelectedColor] = useState12(colors2[defaultColor]);
|
|
17632
17613
|
const [showFullColors, setIsShowFullColor] = useState12(false);
|
|
17633
|
-
const pickColorsRef =
|
|
17634
|
-
|
|
17614
|
+
const pickColorsRef = useRef7(null);
|
|
17615
|
+
useEffect12(() => {
|
|
17635
17616
|
setSelectedColor(colors2[defaultColor]);
|
|
17636
17617
|
}, [defaultColor]);
|
|
17637
17618
|
const handleShowFullColors = () => {
|
|
17638
17619
|
setIsShowFullColor(!showFullColors);
|
|
17639
17620
|
};
|
|
17640
|
-
|
|
17621
|
+
useEffect12(() => {
|
|
17641
17622
|
const handleClickOutside = (event) => {
|
|
17642
17623
|
if (pickColorsRef.current && !pickColorsRef.current.contains(event.target)) {
|
|
17643
17624
|
setIsShowFullColor(false);
|
|
@@ -17728,7 +17709,7 @@ var ColorField = (props) => {
|
|
|
17728
17709
|
};
|
|
17729
17710
|
|
|
17730
17711
|
// src/widgets/basic/copy-link-buttton/copy-link.tsx
|
|
17731
|
-
import { useEffect as
|
|
17712
|
+
import { useEffect as useEffect13 } from "react";
|
|
17732
17713
|
import { jsx as jsx84, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
17733
17714
|
var CopyLinkButtonField = (props) => {
|
|
17734
17715
|
const {
|
|
@@ -17765,7 +17746,7 @@ var CopyLinkButtonField = (props) => {
|
|
|
17765
17746
|
fieldState: { error: error2 }
|
|
17766
17747
|
}) => {
|
|
17767
17748
|
const { setError, clearErrors } = methods;
|
|
17768
|
-
|
|
17749
|
+
useEffect13(() => {
|
|
17769
17750
|
if (value) {
|
|
17770
17751
|
clearErrors(name);
|
|
17771
17752
|
}
|
|
@@ -17838,10 +17819,10 @@ var CopyLinkButtonField = (props) => {
|
|
|
17838
17819
|
};
|
|
17839
17820
|
|
|
17840
17821
|
// src/widgets/basic/date-field/date.tsx
|
|
17841
|
-
import { forwardRef as forwardRef6, useEffect as
|
|
17822
|
+
import { forwardRef as forwardRef6, useEffect as useEffect17 } from "react";
|
|
17842
17823
|
|
|
17843
17824
|
// node_modules/react-datepicker/dist/index.es.js
|
|
17844
|
-
import React10, { useRef as
|
|
17825
|
+
import React10, { useRef as useRef11, useCallback as useCallback5, useEffect as useEffect15, cloneElement as cloneElement3, Component, createRef, createElement as createElement5 } from "react";
|
|
17845
17826
|
|
|
17846
17827
|
// node_modules/date-fns/constants.js
|
|
17847
17828
|
var daysInYear = 365.2425;
|
|
@@ -22411,8 +22392,8 @@ var CalendarContainer = function(_a2) {
|
|
|
22411
22392
|
return React10.createElement("div", { className, role: "dialog", "aria-label": ariaLabel, "aria-modal": "true" }, children);
|
|
22412
22393
|
};
|
|
22413
22394
|
var useDetectClickOutside = function(onClickOutside, ignoreClass) {
|
|
22414
|
-
var ref =
|
|
22415
|
-
var onClickOutsideRef =
|
|
22395
|
+
var ref = useRef11(null);
|
|
22396
|
+
var onClickOutsideRef = useRef11(onClickOutside);
|
|
22416
22397
|
onClickOutsideRef.current = onClickOutside;
|
|
22417
22398
|
var handleClickOutside = useCallback5(function(event) {
|
|
22418
22399
|
var _a2;
|
|
@@ -22425,7 +22406,7 @@ var useDetectClickOutside = function(onClickOutside, ignoreClass) {
|
|
|
22425
22406
|
}
|
|
22426
22407
|
}
|
|
22427
22408
|
}, [ignoreClass]);
|
|
22428
|
-
|
|
22409
|
+
useEffect15(function() {
|
|
22429
22410
|
document.addEventListener("mousedown", handleClickOutside);
|
|
22430
22411
|
return function() {
|
|
22431
22412
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
@@ -25666,7 +25647,7 @@ function withFloating(Component3) {
|
|
|
25666
25647
|
var WithFloating = function(props) {
|
|
25667
25648
|
var _a2;
|
|
25668
25649
|
var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
|
|
25669
|
-
var arrowRef =
|
|
25650
|
+
var arrowRef = useRef11(null);
|
|
25670
25651
|
var floatingProps = useFloating2(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
|
|
25671
25652
|
flip3({ padding: 15 }),
|
|
25672
25653
|
offset3(10),
|
|
@@ -26845,7 +26826,7 @@ function _toConsumableArray(r4) {
|
|
|
26845
26826
|
|
|
26846
26827
|
// node_modules/react-select/dist/Select-ef7c0426.esm.js
|
|
26847
26828
|
import * as React14 from "react";
|
|
26848
|
-
import { useMemo as useMemo9, Fragment as Fragment23, useRef as
|
|
26829
|
+
import { useMemo as useMemo9, Fragment as Fragment23, useRef as useRef14, useCallback as useCallback8, useEffect as useEffect16, Component as Component2 } from "react";
|
|
26849
26830
|
|
|
26850
26831
|
// node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
|
|
26851
26832
|
import * as React12 from "react";
|
|
@@ -28177,7 +28158,7 @@ function _taggedTemplateLiteral(e3, t3) {
|
|
|
28177
28158
|
}
|
|
28178
28159
|
|
|
28179
28160
|
// node_modules/react-select/dist/index-641ee5b8.esm.js
|
|
28180
|
-
import { useContext as useContext9, useRef as
|
|
28161
|
+
import { useContext as useContext9, useRef as useRef13, useState as useState16, useMemo as useMemo8, useCallback as useCallback7, createContext as createContext5 } from "react";
|
|
28181
28162
|
import { createPortal as createPortal4 } from "react-dom";
|
|
28182
28163
|
|
|
28183
28164
|
// node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
|
|
@@ -28523,7 +28504,7 @@ var PortalPlacementContext = /* @__PURE__ */ createContext5(null);
|
|
|
28523
28504
|
var MenuPlacer = function MenuPlacer2(props) {
|
|
28524
28505
|
var children = props.children, minMenuHeight = props.minMenuHeight, maxMenuHeight = props.maxMenuHeight, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition, menuShouldScrollIntoView = props.menuShouldScrollIntoView, theme = props.theme;
|
|
28525
28506
|
var _ref3 = useContext9(PortalPlacementContext) || {}, setPortalPlacement = _ref3.setPortalPlacement;
|
|
28526
|
-
var ref =
|
|
28507
|
+
var ref = useRef13(null);
|
|
28527
28508
|
var _useState = useState16(maxMenuHeight), _useState2 = _slicedToArray(_useState, 2), maxHeight = _useState2[0], setMaxHeight = _useState2[1];
|
|
28528
28509
|
var _useState3 = useState16(null), _useState4 = _slicedToArray(_useState3, 2), placement = _useState4[0], setPlacement = _useState4[1];
|
|
28529
28510
|
var controlHeight2 = theme.spacing.controlHeight;
|
|
@@ -28627,8 +28608,8 @@ var menuPortalCSS = function menuPortalCSS2(_ref8) {
|
|
|
28627
28608
|
};
|
|
28628
28609
|
var MenuPortal = function MenuPortal2(props) {
|
|
28629
28610
|
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 =
|
|
28611
|
+
var menuPortalRef = useRef13(null);
|
|
28612
|
+
var cleanupRef = useRef13(null);
|
|
28632
28613
|
var _useState5 = useState16(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
|
|
28633
28614
|
var portalPlacementContext = useMemo8(function() {
|
|
28634
28615
|
return {
|
|
@@ -29766,10 +29747,10 @@ var cancelScroll = function cancelScroll2(event) {
|
|
|
29766
29747
|
};
|
|
29767
29748
|
function useScrollCapture(_ref3) {
|
|
29768
29749
|
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 =
|
|
29750
|
+
var isBottom = useRef14(false);
|
|
29751
|
+
var isTop = useRef14(false);
|
|
29752
|
+
var touchStart = useRef14(0);
|
|
29753
|
+
var scrollTarget = useRef14(null);
|
|
29773
29754
|
var handleEventDelta = useCallback8(function(event, delta) {
|
|
29774
29755
|
if (scrollTarget.current === null) return;
|
|
29775
29756
|
var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight;
|
|
@@ -29829,7 +29810,7 @@ function useScrollCapture(_ref3) {
|
|
|
29829
29810
|
el.removeEventListener("touchstart", onTouchStart, false);
|
|
29830
29811
|
el.removeEventListener("touchmove", onTouchMove, false);
|
|
29831
29812
|
}, [onTouchMove, onTouchStart, onWheel]);
|
|
29832
|
-
|
|
29813
|
+
useEffect16(function() {
|
|
29833
29814
|
if (!isEnabled) return;
|
|
29834
29815
|
var element = scrollTarget.current;
|
|
29835
29816
|
startListening(element);
|
|
@@ -29876,8 +29857,8 @@ var listenerOptions = {
|
|
|
29876
29857
|
};
|
|
29877
29858
|
function useScrollLock(_ref3) {
|
|
29878
29859
|
var isEnabled = _ref3.isEnabled, _ref$accountForScroll = _ref3.accountForScrollbars, accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
|
|
29879
|
-
var originalStyles =
|
|
29880
|
-
var scrollTarget =
|
|
29860
|
+
var originalStyles = useRef14({});
|
|
29861
|
+
var scrollTarget = useRef14(null);
|
|
29881
29862
|
var addScrollLock = useCallback8(function(touchScrollTarget) {
|
|
29882
29863
|
if (!canUseDOM) return;
|
|
29883
29864
|
var target = document.body;
|
|
@@ -29932,7 +29913,7 @@ function useScrollLock(_ref3) {
|
|
|
29932
29913
|
}
|
|
29933
29914
|
}
|
|
29934
29915
|
}, [accountForScrollbars]);
|
|
29935
|
-
|
|
29916
|
+
useEffect16(function() {
|
|
29936
29917
|
if (!isEnabled) return;
|
|
29937
29918
|
var element = scrollTarget.current;
|
|
29938
29919
|
addScrollLock(element);
|
|
@@ -31651,7 +31632,7 @@ var DateField = (props) => {
|
|
|
31651
31632
|
},
|
|
31652
31633
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
31653
31634
|
const { setError, clearErrors } = methods;
|
|
31654
|
-
|
|
31635
|
+
useEffect17(() => {
|
|
31655
31636
|
if (value) {
|
|
31656
31637
|
clearErrors(name);
|
|
31657
31638
|
}
|
|
@@ -32006,7 +31987,7 @@ var FeeField = (props) => {
|
|
|
32006
31987
|
};
|
|
32007
31988
|
|
|
32008
31989
|
// src/widgets/basic/file-upload-field/file-upload.tsx
|
|
32009
|
-
import { useEffect as
|
|
31990
|
+
import { useEffect as useEffect18, useRef as useRef15, useState as useState18 } from "react";
|
|
32010
31991
|
import { jsx as jsx93, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
32011
31992
|
var RenderFile = ({
|
|
32012
31993
|
file,
|
|
@@ -32071,10 +32052,10 @@ var FileUploadField = (props) => {
|
|
|
32071
32052
|
downloadFunction
|
|
32072
32053
|
} = props;
|
|
32073
32054
|
const { t: t3 } = useI18n();
|
|
32074
|
-
const fileInputRef =
|
|
32055
|
+
const fileInputRef = useRef15(null);
|
|
32075
32056
|
const [selectedFiles, setSelectedFiles] = useState18([]);
|
|
32076
32057
|
const [uploadError, setUploadError] = useState18();
|
|
32077
|
-
|
|
32058
|
+
useEffect18(() => {
|
|
32078
32059
|
if (selectedFiles?.length === 0 && value) {
|
|
32079
32060
|
setSelectedFiles([
|
|
32080
32061
|
{
|
|
@@ -32092,7 +32073,7 @@ var FileUploadField = (props) => {
|
|
|
32092
32073
|
required: required ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
32093
32074
|
},
|
|
32094
32075
|
render: ({ field: { onChange: onChange2 }, fieldState: { error: error2 } }) => {
|
|
32095
|
-
|
|
32076
|
+
useEffect18(() => {
|
|
32096
32077
|
let data = widget === "many2many_binary" ? selectedFiles : selectedFiles?.[0]?.data;
|
|
32097
32078
|
if (widget !== "many2many_binary" && data && isBase64File(data)) {
|
|
32098
32079
|
data = data.split(",")[1];
|
|
@@ -32148,7 +32129,7 @@ var FileUploadField = (props) => {
|
|
|
32148
32129
|
};
|
|
32149
32130
|
|
|
32150
32131
|
// src/widgets/basic/float-field/float.tsx
|
|
32151
|
-
import { useEffect as
|
|
32132
|
+
import { useEffect as useEffect19, useRef as useRef16, useState as useState19 } from "react";
|
|
32152
32133
|
import { Fragment as Fragment26, jsx as jsx94, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
32153
32134
|
var FloatField = (props) => {
|
|
32154
32135
|
const {
|
|
@@ -32184,9 +32165,9 @@ var FloatField = (props) => {
|
|
|
32184
32165
|
const [inputValue, setInputValue] = useState19(
|
|
32185
32166
|
value !== void 0 && value !== null ? formatFloatNumber(value) : ""
|
|
32186
32167
|
);
|
|
32187
|
-
const isDirtyRef =
|
|
32188
|
-
const lastCommittedValueRef =
|
|
32189
|
-
|
|
32168
|
+
const isDirtyRef = useRef16(false);
|
|
32169
|
+
const lastCommittedValueRef = useRef16(null);
|
|
32170
|
+
useEffect19(() => {
|
|
32190
32171
|
if (isDirtyRef.current) return;
|
|
32191
32172
|
const numericInput = parseFloat(inputValue?.replace(/,/g, ""));
|
|
32192
32173
|
if (propValue !== void 0 && propValue !== null && !Number.isNaN(propValue) && propValue !== numericInput) {
|
|
@@ -32412,7 +32393,7 @@ var FloatTimeField = (props) => {
|
|
|
32412
32393
|
};
|
|
32413
32394
|
|
|
32414
32395
|
// src/widgets/basic/html-field/html.tsx
|
|
32415
|
-
import { useEffect as
|
|
32396
|
+
import { useEffect as useEffect20, useRef as useRef17 } from "react";
|
|
32416
32397
|
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
32417
32398
|
var HtmlField = (props) => {
|
|
32418
32399
|
const {
|
|
@@ -32426,7 +32407,7 @@ var HtmlField = (props) => {
|
|
|
32426
32407
|
isEditTable,
|
|
32427
32408
|
baseClassName
|
|
32428
32409
|
} = props;
|
|
32429
|
-
const divRef =
|
|
32410
|
+
const divRef = useRef17(null);
|
|
32430
32411
|
if (!isForm && !isEditTable) {
|
|
32431
32412
|
return /* @__PURE__ */ jsx96("div", { dangerouslySetInnerHTML: { __html: value || defaultValue || "" } });
|
|
32432
32413
|
}
|
|
@@ -32437,7 +32418,7 @@ var HtmlField = (props) => {
|
|
|
32437
32418
|
control: methods?.control,
|
|
32438
32419
|
defaultValue,
|
|
32439
32420
|
render: ({ field: { onChange: fieldOnChange, value: value2 } }) => {
|
|
32440
|
-
|
|
32421
|
+
useEffect20(() => {
|
|
32441
32422
|
if (divRef.current && divRef.current.innerHTML !== value2) {
|
|
32442
32423
|
divRef.current.innerHTML = value2 || "";
|
|
32443
32424
|
}
|
|
@@ -32475,7 +32456,7 @@ var ImageField = (props) => {
|
|
|
32475
32456
|
};
|
|
32476
32457
|
|
|
32477
32458
|
// src/widgets/basic/many2many-tags-field/many2many-tags.tsx
|
|
32478
|
-
import React17, { useEffect as
|
|
32459
|
+
import React17, { useEffect as useEffect21, useMemo as useMemo11 } from "react";
|
|
32479
32460
|
|
|
32480
32461
|
// src/widgets/basic/information-field/information.tsx
|
|
32481
32462
|
import { Fragment as Fragment28, jsx as jsx98, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
@@ -32519,7 +32500,7 @@ var CustomMultiValue = ({ stringToColor, ...props }) => {
|
|
|
32519
32500
|
(childItem) => childItem?.is_display && childItem?.action?.res_model === relation
|
|
32520
32501
|
)
|
|
32521
32502
|
)?.[0]?.action?.id;
|
|
32522
|
-
return /* @__PURE__ */ jsxs65("div", { className: "flex items-center gap-2 relative
|
|
32503
|
+
return /* @__PURE__ */ jsxs65("div", { className: "flex items-center gap-2 mr-2 relative border-[1px] border-solid border-[rgba(66,66,66,0.12)] py-1 px-2 rounded", children: [
|
|
32523
32504
|
/* @__PURE__ */ jsx99(
|
|
32524
32505
|
AvatarField,
|
|
32525
32506
|
{
|
|
@@ -32534,9 +32515,10 @@ var CustomMultiValue = ({ stringToColor, ...props }) => {
|
|
|
32534
32515
|
),
|
|
32535
32516
|
/* @__PURE__ */ jsx99("span", { className: "capitalize", children: data?.label ?? data?.display_name }),
|
|
32536
32517
|
/* @__PURE__ */ jsx99(
|
|
32537
|
-
"
|
|
32518
|
+
"button",
|
|
32538
32519
|
{
|
|
32539
|
-
|
|
32520
|
+
type: "button",
|
|
32521
|
+
className: "ml-1 flex items-center justify-center rounded-full !cursor-pointer",
|
|
32540
32522
|
onClick: (e3) => {
|
|
32541
32523
|
e3.stopPropagation();
|
|
32542
32524
|
props.removeProps.onClick();
|
|
@@ -32569,7 +32551,6 @@ var CustomMenuList = (props) => {
|
|
|
32569
32551
|
};
|
|
32570
32552
|
var Many2ManyTagField = (props) => {
|
|
32571
32553
|
const {
|
|
32572
|
-
relation,
|
|
32573
32554
|
value,
|
|
32574
32555
|
name,
|
|
32575
32556
|
methods,
|
|
@@ -32619,7 +32600,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32619
32600
|
},
|
|
32620
32601
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
32621
32602
|
const { clearErrors } = methods;
|
|
32622
|
-
|
|
32603
|
+
useEffect21(() => {
|
|
32623
32604
|
if (field.value) {
|
|
32624
32605
|
clearErrors(name);
|
|
32625
32606
|
}
|
|
@@ -32682,7 +32663,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32682
32663
|
dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
|
|
32683
32664
|
clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
|
|
32684
32665
|
} : {
|
|
32685
|
-
valueContainer: () => "overflow-unset !m-0 !p-0",
|
|
32666
|
+
valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
|
|
32686
32667
|
control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
|
|
32687
32668
|
singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
|
|
32688
32669
|
input: () => "!m-0 !p-0",
|
|
@@ -32770,7 +32751,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32770
32751
|
};
|
|
32771
32752
|
|
|
32772
32753
|
// src/widgets/basic/monetary-field/monetary.tsx
|
|
32773
|
-
import { useEffect as
|
|
32754
|
+
import { useEffect as useEffect22 } from "react";
|
|
32774
32755
|
import { Fragment as Fragment29, jsx as jsx100, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
32775
32756
|
var MonetaryField = (props) => {
|
|
32776
32757
|
const { t: t3 } = useI18n();
|
|
@@ -32820,7 +32801,7 @@ var MonetaryField = (props) => {
|
|
|
32820
32801
|
fieldState: { error: error2 }
|
|
32821
32802
|
}) => {
|
|
32822
32803
|
const { setError, clearErrors } = methods;
|
|
32823
|
-
|
|
32804
|
+
useEffect22(() => {
|
|
32824
32805
|
if (value2 !== void 0 && value2 !== null && !isNaN(value2)) {
|
|
32825
32806
|
clearErrors(name);
|
|
32826
32807
|
}
|
|
@@ -32876,7 +32857,7 @@ var PaidBadgedField = () => {
|
|
|
32876
32857
|
};
|
|
32877
32858
|
|
|
32878
32859
|
// src/widgets/basic/priority-field/rating-star.tsx
|
|
32879
|
-
import React18, { useEffect as
|
|
32860
|
+
import React18, { useEffect as useEffect23, useState as useState21 } from "react";
|
|
32880
32861
|
import { jsx as jsx102, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
32881
32862
|
var RatingStarField = (props) => {
|
|
32882
32863
|
const {
|
|
@@ -32888,7 +32869,7 @@ var RatingStarField = (props) => {
|
|
|
32888
32869
|
} = props;
|
|
32889
32870
|
const [rating, setRating] = useState21(defaultValue);
|
|
32890
32871
|
const [hover, setHover] = useState21(0);
|
|
32891
|
-
|
|
32872
|
+
useEffect23(() => {
|
|
32892
32873
|
setRating(defaultValue);
|
|
32893
32874
|
}, [defaultValue]);
|
|
32894
32875
|
const handleClick = (value) => {
|
|
@@ -33003,7 +32984,7 @@ var PriorityField = (props) => {
|
|
|
33003
32984
|
};
|
|
33004
32985
|
|
|
33005
32986
|
// src/widgets/basic/radio-group-field/radio-group.tsx
|
|
33006
|
-
import { useEffect as
|
|
32987
|
+
import { useEffect as useEffect24 } from "react";
|
|
33007
32988
|
import { jsx as jsx104, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
33008
32989
|
var RadioGroupField = (props) => {
|
|
33009
32990
|
const {
|
|
@@ -33017,7 +32998,7 @@ var RadioGroupField = (props) => {
|
|
|
33017
32998
|
onChange: onChange2,
|
|
33018
32999
|
setValue
|
|
33019
33000
|
} = props;
|
|
33020
|
-
|
|
33001
|
+
useEffect24(() => {
|
|
33021
33002
|
if (selection?.length > 0) {
|
|
33022
33003
|
if (setValue) setValue(name, selection?.[0]?.[0]);
|
|
33023
33004
|
}
|
|
@@ -33323,7 +33304,7 @@ var ToggleButtonField = (props) => {
|
|
|
33323
33304
|
};
|
|
33324
33305
|
|
|
33325
33306
|
// src/widgets/basic/integer-field/integer.tsx
|
|
33326
|
-
import { useEffect as
|
|
33307
|
+
import { useEffect as useEffect25, useRef as useRef18, useState as useState22 } from "react";
|
|
33327
33308
|
import { Fragment as Fragment31, jsx as jsx109, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
33328
33309
|
var IntegerField = (props) => {
|
|
33329
33310
|
const {
|
|
@@ -33360,13 +33341,13 @@ var IntegerField = (props) => {
|
|
|
33360
33341
|
fieldState: { error: error2 }
|
|
33361
33342
|
}) => {
|
|
33362
33343
|
const { setError, clearErrors } = methods;
|
|
33363
|
-
const isDirtyRef =
|
|
33364
|
-
const inputRef =
|
|
33365
|
-
const lastCommittedValueRef =
|
|
33344
|
+
const isDirtyRef = useRef18(false);
|
|
33345
|
+
const inputRef = useRef18(null);
|
|
33346
|
+
const lastCommittedValueRef = useRef18(null);
|
|
33366
33347
|
const [inputValue, setInputValue] = useState22(
|
|
33367
33348
|
value2 !== void 0 && value2 !== null ? String(value2) : ""
|
|
33368
33349
|
);
|
|
33369
|
-
|
|
33350
|
+
useEffect25(() => {
|
|
33370
33351
|
if (value2 !== void 0 && value2 !== null) {
|
|
33371
33352
|
setInputValue(String(value2));
|
|
33372
33353
|
clearErrors(name);
|
|
@@ -33522,7 +33503,7 @@ var StatusDropdownField = (props) => {
|
|
|
33522
33503
|
|
|
33523
33504
|
// src/widgets/basic/many2many-field/many2many.tsx
|
|
33524
33505
|
import { createPortal as createPortal5 } from "react-dom";
|
|
33525
|
-
import { useEffect as
|
|
33506
|
+
import { useEffect as useEffect26 } from "react";
|
|
33526
33507
|
import { jsx as jsx111, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
33527
33508
|
var Many2ManyField = (props) => {
|
|
33528
33509
|
const { t: t3 } = useI18n();
|
|
@@ -33577,7 +33558,7 @@ var Many2ManyField = (props) => {
|
|
|
33577
33558
|
setGroupBy,
|
|
33578
33559
|
clearSearch
|
|
33579
33560
|
} = searchController;
|
|
33580
|
-
|
|
33561
|
+
useEffect26(() => {
|
|
33581
33562
|
const groupItems = Array.isArray(selectedTags) ? selectedTags.filter((item) => item.type === "group_by") : [];
|
|
33582
33563
|
if (groupItems?.length > 0) {
|
|
33583
33564
|
typeof setPageLimit === "function" && setPageLimit(80);
|
|
@@ -33732,7 +33713,7 @@ var Many2ManyField = (props) => {
|
|
|
33732
33713
|
};
|
|
33733
33714
|
|
|
33734
33715
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
33735
|
-
import React19, { useEffect as
|
|
33716
|
+
import React19, { useEffect as useEffect27, useState as useState23 } from "react";
|
|
33736
33717
|
import { Fragment as Fragment32, jsx as jsx112, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
33737
33718
|
var CustomMenuList2 = (props) => {
|
|
33738
33719
|
const { t: t3 } = useI18n();
|
|
@@ -33839,7 +33820,7 @@ var Many2OneField = (props) => {
|
|
|
33839
33820
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length ? options2.find(
|
|
33840
33821
|
(o3) => o3?.value === tempSelectedOption.value
|
|
33841
33822
|
) ?? currentValue : currentValue ?? null;
|
|
33842
|
-
|
|
33823
|
+
useEffect27(() => {
|
|
33843
33824
|
if (error2 && selectedOption) {
|
|
33844
33825
|
methods?.clearErrors(name);
|
|
33845
33826
|
}
|