@fctc/interface-logic 3.2.5 → 3.2.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/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/models.js +1 -1
- package/dist/models.mjs +1 -1
- package/dist/provider.js +1 -1
- package/dist/provider.mjs +1 -1
- package/dist/utils.d.mts +2 -1
- package/dist/utils.d.ts +2 -1
- package/dist/utils.js +33 -0
- package/dist/utils.mjs +32 -0
- package/package.json +90 -90
package/dist/hooks.js
CHANGED
|
@@ -6141,7 +6141,7 @@ var BaseModel = class {
|
|
|
6141
6141
|
} else {
|
|
6142
6142
|
spec[field?.name].fields = this.getSpecificationByFields({
|
|
6143
6143
|
fields: Object.values(modelRelation),
|
|
6144
|
-
specification: {},
|
|
6144
|
+
specification: { id: {}, display_name: {} },
|
|
6145
6145
|
modelsData,
|
|
6146
6146
|
model: relation,
|
|
6147
6147
|
modelRoot: model
|
package/dist/hooks.mjs
CHANGED
|
@@ -6014,7 +6014,7 @@ var BaseModel = class {
|
|
|
6014
6014
|
} else {
|
|
6015
6015
|
spec[field?.name].fields = this.getSpecificationByFields({
|
|
6016
6016
|
fields: Object.values(modelRelation),
|
|
6017
|
-
specification: {},
|
|
6017
|
+
specification: { id: {}, display_name: {} },
|
|
6018
6018
|
modelsData,
|
|
6019
6019
|
model: relation,
|
|
6020
6020
|
modelRoot: model
|
package/dist/models.js
CHANGED
|
@@ -65,7 +65,7 @@ var BaseModel = class {
|
|
|
65
65
|
} else {
|
|
66
66
|
spec[field?.name].fields = this.getSpecificationByFields({
|
|
67
67
|
fields: Object.values(modelRelation),
|
|
68
|
-
specification: {},
|
|
68
|
+
specification: { id: {}, display_name: {} },
|
|
69
69
|
modelsData,
|
|
70
70
|
model: relation,
|
|
71
71
|
modelRoot: model
|
package/dist/models.mjs
CHANGED
|
@@ -39,7 +39,7 @@ var BaseModel = class {
|
|
|
39
39
|
} else {
|
|
40
40
|
spec[field?.name].fields = this.getSpecificationByFields({
|
|
41
41
|
fields: Object.values(modelRelation),
|
|
42
|
-
specification: {},
|
|
42
|
+
specification: { id: {}, display_name: {} },
|
|
43
43
|
modelsData,
|
|
44
44
|
model: relation,
|
|
45
45
|
modelRoot: model
|
package/dist/provider.js
CHANGED
|
@@ -6526,7 +6526,7 @@ var BaseModel = class {
|
|
|
6526
6526
|
} else {
|
|
6527
6527
|
spec[field?.name].fields = this.getSpecificationByFields({
|
|
6528
6528
|
fields: Object.values(modelRelation),
|
|
6529
|
-
specification: {},
|
|
6529
|
+
specification: { id: {}, display_name: {} },
|
|
6530
6530
|
modelsData,
|
|
6531
6531
|
model: relation,
|
|
6532
6532
|
modelRoot: model
|
package/dist/provider.mjs
CHANGED
|
@@ -6483,7 +6483,7 @@ var BaseModel = class {
|
|
|
6483
6483
|
} else {
|
|
6484
6484
|
spec[field?.name].fields = this.getSpecificationByFields({
|
|
6485
6485
|
fields: Object.values(modelRelation),
|
|
6486
|
-
specification: {},
|
|
6486
|
+
specification: { id: {}, display_name: {} },
|
|
6487
6487
|
modelsData,
|
|
6488
6488
|
model: relation,
|
|
6489
6489
|
modelRoot: model
|
package/dist/utils.d.mts
CHANGED
|
@@ -106,5 +106,6 @@ declare const useField: (props: any) => {
|
|
|
106
106
|
readonly: boolean;
|
|
107
107
|
nameField: string | null;
|
|
108
108
|
};
|
|
109
|
+
declare const downloadFile: (url: string, filename?: string) => Promise<void>;
|
|
109
110
|
|
|
110
|
-
export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, sessionStorageUtils, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
|
|
111
|
+
export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, downloadFile, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, sessionStorageUtils, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
|
package/dist/utils.d.ts
CHANGED
|
@@ -106,5 +106,6 @@ declare const useField: (props: any) => {
|
|
|
106
106
|
readonly: boolean;
|
|
107
107
|
nameField: string | null;
|
|
108
108
|
};
|
|
109
|
+
declare const downloadFile: (url: string, filename?: string) => Promise<void>;
|
|
109
110
|
|
|
110
|
-
export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, sessionStorageUtils, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
|
|
111
|
+
export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, downloadFile, evalJSONContext, evalJSONDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, sessionStorageUtils, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
|
package/dist/utils.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(utils_exports, {
|
|
|
36
36
|
convertTimeToFloat: () => convertTimeToFloat,
|
|
37
37
|
copyTextToClipboard: () => copyTextToClipboard,
|
|
38
38
|
domainHelper: () => domainHelper,
|
|
39
|
+
downloadFile: () => downloadFile,
|
|
39
40
|
evalJSONContext: () => evalJSONContext,
|
|
40
41
|
evalJSONDomain: () => evalJSONDomain,
|
|
41
42
|
filterFieldDirty: () => filterFieldDirty,
|
|
@@ -2943,6 +2944,37 @@ var useField = (props) => {
|
|
|
2943
2944
|
nameField
|
|
2944
2945
|
};
|
|
2945
2946
|
};
|
|
2947
|
+
var downloadFile = async (url, filename) => {
|
|
2948
|
+
try {
|
|
2949
|
+
const response = await fetch(url);
|
|
2950
|
+
if (!response.ok) throw new Error(`Failed to fetch ${url}`);
|
|
2951
|
+
const contentType = response.headers.get("Content-Type") || "";
|
|
2952
|
+
let ext = "";
|
|
2953
|
+
if (contentType.includes("pdf")) ext = ".pdf";
|
|
2954
|
+
else if (contentType.includes("png")) ext = ".png";
|
|
2955
|
+
else if (contentType.includes("jpeg") || contentType.includes("jpg"))
|
|
2956
|
+
ext = ".jpg";
|
|
2957
|
+
else if (contentType.includes("zip")) ext = ".zip";
|
|
2958
|
+
else if (contentType.includes("msword")) ext = ".doc";
|
|
2959
|
+
else if (contentType.includes("spreadsheet")) ext = ".xls";
|
|
2960
|
+
else if (contentType.includes("json")) ext = ".json";
|
|
2961
|
+
else if (contentType.includes("text")) ext = ".txt";
|
|
2962
|
+
else {
|
|
2963
|
+
ext = "";
|
|
2964
|
+
}
|
|
2965
|
+
const blob = await response.blob();
|
|
2966
|
+
const urlBlob = window.URL.createObjectURL(blob);
|
|
2967
|
+
const link = document.createElement("a");
|
|
2968
|
+
link.href = urlBlob;
|
|
2969
|
+
link.download = (filename || "file") + ext;
|
|
2970
|
+
document.body.appendChild(link);
|
|
2971
|
+
link.click();
|
|
2972
|
+
document.body.removeChild(link);
|
|
2973
|
+
window.URL.revokeObjectURL(urlBlob);
|
|
2974
|
+
} catch (error) {
|
|
2975
|
+
console.error("File download failed:", error);
|
|
2976
|
+
}
|
|
2977
|
+
};
|
|
2946
2978
|
|
|
2947
2979
|
// src/utils/storage/session-storage.ts
|
|
2948
2980
|
var sessionStorageUtils = /* @__PURE__ */ (() => {
|
|
@@ -3001,6 +3033,7 @@ var sessionStorageUtils = /* @__PURE__ */ (() => {
|
|
|
3001
3033
|
convertTimeToFloat,
|
|
3002
3034
|
copyTextToClipboard,
|
|
3003
3035
|
domainHelper,
|
|
3036
|
+
downloadFile,
|
|
3004
3037
|
evalJSONContext,
|
|
3005
3038
|
evalJSONDomain,
|
|
3006
3039
|
filterFieldDirty,
|
package/dist/utils.mjs
CHANGED
|
@@ -2877,6 +2877,37 @@ var useField = (props) => {
|
|
|
2877
2877
|
nameField
|
|
2878
2878
|
};
|
|
2879
2879
|
};
|
|
2880
|
+
var downloadFile = async (url, filename) => {
|
|
2881
|
+
try {
|
|
2882
|
+
const response = await fetch(url);
|
|
2883
|
+
if (!response.ok) throw new Error(`Failed to fetch ${url}`);
|
|
2884
|
+
const contentType = response.headers.get("Content-Type") || "";
|
|
2885
|
+
let ext = "";
|
|
2886
|
+
if (contentType.includes("pdf")) ext = ".pdf";
|
|
2887
|
+
else if (contentType.includes("png")) ext = ".png";
|
|
2888
|
+
else if (contentType.includes("jpeg") || contentType.includes("jpg"))
|
|
2889
|
+
ext = ".jpg";
|
|
2890
|
+
else if (contentType.includes("zip")) ext = ".zip";
|
|
2891
|
+
else if (contentType.includes("msword")) ext = ".doc";
|
|
2892
|
+
else if (contentType.includes("spreadsheet")) ext = ".xls";
|
|
2893
|
+
else if (contentType.includes("json")) ext = ".json";
|
|
2894
|
+
else if (contentType.includes("text")) ext = ".txt";
|
|
2895
|
+
else {
|
|
2896
|
+
ext = "";
|
|
2897
|
+
}
|
|
2898
|
+
const blob = await response.blob();
|
|
2899
|
+
const urlBlob = window.URL.createObjectURL(blob);
|
|
2900
|
+
const link = document.createElement("a");
|
|
2901
|
+
link.href = urlBlob;
|
|
2902
|
+
link.download = (filename || "file") + ext;
|
|
2903
|
+
document.body.appendChild(link);
|
|
2904
|
+
link.click();
|
|
2905
|
+
document.body.removeChild(link);
|
|
2906
|
+
window.URL.revokeObjectURL(urlBlob);
|
|
2907
|
+
} catch (error) {
|
|
2908
|
+
console.error("File download failed:", error);
|
|
2909
|
+
}
|
|
2910
|
+
};
|
|
2880
2911
|
|
|
2881
2912
|
// src/utils/storage/session-storage.ts
|
|
2882
2913
|
var sessionStorageUtils = /* @__PURE__ */ (() => {
|
|
@@ -2934,6 +2965,7 @@ export {
|
|
|
2934
2965
|
convertTimeToFloat,
|
|
2935
2966
|
copyTextToClipboard,
|
|
2936
2967
|
domainHelper,
|
|
2968
|
+
downloadFile,
|
|
2937
2969
|
evalJSONContext,
|
|
2938
2970
|
evalJSONDomain,
|
|
2939
2971
|
filterFieldDirty,
|
package/package.json
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fctc/interface-logic",
|
|
3
|
-
"version": "3.2.
|
|
4
|
-
"types": "dist/index.d.ts",
|
|
5
|
-
"main": "dist/index.cjs",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.mjs",
|
|
11
|
-
"require": "./dist/index.cjs"
|
|
12
|
-
},
|
|
13
|
-
"./configs": {
|
|
14
|
-
"types": "./dist/configs.d.ts",
|
|
15
|
-
"import": "./dist/configs.mjs",
|
|
16
|
-
"require": "./dist/configs.cjs"
|
|
17
|
-
},
|
|
18
|
-
"./constants": {
|
|
19
|
-
"types": "./dist/constants.d.ts",
|
|
20
|
-
"import": "./dist/constants.mjs",
|
|
21
|
-
"require": "./dist/constants.cjs"
|
|
22
|
-
},
|
|
23
|
-
"./environment": {
|
|
24
|
-
"types": "./dist/environment.d.ts",
|
|
25
|
-
"import": "./dist/environment.mjs",
|
|
26
|
-
"require": "./dist/environment.cjs"
|
|
27
|
-
},
|
|
28
|
-
"./hooks": {
|
|
29
|
-
"types": "./dist/hooks.d.ts",
|
|
30
|
-
"import": "./dist/hooks.mjs",
|
|
31
|
-
"require": "./dist/hooks.cjs"
|
|
32
|
-
},
|
|
33
|
-
"./provider": {
|
|
34
|
-
"types": "./dist/provider.d.ts",
|
|
35
|
-
"import": "./dist/provider.mjs",
|
|
36
|
-
"require": "./dist/provider.cjs"
|
|
37
|
-
},
|
|
38
|
-
"./services": {
|
|
39
|
-
"types": "./dist/services.d.ts",
|
|
40
|
-
"import": "./dist/services.mjs",
|
|
41
|
-
"require": "./dist/services.cjs"
|
|
42
|
-
},
|
|
43
|
-
"./store": {
|
|
44
|
-
"types": "./dist/store.d.ts",
|
|
45
|
-
"import": "./dist/store.mjs",
|
|
46
|
-
"require": "./dist/store.cjs"
|
|
47
|
-
},
|
|
48
|
-
"./utils": {
|
|
49
|
-
"types": "./dist/utils.d.ts",
|
|
50
|
-
"import": "./dist/utils.mjs",
|
|
51
|
-
"require": "./dist/utils.cjs"
|
|
52
|
-
},
|
|
53
|
-
"./types": {
|
|
54
|
-
"types": "./dist/types.d.ts",
|
|
55
|
-
"import": "./dist/types.mjs",
|
|
56
|
-
"require": "./dist/types.cjs"
|
|
57
|
-
},
|
|
58
|
-
"./models": {
|
|
59
|
-
"types": "./dist/models.d.ts",
|
|
60
|
-
"import": "./dist/models.mjs",
|
|
61
|
-
"require": "./dist/models.cjs"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"files": [
|
|
65
|
-
"dist"
|
|
66
|
-
],
|
|
67
|
-
"scripts": {
|
|
68
|
-
"build": "tsup",
|
|
69
|
-
"test": "jest"
|
|
70
|
-
},
|
|
71
|
-
"peerDependencies": {
|
|
72
|
-
"react": "18.0.0",
|
|
73
|
-
"@tanstack/react-query": "^5.83.0"
|
|
74
|
-
},
|
|
75
|
-
"dependencies": {
|
|
76
|
-
"@reduxjs/toolkit": "^2.8.2",
|
|
77
|
-
"@tanstack/react-query": "^5.83.0",
|
|
78
|
-
"axios": "^1.11.0",
|
|
79
|
-
"moment": "^2.30.1",
|
|
80
|
-
"react-redux": "^9.2.0"
|
|
81
|
-
},
|
|
82
|
-
"devDependencies": {
|
|
83
|
-
"@types/react": "^18.3.1",
|
|
84
|
-
"react": "18.0.0",
|
|
85
|
-
"jest": "^29.7.0",
|
|
86
|
-
"tsup": "^8.0.0",
|
|
87
|
-
"typescript": "^5.8.2"
|
|
88
|
-
},
|
|
89
|
-
"packageManager": "yarn@1.22.0"
|
|
90
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@fctc/interface-logic",
|
|
3
|
+
"version": "3.2.7",
|
|
4
|
+
"types": "dist/index.d.ts",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.mjs",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
},
|
|
13
|
+
"./configs": {
|
|
14
|
+
"types": "./dist/configs.d.ts",
|
|
15
|
+
"import": "./dist/configs.mjs",
|
|
16
|
+
"require": "./dist/configs.cjs"
|
|
17
|
+
},
|
|
18
|
+
"./constants": {
|
|
19
|
+
"types": "./dist/constants.d.ts",
|
|
20
|
+
"import": "./dist/constants.mjs",
|
|
21
|
+
"require": "./dist/constants.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./environment": {
|
|
24
|
+
"types": "./dist/environment.d.ts",
|
|
25
|
+
"import": "./dist/environment.mjs",
|
|
26
|
+
"require": "./dist/environment.cjs"
|
|
27
|
+
},
|
|
28
|
+
"./hooks": {
|
|
29
|
+
"types": "./dist/hooks.d.ts",
|
|
30
|
+
"import": "./dist/hooks.mjs",
|
|
31
|
+
"require": "./dist/hooks.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./provider": {
|
|
34
|
+
"types": "./dist/provider.d.ts",
|
|
35
|
+
"import": "./dist/provider.mjs",
|
|
36
|
+
"require": "./dist/provider.cjs"
|
|
37
|
+
},
|
|
38
|
+
"./services": {
|
|
39
|
+
"types": "./dist/services.d.ts",
|
|
40
|
+
"import": "./dist/services.mjs",
|
|
41
|
+
"require": "./dist/services.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./store": {
|
|
44
|
+
"types": "./dist/store.d.ts",
|
|
45
|
+
"import": "./dist/store.mjs",
|
|
46
|
+
"require": "./dist/store.cjs"
|
|
47
|
+
},
|
|
48
|
+
"./utils": {
|
|
49
|
+
"types": "./dist/utils.d.ts",
|
|
50
|
+
"import": "./dist/utils.mjs",
|
|
51
|
+
"require": "./dist/utils.cjs"
|
|
52
|
+
},
|
|
53
|
+
"./types": {
|
|
54
|
+
"types": "./dist/types.d.ts",
|
|
55
|
+
"import": "./dist/types.mjs",
|
|
56
|
+
"require": "./dist/types.cjs"
|
|
57
|
+
},
|
|
58
|
+
"./models": {
|
|
59
|
+
"types": "./dist/models.d.ts",
|
|
60
|
+
"import": "./dist/models.mjs",
|
|
61
|
+
"require": "./dist/models.cjs"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"files": [
|
|
65
|
+
"dist"
|
|
66
|
+
],
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "tsup",
|
|
69
|
+
"test": "jest"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"react": "18.0.0",
|
|
73
|
+
"@tanstack/react-query": "^5.83.0"
|
|
74
|
+
},
|
|
75
|
+
"dependencies": {
|
|
76
|
+
"@reduxjs/toolkit": "^2.8.2",
|
|
77
|
+
"@tanstack/react-query": "^5.83.0",
|
|
78
|
+
"axios": "^1.11.0",
|
|
79
|
+
"moment": "^2.30.1",
|
|
80
|
+
"react-redux": "^9.2.0"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@types/react": "^18.3.1",
|
|
84
|
+
"react": "18.0.0",
|
|
85
|
+
"jest": "^29.7.0",
|
|
86
|
+
"tsup": "^8.0.0",
|
|
87
|
+
"typescript": "^5.8.2"
|
|
88
|
+
},
|
|
89
|
+
"packageManager": "yarn@1.22.0"
|
|
90
|
+
}
|