@esvndev/es-react-config-setting 1.0.59 → 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.mjs CHANGED
@@ -18816,32 +18816,30 @@ const SettingApp = (props) => {
18816
18816
  eventClose({ state: 'close' });
18817
18817
  };
18818
18818
  //Sự kiện sau khi đã mở cài đặt
18819
- const handleFormOpened = () => {
18820
- };
18819
+ const handleFormOpened = () => { };
18821
18820
  //Sự kiện sau khi đã đóng cài đặt
18822
- const handleFormClosed = () => {
18821
+ const handleFormClosed = () => { };
18822
+ const DynamicIcon = ({ name, className }) => {
18823
+ const LucideIcon = Icon[name];
18824
+ return LucideIcon ? jsx(LucideIcon, { className: className }) : null;
18823
18825
  };
18826
+ //#endregion
18827
+ const [settingData, setSettingData] = useState({});
18828
+ const [dataSettingGroup, setDataSettingGroup] = useState([]);
18829
+ const [formState, setFormState] = useState({});
18824
18830
  //Sự kiện giá trị thay đổi
18825
18831
  const _eventChange = (obj) => {
18826
18832
  UpdateSettingConfig({
18827
18833
  Items: [{
18828
18834
  Key: obj.key,
18829
- Value: obj.value
18835
+ Value: obj.value,
18830
18836
  }]
18831
- }, null, (rs) => {
18837
+ }, obj.file, (rs) => {
18832
18838
  console.log(rs);
18833
18839
  });
18834
18840
  if (eventChange)
18835
18841
  eventChange([{ key: obj.key, value: obj.value, state: "update" }]);
18836
18842
  };
18837
- const DynamicIcon = ({ name, className }) => {
18838
- const LucideIcon = Icon[name];
18839
- return LucideIcon ? jsx(LucideIcon, { className: className }) : null;
18840
- };
18841
- //#endregion
18842
- const [settingData, setSettingData] = useState({});
18843
- const [dataSettingGroup, setDataSettingGroup] = useState([]);
18844
- const [formState, setFormState] = useState({});
18845
18843
  //Load data of group config and setting by group
18846
18844
  useEffect(() => {
18847
18845
  if (isOpen) {
@@ -18903,7 +18901,18 @@ const SettingApp = (props) => {
18903
18901
  if (saveSettings && _m[obj.id] !== null) {
18904
18902
  clearTimeout(_m[obj.id]);
18905
18903
  }
18906
- const value = e.target.type === "checkbox" ? e.target.checked : e.target.value;
18904
+ let value;
18905
+ let value_file;
18906
+ if (e.target.type === "checkbox") {
18907
+ value = e.target.checked;
18908
+ }
18909
+ else if (e.target.type === "file") {
18910
+ value = e.target.value;
18911
+ value_file = e.target.files?.[0] ?? null;
18912
+ }
18913
+ else {
18914
+ value = e.target.value;
18915
+ }
18907
18916
  setFormState(prev => ({
18908
18917
  ...prev,
18909
18918
  [obj.id]: value
@@ -18913,6 +18922,7 @@ const SettingApp = (props) => {
18913
18922
  obj: obj,
18914
18923
  key: obj.id,
18915
18924
  value: value,
18925
+ file: value_file
18916
18926
  };
18917
18927
  _m[obj.id] = setTimeout(() => {
18918
18928
  _eventChange(_data);
@@ -18920,7 +18930,6 @@ const SettingApp = (props) => {
18920
18930
  };
18921
18931
  //Hàm sử dụng tạo theo loại giá trị
18922
18932
  const _renderInput = (root, data) => {
18923
- console.log(data);
18924
18933
  const value = formState[data.id] ?? data.value ?? "";
18925
18934
  switch (data.type) {
18926
18935
  case "switch":