@scaleflex/widget-url 4.8.4 → 4.8.6
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/CHANGELOG.md +7674 -7657
- package/LICENSE +21 -21
- package/README.md +102 -102
- package/package.json +6 -6
- package/types/index.d.ts +17 -17
- package/lib/UrlUI.js +0 -123
- package/lib/UrlUI.styled.js +0 -30
- package/lib/defaultLocale.js +0 -16
- package/lib/index.js +0 -268
- package/lib/utils/forEachDroppedOrPastedUrl.js +0 -94
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 scaleflex
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 scaleflex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
# @scaleflex/widget-url
|
|
2
|
-
|
|
3
|
-
[![Plugins][plugins-image]](#plugins)
|
|
4
|
-
[![Website][filerobot-image]][sfx-url]
|
|
5
|
-
[![Version][filerobot-version]][version-url]
|
|
6
|
-
[![Scaleflex team][made-by-image]][sfx-url]
|
|
7
|
-
[![License][license-image]][license-url]
|
|
8
|
-
[![CodeSandbox][codeSandbox-image]][codeSandbox-url]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<div align='center'>
|
|
12
|
-
<img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://assets.scaleflex.com/Corporate+Branding/%5B2025%5D+ALL+LOGOS+%2B+ICONS/SCALEFLEX/VXP+logo/Horizontal+White/VXP+logo+WHITE.png?vh=663932" width="140"/>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
The Url plugin for [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core)
|
|
16
|
-
lets users import files from the Internet. Paste any URL and it’ll be added!
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
### NPM
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install --save @scaleflex/widget-url
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### YARN
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
yarn add @scaleflex/widget-url
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
then
|
|
33
|
-
|
|
34
|
-
```js
|
|
35
|
-
import Url from '@scaleflex/widget-url'
|
|
36
|
-
...
|
|
37
|
-
...
|
|
38
|
-
...
|
|
39
|
-
scaleflexWidget.use(Url, propertiesObject)
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### CDN
|
|
43
|
-
|
|
44
|
-
The plugin from CDN is found inside `Scaleflex` global object `Scaleflex.Url`
|
|
45
|
-
|
|
46
|
-
```js
|
|
47
|
-
const url = window.ScaleflexWidget.Url
|
|
48
|
-
...
|
|
49
|
-
...
|
|
50
|
-
...
|
|
51
|
-
scaleflexWidget.use(url, propertiesObject)
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Plugin's styles
|
|
55
|
-
|
|
56
|
-
```js
|
|
57
|
-
import '@scaleflex/widget-core/dist/style.css'
|
|
58
|
-
import '@scaleflex/widget-url/dist/style.css'
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
or if you prefer the minified version
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
import '@scaleflex/widget-core/dist/style.min.css'
|
|
65
|
-
import '@scaleflex/widget-url/dist/style.min.css'
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
> The plugin's css file should be imported after the [Core's css file](../@scaleflex/widget-core/#modules-styles) for having the styles shown correctly.
|
|
69
|
-
|
|
70
|
-
## Properties
|
|
71
|
-
|
|
72
|
-
### `title`
|
|
73
|
-
|
|
74
|
-
<u>Type:</u> `string`
|
|
75
|
-
|
|
76
|
-
<u>Default:</u> `'Link'`
|
|
77
|
-
|
|
78
|
-
The title/label that would be shown & used for the plugin.
|
|
79
|
-
|
|
80
|
-
### `companionHeaders`
|
|
81
|
-
|
|
82
|
-
<u>Type:</u> `null` | `object`
|
|
83
|
-
|
|
84
|
-
<u>Default:</u> `null`
|
|
85
|
-
|
|
86
|
-
If you need to pass additional headers for in companion requests then pass them in this property.
|
|
87
|
-
|
|
88
|
-
<!-- Variables -->
|
|
89
|
-
|
|
90
|
-
[npm-url]: https://www.npmjs.com/package/@scaleflex/widget-url
|
|
91
|
-
[license-url]: https://opensource.org/licenses/MIT
|
|
92
|
-
[sfx-url]: https://www.scaleflex.com/
|
|
93
|
-
[version-url]: https://www.npmjs.com/package/@scaleflex/widget-url
|
|
94
|
-
[codeSandbox-url]: https://codesandbox.io/p/sandbox/scalelfex-widget-v4-sandbox-dtp6l3?file=%2Fsrc%2Findex.js
|
|
95
|
-
|
|
96
|
-
[npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
|
|
97
|
-
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
|
|
98
|
-
[made-by-image]: https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg?style=for-the-badge
|
|
99
|
-
[plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
|
|
100
|
-
[filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
|
|
101
|
-
[filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-url?label=Version&style=for-the-badge&logo=npm
|
|
102
|
-
[codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
|
|
1
|
+
# @scaleflex/widget-url
|
|
2
|
+
|
|
3
|
+
[![Plugins][plugins-image]](#plugins)
|
|
4
|
+
[![Website][filerobot-image]][sfx-url]
|
|
5
|
+
[![Version][filerobot-version]][version-url]
|
|
6
|
+
[![Scaleflex team][made-by-image]][sfx-url]
|
|
7
|
+
[![License][license-image]][license-url]
|
|
8
|
+
[![CodeSandbox][codeSandbox-image]][codeSandbox-url]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<div align='center'>
|
|
12
|
+
<img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://assets.scaleflex.com/Corporate+Branding/%5B2025%5D+ALL+LOGOS+%2B+ICONS/SCALEFLEX/VXP+logo/Horizontal+White/VXP+logo+WHITE.png?vh=663932" width="140"/>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
The Url plugin for [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core)
|
|
16
|
+
lets users import files from the Internet. Paste any URL and it’ll be added!
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### NPM
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install --save @scaleflex/widget-url
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### YARN
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
yarn add @scaleflex/widget-url
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
then
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import Url from '@scaleflex/widget-url'
|
|
36
|
+
...
|
|
37
|
+
...
|
|
38
|
+
...
|
|
39
|
+
scaleflexWidget.use(Url, propertiesObject)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### CDN
|
|
43
|
+
|
|
44
|
+
The plugin from CDN is found inside `Scaleflex` global object `Scaleflex.Url`
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
const url = window.ScaleflexWidget.Url
|
|
48
|
+
...
|
|
49
|
+
...
|
|
50
|
+
...
|
|
51
|
+
scaleflexWidget.use(url, propertiesObject)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Plugin's styles
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
import '@scaleflex/widget-core/dist/style.css'
|
|
58
|
+
import '@scaleflex/widget-url/dist/style.css'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
or if you prefer the minified version
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
import '@scaleflex/widget-core/dist/style.min.css'
|
|
65
|
+
import '@scaleflex/widget-url/dist/style.min.css'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
> The plugin's css file should be imported after the [Core's css file](../@scaleflex/widget-core/#modules-styles) for having the styles shown correctly.
|
|
69
|
+
|
|
70
|
+
## Properties
|
|
71
|
+
|
|
72
|
+
### `title`
|
|
73
|
+
|
|
74
|
+
<u>Type:</u> `string`
|
|
75
|
+
|
|
76
|
+
<u>Default:</u> `'Link'`
|
|
77
|
+
|
|
78
|
+
The title/label that would be shown & used for the plugin.
|
|
79
|
+
|
|
80
|
+
### `companionHeaders`
|
|
81
|
+
|
|
82
|
+
<u>Type:</u> `null` | `object`
|
|
83
|
+
|
|
84
|
+
<u>Default:</u> `null`
|
|
85
|
+
|
|
86
|
+
If you need to pass additional headers for in companion requests then pass them in this property.
|
|
87
|
+
|
|
88
|
+
<!-- Variables -->
|
|
89
|
+
|
|
90
|
+
[npm-url]: https://www.npmjs.com/package/@scaleflex/widget-url
|
|
91
|
+
[license-url]: https://opensource.org/licenses/MIT
|
|
92
|
+
[sfx-url]: https://www.scaleflex.com/
|
|
93
|
+
[version-url]: https://www.npmjs.com/package/@scaleflex/widget-url
|
|
94
|
+
[codeSandbox-url]: https://codesandbox.io/p/sandbox/scalelfex-widget-v4-sandbox-dtp6l3?file=%2Fsrc%2Findex.js
|
|
95
|
+
|
|
96
|
+
[npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
|
|
97
|
+
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
|
|
98
|
+
[made-by-image]: https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg?style=for-the-badge
|
|
99
|
+
[plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
|
|
100
|
+
[filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
|
|
101
|
+
[filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-url?label=Version&style=for-the-badge&logo=npm
|
|
102
|
+
[codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/widget-url",
|
|
3
3
|
"description": "The Url plugin lets users import files from the Internet. Paste any URL and it’ll be added!",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.6",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"style": "dist/style.min.css",
|
|
8
8
|
"types": "types/index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@scaleflex/widget-common": "^4.8.
|
|
11
|
-
"@scaleflex/widget-companion-client": "^4.8.
|
|
12
|
-
"@scaleflex/widget-icons": "^4.8.
|
|
13
|
-
"@scaleflex/widget-utils": "^4.8.
|
|
10
|
+
"@scaleflex/widget-common": "^4.8.6",
|
|
11
|
+
"@scaleflex/widget-companion-client": "^4.8.6",
|
|
12
|
+
"@scaleflex/widget-icons": "^4.8.6",
|
|
13
|
+
"@scaleflex/widget-utils": "^4.8.6"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"react": "^19.0.0",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "cbb232cc92583c3888556df91ff90b4654e64790"
|
|
34
34
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import Filerobot = require("@scaleflex/widget-core");
|
|
2
|
-
import CompanionClient = require("@scaleflex/widget-companion-client");
|
|
3
|
-
import UrlLocale = require("./generatedLocale");
|
|
4
|
-
|
|
5
|
-
declare module Url {
|
|
6
|
-
export interface UrlOptions
|
|
7
|
-
extends Filerobot.PluginOptions,
|
|
8
|
-
CompanionClient.RequestClientOptions {
|
|
9
|
-
replaceTargetContent?: boolean;
|
|
10
|
-
target?: Filerobot.PluginTarget;
|
|
11
|
-
locale?: UrlLocale;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare class Url extends Filerobot.Plugin<Url.UrlOptions> {}
|
|
16
|
-
|
|
17
|
-
export = Url;
|
|
1
|
+
import Filerobot = require("@scaleflex/widget-core");
|
|
2
|
+
import CompanionClient = require("@scaleflex/widget-companion-client");
|
|
3
|
+
import UrlLocale = require("./generatedLocale");
|
|
4
|
+
|
|
5
|
+
declare module Url {
|
|
6
|
+
export interface UrlOptions
|
|
7
|
+
extends Filerobot.PluginOptions,
|
|
8
|
+
CompanionClient.RequestClientOptions {
|
|
9
|
+
replaceTargetContent?: boolean;
|
|
10
|
+
target?: Filerobot.PluginTarget;
|
|
11
|
+
locale?: UrlLocale;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare class Url extends Filerobot.Plugin<Url.UrlOptions> {}
|
|
16
|
+
|
|
17
|
+
export = Url;
|
package/lib/UrlUI.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
-
import { useState } from 'react';
|
|
8
|
-
import { useSelector } from 'react-redux';
|
|
9
|
-
import { Link } from '@scaleflex/icons';
|
|
10
|
-
import { selectInfo } from '@scaleflex/widget-core/lib/slices/info.slice';
|
|
11
|
-
import Styled from './UrlUI.styled';
|
|
12
|
-
import { selectCurrentFolderPath } from '@scaleflex/widget-explorer/lib/slices/folders.slice';
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
var HTTP_REGEX = /(http):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-/]))?/;
|
|
15
|
-
var DUPLICATE_MESSAGE = 'duplicate';
|
|
16
|
-
var UrlUI = function UrlUI(_ref) {
|
|
17
|
-
var addFile = _ref.addFile,
|
|
18
|
-
i18n = _ref.i18n,
|
|
19
|
-
fileName = _ref.fileName;
|
|
20
|
-
var currentFolderPath = useSelector(selectCurrentFolderPath);
|
|
21
|
-
var _useState = useState(false),
|
|
22
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
23
|
-
isLoading = _useState2[0],
|
|
24
|
-
setIsLoading = _useState2[1];
|
|
25
|
-
var _useState3 = useState(''),
|
|
26
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
27
|
-
inputValue = _useState4[0],
|
|
28
|
-
setInputValue = _useState4[1];
|
|
29
|
-
var _useState5 = useState(false),
|
|
30
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
31
|
-
isError = _useState6[0],
|
|
32
|
-
setIsError = _useState6[1];
|
|
33
|
-
var _useState7 = useState(false),
|
|
34
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
35
|
-
isNotHttps = _useState8[0],
|
|
36
|
-
setIsNotHttps = _useState8[1];
|
|
37
|
-
|
|
38
|
-
// TODO: we should improve the logic as it depends on the language?, better to trigger an event maybe? or some better solution.
|
|
39
|
-
var isFileExists = useSelector(function (state) {
|
|
40
|
-
return selectInfo(state).message.includes(DUPLICATE_MESSAGE);
|
|
41
|
-
});
|
|
42
|
-
var handleChangeInput = function handleChangeInput(event) {
|
|
43
|
-
setIsError(false);
|
|
44
|
-
setInputValue(event.target.value);
|
|
45
|
-
};
|
|
46
|
-
var handleError = function handleError() {
|
|
47
|
-
setIsError(true);
|
|
48
|
-
setIsLoading(false);
|
|
49
|
-
};
|
|
50
|
-
var handleSubmit = function handleSubmit() {
|
|
51
|
-
if (inputValue.match(HTTP_REGEX)) {
|
|
52
|
-
setIsNotHttps(true);
|
|
53
|
-
setIsError(true);
|
|
54
|
-
} else {
|
|
55
|
-
setIsLoading(true);
|
|
56
|
-
setIsError(false);
|
|
57
|
-
addFile({
|
|
58
|
-
url: inputValue,
|
|
59
|
-
toFolder: currentFolderPath,
|
|
60
|
-
callback: function callback() {
|
|
61
|
-
return setIsLoading(false);
|
|
62
|
-
},
|
|
63
|
-
onError: handleError
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var handleKeyPress = function handleKeyPress(event) {
|
|
68
|
-
if (event.keyCode === 13 && inputValue.length) {
|
|
69
|
-
handleSubmit();
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var errorMessage = function errorMessage() {
|
|
73
|
-
if (isNotHttps && isError) {
|
|
74
|
-
return i18n('urlUiInputErrorHttpsRequired');
|
|
75
|
-
}
|
|
76
|
-
if (isFileExists && isError) {
|
|
77
|
-
return i18n('urlUiInputExistsError', {
|
|
78
|
-
fileName: fileName(inputValue)
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (isError) {
|
|
82
|
-
return i18n('urlUiInputError');
|
|
83
|
-
}
|
|
84
|
-
return '';
|
|
85
|
-
};
|
|
86
|
-
return /*#__PURE__*/_jsx(Styled.Wrapper, {
|
|
87
|
-
className: "filerobot-Url",
|
|
88
|
-
children: /*#__PURE__*/_jsxs(Styled.Content, {
|
|
89
|
-
className: "filerobot-Url-content",
|
|
90
|
-
children: [/*#__PURE__*/_jsx(Styled.IconWrapper, {
|
|
91
|
-
children: /*#__PURE__*/_jsx(Link, {
|
|
92
|
-
size: 34
|
|
93
|
-
})
|
|
94
|
-
}), /*#__PURE__*/_jsxs(Styled.Info, {
|
|
95
|
-
children: [i18n('urlUiEnterPublicUrlText'), ' ', /*#__PURE__*/_jsxs(Styled.Hint, {
|
|
96
|
-
className: "filerobot-Url-required",
|
|
97
|
-
children: ["(", i18n('urlUiHttpsRequiredText'), ")"]
|
|
98
|
-
})]
|
|
99
|
-
}), /*#__PURE__*/_jsxs(Styled.InputWrapper, {
|
|
100
|
-
children: [/*#__PURE__*/_jsx(Styled.InputGroup, {
|
|
101
|
-
className: "filerobot-Url-input",
|
|
102
|
-
placeholder: i18n('urlUiInputPlaceholder'),
|
|
103
|
-
focusOnMount: true,
|
|
104
|
-
onKeyUp: handleKeyPress,
|
|
105
|
-
onChange: handleChangeInput,
|
|
106
|
-
fullWidth: true,
|
|
107
|
-
value: inputValue,
|
|
108
|
-
error: isError,
|
|
109
|
-
hint: errorMessage()
|
|
110
|
-
}), /*#__PURE__*/_jsx(Styled.Button, {
|
|
111
|
-
className: "filerobot-Url-actionsBtn",
|
|
112
|
-
disabled: isLoading || !inputValue.length,
|
|
113
|
-
onClick: handleSubmit,
|
|
114
|
-
loading: isLoading,
|
|
115
|
-
size: "lg",
|
|
116
|
-
color: "primary",
|
|
117
|
-
children: i18n('mutualizedImportLabel')
|
|
118
|
-
})]
|
|
119
|
-
})]
|
|
120
|
-
})
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
export default UrlUI;
|
package/lib/UrlUI.styled.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
2
|
-
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
3
|
-
import { PC } from '@scaleflex/widget-common';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import { InputGroup as SfxInputGroup, Button as SfxButton } from '@scaleflex/ui/core';
|
|
6
|
-
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n height: 100%;\n flex: 1;\n padding: 0 24px;\n"])));
|
|
7
|
-
var Content = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n row-gap: 16px;\n"])));
|
|
8
|
-
var IconWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 80px;\n height: 80px;\n border-radius: 50%;\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n"])), function (_ref) {
|
|
9
|
-
var theme = _ref.theme;
|
|
10
|
-
return theme.palette[PC.Link];
|
|
11
|
-
}, function (_ref2) {
|
|
12
|
-
var theme = _ref2.theme;
|
|
13
|
-
return theme.palette[PC.ButtonPrimaryText];
|
|
14
|
-
});
|
|
15
|
-
var Info = styled.p(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n font-size: 18px;\n line-height: 20px;\n text-align: center;\n font-weight: 400;\n margin: 0;\n"])));
|
|
16
|
-
var Hint = styled.span(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n\n"])));
|
|
17
|
-
var InputWrapper = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n column-gap: 12px;\n height: 48px;\n width: 100%;\n max-width: 714px;\n\n .SfxInputGroup-root {\n width: 100%;\n height: 100%;\n }\n"])));
|
|
18
|
-
var InputGroup = styled(SfxInputGroup)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n height: 100%;\n width: 100%;\n padding: 11px 20px;\n"])));
|
|
19
|
-
var Button = styled(SfxButton)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: 102px;\n display: flex;\n justify-content: center;\n transition: all 100ms ease-out;\n"])));
|
|
20
|
-
var Styled = {
|
|
21
|
-
Wrapper: Wrapper,
|
|
22
|
-
Content: Content,
|
|
23
|
-
IconWrapper: IconWrapper,
|
|
24
|
-
Info: Info,
|
|
25
|
-
Hint: Hint,
|
|
26
|
-
InputWrapper: InputWrapper,
|
|
27
|
-
InputGroup: InputGroup,
|
|
28
|
-
Button: Button
|
|
29
|
-
};
|
|
30
|
-
export default Styled;
|
package/lib/defaultLocale.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
mutualizedImportLabel: 'Import',
|
|
3
|
-
urlUiImportingLabel: 'Importing...',
|
|
4
|
-
mutualizedCancelButtonLabel: 'Cancel',
|
|
5
|
-
urlUiEnterUrlToImportLabel: 'Enter URL to import a file',
|
|
6
|
-
urlUiInputPlaceholder: 'eg. https://sample-site.com/path-to-file',
|
|
7
|
-
urlUiInputError: 'Incorrect URL!',
|
|
8
|
-
urlUiInputExistsError: 'the %{fileName} already exists',
|
|
9
|
-
urlUiInputErrorHttpsRequired: 'Incorrect URL, https required',
|
|
10
|
-
addFileFailedToFetchMessage: 'Companion failed to fetch this URL, please make sure it’s correct',
|
|
11
|
-
addFileEnterCorrectUrlInfo: 'Incorrect URL: Please make sure you are entering a direct link to a file',
|
|
12
|
-
urlUiEnterPublicUrlText: 'Enter public URL of file to upload',
|
|
13
|
-
urlUiHttpsRequiredText: 'https required',
|
|
14
|
-
addFileImportingCancelledInfo: 'Importing request has just cancelled.',
|
|
15
|
-
addFileNoPendingImportsToCancelInfo: 'No import requests were found to cancel.'
|
|
16
|
-
};
|