@fctc/interface-logic 4.5.11-beta.0 → 4.6.1

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.
Files changed (46) hide show
  1. package/dist/base-model-type-DD8uZnDP.d.ts +8 -0
  2. package/dist/configs.d.ts +12 -0
  3. package/dist/configs.js +2581 -0
  4. package/dist/configs.mjs +2544 -1
  5. package/dist/constants.d.mts +1 -1
  6. package/dist/constants.d.ts +235 -0
  7. package/dist/constants.js +335 -0
  8. package/dist/constants.mjs +293 -1
  9. package/dist/environment.d.mts +1 -1
  10. package/dist/environment.d.ts +56 -0
  11. package/dist/environment.js +2708 -0
  12. package/dist/environment.mjs +2669 -1
  13. package/dist/hooks.d.mts +7 -1
  14. package/dist/hooks.d.ts +828 -0
  15. package/dist/hooks.js +8949 -0
  16. package/dist/hooks.mjs +8792 -1
  17. package/dist/{local-storage-AbiOQTLK.d.mts → local-storage-BPvoMGYJ.d.mts} +1 -1
  18. package/dist/local-storage-BPvoMGYJ.d.ts +10 -0
  19. package/dist/models.d.ts +14 -0
  20. package/dist/models.js +147 -0
  21. package/dist/models.mjs +120 -1
  22. package/dist/provider.d.mts +10 -5
  23. package/dist/provider.d.ts +214 -0
  24. package/dist/provider.js +9535 -0
  25. package/dist/provider.mjs +9489 -1
  26. package/dist/services.d.ts +700 -0
  27. package/dist/services.js +6959 -0
  28. package/dist/services.mjs +6912 -1
  29. package/dist/store.d.mts +382 -0
  30. package/dist/store.d.ts +382 -0
  31. package/dist/store.js +823 -0
  32. package/dist/store.mjs +717 -0
  33. package/dist/types.d.ts +19 -0
  34. package/dist/types.js +18 -0
  35. package/dist/utils.d.mts +61 -38
  36. package/dist/utils.d.ts +112 -0
  37. package/dist/utils.js +3099 -0
  38. package/dist/utils.mjs +3030 -1
  39. package/dist/view-type-CfcWWR0w.d.ts +137 -0
  40. package/package.json +92 -78
  41. package/dist/chunk-5N6LG2T7.mjs +0 -2
  42. package/dist/chunk-CI6PEZ77.mjs +0 -1
  43. package/dist/chunk-KPELPP6F.mjs +0 -1
  44. package/dist/chunk-LCUY2BJU.mjs +0 -1
  45. package/dist/chunk-QGGHYIHF.mjs +0 -1
  46. package/dist/chunk-W5MFEPZ6.mjs +0 -5
@@ -0,0 +1,19 @@
1
+ export { C as ContextApi, D as DeleteParams, F as ForgotPasswordBody, G as GetAllParams, a as GetDetailParams, b as GetListParams, c as GetSelectionType, f as GetViewParams, L as LoginCredentialBody, O as OnChangeParams, R as ResetPasswordRequest, S as SaveParams, d as SocialTokenBody, e as Specification, U as UpdatePasswordRequest, g as View, V as ViewData, u as updatePasswordBody } from './view-type-CfcWWR0w.js';
2
+ export { B as BaseModelInit } from './base-model-type-DD8uZnDP.js';
3
+
4
+ interface Config {
5
+ baseUrl: string;
6
+ grantType: string;
7
+ clientId: string;
8
+ clientSecret: string;
9
+ database: string;
10
+ }
11
+
12
+ interface Context {
13
+ uid: number;
14
+ lang: string;
15
+ allowCompanys: number[];
16
+ [key: string]: any;
17
+ }
18
+
19
+ export type { Config, Context };
package/dist/types.js ADDED
@@ -0,0 +1,18 @@
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
package/dist/utils.d.mts CHANGED
@@ -1,5 +1,3 @@
1
- export { L as LocalStorageUtilsType, l as localStorageUtils } from './local-storage-AbiOQTLK.mjs';
2
-
3
1
  declare const sessionStorageUtils: {
4
2
  getMenuFocus: () => IMenu;
5
3
  setMenuFocus: (menuTree: IMenu) => void;
@@ -16,28 +14,21 @@ interface IMenu {
16
14
  service: string;
17
15
  }
18
16
 
19
- interface Context {
20
- [key: string]: any;
17
+ declare class WesapError extends Error {
18
+ code: number;
19
+ constructor(message: string, code: number);
21
20
  }
22
- type ContextDescription = Context | string | undefined;
23
- /**
24
- * Create an evaluated context from an arbitrary list of context representations.
25
- * The evaluated context in construction is used along the way to evaluate further parts.
26
- *
27
- * @param contexts - Danh sách các context representations
28
- * @param initialEvaluationContext - Context ban đầu để bắt đầu đánh giá (tùy chọn)
29
- * @returns Context đã được đánh giá
30
- */
31
- declare function makeContext(contexts: ContextDescription[], initialEvaluationContext?: Context): Context;
32
- /**
33
- * Allow to evaluate a context with an incomplete evaluation context. The evaluated context only
34
- * contains keys whose values are static or can be evaluated with the given evaluation context.
35
- *
36
- * @param context - Chuỗi context cần đánh giá
37
- * @param evaluationContext - Context dùng để đánh giá (mặc định là rỗng)
38
- * @returns Context đã được đánh giá một phần
39
- */
40
- declare function evalPartialContext(_context: string, evaluationContext?: Context): Context;
21
+ declare function handleError(error: Error, env: {
22
+ services: {
23
+ notification: {
24
+ error: (message: string) => void;
25
+ };
26
+ };
27
+ }): void;
28
+
29
+ declare const formatCurrency: (amount: number, currency?: string) => string;
30
+ declare const formatDate: (date: string | Date, locale?: string) => string;
31
+ declare const validateAndParseDate: (input: string, isDateTime?: boolean) => string | null;
41
32
 
42
33
  type AST = {
43
34
  type: number;
@@ -46,8 +37,6 @@ type AST = {
46
37
  type Condition = [string | 0 | 1, string, any];
47
38
  type DomainListRepr = ('&' | '|' | '!' | Condition)[];
48
39
  type DomainRepr = DomainListRepr | string | Domain;
49
- declare class InvalidDomainError extends Error {
50
- }
51
40
  declare class Domain {
52
41
  ast: AST;
53
42
  static TRUE: Domain;
@@ -63,27 +52,61 @@ declare class Domain {
63
52
  toList(context: Record<string, any>): DomainListRepr;
64
53
  toJson(): DomainListRepr | string;
65
54
  }
66
- declare function evalDomain(modifier: any[] | boolean, evalContext: Record<string, any>): boolean;
67
- declare const checkDomain: (context: any, domain: any) => boolean;
68
- declare const matchDomains: (context: any, domains: any) => boolean;
69
55
 
56
+ declare const evalJSONContext: (_context: any, context?: {}) => any;
57
+ declare const evalJSONDomain: (domain: any, context: any) => any;
58
+ declare const formatSortingString: (input: string | null | undefined) => string | null;
70
59
  declare const domainHelper: {
71
60
  checkDomain: (context: any, domain: any) => boolean;
72
61
  matchDomains: (context: any, domains: any) => boolean;
73
62
  Domain: typeof Domain;
74
63
  };
75
- declare const evalJSONContext: (_context: any, context?: {}) => any;
76
- declare const evalJSONDomain: (domain: any, context: any) => any;
77
- declare const formatSortingString: (input: string | null | undefined) => string | null;
78
- declare function combineContexts(contexts: ({
79
- [key: string]: any;
80
- } | undefined)[]): {
81
- [key: string]: any;
82
- } | undefined;
83
64
  declare const toQueryString: (params: Record<string, string | number | boolean>) => string;
84
- declare function cleanObject<T extends Record<string, any>>(obj: T): Partial<T>;
65
+ declare const convertFloatToTime: (floatValue: number) => string;
66
+ declare const convertTimeToFloat: (timeString: string) => number;
67
+ declare const stringToColor: (name: string, id: number) => string;
68
+ declare const getFieldsOnChange: (fields: any) => any;
69
+ declare const filterFieldDirty: ({ id, viewData, formValues, dirtyFields, model, defaultData, keepZeroValue, }: {
70
+ id?: any;
71
+ viewData?: any;
72
+ formValues?: any;
73
+ dirtyFields?: any;
74
+ model?: any;
75
+ defaultData?: any;
76
+ keepZeroValue?: boolean;
77
+ }) => any;
78
+ type MergeableObject = {
79
+ [key: string]: any;
80
+ } | null | undefined;
81
+ declare const mergeObjects: <T extends MergeableObject, U extends MergeableObject>(object1: T, object2: U) => (T & U) | undefined;
82
+ declare const formatUrlPath: ({ viewType, aid, model, id, actionPath, }: {
83
+ viewType: "list" | "form" | "kanban" | any;
84
+ actionPath: string;
85
+ aid: string | number;
86
+ model: string;
87
+ id?: string | number;
88
+ }) => string;
89
+ declare const removeUndefinedFields: <T extends Record<string, any>>(obj: T) => Partial<T>;
90
+ declare const useTabModel: (viewData: any, onchangeData: any) => any;
91
+ declare const isBase64File: (str: any) => boolean;
92
+ declare const isBase64Image: (str: any) => boolean;
93
+ declare const checkIsImageLink: (url: any) => boolean;
94
+ declare const formatFileSize: (size: any) => string;
95
+ declare const getSubdomain: (url?: string) => string | null;
96
+ declare const resequence: (arr: any, start: any, end: any) => any;
97
+ declare const getOffSet: (arr: any, start: any, end: any) => any;
98
+ declare const copyTextToClipboard: (text: string) => Promise<void>;
85
99
  declare const updateTokenParamInOriginalRequest: (originalRequest: {
86
100
  data?: any;
87
101
  }, newAccessToken: string) => any;
102
+ declare const isObjectEmpty: (obj: object) => boolean;
103
+ declare const useField: (props: any) => {
104
+ invisible: boolean;
105
+ required: boolean;
106
+ readonly: boolean;
107
+ nameField: string | null;
108
+ };
109
+ declare const downloadFile: (url: string, filename?: string) => Promise<void>;
110
+ declare const extractIdFromDomain: (domain?: [string, string, any][]) => number | null;
88
111
 
89
- export { Domain, InvalidDomainError, checkDomain, cleanObject, combineContexts, domainHelper, evalDomain, evalJSONContext, evalJSONDomain, evalPartialContext, formatSortingString, makeContext, matchDomains, sessionStorageUtils, toQueryString, updateTokenParamInOriginalRequest };
112
+ export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, downloadFile, evalJSONContext, evalJSONDomain, extractIdFromDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, sessionStorageUtils, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
@@ -0,0 +1,112 @@
1
+ declare const sessionStorageUtils: {
2
+ getMenuFocus: () => IMenu;
3
+ setMenuFocus: (menuTree: IMenu) => void;
4
+ setActionData: (actData: any) => void;
5
+ getActionData: () => any | null;
6
+ getViewData: () => any | null;
7
+ setViewData: (viewData: any) => void;
8
+ getBrowserSession: () => string | null;
9
+ getXNode: () => any | null;
10
+ setXNode: (xNode: any) => void;
11
+ };
12
+ interface IMenu {
13
+ id: number | undefined;
14
+ service: string;
15
+ }
16
+
17
+ declare class WesapError extends Error {
18
+ code: number;
19
+ constructor(message: string, code: number);
20
+ }
21
+ declare function handleError(error: Error, env: {
22
+ services: {
23
+ notification: {
24
+ error: (message: string) => void;
25
+ };
26
+ };
27
+ }): void;
28
+
29
+ declare const formatCurrency: (amount: number, currency?: string) => string;
30
+ declare const formatDate: (date: string | Date, locale?: string) => string;
31
+ declare const validateAndParseDate: (input: string, isDateTime?: boolean) => string | null;
32
+
33
+ type AST = {
34
+ type: number;
35
+ value: any;
36
+ };
37
+ type Condition = [string | 0 | 1, string, any];
38
+ type DomainListRepr = ('&' | '|' | '!' | Condition)[];
39
+ type DomainRepr = DomainListRepr | string | Domain;
40
+ declare class Domain {
41
+ ast: AST;
42
+ static TRUE: Domain;
43
+ static FALSE: Domain;
44
+ static combine(domains: DomainRepr[], operator: 'AND' | 'OR'): Domain;
45
+ static and(domains: DomainRepr[]): Domain;
46
+ static or(domains: DomainRepr[]): Domain;
47
+ static not(domain: DomainRepr): Domain;
48
+ static removeDomainLeaves(domain: DomainRepr, keysToRemove: string[]): Domain;
49
+ constructor(descr?: DomainRepr);
50
+ contains(record: any): boolean;
51
+ toString(): string;
52
+ toList(context: Record<string, any>): DomainListRepr;
53
+ toJson(): DomainListRepr | string;
54
+ }
55
+
56
+ declare const evalJSONContext: (_context: any, context?: {}) => any;
57
+ declare const evalJSONDomain: (domain: any, context: any) => any;
58
+ declare const formatSortingString: (input: string | null | undefined) => string | null;
59
+ declare const domainHelper: {
60
+ checkDomain: (context: any, domain: any) => boolean;
61
+ matchDomains: (context: any, domains: any) => boolean;
62
+ Domain: typeof Domain;
63
+ };
64
+ declare const toQueryString: (params: Record<string, string | number | boolean>) => string;
65
+ declare const convertFloatToTime: (floatValue: number) => string;
66
+ declare const convertTimeToFloat: (timeString: string) => number;
67
+ declare const stringToColor: (name: string, id: number) => string;
68
+ declare const getFieldsOnChange: (fields: any) => any;
69
+ declare const filterFieldDirty: ({ id, viewData, formValues, dirtyFields, model, defaultData, keepZeroValue, }: {
70
+ id?: any;
71
+ viewData?: any;
72
+ formValues?: any;
73
+ dirtyFields?: any;
74
+ model?: any;
75
+ defaultData?: any;
76
+ keepZeroValue?: boolean;
77
+ }) => any;
78
+ type MergeableObject = {
79
+ [key: string]: any;
80
+ } | null | undefined;
81
+ declare const mergeObjects: <T extends MergeableObject, U extends MergeableObject>(object1: T, object2: U) => (T & U) | undefined;
82
+ declare const formatUrlPath: ({ viewType, aid, model, id, actionPath, }: {
83
+ viewType: "list" | "form" | "kanban" | any;
84
+ actionPath: string;
85
+ aid: string | number;
86
+ model: string;
87
+ id?: string | number;
88
+ }) => string;
89
+ declare const removeUndefinedFields: <T extends Record<string, any>>(obj: T) => Partial<T>;
90
+ declare const useTabModel: (viewData: any, onchangeData: any) => any;
91
+ declare const isBase64File: (str: any) => boolean;
92
+ declare const isBase64Image: (str: any) => boolean;
93
+ declare const checkIsImageLink: (url: any) => boolean;
94
+ declare const formatFileSize: (size: any) => string;
95
+ declare const getSubdomain: (url?: string) => string | null;
96
+ declare const resequence: (arr: any, start: any, end: any) => any;
97
+ declare const getOffSet: (arr: any, start: any, end: any) => any;
98
+ declare const copyTextToClipboard: (text: string) => Promise<void>;
99
+ declare const updateTokenParamInOriginalRequest: (originalRequest: {
100
+ data?: any;
101
+ }, newAccessToken: string) => any;
102
+ declare const isObjectEmpty: (obj: object) => boolean;
103
+ declare const useField: (props: any) => {
104
+ invisible: boolean;
105
+ required: boolean;
106
+ readonly: boolean;
107
+ nameField: string | null;
108
+ };
109
+ declare const downloadFile: (url: string, filename?: string) => Promise<void>;
110
+ declare const extractIdFromDomain: (domain?: [string, string, any][]) => number | null;
111
+
112
+ export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, downloadFile, evalJSONContext, evalJSONDomain, extractIdFromDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, sessionStorageUtils, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };