@bindu-dashing/dam-solution-v2 5.8.52 → 5.8.54

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.
@@ -100,7 +100,6 @@ function DriveContainer({ parentFolderId, setSelectedFile, setParentFolderId, pi
100
100
  }
101
101
  }, []);
102
102
  const folders = useMemo(() => {
103
- console.log('## foldersPaginatedData', foldersPaginatedData);
104
103
  return !!foldersPaginatedData
105
104
  ? flatMap(get(foldersPaginatedData, "pages"), "folders")
106
105
  : [];
@@ -23,43 +23,6 @@ const FolderGridView = ({ folders, foldersFetching, hasNextPage, fetchNextPage,
23
23
  const { showPreviewModal, selectedFile } = state;
24
24
  const { type } = useAppParams();
25
25
  const clickTimer = useRef(null);
26
- const doubleClickDetected = useRef(false);
27
- const handleDoubleClick = (folder) => {
28
- const id = get(folder, "_id");
29
- const fileType = get(folder, "type", EntityType.FOLDER);
30
- // Mark that double-click was detected
31
- doubleClickDetected.current = true;
32
- // Clear any pending single-click timer
33
- if (clickTimer.current) {
34
- clearTimeout(clickTimer.current);
35
- clickTimer.current = null;
36
- }
37
- if (isImagePicker) {
38
- if (fileType === EntityType.FILE) {
39
- setSelectedFile === null || setSelectedFile === void 0 ? void 0 : setSelectedFile(folder);
40
- }
41
- else {
42
- setParentFolderId === null || setParentFolderId === void 0 ? void 0 : setParentFolderId(id);
43
- }
44
- }
45
- else if (type === DriveModes.FOLDERS) {
46
- if (navigate) {
47
- navigate(FETCH_ENTITY_SCREEN.replace(":id", id).replace(":type", fileType));
48
- }
49
- }
50
- else {
51
- if (fileType === EntityType.FOLDER && navigate) {
52
- navigate(SUBFOLDERS_SCREEN.replace(":folderId", id));
53
- }
54
- if (fileType === EntityType.FILE && type !== DriveModes.TRASH) {
55
- setState((prevState) => (Object.assign(Object.assign({}, prevState), { selectedFile: folder, showPreviewModal: true })));
56
- }
57
- }
58
- // Reset the flag after a short delay
59
- setTimeout(() => {
60
- doubleClickDetected.current = false;
61
- }, 300);
62
- };
63
26
  const handleClick = (folder) => {
64
27
  const id = get(folder, "_id");
65
28
  const fileType = get(folder, "type", EntityType.FOLDER);
@@ -89,11 +52,6 @@ const FolderGridView = ({ folders, foldersFetching, hasNextPage, fetchNextPage,
89
52
  return;
90
53
  }
91
54
  clickTimer.current = setTimeout(() => {
92
- // Don't execute single-click action if double-click was detected
93
- if (doubleClickDetected.current) {
94
- clickTimer.current = null;
95
- return;
96
- }
97
55
  if (fileType === EntityType.FILE) {
98
56
  const alreadySelected = includes(selectedFileIds, id);
99
57
  setSelectedItems({
@@ -126,7 +84,7 @@ const FolderGridView = ({ folders, foldersFetching, hasNextPage, fetchNextPage,
126
84
  (sortOrder === SortOrders.ASCEND ? (_jsx(ArrowUpOutlined, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" })) : (_jsx(ArrowDownOutlined, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" }))), sortBy !== SortByKeys.SIZE && (_jsx(FaSortIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-w-4 md-lib-h-4" }))] })] })] }), _jsx("div", { className: "md-lib-grid md-lib-grid-cols-2 md:md-lib-grid-cols-3 xl:md-lib-grid-cols-4 2xl:md-lib-grid-cols-5 md-lib-gap-x-4 md-lib-gap-y-10", children: _.map(folders, (folder) => {
127
85
  const isSelected = includes(selectedFolderIds, get(folder, "_id")) ||
128
86
  get(selectedPickerFile, "_id") === get(folder, "_id");
129
- return (_jsxs("div", { className: `md-lib-border md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-rounded-lg md-lib-px-5 md-lib-h-16 md-lib-flex md-lib-items-center md-lib-justify-between md-lib-cursor-pointer ${isSelected ? "md-lib-bg-borderColor dark:md-lib-bg-darkSecondaryBg" : ""}`, onClick: () => handleClick(folder), onDoubleClick: () => handleDoubleClick(folder), children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2 md-lib-w-[calc(100%-20px)]", children: [_jsxs("div", { children: [" ", _jsx(FaFolderIcon, { className: "md-lib-text-primaryColor", size: 32 })] }), _jsx("p", { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-truncate", title: get(folder, "name", "N/A"), children: get(folder, "name") })] }), !isImagePicker && type !== DriveModes.FOLDERS && (_jsx("div", { onClick: (e) => e.stopPropagation(), children: _jsx(FolderMenuOptions, { folder: folder }) }))] }, get(folder, "_id")));
87
+ return (_jsxs("div", { className: `md-lib-border md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-rounded-lg md-lib-px-5 md-lib-h-16 md-lib-flex md-lib-items-center md-lib-justify-between md-lib-cursor-pointer ${isSelected ? "md-lib-bg-borderColor dark:md-lib-bg-darkSecondaryBg" : ""}`, onClick: () => handleClick(folder), children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2 md-lib-w-[calc(100%-20px)]", children: [_jsxs("div", { children: [" ", _jsx(FaFolderIcon, { className: "md-lib-text-primaryColor", size: 32 })] }), _jsx("p", { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-truncate", title: get(folder, "name", "N/A"), children: get(folder, "name") })] }), !isImagePicker && type !== DriveModes.FOLDERS && (_jsx("div", { onClick: (e) => e.stopPropagation(), children: _jsx(FolderMenuOptions, { folder: folder }) }))] }, get(folder, "_id")));
130
88
  }) }), _jsx(FilesGridView, { files: files, handleClick: handleClick, selectedFileIds: selectedFileIds, isImagePicker: isImagePicker, selectedPickerFile: selectedPickerFile }), _jsx(LoadMoreItems, { hasNextPage: hasNextPage, isItemsFetching: foldersFetching, fetchNextPage: fetchNextPage }), (!!get(selectedFileIds, "length") ||
131
89
  !!get(selectedFolderIds, "length")) && (_jsx(ActionsBar, { fileIds: selectedFileIds, folderIds: selectedFolderIds, onCloseSelection: () => setSelectedItems({ fileIds: [], folderIds: [] }) })), showPreviewModal && (_jsx(FileDetails, { open: showPreviewModal, handleClose: () => {
132
90
  setState((prevState) => (Object.assign(Object.assign({}, prevState), { showPreviewModal: false, selectedFile: {} })));
@@ -48,7 +48,7 @@ const FolderListView = ({ folders, foldersFetching, hasNextPage, fetchNextPage,
48
48
  const { showPreviewModal, selectedFile } = state;
49
49
  const { type } = useAppParams();
50
50
  const clickTimer = useRef(null);
51
- const doubleClickDetected = useRef(false);
51
+ const lastClickedId = useRef(null);
52
52
  const assetIds = Array.from(new Set(folders
53
53
  .filter((f) => get(f, "type") === EntityType.FILE)
54
54
  .map((f) => get(f, "assetId"))
@@ -61,45 +61,10 @@ const FolderListView = ({ folders, foldersFetching, hasNextPage, fetchNextPage,
61
61
  .flat();
62
62
  return allFields;
63
63
  }, [assetIds, assets]);
64
- const handleDoubleClick = (folder) => {
65
- const id = get(folder, "_id");
66
- const fileType = get(folder, "type", EntityType.FOLDER);
67
- // Mark that double-click was detected
68
- doubleClickDetected.current = true;
69
- // Clear any pending single-click timer
70
- if (clickTimer.current) {
71
- clearTimeout(clickTimer.current);
72
- clickTimer.current = null;
73
- }
74
- if (isImagePicker) {
75
- if (fileType === EntityType.FILE) {
76
- setSelectedFile === null || setSelectedFile === void 0 ? void 0 : setSelectedFile(folder);
77
- }
78
- else {
79
- setParentFolderId === null || setParentFolderId === void 0 ? void 0 : setParentFolderId(id);
80
- }
81
- }
82
- else if (type === DriveModes.FOLDERS) {
83
- if (navigate) {
84
- navigate(FETCH_ENTITY_SCREEN.replace(":id", id).replace(":type", fileType));
85
- }
86
- }
87
- else {
88
- if (fileType === EntityType.FOLDER && navigate) {
89
- navigate(SUBFOLDERS_SCREEN.replace(":folderId", id));
90
- }
91
- if (fileType === EntityType.FILE && type !== DriveModes.TRASH) {
92
- setState((prevState) => (Object.assign(Object.assign({}, prevState), { selectedFile: folder, showPreviewModal: true })));
93
- }
94
- }
95
- // Reset the flag after a short delay
96
- setTimeout(() => {
97
- doubleClickDetected.current = false;
98
- }, 300);
99
- };
100
64
  const handleClick = (folder) => {
101
65
  const id = get(folder, "_id");
102
66
  const fileType = get(folder, "type", EntityType.FOLDER);
67
+ console.log('## handleClick', folder, id, fileType);
103
68
  if (isImagePicker) {
104
69
  if (fileType === EntityType.FILE) {
105
70
  setSelectedFile === null || setSelectedFile === void 0 ? void 0 : setSelectedFile(folder);
@@ -114,23 +79,33 @@ const FolderListView = ({ folders, foldersFetching, hasNextPage, fetchNextPage,
114
79
  }
115
80
  }
116
81
  else {
117
- if (clickTimer.current) {
118
- clearTimeout(clickTimer.current);
82
+ // Check if this is a double click (same item clicked within timer window)
83
+ const isDoubleClick = clickTimer.current !== null && lastClickedId.current === id;
84
+ if (isDoubleClick) {
85
+ // Double click detected - clear timer and handle double click action
86
+ if (clickTimer.current) {
87
+ clearTimeout(clickTimer.current);
88
+ }
119
89
  clickTimer.current = null;
90
+ lastClickedId.current = null;
120
91
  if (fileType === EntityType.FOLDER && navigate) {
92
+ // Double click on folder: navigate into folder
121
93
  navigate(SUBFOLDERS_SCREEN.replace(":folderId", id));
122
94
  }
123
- if (fileType === EntityType.FILE && type !== DriveModes.TRASH) {
95
+ else if (fileType === EntityType.FILE && type !== DriveModes.TRASH) {
96
+ // Double click on file: show preview
124
97
  setState((prevState) => (Object.assign(Object.assign({}, prevState), { selectedFile: folder, showPreviewModal: true })));
125
98
  }
126
99
  return;
127
100
  }
101
+ // Single click - set timer for selection
102
+ if (clickTimer.current) {
103
+ // Different item clicked, clear previous timer
104
+ clearTimeout(clickTimer.current);
105
+ }
106
+ lastClickedId.current = id;
128
107
  clickTimer.current = setTimeout(() => {
129
- // Don't execute single-click action if double-click was detected
130
- if (doubleClickDetected.current) {
131
- clickTimer.current = null;
132
- return;
133
- }
108
+ // Single click action: toggle selection
134
109
  if (fileType === EntityType.FILE) {
135
110
  const alreadySelected = includes(selectedFileIds, id);
136
111
  setSelectedItems({
@@ -148,6 +123,7 @@ const FolderListView = ({ folders, foldersFetching, hasNextPage, fetchNextPage,
148
123
  });
149
124
  }
150
125
  clickTimer.current = null;
126
+ lastClickedId.current = null;
151
127
  }, 250);
152
128
  }
153
129
  };
@@ -203,7 +179,7 @@ const FolderListView = ({ folders, foldersFetching, hasNextPage, fetchNextPage,
203
179
  includes(selectedFolderIds, id)) ||
204
180
  get(selectedPickerFile, "_id") === id;
205
181
  const currentAsset = assets.find((asset) => asset._id === get(folder, "assetId"));
206
- return (_jsxs("div", { onClick: () => handleClick(folder), onDoubleClick: () => handleDoubleClick(folder), className: `md-lib-flex md-lib-justify-between md-lib-gap-2 md-lib-items-center md-lib-min-w-fit md-lib-py-3 md-lib-px-2 md-lib-rounded-xl md-lib-cursor-pointer hover:md-lib-bg-borderColor dark:hover:md-lib-bg-darkSecondaryBg ${isSelected
182
+ return (_jsxs("div", { onClick: () => handleClick(folder), className: `md-lib-flex md-lib-justify-between md-lib-gap-2 md-lib-items-center md-lib-min-w-fit md-lib-py-3 md-lib-px-2 md-lib-rounded-xl md-lib-cursor-pointer hover:md-lib-bg-borderColor dark:hover:md-lib-bg-darkSecondaryBg ${isSelected
207
183
  ? "md-lib-bg-borderColor dark:md-lib-bg-darkSecondaryBg"
208
184
  : ""}`, children: [" ", !isImagePicker && type !== DriveModes.FOLDERS && (_jsx("div", { className: "md-lib-w-6", onClick: (e) => e.stopPropagation(), children: get(folder, "type") === EntityType.FILE ? (get(folder, "fileUploadStatus") ===
209
185
  ThumbnailStatus.PENDING ? (_jsx(_Fragment, {})) : (_jsx(FileMenuOptions, { file: folder }))) : (_jsx(FolderMenuOptions, { folder: folder })) })), _jsx("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-between md-lib-w-[280px] md-lib-text-[15px] md-lib-text-textColor dark:md-lib-text-darkTextColor", title: name, children: _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2 md-lib-overflow-hidden", children: [_jsx("div", { children: get(folder, "type") === EntityType.FILE ? (get(folder, "fileUploadStatus") ===
@@ -35,7 +35,6 @@ function App(props) {
35
35
  props === null || props === void 0 ? void 0 : props.id,
36
36
  props === null || props === void 0 ? void 0 : props.parentId,
37
37
  props === null || props === void 0 ? void 0 : props.showSubfolders,
38
- props === null || props === void 0 ? void 0 : props.routerVersion,
39
38
  ]);
40
39
  const [folders, setFolders] = useState([]);
41
40
  if (typeof window !== "undefined" && !window.process) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bindu-dashing/dam-solution-v2",
3
- "version": "5.8.52",
3
+ "version": "5.8.54",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.0.1",
6
6
  "@emoji-mart/data": "^1.2.1",