@fctc/widget-logic 1.9.1 → 1.9.3
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +103 -316
- package/dist/index.mjs +81 -297
- package/dist/widget.d.mts +1 -28
- package/dist/widget.d.ts +1 -28
- package/dist/widget.js +103 -316
- package/dist/widget.mjs +81 -295
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4061,8 +4061,6 @@ __export(index_exports, {
|
|
|
4061
4061
|
downLoadBinaryController: () => downLoadBinaryController,
|
|
4062
4062
|
downloadFileController: () => downloadFileController,
|
|
4063
4063
|
durationController: () => durationController,
|
|
4064
|
-
floatController: () => floatController,
|
|
4065
|
-
floatTimeFiledController: () => floatTimeFiledController,
|
|
4066
4064
|
getDateRange: () => getDateRange,
|
|
4067
4065
|
languages: () => languages,
|
|
4068
4066
|
many2manyFieldController: () => many2manyFieldController,
|
|
@@ -5829,98 +5827,63 @@ var priorityFieldController = (props) => {
|
|
|
5829
5827
|
};
|
|
5830
5828
|
};
|
|
5831
5829
|
|
|
5832
|
-
// src/widget/basic/
|
|
5833
|
-
import { useState as useState10 } from "react";
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
onChange: fieldOnChange,
|
|
5840
|
-
onBlur,
|
|
5841
|
-
value,
|
|
5842
|
-
isDirty,
|
|
5843
|
-
props
|
|
5844
|
-
}) => {
|
|
5845
|
-
const { name, defaultValue = 0, onChange } = props;
|
|
5846
|
-
const [input, setInput] = useState10(
|
|
5847
|
-
convertFloatToTime(value ?? defaultValue)
|
|
5848
|
-
);
|
|
5849
|
-
const [formattedTime, setFormattedTime] = useState10("");
|
|
5850
|
-
const [errors, setErrors] = useState10("");
|
|
5851
|
-
const handleInputChange = (e) => {
|
|
5852
|
-
const raw = e.target.value.replace(/[^\d:]/g, "");
|
|
5853
|
-
setInput(raw);
|
|
5854
|
-
const timeRegex = /^(\d{1,2}):?(\d{0,2})$/;
|
|
5855
|
-
const match = raw.match(timeRegex);
|
|
5856
|
-
if (!match) {
|
|
5857
|
-
setErrors("\u0110\u1ECBnh d\u1EA1ng kh\xF4ng h\u1EE3p l\u1EC7");
|
|
5858
|
-
setFormattedTime("");
|
|
5859
|
-
return;
|
|
5860
|
-
}
|
|
5861
|
-
let hours = parseInt(match[1] ?? "0", 10);
|
|
5862
|
-
let minutes = parseInt(match[2] ?? "0", 10);
|
|
5863
|
-
if (isNaN(hours)) hours = 0;
|
|
5864
|
-
if (isNaN(minutes)) minutes = 0;
|
|
5865
|
-
if (hours >= 24) {
|
|
5866
|
-
hours = 0;
|
|
5867
|
-
}
|
|
5868
|
-
if (minutes >= 60) {
|
|
5869
|
-
minutes = 0;
|
|
5870
|
-
}
|
|
5871
|
-
const formatted = `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
|
|
5872
|
-
setErrors("");
|
|
5873
|
-
setFormattedTime(formatted);
|
|
5874
|
-
fieldOnChange(formatted);
|
|
5830
|
+
// src/widget/basic/download-file-field/controller.ts
|
|
5831
|
+
import { useId, useState as useState10 } from "react";
|
|
5832
|
+
var downloadFileController = () => {
|
|
5833
|
+
const inputId = useId();
|
|
5834
|
+
const [file, setFile] = useState10(null);
|
|
5835
|
+
const handleFileChange = (e) => {
|
|
5836
|
+
setFile(e.target.files[0]);
|
|
5875
5837
|
};
|
|
5876
|
-
const
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
}
|
|
5885
|
-
} else {
|
|
5886
|
-
setInput("00:00");
|
|
5887
|
-
fieldOnChange(0);
|
|
5888
|
-
if (onChange) {
|
|
5889
|
-
onChange(name ?? "", 0);
|
|
5890
|
-
}
|
|
5891
|
-
setErrors("");
|
|
5892
|
-
}
|
|
5893
|
-
onBlur();
|
|
5838
|
+
const handleFileDownload = () => {
|
|
5839
|
+
const url = URL.createObjectURL(file);
|
|
5840
|
+
const link = document.createElement("a");
|
|
5841
|
+
link.href = url;
|
|
5842
|
+
link.download = file.name;
|
|
5843
|
+
document.body.appendChild(link);
|
|
5844
|
+
link.click();
|
|
5845
|
+
document.body.removeChild(link);
|
|
5894
5846
|
};
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5847
|
+
return {
|
|
5848
|
+
inputId,
|
|
5849
|
+
file,
|
|
5850
|
+
handleFileChange,
|
|
5851
|
+
handleFileDownload
|
|
5852
|
+
};
|
|
5853
|
+
};
|
|
5854
|
+
|
|
5855
|
+
// src/widget/basic/download-binary-field/controller.ts
|
|
5856
|
+
var downLoadBinaryController = (props) => {
|
|
5857
|
+
const { value, defaultValue, formValues } = props;
|
|
5858
|
+
const handleFileDownload = async (e) => {
|
|
5859
|
+
e.stopPropagation();
|
|
5860
|
+
await downloadFile(value || defaultValue, formValues?.name);
|
|
5861
|
+
};
|
|
5862
|
+
const downloadFile = async (url, filename) => {
|
|
5863
|
+
try {
|
|
5864
|
+
const response = await fetch(url);
|
|
5865
|
+
if (response) {
|
|
5866
|
+
const blob = await response.blob();
|
|
5867
|
+
const urlBlob = window.URL.createObjectURL(blob);
|
|
5868
|
+
const link = document.createElement("a");
|
|
5869
|
+
link.href = urlBlob;
|
|
5870
|
+
link.download = filename || "downloaded-file";
|
|
5871
|
+
document.body.appendChild(link);
|
|
5872
|
+
link.click();
|
|
5873
|
+
document.body.removeChild(link);
|
|
5874
|
+
window.URL.revokeObjectURL(urlBlob);
|
|
5910
5875
|
}
|
|
5876
|
+
} catch (error) {
|
|
5877
|
+
console.error("File download failed:", error);
|
|
5911
5878
|
}
|
|
5912
5879
|
};
|
|
5913
5880
|
return {
|
|
5914
|
-
|
|
5915
|
-
handleBlur,
|
|
5916
|
-
handleKeyDown,
|
|
5917
|
-
input,
|
|
5918
|
-
errors
|
|
5881
|
+
handleFileDownload
|
|
5919
5882
|
};
|
|
5920
5883
|
};
|
|
5921
5884
|
|
|
5922
|
-
// src/widget/basic/
|
|
5923
|
-
|
|
5885
|
+
// src/widget/basic/date-field/controller.ts
|
|
5886
|
+
var import_moment = __toESM(require_moment());
|
|
5924
5887
|
|
|
5925
5888
|
// src/utils/i18n.ts
|
|
5926
5889
|
import { initReactI18next } from "react-i18next";
|
|
@@ -6688,184 +6651,7 @@ i18n.use(LanguageDetector).use(initReactI18next).init({
|
|
|
6688
6651
|
});
|
|
6689
6652
|
var i18n_default = i18n;
|
|
6690
6653
|
|
|
6691
|
-
// src/widget/basic/float-field/controller.ts
|
|
6692
|
-
var floatController = ({
|
|
6693
|
-
onChange,
|
|
6694
|
-
value,
|
|
6695
|
-
props
|
|
6696
|
-
}) => {
|
|
6697
|
-
const { name, required, methods, onChange: handleOnchange, string } = props;
|
|
6698
|
-
const { setError, clearErrors } = methods;
|
|
6699
|
-
const [inputValue, setInputValue] = useState11(
|
|
6700
|
-
value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
|
|
6701
|
-
);
|
|
6702
|
-
useEffect12(() => {
|
|
6703
|
-
if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
|
|
6704
|
-
setInputValue(useFormatFloatNumber(value));
|
|
6705
|
-
clearErrors(name);
|
|
6706
|
-
} else if (value === null || value === void 0) {
|
|
6707
|
-
setInputValue("");
|
|
6708
|
-
}
|
|
6709
|
-
}, [value, name, clearErrors]);
|
|
6710
|
-
const isDirtyRef = useRef4(false);
|
|
6711
|
-
const inputRef = useRef4(null);
|
|
6712
|
-
const lastCommittedValueRef = useRef4(null);
|
|
6713
|
-
const handleInputChange = (e) => {
|
|
6714
|
-
const newValue = e.target.value;
|
|
6715
|
-
const valueWithoutCommas = newValue.replace(/,/g, "");
|
|
6716
|
-
if (/^[0-9]*[.,]?[0-9]*$/.test(valueWithoutCommas) || newValue === "") {
|
|
6717
|
-
const parts = valueWithoutCommas.split(".");
|
|
6718
|
-
let integerPart = parts[0] || "";
|
|
6719
|
-
const decimalPart = parts[1] || "";
|
|
6720
|
-
if (decimalPart.length > 100) return;
|
|
6721
|
-
if (integerPart) {
|
|
6722
|
-
integerPart = Number(integerPart).toLocaleString("en-US");
|
|
6723
|
-
}
|
|
6724
|
-
const formattedValue = decimalPart ? `${integerPart}.${decimalPart}` : integerPart;
|
|
6725
|
-
setInputValue(formattedValue);
|
|
6726
|
-
const parsedValue = parseFloat(valueWithoutCommas.replace(",", "."));
|
|
6727
|
-
if (!isNaN(parsedValue)) {
|
|
6728
|
-
if (parsedValue < 0) {
|
|
6729
|
-
setError(name, {
|
|
6730
|
-
type: "validate",
|
|
6731
|
-
message: i18n_default.t("invalid_number")
|
|
6732
|
-
});
|
|
6733
|
-
} else {
|
|
6734
|
-
onChange(parsedValue);
|
|
6735
|
-
clearErrors(name);
|
|
6736
|
-
isDirtyRef.current = true;
|
|
6737
|
-
}
|
|
6738
|
-
} else {
|
|
6739
|
-
onChange(null);
|
|
6740
|
-
clearErrors(name);
|
|
6741
|
-
}
|
|
6742
|
-
}
|
|
6743
|
-
};
|
|
6744
|
-
const handleInputMouseLeave = () => {
|
|
6745
|
-
if (!isDirtyRef.current) {
|
|
6746
|
-
inputRef.current?.blur();
|
|
6747
|
-
return;
|
|
6748
|
-
}
|
|
6749
|
-
const rawValue = inputValue.replace(/,/g, "");
|
|
6750
|
-
const parsedValue = parseFloat(rawValue);
|
|
6751
|
-
if (rawValue === "" || rawValue === ".") {
|
|
6752
|
-
if (required) {
|
|
6753
|
-
setError(name, {
|
|
6754
|
-
type: "required",
|
|
6755
|
-
message: `${string} ${i18n_default.t("must_required")}`
|
|
6756
|
-
});
|
|
6757
|
-
}
|
|
6758
|
-
onChange(null);
|
|
6759
|
-
setInputValue("");
|
|
6760
|
-
lastCommittedValueRef.current = null;
|
|
6761
|
-
} else if (!isNaN(parsedValue)) {
|
|
6762
|
-
if (parsedValue < 0) {
|
|
6763
|
-
setError(name, {
|
|
6764
|
-
type: "validate",
|
|
6765
|
-
message: i18n_default.t("invalid_number")
|
|
6766
|
-
});
|
|
6767
|
-
setInputValue("");
|
|
6768
|
-
lastCommittedValueRef.current = null;
|
|
6769
|
-
} else {
|
|
6770
|
-
if (lastCommittedValueRef.current !== parsedValue) {
|
|
6771
|
-
const parts = rawValue.split(".");
|
|
6772
|
-
let integerPart = parts[0];
|
|
6773
|
-
const decimalPart = parts[1] || "";
|
|
6774
|
-
integerPart = Number(integerPart).toLocaleString("en-US");
|
|
6775
|
-
const formattedValue = decimalPart ? `${integerPart}.${decimalPart}` : integerPart;
|
|
6776
|
-
onChange(parsedValue);
|
|
6777
|
-
setInputValue(formattedValue);
|
|
6778
|
-
handleOnchange?.(name ?? "", parsedValue);
|
|
6779
|
-
clearErrors(name);
|
|
6780
|
-
lastCommittedValueRef.current = parsedValue;
|
|
6781
|
-
}
|
|
6782
|
-
}
|
|
6783
|
-
} else {
|
|
6784
|
-
setError(name, {
|
|
6785
|
-
type: "validate",
|
|
6786
|
-
message: i18n_default.t("invalid_number")
|
|
6787
|
-
});
|
|
6788
|
-
setInputValue("");
|
|
6789
|
-
lastCommittedValueRef.current = null;
|
|
6790
|
-
}
|
|
6791
|
-
isDirtyRef.current = false;
|
|
6792
|
-
inputRef.current?.blur();
|
|
6793
|
-
};
|
|
6794
|
-
return {
|
|
6795
|
-
handleInputMouseLeave,
|
|
6796
|
-
handleInputChange,
|
|
6797
|
-
useFormatFloatNumber,
|
|
6798
|
-
inputRef,
|
|
6799
|
-
inputValue
|
|
6800
|
-
};
|
|
6801
|
-
};
|
|
6802
|
-
var useFormatFloatNumber = (value) => {
|
|
6803
|
-
if (value === void 0 || value === null || value === "") return "";
|
|
6804
|
-
const numValue = typeof value === "string" ? parseFloat(value.replace(/,/g, "")) : value;
|
|
6805
|
-
if (isNaN(numValue)) return "";
|
|
6806
|
-
return numValue.toLocaleString("en-US", {
|
|
6807
|
-
minimumFractionDigits: numValue % 1 === 0 ? 0 : 1,
|
|
6808
|
-
maximumFractionDigits: 20
|
|
6809
|
-
});
|
|
6810
|
-
};
|
|
6811
|
-
|
|
6812
|
-
// src/widget/basic/download-file-field/controller.ts
|
|
6813
|
-
import { useId, useState as useState12 } from "react";
|
|
6814
|
-
var downloadFileController = () => {
|
|
6815
|
-
const inputId = useId();
|
|
6816
|
-
const [file, setFile] = useState12(null);
|
|
6817
|
-
const handleFileChange = (e) => {
|
|
6818
|
-
setFile(e.target.files[0]);
|
|
6819
|
-
};
|
|
6820
|
-
const handleFileDownload = () => {
|
|
6821
|
-
const url = URL.createObjectURL(file);
|
|
6822
|
-
const link = document.createElement("a");
|
|
6823
|
-
link.href = url;
|
|
6824
|
-
link.download = file.name;
|
|
6825
|
-
document.body.appendChild(link);
|
|
6826
|
-
link.click();
|
|
6827
|
-
document.body.removeChild(link);
|
|
6828
|
-
};
|
|
6829
|
-
return {
|
|
6830
|
-
inputId,
|
|
6831
|
-
file,
|
|
6832
|
-
handleFileChange,
|
|
6833
|
-
handleFileDownload
|
|
6834
|
-
};
|
|
6835
|
-
};
|
|
6836
|
-
|
|
6837
|
-
// src/widget/basic/download-binary-field/controller.ts
|
|
6838
|
-
var downLoadBinaryController = (props) => {
|
|
6839
|
-
const { value, defaultValue, formValues } = props;
|
|
6840
|
-
const handleFileDownload = async (e) => {
|
|
6841
|
-
e.stopPropagation();
|
|
6842
|
-
await downloadFile(value || defaultValue, formValues?.name);
|
|
6843
|
-
};
|
|
6844
|
-
const downloadFile = async (url, filename) => {
|
|
6845
|
-
try {
|
|
6846
|
-
const response = await fetch(url);
|
|
6847
|
-
if (response) {
|
|
6848
|
-
const blob = await response.blob();
|
|
6849
|
-
const urlBlob = window.URL.createObjectURL(blob);
|
|
6850
|
-
const link = document.createElement("a");
|
|
6851
|
-
link.href = urlBlob;
|
|
6852
|
-
link.download = filename || "downloaded-file";
|
|
6853
|
-
document.body.appendChild(link);
|
|
6854
|
-
link.click();
|
|
6855
|
-
document.body.removeChild(link);
|
|
6856
|
-
window.URL.revokeObjectURL(urlBlob);
|
|
6857
|
-
}
|
|
6858
|
-
} catch (error) {
|
|
6859
|
-
console.error("File download failed:", error);
|
|
6860
|
-
}
|
|
6861
|
-
};
|
|
6862
|
-
return {
|
|
6863
|
-
handleFileDownload
|
|
6864
|
-
};
|
|
6865
|
-
};
|
|
6866
|
-
|
|
6867
6654
|
// src/widget/basic/date-field/controller.ts
|
|
6868
|
-
var import_moment = __toESM(require_moment());
|
|
6869
6655
|
var DURATIONS = {
|
|
6870
6656
|
PAST: "past",
|
|
6871
6657
|
NOW: "now",
|
|
@@ -6977,11 +6763,11 @@ var dateFieldController = (props) => {
|
|
|
6977
6763
|
};
|
|
6978
6764
|
|
|
6979
6765
|
// src/widget/basic/copy-link-button/controller.ts
|
|
6980
|
-
import { useState as
|
|
6766
|
+
import { useState as useState11 } from "react";
|
|
6981
6767
|
import { copyTextToClipboard } from "@fctc/interface-logic/utils";
|
|
6982
6768
|
var copyLinkButtonController = (props) => {
|
|
6983
6769
|
const { value, defaultValue } = props;
|
|
6984
|
-
const [isCopied, setIsCopied] =
|
|
6770
|
+
const [isCopied, setIsCopied] = useState11(false);
|
|
6985
6771
|
const handleCopyToClipboard = async (value2) => {
|
|
6986
6772
|
await copyTextToClipboard(value2);
|
|
6987
6773
|
setIsCopied(true);
|
|
@@ -7011,8 +6797,8 @@ var colorFieldController = (props) => {
|
|
|
7011
6797
|
try {
|
|
7012
6798
|
onSave({
|
|
7013
6799
|
ids: idDefault !== null ? [idDefault] : [],
|
|
7014
|
-
model: model
|
|
7015
|
-
data: { [name
|
|
6800
|
+
model: String(model),
|
|
6801
|
+
data: { [String(name)]: id },
|
|
7016
6802
|
specification: {
|
|
7017
6803
|
name: {},
|
|
7018
6804
|
color: {}
|
|
@@ -7029,16 +6815,16 @@ var colorFieldController = (props) => {
|
|
|
7029
6815
|
};
|
|
7030
6816
|
|
|
7031
6817
|
// src/widget/basic/binary-field/controller.ts
|
|
7032
|
-
import { useEffect as
|
|
6818
|
+
import { useEffect as useEffect12, useId as useId2, useRef as useRef4, useState as useState12 } from "react";
|
|
7033
6819
|
import { isBase64Image } from "@fctc/interface-logic/utils";
|
|
7034
6820
|
var binaryFieldController = (props) => {
|
|
7035
6821
|
const { name, methods, readonly = false, value } = props;
|
|
7036
6822
|
const inputId = useId2();
|
|
7037
|
-
const [selectedImage, setSelectedImage] =
|
|
7038
|
-
const [initialImage, setInitialImage] =
|
|
7039
|
-
const [isInsideTable, setIsInsideTable] =
|
|
6823
|
+
const [selectedImage, setSelectedImage] = useState12(null);
|
|
6824
|
+
const [initialImage, setInitialImage] = useState12(value || null);
|
|
6825
|
+
const [isInsideTable, setIsInsideTable] = useState12(false);
|
|
7040
6826
|
const { setValue } = methods;
|
|
7041
|
-
const binaryRef =
|
|
6827
|
+
const binaryRef = useRef4(null);
|
|
7042
6828
|
const convertUrlToBase64 = async (url) => {
|
|
7043
6829
|
try {
|
|
7044
6830
|
const response = await fetch(url);
|
|
@@ -7100,14 +6886,14 @@ var binaryFieldController = (props) => {
|
|
|
7100
6886
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
7101
6887
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
7102
6888
|
};
|
|
7103
|
-
|
|
6889
|
+
useEffect12(() => {
|
|
7104
6890
|
return () => {
|
|
7105
6891
|
if (selectedImage) {
|
|
7106
6892
|
URL.revokeObjectURL(selectedImage);
|
|
7107
6893
|
}
|
|
7108
6894
|
};
|
|
7109
6895
|
}, [selectedImage]);
|
|
7110
|
-
|
|
6896
|
+
useEffect12(() => {
|
|
7111
6897
|
if (binaryRef.current) {
|
|
7112
6898
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
7113
6899
|
setIsInsideTable(isInsideTable2);
|
|
@@ -7128,7 +6914,7 @@ var binaryFieldController = (props) => {
|
|
|
7128
6914
|
|
|
7129
6915
|
// src/widget/advance/table/table-body/controller.ts
|
|
7130
6916
|
import { useAppDispatch as useAppDispatch6, setSelectedRowKeys } from "@fctc/interface-logic/store";
|
|
7131
|
-
import { useEffect as
|
|
6917
|
+
import { useEffect as useEffect13, useMemo as useMemo12 } from "react";
|
|
7132
6918
|
var tableBodyController = (props) => {
|
|
7133
6919
|
const {
|
|
7134
6920
|
checkedAll,
|
|
@@ -7162,7 +6948,7 @@ var tableBodyController = (props) => {
|
|
|
7162
6948
|
const handleClickRow = (col, row2) => {
|
|
7163
6949
|
onClickRow(col, row2);
|
|
7164
6950
|
};
|
|
7165
|
-
|
|
6951
|
+
useEffect13(() => {
|
|
7166
6952
|
if (!row?.id) return;
|
|
7167
6953
|
if (isAutoSelect) {
|
|
7168
6954
|
if (checkboxRef?.current === "uncheck") {
|
|
@@ -7180,7 +6966,7 @@ var tableBodyController = (props) => {
|
|
|
7180
6966
|
}
|
|
7181
6967
|
}
|
|
7182
6968
|
}, [isAutoSelect]);
|
|
7183
|
-
|
|
6969
|
+
useEffect13(() => {
|
|
7184
6970
|
if (!checkedAll) {
|
|
7185
6971
|
checkboxRef.current = "enabled";
|
|
7186
6972
|
false;
|
|
@@ -7236,7 +7022,7 @@ var tableHeadController = (props) => {
|
|
|
7236
7022
|
};
|
|
7237
7023
|
|
|
7238
7024
|
// src/widget/advance/table/table-view/controller.ts
|
|
7239
|
-
import { useEffect as
|
|
7025
|
+
import { useEffect as useEffect14, useMemo as useMemo13, useRef as useRef5, useState as useState13 } from "react";
|
|
7240
7026
|
import {
|
|
7241
7027
|
useAppSelector as useAppSelector5,
|
|
7242
7028
|
selectSearch as selectSearch4,
|
|
@@ -7244,8 +7030,8 @@ import {
|
|
|
7244
7030
|
} from "@fctc/interface-logic/store";
|
|
7245
7031
|
import { domainHelper } from "@fctc/interface-logic/utils";
|
|
7246
7032
|
var tableController = ({ data }) => {
|
|
7247
|
-
const [rows, setRows] =
|
|
7248
|
-
const [columns, setColumns] =
|
|
7033
|
+
const [rows, setRows] = useState13(data.records || []);
|
|
7034
|
+
const [columns, setColumns] = useState13([]);
|
|
7249
7035
|
const dataModelFields = data.fields?.map((field) => {
|
|
7250
7036
|
return {
|
|
7251
7037
|
...data.dataModel?.[field?.name],
|
|
@@ -7273,7 +7059,7 @@ var tableController = ({ data }) => {
|
|
|
7273
7059
|
return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
|
|
7274
7060
|
});
|
|
7275
7061
|
};
|
|
7276
|
-
|
|
7062
|
+
useEffect14(() => {
|
|
7277
7063
|
setRows(transformData(data.records || null));
|
|
7278
7064
|
}, [data.records]);
|
|
7279
7065
|
const handleGetColumns = () => {
|
|
@@ -7294,7 +7080,7 @@ var tableController = ({ data }) => {
|
|
|
7294
7080
|
}
|
|
7295
7081
|
return cols;
|
|
7296
7082
|
};
|
|
7297
|
-
|
|
7083
|
+
useEffect14(() => {
|
|
7298
7084
|
const columns2 = handleGetColumns();
|
|
7299
7085
|
setColumns(columns2);
|
|
7300
7086
|
}, [data.records]);
|
|
@@ -7319,7 +7105,7 @@ var tableController = ({ data }) => {
|
|
|
7319
7105
|
};
|
|
7320
7106
|
|
|
7321
7107
|
// src/widget/advance/table/table-group/controller.ts
|
|
7322
|
-
import { useEffect as
|
|
7108
|
+
import { useEffect as useEffect15, useMemo as useMemo14, useState as useState14 } from "react";
|
|
7323
7109
|
import {
|
|
7324
7110
|
useOdooDataTransform,
|
|
7325
7111
|
useGetListData as useGetListData2
|
|
@@ -7358,14 +7144,14 @@ var tableGroupController = (props) => {
|
|
|
7358
7144
|
setIsAutoSelect,
|
|
7359
7145
|
selectedRowKeysRef
|
|
7360
7146
|
} = props;
|
|
7361
|
-
const [pageGroup, setPageGroup] =
|
|
7147
|
+
const [pageGroup, setPageGroup] = useState14(0);
|
|
7362
7148
|
const { groupByDomain, selectedTags } = useAppSelector6(selectSearch5);
|
|
7363
7149
|
const { selectedRowKeys } = useAppSelector6(selectList4);
|
|
7364
7150
|
const appDispatch = useAppDispatch8();
|
|
7365
7151
|
const { toDataJS } = useOdooDataTransform();
|
|
7366
7152
|
const initVal = toDataJS(row, viewData, model);
|
|
7367
|
-
const [isShowGroup, setIsShowGroup] =
|
|
7368
|
-
const [colEmptyGroup, setColEmptyGroup] =
|
|
7153
|
+
const [isShowGroup, setIsShowGroup] = useState14(false);
|
|
7154
|
+
const [colEmptyGroup, setColEmptyGroup] = useState14({
|
|
7369
7155
|
fromStart: 1,
|
|
7370
7156
|
fromEnd: 1
|
|
7371
7157
|
});
|
|
@@ -7424,7 +7210,7 @@ var tableGroupController = (props) => {
|
|
|
7424
7210
|
}
|
|
7425
7211
|
});
|
|
7426
7212
|
const leftPadding = level > 1 ? level * 8 + "px" : "0px";
|
|
7427
|
-
|
|
7213
|
+
useEffect15(() => {
|
|
7428
7214
|
if (isShowGroup && selectedTags?.length > 0) {
|
|
7429
7215
|
setIsShowGroup(false);
|
|
7430
7216
|
}
|
|
@@ -7458,7 +7244,7 @@ var tableGroupController = (props) => {
|
|
|
7458
7244
|
}
|
|
7459
7245
|
toggleShowGroup();
|
|
7460
7246
|
};
|
|
7461
|
-
|
|
7247
|
+
useEffect15(() => {
|
|
7462
7248
|
if (!isQueryFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
7463
7249
|
return;
|
|
7464
7250
|
}
|
|
@@ -7505,7 +7291,7 @@ import {
|
|
|
7505
7291
|
evalJSONDomain as evalJSONDomain6,
|
|
7506
7292
|
validateAndParseDate
|
|
7507
7293
|
} from "@fctc/interface-logic/utils";
|
|
7508
|
-
import { useCallback as useCallback3, useEffect as
|
|
7294
|
+
import { useCallback as useCallback3, useEffect as useEffect16, useState as useState15 } from "react";
|
|
7509
7295
|
var searchController = ({
|
|
7510
7296
|
viewData,
|
|
7511
7297
|
actionData,
|
|
@@ -7514,11 +7300,11 @@ var searchController = ({
|
|
|
7514
7300
|
setSearchMap,
|
|
7515
7301
|
searchMap
|
|
7516
7302
|
}) => {
|
|
7517
|
-
const [filterBy, setFilterBy] =
|
|
7518
|
-
const [searchBy, setSearchBy] =
|
|
7519
|
-
const [groupBy, setGroupBy] =
|
|
7520
|
-
const [selectedTags, setSelectedTags] =
|
|
7521
|
-
const [searchString, setSearchString] =
|
|
7303
|
+
const [filterBy, setFilterBy] = useState15(null);
|
|
7304
|
+
const [searchBy, setSearchBy] = useState15(null);
|
|
7305
|
+
const [groupBy, setGroupBy] = useState15(null);
|
|
7306
|
+
const [selectedTags, setSelectedTags] = useState15(null);
|
|
7307
|
+
const [searchString, setSearchString] = useState15("");
|
|
7522
7308
|
const domainAction = actionData?.domain ? Array.isArray(actionData?.domain) ? [...actionData?.domain] : evalJSONDomain6(actionData?.domain, contextSearch) : [];
|
|
7523
7309
|
const aid = actionData?.id;
|
|
7524
7310
|
const model = actionData?.res_model;
|
|
@@ -7565,7 +7351,7 @@ var searchController = ({
|
|
|
7565
7351
|
}
|
|
7566
7352
|
}
|
|
7567
7353
|
};
|
|
7568
|
-
|
|
7354
|
+
useEffect16(() => {
|
|
7569
7355
|
clearSearch();
|
|
7570
7356
|
fetchData();
|
|
7571
7357
|
}, [aid, model, viewData]);
|
|
@@ -7711,7 +7497,7 @@ var searchController = ({
|
|
|
7711
7497
|
},
|
|
7712
7498
|
[searchMap]
|
|
7713
7499
|
);
|
|
7714
|
-
|
|
7500
|
+
useEffect16(() => {
|
|
7715
7501
|
setSelectedTags(null);
|
|
7716
7502
|
setTagSearch(searchMap);
|
|
7717
7503
|
}, [searchMap]);
|
|
@@ -7820,8 +7606,6 @@ export {
|
|
|
7820
7606
|
downLoadBinaryController,
|
|
7821
7607
|
downloadFileController,
|
|
7822
7608
|
durationController,
|
|
7823
|
-
floatController,
|
|
7824
|
-
floatTimeFiledController,
|
|
7825
7609
|
getDateRange,
|
|
7826
7610
|
languages,
|
|
7827
7611
|
many2manyFieldController,
|
package/dist/widget.d.mts
CHANGED
|
@@ -130,33 +130,6 @@ declare const priorityFieldController: (props: IPriorityFieldProps) => {
|
|
|
130
130
|
onChange: ((name: string, value: any) => void) | undefined;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
declare const floatTimeFiledController: ({ onChange: fieldOnChange, onBlur, value, isDirty, props, }: {
|
|
134
|
-
onChange: any;
|
|
135
|
-
onBlur: any;
|
|
136
|
-
value: any;
|
|
137
|
-
error: any;
|
|
138
|
-
isDirty: any;
|
|
139
|
-
props: IInputFieldProps;
|
|
140
|
-
}) => {
|
|
141
|
-
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
142
|
-
handleBlur: () => void;
|
|
143
|
-
handleKeyDown: (e: any) => void;
|
|
144
|
-
input: string;
|
|
145
|
-
errors: string;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
declare const floatController: ({ onChange, value, props, }: {
|
|
149
|
-
onChange: any;
|
|
150
|
-
value: any;
|
|
151
|
-
props: IInputFieldProps;
|
|
152
|
-
}) => {
|
|
153
|
-
handleInputMouseLeave: () => void;
|
|
154
|
-
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
155
|
-
useFormatFloatNumber: (value: number | string) => string;
|
|
156
|
-
inputRef: react.MutableRefObject<HTMLInputElement | null>;
|
|
157
|
-
inputValue: string;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
133
|
declare const downloadFileController: () => {
|
|
161
134
|
inputId: string;
|
|
162
135
|
file: any;
|
|
@@ -320,4 +293,4 @@ declare const searchController: ({ viewData, actionData, fieldsList, contextSear
|
|
|
320
293
|
domain: any[] | undefined;
|
|
321
294
|
};
|
|
322
295
|
|
|
323
|
-
export { type ISelctionStateProps, type ITableBodyProps, type ITableHeadProps, type ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController,
|
|
296
|
+
export { type ISelctionStateProps, type ITableBodyProps, type ITableHeadProps, type ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, searchController, statusDropdownController, tableBodyController, tableController, tableGroupController, tableHeadController };
|
package/dist/widget.d.ts
CHANGED
|
@@ -130,33 +130,6 @@ declare const priorityFieldController: (props: IPriorityFieldProps) => {
|
|
|
130
130
|
onChange: ((name: string, value: any) => void) | undefined;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
declare const floatTimeFiledController: ({ onChange: fieldOnChange, onBlur, value, isDirty, props, }: {
|
|
134
|
-
onChange: any;
|
|
135
|
-
onBlur: any;
|
|
136
|
-
value: any;
|
|
137
|
-
error: any;
|
|
138
|
-
isDirty: any;
|
|
139
|
-
props: IInputFieldProps;
|
|
140
|
-
}) => {
|
|
141
|
-
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
142
|
-
handleBlur: () => void;
|
|
143
|
-
handleKeyDown: (e: any) => void;
|
|
144
|
-
input: string;
|
|
145
|
-
errors: string;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
declare const floatController: ({ onChange, value, props, }: {
|
|
149
|
-
onChange: any;
|
|
150
|
-
value: any;
|
|
151
|
-
props: IInputFieldProps;
|
|
152
|
-
}) => {
|
|
153
|
-
handleInputMouseLeave: () => void;
|
|
154
|
-
handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
155
|
-
useFormatFloatNumber: (value: number | string) => string;
|
|
156
|
-
inputRef: react.MutableRefObject<HTMLInputElement | null>;
|
|
157
|
-
inputValue: string;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
133
|
declare const downloadFileController: () => {
|
|
161
134
|
inputId: string;
|
|
162
135
|
file: any;
|
|
@@ -320,4 +293,4 @@ declare const searchController: ({ viewData, actionData, fieldsList, contextSear
|
|
|
320
293
|
domain: any[] | undefined;
|
|
321
294
|
};
|
|
322
295
|
|
|
323
|
-
export { type ISelctionStateProps, type ITableBodyProps, type ITableHeadProps, type ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController,
|
|
296
|
+
export { type ISelctionStateProps, type ITableBodyProps, type ITableHeadProps, type ITableProps, binaryFieldController, colorFieldController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, searchController, statusDropdownController, tableBodyController, tableController, tableGroupController, tableHeadController };
|