@fctc/interface-logic 1.4.5 → 1.4.7
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/configs.d.mts +15 -0
- package/dist/configs.d.ts +15 -0
- package/dist/configs.js +2386 -0
- package/dist/configs.mjs +2349 -0
- package/dist/constants.d.mts +131 -0
- package/dist/constants.d.ts +131 -0
- package/dist/constants.js +205 -0
- package/dist/constants.mjs +166 -0
- package/dist/environment.d.mts +55 -0
- package/dist/environment.d.ts +55 -0
- package/dist/environment.js +3094 -0
- package/dist/environment.mjs +3054 -0
- package/dist/hooks.d.mts +359 -0
- package/dist/hooks.d.ts +359 -0
- package/dist/{index.js → hooks.js} +10 -1012
- package/dist/{index.mjs → hooks.mjs} +5 -947
- package/dist/provider.d.mts +15 -0
- package/dist/provider.d.ts +15 -0
- package/dist/provider.js +3603 -0
- package/dist/provider.mjs +3564 -0
- package/dist/services.d.mts +255 -0
- package/dist/services.d.ts +255 -0
- package/dist/services.js +4662 -0
- package/dist/services.mjs +4617 -0
- package/dist/store.d.mts +643 -0
- package/dist/store.d.ts +643 -0
- package/dist/store.js +814 -0
- package/dist/store.mjs +709 -0
- package/dist/types.d.mts +17 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +18 -0
- package/dist/types.mjs +0 -0
- package/dist/utils.d.mts +93 -0
- package/dist/utils.d.ts +93 -0
- package/dist/utils.js +2962 -0
- package/dist/utils.mjs +2896 -0
- package/dist/view-type-BGJfDe73.d.mts +113 -0
- package/dist/view-type-BGJfDe73.d.ts +113 -0
- package/package.json +1 -1
- package/dist/index.d.mts +0 -1212
- package/dist/index.d.ts +0 -1212
|
@@ -27,66 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
|
-
// src/
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
33
|
-
ActionService: () => action_service_default,
|
|
34
|
-
AuthService: () => auth_service_default,
|
|
35
|
-
CompanyService: () => company_service_default,
|
|
36
|
-
ComponentType: () => ComponentType,
|
|
37
|
-
EnvStore: () => EnvStore,
|
|
38
|
-
ExcelService: () => excel_service_default,
|
|
39
|
-
FieldTypeConstants: () => FieldTypeConstants,
|
|
40
|
-
FormService: () => form_service_default,
|
|
41
|
-
KanbanService: () => kanban_service_default,
|
|
42
|
-
KeyConstants: () => KeyConstants,
|
|
43
|
-
MethodConstants: () => MethodConstants,
|
|
44
|
-
MethodType: () => MethodType,
|
|
45
|
-
ModelConstants: () => ModelConstants,
|
|
46
|
-
ModelService: () => model_service_default,
|
|
47
|
-
SearchType: () => SearchType,
|
|
48
|
-
UriConstants: () => UriConstants,
|
|
49
|
-
UserService: () => user_service_default,
|
|
50
|
-
VersionGate: () => VersionGate,
|
|
51
|
-
ViewService: () => view_service_default,
|
|
52
|
-
WIDGETAVATAR: () => WIDGETAVATAR,
|
|
53
|
-
WIDGETCOLOR: () => WIDGETCOLOR,
|
|
54
|
-
WIDGETCURRENCY: () => WIDGETCURRENCY,
|
|
55
|
-
WIDGETNOSTRING: () => WIDGETNOSTRING,
|
|
56
|
-
WIDGETSTATUS: () => WIDGETSTATUS,
|
|
57
|
-
WesapError: () => WesapError,
|
|
58
|
-
axiosClient: () => axiosClient,
|
|
59
|
-
checkIsImageLink: () => checkIsImageLink,
|
|
60
|
-
convertFloatToTime: () => convertFloatToTime,
|
|
61
|
-
convertTimeToFloat: () => convertTimeToFloat,
|
|
62
|
-
copyTextToClipboard: () => copyTextToClipboard,
|
|
63
|
-
domainHelper: () => domainHelper,
|
|
64
|
-
evalJSONContext: () => evalJSONContext,
|
|
65
|
-
evalJSONDomain: () => evalJSONDomain,
|
|
66
|
-
filterFieldDirty: () => filterFieldDirty,
|
|
67
|
-
formatCurrency: () => formatCurrency,
|
|
68
|
-
formatDate: () => formatDate,
|
|
69
|
-
formatFileSize: () => formatFileSize,
|
|
70
|
-
formatSortingString: () => formatSortingString,
|
|
71
|
-
formatUrlPath: () => formatUrlPath,
|
|
72
|
-
getEnv: () => getEnv,
|
|
73
|
-
getFieldsOnChange: () => getFieldsOnChange,
|
|
74
|
-
getOffSet: () => getOffSet,
|
|
75
|
-
getSubdomain: () => getSubdomain,
|
|
76
|
-
handleError: () => handleError,
|
|
77
|
-
isBase64File: () => isBase64File,
|
|
78
|
-
isBase64Image: () => isBase64Image,
|
|
79
|
-
isObjectEmpty: () => isObjectEmpty,
|
|
80
|
-
mergeObjects: () => mergeObjects,
|
|
81
|
-
removeUndefinedFields: () => removeUndefinedFields,
|
|
82
|
-
resequence: () => resequence,
|
|
83
|
-
selectEnv: () => selectEnv,
|
|
84
|
-
setEnvFile: () => setEnvFile,
|
|
85
|
-
stringToColor: () => stringToColor,
|
|
86
|
-
toQueryString: () => toQueryString,
|
|
87
|
-
updateTokenParamInOriginalRequest: () => updateTokenParamInOriginalRequest,
|
|
88
|
-
useAppDispatch: () => useAppDispatch,
|
|
89
|
-
useAppSelector: () => useAppSelector,
|
|
30
|
+
// src/hooks.ts
|
|
31
|
+
var hooks_exports = {};
|
|
32
|
+
__export(hooks_exports, {
|
|
90
33
|
useButton: () => use_button_default,
|
|
91
34
|
useChangeStatus: () => use_change_status_default,
|
|
92
35
|
useDelete: () => use_delete_default,
|
|
@@ -94,7 +37,6 @@ __export(index_exports, {
|
|
|
94
37
|
useDuplicateRecord: () => use_duplicate_record_default,
|
|
95
38
|
useExecuteImport: () => uss_execute_import_default,
|
|
96
39
|
useExportExcel: () => use_export_excel_default,
|
|
97
|
-
useField: () => useField,
|
|
98
40
|
useForgotPassword: () => use_forgot_password_default,
|
|
99
41
|
useForgotPasswordSSO: () => use_forgotpassword_sso_default,
|
|
100
42
|
useGet2FAMethods: () => uset_get_2FA_method_default,
|
|
@@ -150,48 +92,17 @@ __export(index_exports, {
|
|
|
150
92
|
useSettingsWebRead2fa: () => use_settings_web_read_2fa_default,
|
|
151
93
|
useSignInSSO: () => use_signin_sso_default,
|
|
152
94
|
useSwitchLocale: () => use_switch_locale_default,
|
|
153
|
-
useTabModel: () => useTabModel,
|
|
154
95
|
useUpdatePassword: () => use_update_password_default,
|
|
155
96
|
useUploadFile: () => use_upload_file_default,
|
|
156
97
|
useUploadIdFile: () => use_upload_id_file_default,
|
|
157
98
|
useUploadImage: () => use_upload_image_default,
|
|
158
99
|
useVerify2FA: () => use_verify_2FA_default,
|
|
159
|
-
useVerifyTotp: () => use_verify_totp_default
|
|
160
|
-
validateAndParseDate: () => validateAndParseDate
|
|
100
|
+
useVerifyTotp: () => use_verify_totp_default
|
|
161
101
|
});
|
|
162
|
-
module.exports = __toCommonJS(
|
|
102
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
163
103
|
|
|
164
|
-
// src/
|
|
165
|
-
var
|
|
166
|
-
|
|
167
|
-
// src/constants/api/key-constant.ts
|
|
168
|
-
var KeyConstants = /* @__PURE__ */ ((KeyConstants2) => {
|
|
169
|
-
KeyConstants2["PROFILE"] = "userinfo";
|
|
170
|
-
KeyConstants2["CURRENT_COMPANY"] = "current_company";
|
|
171
|
-
KeyConstants2["LIST_COMPANY"] = "list_company";
|
|
172
|
-
KeyConstants2["COMPANY_INFO"] = "company_info";
|
|
173
|
-
KeyConstants2["MENU"] = "menus";
|
|
174
|
-
KeyConstants2["GET_VIEW_BY_ACTION"] = "get_view_by_action";
|
|
175
|
-
KeyConstants2["ACTION_DETAIL"] = "action_detail";
|
|
176
|
-
KeyConstants2["GET_DATA_SELECTION"] = "get_data_select";
|
|
177
|
-
KeyConstants2["WEB_SAVE"] = "web_save";
|
|
178
|
-
KeyConstants2["WEB_READ"] = "web_read";
|
|
179
|
-
KeyConstants2["GET_PROVIDER"] = "get_provider";
|
|
180
|
-
return KeyConstants2;
|
|
181
|
-
})(KeyConstants || {});
|
|
182
|
-
|
|
183
|
-
// src/constants/api/method-constant.ts
|
|
184
|
-
var MethodConstants = /* @__PURE__ */ ((MethodConstants2) => {
|
|
185
|
-
MethodConstants2["WEB_SEARCH_READ"] = "web_search_read";
|
|
186
|
-
MethodConstants2["WEB_READ_GROUP"] = "web_read_group";
|
|
187
|
-
MethodConstants2["WEB_READ"] = "web_read";
|
|
188
|
-
MethodConstants2["WEB_SAVE"] = "web_save";
|
|
189
|
-
MethodConstants2["UNLINK"] = "unlink";
|
|
190
|
-
MethodConstants2["ONCHANGE"] = "onchange";
|
|
191
|
-
MethodConstants2["GET_ONCHANGE_FIELDS"] = "get_fields_onchange";
|
|
192
|
-
MethodConstants2["GET_FIELD_VIEW"] = "get_fields_view_v2";
|
|
193
|
-
return MethodConstants2;
|
|
194
|
-
})(MethodConstants || {});
|
|
104
|
+
// src/hooks/auth/use-forgot-password.ts
|
|
105
|
+
var import_react_query = require("@tanstack/react-query");
|
|
195
106
|
|
|
196
107
|
// src/constants/api/uri-constant.ts
|
|
197
108
|
var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
@@ -223,380 +134,11 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
|
|
|
223
134
|
return UriConstants2;
|
|
224
135
|
})(UriConstants || {});
|
|
225
136
|
|
|
226
|
-
// src/
|
|
227
|
-
var
|
|
228
|
-
code;
|
|
229
|
-
constructor(message, code) {
|
|
230
|
-
super(message);
|
|
231
|
-
this.code = code;
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
function handleError(error, env2) {
|
|
235
|
-
if (error instanceof WesapError) {
|
|
236
|
-
env2.services.notification.error(error.message);
|
|
237
|
-
} else {
|
|
238
|
-
env2.services.notification.error("An unexpected error occurred");
|
|
239
|
-
}
|
|
240
|
-
}
|
|
137
|
+
// src/configs/axios-client.ts
|
|
138
|
+
var import_axios = __toESM(require("axios"));
|
|
241
139
|
|
|
242
140
|
// src/utils/format.ts
|
|
243
141
|
var import_moment = __toESM(require("moment"));
|
|
244
|
-
var formatCurrency = (amount, currency = "USD") => {
|
|
245
|
-
const formatter = new Intl.NumberFormat("vi-VN", {
|
|
246
|
-
style: "currency",
|
|
247
|
-
currency,
|
|
248
|
-
minimumFractionDigits: 0
|
|
249
|
-
});
|
|
250
|
-
return formatter.format(amount).replaceAll(".", ",");
|
|
251
|
-
};
|
|
252
|
-
var formatDate = (date, locale = "en-US") => {
|
|
253
|
-
return new Intl.DateTimeFormat(locale).format(new Date(date));
|
|
254
|
-
};
|
|
255
|
-
var validateAndParseDate = (input, isDateTime = false) => {
|
|
256
|
-
if (!input || typeof input !== "string") return null;
|
|
257
|
-
const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
|
|
258
|
-
const dateFormat = "YYYY-MM-DD";
|
|
259
|
-
const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
|
|
260
|
-
const currentDay = (0, import_moment.default)().format("DD");
|
|
261
|
-
const currentMonth = (0, import_moment.default)().format("MM");
|
|
262
|
-
const currentYear = (0, import_moment.default)().format("YYYY");
|
|
263
|
-
const defaultTime = "00:00:00";
|
|
264
|
-
const maxYear = parseInt(currentYear) + 10;
|
|
265
|
-
const isValidDate = (day, month, year) => {
|
|
266
|
-
const date = (0, import_moment.default)(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
|
|
267
|
-
return date.isValid();
|
|
268
|
-
};
|
|
269
|
-
const isValidTime = (hour, minute = "00", second = "00") => {
|
|
270
|
-
const h = parseInt(hour, 10);
|
|
271
|
-
const m = parseInt(minute, 10);
|
|
272
|
-
const s = parseInt(second, 10);
|
|
273
|
-
return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
|
|
274
|
-
};
|
|
275
|
-
const formatOutput = (day, month, year, time = defaultTime) => {
|
|
276
|
-
let result = (0, import_moment.default)(
|
|
277
|
-
`${day}-${month}-${year} ${time}`,
|
|
278
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
279
|
-
);
|
|
280
|
-
if (!result.isValid()) return null;
|
|
281
|
-
if (isDateTime) {
|
|
282
|
-
result = result.subtract(7, "hours");
|
|
283
|
-
return result.format(dateTimeFormat);
|
|
284
|
-
}
|
|
285
|
-
return result.format(dateFormat);
|
|
286
|
-
};
|
|
287
|
-
if (isDateTime && input.match(
|
|
288
|
-
/^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
|
|
289
|
-
)) {
|
|
290
|
-
const [datePart, timePart] = input.split(/\s+/);
|
|
291
|
-
const dateParts = datePart.split(/[\/-]/);
|
|
292
|
-
const timeParts = timePart.split(":");
|
|
293
|
-
const day = dateParts[0].padStart(2, "0");
|
|
294
|
-
const month = dateParts[1].padStart(2, "0");
|
|
295
|
-
const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
|
|
296
|
-
const hour = timeParts[0].padStart(2, "0");
|
|
297
|
-
const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
|
|
298
|
-
const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
|
|
299
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
300
|
-
let result = (0, import_moment.default)(
|
|
301
|
-
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
302
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
303
|
-
);
|
|
304
|
-
if (!result.isValid()) return null;
|
|
305
|
-
result = result.subtract(7, "hours");
|
|
306
|
-
return result.format(dateTimeFormat);
|
|
307
|
-
}
|
|
308
|
-
return null;
|
|
309
|
-
}
|
|
310
|
-
if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
|
|
311
|
-
const [year, month, day] = cleanInput.split("-");
|
|
312
|
-
if (isValidDate(day, month, year)) {
|
|
313
|
-
return formatOutput(day, month, year);
|
|
314
|
-
}
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
317
|
-
if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
|
|
318
|
-
const [day, month, year] = cleanInput.split("/");
|
|
319
|
-
const paddedDay = day.padStart(2, "0");
|
|
320
|
-
const paddedMonth = month.padStart(2, "0");
|
|
321
|
-
const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
|
|
322
|
-
if (isValidDate(paddedDay, paddedMonth, fullYear)) {
|
|
323
|
-
return formatOutput(paddedDay, paddedMonth, fullYear);
|
|
324
|
-
}
|
|
325
|
-
return null;
|
|
326
|
-
}
|
|
327
|
-
if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
|
|
328
|
-
const [day, month, year] = cleanInput.split("-");
|
|
329
|
-
const paddedDay = day.padStart(2, "0");
|
|
330
|
-
const paddedMonth = month.padStart(2, "0");
|
|
331
|
-
const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
|
|
332
|
-
if (isValidDate(paddedDay, paddedMonth, fullYear)) {
|
|
333
|
-
return formatOutput(paddedDay, paddedMonth, fullYear);
|
|
334
|
-
}
|
|
335
|
-
return null;
|
|
336
|
-
}
|
|
337
|
-
if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
|
|
338
|
-
const [day, month] = cleanInput.split(/[\/-]/);
|
|
339
|
-
const paddedDay = day.padStart(2, "0");
|
|
340
|
-
const paddedMonth = month.padStart(2, "0");
|
|
341
|
-
if (isValidDate(paddedDay, paddedMonth, currentYear)) {
|
|
342
|
-
return formatOutput(paddedDay, paddedMonth, currentYear);
|
|
343
|
-
}
|
|
344
|
-
return null;
|
|
345
|
-
}
|
|
346
|
-
if (cleanInput.match(/^\d{4}$/)) {
|
|
347
|
-
const num = parseInt(cleanInput, 10);
|
|
348
|
-
if (num >= 2e3 && num <= maxYear) {
|
|
349
|
-
if (isValidDate(currentDay, currentMonth, num.toString())) {
|
|
350
|
-
return formatOutput(currentDay, currentMonth, num.toString());
|
|
351
|
-
}
|
|
352
|
-
return null;
|
|
353
|
-
}
|
|
354
|
-
const day = cleanInput.slice(0, 2);
|
|
355
|
-
const month = cleanInput.slice(2, 4);
|
|
356
|
-
if (isValidDate(day, month, currentYear)) {
|
|
357
|
-
return formatOutput(day, month, currentYear);
|
|
358
|
-
}
|
|
359
|
-
return null;
|
|
360
|
-
}
|
|
361
|
-
if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
|
|
362
|
-
const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
|
|
363
|
-
let result = (0, import_moment.default)().subtract(daysToSubtract, "days");
|
|
364
|
-
if (isDateTime) {
|
|
365
|
-
result = result.subtract(7, "hours");
|
|
366
|
-
}
|
|
367
|
-
if (result.isValid()) {
|
|
368
|
-
return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
|
|
369
|
-
}
|
|
370
|
-
return null;
|
|
371
|
-
}
|
|
372
|
-
if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
|
|
373
|
-
const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
|
|
374
|
-
const day = parts[0].padStart(2, "0");
|
|
375
|
-
const month = parts[1].padStart(2, "0");
|
|
376
|
-
let year = parts[2];
|
|
377
|
-
year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
|
|
378
|
-
if (isValidDate(day, month, year)) {
|
|
379
|
-
return formatOutput(day, month, year);
|
|
380
|
-
}
|
|
381
|
-
return null;
|
|
382
|
-
}
|
|
383
|
-
if (isDateTime) {
|
|
384
|
-
if (cleanInput.length === 9) {
|
|
385
|
-
const day = cleanInput.slice(0, 2);
|
|
386
|
-
const month = cleanInput.slice(2, 4);
|
|
387
|
-
const year = cleanInput.slice(4, 8);
|
|
388
|
-
const hour = cleanInput.slice(8, 9).padStart(2, "0");
|
|
389
|
-
if (isValidDate(day, month, year) && isValidTime(hour)) {
|
|
390
|
-
let result = (0, import_moment.default)(
|
|
391
|
-
`${day}-${month}-${year} ${hour}:00:00`,
|
|
392
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
393
|
-
);
|
|
394
|
-
if (!result.isValid()) return null;
|
|
395
|
-
result = result.subtract(7, "hours");
|
|
396
|
-
return result.format(dateTimeFormat);
|
|
397
|
-
}
|
|
398
|
-
return null;
|
|
399
|
-
}
|
|
400
|
-
if (cleanInput.length === 10) {
|
|
401
|
-
const day = cleanInput.slice(0, 2);
|
|
402
|
-
const month = cleanInput.slice(2, 4);
|
|
403
|
-
const year = cleanInput.slice(4, 8);
|
|
404
|
-
const hour = cleanInput.slice(8, 10);
|
|
405
|
-
if (isValidDate(day, month, year) && isValidTime(hour)) {
|
|
406
|
-
let result = (0, import_moment.default)(
|
|
407
|
-
`${day}-${month}-${year} ${hour}:00:00`,
|
|
408
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
409
|
-
);
|
|
410
|
-
if (!result.isValid()) return null;
|
|
411
|
-
result = result.subtract(7, "hours");
|
|
412
|
-
return result.format(dateTimeFormat);
|
|
413
|
-
}
|
|
414
|
-
return null;
|
|
415
|
-
}
|
|
416
|
-
if (cleanInput.length === 11) {
|
|
417
|
-
const day = cleanInput.slice(0, 2);
|
|
418
|
-
const month = cleanInput.slice(2, 4);
|
|
419
|
-
const year = cleanInput.slice(4, 8);
|
|
420
|
-
const hour = cleanInput.slice(8, 10);
|
|
421
|
-
const minute = cleanInput.slice(10, 11).padStart(2, "0");
|
|
422
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
|
|
423
|
-
let result = (0, import_moment.default)(
|
|
424
|
-
`${day}-${month}-${year} ${hour}:${minute}:00`,
|
|
425
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
426
|
-
);
|
|
427
|
-
if (!result.isValid()) return null;
|
|
428
|
-
result = result.subtract(7, "hours");
|
|
429
|
-
return result.format(dateTimeFormat);
|
|
430
|
-
}
|
|
431
|
-
return null;
|
|
432
|
-
}
|
|
433
|
-
if (cleanInput.length === 12) {
|
|
434
|
-
const day = cleanInput.slice(0, 2);
|
|
435
|
-
const month = cleanInput.slice(2, 4);
|
|
436
|
-
const year = cleanInput.slice(4, 8);
|
|
437
|
-
const hour = cleanInput.slice(8, 10);
|
|
438
|
-
const minute = cleanInput.slice(10, 12);
|
|
439
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
|
|
440
|
-
let result = (0, import_moment.default)(
|
|
441
|
-
`${day}-${month}-${year} ${hour}:${minute}:00`,
|
|
442
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
443
|
-
);
|
|
444
|
-
if (!result.isValid()) return null;
|
|
445
|
-
result = result.subtract(7, "hours");
|
|
446
|
-
return result.format(dateTimeFormat);
|
|
447
|
-
}
|
|
448
|
-
return null;
|
|
449
|
-
}
|
|
450
|
-
if (cleanInput.length === 13) {
|
|
451
|
-
const day = cleanInput.slice(0, 2);
|
|
452
|
-
const month = cleanInput.slice(2, 4);
|
|
453
|
-
const year = cleanInput.slice(4, 8);
|
|
454
|
-
const hour = cleanInput.slice(8, 10);
|
|
455
|
-
const minute = cleanInput.slice(10, 12);
|
|
456
|
-
const second = cleanInput.slice(12, 13).padStart(2, "0");
|
|
457
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
458
|
-
let result = (0, import_moment.default)(
|
|
459
|
-
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
460
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
461
|
-
);
|
|
462
|
-
if (!result.isValid()) return null;
|
|
463
|
-
result = result.subtract(7, "hours");
|
|
464
|
-
return result.format(dateTimeFormat);
|
|
465
|
-
}
|
|
466
|
-
return null;
|
|
467
|
-
}
|
|
468
|
-
if (cleanInput.length === 14) {
|
|
469
|
-
const day = cleanInput.slice(0, 2);
|
|
470
|
-
const month = cleanInput.slice(2, 4);
|
|
471
|
-
const year = cleanInput.slice(4, 8);
|
|
472
|
-
const hour = cleanInput.slice(8, 10);
|
|
473
|
-
const minute = cleanInput.slice(10, 12);
|
|
474
|
-
const second = cleanInput.slice(12, 14);
|
|
475
|
-
if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
|
|
476
|
-
let result = (0, import_moment.default)(
|
|
477
|
-
`${day}-${month}-${year} ${hour}:${minute}:${second}`,
|
|
478
|
-
"DD-MM-YYYY HH:mm:ss"
|
|
479
|
-
);
|
|
480
|
-
if (!result.isValid()) return null;
|
|
481
|
-
result = result.subtract(7, "hours");
|
|
482
|
-
return result.format(dateTimeFormat);
|
|
483
|
-
}
|
|
484
|
-
return null;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
const len = cleanInput.length;
|
|
488
|
-
if (len === 1 || len === 2) {
|
|
489
|
-
const paddedDay = cleanInput.padStart(2, "0");
|
|
490
|
-
if (isValidDate(paddedDay, currentMonth, currentYear)) {
|
|
491
|
-
return formatOutput(paddedDay, currentMonth, currentYear);
|
|
492
|
-
}
|
|
493
|
-
return null;
|
|
494
|
-
}
|
|
495
|
-
if (len === 3) {
|
|
496
|
-
const day = cleanInput.slice(0, 2);
|
|
497
|
-
const month = cleanInput.slice(2, 3).padStart(2, "0");
|
|
498
|
-
if (isValidDate(day, month, currentYear)) {
|
|
499
|
-
return formatOutput(day, month, currentYear);
|
|
500
|
-
}
|
|
501
|
-
return null;
|
|
502
|
-
}
|
|
503
|
-
if (len === 6) {
|
|
504
|
-
const day = cleanInput.slice(0, 2);
|
|
505
|
-
const month = cleanInput.slice(2, 4);
|
|
506
|
-
let year = cleanInput.slice(4, 6);
|
|
507
|
-
year = `20${year}`;
|
|
508
|
-
if (parseInt(month) > 12) {
|
|
509
|
-
if (isValidDate(day, currentMonth, currentYear)) {
|
|
510
|
-
return formatOutput(day, currentMonth, currentYear);
|
|
511
|
-
}
|
|
512
|
-
return null;
|
|
513
|
-
}
|
|
514
|
-
if (isValidDate(day, month, year)) {
|
|
515
|
-
return formatOutput(day, month, year);
|
|
516
|
-
}
|
|
517
|
-
return null;
|
|
518
|
-
}
|
|
519
|
-
if (len === 7) {
|
|
520
|
-
return null;
|
|
521
|
-
}
|
|
522
|
-
if (len === 8) {
|
|
523
|
-
const day = cleanInput.slice(0, 2);
|
|
524
|
-
const month = cleanInput.slice(2, 4);
|
|
525
|
-
const year = cleanInput.slice(4, 8);
|
|
526
|
-
if (isValidDate(day, month, year)) {
|
|
527
|
-
return formatOutput(day, month, year);
|
|
528
|
-
}
|
|
529
|
-
return null;
|
|
530
|
-
}
|
|
531
|
-
if (len > 8 && !isDateTime) {
|
|
532
|
-
return null;
|
|
533
|
-
}
|
|
534
|
-
return null;
|
|
535
|
-
};
|
|
536
|
-
|
|
537
|
-
// src/constants/field/field-type-constant.ts
|
|
538
|
-
var FieldTypeConstants = /* @__PURE__ */ ((FieldTypeConstants2) => {
|
|
539
|
-
FieldTypeConstants2["CHAR"] = "char";
|
|
540
|
-
FieldTypeConstants2["TEXT"] = "text";
|
|
541
|
-
FieldTypeConstants2["INTEGER"] = "integer";
|
|
542
|
-
FieldTypeConstants2["FLOAT"] = "float";
|
|
543
|
-
FieldTypeConstants2["BOOLEAN"] = "boolean";
|
|
544
|
-
FieldTypeConstants2["DATE"] = "date";
|
|
545
|
-
FieldTypeConstants2["DATETIME"] = "datetime";
|
|
546
|
-
FieldTypeConstants2["BINARY"] = "binary";
|
|
547
|
-
FieldTypeConstants2["SELECTION"] = "selection";
|
|
548
|
-
FieldTypeConstants2["HTML"] = "html";
|
|
549
|
-
FieldTypeConstants2["MANY2ONE"] = "many2one";
|
|
550
|
-
FieldTypeConstants2["ONE2MANY"] = "one2many";
|
|
551
|
-
FieldTypeConstants2["MANY2MANY"] = "many2many";
|
|
552
|
-
FieldTypeConstants2["MONETARY"] = "monetary";
|
|
553
|
-
FieldTypeConstants2["REFERENCE"] = "reference";
|
|
554
|
-
FieldTypeConstants2["FUNCTION"] = "function";
|
|
555
|
-
FieldTypeConstants2["PROPERTY"] = "property";
|
|
556
|
-
return FieldTypeConstants2;
|
|
557
|
-
})(FieldTypeConstants || {});
|
|
558
|
-
|
|
559
|
-
// src/constants/method/method-type-constant.ts
|
|
560
|
-
var MethodType = /* @__PURE__ */ ((MethodType2) => {
|
|
561
|
-
MethodType2[MethodType2["CREATE"] = 0] = "CREATE";
|
|
562
|
-
MethodType2[MethodType2["UPDATE"] = 1] = "UPDATE";
|
|
563
|
-
MethodType2[MethodType2["DELETE"] = 2] = "DELETE";
|
|
564
|
-
MethodType2[MethodType2["UNLINK"] = 3] = "UNLINK";
|
|
565
|
-
MethodType2[MethodType2["NO_CHANGE"] = 4] = "NO_CHANGE";
|
|
566
|
-
return MethodType2;
|
|
567
|
-
})(MethodType || {});
|
|
568
|
-
|
|
569
|
-
// src/constants/model/model-constant.ts
|
|
570
|
-
var ModelConstants = /* @__PURE__ */ ((ModelConstants2) => {
|
|
571
|
-
ModelConstants2["MENU"] = "ir.ui.menu";
|
|
572
|
-
ModelConstants2["USER"] = "res.users";
|
|
573
|
-
ModelConstants2["COMPANY"] = "res.company";
|
|
574
|
-
ModelConstants2["WINDOW_ACTION"] = "ir.actions.act_window";
|
|
575
|
-
ModelConstants2["BASE_IMPORT"] = "base_import.import";
|
|
576
|
-
ModelConstants2["GET_IMPORT"] = "get_import_templates";
|
|
577
|
-
return ModelConstants2;
|
|
578
|
-
})(ModelConstants || {});
|
|
579
|
-
|
|
580
|
-
// src/constants/type/index.ts
|
|
581
|
-
var ComponentType = /* @__PURE__ */ ((ComponentType2) => {
|
|
582
|
-
ComponentType2["GROUP"] = "group";
|
|
583
|
-
ComponentType2["FIELD"] = "field";
|
|
584
|
-
ComponentType2["TREE"] = "tree";
|
|
585
|
-
ComponentType2["DIV"] = "div";
|
|
586
|
-
ComponentType2["LIST"] = "list";
|
|
587
|
-
ComponentType2["FORM"] = "form";
|
|
588
|
-
ComponentType2["SETTINGS"] = "setting";
|
|
589
|
-
ComponentType2["SPAN"] = "span";
|
|
590
|
-
ComponentType2["KANBAN"] = "kanban";
|
|
591
|
-
ComponentType2["CALENDAR"] = "calendar";
|
|
592
|
-
ComponentType2["TYPE"] = "view-type";
|
|
593
|
-
return ComponentType2;
|
|
594
|
-
})(ComponentType || {});
|
|
595
|
-
var SearchType = {
|
|
596
|
-
FILTER: "filter_by",
|
|
597
|
-
SEARCH: "search_by",
|
|
598
|
-
GROUP: "group_by"
|
|
599
|
-
};
|
|
600
142
|
|
|
601
143
|
// src/constants/widget/widget-avatar-constant.ts
|
|
602
144
|
var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
@@ -604,28 +146,6 @@ var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
|
|
|
604
146
|
WIDGETAVATAR2["many2many_avatar_user"] = "many2many_avatar_user";
|
|
605
147
|
return WIDGETAVATAR2;
|
|
606
148
|
})(WIDGETAVATAR || {});
|
|
607
|
-
var WIDGETCURRENCY = /* @__PURE__ */ ((WIDGETCURRENCY2) => {
|
|
608
|
-
WIDGETCURRENCY2["many2one_avatar_user"] = "many2one_avatar_user";
|
|
609
|
-
WIDGETCURRENCY2["many2many_avatar_user"] = "many2many_avatar_user";
|
|
610
|
-
return WIDGETCURRENCY2;
|
|
611
|
-
})(WIDGETCURRENCY || {});
|
|
612
|
-
|
|
613
|
-
// src/constants/widget/widget-color-constant.ts
|
|
614
|
-
var WIDGETCOLOR = /* @__PURE__ */ ((WIDGETCOLOR2) => {
|
|
615
|
-
WIDGETCOLOR2["many2many_tags"] = "many2many_tags";
|
|
616
|
-
WIDGETCOLOR2["helpdesk_sla_many2many_tags"] = "helpdesk_sla_many2many_tags";
|
|
617
|
-
return WIDGETCOLOR2;
|
|
618
|
-
})(WIDGETCOLOR || {});
|
|
619
|
-
|
|
620
|
-
// src/constants/widget/widget-status-constant.ts
|
|
621
|
-
var WIDGETSTATUS = /* @__PURE__ */ ((WIDGETSTATUS2) => {
|
|
622
|
-
WIDGETSTATUS2["sla_status_ids"] = "sla_status_ids";
|
|
623
|
-
return WIDGETSTATUS2;
|
|
624
|
-
})(WIDGETSTATUS || {});
|
|
625
|
-
var WIDGETNOSTRING = /* @__PURE__ */ ((WIDGETNOSTRING2) => {
|
|
626
|
-
WIDGETNOSTRING2["sla_status_ids"] = "sla_status_ids";
|
|
627
|
-
return WIDGETNOSTRING2;
|
|
628
|
-
})(WIDGETNOSTRING || {});
|
|
629
149
|
|
|
630
150
|
// src/utils/domain/py_tokenizer.ts
|
|
631
151
|
var TokenizerError = class extends Error {
|
|
@@ -2394,48 +1914,6 @@ function parseExpr(expr) {
|
|
|
2394
1914
|
const tokens = tokenize(expr);
|
|
2395
1915
|
return parse(tokens);
|
|
2396
1916
|
}
|
|
2397
|
-
function evaluateExpr(expr, context = {}) {
|
|
2398
|
-
let ast;
|
|
2399
|
-
try {
|
|
2400
|
-
ast = parseExpr(expr);
|
|
2401
|
-
} catch (error) {
|
|
2402
|
-
throw new EvalError(
|
|
2403
|
-
`Can not parse python expression: (${expr})
|
|
2404
|
-
Error: ${error.message}`
|
|
2405
|
-
);
|
|
2406
|
-
}
|
|
2407
|
-
try {
|
|
2408
|
-
return evaluate(ast, context);
|
|
2409
|
-
} catch (error) {
|
|
2410
|
-
throw new EvalError(
|
|
2411
|
-
`Can not evaluate python expression: (${expr})
|
|
2412
|
-
Error: ${error.message}`
|
|
2413
|
-
);
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
function evaluateBooleanExpr(expr, context = {}) {
|
|
2417
|
-
if (!expr || expr === "False" || expr === "0") {
|
|
2418
|
-
return false;
|
|
2419
|
-
}
|
|
2420
|
-
if (expr === "True" || expr === "1") {
|
|
2421
|
-
return true;
|
|
2422
|
-
}
|
|
2423
|
-
return evaluateExpr(`bool(${expr})`, context);
|
|
2424
|
-
}
|
|
2425
|
-
|
|
2426
|
-
// src/utils/domain/context.ts
|
|
2427
|
-
function evalPartialContext(_context, evaluationContext = {}) {
|
|
2428
|
-
const ast = parseExpr(_context);
|
|
2429
|
-
const context = {};
|
|
2430
|
-
for (const key in ast.value) {
|
|
2431
|
-
const value = ast.value[key];
|
|
2432
|
-
try {
|
|
2433
|
-
context[key] = evaluate(value, evaluationContext);
|
|
2434
|
-
} catch {
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2437
|
-
return context;
|
|
2438
|
-
}
|
|
2439
1917
|
|
|
2440
1918
|
// src/utils/domain/objects.ts
|
|
2441
1919
|
function shallowEqual(obj1, obj2, comparisonFn = (a, b) => a === b) {
|
|
@@ -2774,280 +2252,14 @@ function matchDomain(record, domain) {
|
|
|
2774
2252
|
}
|
|
2775
2253
|
return matchCondition(record, condStack.pop());
|
|
2776
2254
|
}
|
|
2777
|
-
var checkDomain = (context, domain) => {
|
|
2778
|
-
try {
|
|
2779
|
-
if (domain === void 0 || domain === "0" || domain === "False" || domain === false) {
|
|
2780
|
-
return false;
|
|
2781
|
-
} else if (domain === "1" || domain === "True" || domain === true) {
|
|
2782
|
-
return true;
|
|
2783
|
-
}
|
|
2784
|
-
try {
|
|
2785
|
-
if (context && domain) {
|
|
2786
|
-
const d = new Domain(domain);
|
|
2787
|
-
return d.contains(context);
|
|
2788
|
-
}
|
|
2789
|
-
} catch (error) {
|
|
2790
|
-
if (context && domain) {
|
|
2791
|
-
const domainEval = evaluateBooleanExpr(domain, context);
|
|
2792
|
-
return domainEval;
|
|
2793
|
-
}
|
|
2794
|
-
return false;
|
|
2795
|
-
}
|
|
2796
|
-
return false;
|
|
2797
|
-
} catch (e) {
|
|
2798
|
-
return false;
|
|
2799
|
-
}
|
|
2800
|
-
};
|
|
2801
|
-
var matchDomains = (context, domains) => {
|
|
2802
|
-
if (Array.isArray(domains)) {
|
|
2803
|
-
if (domains?.length > 0) {
|
|
2804
|
-
return domains && domains.some((domain) => checkDomain(context, domain));
|
|
2805
|
-
}
|
|
2806
|
-
} else return checkDomain(context, domains);
|
|
2807
|
-
return false;
|
|
2808
|
-
};
|
|
2809
2255
|
|
|
2810
2256
|
// src/utils/function.ts
|
|
2811
2257
|
var import_react = require("react");
|
|
2812
|
-
var evalJSONContext = (_context, context = {}) => {
|
|
2813
|
-
try {
|
|
2814
|
-
return evalPartialContext(_context, context);
|
|
2815
|
-
} catch (err) {
|
|
2816
|
-
return null;
|
|
2817
|
-
}
|
|
2818
|
-
};
|
|
2819
|
-
var evalJSONDomain = (domain, context) => {
|
|
2820
|
-
try {
|
|
2821
|
-
if (context) {
|
|
2822
|
-
Object.keys(context)?.forEach((key) => {
|
|
2823
|
-
if (Array.isArray(context[key])) {
|
|
2824
|
-
const isTypeObject = context[key]?.every(
|
|
2825
|
-
(item) => typeof item === "object" && item !== null && item?.id !== void 0
|
|
2826
|
-
);
|
|
2827
|
-
if (isTypeObject) {
|
|
2828
|
-
context[key] = context[key]?.map((item) => item?.id);
|
|
2829
|
-
}
|
|
2830
|
-
}
|
|
2831
|
-
});
|
|
2832
|
-
}
|
|
2833
|
-
const value = evaluateExpr(domain, context);
|
|
2834
|
-
return value;
|
|
2835
|
-
} catch (err) {
|
|
2836
|
-
try {
|
|
2837
|
-
const domainObject = new Domain(domain).toList(context);
|
|
2838
|
-
return domainObject;
|
|
2839
|
-
} catch (err2) {
|
|
2840
|
-
return [];
|
|
2841
|
-
}
|
|
2842
|
-
}
|
|
2843
|
-
};
|
|
2844
|
-
var formatSortingString = (input) => {
|
|
2845
|
-
if (!input) return null;
|
|
2846
|
-
return input.split(",").map((field) => {
|
|
2847
|
-
const [key, order] = field.trim().split(/\s+/);
|
|
2848
|
-
const sortOrder = order?.toUpperCase() === "DESC" ? "DESC" : "ASC";
|
|
2849
|
-
return `${key} ${sortOrder}`;
|
|
2850
|
-
}).join(", ");
|
|
2851
|
-
};
|
|
2852
|
-
var domainHelper = {
|
|
2853
|
-
checkDomain,
|
|
2854
|
-
matchDomains,
|
|
2855
|
-
Domain
|
|
2856
|
-
};
|
|
2857
2258
|
var toQueryString = (params) => {
|
|
2858
2259
|
return Object.keys(params).map(
|
|
2859
2260
|
(key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
|
|
2860
2261
|
).join("&");
|
|
2861
2262
|
};
|
|
2862
|
-
var convertFloatToTime = (floatValue) => {
|
|
2863
|
-
const hours = Math.floor(floatValue);
|
|
2864
|
-
const minutes = Math.round((floatValue - hours) * 60);
|
|
2865
|
-
const formattedHours = String(hours).padStart(2, "0");
|
|
2866
|
-
const formattedMinutes = String(minutes).padStart(2, "0");
|
|
2867
|
-
return `${formattedHours}:${formattedMinutes}`;
|
|
2868
|
-
};
|
|
2869
|
-
var convertTimeToFloat = (timeString) => {
|
|
2870
|
-
const [hours, minutes] = timeString.split(":").map(Number);
|
|
2871
|
-
return hours + minutes / 60;
|
|
2872
|
-
};
|
|
2873
|
-
var stringToColor = (name, id) => {
|
|
2874
|
-
const combined = name + id / 2;
|
|
2875
|
-
let hash = 0;
|
|
2876
|
-
for (let i = 0; i < combined.length; i++) {
|
|
2877
|
-
hash = combined.charCodeAt(i) + ((hash << 5) - hash);
|
|
2878
|
-
}
|
|
2879
|
-
const r = hash >> 16 & 255;
|
|
2880
|
-
const g = hash >> 8 & 255;
|
|
2881
|
-
const b = hash & 255;
|
|
2882
|
-
const adjustedR = 120 + r % 61;
|
|
2883
|
-
const adjustedG = 120 + g % 61;
|
|
2884
|
-
const adjustedB = 120 + b % 61;
|
|
2885
|
-
return `#${adjustedR.toString(16).padStart(2, "0")}${adjustedG.toString(16).padStart(2, "0")}${adjustedB.toString(16).padStart(2, "0")}`;
|
|
2886
|
-
};
|
|
2887
|
-
var getFieldsOnChange = (fields) => {
|
|
2888
|
-
const result = [];
|
|
2889
|
-
function traverse(items) {
|
|
2890
|
-
for (const item of items) {
|
|
2891
|
-
if (item) {
|
|
2892
|
-
if (item?.type_co === "field" && matchDomains(fields, item?.on_change)) {
|
|
2893
|
-
result.push(item.name);
|
|
2894
|
-
}
|
|
2895
|
-
if (item?.fields && Array.isArray(item?.fields)) {
|
|
2896
|
-
traverse(item?.fields);
|
|
2897
|
-
}
|
|
2898
|
-
}
|
|
2899
|
-
}
|
|
2900
|
-
}
|
|
2901
|
-
traverse(fields);
|
|
2902
|
-
return result;
|
|
2903
|
-
};
|
|
2904
|
-
var filterFieldDirty = ({
|
|
2905
|
-
id,
|
|
2906
|
-
viewData,
|
|
2907
|
-
formValues,
|
|
2908
|
-
dirtyFields,
|
|
2909
|
-
model,
|
|
2910
|
-
defaultData
|
|
2911
|
-
}) => {
|
|
2912
|
-
const data = id ? { ...dirtyFields } : { ...formValues };
|
|
2913
|
-
for (const key in data) {
|
|
2914
|
-
if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */) {
|
|
2915
|
-
const lineData = [];
|
|
2916
|
-
(formValues[key] ?? []).forEach((itemData, index) => {
|
|
2917
|
-
if (typeof itemData?.id === "string" && itemData?.id.includes("virtual")) {
|
|
2918
|
-
delete itemData?.id;
|
|
2919
|
-
}
|
|
2920
|
-
if (!itemData?.id) {
|
|
2921
|
-
lineData.push([
|
|
2922
|
-
0 /* CREATE */,
|
|
2923
|
-
`virtual_${index}`,
|
|
2924
|
-
filterFieldDirty({
|
|
2925
|
-
id: itemData?.id,
|
|
2926
|
-
viewData,
|
|
2927
|
-
formValues: itemData,
|
|
2928
|
-
dirtyFields: {},
|
|
2929
|
-
model: viewData?.models?.[model]?.[key]?.relation,
|
|
2930
|
-
defaultData
|
|
2931
|
-
})
|
|
2932
|
-
]);
|
|
2933
|
-
} else if (dirtyFields[key]?.length) {
|
|
2934
|
-
dirtyFields[key].forEach((itemDirty, indexDirty) => {
|
|
2935
|
-
if (Object.values(itemDirty).includes(true) && indexDirty === index) {
|
|
2936
|
-
lineData.push([
|
|
2937
|
-
1 /* UPDATE */,
|
|
2938
|
-
itemData?.id,
|
|
2939
|
-
filterFieldDirty({
|
|
2940
|
-
id: itemData?.id,
|
|
2941
|
-
viewData,
|
|
2942
|
-
formValues: itemData,
|
|
2943
|
-
dirtyFields: itemDirty,
|
|
2944
|
-
model: viewData?.models?.[model]?.[key]?.relation,
|
|
2945
|
-
defaultData: {}
|
|
2946
|
-
})
|
|
2947
|
-
]);
|
|
2948
|
-
}
|
|
2949
|
-
});
|
|
2950
|
-
}
|
|
2951
|
-
});
|
|
2952
|
-
(defaultData[key] ?? []).forEach((item) => {
|
|
2953
|
-
if (!(formValues[key] ?? []).find(
|
|
2954
|
-
(itemData) => itemData?.id === item?.id
|
|
2955
|
-
)) {
|
|
2956
|
-
lineData.push([2 /* DELETE */, item?.id, item]);
|
|
2957
|
-
}
|
|
2958
|
-
});
|
|
2959
|
-
data[key] = lineData;
|
|
2960
|
-
} else if (viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
|
|
2961
|
-
const lineData = [];
|
|
2962
|
-
(formValues[key] || []).forEach((itemData) => {
|
|
2963
|
-
if (itemData?.id) {
|
|
2964
|
-
lineData.push([4 /* NO_CHANGE */, itemData?.id]);
|
|
2965
|
-
}
|
|
2966
|
-
});
|
|
2967
|
-
(defaultData[key] ?? []).forEach((item) => {
|
|
2968
|
-
if (!(formValues[key] ?? []).find(
|
|
2969
|
-
(itemData) => itemData?.id === item?.id
|
|
2970
|
-
)) {
|
|
2971
|
-
lineData.push([3 /* UNLINK */, item?.id]);
|
|
2972
|
-
}
|
|
2973
|
-
});
|
|
2974
|
-
data[key] = lineData;
|
|
2975
|
-
} else {
|
|
2976
|
-
if (id && (typeof dirtyFields?.[key] === "object" && !dirtyFields?.[key]?.id || typeof dirtyFields[key] !== "object" && !dirtyFields[key])) {
|
|
2977
|
-
delete data[key];
|
|
2978
|
-
} else {
|
|
2979
|
-
if (!data[key]) {
|
|
2980
|
-
delete data[key];
|
|
2981
|
-
} else {
|
|
2982
|
-
data[key] = formValues?.[key]?.display_name ? formValues?.[key]?.id : formValues?.[key];
|
|
2983
|
-
}
|
|
2984
|
-
}
|
|
2985
|
-
}
|
|
2986
|
-
}
|
|
2987
|
-
return data;
|
|
2988
|
-
};
|
|
2989
|
-
var mergeObjects = (object1, object2) => {
|
|
2990
|
-
if (!object1 || !object2) return void 0;
|
|
2991
|
-
const mergedObject = { ...object2 };
|
|
2992
|
-
Object.keys(object1).forEach((key) => {
|
|
2993
|
-
if (Array.isArray(object1[key]) && Array.isArray(object2[key])) {
|
|
2994
|
-
mergedObject[key] = object2[key].map((item, index) => {
|
|
2995
|
-
if (object1[key][index]) {
|
|
2996
|
-
return {
|
|
2997
|
-
...item,
|
|
2998
|
-
...object1[key][index]
|
|
2999
|
-
};
|
|
3000
|
-
}
|
|
3001
|
-
return item;
|
|
3002
|
-
});
|
|
3003
|
-
} else if (typeof object1[key] === "object" && typeof object2[key] === "object" && object1[key] !== null && object2[key] !== null) {
|
|
3004
|
-
mergedObject[key] = mergeObjects(object1[key], object2[key]);
|
|
3005
|
-
} else {
|
|
3006
|
-
mergedObject[key] = object1[key] !== void 0 ? object1[key] : object2[key];
|
|
3007
|
-
}
|
|
3008
|
-
});
|
|
3009
|
-
if (object2) {
|
|
3010
|
-
Object.keys(object2).forEach((key) => {
|
|
3011
|
-
if (!mergedObject.hasOwnProperty(key)) {
|
|
3012
|
-
mergedObject[key] = object2[key];
|
|
3013
|
-
}
|
|
3014
|
-
});
|
|
3015
|
-
}
|
|
3016
|
-
return mergedObject;
|
|
3017
|
-
};
|
|
3018
|
-
var formatUrlPath = ({
|
|
3019
|
-
viewType,
|
|
3020
|
-
aid,
|
|
3021
|
-
model,
|
|
3022
|
-
id,
|
|
3023
|
-
actionPath
|
|
3024
|
-
}) => {
|
|
3025
|
-
let _url = `/${viewType}/${actionPath}?aid=${aid}&model=${model}`;
|
|
3026
|
-
if (id) {
|
|
3027
|
-
_url += `&id=${id}`;
|
|
3028
|
-
}
|
|
3029
|
-
return _url;
|
|
3030
|
-
};
|
|
3031
|
-
var removeUndefinedFields = (obj) => {
|
|
3032
|
-
const newObj = {};
|
|
3033
|
-
for (const key in obj) {
|
|
3034
|
-
if (obj[key] !== void 0) {
|
|
3035
|
-
newObj[key] = obj[key];
|
|
3036
|
-
}
|
|
3037
|
-
}
|
|
3038
|
-
return newObj;
|
|
3039
|
-
};
|
|
3040
|
-
var useTabModel = (viewData, onchangeData) => {
|
|
3041
|
-
const tabsData = viewData?.views?.form?.tabs?.filter((val) => {
|
|
3042
|
-
if (!val) return null;
|
|
3043
|
-
const hide = checkDomain(onchangeData, val.invisible);
|
|
3044
|
-
if (!hide) {
|
|
3045
|
-
return val;
|
|
3046
|
-
}
|
|
3047
|
-
return false;
|
|
3048
|
-
}) || [];
|
|
3049
|
-
return tabsData;
|
|
3050
|
-
};
|
|
3051
2263
|
var isBase64File = (str) => {
|
|
3052
2264
|
try {
|
|
3053
2265
|
const dataUriPattern = /^data:([a-zA-Z]+\/[a-zA-Z0-9-.+]+)?;base64,/;
|
|
@@ -3063,69 +2275,6 @@ var isBase64File = (str) => {
|
|
|
3063
2275
|
return false;
|
|
3064
2276
|
}
|
|
3065
2277
|
};
|
|
3066
|
-
var isBase64Image = (str) => {
|
|
3067
|
-
const base64Regex = /^data:image\/(png|jpeg|jpg|gif|webp);base64,/;
|
|
3068
|
-
if (!base64Regex.test(str)) {
|
|
3069
|
-
return false;
|
|
3070
|
-
}
|
|
3071
|
-
try {
|
|
3072
|
-
const base64Data = str.split(",")[1];
|
|
3073
|
-
return !!base64Data && atob(base64Data).length > 0;
|
|
3074
|
-
} catch (error) {
|
|
3075
|
-
return false;
|
|
3076
|
-
}
|
|
3077
|
-
};
|
|
3078
|
-
var checkIsImageLink = (url) => {
|
|
3079
|
-
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
|
|
3080
|
-
return imageExtensions.test(url) || isBase64Image(url);
|
|
3081
|
-
};
|
|
3082
|
-
var formatFileSize = (size) => {
|
|
3083
|
-
if (size < 1024) return `${size} B`;
|
|
3084
|
-
const i = Math.floor(Math.log(size) / Math.log(1024));
|
|
3085
|
-
const sizes = ["B", "KB", "MB", "GB", "TB"];
|
|
3086
|
-
return `${(size / Math.pow(1024, i)).toFixed(2)} ${sizes[i]}`;
|
|
3087
|
-
};
|
|
3088
|
-
var getSubdomain = (url = window.location.href) => {
|
|
3089
|
-
const parts = url?.split(".");
|
|
3090
|
-
if (parts.length > 2) {
|
|
3091
|
-
return parts[0].replace("https://", "").replace("http://", "");
|
|
3092
|
-
}
|
|
3093
|
-
return null;
|
|
3094
|
-
};
|
|
3095
|
-
var resequence = (arr, start, end) => {
|
|
3096
|
-
if (start < 0 || start >= arr.length || end < 0 || end >= arr.length) {
|
|
3097
|
-
return [];
|
|
3098
|
-
}
|
|
3099
|
-
const [element] = arr.splice(start, 1);
|
|
3100
|
-
arr.splice(end, 0, element);
|
|
3101
|
-
return arr.slice(Math.min(start, end), Math.max(start, end) + 1);
|
|
3102
|
-
};
|
|
3103
|
-
var getOffSet = (arr, start, end) => {
|
|
3104
|
-
if (start < 0 || start >= arr.length || end < 0 || end >= arr.length) {
|
|
3105
|
-
return 0;
|
|
3106
|
-
}
|
|
3107
|
-
if (start > end) {
|
|
3108
|
-
return end;
|
|
3109
|
-
}
|
|
3110
|
-
return arr.slice(0, start).length;
|
|
3111
|
-
};
|
|
3112
|
-
var copyTextToClipboard = async (text) => {
|
|
3113
|
-
if ("clipboard" in navigator) {
|
|
3114
|
-
return await navigator.clipboard.writeText(text);
|
|
3115
|
-
} else {
|
|
3116
|
-
const textArea = document.createElement("textarea");
|
|
3117
|
-
textArea.value = text;
|
|
3118
|
-
textArea.style.position = "fixed";
|
|
3119
|
-
document.body.appendChild(textArea);
|
|
3120
|
-
textArea.focus();
|
|
3121
|
-
textArea.select();
|
|
3122
|
-
try {
|
|
3123
|
-
document.execCommand("copy");
|
|
3124
|
-
} finally {
|
|
3125
|
-
document.body.removeChild(textArea);
|
|
3126
|
-
}
|
|
3127
|
-
}
|
|
3128
|
-
};
|
|
3129
2278
|
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
3130
2279
|
if (!originalRequest.data) return originalRequest.data;
|
|
3131
2280
|
if (typeof originalRequest.data === "string") {
|
|
@@ -3145,41 +2294,6 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
|
3145
2294
|
}
|
|
3146
2295
|
return originalRequest.data;
|
|
3147
2296
|
};
|
|
3148
|
-
var isObjectEmpty = (obj) => {
|
|
3149
|
-
return Object.keys(obj).length === 0;
|
|
3150
|
-
};
|
|
3151
|
-
var useField = (props) => {
|
|
3152
|
-
const [invisible, setInvisible] = (0, import_react.useState)(true);
|
|
3153
|
-
const [required, setRequired] = (0, import_react.useState)(false);
|
|
3154
|
-
const [readonly, setReadOnly] = (0, import_react.useState)(false);
|
|
3155
|
-
const {
|
|
3156
|
-
invisible: inv,
|
|
3157
|
-
required: req,
|
|
3158
|
-
readonly: rea,
|
|
3159
|
-
onchangeData,
|
|
3160
|
-
rootField,
|
|
3161
|
-
index,
|
|
3162
|
-
name
|
|
3163
|
-
} = props;
|
|
3164
|
-
const nameField = rootField ? `${rootField?.name}.${index}.${name}` : null;
|
|
3165
|
-
(0, import_react.useEffect)(() => {
|
|
3166
|
-
if (onchangeData && Object.keys(onchangeData).length > 0) {
|
|
3167
|
-
setRequired(
|
|
3168
|
-
typeof req === "object" ? matchDomains(onchangeData, req) : checkDomain(onchangeData, req)
|
|
3169
|
-
);
|
|
3170
|
-
setInvisible(matchDomains(onchangeData, inv));
|
|
3171
|
-
setReadOnly(
|
|
3172
|
-
typeof req === "object" ? matchDomains(onchangeData, rea) : checkDomain(onchangeData, rea)
|
|
3173
|
-
);
|
|
3174
|
-
}
|
|
3175
|
-
}, [onchangeData]);
|
|
3176
|
-
return {
|
|
3177
|
-
invisible,
|
|
3178
|
-
required,
|
|
3179
|
-
readonly,
|
|
3180
|
-
nameField
|
|
3181
|
-
};
|
|
3182
|
-
};
|
|
3183
2297
|
|
|
3184
2298
|
// src/utils/storage/local-storage.ts
|
|
3185
2299
|
var localStorageUtils = () => {
|
|
@@ -3480,7 +2594,6 @@ var {
|
|
|
3480
2594
|
setConfig,
|
|
3481
2595
|
setEnvFile
|
|
3482
2596
|
} = envSlice.actions;
|
|
3483
|
-
var selectEnv = (state) => state.env;
|
|
3484
2597
|
var env_slice_default = envSlice.reducer;
|
|
3485
2598
|
|
|
3486
2599
|
// src/store/reducers/excel-slice/index.ts
|
|
@@ -4009,10 +3122,6 @@ var envStore = (0, import_toolkit11.configureStore)({
|
|
|
4009
3122
|
})
|
|
4010
3123
|
});
|
|
4011
3124
|
|
|
4012
|
-
// src/store/index.ts
|
|
4013
|
-
var useAppDispatch = import_react_redux.useDispatch;
|
|
4014
|
-
var useAppSelector = import_react_redux.useSelector;
|
|
4015
|
-
|
|
4016
3125
|
// src/environment/EnvStore.ts
|
|
4017
3126
|
var EnvStore = class {
|
|
4018
3127
|
envStore;
|
|
@@ -4094,9 +3203,6 @@ function getEnv() {
|
|
|
4094
3203
|
return env;
|
|
4095
3204
|
}
|
|
4096
3205
|
|
|
4097
|
-
// src/hooks/auth/use-forgot-password.ts
|
|
4098
|
-
var import_react_query = require("@tanstack/react-query");
|
|
4099
|
-
|
|
4100
3206
|
// src/services/action-service/index.ts
|
|
4101
3207
|
var ActionService = {
|
|
4102
3208
|
// Load Action
|
|
@@ -6840,113 +5946,8 @@ var useVerifyTotp = () => {
|
|
|
6840
5946
|
});
|
|
6841
5947
|
};
|
|
6842
5948
|
var use_verify_totp_default = useVerifyTotp;
|
|
6843
|
-
|
|
6844
|
-
// src/provider/react-query-provider.tsx
|
|
6845
|
-
var import_react_query67 = require("@tanstack/react-query");
|
|
6846
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
6847
|
-
|
|
6848
|
-
// src/provider/redux-provider.tsx
|
|
6849
|
-
var import_react_redux2 = require("react-redux");
|
|
6850
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
6851
|
-
|
|
6852
|
-
// src/provider/main-provider.tsx
|
|
6853
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
6854
|
-
|
|
6855
|
-
// src/provider/version-gate-provider.tsx
|
|
6856
|
-
var import_react2 = require("react");
|
|
6857
|
-
var import_react_query68 = require("@tanstack/react-query");
|
|
6858
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
6859
|
-
var VersionGate = ({ children }) => {
|
|
6860
|
-
const queryClient = (0, import_react_query68.useQueryClient)();
|
|
6861
|
-
const [ready, setReady] = (0, import_react2.useState)(false);
|
|
6862
|
-
(0, import_react2.useEffect)(() => {
|
|
6863
|
-
const clearVersion = () => {
|
|
6864
|
-
queryClient.clear();
|
|
6865
|
-
localStorage.removeItem("__api_version__");
|
|
6866
|
-
};
|
|
6867
|
-
const validateVersion = async () => {
|
|
6868
|
-
const serverVersion = await view_service_default.getVersion();
|
|
6869
|
-
const cached = localStorage.getItem("__api_version__");
|
|
6870
|
-
if (cached !== serverVersion?.api_version) {
|
|
6871
|
-
clearVersion();
|
|
6872
|
-
localStorage.setItem("__api_version__", serverVersion?.api_version);
|
|
6873
|
-
} else {
|
|
6874
|
-
console.log("Api version:", serverVersion?.api_version);
|
|
6875
|
-
}
|
|
6876
|
-
setReady(true);
|
|
6877
|
-
};
|
|
6878
|
-
validateVersion();
|
|
6879
|
-
if (typeof window !== "undefined") {
|
|
6880
|
-
const onKey = (e) => {
|
|
6881
|
-
const key = e.key.toLowerCase();
|
|
6882
|
-
const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
|
|
6883
|
-
if (isHardRefresh) clearVersion();
|
|
6884
|
-
};
|
|
6885
|
-
window.addEventListener("keydown", onKey);
|
|
6886
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
6887
|
-
}
|
|
6888
|
-
}, [queryClient]);
|
|
6889
|
-
return ready ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children }) : null;
|
|
6890
|
-
};
|
|
6891
5949
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6892
5950
|
0 && (module.exports = {
|
|
6893
|
-
ActionService,
|
|
6894
|
-
AuthService,
|
|
6895
|
-
CompanyService,
|
|
6896
|
-
ComponentType,
|
|
6897
|
-
EnvStore,
|
|
6898
|
-
ExcelService,
|
|
6899
|
-
FieldTypeConstants,
|
|
6900
|
-
FormService,
|
|
6901
|
-
KanbanService,
|
|
6902
|
-
KeyConstants,
|
|
6903
|
-
MethodConstants,
|
|
6904
|
-
MethodType,
|
|
6905
|
-
ModelConstants,
|
|
6906
|
-
ModelService,
|
|
6907
|
-
SearchType,
|
|
6908
|
-
UriConstants,
|
|
6909
|
-
UserService,
|
|
6910
|
-
VersionGate,
|
|
6911
|
-
ViewService,
|
|
6912
|
-
WIDGETAVATAR,
|
|
6913
|
-
WIDGETCOLOR,
|
|
6914
|
-
WIDGETCURRENCY,
|
|
6915
|
-
WIDGETNOSTRING,
|
|
6916
|
-
WIDGETSTATUS,
|
|
6917
|
-
WesapError,
|
|
6918
|
-
axiosClient,
|
|
6919
|
-
checkIsImageLink,
|
|
6920
|
-
convertFloatToTime,
|
|
6921
|
-
convertTimeToFloat,
|
|
6922
|
-
copyTextToClipboard,
|
|
6923
|
-
domainHelper,
|
|
6924
|
-
evalJSONContext,
|
|
6925
|
-
evalJSONDomain,
|
|
6926
|
-
filterFieldDirty,
|
|
6927
|
-
formatCurrency,
|
|
6928
|
-
formatDate,
|
|
6929
|
-
formatFileSize,
|
|
6930
|
-
formatSortingString,
|
|
6931
|
-
formatUrlPath,
|
|
6932
|
-
getEnv,
|
|
6933
|
-
getFieldsOnChange,
|
|
6934
|
-
getOffSet,
|
|
6935
|
-
getSubdomain,
|
|
6936
|
-
handleError,
|
|
6937
|
-
isBase64File,
|
|
6938
|
-
isBase64Image,
|
|
6939
|
-
isObjectEmpty,
|
|
6940
|
-
mergeObjects,
|
|
6941
|
-
removeUndefinedFields,
|
|
6942
|
-
resequence,
|
|
6943
|
-
selectEnv,
|
|
6944
|
-
setEnvFile,
|
|
6945
|
-
stringToColor,
|
|
6946
|
-
toQueryString,
|
|
6947
|
-
updateTokenParamInOriginalRequest,
|
|
6948
|
-
useAppDispatch,
|
|
6949
|
-
useAppSelector,
|
|
6950
5951
|
useButton,
|
|
6951
5952
|
useChangeStatus,
|
|
6952
5953
|
useDelete,
|
|
@@ -6954,7 +5955,6 @@ var VersionGate = ({ children }) => {
|
|
|
6954
5955
|
useDuplicateRecord,
|
|
6955
5956
|
useExecuteImport,
|
|
6956
5957
|
useExportExcel,
|
|
6957
|
-
useField,
|
|
6958
5958
|
useForgotPassword,
|
|
6959
5959
|
useForgotPasswordSSO,
|
|
6960
5960
|
useGet2FAMethods,
|
|
@@ -7010,12 +6010,10 @@ var VersionGate = ({ children }) => {
|
|
|
7010
6010
|
useSettingsWebRead2fa,
|
|
7011
6011
|
useSignInSSO,
|
|
7012
6012
|
useSwitchLocale,
|
|
7013
|
-
useTabModel,
|
|
7014
6013
|
useUpdatePassword,
|
|
7015
6014
|
useUploadFile,
|
|
7016
6015
|
useUploadIdFile,
|
|
7017
6016
|
useUploadImage,
|
|
7018
6017
|
useVerify2FA,
|
|
7019
|
-
useVerifyTotp
|
|
7020
|
-
validateAndParseDate
|
|
6018
|
+
useVerifyTotp
|
|
7021
6019
|
});
|