@uppy/provider-views
Advanced tools
Comparing version 3.0.0-beta.2 to 3.0.0-beta.3
# @uppy/provider-views | ||
## 3.0.0-beta.3 | ||
Released: 2022-08-16 | ||
Included in: Uppy v3.0.0-beta.5 | ||
- @uppy/provider-views: Reset filter input correctly in provider views (Merlijn Vos / #3978) | ||
- @uppy/provider-views: core validateRestrictions: return error directly vs the result/reason obj (Artur Paikin / #3951) | ||
## 2.1.2 | ||
@@ -4,0 +12,0 @@ |
@@ -79,3 +79,3 @@ import { h } from 'preact'; | ||
}), files.map(file => { | ||
const validated = validateRestrictions(remoteFileObjToLocal(file), [...uppyFiles, ...currentSelection]); | ||
const restrictionError = validateRestrictions(remoteFileObjToLocal(file), [...uppyFiles, ...currentSelection]); | ||
return Item({ | ||
@@ -94,4 +94,4 @@ id: file.id, | ||
type: 'file', | ||
isDisabled: !validated.result && !isChecked(file), | ||
restrictionReason: validated.reason | ||
isDisabled: restrictionError && !isChecked(file), | ||
restrictionError | ||
}); | ||
@@ -98,0 +98,0 @@ }))); |
@@ -7,3 +7,3 @@ import { h } from 'preact'; | ||
isDisabled, | ||
restrictionReason, | ||
restrictionError, | ||
isChecked, | ||
@@ -20,3 +20,3 @@ title, | ||
className: className, | ||
title: isDisabled ? restrictionReason : null | ||
title: isDisabled ? restrictionError == null ? void 0 : restrictionError.message : null | ||
}, h("input", { | ||
@@ -23,0 +23,0 @@ type: "checkbox", |
@@ -12,3 +12,3 @@ import { h } from 'preact'; // if folder: | ||
isDisabled, | ||
restrictionReason, | ||
restrictionError, | ||
isCheckboxDisabled, | ||
@@ -28,3 +28,3 @@ isChecked, | ||
className: className, | ||
title: isDisabled ? restrictionReason : null | ||
title: isDisabled ? restrictionError == null ? void 0 : restrictionError.message : null | ||
}, !isCheckboxDisabled ? h("input", { | ||
@@ -31,0 +31,0 @@ type: "checkbox", |
@@ -1,2 +0,2 @@ | ||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
@@ -3,0 +3,0 @@ import { h } from 'preact'; |
@@ -15,3 +15,3 @@ function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
const packageJson = { | ||
"version": "3.0.0-beta.2" | ||
"version": "3.0.0-beta.3" | ||
}; | ||
@@ -123,3 +123,4 @@ | ||
this.plugin.setPluginState({ | ||
directories: updatedDirectories | ||
directories: updatedDirectories, | ||
filterInput: '' | ||
}); | ||
@@ -159,3 +160,4 @@ }, this.handleError); | ||
folders: [], | ||
directories: [] | ||
directories: [], | ||
filterInput: '' | ||
}; | ||
@@ -223,3 +225,4 @@ this.plugin.setPluginState(newState); | ||
this.plugin.setPluginState({ | ||
selectedFolders: folders | ||
selectedFolders: folders, | ||
filterInput: '' | ||
}); | ||
@@ -226,0 +229,0 @@ let message; |
@@ -15,3 +15,3 @@ function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
const packageJson = { | ||
"version": "3.0.0-beta.2" | ||
"version": "3.0.0-beta.3" | ||
}; | ||
@@ -18,0 +18,0 @@ /** |
@@ -58,9 +58,9 @@ import remoteFileObjToLocal from '@uppy/utils/lib/remoteFileObjToLocal'; | ||
} = this.plugin; | ||
const validatedRestrictions = uppy.validateRestrictions(remoteFileObjToLocal(item), [...uppy.getFiles(), ...reducedCurrentSelection]); | ||
const restrictionError = uppy.validateRestrictions(remoteFileObjToLocal(item), [...uppy.getFiles(), ...reducedCurrentSelection]); | ||
if (validatedRestrictions.result) { | ||
if (!restrictionError) { | ||
reducedCurrentSelection.push(item); | ||
} else { | ||
uppy.info({ | ||
message: validatedRestrictions.reason | ||
message: restrictionError.message | ||
}, 'error', uppy.opts.infoTimeout); | ||
@@ -67,0 +67,0 @@ } |
@@ -49,3 +49,4 @@ import getFileType from '@uppy/utils/lib/getFileType'; | ||
this.plugin.setPluginState({ | ||
currentSelection: [] | ||
currentSelection: [], | ||
filterInput: '' | ||
}); | ||
@@ -52,0 +53,0 @@ } |
{ | ||
"name": "@uppy/provider-views", | ||
"description": "View library for Uppy remote provider plugins.", | ||
"version": "3.0.0-beta.2", | ||
"version": "3.0.0-beta.3", | ||
"license": "MIT", | ||
@@ -23,3 +23,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/utils": "^5.0.0-beta", | ||
"@uppy/utils": "^5.0.0-beta.1", | ||
"classnames": "^2.2.6", | ||
@@ -29,5 +29,4 @@ "preact": "^10.5.13" | ||
"peerDependencies": { | ||
"@uppy/core": "^3.0.0-beta.1" | ||
}, | ||
"stableVersion": "2.1.1" | ||
"@uppy/core": "^3.0.0-beta.4" | ||
} | ||
} |
@@ -104,3 +104,3 @@ import { h } from 'preact' | ||
{files.map((file) => { | ||
const validated = validateRestrictions( | ||
const restrictionError = validateRestrictions( | ||
remoteFileObjToLocal(file), | ||
@@ -123,4 +123,4 @@ [...uppyFiles, ...currentSelection], | ||
type: 'file', | ||
isDisabled: !validated.result && !isChecked(file), | ||
restrictionReason: validated.reason, | ||
isDisabled: restrictionError && !isChecked(file), | ||
restrictionError, | ||
}) | ||
@@ -127,0 +127,0 @@ })} |
@@ -7,3 +7,3 @@ import { h } from 'preact' | ||
isDisabled, | ||
restrictionReason, | ||
restrictionError, | ||
isChecked, | ||
@@ -22,3 +22,3 @@ title, | ||
className={className} | ||
title={isDisabled ? restrictionReason : null} | ||
title={isDisabled ? restrictionError?.message : null} | ||
> | ||
@@ -25,0 +25,0 @@ <input |
@@ -14,3 +14,3 @@ import { h } from 'preact' | ||
isDisabled, | ||
restrictionReason, | ||
restrictionError, | ||
isCheckboxDisabled, | ||
@@ -32,3 +32,3 @@ isChecked, | ||
className={className} | ||
title={isDisabled ? restrictionReason : null} | ||
title={isDisabled ? restrictionError?.message : null} | ||
> | ||
@@ -35,0 +35,0 @@ {!isCheckboxDisabled ? ( |
@@ -122,3 +122,3 @@ import { h } from 'preact' | ||
this.#updateFilesAndFolders(res, files, folders) | ||
this.plugin.setPluginState({ directories: updatedDirectories }) | ||
this.plugin.setPluginState({ directories: updatedDirectories, filterInput: '' }) | ||
}, | ||
@@ -159,2 +159,3 @@ this.handleError, | ||
directories: [], | ||
filterInput: '', | ||
} | ||
@@ -214,3 +215,3 @@ this.plugin.setPluginState(newState) | ||
} | ||
this.plugin.setPluginState({ selectedFolders: folders }) | ||
this.plugin.setPluginState({ selectedFolders: folders, filterInput: '' }) | ||
@@ -217,0 +218,0 @@ let message |
@@ -54,10 +54,11 @@ import remoteFileObjToLocal from '@uppy/utils/lib/remoteFileObjToLocal' | ||
const { uppy } = this.plugin | ||
const validatedRestrictions = uppy.validateRestrictions( | ||
const restrictionError = uppy.validateRestrictions( | ||
remoteFileObjToLocal(item), | ||
[...uppy.getFiles(), ...reducedCurrentSelection], | ||
) | ||
if (validatedRestrictions.result) { | ||
if (!restrictionError) { | ||
reducedCurrentSelection.push(item) | ||
} else { | ||
uppy.info({ message: validatedRestrictions.reason }, 'error', uppy.opts.infoTimeout) | ||
uppy.info({ message: restrictionError.message }, 'error', uppy.opts.infoTimeout) | ||
} | ||
@@ -64,0 +65,0 @@ } |
@@ -47,3 +47,3 @@ import getFileType from '@uppy/utils/lib/getFileType' | ||
clearSelection () { | ||
this.plugin.setPluginState({ currentSelection: [] }) | ||
this.plugin.setPluginState({ currentSelection: [], filterInput: '' }) | ||
} | ||
@@ -50,0 +50,0 @@ |
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
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
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
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
240514
3498
Updated@uppy/utils@^5.0.0-beta.1