@pitcher/canvas-ui 2026.1.13-135930-beta → 2026.1.13-143130-beta
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/canvas-ui.js +22 -13
- package/canvas-ui.js.map +1 -1
- package/lib/apps/browser/stores/api.d.ts +18 -0
- package/package.json +1 -1
package/canvas-ui.js
CHANGED
|
@@ -109586,9 +109586,11 @@ const _sfc_main$4U = /* @__PURE__ */ defineComponent({
|
|
|
109586
109586
|
function filterByItemVisibility(items) {
|
|
109587
109587
|
const isAdmin = state$3.appName.value === "admin";
|
|
109588
109588
|
return items.reduce((acc, item) => {
|
|
109589
|
+
const hasCountData = "files_count" in item || "folders_count" in item || "available_files_count" in item || "available_folders_count" in item;
|
|
109589
109590
|
const filesCount = item.available_files_count ?? item.files_count ?? 0;
|
|
109590
109591
|
const foldersCount = item.available_folders_count ?? item.folders_count ?? 0;
|
|
109591
|
-
const
|
|
109592
|
+
const isFolderEmpty = item.type == "folder" && hasCountData && filesCount === 0 && foldersCount === 0;
|
|
109593
|
+
const shouldHideItem = item.name?.startsWith(".") || isFolderEmpty || item.folder?.file_thumbnail_urls?.length === 0;
|
|
109592
109594
|
if (!shouldHideItem && !isAdmin || isAdmin) {
|
|
109593
109595
|
acc.push({
|
|
109594
109596
|
...item,
|
|
@@ -109965,7 +109967,8 @@ const getInitialState$1 = () => ({
|
|
|
109965
109967
|
// instance metadata template fields dictionary
|
|
109966
109968
|
searchQuery: "",
|
|
109967
109969
|
searchMetadataFilters: {},
|
|
109968
|
-
filteredItems: []
|
|
109970
|
+
filteredItems: [],
|
|
109971
|
+
folderCache: {}
|
|
109969
109972
|
});
|
|
109970
109973
|
const state$2 = reactive(getInitialState$1());
|
|
109971
109974
|
const fileOrderedStatuses = [FileStatusEnum.PENDING, FileStatusEnum.VIEWABLE];
|
|
@@ -110050,6 +110053,15 @@ function updateFolderState(folder) {
|
|
|
110050
110053
|
state$2.folders = folder.folders;
|
|
110051
110054
|
state$2.files = folder.files;
|
|
110052
110055
|
state$2.currentFolderPath = folder.path;
|
|
110056
|
+
folder.folders.forEach((subfolder) => {
|
|
110057
|
+
state$2.folderCache[subfolder.id] = {
|
|
110058
|
+
files_count: subfolder.files_count ?? 0,
|
|
110059
|
+
folders_count: subfolder.folders_count ?? 0,
|
|
110060
|
+
available_files_count: subfolder.available_files_count,
|
|
110061
|
+
available_folders_count: subfolder.available_folders_count,
|
|
110062
|
+
timestamp: Date.now()
|
|
110063
|
+
};
|
|
110064
|
+
});
|
|
110053
110065
|
if (useAppStore$4().showFilteredResults.value) {
|
|
110054
110066
|
const filesById = new Map(state$2.files.map((file) => [file.id, file]));
|
|
110055
110067
|
state$2.filteredItems = state$2.filteredItems.map((filteredItem) => {
|
|
@@ -110315,23 +110327,20 @@ function init({
|
|
|
110315
110327
|
let filteredFolders = [];
|
|
110316
110328
|
if (!hasMetadataFilters && foldersResponse.status === "fulfilled" && foldersResponse.value) {
|
|
110317
110329
|
const foldersFromSearch = foldersResponse.value.results ?? [];
|
|
110318
|
-
|
|
110319
|
-
|
|
110320
|
-
|
|
110321
|
-
const filesCount = folderDetails?.files?.length ?? 0;
|
|
110322
|
-
const foldersCount = folderDetails?.folders?.length ?? 0;
|
|
110330
|
+
filteredFolders = foldersFromSearch.map((folder) => {
|
|
110331
|
+
const cached = state$2.folderCache[folder.id];
|
|
110332
|
+
if (cached) {
|
|
110323
110333
|
return {
|
|
110324
110334
|
...folder,
|
|
110325
110335
|
type: "folder",
|
|
110326
|
-
files_count:
|
|
110327
|
-
folders_count:
|
|
110336
|
+
files_count: cached.files_count,
|
|
110337
|
+
folders_count: cached.folders_count,
|
|
110338
|
+
available_files_count: cached.available_files_count,
|
|
110339
|
+
available_folders_count: cached.available_folders_count
|
|
110328
110340
|
};
|
|
110329
|
-
} catch (error) {
|
|
110330
|
-
console.error(`Failed to fetch details for folder ${folder.name}:`, error);
|
|
110331
|
-
return { ...folder, type: "folder" };
|
|
110332
110341
|
}
|
|
110342
|
+
return { ...folder, type: "folder" };
|
|
110333
110343
|
});
|
|
110334
|
-
filteredFolders = await Promise.all(folderDetailsPromises);
|
|
110335
110344
|
} else if (!hasMetadataFilters && !useAppStore$4().isLocalSearch.value) {
|
|
110336
110345
|
console.error(
|
|
110337
110346
|
"Failed to fetch folders:",
|