@esvndev/es-react-config-setting 1.0.55 → 1.0.57
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 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -32
- 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];
|
|
@@ -18901,6 +18887,36 @@ const SettingApp = (props) => {
|
|
|
18901
18887
|
loadSettingConfigByGroup(data);
|
|
18902
18888
|
setDataSettingGroup(updated);
|
|
18903
18889
|
};
|
|
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 thông số delay tránh gửi liên tục
|
|
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
|
+
obj: obj,
|
|
18913
|
+
key: obj.id,
|
|
18914
|
+
value: value,
|
|
18915
|
+
};
|
|
18916
|
+
_m[obj.id] = setTimeout(() => {
|
|
18917
|
+
_eventChange(_data);
|
|
18918
|
+
}, 1000);
|
|
18919
|
+
};
|
|
18904
18920
|
//Hàm sử dụng tạo theo loại giá trị
|
|
18905
18921
|
const _renderInput = (root, data) => {
|
|
18906
18922
|
console.log(data);
|
|
@@ -18908,11 +18924,11 @@ const SettingApp = (props) => {
|
|
|
18908
18924
|
switch (data.type) {
|
|
18909
18925
|
case "switch":
|
|
18910
18926
|
case "checkbox":
|
|
18911
|
-
return (jsx("div", { className: "checkbox", title: data.description, children: jsx(Input$1, { type: "checkbox", checked: !!value, onChange: (e) =>
|
|
18927
|
+
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
18928
|
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) =>
|
|
18929
|
+
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
18930
|
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) =>
|
|
18931
|
+
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
18932
|
case "slider":
|
|
18917
18933
|
case "text":
|
|
18918
18934
|
case "password":
|
|
@@ -18921,12 +18937,12 @@ const SettingApp = (props) => {
|
|
|
18921
18937
|
case "time":
|
|
18922
18938
|
case "datetime":
|
|
18923
18939
|
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) =>
|
|
18940
|
+
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
18941
|
case "image":
|
|
18926
18942
|
case "file":
|
|
18927
|
-
return (jsx("div", { className: "file-input", title: data.description, children: jsx(Input$1, { type: "file", className: "input-custom", onChange: (e) =>
|
|
18943
|
+
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
18944
|
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) =>
|
|
18945
|
+
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
18946
|
}
|
|
18931
18947
|
};
|
|
18932
18948
|
//hàm tạo các thông số cấu hình và cài đặt
|