@esvndev/es-react-config-setting 1.0.60 → 1.0.64

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 CHANGED
@@ -18804,6 +18804,7 @@ const GetSettingConfigByGroup = (obj, callback) => {
18804
18804
  const UpdateSettingConfig = (obj, file, callback) => {
18805
18805
  const _url = `${BASE_URL}/api/config/update-setting-config`;
18806
18806
  const formData = new FormData();
18807
+ formData.append(`GroupId`, obj.GroupId);
18807
18808
  obj.Items.forEach((item, index) => {
18808
18809
  formData.append(`Items[${index}].Key`, item.Key);
18809
18810
  formData.append(`Items[${index}].Value`, item.Value);
@@ -18857,6 +18858,7 @@ const SettingApp = (props) => {
18857
18858
  //Sự kiện giá trị thay đổi
18858
18859
  const _eventChange = (obj) => {
18859
18860
  UpdateSettingConfig({
18861
+ GroupId: obj.groupId,
18860
18862
  Items: [{
18861
18863
  Key: obj.key,
18862
18864
  Value: obj.value,
@@ -18923,7 +18925,7 @@ const SettingApp = (props) => {
18923
18925
  allowed_defects_per_model_day: null
18924
18926
  }).current;
18925
18927
  //Cấu hình thông số delay tránh gửi liên tục
18926
- const change_save = (obj, e) => {
18928
+ const change_save = (root, obj, e) => {
18927
18929
  const _m = saveSettings;
18928
18930
  if (saveSettings && _m[obj.id] !== null) {
18929
18931
  clearTimeout(_m[obj.id]);
@@ -18949,7 +18951,8 @@ const SettingApp = (props) => {
18949
18951
  obj: obj,
18950
18952
  key: obj.id,
18951
18953
  value: value,
18952
- file: value_file
18954
+ file: value_file,
18955
+ groupId: root.id
18953
18956
  };
18954
18957
  _m[obj.id] = setTimeout(() => {
18955
18958
  _eventChange(_data);
@@ -18961,11 +18964,18 @@ const SettingApp = (props) => {
18961
18964
  switch (data.type) {
18962
18965
  case "switch":
18963
18966
  case "checkbox":
18964
- 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));
18967
+ return (jsxRuntime.jsx("div", { className: "checkbox", title: data.description, children: jsxRuntime.jsx(Input$1, { type: "checkbox", checked: !!value, onChange: (e) => change_save(root, data, e) }) }, data.id));
18965
18968
  case "radio":
18966
- 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));
18969
+ 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(root, data, e) }), opt.name] }, index))) }, data.id));
18967
18970
  case "combobox":
18968
- 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));
18971
+ let _data_option = [];
18972
+ try {
18973
+ _data_option = JSON.parse(data.option ?? []);
18974
+ }
18975
+ catch (ex) {
18976
+ console.log("Error config option setting", data);
18977
+ }
18978
+ 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(root, 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));
18969
18979
  case "slider":
18970
18980
  case "text":
18971
18981
  case "password":
@@ -18974,12 +18984,12 @@ const SettingApp = (props) => {
18974
18984
  case "time":
18975
18985
  case "datetime":
18976
18986
  case "color":
18977
- 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));
18987
+ 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(root, data, e) }) }, data.id));
18978
18988
  case "image":
18979
18989
  case "file":
18980
- 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));
18990
+ return (jsxRuntime.jsx("div", { className: "file-input", title: data.description, children: jsxRuntime.jsx(Input$1, { type: "file", className: "input-custom", onChange: (e) => change_save(root, data, e) }) }, data.id));
18981
18991
  default:
18982
- 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));
18992
+ 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(root, data, e) }) }, data.id));
18983
18993
  }
18984
18994
  };
18985
18995
  //hàm tạo các thông số cấu hình và cài đặt