@esvndev/es-react-config-setting 1.0.58 → 1.0.60
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 +25 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18694,8 +18694,8 @@ const GetSettingGroup = (callback) => {
|
|
|
18694
18694
|
headers: {
|
|
18695
18695
|
'Content-Type': 'application/json',
|
|
18696
18696
|
Authorization: `Bearer ${getToken()}`,
|
|
18697
|
-
body: JSON.stringify({ ModuleId: REACT_APP_PRODUCT_CODE, StateId: '' })
|
|
18698
18697
|
},
|
|
18698
|
+
body: JSON.stringify({ ModuleId: REACT_APP_PRODUCT_CODE, StateId: '' })
|
|
18699
18699
|
};
|
|
18700
18700
|
fetch(_url, options)
|
|
18701
18701
|
.then(response => {
|
|
@@ -18843,32 +18843,30 @@ const SettingApp = (props) => {
|
|
|
18843
18843
|
eventClose({ state: 'close' });
|
|
18844
18844
|
};
|
|
18845
18845
|
//Sự kiện sau khi đã mở cài đặt
|
|
18846
|
-
const handleFormOpened = () => {
|
|
18847
|
-
};
|
|
18846
|
+
const handleFormOpened = () => { };
|
|
18848
18847
|
//Sự kiện sau khi đã đóng cài đặt
|
|
18849
|
-
const handleFormClosed = () => {
|
|
18848
|
+
const handleFormClosed = () => { };
|
|
18849
|
+
const DynamicIcon = ({ name, className }) => {
|
|
18850
|
+
const LucideIcon = Icon[name];
|
|
18851
|
+
return LucideIcon ? jsxRuntime.jsx(LucideIcon, { className: className }) : null;
|
|
18850
18852
|
};
|
|
18853
|
+
//#endregion
|
|
18854
|
+
const [settingData, setSettingData] = React.useState({});
|
|
18855
|
+
const [dataSettingGroup, setDataSettingGroup] = React.useState([]);
|
|
18856
|
+
const [formState, setFormState] = React.useState({});
|
|
18851
18857
|
//Sự kiện giá trị thay đổi
|
|
18852
18858
|
const _eventChange = (obj) => {
|
|
18853
18859
|
UpdateSettingConfig({
|
|
18854
18860
|
Items: [{
|
|
18855
18861
|
Key: obj.key,
|
|
18856
|
-
Value: obj.value
|
|
18862
|
+
Value: obj.value,
|
|
18857
18863
|
}]
|
|
18858
|
-
},
|
|
18864
|
+
}, obj.file, (rs) => {
|
|
18859
18865
|
console.log(rs);
|
|
18860
18866
|
});
|
|
18861
18867
|
if (eventChange)
|
|
18862
18868
|
eventChange([{ key: obj.key, value: obj.value, state: "update" }]);
|
|
18863
18869
|
};
|
|
18864
|
-
const DynamicIcon = ({ name, className }) => {
|
|
18865
|
-
const LucideIcon = Icon[name];
|
|
18866
|
-
return LucideIcon ? jsxRuntime.jsx(LucideIcon, { className: className }) : null;
|
|
18867
|
-
};
|
|
18868
|
-
//#endregion
|
|
18869
|
-
const [settingData, setSettingData] = React.useState({});
|
|
18870
|
-
const [dataSettingGroup, setDataSettingGroup] = React.useState([]);
|
|
18871
|
-
const [formState, setFormState] = React.useState({});
|
|
18872
18870
|
//Load data of group config and setting by group
|
|
18873
18871
|
React.useEffect(() => {
|
|
18874
18872
|
if (isOpen) {
|
|
@@ -18930,7 +18928,18 @@ const SettingApp = (props) => {
|
|
|
18930
18928
|
if (saveSettings && _m[obj.id] !== null) {
|
|
18931
18929
|
clearTimeout(_m[obj.id]);
|
|
18932
18930
|
}
|
|
18933
|
-
|
|
18931
|
+
let value;
|
|
18932
|
+
let value_file;
|
|
18933
|
+
if (e.target.type === "checkbox") {
|
|
18934
|
+
value = e.target.checked;
|
|
18935
|
+
}
|
|
18936
|
+
else if (e.target.type === "file") {
|
|
18937
|
+
value = e.target.value;
|
|
18938
|
+
value_file = e.target.files?.[0] ?? null;
|
|
18939
|
+
}
|
|
18940
|
+
else {
|
|
18941
|
+
value = e.target.value;
|
|
18942
|
+
}
|
|
18934
18943
|
setFormState(prev => ({
|
|
18935
18944
|
...prev,
|
|
18936
18945
|
[obj.id]: value
|
|
@@ -18940,6 +18949,7 @@ const SettingApp = (props) => {
|
|
|
18940
18949
|
obj: obj,
|
|
18941
18950
|
key: obj.id,
|
|
18942
18951
|
value: value,
|
|
18952
|
+
file: value_file
|
|
18943
18953
|
};
|
|
18944
18954
|
_m[obj.id] = setTimeout(() => {
|
|
18945
18955
|
_eventChange(_data);
|
|
@@ -18947,7 +18957,6 @@ const SettingApp = (props) => {
|
|
|
18947
18957
|
};
|
|
18948
18958
|
//Hàm sử dụng tạo theo loại giá trị
|
|
18949
18959
|
const _renderInput = (root, data) => {
|
|
18950
|
-
console.log(data);
|
|
18951
18960
|
const value = formState[data.id] ?? data.value ?? "";
|
|
18952
18961
|
switch (data.type) {
|
|
18953
18962
|
case "switch":
|