@esvndev/es-react-config-setting 1.0.86 → 1.0.87

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
@@ -17165,7 +17165,6 @@ const SettingApp = (props) => {
17165
17165
  }]
17166
17166
  }, obj.file, (rs) => {
17167
17167
  console.log(rs);
17168
- loadSettingConfigByGroup(dataTabSelected.current);
17169
17168
  });
17170
17169
  if (eventChange)
17171
17170
  eventChange([{ key: obj.key, value: obj.value, state: "update" }]);
@@ -17227,7 +17226,7 @@ const SettingApp = (props) => {
17227
17226
  allowed_defects_per_model_day: null
17228
17227
  }).current;
17229
17228
  //Cấu hình thông số delay tránh gửi liên tục
17230
- const change_save = (root, obj, e, index, _index, dataRoot) => {
17229
+ const change_save = (root, obj, e) => {
17231
17230
  const _m = saveSettings;
17232
17231
  if (saveSettings && _m[obj.id] !== null) {
17233
17232
  clearTimeout(_m[obj.id]);
@@ -17262,18 +17261,16 @@ const SettingApp = (props) => {
17262
17261
  _m[obj.id] = setTimeout(() => {
17263
17262
  _eventChange(_data);
17264
17263
  }, time_update);
17265
- dataRoot[index].data[_index] = value;
17266
- setSettingData([...dataRoot]);
17267
17264
  };
17268
17265
  //Hàm sử dụng tạo theo loại giá trị
17269
- const _renderInput = (root, data, index, _index, dataRoot) => {
17266
+ const _renderInput = (root, data) => {
17270
17267
  const value = formState[data.id] ?? data.value ?? "";
17271
17268
  switch (data.type) {
17272
17269
  case "switch":
17273
17270
  case "checkbox":
17274
- return (jsxRuntime.jsx("div", { className: "checkbox", title: data.description, children: jsxRuntime.jsx(Input$1, { style: { width: '237px !important' }, type: "checkbox", checked: (value === "true"), onChange: (e) => change_save(root, data, e, index, _index, dataRoot) }) }, data.id));
17271
+ return (jsxRuntime.jsx("div", { className: "checkbox", title: data.description, children: jsxRuntime.jsx(Input$1, { style: { width: '237px !important' }, type: "checkbox", checked: (value === "true" || value === true), onChange: (e) => change_save(root, data, e) }) }, data.id));
17275
17272
  case "radio":
17276
- 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, index, _index, dataRoot) }), opt.name] }, index))) }, data.id));
17273
+ 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));
17277
17274
  case "combobox":
17278
17275
  let _data_option = [];
17279
17276
  if (data.option) {
@@ -17285,7 +17282,7 @@ const SettingApp = (props) => {
17285
17282
  }
17286
17283
  }
17287
17284
  data.option = _data_option;
17288
- 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, index, _index, dataRoot), 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));
17285
+ 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));
17289
17286
  case "slider":
17290
17287
  case "text":
17291
17288
  case "password":
@@ -17294,12 +17291,12 @@ const SettingApp = (props) => {
17294
17291
  case "time":
17295
17292
  case "datetime":
17296
17293
  case "color":
17297
- 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, index, _index, dataRoot) }) }, data.id));
17294
+ 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));
17298
17295
  case "image":
17299
17296
  case "file":
17300
- 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, index, _index, dataRoot) }) }, data.id));
17297
+ 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));
17301
17298
  default:
17302
- 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, index, _index, dataRoot) }) }, data.id));
17299
+ 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));
17303
17300
  }
17304
17301
  };
17305
17302
  //hàm tạo các thông số cấu hình và cài đặt
@@ -17309,7 +17306,7 @@ const SettingApp = (props) => {
17309
17306
  jsxRuntime.jsx("div", { className: "setting-section-desc", children: jsxRuntime.jsx("div", { className: "", children: jsxRuntime.jsx("span", { children: item.description }) }) })
17310
17307
  : null, item.data ?
17311
17308
  jsxRuntime.jsx("div", { className: "setting-section-content ", children: item.data.length > 0 ? item.data.map((_item, _index) => {
17312
- return (jsxRuntime.jsxs("div", { className: 'flx flx-al-c flx-sp-btw setting-section-content__item ' + (item.data.length === 1 ? "single" : (_index === 0 ? 'first' : (_index === item.data.length - 1 ? 'last' : ""))), children: [jsxRuntime.jsxs("div", { className: "flx flx-col", style: { flex: "0 0 fit-content", maxWidth: '50%' }, children: [jsxRuntime.jsx("span", { children: _item.name }), jsxRuntime.jsx("span", { className: "setting-section-content__description", children: _item.description })] }), jsxRuntime.jsx("div", { style: { maxWidth: "50%" }, children: jsxRuntime.jsx("div", { style: { width: "100%", boxSizing: "border-box" }, children: _renderInput(item, _item, index, _index, settingData) }) })] }));
17309
+ return (jsxRuntime.jsxs("div", { className: 'flx flx-al-c flx-sp-btw setting-section-content__item ' + (item.data.length === 1 ? "single" : (_index === 0 ? 'first' : (_index === item.data.length - 1 ? 'last' : ""))), children: [jsxRuntime.jsxs("div", { className: "flx flx-col", style: { flex: "0 0 fit-content", maxWidth: '50%' }, children: [jsxRuntime.jsx("span", { children: _item.name }), jsxRuntime.jsx("span", { className: "setting-section-content__description", children: _item.description })] }), jsxRuntime.jsx("div", { style: { maxWidth: "50%" }, children: jsxRuntime.jsx("div", { style: { width: "100%", boxSizing: "border-box" }, children: _renderInput(item, _item) }) })] }));
17313
17310
  }) : null }) : null] }));
17314
17311
  })
17315
17312
  : null);