@sb1/ffe-file-upload-react 6.1.6 → 7.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/es/FileUpload.js +5 -4
- package/lib/FileUpload.js +5 -4
- package/package.json +5 -5
- package/types/index.d.ts +7 -7
package/es/FileUpload.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
4
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
7
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
6
8
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
7
9
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -81,8 +83,7 @@ var FileUpload = /*#__PURE__*/function (_React$Component) {
|
|
|
81
83
|
infoSubText = _this$props.infoSubText,
|
|
82
84
|
uploadTitle = _this$props.uploadTitle,
|
|
83
85
|
uploadMicroText = _this$props.uploadMicroText,
|
|
84
|
-
uploadSubText = _this$props.uploadSubText
|
|
85
|
-
onFileDeleted = _this$props.onFileDeleted;
|
|
86
|
+
uploadSubText = _this$props.uploadSubText;
|
|
86
87
|
return /*#__PURE__*/React.createElement("div", {
|
|
87
88
|
className: "ffe-file-upload"
|
|
88
89
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -95,7 +96,7 @@ var FileUpload = /*#__PURE__*/function (_React$Component) {
|
|
|
95
96
|
file: files[file],
|
|
96
97
|
cancelText: cancelText,
|
|
97
98
|
deleteText: deleteText,
|
|
98
|
-
onFileDeleted: onFileDeleted
|
|
99
|
+
onFileDeleted: _this2.onFileDeleted
|
|
99
100
|
});
|
|
100
101
|
})) : /*#__PURE__*/React.createElement("div", {
|
|
101
102
|
className: "ffe-file-upload__info-section"
|
package/lib/FileUpload.js
CHANGED
|
@@ -13,8 +13,10 @@ var _ffeButtonsReact = require("@sb1/ffe-buttons-react");
|
|
|
13
13
|
var _pilNedIBoksIkon = _interopRequireDefault(require("@sb1/ffe-icons-react/lib/pil-ned-i-boks-ikon"));
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
16
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
17
17
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
18
20
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
21
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
20
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -88,8 +90,7 @@ var FileUpload = /*#__PURE__*/function (_React$Component) {
|
|
|
88
90
|
infoSubText = _this$props.infoSubText,
|
|
89
91
|
uploadTitle = _this$props.uploadTitle,
|
|
90
92
|
uploadMicroText = _this$props.uploadMicroText,
|
|
91
|
-
uploadSubText = _this$props.uploadSubText
|
|
92
|
-
onFileDeleted = _this$props.onFileDeleted;
|
|
93
|
+
uploadSubText = _this$props.uploadSubText;
|
|
93
94
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
94
95
|
className: "ffe-file-upload"
|
|
95
96
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -102,7 +103,7 @@ var FileUpload = /*#__PURE__*/function (_React$Component) {
|
|
|
102
103
|
file: files[file],
|
|
103
104
|
cancelText: cancelText,
|
|
104
105
|
deleteText: deleteText,
|
|
105
|
-
onFileDeleted: onFileDeleted
|
|
106
|
+
onFileDeleted: _this2.onFileDeleted
|
|
106
107
|
});
|
|
107
108
|
})) : /*#__PURE__*/_react.default.createElement("div", {
|
|
108
109
|
className: "ffe-file-upload__info-section"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-file-upload-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Upload file button with validation and list of uploaded files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ffe"
|
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
"test:watch": "ffe-buildtool jest --watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@sb1/ffe-buttons-react": "^
|
|
31
|
+
"@sb1/ffe-buttons-react": "^17.0.0",
|
|
32
|
+
"@sb1/ffe-file-upload": "^8.0.0",
|
|
33
|
+
"@sb1/ffe-form": "^23.0.0",
|
|
32
34
|
"@sb1/ffe-icons-react": "^7.3.4",
|
|
33
35
|
"classnames": "^2.3.1"
|
|
34
36
|
},
|
|
@@ -38,8 +40,6 @@
|
|
|
38
40
|
"react-dom": "^16.9.0"
|
|
39
41
|
},
|
|
40
42
|
"peerDependencies": {
|
|
41
|
-
"@sb1/ffe-core": "*",
|
|
42
|
-
"@sb1/ffe-form": "*",
|
|
43
43
|
"react": ">=16.9.0"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"depencencies": {
|
|
49
49
|
"prop-types": "^15.6.0"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "04e17f405e57198e2cef5e65bae130b43e8dcb81"
|
|
52
52
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
export interface FileItem {
|
|
3
|
+
export interface FileItem<T> {
|
|
4
4
|
name: string;
|
|
5
|
-
document?:
|
|
5
|
+
document?: T;
|
|
6
6
|
error?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export interface FileUploadProps {
|
|
9
|
+
export interface FileUploadProps<T> {
|
|
10
10
|
id: string;
|
|
11
11
|
label: string;
|
|
12
|
-
files: Record<string, FileItem
|
|
12
|
+
files: Record<string, FileItem<T>>;
|
|
13
13
|
onFilesSelected(fileList: FileList): void;
|
|
14
14
|
onFilesDropped(fileList: FileList): void;
|
|
15
|
-
onFileDeleted(file:
|
|
15
|
+
onFileDeleted(file: FileItem<T>): void;
|
|
16
16
|
multiple?: boolean;
|
|
17
17
|
title: string;
|
|
18
18
|
infoText: string;
|
|
@@ -23,9 +23,9 @@ export interface FileUploadProps {
|
|
|
23
23
|
uploadMicroText: string;
|
|
24
24
|
uploadSubText: string;
|
|
25
25
|
}
|
|
26
|
-
declare class FileUpload extends React.Component<FileUploadProps
|
|
26
|
+
declare class FileUpload<T> extends React.Component<FileUploadProps<T>, any> {}
|
|
27
27
|
|
|
28
|
-
declare function getFileContent(file: File): Promise<
|
|
28
|
+
declare function getFileContent(file: File): Promise<string>;
|
|
29
29
|
|
|
30
30
|
export default FileUpload;
|
|
31
31
|
export { getFileContent };
|