@uppy/provider-views
Advanced tools
Comparing version 2.0.6 to 2.0.7
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -4,0 +2,0 @@ h, |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -4,0 +2,0 @@ h |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -4,0 +2,0 @@ Component, |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -23,5 +21,5 @@ h, | ||
return h("div", { | ||
className: "uppy-ProviderBrowser-search" | ||
className: "uppy-ProviderBrowser-filter" | ||
}, h("input", { | ||
className: "uppy-u-reset uppy-ProviderBrowser-searchInput", | ||
className: "uppy-u-reset uppy-ProviderBrowser-filterInput", | ||
type: "text", | ||
@@ -38,3 +36,3 @@ placeholder: this.props.i18n('filter'), | ||
focusable: "false", | ||
className: "uppy-c-icon uppy-ProviderBrowser-searchIcon", | ||
className: "uppy-c-icon uppy-ProviderBrowser-filterIcon", | ||
width: "12", | ||
@@ -46,3 +44,3 @@ height: "12", | ||
})), this.props.filterInput && h("button", { | ||
className: "uppy-u-reset uppy-ProviderBrowser-searchClose", | ||
className: "uppy-u-reset uppy-ProviderBrowser-filterClose", | ||
type: "button", | ||
@@ -49,0 +47,0 @@ "aria-label": this.props.i18n('resetFilter'), |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -4,0 +2,0 @@ h |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const ProviderViews = require('./ProviderView'); | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -4,0 +2,0 @@ h |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -4,0 +2,0 @@ h |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -4,0 +2,0 @@ h |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
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); } | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -4,0 +2,0 @@ h |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -4,0 +2,0 @@ h |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const User = require('./User'); | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
module.exports = require('./ProviderView'); |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
var _class, _updateFilesAndFolders, _isOriginAllowed, _temp; | ||
@@ -243,3 +241,4 @@ | ||
handleAuth() { | ||
async handleAuth() { | ||
await this.provider.ensurePreAuth(); | ||
const authState = btoa(JSON.stringify({ | ||
@@ -452,3 +451,3 @@ origin: getOrigin() | ||
}), _class.VERSION = "2.0.6", _temp); | ||
}), _class.VERSION = "2.0.7", _temp); | ||
@@ -455,0 +454,0 @@ function _updateFilesAndFolders2(res, files, folders) { |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -4,0 +2,0 @@ h |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -7,8 +5,39 @@ h | ||
const SUBMIT_KEY = 13; | ||
module.exports = props => { | ||
return h("button", { | ||
type: "button", | ||
onClick: props.triggerSearchInput, | ||
className: "uppy-u-reset uppy-ProviderBrowser-userLogout" | ||
}, props.i18n('backToSearch')); | ||
const { | ||
searchTerm, | ||
i18n, | ||
search | ||
} = props; | ||
const handleKeyPress = ev => { | ||
if (ev.keyCode === SUBMIT_KEY) { | ||
ev.stopPropagation(); | ||
ev.preventDefault(); | ||
search(ev.target.value); | ||
} | ||
}; | ||
return h("div", { | ||
class: "uppy-ProviderBrowser-search" | ||
}, h("input", { | ||
class: "uppy-u-reset uppy-ProviderBrowser-searchInput", | ||
type: "text", | ||
placeholder: i18n('search'), | ||
"aria-label": i18n('search'), | ||
value: searchTerm, | ||
onKeyUp: handleKeyPress, | ||
"data-uppy-super-focusable": true | ||
}), h("svg", { | ||
"aria-hidden": "true", | ||
focusable: "false", | ||
class: "uppy-c-icon uppy-ProviderBrowser-searchIcon", | ||
width: "12", | ||
height: "12", | ||
viewBox: "0 0 12 12" | ||
}, h("path", { | ||
d: "M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z" | ||
}))); | ||
}; |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
module.exports = require('./SearchProviderView'); |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const { | ||
@@ -26,3 +24,3 @@ h | ||
className: "uppy-u-reset uppy-c-textInput uppy-SearchProvider-input", | ||
type: "text", | ||
type: "search", | ||
"aria-label": props.i18n('enterTextToSearch'), | ||
@@ -29,0 +27,0 @@ placeholder: props.i18n('enterTextToSearch'), |
@@ -1,5 +0,3 @@ | ||
"use strict"; | ||
var _class, _updateFilesAndInputMode, _temp; | ||
var _class, _searchTerm, _updateFilesAndInputMode, _temp; | ||
function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
@@ -31,3 +29,3 @@ | ||
module.exports = (_temp = (_searchTerm = /*#__PURE__*/_classPrivateFieldLooseKey("searchTerm"), _updateFilesAndInputMode = /*#__PURE__*/_classPrivateFieldLooseKey("updateFilesAndInputMode"), _class = class SearchProviderView extends View { | ||
module.exports = (_temp = (_updateFilesAndInputMode = /*#__PURE__*/_classPrivateFieldLooseKey("updateFilesAndInputMode"), _class = class SearchProviderView extends View { | ||
/** | ||
@@ -43,6 +41,2 @@ * @param {object} plugin instance of the plugin | ||
}); | ||
Object.defineProperty(this, _searchTerm, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
const defaultOptions = { | ||
@@ -73,4 +67,4 @@ viewType: 'grid', | ||
filterInput: '', | ||
isSearchVisible: false, | ||
currentSelection: [] | ||
currentSelection: [], | ||
searchTerm: null | ||
}); | ||
@@ -82,8 +76,18 @@ } | ||
clearSelection() { | ||
this.plugin.setPluginState({ | ||
currentSelection: [], | ||
isInputMode: true, | ||
files: [], | ||
searchTerm: null | ||
}); | ||
} | ||
search(query) { | ||
if (query && query === _classPrivateFieldLooseBase(this, _searchTerm)[_searchTerm]) { | ||
const { | ||
searchTerm | ||
} = this.plugin.getPluginState(); | ||
if (query && query === searchTerm) { | ||
// no need to search again as this is the same as the previous search | ||
this.plugin.setPluginState({ | ||
isInputMode: false | ||
}); | ||
return; | ||
@@ -110,6 +114,7 @@ } | ||
try { | ||
const response = await this.provider.search(_classPrivateFieldLooseBase(this, _searchTerm)[_searchTerm], query); | ||
const { | ||
files | ||
files, | ||
searchTerm | ||
} = this.plugin.getPluginState(); | ||
const response = await this.provider.search(searchTerm, query); | ||
@@ -144,3 +149,4 @@ _classPrivateFieldLooseBase(this, _updateFilesAndInputMode)[_updateFilesAndInputMode](response, files); | ||
didFirstRender, | ||
isInputMode | ||
isInputMode, | ||
searchTerm | ||
} = this.plugin.getPluginState(); | ||
@@ -178,4 +184,5 @@ | ||
headerComponent: Header({ | ||
triggerSearchInput: this.triggerSearchInput, | ||
i18n: this.plugin.uppy.i18n | ||
search: this.search, | ||
i18n: this.plugin.uppy.i18n, | ||
searchTerm | ||
}), | ||
@@ -217,7 +224,6 @@ title: this.plugin.title, | ||
}), _class.VERSION = "2.0.6", _temp); | ||
}), _class.VERSION = "2.0.7", _temp); | ||
function _updateFilesAndInputMode2(res, files) { | ||
this.nextPageQuery = res.nextPageQuery; | ||
_classPrivateFieldLooseBase(this, _searchTerm)[_searchTerm] = res.searchedFor; | ||
res.items.forEach(item => { | ||
@@ -228,4 +234,5 @@ files.push(item); | ||
isInputMode: false, | ||
files | ||
files, | ||
searchTerm: res.searchedFor | ||
}); | ||
} |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const remoteFileObjToLocal = require('@uppy/utils/lib/remoteFileObjToLocal'); | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
"use strict"; | ||
const getFileType = require('@uppy/utils/lib/getFileType'); | ||
@@ -114,3 +112,4 @@ | ||
if (file.author) { | ||
tagFile.meta.author = file.author; | ||
if (file.author.name != null) tagFile.meta.authorName = String(file.author.name); | ||
if (file.author.url) tagFile.meta.authorUrl = file.author.url; | ||
} | ||
@@ -117,0 +116,0 @@ |
{ | ||
"name": "@uppy/provider-views", | ||
"description": "View library for Uppy remote provider plugins.", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"license": "MIT", | ||
@@ -22,3 +22,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/utils": "^4.0.4", | ||
"@uppy/utils": "^4.0.5", | ||
"classnames": "^2.2.6", | ||
@@ -28,4 +28,4 @@ "preact": "^10.5.13" | ||
"peerDependencies": { | ||
"@uppy/core": "^2.1.3" | ||
"@uppy/core": "^2.1.5" | ||
} | ||
} |
@@ -18,5 +18,5 @@ const { h, Component } = require('preact') | ||
return ( | ||
<div className="uppy-ProviderBrowser-search"> | ||
<div className="uppy-ProviderBrowser-filter"> | ||
<input | ||
className="uppy-u-reset uppy-ProviderBrowser-searchInput" | ||
className="uppy-u-reset uppy-ProviderBrowser-filterInput" | ||
type="text" | ||
@@ -31,3 +31,3 @@ placeholder={this.props.i18n('filter')} | ||
/> | ||
<svg aria-hidden="true" focusable="false" className="uppy-c-icon uppy-ProviderBrowser-searchIcon" width="12" height="12" viewBox="0 0 12 12"> | ||
<svg aria-hidden="true" focusable="false" className="uppy-c-icon uppy-ProviderBrowser-filterIcon" width="12" height="12" viewBox="0 0 12 12"> | ||
<path d="M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z" /> | ||
@@ -37,3 +37,3 @@ </svg> | ||
<button | ||
className="uppy-u-reset uppy-ProviderBrowser-searchClose" | ||
className="uppy-u-reset uppy-ProviderBrowser-filterClose" | ||
type="button" | ||
@@ -40,0 +40,0 @@ aria-label={this.props.i18n('resetFilter')} |
@@ -221,3 +221,5 @@ const { h } = require('preact') | ||
handleAuth () { | ||
async handleAuth () { | ||
await this.provider.ensurePreAuth() | ||
const authState = btoa(JSON.stringify({ origin: getOrigin() })) | ||
@@ -224,0 +226,0 @@ const clientVersion = `@uppy/provider-views=${ProviderView.VERSION}` |
const { h } = require('preact') | ||
const SUBMIT_KEY = 13 | ||
module.exports = (props) => { | ||
const { searchTerm, i18n, search } = props | ||
const handleKeyPress = (ev) => { | ||
if (ev.keyCode === SUBMIT_KEY) { | ||
ev.stopPropagation() | ||
ev.preventDefault() | ||
search(ev.target.value) | ||
} | ||
} | ||
return ( | ||
<button type="button" onClick={props.triggerSearchInput} className="uppy-u-reset uppy-ProviderBrowser-userLogout"> | ||
{props.i18n('backToSearch')} | ||
</button> | ||
<div class="uppy-ProviderBrowser-search"> | ||
<input | ||
class="uppy-u-reset uppy-ProviderBrowser-searchInput" | ||
type="text" | ||
placeholder={i18n('search')} | ||
aria-label={i18n('search')} | ||
value={searchTerm} | ||
onKeyUp={handleKeyPress} | ||
data-uppy-super-focusable | ||
/> | ||
<svg aria-hidden="true" focusable="false" class="uppy-c-icon uppy-ProviderBrowser-searchIcon" width="12" height="12" viewBox="0 0 12 12"> | ||
<path d="M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z" /> | ||
</svg> | ||
</div> | ||
) | ||
} |
@@ -21,3 +21,3 @@ const { h } = require('preact') | ||
className="uppy-u-reset uppy-c-textInput uppy-SearchProvider-input" | ||
type="text" | ||
type="search" | ||
aria-label={props.i18n('enterTextToSearch')} | ||
@@ -24,0 +24,0 @@ placeholder={props.i18n('enterTextToSearch')} |
@@ -15,4 +15,2 @@ const { h } = require('preact') | ||
#searchTerm | ||
/** | ||
@@ -53,4 +51,4 @@ * @param {object} plugin instance of the plugin | ||
filterInput: '', | ||
isSearchVisible: false, | ||
currentSelection: [], | ||
searchTerm: null, | ||
}) | ||
@@ -63,13 +61,25 @@ } | ||
clearSelection () { | ||
this.plugin.setPluginState({ | ||
currentSelection: [], | ||
isInputMode: true, | ||
files: [], | ||
searchTerm: null, | ||
}) | ||
} | ||
#updateFilesAndInputMode (res, files) { | ||
this.nextPageQuery = res.nextPageQuery | ||
this.#searchTerm = res.searchedFor | ||
res.items.forEach((item) => { files.push(item) }) | ||
this.plugin.setPluginState({ isInputMode: false, files }) | ||
this.plugin.setPluginState({ | ||
isInputMode: false, | ||
files, | ||
searchTerm: res.searchedFor, | ||
}) | ||
} | ||
search (query) { | ||
if (query && query === this.#searchTerm) { | ||
const { searchTerm } = this.plugin.getPluginState() | ||
if (query && query === searchTerm) { | ||
// no need to search again as this is the same as the previous search | ||
this.plugin.setPluginState({ isInputMode: false }) | ||
return | ||
@@ -98,4 +108,4 @@ } | ||
try { | ||
const response = await this.provider.search(this.#searchTerm, query) | ||
const { files } = this.plugin.getPluginState() | ||
const { files, searchTerm } = this.plugin.getPluginState() | ||
const response = await this.provider.search(searchTerm, query) | ||
@@ -121,3 +131,3 @@ this.#updateFilesAndInputMode(response, files) | ||
render (state, viewOptions = {}) { | ||
const { didFirstRender, isInputMode } = this.plugin.getPluginState() | ||
const { didFirstRender, isInputMode, searchTerm } = this.plugin.getPluginState() | ||
@@ -143,4 +153,5 @@ if (!didFirstRender) { | ||
headerComponent: Header({ | ||
triggerSearchInput: this.triggerSearchInput, | ||
search: this.search, | ||
i18n: this.plugin.uppy.i18n, | ||
searchTerm, | ||
}), | ||
@@ -147,0 +158,0 @@ title: this.plugin.title, |
@@ -104,3 +104,4 @@ const getFileType = require('@uppy/utils/lib/getFileType') | ||
if (file.author) { | ||
tagFile.meta.author = file.author | ||
if (file.author.name != null) tagFile.meta.authorName = String(file.author.name) | ||
if (file.author.url) tagFile.meta.authorUrl = file.author.url | ||
} | ||
@@ -107,0 +108,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
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
242325
78
3495
Updated@uppy/utils@^4.0.5