@esvndev/es-react-config-setting 1.0.86 → 1.0.88
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/components/init/index.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -19
- package/dist/index.mjs.map +1 -1
- package/dist/request/index.d.ts +1 -1
- package/dist/shared/type.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -16990,12 +16990,15 @@ const GetSettingGroup = (callback) => {
|
|
|
16990
16990
|
callback({ status: false, data: error });
|
|
16991
16991
|
});
|
|
16992
16992
|
};
|
|
16993
|
-
const GetSettingConfigClient = async (callback) => {
|
|
16993
|
+
const GetSettingConfigClient = async (filter, callback) => {
|
|
16994
16994
|
const _url = `${BASE_URL}/api/escore/get-setting-config-client`;
|
|
16995
16995
|
const _obj = {
|
|
16996
16996
|
ModuleId: REACT_APP_PRODUCT_CODE,
|
|
16997
16997
|
StateId: '',
|
|
16998
|
-
Option: JSON.stringify({
|
|
16998
|
+
Option: JSON.stringify({
|
|
16999
|
+
version: localStorage.getItem("app_config_setting_version"),
|
|
17000
|
+
...(filter ?? {})
|
|
17001
|
+
})
|
|
16999
17002
|
};
|
|
17000
17003
|
const options = {
|
|
17001
17004
|
method: 'POST',
|
|
@@ -17138,7 +17141,6 @@ const SettingApp = (props) => {
|
|
|
17138
17141
|
}]
|
|
17139
17142
|
}, obj.file, (rs) => {
|
|
17140
17143
|
console.log(rs);
|
|
17141
|
-
loadSettingConfigByGroup(dataTabSelected.current);
|
|
17142
17144
|
});
|
|
17143
17145
|
if (eventChange)
|
|
17144
17146
|
eventChange([{ key: obj.key, value: obj.value, state: "update" }]);
|
|
@@ -17200,7 +17202,7 @@ const SettingApp = (props) => {
|
|
|
17200
17202
|
allowed_defects_per_model_day: null
|
|
17201
17203
|
}).current;
|
|
17202
17204
|
//Cấu hình thông số delay tránh gửi liên tục
|
|
17203
|
-
const change_save = (root, obj, e
|
|
17205
|
+
const change_save = (root, obj, e) => {
|
|
17204
17206
|
const _m = saveSettings;
|
|
17205
17207
|
if (saveSettings && _m[obj.id] !== null) {
|
|
17206
17208
|
clearTimeout(_m[obj.id]);
|
|
@@ -17235,18 +17237,16 @@ const SettingApp = (props) => {
|
|
|
17235
17237
|
_m[obj.id] = setTimeout(() => {
|
|
17236
17238
|
_eventChange(_data);
|
|
17237
17239
|
}, time_update);
|
|
17238
|
-
dataRoot[index].data[_index] = value;
|
|
17239
|
-
setSettingData([...dataRoot]);
|
|
17240
17240
|
};
|
|
17241
17241
|
//Hàm sử dụng tạo theo loại giá trị
|
|
17242
|
-
const _renderInput = (root, data
|
|
17242
|
+
const _renderInput = (root, data) => {
|
|
17243
17243
|
const value = formState[data.id] ?? data.value ?? "";
|
|
17244
17244
|
switch (data.type) {
|
|
17245
17245
|
case "switch":
|
|
17246
17246
|
case "checkbox":
|
|
17247
|
-
return (jsx("div", { className: "checkbox", title: data.description, children: jsx(Input$1, { style: { width: '237px !important' }, type: "checkbox", checked: (value === "true"), onChange: (e) => change_save(root, data, e
|
|
17247
|
+
return (jsx("div", { className: "checkbox", title: data.description, children: jsx(Input$1, { style: { width: '237px !important' }, type: "checkbox", checked: (value === "true" || value === true), onChange: (e) => change_save(root, data, e) }) }, data.id));
|
|
17248
17248
|
case "radio":
|
|
17249
|
-
return (jsx("div", { className: "radio-group", title: data.description, children: data.option?.map((opt, index) => (jsxs("label", { children: [jsx(Input$1, { type: "radio", name: data.name, value: opt.value, checked: value === opt.value, onChange: (e) => change_save(root, data, e
|
|
17249
|
+
return (jsx("div", { className: "radio-group", title: data.description, children: data.option?.map((opt, index) => (jsxs("label", { children: [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));
|
|
17250
17250
|
case "combobox":
|
|
17251
17251
|
let _data_option = [];
|
|
17252
17252
|
if (data.option) {
|
|
@@ -17258,7 +17258,7 @@ const SettingApp = (props) => {
|
|
|
17258
17258
|
}
|
|
17259
17259
|
}
|
|
17260
17260
|
data.option = _data_option;
|
|
17261
|
-
return (jsx("div", { className: "combobox", title: data.description, children: jsxs(Input$1, { type: "select", className: "input-custom", name: data.name, value: value, onChange: (e) => change_save(root, data, e
|
|
17261
|
+
return (jsx("div", { className: "combobox", title: data.description, children: jsxs(Input$1, { type: "select", className: "input-custom", name: data.name, value: value, onChange: (e) => change_save(root, data, e), children: [jsx("option", { value: "", children: "Ch\u1ECDn m\u1ED9t gi\u00E1 tr\u1ECB" }), data.option?.map((opt, index) => (jsx("option", { value: opt.value, children: opt.name }, index)))] }) }, data.id));
|
|
17262
17262
|
case "slider":
|
|
17263
17263
|
case "text":
|
|
17264
17264
|
case "password":
|
|
@@ -17267,12 +17267,12 @@ const SettingApp = (props) => {
|
|
|
17267
17267
|
case "time":
|
|
17268
17268
|
case "datetime":
|
|
17269
17269
|
case "color":
|
|
17270
|
-
return (jsx("div", { className: `${data.type}-input`, title: data.description, children: jsx(Input$1, { type: data.type, className: "input-custom", value: value, placeholder: data.name, onChange: (e) => change_save(root, data, e
|
|
17270
|
+
return (jsx("div", { className: `${data.type}-input`, title: data.description, children: jsx(Input$1, { type: data.type, className: "input-custom", value: value, placeholder: data.name, onChange: (e) => change_save(root, data, e) }) }, data.id));
|
|
17271
17271
|
case "image":
|
|
17272
17272
|
case "file":
|
|
17273
|
-
return (jsx("div", { className: "file-input", title: data.description, children: jsx(Input$1, { type: "file", className: "input-custom", onChange: (e) => change_save(root, data, e
|
|
17273
|
+
return (jsx("div", { className: "file-input", title: data.description, children: jsx(Input$1, { type: "file", className: "input-custom", onChange: (e) => change_save(root, data, e) }) }, data.id));
|
|
17274
17274
|
default:
|
|
17275
|
-
return (jsx("div", { className: `${data.type ?? 'normal'}-input`, title: data.description, children: jsx(Input$1, { type: data.type ?? "text", value: value, onChange: (e) => change_save(root, data, e
|
|
17275
|
+
return (jsx("div", { className: `${data.type ?? 'normal'}-input`, title: data.description, children: jsx(Input$1, { type: data.type ?? "text", value: value, onChange: (e) => change_save(root, data, e) }) }, data.id));
|
|
17276
17276
|
}
|
|
17277
17277
|
};
|
|
17278
17278
|
//hàm tạo các thông số cấu hình và cài đặt
|
|
@@ -17282,7 +17282,7 @@ const SettingApp = (props) => {
|
|
|
17282
17282
|
jsx("div", { className: "setting-section-desc", children: jsx("div", { className: "", children: jsx("span", { children: item.description }) }) })
|
|
17283
17283
|
: null, item.data ?
|
|
17284
17284
|
jsx("div", { className: "setting-section-content ", children: item.data.length > 0 ? item.data.map((_item, _index) => {
|
|
17285
|
-
return (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: [jsxs("div", { className: "flx flx-col", style: { flex: "0 0 fit-content", maxWidth: '50%' }, children: [jsx("span", { children: _item.name }), jsx("span", { className: "setting-section-content__description", children: _item.description })] }), jsx("div", { style: { maxWidth: "50%" }, children: jsx("div", { style: { width: "100%", boxSizing: "border-box" }, children: _renderInput(item, _item
|
|
17285
|
+
return (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: [jsxs("div", { className: "flx flx-col", style: { flex: "0 0 fit-content", maxWidth: '50%' }, children: [jsx("span", { children: _item.name }), jsx("span", { className: "setting-section-content__description", children: _item.description })] }), jsx("div", { style: { maxWidth: "50%" }, children: jsx("div", { style: { width: "100%", boxSizing: "border-box" }, children: _renderInput(item, _item) }) })] }));
|
|
17286
17286
|
}) : null }) : null] }));
|
|
17287
17287
|
})
|
|
17288
17288
|
: null);
|
|
@@ -17297,7 +17297,8 @@ const SettingApp = (props) => {
|
|
|
17297
17297
|
|
|
17298
17298
|
const GLOBAL_WINDOW_VARIABLE = {};
|
|
17299
17299
|
const VARIABLE_FRIVATE = {
|
|
17300
|
-
FIRST_LOAD: true
|
|
17300
|
+
FIRST_LOAD: true,
|
|
17301
|
+
FILTER_SETUP: {}
|
|
17301
17302
|
};
|
|
17302
17303
|
let intervalId = null;
|
|
17303
17304
|
var TIME_RELOAD = 15000;
|
|
@@ -17309,10 +17310,10 @@ const INIT_CONFIG_SETTING = async () => {
|
|
|
17309
17310
|
intervalId = null;
|
|
17310
17311
|
}
|
|
17311
17312
|
if (!localStorage.getItem("app_config_setting_version")) {
|
|
17312
|
-
await _FETCH_AND_UPDATE();
|
|
17313
|
+
await _FETCH_AND_UPDATE(VARIABLE_FRIVATE.FILTER_SETUP);
|
|
17313
17314
|
}
|
|
17314
17315
|
intervalId = setInterval(() => {
|
|
17315
|
-
_FETCH_AND_UPDATE();
|
|
17316
|
+
_FETCH_AND_UPDATE(VARIABLE_FRIVATE.FILTER_SETUP);
|
|
17316
17317
|
}, TIME_RELOAD);
|
|
17317
17318
|
};
|
|
17318
17319
|
function base64ToBytesLength(base64String) {
|
|
@@ -17337,6 +17338,9 @@ const get_conf = (key, type) => {
|
|
|
17337
17338
|
case "text":
|
|
17338
17339
|
_ = GLOBAL_WINDOW_VARIABLE[key].value;
|
|
17339
17340
|
break;
|
|
17341
|
+
case "bool":
|
|
17342
|
+
_ = GLOBAL_WINDOW_VARIABLE[key].value == "true" || GLOBAL_WINDOW_VARIABLE[key].value == true ? true : false;
|
|
17343
|
+
break;
|
|
17340
17344
|
case "int":
|
|
17341
17345
|
try {
|
|
17342
17346
|
_ = parseInt(GLOBAL_WINDOW_VARIABLE[key].value);
|
|
@@ -17368,8 +17372,8 @@ const get_conf = (key, type) => {
|
|
|
17368
17372
|
}
|
|
17369
17373
|
return _;
|
|
17370
17374
|
};
|
|
17371
|
-
const _FETCH_AND_UPDATE = async () => {
|
|
17372
|
-
await GetSettingConfigClient((data) => {
|
|
17375
|
+
const _FETCH_AND_UPDATE = async (filter) => {
|
|
17376
|
+
await GetSettingConfigClient(filter, (data) => {
|
|
17373
17377
|
try {
|
|
17374
17378
|
if (data?.isupdatetime) {
|
|
17375
17379
|
TIME_RELOAD = (data?.timeupdate < 5000 || data?.timeupdate > 300000) ? 5000 : data?.timeupdate;
|