@uppy/provider-views
Advanced tools
Comparing version 4.0.0-beta.10 to 4.0.0-beta.11
# @uppy/provider-views | ||
## 4.0.0-beta.11 | ||
Released: 2024-07-02 | ||
Included in: Uppy v4.0.0-beta.14 | ||
- @uppy/provider-views: `afterFill()` - add loading progress (Evgenia Karunus / #5288) | ||
## 4.0.0-beta.10 | ||
@@ -4,0 +11,0 @@ |
@@ -44,3 +44,3 @@ import { h } from 'preact'; | ||
className: "uppy-Provider-loading" | ||
}, h("span", null, i18n('loading'))); | ||
}, typeof isLoading === 'string' ? isLoading : i18n('loading')); | ||
} | ||
@@ -47,0 +47,0 @@ if (displayedPartialTree.length === 0) { |
@@ -14,3 +14,3 @@ function _classPrivateFieldLooseBase(e, t) { if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance"); return e; } | ||
const packageJson = { | ||
"version": "4.0.0-beta.10" | ||
"version": "4.0.0-beta.11" | ||
}; | ||
@@ -264,3 +264,7 @@ import PartialTreeUtils from "../utils/PartialTreeUtils/index.js"; | ||
signal | ||
}), this.validateSingleFile); | ||
}), this.validateSingleFile, n => { | ||
this.setLoading(this.plugin.uppy.i18n('addedNumFiles', { | ||
numFiles: n | ||
})); | ||
}); | ||
@@ -267,0 +271,0 @@ // 2. Now that we know how many files there are - recheck aggregateRestrictions! |
@@ -10,3 +10,3 @@ import { h } from 'preact'; | ||
const packageJson = { | ||
"version": "4.0.0-beta.10" | ||
"version": "4.0.0-beta.11" | ||
}; | ||
@@ -13,0 +13,0 @@ import PartialTreeUtils from "../utils/PartialTreeUtils/index.js"; |
@@ -9,4 +9,4 @@ import type { PartialTree, PartialTreeId } from '@uppy/core/lib/Uppy'; | ||
} | ||
declare const afterFill: (partialTree: PartialTree, apiList: ApiList, validateSingleFile: (file: CompanionFile) => string | null) => Promise<PartialTree>; | ||
declare const afterFill: (partialTree: PartialTree, apiList: ApiList, validateSingleFile: (file: CompanionFile) => string | null, reportProgress: (n: number) => void) => Promise<PartialTree>; | ||
export default afterFill; | ||
//# sourceMappingURL=afterFill.d.ts.map |
@@ -42,3 +42,3 @@ /* eslint-disable no-param-reassign */ | ||
}; | ||
const afterFill = async (partialTree, apiList, validateSingleFile) => { | ||
const afterFill = async (partialTree, apiList, validateSingleFile, reportProgress) => { | ||
const queue = new PQueue({ | ||
@@ -53,6 +53,10 @@ concurrency: 6 | ||
item.cached === false || item.nextPagePath)); | ||
// per each poor folder, recursively fetch all files and make them .checked!!! | ||
// per each poor folder, recursively fetch all files and make them .checked! | ||
poorFolders.forEach(poorFolder => { | ||
queue.add(() => recursivelyFetch(queue, poorTree, poorFolder, apiList, validateSingleFile)); | ||
}); | ||
queue.on('completed', () => { | ||
const nOfFilesChecked = poorTree.filter(i => i.type === 'file' && i.status === 'checked').length; | ||
reportProgress(nOfFilesChecked); | ||
}); | ||
await queue.onIdle(); | ||
@@ -59,0 +63,0 @@ return poorTree; |
@@ -5,5 +5,5 @@ declare const _default: { | ||
afterToggleCheckbox: (oldTree: import("@uppy/core/lib/Uppy.ts").PartialTree, clickedRange: string[]) => import("@uppy/core/lib/Uppy.ts").PartialTree; | ||
afterFill: (partialTree: import("@uppy/core/lib/Uppy.ts").PartialTree, apiList: import("./afterFill.ts").ApiList, validateSingleFile: (file: import("@uppy/utils/lib/CompanionFile.ts").CompanionFile) => string | null) => Promise<import("@uppy/core/lib/Uppy.ts").PartialTree>; | ||
afterFill: (partialTree: import("@uppy/core/lib/Uppy.ts").PartialTree, apiList: import("./afterFill.ts").ApiList, validateSingleFile: (file: import("@uppy/utils/lib/CompanionFile.ts").CompanionFile) => string | null, reportProgress: (n: number) => void) => Promise<import("@uppy/core/lib/Uppy.ts").PartialTree>; | ||
}; | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@uppy/provider-views", | ||
"description": "View library for Uppy remote provider plugins.", | ||
"version": "4.0.0-beta.10", | ||
"version": "4.0.0-beta.11", | ||
"license": "MIT", | ||
@@ -32,5 +32,5 @@ "main": "lib/index.js", | ||
"peerDependencies": { | ||
"@uppy/core": "^4.0.0-beta.11" | ||
"@uppy/core": "^4.0.0-beta.12" | ||
}, | ||
"stableVersion": "3.11.0" | ||
} |
@@ -78,2 +78,3 @@ /* eslint-disable no-param-reassign */ | ||
validateSingleFile: (file: CompanionFile) => string | null, | ||
reportProgress: (n: number) => void, | ||
): Promise<PartialTree> => { | ||
@@ -91,3 +92,3 @@ const queue = new PQueue({ concurrency: 6 }) | ||
) as PartialTreeFolderNode[] | ||
// per each poor folder, recursively fetch all files and make them .checked!!! | ||
// per each poor folder, recursively fetch all files and make them .checked! | ||
poorFolders.forEach((poorFolder) => { | ||
@@ -105,2 +106,9 @@ queue.add(() => | ||
queue.on('completed', () => { | ||
const nOfFilesChecked = poorTree.filter( | ||
(i) => i.type === 'file' && i.status === 'checked', | ||
).length | ||
reportProgress(nOfFilesChecked) | ||
}) | ||
await queue.onIdle() | ||
@@ -107,0 +115,0 @@ |
@@ -82,3 +82,8 @@ /* eslint-disable no-underscore-dangle */ | ||
const mock = vi.fn() | ||
const enrichedTree = await afterFill(tree, mock, () => null) | ||
const enrichedTree = await afterFill( | ||
tree, | ||
mock, | ||
() => null, | ||
() => {}, | ||
) | ||
@@ -113,3 +118,8 @@ // While we're at it - make sure we're not doing excessive api calls! | ||
} | ||
const enrichedTree = await afterFill(tree, mock, () => null) | ||
const enrichedTree = await afterFill( | ||
tree, | ||
mock, | ||
() => null, | ||
() => {}, | ||
) | ||
@@ -142,3 +152,8 @@ const checkedFiles = enrichedTree.filter( | ||
} | ||
const enrichedTree = await afterFill(tree, mock, () => null) | ||
const enrichedTree = await afterFill( | ||
tree, | ||
mock, | ||
() => null, | ||
() => {}, | ||
) | ||
@@ -177,3 +192,8 @@ const checkedFiles = enrichedTree.filter( | ||
} | ||
const enrichedTree = await afterFill(tree, mock, () => null) | ||
const enrichedTree = await afterFill( | ||
tree, | ||
mock, | ||
() => null, | ||
() => {}, | ||
) | ||
@@ -240,3 +260,8 @@ const checkedFiles = enrichedTree.filter( | ||
} | ||
const enrichedTree = await afterFill(tree, mock, () => null) | ||
const enrichedTree = await afterFill( | ||
tree, | ||
mock, | ||
() => null, | ||
() => {}, | ||
) | ||
@@ -243,0 +268,0 @@ const checkedFiles = enrichedTree.filter( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
385895
5394