@solidxai/core-ui 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.js +51 -27
- package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
- package/dist/components/core/common/SolidGlobalSearchElement.tsx +85 -22
- package/dist/components/core/common/SolidImageViewer.d.ts +10 -0
- package/dist/components/core/common/SolidImageViewer.d.ts.map +1 -0
- package/dist/components/core/common/SolidImageViewer.js +59 -0
- package/dist/components/core/common/SolidImageViewer.js.map +1 -0
- package/dist/components/core/common/SolidImageViewer.tsx +84 -0
- package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.d.ts.map +1 -1
- package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.js +80 -79
- package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.js.map +1 -1
- package/dist/components/core/form/fields/widgets/SolidS3FileViewerWidget.tsx +92 -85
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +6 -4
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +6 -4
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.js +16 -17
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidMediaMultipleColumn.tsx +46 -44
- package/dist/components/core/list/columns/SolidMediaSingleColumn.d.ts.map +1 -1
- package/dist/components/core/list/columns/SolidMediaSingleColumn.js +6 -4
- package/dist/components/core/list/columns/SolidMediaSingleColumn.js.map +1 -1
- package/dist/components/core/list/columns/SolidMediaSingleColumn.tsx +7 -5
- package/dist/helpers/fetchS3Url.d.ts +19 -0
- package/dist/helpers/fetchS3Url.d.ts.map +1 -0
- package/dist/helpers/fetchS3Url.js +60 -0
- package/dist/helpers/fetchS3Url.js.map +1 -0
- package/dist/helpers/fetchS3Url.ts +33 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/index.ts +8 -1
- package/dist/routes/pages/admin/core/ListPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/ListPage.js +8 -3
- package/dist/routes/pages/admin/core/ListPage.js.map +1 -1
- package/dist/routes/pages/admin/core/ListPage.tsx +10 -3
- package/package.json +1 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
3
|
import { SolidFormFieldWidgetProps } from "../../../../../types/solid-core";
|
|
4
4
|
import { Button } from "primereact/button";
|
|
5
5
|
import { Dialog } from "primereact/dialog";
|
|
6
6
|
import { useResolveS3UrlMutation } from "../../../../../redux/api/fieldApi";
|
|
7
7
|
import Viewer from "viewerjs";
|
|
8
8
|
import "viewerjs/dist/viewer.css";
|
|
9
|
+
import { SolidImageViewer } from "../../../../../components/core/common/SolidImageViewer";
|
|
10
|
+
import { fetchS3Url, type FetchS3UrlOptions } from "../../../../..//helpers/fetchS3Url";
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* SolidS3FileViewerWidget (PrimeReact version)
|
|
@@ -31,35 +33,25 @@ export const SolidS3FileViewerWidget = ({ formik, fieldContext }: SolidFormField
|
|
|
31
33
|
|
|
32
34
|
const [resolveS3Url] = useResolveS3UrlMutation();
|
|
33
35
|
|
|
34
|
-
const
|
|
35
|
-
console.log("fetch url called");
|
|
36
|
+
const resolveFileUrl = async () => {
|
|
36
37
|
setIsLoading(true);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (result.statusCode == "200") {
|
|
50
|
-
console.log("fetch url success", result.data.url);
|
|
51
|
-
return result.data.url;
|
|
52
|
-
}
|
|
53
|
-
} catch (e) {
|
|
54
|
-
console.error("Failed to resolve S3 URL:", e);
|
|
55
|
-
setIsLoading(false);
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
38
|
+
|
|
39
|
+
const options: FetchS3UrlOptions = {
|
|
40
|
+
s3Key: value,
|
|
41
|
+
fileType: fileType,
|
|
42
|
+
bucketName: bucketName,
|
|
43
|
+
mediaStorageProviderUserKey: mediaStorageProviderUserKey,
|
|
44
|
+
isPrivate: isPrivate
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const url = await fetchS3Url(resolveS3Url, options);
|
|
48
|
+
setIsLoading(false);
|
|
49
|
+
return url;
|
|
58
50
|
};
|
|
59
51
|
|
|
60
52
|
const handleDownload = async () => {
|
|
61
53
|
if (isLoading) return;
|
|
62
|
-
const url = await
|
|
54
|
+
const url = await resolveFileUrl();
|
|
63
55
|
if (!url) return;
|
|
64
56
|
const a = document.createElement("a");
|
|
65
57
|
a.href = url;
|
|
@@ -72,13 +64,13 @@ export const SolidS3FileViewerWidget = ({ formik, fieldContext }: SolidFormField
|
|
|
72
64
|
const handleView = async () => {
|
|
73
65
|
console.log("isLoading in view", isLoading);
|
|
74
66
|
if (isLoading) return;
|
|
75
|
-
|
|
76
|
-
const url = await
|
|
67
|
+
|
|
68
|
+
const url = await resolveFileUrl();
|
|
77
69
|
console.log("url after fetch success", url);
|
|
78
70
|
if (!url) return;
|
|
79
|
-
|
|
71
|
+
|
|
80
72
|
setPreviewUrl(url);
|
|
81
|
-
|
|
73
|
+
|
|
82
74
|
if (isImage) {
|
|
83
75
|
// Trigger viewer to show after state update
|
|
84
76
|
setShouldShowViewer(true);
|
|
@@ -92,54 +84,54 @@ export const SolidS3FileViewerWidget = ({ formik, fieldContext }: SolidFormField
|
|
|
92
84
|
const isDownloadOnly = ["xlsx", "xls", "csv", "doc", "docx"].includes(fileType);
|
|
93
85
|
|
|
94
86
|
// 🔹 Initialize Viewer.js once image exists
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}, [previewUrl, isImage]);
|
|
87
|
+
// useEffect(() => {
|
|
88
|
+
// if (imageRef.current && previewUrl && isImage) {
|
|
89
|
+
// // Destroy existing viewer if any
|
|
90
|
+
// if (viewerRef.current) {
|
|
91
|
+
// viewerRef.current.destroy();
|
|
92
|
+
// }
|
|
93
|
+
|
|
94
|
+
// // Create new viewer instance
|
|
95
|
+
// viewerRef.current = new Viewer(imageRef.current, {
|
|
96
|
+
// toolbar: {
|
|
97
|
+
// zoomIn: 1,
|
|
98
|
+
// zoomOut: 1,
|
|
99
|
+
// rotateLeft: 1,
|
|
100
|
+
// rotateRight: 1,
|
|
101
|
+
// reset: 1,
|
|
102
|
+
// },
|
|
103
|
+
// navbar: false,
|
|
104
|
+
// title: false,
|
|
105
|
+
// transition: true,
|
|
106
|
+
// movable: true,
|
|
107
|
+
// scalable: true,
|
|
108
|
+
// rotatable: true,
|
|
109
|
+
// zoomable: true,
|
|
110
|
+
// zIndex: 9999,
|
|
111
|
+
// // Add hidden event to reset state
|
|
112
|
+
// hidden: () => {
|
|
113
|
+
// setShouldShowViewer(false);
|
|
114
|
+
// }
|
|
115
|
+
// });
|
|
116
|
+
|
|
117
|
+
// console.log("Viewer initialized");
|
|
118
|
+
// }
|
|
119
|
+
|
|
120
|
+
// return () => {
|
|
121
|
+
// if (viewerRef.current) {
|
|
122
|
+
// viewerRef.current.destroy();
|
|
123
|
+
// viewerRef.current = null;
|
|
124
|
+
// }
|
|
125
|
+
// };
|
|
126
|
+
// }, [previewUrl, isImage]);
|
|
135
127
|
|
|
136
128
|
// 🔹 Show viewer when shouldShowViewer becomes true
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}, [shouldShowViewer]);
|
|
129
|
+
// useEffect(() => {
|
|
130
|
+
// if (shouldShowViewer && viewerRef.current) {
|
|
131
|
+
// console.log("Showing viewer");
|
|
132
|
+
// viewerRef.current.show();
|
|
133
|
+
// }
|
|
134
|
+
// }, [shouldShowViewer]);
|
|
143
135
|
|
|
144
136
|
return (
|
|
145
137
|
<div className="mt-2 flex flex-col gap-2">
|
|
@@ -179,17 +171,32 @@ export const SolidS3FileViewerWidget = ({ formik, fieldContext }: SolidFormField
|
|
|
179
171
|
|
|
180
172
|
{/* Hidden image for Viewer.js - keep visibility hidden instead of display none */}
|
|
181
173
|
{isImage && previewUrl && (
|
|
182
|
-
<img
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
174
|
+
// <img
|
|
175
|
+
// ref={imageRef}
|
|
176
|
+
// src={previewUrl}
|
|
177
|
+
// alt={value}
|
|
178
|
+
// style={{
|
|
179
|
+
// position: "absolute",
|
|
180
|
+
// visibility: "hidden",
|
|
181
|
+
// width: "1px",
|
|
182
|
+
// height: "1px"
|
|
183
|
+
// }}
|
|
184
|
+
// />
|
|
185
|
+
<SolidImageViewer
|
|
186
|
+
images={[previewUrl]}
|
|
187
|
+
open={shouldShowViewer}
|
|
188
|
+
onClose={() => setShouldShowViewer(false)}
|
|
189
|
+
viewerOptions={{
|
|
190
|
+
toolbar: {
|
|
191
|
+
zoomIn: 1,
|
|
192
|
+
zoomOut: 1,
|
|
193
|
+
rotateLeft: 1,
|
|
194
|
+
rotateRight: 1,
|
|
195
|
+
reset: 1,
|
|
196
|
+
},
|
|
191
197
|
}}
|
|
192
198
|
/>
|
|
199
|
+
|
|
193
200
|
)}
|
|
194
201
|
|
|
195
202
|
<Dialog
|
|
@@ -219,4 +226,4 @@ export const SolidS3FileViewerWidget = ({ formik, fieldContext }: SolidFormField
|
|
|
219
226
|
</Dialog>
|
|
220
227
|
</div>
|
|
221
228
|
);
|
|
222
|
-
};
|
|
229
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidListView.d.ts","sourceRoot":"","sources":["../../../../src/components/core/list/SolidListView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAgF,MAAM,OAAO,CAAC;AAwCrG,OAAO,uCAAuC,CAAC;AAC/C,OAAO,gDAAgD,CAAC;AA0BxD,eAAO,MAAM,wBAAwB,WAgBpC,CAAC;AAGF,eAAO,MAAM,6BAA6B,mBAgBzC,CAAC;AAEF,eAAO,MAAM,wBAAwB,gBAAiB,MAAM,kBAU3D,CAAC;AAGF,eAAO,MAAM,6BAA6B,0BAAsB,MAAM,kBAUrE,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;OAKG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IAC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,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC;QACtB,OAAO,EAAE,GAAG,CAAC;QACb,gBAAgB,EAAE,GAAG,CAAC;QACtB,QAAQ,EAAE,GAAG,EAAE,CAAC;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,aAAa,iGAk2DxB,CAAC"}
|
|
@@ -565,8 +565,10 @@ export var SolidListView = forwardRef(function (params, ref) {
|
|
|
565
565
|
setToPopulateMedia(populateMedia);
|
|
566
566
|
setFirst(0);
|
|
567
567
|
}
|
|
568
|
+
//below line was added to handle state stale issue when we converted boilerplate to vite
|
|
569
|
+
//since now we dont need it becuase our component is remounted on every router change
|
|
568
570
|
setFilters(params.customFilter || { $and: [] });
|
|
569
|
-
setFilterPredicates(null);
|
|
571
|
+
//setFilterPredicates(null);
|
|
570
572
|
setSelectedRecords([]);
|
|
571
573
|
setSelectedRecoverRecords([]);
|
|
572
574
|
setQueryDataLoaded(true);
|
|
@@ -650,7 +652,7 @@ export var SolidListView = forwardRef(function (params, ref) {
|
|
|
650
652
|
latestFilterPredicatesRef.current = filterPredicates;
|
|
651
653
|
}, [filterPredicates]);
|
|
652
654
|
useEffect(function () {
|
|
653
|
-
console.log("useEffect: [first- ".concat(first, ", rows- ").concat(rows, ", sortField- ").concat(sortField, ", sortOrder- ").concat(sortOrder, ", showArchived- ").concat(showArchived, ", toPopulate- ").concat(toPopulate, ", toPopulateMedia- ").concat(toPopulateMedia, ", queryDataLoaded- ").concat(queryDataLoaded, "]"));
|
|
655
|
+
console.log("useEffect: [first- ".concat(first, ", rows- ").concat(rows, ", sortField- ").concat(sortField, ", sortOrder- ").concat(sortOrder, ", showArchived- ").concat(showArchived, ", toPopulate- ").concat(toPopulate, ", toPopulateMedia- ").concat(toPopulateMedia, ", queryDataLoaded- ").concat(queryDataLoaded, ", filterPredicates- ").concat(filterPredicates, "]"));
|
|
654
656
|
if (queryDataLoaded && filters && (filterPredicates || params.embeded == true)) {
|
|
655
657
|
setQueryString();
|
|
656
658
|
}
|
|
@@ -663,7 +665,8 @@ export var SolidListView = forwardRef(function (params, ref) {
|
|
|
663
665
|
showArchived,
|
|
664
666
|
toPopulate,
|
|
665
667
|
toPopulateMedia,
|
|
666
|
-
queryDataLoaded
|
|
668
|
+
queryDataLoaded,
|
|
669
|
+
filterPredicates
|
|
667
670
|
]);
|
|
668
671
|
// Handle pagination event.
|
|
669
672
|
var onPageChange = function (event) {
|
|
@@ -794,7 +797,6 @@ export var SolidListView = forwardRef(function (params, ref) {
|
|
|
794
797
|
latestFilterPredicatesRef.current = updatedFilterPredicates;
|
|
795
798
|
// Then update state
|
|
796
799
|
setFilters(updatedFilter);
|
|
797
|
-
setPersistFilter(persistFilter);
|
|
798
800
|
setFilterPredicates(updatedFilterPredicates);
|
|
799
801
|
// Force synchronous state updates
|
|
800
802
|
};
|