@esvndev/es-react-config-setting 1.0.85 → 1.0.86
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 +15 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17134,6 +17134,8 @@ const SettingApp = (props) => {
|
|
|
17134
17134
|
return { innerWidth, innerHeight };
|
|
17135
17135
|
};
|
|
17136
17136
|
const [windowSize, setWindowSize] = React.useState(getWindowSize());
|
|
17137
|
+
//Lưu dữ liệu tab đã chọn
|
|
17138
|
+
const dataTabSelected = React.useRef({});
|
|
17137
17139
|
//Cho phép tự đóng hoặc không
|
|
17138
17140
|
const [backdrop, setBackdrop] = React.useState(true);
|
|
17139
17141
|
//Sự kiện đóng/mở cài đặt
|
|
@@ -17163,6 +17165,7 @@ const SettingApp = (props) => {
|
|
|
17163
17165
|
}]
|
|
17164
17166
|
}, obj.file, (rs) => {
|
|
17165
17167
|
console.log(rs);
|
|
17168
|
+
loadSettingConfigByGroup(dataTabSelected.current);
|
|
17166
17169
|
});
|
|
17167
17170
|
if (eventChange)
|
|
17168
17171
|
eventChange([{ key: obj.key, value: obj.value, state: "update" }]);
|
|
@@ -17206,6 +17209,7 @@ const SettingApp = (props) => {
|
|
|
17206
17209
|
}, [settingData]);
|
|
17207
17210
|
//Sự kiện chọn nhóm cài đặt
|
|
17208
17211
|
const switchSettingTab = (data) => {
|
|
17212
|
+
dataTabSelected.current = data;
|
|
17209
17213
|
const updated = dataSettingGroup.map((item) => ({
|
|
17210
17214
|
...item,
|
|
17211
17215
|
active: item.id === data.id
|
|
@@ -17223,7 +17227,7 @@ const SettingApp = (props) => {
|
|
|
17223
17227
|
allowed_defects_per_model_day: null
|
|
17224
17228
|
}).current;
|
|
17225
17229
|
//Cấu hình thông số delay tránh gửi liên tục
|
|
17226
|
-
const change_save = (root, obj, e) => {
|
|
17230
|
+
const change_save = (root, obj, e, index, _index, dataRoot) => {
|
|
17227
17231
|
const _m = saveSettings;
|
|
17228
17232
|
if (saveSettings && _m[obj.id] !== null) {
|
|
17229
17233
|
clearTimeout(_m[obj.id]);
|
|
@@ -17258,16 +17262,18 @@ const SettingApp = (props) => {
|
|
|
17258
17262
|
_m[obj.id] = setTimeout(() => {
|
|
17259
17263
|
_eventChange(_data);
|
|
17260
17264
|
}, time_update);
|
|
17265
|
+
dataRoot[index].data[_index] = value;
|
|
17266
|
+
setSettingData([...dataRoot]);
|
|
17261
17267
|
};
|
|
17262
17268
|
//Hàm sử dụng tạo theo loại giá trị
|
|
17263
|
-
const _renderInput = (root, data) => {
|
|
17269
|
+
const _renderInput = (root, data, index, _index, dataRoot) => {
|
|
17264
17270
|
const value = formState[data.id] ?? data.value ?? "";
|
|
17265
17271
|
switch (data.type) {
|
|
17266
17272
|
case "switch":
|
|
17267
17273
|
case "checkbox":
|
|
17268
|
-
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) }) }, data.id));
|
|
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));
|
|
17269
17275
|
case "radio":
|
|
17270
|
-
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));
|
|
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));
|
|
17271
17277
|
case "combobox":
|
|
17272
17278
|
let _data_option = [];
|
|
17273
17279
|
if (data.option) {
|
|
@@ -17279,7 +17285,7 @@ const SettingApp = (props) => {
|
|
|
17279
17285
|
}
|
|
17280
17286
|
}
|
|
17281
17287
|
data.option = _data_option;
|
|
17282
|
-
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));
|
|
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));
|
|
17283
17289
|
case "slider":
|
|
17284
17290
|
case "text":
|
|
17285
17291
|
case "password":
|
|
@@ -17288,12 +17294,12 @@ const SettingApp = (props) => {
|
|
|
17288
17294
|
case "time":
|
|
17289
17295
|
case "datetime":
|
|
17290
17296
|
case "color":
|
|
17291
|
-
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));
|
|
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));
|
|
17292
17298
|
case "image":
|
|
17293
17299
|
case "file":
|
|
17294
|
-
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));
|
|
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));
|
|
17295
17301
|
default:
|
|
17296
|
-
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));
|
|
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));
|
|
17297
17303
|
}
|
|
17298
17304
|
};
|
|
17299
17305
|
//hàm tạo các thông số cấu hình và cài đặt
|
|
@@ -17303,7 +17309,7 @@ const SettingApp = (props) => {
|
|
|
17303
17309
|
jsxRuntime.jsx("div", { className: "setting-section-desc", children: jsxRuntime.jsx("div", { className: "", children: jsxRuntime.jsx("span", { children: item.description }) }) })
|
|
17304
17310
|
: null, item.data ?
|
|
17305
17311
|
jsxRuntime.jsx("div", { className: "setting-section-content ", children: item.data.length > 0 ? item.data.map((_item, _index) => {
|
|
17306
|
-
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) }) })] }));
|
|
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) }) })] }));
|
|
17307
17313
|
}) : null }) : null] }));
|
|
17308
17314
|
})
|
|
17309
17315
|
: null);
|