@scaleflex/widget-core 0.2.1 → 4.0.0
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 +48 -26
- package/README.md +19 -14
- package/dist/style.css +3 -0
- package/dist/style.min.css +1 -1
- package/lib/_common.scss +4 -0
- package/lib/index.js +14 -14
- package/lib/slices/uploads.slice.js +4 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,42 +3,64 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @scaleflex/widget-core
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [0.2.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.1.2...v0.2.0) (2025-08-05)
|
|
6
|
+
# [4.0.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.3.0...v4.0.0) (2025-08-26)
|
|
15
7
|
|
|
16
8
|
|
|
17
9
|
### Features
|
|
18
10
|
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## [0.1.2](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.1.1...v0.1.2) (2025-07-30)
|
|
26
|
-
|
|
27
|
-
**Note:** Version bump only for package @scaleflex/widget-core
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## [0.1.1](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.1.0...v0.1.1) (2025-07-28)
|
|
34
|
-
|
|
35
|
-
**Note:** Version bump only for package @scaleflex/widget-core
|
|
11
|
+
* add box-sizing rule for #SfxPopper to ensure consistent layout ([95926e8](https://code.scaleflex.cloud/scaleflex/widget/commits/95926e8e9543eea1d633b284b0d65ae8492fc096))
|
|
12
|
+
* update import statements and CDN links for Scaleflex widgets, enhance sandbox functionality, and improve documentation clarity ([6322d8f](https://code.scaleflex.cloud/scaleflex/widget/commits/6322d8f0a1622955f551fa66e38c3a31cc290736))
|
|
36
13
|
|
|
37
14
|
|
|
38
15
|
|
|
39
16
|
|
|
40
17
|
|
|
41
18
|
|
|
19
|
+
# [0.3.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.2.1...v0.3.0) (2025-08-12)
|
|
20
|
+
|
|
21
|
+
**Note:** Version bump only for package @scaleflex/widget-core
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [0.2.1](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.2.0...v0.2.1) (2025-08-06)
|
|
29
|
+
|
|
30
|
+
**Note:** Version bump only for package @scaleflex/widget-core
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# [0.2.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.1.2...v0.2.0) (2025-08-05)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
* implement the recursive remote upload for 3rd parties [FRA-1343] ([4db5cba](https://code.scaleflex.cloud/scaleflex/widget/commits/4db5cba125d155b1d1ab6cdbc68c28ae07d78f4c))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## [0.1.2](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.1.1...v0.1.2) (2025-07-30)
|
|
48
|
+
|
|
49
|
+
**Note:** Version bump only for package @scaleflex/widget-core
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## [0.1.1](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.1.0...v0.1.1) (2025-07-28)
|
|
56
|
+
|
|
57
|
+
**Note:** Version bump only for package @scaleflex/widget-core
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
42
64
|
# [0.1.0](https://code.scaleflex.cloud/scaleflex/widget/compare/v0.0.5...v0.1.0) (2025-07-23)
|
|
43
65
|
|
|
44
66
|
**Note:** Version bump only for package @scaleflex/widget-core
|
package/README.md
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
# Scaleflex Media Asset Widget (
|
|
1
|
+
# Scaleflex Media Asset Widget (SMAW)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
> This is the successor of [Filerobot Media Asset Widget (FMAW) - V3](https://www.npmjs.com/package/@filerobot/core).
|
|
5
|
+
|
|
2
6
|
|
|
3
7
|
> This package contains both the main/global readme for the whole widget and the readme for [@scaleflex/widget-core](#scaleflexwidget-core) plugin itself.
|
|
4
8
|
|
|
9
|
+
|
|
5
10
|
[![Plugins][plugins-image]](#plugins)
|
|
6
11
|
[![Website][filerobot-image]][sfx-url]
|
|
7
12
|
[![Version][filerobot-version]][version-url]
|
|
@@ -12,10 +17,10 @@
|
|
|
12
17
|
[![CodeSandbox][codeSandbox-image]][codeSandbox-url]
|
|
13
18
|
|
|
14
19
|
<div align='center'>
|
|
15
|
-
<img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://
|
|
20
|
+
<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"/>
|
|
16
21
|
</div>
|
|
17
22
|
|
|
18
|
-
The **
|
|
23
|
+
The **SMAW** is a file uploader and media gallery in one easy-to-integrate modal or inline widget. It is the storefront of the [**Scaleflex**](https://scaleflex.com) DAM (Digital Asset Management) and enables accelerated uploads through Scaleflex's content ingestion network and reverse CDN.
|
|
19
24
|
|
|
20
25
|
Various plugins like for example the [**Scaleflex Image Editor**](https://www.npmjs.com/package/@scaleflex/widget-image-editor/#scaleflexwidgetimage-editor) can be enabled to address use cases requiring the interaction with images, videos and static files in your web application. The modular architecture only loads relevant code, thus making the widget as lightweight as possible.
|
|
21
26
|
|
|
@@ -26,7 +31,7 @@ Various plugins like for example the [**Scaleflex Image Editor**](https://www.np
|
|
|
26
31
|
<details>
|
|
27
32
|
<summary>Table of contents</summary>
|
|
28
33
|
|
|
29
|
-
- [Scaleflex Media Asset Widget (
|
|
34
|
+
- [Scaleflex Media Asset Widget (SMAW)](#scaleflexwidget-media-asset-widget-fmaw)
|
|
30
35
|
- [Main features:](#main-features)
|
|
31
36
|
- [Installation](#installation)
|
|
32
37
|
- [Quickstart](#quickstart)
|
|
@@ -79,7 +84,7 @@ The widget's architecture contains the [**Core**](#scaleflexwidget-core) module
|
|
|
79
84
|
<link
|
|
80
85
|
rel="stylesheet"
|
|
81
86
|
type="text/css"
|
|
82
|
-
href="https://cdn.scaleflex.com/plugins/
|
|
87
|
+
href="https://cdn.scaleflex.com/plugins/widget/v4/stable/scalefex-widget.min.css"
|
|
83
88
|
/>
|
|
84
89
|
```
|
|
85
90
|
|
|
@@ -88,7 +93,7 @@ The widget's architecture contains the [**Core**](#scaleflexwidget-core) module
|
|
|
88
93
|
```html
|
|
89
94
|
<script
|
|
90
95
|
type="text/javascript"
|
|
91
|
-
src="https://cdn.scaleflex.com/plugins/
|
|
96
|
+
src="https://cdn.scaleflex.com/plugins/widget/v4/stable/scalefex-widget.min.js"
|
|
92
97
|
></script>
|
|
93
98
|
```
|
|
94
99
|
|
|
@@ -98,11 +103,11 @@ The widget's architecture contains the [**Core**](#scaleflexwidget-core) module
|
|
|
98
103
|
|
|
99
104
|
### Demo
|
|
100
105
|
|
|
101
|
-
[See the
|
|
106
|
+
[See the SMAW in action here](https://cdn.scaleflex.com/plugins/filerobot-widget/v3/demo/index.html).
|
|
102
107
|
|
|
103
|
-
The following implementation examples build a
|
|
108
|
+
The following implementation examples build a SMAW for uploading files, showing the [**Scaleflex Explorer**](https://www.npmjs.com/package/@scaleflex/widget-explorer/#scaleflexwidgetexplorer) as a file explorer/media gallery, enabling the [**Webcam**](https://www.npmjs.com/package/@scaleflex/widget-webcam/#scaleflexwidgetwebcam) for capturing photos and videos and the [**Scaleflex Image Editor**](https://www.npmjs.com/package/@scaleflex/widget-image-editor/#scaleflexwidgetimage-editor) for editing images inline.
|
|
104
109
|
|
|
105
|
-
At minima, you will need the following 3 packages to display a basic
|
|
110
|
+
At minima, you will need the following 3 packages to display a basic SMAW:
|
|
106
111
|
|
|
107
112
|
- [**Core**](#scaleflexwidget-core)
|
|
108
113
|
- [**Scaleflex Explorer**](https://www.npmjs.com/package/@scaleflex/widget-explorer/#scaleflexwidgetexplorer)
|
|
@@ -165,13 +170,13 @@ render(<App />, document.getElementById("app"));
|
|
|
165
170
|
<link
|
|
166
171
|
rel="stylesheet"
|
|
167
172
|
type="text/css"
|
|
168
|
-
href="https://cdn.scaleflex.com/plugins/
|
|
173
|
+
href="https://cdn.scaleflex.com/plugins/widget/v4/stable/scalefex-widget.min.css"
|
|
169
174
|
/>
|
|
170
175
|
</head>
|
|
171
176
|
<body>
|
|
172
177
|
<div id="scaleflex-widget"></div>
|
|
173
178
|
|
|
174
|
-
<script src="https://cdn.scaleflex.com/plugins/
|
|
179
|
+
<script src="https://cdn.scaleflex.com/plugins/widget/v4/stable/scalefex-widget.min.js"></script>
|
|
175
180
|
|
|
176
181
|
<script type="text/javascript">
|
|
177
182
|
const widget = window.ScaleflexWidget;
|
|
@@ -262,7 +267,7 @@ Go to the [Explorer plugin modes](https://www.npmjs.com/package/@scaleflex/widge
|
|
|
262
267
|
|
|
263
268
|
## `@scaleflex/widget-core`
|
|
264
269
|
|
|
265
|
-
The core module of the Scaleflex Media Asset Widget. This module contains all common settings shared across all
|
|
270
|
+
The core module of the Scaleflex Media Asset Widget. This module contains all common settings shared across all SMAW plugins and can be used standalone in your upload workflows to interact with Scaleflex DAM.
|
|
266
271
|
|
|
267
272
|
## Usage
|
|
268
273
|
|
|
@@ -334,7 +339,7 @@ The container token (Scaleflex token) that will be used in all the widget's mode
|
|
|
334
339
|
|
|
335
340
|
<u>Default:</u> `undefined`
|
|
336
341
|
|
|
337
|
-
The Security Template Id is used for the the
|
|
342
|
+
The Security Template Id is used for the the SMAW to request session-specific API access keys, also known as SASS key. [Security Templates](https://docs.filerobot.com/go/filerobot-documentation/en/dam-api/api-authentication/security-templates#85e64ad9266588659bf160f345eb46ca87ab1362) are created in the Scaleflex Asset Hub and define permissions and validity for SASS keys. They work similar to oAuth2 tokens.
|
|
338
343
|
|
|
339
344
|
### `id`
|
|
340
345
|
|
|
@@ -1095,4 +1100,4 @@ scaleflexWidget.on('modified-url', (modifiedUrl, designState, info) => {
|
|
|
1095
1100
|
|
|
1096
1101
|
## License
|
|
1097
1102
|
|
|
1098
|
-
The Scaleflex Media Asset Widget (
|
|
1103
|
+
The Scaleflex Media Asset Widget (SMAW) is provided under the [MIT License](https://opensource.org/licenses/MIT)
|
package/dist/style.css
CHANGED
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
.SfxModal-Wrapper, .filerobot-Root *, #SfxPopper * {
|
|
19
19
|
font-family: "Roboto", sans-serif, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; }
|
|
20
20
|
|
|
21
|
+
#SfxPopper * {
|
|
22
|
+
box-sizing: border-box; }
|
|
23
|
+
|
|
21
24
|
.SfxModal-Wrapper *, .filerobot-Root *, #SfxPopper * {
|
|
22
25
|
scrollbar-color: auto !important;
|
|
23
26
|
/* Track */
|
package/dist/style.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");.filerobot-Root{box-sizing:border-box;font-family:Roboto,sans-serif,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;line-height:1;overflow:hidden;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#333;position:relative;text-align:left}.filerobot-Root :disabled{cursor:not-allowed}#SfxPopper *,.SfxModal-Wrapper,.filerobot-Root *{font-family:Roboto,sans-serif,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}#SfxPopper *,.SfxModal-Wrapper *,.filerobot-Root *{scrollbar-color:auto!important}#SfxPopper ::-webkit-scrollbar,.SfxModal-Wrapper ::-webkit-scrollbar,.filerobot-Root ::-webkit-scrollbar{height:12px!important;width:12px!important}#SfxPopper ::-webkit-scrollbar-track,.SfxModal-Wrapper ::-webkit-scrollbar-track,.filerobot-Root ::-webkit-scrollbar-track{background:transparent!important}#SfxPopper ::-webkit-scrollbar-thumb,.SfxModal-Wrapper ::-webkit-scrollbar-thumb,.filerobot-Root ::-webkit-scrollbar-thumb{background:#ccd6de;border:4px solid #fff;border-radius:99px;padding:4px 6px}.filerobot-Root *,.filerobot-Root :after,.filerobot-Root :before{box-sizing:inherit}.filerobot-Root [hidden]{display:none}.filerobot-u-reset{-webkit-appearance:none;backface-visibility:visible;background:none;border:none;border-collapse:separate;-o-border-image:none;border-image:none;border-radius:0;border-spacing:0;box-shadow:none;clear:none;color:inherit;cursor:auto;display:inline;empty-cells:show;float:none;font-family:inherit;font-size:inherit;font-stretch:normal;font-style:normal;font-variant:normal;font-weight:400;-webkit-hyphens:none;hyphens:none;left:auto;letter-spacing:normal;line-height:1;list-style:none;margin:0;max-height:none;max-width:none;min-height:0;min-width:0;opacity:1;outline:medium none invert;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;text-align:left;text-decoration:none;text-indent:0;text-shadow:none;text-transform:none;top:auto;transform:none;transform-origin:50% 50% 0;transform-style:flat;transition:none 0s ease 0s;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;z-index:auto}.filerobot-u-reset span{max-width:250px;overflow:hidden;text-overflow:ellipsis}.filerobot-u-reset span :not(:disabled) :active{background-color:#eceef2}.filerobot-c-horizontal-separator{border-bottom:1px solid #dfe7ed;display:block;height:1px;left:0;position:absolute;right:0;width:100%}.filerobot-c-icon{max-height:100%;max-width:100%;fill:currentColor;display:inline-block;overflow:hidden}.filerobot-c-btn{display:inline-block;font-family:inherit;font-size:16px;font-weight:500;line-height:1;text-align:center;transition-duration:.3s;transition-property:background-color,color;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;white-space:nowrap}.filerobot-c-btn:not(:disabled):not(.disabled){cursor:pointer}.filerobot-c-btn::-moz-focus-inner{border:0}.filerobot-c-btn-primary{background-color:#5282db;border-radius:4px;color:#fff;font-size:14px;padding:10px 18px}.filerobot-c-btn-primary:hover{background-color:#2b64cf}.filerobot-c-btn-primary:focus{box-shadow:0 0 0 3px rgba(82,130,219,.4);outline:none}.filerobot-size--md .filerobot-c-btn-primary{padding:13px 22px}[data-filerobot-theme=dark] .filerobot-c-btn-primary{color:#eaeaea}[data-filerobot-theme=dark] .filerobot-c-btn-primary:focus{outline:none}[data-filerobot-theme=dark] .filerobot-c-btn-primary::-moz-focus-inner{border:0}[data-filerobot-theme=dark] .filerobot-c-btn-primary:focus{box-shadow:0 0 0 2px rgba(170,225,255,.85)}.filerobot-c-empty{align-items:center;background-color:#fff;color:#939393;flex:1;flex-flow:column wrap;font-size:12px;justify-content:center;line-height:14px;width:100%}.filerobot-c-empty,.filerobot-c-empty-wrapper{display:flex;height:100%}.filerobot-c-empty.left{align-items:flex-start}.filerobot-c-empty.right{align-items:flex-end}.filerobot-c-empty{align-items:flex-start;color:#768a9f}svg{outline:none}
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");.filerobot-Root{box-sizing:border-box;font-family:Roboto,sans-serif,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;line-height:1;overflow:hidden;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:#333;position:relative;text-align:left}.filerobot-Root :disabled{cursor:not-allowed}#SfxPopper *,.SfxModal-Wrapper,.filerobot-Root *{font-family:Roboto,sans-serif,Helvetica,Arial,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol}#SfxPopper *{box-sizing:border-box}#SfxPopper *,.SfxModal-Wrapper *,.filerobot-Root *{scrollbar-color:auto!important}#SfxPopper ::-webkit-scrollbar,.SfxModal-Wrapper ::-webkit-scrollbar,.filerobot-Root ::-webkit-scrollbar{height:12px!important;width:12px!important}#SfxPopper ::-webkit-scrollbar-track,.SfxModal-Wrapper ::-webkit-scrollbar-track,.filerobot-Root ::-webkit-scrollbar-track{background:transparent!important}#SfxPopper ::-webkit-scrollbar-thumb,.SfxModal-Wrapper ::-webkit-scrollbar-thumb,.filerobot-Root ::-webkit-scrollbar-thumb{background:#ccd6de;border:4px solid #fff;border-radius:99px;padding:4px 6px}.filerobot-Root *,.filerobot-Root :after,.filerobot-Root :before{box-sizing:inherit}.filerobot-Root [hidden]{display:none}.filerobot-u-reset{-webkit-appearance:none;backface-visibility:visible;background:none;border:none;border-collapse:separate;-o-border-image:none;border-image:none;border-radius:0;border-spacing:0;box-shadow:none;clear:none;color:inherit;cursor:auto;display:inline;empty-cells:show;float:none;font-family:inherit;font-size:inherit;font-stretch:normal;font-style:normal;font-variant:normal;font-weight:400;-webkit-hyphens:none;hyphens:none;left:auto;letter-spacing:normal;line-height:1;list-style:none;margin:0;max-height:none;max-width:none;min-height:0;min-width:0;opacity:1;outline:medium none invert;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;text-align:left;text-decoration:none;text-indent:0;text-shadow:none;text-transform:none;top:auto;transform:none;transform-origin:50% 50% 0;transform-style:flat;transition:none 0s ease 0s;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;z-index:auto}.filerobot-u-reset span{max-width:250px;overflow:hidden;text-overflow:ellipsis}.filerobot-u-reset span :not(:disabled) :active{background-color:#eceef2}.filerobot-c-horizontal-separator{border-bottom:1px solid #dfe7ed;display:block;height:1px;left:0;position:absolute;right:0;width:100%}.filerobot-c-icon{max-height:100%;max-width:100%;fill:currentColor;display:inline-block;overflow:hidden}.filerobot-c-btn{display:inline-block;font-family:inherit;font-size:16px;font-weight:500;line-height:1;text-align:center;transition-duration:.3s;transition-property:background-color,color;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;white-space:nowrap}.filerobot-c-btn:not(:disabled):not(.disabled){cursor:pointer}.filerobot-c-btn::-moz-focus-inner{border:0}.filerobot-c-btn-primary{background-color:#5282db;border-radius:4px;color:#fff;font-size:14px;padding:10px 18px}.filerobot-c-btn-primary:hover{background-color:#2b64cf}.filerobot-c-btn-primary:focus{box-shadow:0 0 0 3px rgba(82,130,219,.4);outline:none}.filerobot-size--md .filerobot-c-btn-primary{padding:13px 22px}[data-filerobot-theme=dark] .filerobot-c-btn-primary{color:#eaeaea}[data-filerobot-theme=dark] .filerobot-c-btn-primary:focus{outline:none}[data-filerobot-theme=dark] .filerobot-c-btn-primary::-moz-focus-inner{border:0}[data-filerobot-theme=dark] .filerobot-c-btn-primary:focus{box-shadow:0 0 0 2px rgba(170,225,255,.85)}.filerobot-c-empty{align-items:center;background-color:#fff;color:#939393;flex:1;flex-flow:column wrap;font-size:12px;justify-content:center;line-height:14px;width:100%}.filerobot-c-empty,.filerobot-c-empty-wrapper{display:flex;height:100%}.filerobot-c-empty.left{align-items:flex-start}.filerobot-c-empty.right{align-items:flex-end}.filerobot-c-empty{align-items:flex-start;color:#768a9f}svg{outline:none}
|
package/lib/_common.scss
CHANGED
package/lib/index.js
CHANGED
|
@@ -84,15 +84,15 @@ var RestrictionError = /*#__PURE__*/function (_Error) {
|
|
|
84
84
|
* Manages plugins, state updates, acts as an event bus,
|
|
85
85
|
* adds/removes files and metadata.
|
|
86
86
|
*/
|
|
87
|
-
var
|
|
87
|
+
var ScaleflexWidget = /*#__PURE__*/function () {
|
|
88
88
|
/**
|
|
89
89
|
* Instantiate filerobot
|
|
90
90
|
*
|
|
91
91
|
* @param {object} opts — filerobot options
|
|
92
92
|
*/
|
|
93
|
-
function
|
|
93
|
+
function ScaleflexWidget(opts) {
|
|
94
94
|
var _this2 = this;
|
|
95
|
-
_classCallCheck(this,
|
|
95
|
+
_classCallCheck(this, ScaleflexWidget);
|
|
96
96
|
_defineProperty(this, "loadBackendTranslations", function () {
|
|
97
97
|
if (!_this2.backendTranslations) {
|
|
98
98
|
handlePromise(getBackendTranslations({
|
|
@@ -377,7 +377,7 @@ var Filerobot = /*#__PURE__*/function () {
|
|
|
377
377
|
this.initUserAuthState(this.opts.sassKey);
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
return _createClass(
|
|
380
|
+
return _createClass(ScaleflexWidget, [{
|
|
381
381
|
key: "on",
|
|
382
382
|
value: function on(event, callback) {
|
|
383
383
|
this.emitter.on(event, callback);
|
|
@@ -542,7 +542,7 @@ var Filerobot = /*#__PURE__*/function () {
|
|
|
542
542
|
var files = _objectSpread({}, selectUploads(this.getGlobalState()));
|
|
543
543
|
Object.keys(files).forEach(function (fileId) {
|
|
544
544
|
files[fileId] = _objectSpread(_objectSpread({}, files[fileId]), {}, {
|
|
545
|
-
data:
|
|
545
|
+
data: ScaleflexWidget.uploadFilesData[fileId]
|
|
546
546
|
});
|
|
547
547
|
});
|
|
548
548
|
return files;
|
|
@@ -590,7 +590,7 @@ var Filerobot = /*#__PURE__*/function () {
|
|
|
590
590
|
id: fileId
|
|
591
591
|
});
|
|
592
592
|
if (state.data) {
|
|
593
|
-
|
|
593
|
+
ScaleflexWidget.uploadFilesData[fileId] = state.data;
|
|
594
594
|
fileState.data = extractFileDataNoBlob(state.data);
|
|
595
595
|
}
|
|
596
596
|
this.dispatch(uploadUpdated(_objectSpread(_objectSpread({}, fileState), {}, {
|
|
@@ -714,7 +714,7 @@ var Filerobot = /*#__PURE__*/function () {
|
|
|
714
714
|
}
|
|
715
715
|
return _objectSpread(_objectSpread({}, uploadOperations[uploadOperationId].files[fileId]), {}, {
|
|
716
716
|
uploadId: uploadOperationId,
|
|
717
|
-
data:
|
|
717
|
+
data: ScaleflexWidget.uploadFilesData[fileId]
|
|
718
718
|
});
|
|
719
719
|
}
|
|
720
720
|
|
|
@@ -993,7 +993,7 @@ var Filerobot = /*#__PURE__*/function () {
|
|
|
993
993
|
});
|
|
994
994
|
}
|
|
995
995
|
if (file.data) {
|
|
996
|
-
|
|
996
|
+
ScaleflexWidget.uploadFilesData[newFile.id] = file.data;
|
|
997
997
|
}
|
|
998
998
|
return newFile;
|
|
999
999
|
}
|
|
@@ -1090,7 +1090,7 @@ var Filerobot = /*#__PURE__*/function () {
|
|
|
1090
1090
|
skipOpenUploadsPanel: forceAutoProceed
|
|
1091
1091
|
}));
|
|
1092
1092
|
this.emit('file-added', _objectSpread(_objectSpread({}, newFile), {}, {
|
|
1093
|
-
data:
|
|
1093
|
+
data: ScaleflexWidget.uploadFilesData[newFile.id]
|
|
1094
1094
|
}));
|
|
1095
1095
|
this.log("Added file: ".concat(newFile.name, ", ").concat(newFile.id, ", mime type: ").concat(newFile.type));
|
|
1096
1096
|
this._startIfAutoProceed({
|
|
@@ -1140,7 +1140,7 @@ var Filerobot = /*#__PURE__*/function () {
|
|
|
1140
1140
|
}));
|
|
1141
1141
|
newFiles.forEach(function (newFile) {
|
|
1142
1142
|
_this5.emit('file-added', _objectSpread(_objectSpread({}, newFile), {}, {
|
|
1143
|
-
data:
|
|
1143
|
+
data: ScaleflexWidget.uploadFilesData[newFile.id]
|
|
1144
1144
|
}));
|
|
1145
1145
|
});
|
|
1146
1146
|
if (newFiles.length > 5) {
|
|
@@ -1196,7 +1196,7 @@ var Filerobot = /*#__PURE__*/function () {
|
|
|
1196
1196
|
if (currentUploadOperation && uploadOperationId) {
|
|
1197
1197
|
var newFileIds = currentUploadOperation.filesIds.filter(notRemovedFileIds);
|
|
1198
1198
|
delete currentUploadOperation.files[fileId];
|
|
1199
|
-
delete
|
|
1199
|
+
delete ScaleflexWidget.uploadFilesData[fileId];
|
|
1200
1200
|
this.emit('file-removed', fileBeforeRemove, reason);
|
|
1201
1201
|
this.log("Removed file: ".concat(fileId));
|
|
1202
1202
|
if (newFileIds.length === 0) {
|
|
@@ -1921,12 +1921,12 @@ var Filerobot = /*#__PURE__*/function () {
|
|
|
1921
1921
|
// static VERSION = version
|
|
1922
1922
|
// This property contains the data File class instance of the uploads' files, mapped through the file id,
|
|
1923
1923
|
// as `File` class is not serializable data type so we are not saving it into redux, and keeping it in sync with related upload/file object.
|
|
1924
|
-
_defineProperty(
|
|
1924
|
+
_defineProperty(ScaleflexWidget, "uploadFilesData", {
|
|
1925
1925
|
// [fileId]: { [File/Blob instance] }
|
|
1926
1926
|
});
|
|
1927
1927
|
export default function (opts) {
|
|
1928
|
-
return new
|
|
1928
|
+
return new ScaleflexWidget(opts);
|
|
1929
1929
|
}
|
|
1930
1930
|
|
|
1931
1931
|
// Expose class constructor.
|
|
1932
|
-
export {
|
|
1932
|
+
export { ScaleflexWidget, Plugin, debugLogger };
|
|
@@ -15,7 +15,7 @@ import { UPLOAD_CONNECTOR_SERVER, PLUGINS_IDS } from '@scaleflex/widget-utils/li
|
|
|
15
15
|
import deepMerge from '@scaleflex/widget-utils/lib/deepMerge';
|
|
16
16
|
import createThunk from '@scaleflex/widget-utils/lib/createThunk';
|
|
17
17
|
import supportsUploadProgress from '../supportsUploadProgress';
|
|
18
|
-
import {
|
|
18
|
+
import { ScaleflexWidget } from '../';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* The order of the code in slice file is:
|
|
@@ -260,7 +260,7 @@ export var selectUploadsIds = function selectUploadsIds(state) {
|
|
|
260
260
|
export var selectUploadsArray = createSelector(selectUploads, function (files) {
|
|
261
261
|
return Object.keys(files).map(function (fileId) {
|
|
262
262
|
return files[fileId] ? _objectSpread(_objectSpread({}, files[fileId]), {}, {
|
|
263
|
-
data:
|
|
263
|
+
data: ScaleflexWidget.uploadFilesData[fileId]
|
|
264
264
|
}) : undefined;
|
|
265
265
|
});
|
|
266
266
|
});
|
|
@@ -268,7 +268,7 @@ export var selectUploadById = createSelector([selectUploads, function (_state, f
|
|
|
268
268
|
return fileId;
|
|
269
269
|
}], function (files, fileId) {
|
|
270
270
|
return files[fileId] ? _objectSpread(_objectSpread({}, files[fileId]), {}, {
|
|
271
|
-
data:
|
|
271
|
+
data: ScaleflexWidget.uploadFilesData[fileId]
|
|
272
272
|
}) : undefined;
|
|
273
273
|
});
|
|
274
274
|
export var selectUploadsByIds = createSelector([selectUploads, function (_state, filesIds) {
|
|
@@ -276,7 +276,7 @@ export var selectUploadsByIds = createSelector([selectUploads, function (_state,
|
|
|
276
276
|
}], function (files, filesIds) {
|
|
277
277
|
return filesIds.map(function (fileId) {
|
|
278
278
|
return files[fileId] ? _objectSpread(_objectSpread({}, files[fileId]), {}, {
|
|
279
|
-
data:
|
|
279
|
+
data: ScaleflexWidget.uploadFilesData[fileId]
|
|
280
280
|
}) : undefined;
|
|
281
281
|
});
|
|
282
282
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/widget-core",
|
|
3
3
|
"description": "Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, Box, One Drive, S3 and more.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"style": "dist/style.min.css",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@reduxjs/toolkit": "^1.9.5",
|
|
19
19
|
"@scaleflex/icons": "^3.0.0-beta.11",
|
|
20
20
|
"@scaleflex/ui": "^3.0.0-beta.11",
|
|
21
|
-
"@scaleflex/widget-utils": "^0.
|
|
21
|
+
"@scaleflex/widget-utils": "^4.0.0",
|
|
22
22
|
"@transloadit/prettier-bytes": "0.1.0",
|
|
23
23
|
"cuid": "^3.0.0",
|
|
24
24
|
"lodash.throttle": "^4.1.1",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"react": ">=19.0.0",
|
|
35
35
|
"react-dom": ">=19.0.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "bf4d9631c2695e70b94092490e4a9800b54b38b7"
|
|
38
38
|
}
|