@fctc/widget-logic 5.3.7-beta.14 → 5.3.7-beta.16

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.
@@ -1 +0,0 @@
1
- export * from '@fctc/interface-logic/provider';
@@ -1 +0,0 @@
1
- export * from '@fctc/interface-logic/provider';
package/dist/provider.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
-
17
- // src/provider.ts
18
- var provider_exports = {};
19
- module.exports = __toCommonJS(provider_exports);
20
- __reExport(provider_exports, require("@fctc/interface-logic/provider"), module.exports);
21
- // Annotate the CommonJS export names for ESM import in node:
22
- 0 && (module.exports = {
23
- ...require("@fctc/interface-logic/provider")
24
- });
package/dist/provider.mjs DELETED
@@ -1,2 +0,0 @@
1
- // src/provider.ts
2
- export * from "@fctc/interface-logic/provider";
@@ -1 +0,0 @@
1
- export * from '@fctc/interface-logic/services';
@@ -1 +0,0 @@
1
- export * from '@fctc/interface-logic/services';
package/dist/services.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
-
17
- // src/services.ts
18
- var services_exports = {};
19
- module.exports = __toCommonJS(services_exports);
20
- __reExport(services_exports, require("@fctc/interface-logic/services"), module.exports);
21
- // Annotate the CommonJS export names for ESM import in node:
22
- 0 && (module.exports = {
23
- ...require("@fctc/interface-logic/services")
24
- });
package/dist/services.mjs DELETED
@@ -1,2 +0,0 @@
1
- // src/services.ts
2
- export * from "@fctc/interface-logic/services";
package/dist/types.d.mts DELETED
@@ -1,36 +0,0 @@
1
- export * from '@fctc/interface-logic/types';
2
-
3
- interface ValuePropsType {
4
- id: number | string;
5
- display_name: number | string;
6
- [key: string]: any;
7
- }
8
- interface IInputFieldProps {
9
- name?: string;
10
- type?: string;
11
- readonly?: boolean;
12
- required?: boolean;
13
- placeholder?: string;
14
- defaultValue?: string | number | ValuePropsType | any;
15
- invisible?: boolean;
16
- methods?: any;
17
- onChange?: (name: string, value: any) => void;
18
- onBlur?: Function;
19
- onRefetch?: Function;
20
- isForm?: boolean;
21
- className?: string;
22
- value?: string | number | ValuePropsType | null | Record<any, any> | any;
23
- string?: string;
24
- isEditTable?: boolean;
25
- formValues?: any;
26
- model?: string;
27
- relation?: string;
28
- domain?: any;
29
- idForm?: boolean;
30
- widget?: string;
31
- aid?: string | number;
32
- context?: string | Object;
33
- filename?: string;
34
- }
35
-
36
- export type { IInputFieldProps, ValuePropsType };
package/dist/types.d.ts DELETED
@@ -1,36 +0,0 @@
1
- export * from '@fctc/interface-logic/types';
2
-
3
- interface ValuePropsType {
4
- id: number | string;
5
- display_name: number | string;
6
- [key: string]: any;
7
- }
8
- interface IInputFieldProps {
9
- name?: string;
10
- type?: string;
11
- readonly?: boolean;
12
- required?: boolean;
13
- placeholder?: string;
14
- defaultValue?: string | number | ValuePropsType | any;
15
- invisible?: boolean;
16
- methods?: any;
17
- onChange?: (name: string, value: any) => void;
18
- onBlur?: Function;
19
- onRefetch?: Function;
20
- isForm?: boolean;
21
- className?: string;
22
- value?: string | number | ValuePropsType | null | Record<any, any> | any;
23
- string?: string;
24
- isEditTable?: boolean;
25
- formValues?: any;
26
- model?: string;
27
- relation?: string;
28
- domain?: any;
29
- idForm?: boolean;
30
- widget?: string;
31
- aid?: string | number;
32
- context?: string | Object;
33
- filename?: string;
34
- }
35
-
36
- export type { IInputFieldProps, ValuePropsType };
package/dist/types.js DELETED
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
-
17
- // src/types.ts
18
- var types_exports = {};
19
- module.exports = __toCommonJS(types_exports);
20
- __reExport(types_exports, require("@fctc/interface-logic/types"), module.exports);
21
- // Annotate the CommonJS export names for ESM import in node:
22
- 0 && (module.exports = {
23
- ...require("@fctc/interface-logic/types")
24
- });
package/dist/types.mjs DELETED
@@ -1,2 +0,0 @@
1
- // src/types.ts
2
- export * from "@fctc/interface-logic/types";
package/dist/utils.d.mts DELETED
@@ -1,23 +0,0 @@
1
- export * from '@fctc/interface-logic/utils';
2
-
3
- declare const languages: {
4
- id: string;
5
- name: string;
6
- }[];
7
-
8
- declare const countSum: (data: any[], field: string) => number;
9
- declare const isObjectEmpty: (obj: object) => boolean;
10
- declare function mergeButtons(fields: any): any;
11
- declare const STORAGES: {
12
- readonly TOKEN: "accessToken";
13
- readonly USER_INFO: "USER_INFO";
14
- };
15
- type UseStateHook<T> = [[boolean, T | null], (value: T | null) => void];
16
- type StorageKey = keyof typeof STORAGES;
17
- declare function setStorageItemAsync(key: StorageKey, value: string | null): Promise<void>;
18
- declare function useStorageState(key: StorageKey): UseStateHook<string>;
19
- declare const guessTypeFromUrl: (url: string) => any;
20
-
21
- declare const validateAndParseDate: (input: string, isDateTime?: boolean) => string | null;
22
-
23
- export { STORAGES, countSum, guessTypeFromUrl, isObjectEmpty, languages, mergeButtons, setStorageItemAsync, useStorageState, validateAndParseDate };
package/dist/utils.d.ts DELETED
@@ -1,23 +0,0 @@
1
- export * from '@fctc/interface-logic/utils';
2
-
3
- declare const languages: {
4
- id: string;
5
- name: string;
6
- }[];
7
-
8
- declare const countSum: (data: any[], field: string) => number;
9
- declare const isObjectEmpty: (obj: object) => boolean;
10
- declare function mergeButtons(fields: any): any;
11
- declare const STORAGES: {
12
- readonly TOKEN: "accessToken";
13
- readonly USER_INFO: "USER_INFO";
14
- };
15
- type UseStateHook<T> = [[boolean, T | null], (value: T | null) => void];
16
- type StorageKey = keyof typeof STORAGES;
17
- declare function setStorageItemAsync(key: StorageKey, value: string | null): Promise<void>;
18
- declare function useStorageState(key: StorageKey): UseStateHook<string>;
19
- declare const guessTypeFromUrl: (url: string) => any;
20
-
21
- declare const validateAndParseDate: (input: string, isDateTime?: boolean) => string | null;
22
-
23
- export { STORAGES, countSum, guessTypeFromUrl, isObjectEmpty, languages, mergeButtons, setStorageItemAsync, useStorageState, validateAndParseDate };
package/dist/utils.js DELETED
@@ -1,436 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
-
31
- // src/utils.ts
32
- var utils_exports = {};
33
- __export(utils_exports, {
34
- STORAGES: () => STORAGES,
35
- countSum: () => countSum,
36
- guessTypeFromUrl: () => guessTypeFromUrl,
37
- isObjectEmpty: () => isObjectEmpty,
38
- languages: () => languages,
39
- mergeButtons: () => mergeButtons,
40
- setStorageItemAsync: () => setStorageItemAsync,
41
- useStorageState: () => useStorageState,
42
- validateAndParseDate: () => validateAndParseDate
43
- });
44
- module.exports = __toCommonJS(utils_exports);
45
-
46
- // src/utils/constants.ts
47
- var languages = [
48
- { id: "vi_VN", name: "VIE" },
49
- { id: "en_US", name: "ENG" }
50
- ];
51
-
52
- // src/utils/function.ts
53
- var import_react = require("react");
54
- var countSum = (data, field) => {
55
- if (!data || !field) return 0;
56
- return data.reduce(
57
- (total, item) => total + (item?.[`${field}_count`] || 0),
58
- 0
59
- );
60
- };
61
- var isObjectEmpty = (obj) => {
62
- return Object.keys(obj).length === 0;
63
- };
64
- function mergeButtons(fields) {
65
- const buttons = fields?.filter((f) => f.type_co === "button");
66
- const others = fields?.filter((f) => f.type_co !== "button");
67
- if (buttons?.length) {
68
- others.push({
69
- type_co: "buttons",
70
- buttons
71
- });
72
- }
73
- return others;
74
- }
75
- var STORAGES = {
76
- TOKEN: "accessToken",
77
- USER_INFO: "USER_INFO"
78
- };
79
- function useAsyncState(initialValue = [true, null]) {
80
- return (0, import_react.useReducer)(
81
- (_state, action = null) => [false, action],
82
- initialValue
83
- );
84
- }
85
- async function setStorageItemAsync(key, value) {
86
- try {
87
- if (value === null) {
88
- localStorage.removeItem(key);
89
- } else {
90
- localStorage.setItem(key, value);
91
- }
92
- } catch (e) {
93
- console.error("Local storage is unavailable:", e);
94
- }
95
- }
96
- function useStorageState(key) {
97
- const [state, setState] = useAsyncState();
98
- (0, import_react.useEffect)(() => {
99
- try {
100
- const storedValue = localStorage.getItem(key);
101
- setState(storedValue);
102
- } catch (e) {
103
- console.error("Local storage is unavailable:", e);
104
- }
105
- }, [key]);
106
- const setValue = (0, import_react.useCallback)(
107
- (value) => {
108
- setState(value);
109
- setStorageItemAsync(key, value);
110
- },
111
- [key]
112
- );
113
- return [state, setValue];
114
- }
115
- var guessTypeFromUrl = (url) => {
116
- const ext = url.split(".").pop()?.toLowerCase();
117
- if (!ext) return null;
118
- const map = {
119
- jpg: "image/jpeg",
120
- jpeg: "image/jpeg",
121
- png: "image/png",
122
- webp: "image/webp",
123
- gif: "image/gif",
124
- svg: "image/svg+xml",
125
- bmp: "image/bmp",
126
- tiff: "image/tiff",
127
- pdf: "application/pdf",
128
- zip: "application/zip",
129
- rar: "application/x-rar-compressed",
130
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
131
- xls: "application/vnd.ms-excel",
132
- mp4: "video/mp4",
133
- mov: "video/quicktime"
134
- };
135
- return map[ext] || null;
136
- };
137
-
138
- // src/utils/format-date.ts
139
- var import_moment = __toESM(require("moment"));
140
- var validateAndParseDate = (input, isDateTime = false) => {
141
- if (!input || typeof input !== "string") return null;
142
- const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
143
- const dateFormat = "YYYY-MM-DD";
144
- const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
145
- const currentDay = (0, import_moment.default)().format("DD");
146
- const currentMonth = (0, import_moment.default)().format("MM");
147
- const currentYear = (0, import_moment.default)().format("YYYY");
148
- const defaultTime = "00:00:00";
149
- const maxYear = parseInt(currentYear) + 10;
150
- const isValidDate = (day, month, year) => {
151
- const date = (0, import_moment.default)(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
152
- return date.isValid();
153
- };
154
- const isValidTime = (hour, minute = "00", second = "00") => {
155
- const h = parseInt(hour, 10);
156
- const m = parseInt(minute, 10);
157
- const s = parseInt(second, 10);
158
- return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
159
- };
160
- const formatOutput = (day, month, year, time = defaultTime) => {
161
- let result = (0, import_moment.default)(
162
- `${day}-${month}-${year} ${time}`,
163
- "DD-MM-YYYY HH:mm:ss"
164
- );
165
- if (!result.isValid()) return null;
166
- if (isDateTime) {
167
- result = result.subtract(7, "hours");
168
- return result.format(dateTimeFormat);
169
- }
170
- return result.format(dateFormat);
171
- };
172
- if (isDateTime && input.match(
173
- /^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
174
- )) {
175
- const [datePart, timePart] = input.split(/\s+/);
176
- const dateParts = datePart.split(/[\/-]/);
177
- const timeParts = timePart.split(":");
178
- const day = dateParts[0].padStart(2, "0");
179
- const month = dateParts[1].padStart(2, "0");
180
- const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
181
- const hour = timeParts[0].padStart(2, "0");
182
- const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
183
- const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
184
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
185
- let result = (0, import_moment.default)(
186
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
187
- "DD-MM-YYYY HH:mm:ss"
188
- );
189
- if (!result.isValid()) return null;
190
- result = result.subtract(7, "hours");
191
- return result.format(dateTimeFormat);
192
- }
193
- return null;
194
- }
195
- if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
196
- const [year, month, day] = cleanInput.split("-");
197
- if (isValidDate(day, month, year)) {
198
- return formatOutput(day, month, year);
199
- }
200
- return null;
201
- }
202
- if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
203
- const [day, month, year] = cleanInput.split("/");
204
- const paddedDay = day.padStart(2, "0");
205
- const paddedMonth = month.padStart(2, "0");
206
- const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
207
- if (isValidDate(paddedDay, paddedMonth, fullYear)) {
208
- return formatOutput(paddedDay, paddedMonth, fullYear);
209
- }
210
- return null;
211
- }
212
- if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
213
- const [day, month, year] = cleanInput.split("-");
214
- const paddedDay = day.padStart(2, "0");
215
- const paddedMonth = month.padStart(2, "0");
216
- const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
217
- if (isValidDate(paddedDay, paddedMonth, fullYear)) {
218
- return formatOutput(paddedDay, paddedMonth, fullYear);
219
- }
220
- return null;
221
- }
222
- if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
223
- const [day, month] = cleanInput.split(/[\/-]/);
224
- const paddedDay = day.padStart(2, "0");
225
- const paddedMonth = month.padStart(2, "0");
226
- if (isValidDate(paddedDay, paddedMonth, currentYear)) {
227
- return formatOutput(paddedDay, paddedMonth, currentYear);
228
- }
229
- return null;
230
- }
231
- if (cleanInput.match(/^\d{4}$/)) {
232
- const num = parseInt(cleanInput, 10);
233
- if (num >= 2e3 && num <= maxYear) {
234
- if (isValidDate(currentDay, currentMonth, num.toString())) {
235
- return formatOutput(currentDay, currentMonth, num.toString());
236
- }
237
- return null;
238
- }
239
- const day = cleanInput.slice(0, 2);
240
- const month = cleanInput.slice(2, 4);
241
- if (isValidDate(day, month, currentYear)) {
242
- return formatOutput(day, month, currentYear);
243
- }
244
- return null;
245
- }
246
- if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
247
- const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
248
- let result = (0, import_moment.default)().subtract(daysToSubtract, "days");
249
- if (isDateTime) {
250
- result = result.subtract(7, "hours");
251
- }
252
- if (result.isValid()) {
253
- return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
254
- }
255
- return null;
256
- }
257
- if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
258
- const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
259
- const day = parts[0].padStart(2, "0");
260
- const month = parts[1].padStart(2, "0");
261
- let year = parts[2];
262
- year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
263
- if (isValidDate(day, month, year)) {
264
- return formatOutput(day, month, year);
265
- }
266
- return null;
267
- }
268
- if (isDateTime) {
269
- if (cleanInput.length === 9) {
270
- const day = cleanInput.slice(0, 2);
271
- const month = cleanInput.slice(2, 4);
272
- const year = cleanInput.slice(4, 8);
273
- const hour = cleanInput.slice(8, 9).padStart(2, "0");
274
- if (isValidDate(day, month, year) && isValidTime(hour)) {
275
- let result = (0, import_moment.default)(
276
- `${day}-${month}-${year} ${hour}:00:00`,
277
- "DD-MM-YYYY HH:mm:ss"
278
- );
279
- if (!result.isValid()) return null;
280
- result = result.subtract(7, "hours");
281
- return result.format(dateTimeFormat);
282
- }
283
- return null;
284
- }
285
- if (cleanInput.length === 10) {
286
- const day = cleanInput.slice(0, 2);
287
- const month = cleanInput.slice(2, 4);
288
- const year = cleanInput.slice(4, 8);
289
- const hour = cleanInput.slice(8, 10);
290
- if (isValidDate(day, month, year) && isValidTime(hour)) {
291
- let result = (0, import_moment.default)(
292
- `${day}-${month}-${year} ${hour}:00:00`,
293
- "DD-MM-YYYY HH:mm:ss"
294
- );
295
- if (!result.isValid()) return null;
296
- result = result.subtract(7, "hours");
297
- return result.format(dateTimeFormat);
298
- }
299
- return null;
300
- }
301
- if (cleanInput.length === 11) {
302
- const day = cleanInput.slice(0, 2);
303
- const month = cleanInput.slice(2, 4);
304
- const year = cleanInput.slice(4, 8);
305
- const hour = cleanInput.slice(8, 10);
306
- const minute = cleanInput.slice(10, 11).padStart(2, "0");
307
- if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
308
- let result = (0, import_moment.default)(
309
- `${day}-${month}-${year} ${hour}:${minute}:00`,
310
- "DD-MM-YYYY HH:mm:ss"
311
- );
312
- if (!result.isValid()) return null;
313
- result = result.subtract(7, "hours");
314
- return result.format(dateTimeFormat);
315
- }
316
- return null;
317
- }
318
- if (cleanInput.length === 12) {
319
- const day = cleanInput.slice(0, 2);
320
- const month = cleanInput.slice(2, 4);
321
- const year = cleanInput.slice(4, 8);
322
- const hour = cleanInput.slice(8, 10);
323
- const minute = cleanInput.slice(10, 12);
324
- if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
325
- let result = (0, import_moment.default)(
326
- `${day}-${month}-${year} ${hour}:${minute}:00`,
327
- "DD-MM-YYYY HH:mm:ss"
328
- );
329
- if (!result.isValid()) return null;
330
- result = result.subtract(7, "hours");
331
- return result.format(dateTimeFormat);
332
- }
333
- return null;
334
- }
335
- if (cleanInput.length === 13) {
336
- const day = cleanInput.slice(0, 2);
337
- const month = cleanInput.slice(2, 4);
338
- const year = cleanInput.slice(4, 8);
339
- const hour = cleanInput.slice(8, 10);
340
- const minute = cleanInput.slice(10, 12);
341
- const second = cleanInput.slice(12, 13).padStart(2, "0");
342
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
343
- let result = (0, import_moment.default)(
344
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
345
- "DD-MM-YYYY HH:mm:ss"
346
- );
347
- if (!result.isValid()) return null;
348
- result = result.subtract(7, "hours");
349
- return result.format(dateTimeFormat);
350
- }
351
- return null;
352
- }
353
- if (cleanInput.length === 14) {
354
- const day = cleanInput.slice(0, 2);
355
- const month = cleanInput.slice(2, 4);
356
- const year = cleanInput.slice(4, 8);
357
- const hour = cleanInput.slice(8, 10);
358
- const minute = cleanInput.slice(10, 12);
359
- const second = cleanInput.slice(12, 14);
360
- if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
361
- let result = (0, import_moment.default)(
362
- `${day}-${month}-${year} ${hour}:${minute}:${second}`,
363
- "DD-MM-YYYY HH:mm:ss"
364
- );
365
- if (!result.isValid()) return null;
366
- result = result.subtract(7, "hours");
367
- return result.format(dateTimeFormat);
368
- }
369
- return null;
370
- }
371
- }
372
- const len = cleanInput.length;
373
- if (len === 1 || len === 2) {
374
- const paddedDay = cleanInput.padStart(2, "0");
375
- if (isValidDate(paddedDay, currentMonth, currentYear)) {
376
- return formatOutput(paddedDay, currentMonth, currentYear);
377
- }
378
- return null;
379
- }
380
- if (len === 3) {
381
- const day = cleanInput.slice(0, 2);
382
- const month = cleanInput.slice(2, 3).padStart(2, "0");
383
- if (isValidDate(day, month, currentYear)) {
384
- return formatOutput(day, month, currentYear);
385
- }
386
- return null;
387
- }
388
- if (len === 6) {
389
- const day = cleanInput.slice(0, 2);
390
- const month = cleanInput.slice(2, 4);
391
- let year = cleanInput.slice(4, 6);
392
- year = `20${year}`;
393
- if (parseInt(month) > 12) {
394
- if (isValidDate(day, currentMonth, currentYear)) {
395
- return formatOutput(day, currentMonth, currentYear);
396
- }
397
- return null;
398
- }
399
- if (isValidDate(day, month, year)) {
400
- return formatOutput(day, month, year);
401
- }
402
- return null;
403
- }
404
- if (len === 7) {
405
- return null;
406
- }
407
- if (len === 8) {
408
- const day = cleanInput.slice(0, 2);
409
- const month = cleanInput.slice(2, 4);
410
- const year = cleanInput.slice(4, 8);
411
- if (isValidDate(day, month, year)) {
412
- return formatOutput(day, month, year);
413
- }
414
- return null;
415
- }
416
- if (len > 8 && !isDateTime) {
417
- return null;
418
- }
419
- return null;
420
- };
421
-
422
- // src/utils.ts
423
- __reExport(utils_exports, require("@fctc/interface-logic/utils"), module.exports);
424
- // Annotate the CommonJS export names for ESM import in node:
425
- 0 && (module.exports = {
426
- STORAGES,
427
- countSum,
428
- guessTypeFromUrl,
429
- isObjectEmpty,
430
- languages,
431
- mergeButtons,
432
- setStorageItemAsync,
433
- useStorageState,
434
- validateAndParseDate,
435
- ...require("@fctc/interface-logic/utils")
436
- });