@esvndev/es-react-config-setting 1.0.54 → 1.0.56
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 +48 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -18660,7 +18660,7 @@ const getToken = () => {
|
|
|
18660
18660
|
};
|
|
18661
18661
|
//#endregion
|
|
18662
18662
|
const GetSettingGroup = (callback) => {
|
|
18663
|
-
const _url = `${BASE_URL}/api/config/get-setting-group`;
|
|
18663
|
+
const _url = `${BASE_URL}/api/config/get-setting-config-group`;
|
|
18664
18664
|
const options = {
|
|
18665
18665
|
method: 'GET',
|
|
18666
18666
|
headers: {
|
|
@@ -18821,31 +18821,17 @@ const SettingApp = (props) => {
|
|
|
18821
18821
|
const handleFormClosed = () => {
|
|
18822
18822
|
};
|
|
18823
18823
|
//Sự kiện giá trị thay đổi
|
|
18824
|
-
const _eventChange = (obj
|
|
18825
|
-
|
|
18826
|
-
|
|
18827
|
-
|
|
18828
|
-
|
|
18829
|
-
|
|
18830
|
-
|
|
18831
|
-
|
|
18832
|
-
|
|
18833
|
-
|
|
18834
|
-
}
|
|
18835
|
-
else {
|
|
18836
|
-
_value = e.target.value;
|
|
18837
|
-
}
|
|
18838
|
-
UpdateSettingConfig({
|
|
18839
|
-
Items: [{
|
|
18840
|
-
Key: obj.key,
|
|
18841
|
-
Value: _value
|
|
18842
|
-
}]
|
|
18843
|
-
}, null, (rs) => {
|
|
18844
|
-
console.log(rs);
|
|
18845
|
-
});
|
|
18846
|
-
if (eventChange)
|
|
18847
|
-
eventChange([{ key: obj.key, value: _value, state: "update" }]);
|
|
18848
|
-
}
|
|
18824
|
+
const _eventChange = (obj) => {
|
|
18825
|
+
UpdateSettingConfig({
|
|
18826
|
+
Items: [{
|
|
18827
|
+
Key: obj.key,
|
|
18828
|
+
Value: obj.value
|
|
18829
|
+
}]
|
|
18830
|
+
}, null, (rs) => {
|
|
18831
|
+
console.log(rs);
|
|
18832
|
+
});
|
|
18833
|
+
if (eventChange)
|
|
18834
|
+
eventChange([{ key: obj.key, value: obj.value, state: "update" }]);
|
|
18849
18835
|
};
|
|
18850
18836
|
const DynamicIcon = ({ name, className }) => {
|
|
18851
18837
|
const LucideIcon = Icon[name];
|
|
@@ -18854,6 +18840,7 @@ const SettingApp = (props) => {
|
|
|
18854
18840
|
//#endregion
|
|
18855
18841
|
const [settingData, setSettingData] = useState({});
|
|
18856
18842
|
const [dataSettingGroup, setDataSettingGroup] = useState([]);
|
|
18843
|
+
const [formState, setFormState] = useState({});
|
|
18857
18844
|
//Load data of group config and setting by group
|
|
18858
18845
|
useEffect(() => {
|
|
18859
18846
|
if (isOpen) {
|
|
@@ -18900,7 +18887,35 @@ const SettingApp = (props) => {
|
|
|
18900
18887
|
loadSettingConfigByGroup(data);
|
|
18901
18888
|
setDataSettingGroup(updated);
|
|
18902
18889
|
};
|
|
18903
|
-
|
|
18890
|
+
//Khai báo sản biến cập nhật timer
|
|
18891
|
+
const saveSettings = useRef({
|
|
18892
|
+
hide_warning: null,
|
|
18893
|
+
hide_navbar: null,
|
|
18894
|
+
target_output_per_hour: null,
|
|
18895
|
+
working_hours_per_day: null,
|
|
18896
|
+
monthly_target_defects: null,
|
|
18897
|
+
allowed_defects_per_model_day: null
|
|
18898
|
+
}).current;
|
|
18899
|
+
//Cấu hình số lỗi mục tiêu cho phép cho 1 model trong 1 ngày
|
|
18900
|
+
const change_save = (obj, e) => {
|
|
18901
|
+
const _m = saveSettings;
|
|
18902
|
+
if (saveSettings && _m[obj.id] !== null) {
|
|
18903
|
+
clearTimeout(_m[obj.id]);
|
|
18904
|
+
}
|
|
18905
|
+
const value = e.target.type === "checkbox" ? e.target.checked : e.target.value;
|
|
18906
|
+
setFormState(prev => ({
|
|
18907
|
+
...prev,
|
|
18908
|
+
[obj.id]: value
|
|
18909
|
+
}));
|
|
18910
|
+
const _data = {
|
|
18911
|
+
id: crypto.randomUUID(),
|
|
18912
|
+
key: obj,
|
|
18913
|
+
value: value,
|
|
18914
|
+
};
|
|
18915
|
+
_m[obj.id] = setTimeout(() => {
|
|
18916
|
+
_eventChange(_data);
|
|
18917
|
+
}, 1000);
|
|
18918
|
+
};
|
|
18904
18919
|
//Hàm sử dụng tạo theo loại giá trị
|
|
18905
18920
|
const _renderInput = (root, data) => {
|
|
18906
18921
|
console.log(data);
|
|
@@ -18908,11 +18923,11 @@ const SettingApp = (props) => {
|
|
|
18908
18923
|
switch (data.type) {
|
|
18909
18924
|
case "switch":
|
|
18910
18925
|
case "checkbox":
|
|
18911
|
-
return (jsx("div", { className: "checkbox", title: data.description, children: jsx(Input$1, { type: "checkbox", checked: !!value, onChange: (e) =>
|
|
18926
|
+
return (jsx("div", { className: "checkbox", title: data.description, children: jsx(Input$1, { type: "checkbox", checked: !!value, onChange: (e) => change_save(data, e) }) }, data.id));
|
|
18912
18927
|
case "radio":
|
|
18913
|
-
return (jsx("div", { className: "radio-group", title: data.description, children: data.option?.map((opt, index) => (jsxs("label", { children: [jsx(Input$1, { type: "radio", name: data.name, value: opt.value, checked: value === opt.value, onChange: (e) =>
|
|
18928
|
+
return (jsx("div", { className: "radio-group", title: data.description, children: data.option?.map((opt, index) => (jsxs("label", { children: [jsx(Input$1, { type: "radio", name: data.name, value: opt.value, checked: value === opt.value, onChange: (e) => change_save(data, e) }), opt.name] }, index))) }, data.id));
|
|
18914
18929
|
case "combobox":
|
|
18915
|
-
return (jsx("div", { className: "combobox", title: data.description, children: jsxs(Input$1, { type: "select", className: "input-custom", name: data.name, value: value, onChange: (e) =>
|
|
18930
|
+
return (jsx("div", { className: "combobox", title: data.description, children: jsxs(Input$1, { type: "select", className: "input-custom", name: data.name, value: value, onChange: (e) => change_save(data, e), children: [jsx("option", { value: "", children: "Ch\u1ECDn m\u1ED9t gi\u00E1 tr\u1ECB" }), data.option?.map((opt, index) => (jsx("option", { value: opt.value, children: opt.name }, index)))] }) }, data.id));
|
|
18916
18931
|
case "slider":
|
|
18917
18932
|
case "text":
|
|
18918
18933
|
case "password":
|
|
@@ -18921,12 +18936,12 @@ const SettingApp = (props) => {
|
|
|
18921
18936
|
case "time":
|
|
18922
18937
|
case "datetime":
|
|
18923
18938
|
case "color":
|
|
18924
|
-
return (jsx("div", { className: `${data.type}-input`, title: data.description, children: jsx(Input$1, { type: data.type, className: "input-custom", value: value, placeholder: data.name, onChange: (e) =>
|
|
18939
|
+
return (jsx("div", { className: `${data.type}-input`, title: data.description, children: jsx(Input$1, { type: data.type, className: "input-custom", value: value, placeholder: data.name, onChange: (e) => change_save(data, e) }) }, data.id));
|
|
18925
18940
|
case "image":
|
|
18926
18941
|
case "file":
|
|
18927
|
-
return (jsx("div", { className: "file-input", title: data.description, children: jsx(Input$1, { type: "file", className: "input-custom", onChange: (e) =>
|
|
18942
|
+
return (jsx("div", { className: "file-input", title: data.description, children: jsx(Input$1, { type: "file", className: "input-custom", onChange: (e) => change_save(data, e) }) }, data.id));
|
|
18928
18943
|
default:
|
|
18929
|
-
return (jsx("div", { className: `${data.type ?? 'normal'}-input`, title: data.description, children: jsx(Input$1, { type: data.type ?? "text", value: value, onChange: (e) =>
|
|
18944
|
+
return (jsx("div", { className: `${data.type ?? 'normal'}-input`, title: data.description, children: jsx(Input$1, { type: data.type ?? "text", value: value, onChange: (e) => change_save(data, e) }) }, data.id));
|
|
18930
18945
|
}
|
|
18931
18946
|
};
|
|
18932
18947
|
//hàm tạo các thông số cấu hình và cài đặt
|