@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.js
CHANGED
|
@@ -18687,7 +18687,7 @@ const getToken = () => {
|
|
|
18687
18687
|
};
|
|
18688
18688
|
//#endregion
|
|
18689
18689
|
const GetSettingGroup = (callback) => {
|
|
18690
|
-
const _url = `${BASE_URL}/api/config/get-setting-group`;
|
|
18690
|
+
const _url = `${BASE_URL}/api/config/get-setting-config-group`;
|
|
18691
18691
|
const options = {
|
|
18692
18692
|
method: 'GET',
|
|
18693
18693
|
headers: {
|
|
@@ -18848,31 +18848,17 @@ const SettingApp = (props) => {
|
|
|
18848
18848
|
const handleFormClosed = () => {
|
|
18849
18849
|
};
|
|
18850
18850
|
//Sự kiện giá trị thay đổi
|
|
18851
|
-
const _eventChange = (obj
|
|
18852
|
-
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
|
|
18859
|
-
|
|
18860
|
-
|
|
18861
|
-
}
|
|
18862
|
-
else {
|
|
18863
|
-
_value = e.target.value;
|
|
18864
|
-
}
|
|
18865
|
-
UpdateSettingConfig({
|
|
18866
|
-
Items: [{
|
|
18867
|
-
Key: obj.key,
|
|
18868
|
-
Value: _value
|
|
18869
|
-
}]
|
|
18870
|
-
}, null, (rs) => {
|
|
18871
|
-
console.log(rs);
|
|
18872
|
-
});
|
|
18873
|
-
if (eventChange)
|
|
18874
|
-
eventChange([{ key: obj.key, value: _value, state: "update" }]);
|
|
18875
|
-
}
|
|
18851
|
+
const _eventChange = (obj) => {
|
|
18852
|
+
UpdateSettingConfig({
|
|
18853
|
+
Items: [{
|
|
18854
|
+
Key: obj.key,
|
|
18855
|
+
Value: obj.value
|
|
18856
|
+
}]
|
|
18857
|
+
}, null, (rs) => {
|
|
18858
|
+
console.log(rs);
|
|
18859
|
+
});
|
|
18860
|
+
if (eventChange)
|
|
18861
|
+
eventChange([{ key: obj.key, value: obj.value, state: "update" }]);
|
|
18876
18862
|
};
|
|
18877
18863
|
const DynamicIcon = ({ name, className }) => {
|
|
18878
18864
|
const LucideIcon = Icon[name];
|
|
@@ -18881,6 +18867,7 @@ const SettingApp = (props) => {
|
|
|
18881
18867
|
//#endregion
|
|
18882
18868
|
const [settingData, setSettingData] = React.useState({});
|
|
18883
18869
|
const [dataSettingGroup, setDataSettingGroup] = React.useState([]);
|
|
18870
|
+
const [formState, setFormState] = React.useState({});
|
|
18884
18871
|
//Load data of group config and setting by group
|
|
18885
18872
|
React.useEffect(() => {
|
|
18886
18873
|
if (isOpen) {
|
|
@@ -18927,7 +18914,35 @@ const SettingApp = (props) => {
|
|
|
18927
18914
|
loadSettingConfigByGroup(data);
|
|
18928
18915
|
setDataSettingGroup(updated);
|
|
18929
18916
|
};
|
|
18930
|
-
|
|
18917
|
+
//Khai báo sản biến cập nhật timer
|
|
18918
|
+
const saveSettings = React.useRef({
|
|
18919
|
+
hide_warning: null,
|
|
18920
|
+
hide_navbar: null,
|
|
18921
|
+
target_output_per_hour: null,
|
|
18922
|
+
working_hours_per_day: null,
|
|
18923
|
+
monthly_target_defects: null,
|
|
18924
|
+
allowed_defects_per_model_day: null
|
|
18925
|
+
}).current;
|
|
18926
|
+
//Cấu hình số lỗi mục tiêu cho phép cho 1 model trong 1 ngày
|
|
18927
|
+
const change_save = (obj, e) => {
|
|
18928
|
+
const _m = saveSettings;
|
|
18929
|
+
if (saveSettings && _m[obj.id] !== null) {
|
|
18930
|
+
clearTimeout(_m[obj.id]);
|
|
18931
|
+
}
|
|
18932
|
+
const value = e.target.type === "checkbox" ? e.target.checked : e.target.value;
|
|
18933
|
+
setFormState(prev => ({
|
|
18934
|
+
...prev,
|
|
18935
|
+
[obj.id]: value
|
|
18936
|
+
}));
|
|
18937
|
+
const _data = {
|
|
18938
|
+
id: crypto.randomUUID(),
|
|
18939
|
+
key: obj,
|
|
18940
|
+
value: value,
|
|
18941
|
+
};
|
|
18942
|
+
_m[obj.id] = setTimeout(() => {
|
|
18943
|
+
_eventChange(_data);
|
|
18944
|
+
}, 1000);
|
|
18945
|
+
};
|
|
18931
18946
|
//Hàm sử dụng tạo theo loại giá trị
|
|
18932
18947
|
const _renderInput = (root, data) => {
|
|
18933
18948
|
console.log(data);
|
|
@@ -18935,11 +18950,11 @@ const SettingApp = (props) => {
|
|
|
18935
18950
|
switch (data.type) {
|
|
18936
18951
|
case "switch":
|
|
18937
18952
|
case "checkbox":
|
|
18938
|
-
return (jsxRuntime.jsx("div", { className: "checkbox", title: data.description, children: jsxRuntime.jsx(Input$1, { type: "checkbox", checked: !!value, onChange: (e) =>
|
|
18953
|
+
return (jsxRuntime.jsx("div", { className: "checkbox", title: data.description, children: jsxRuntime.jsx(Input$1, { type: "checkbox", checked: !!value, onChange: (e) => change_save(data, e) }) }, data.id));
|
|
18939
18954
|
case "radio":
|
|
18940
|
-
return (jsxRuntime.jsx("div", { className: "radio-group", title: data.description, children: data.option?.map((opt, index) => (jsxRuntime.jsxs("label", { children: [jsxRuntime.jsx(Input$1, { type: "radio", name: data.name, value: opt.value, checked: value === opt.value, onChange: (e) =>
|
|
18955
|
+
return (jsxRuntime.jsx("div", { className: "radio-group", title: data.description, children: data.option?.map((opt, index) => (jsxRuntime.jsxs("label", { children: [jsxRuntime.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));
|
|
18941
18956
|
case "combobox":
|
|
18942
|
-
return (jsxRuntime.jsx("div", { className: "combobox", title: data.description, children: jsxRuntime.jsxs(Input$1, { type: "select", className: "input-custom", name: data.name, value: value, onChange: (e) =>
|
|
18957
|
+
return (jsxRuntime.jsx("div", { className: "combobox", title: data.description, children: jsxRuntime.jsxs(Input$1, { type: "select", className: "input-custom", name: data.name, value: value, onChange: (e) => change_save(data, e), children: [jsxRuntime.jsx("option", { value: "", children: "Ch\u1ECDn m\u1ED9t gi\u00E1 tr\u1ECB" }), data.option?.map((opt, index) => (jsxRuntime.jsx("option", { value: opt.value, children: opt.name }, index)))] }) }, data.id));
|
|
18943
18958
|
case "slider":
|
|
18944
18959
|
case "text":
|
|
18945
18960
|
case "password":
|
|
@@ -18948,12 +18963,12 @@ const SettingApp = (props) => {
|
|
|
18948
18963
|
case "time":
|
|
18949
18964
|
case "datetime":
|
|
18950
18965
|
case "color":
|
|
18951
|
-
return (jsxRuntime.jsx("div", { className: `${data.type}-input`, title: data.description, children: jsxRuntime.jsx(Input$1, { type: data.type, className: "input-custom", value: value, placeholder: data.name, onChange: (e) =>
|
|
18966
|
+
return (jsxRuntime.jsx("div", { className: `${data.type}-input`, title: data.description, children: jsxRuntime.jsx(Input$1, { type: data.type, className: "input-custom", value: value, placeholder: data.name, onChange: (e) => change_save(data, e) }) }, data.id));
|
|
18952
18967
|
case "image":
|
|
18953
18968
|
case "file":
|
|
18954
|
-
return (jsxRuntime.jsx("div", { className: "file-input", title: data.description, children: jsxRuntime.jsx(Input$1, { type: "file", className: "input-custom", onChange: (e) =>
|
|
18969
|
+
return (jsxRuntime.jsx("div", { className: "file-input", title: data.description, children: jsxRuntime.jsx(Input$1, { type: "file", className: "input-custom", onChange: (e) => change_save(data, e) }) }, data.id));
|
|
18955
18970
|
default:
|
|
18956
|
-
return (jsxRuntime.jsx("div", { className: `${data.type ?? 'normal'}-input`, title: data.description, children: jsxRuntime.jsx(Input$1, { type: data.type ?? "text", value: value, onChange: (e) =>
|
|
18971
|
+
return (jsxRuntime.jsx("div", { className: `${data.type ?? 'normal'}-input`, title: data.description, children: jsxRuntime.jsx(Input$1, { type: data.type ?? "text", value: value, onChange: (e) => change_save(data, e) }) }, data.id));
|
|
18957
18972
|
}
|
|
18958
18973
|
};
|
|
18959
18974
|
//hàm tạo các thông số cấu hình và cài đặt
|