formiojs-eorion 0.1.21 → 0.1.22
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/Formio.js +1 -1
- package/components/Chart/Chart.js +9 -16
- package/components/CustomCheckBox/CustomCheckBox.js +7 -14
- package/components/CustomFile/CustomFile.js +65 -72
- package/components/CustomRadio/CustomRadio.js +13 -21
- package/components/CustomSelect/CustomSelect.js +32 -40
- package/components/CustomTable/CustomTable.js +7 -15
- package/components/CustomTextArea/CustomTextArea.js +4 -3
- package/components/CustomTextField/CustomTextField.js +7 -14
- package/components/Data/Data.js +15 -23
- package/components/DataChinaGrid/Data.js +2 -1
- package/components/DataChinaGridRow/Data.js +2 -1
- package/components/DataSource/DataSource.js +2 -1
- package/components/Department/Department.js +10 -17
- package/components/LocationInputTextField/LocationInputTextField.js +7 -14
- package/components/NocodbFile/NocodbFile.js +65 -72
- package/components/QrCode/QrCode.js +6 -13
- package/components/ScanInputTextField/ScanInputTextField.js +7 -14
- package/components/TaskCalendar/TaskCalendar.js +8 -16
- package/components/_classes/Department/Department.js +10 -17
- package/components/button/Button.js +2 -1
- package/components/echarts/ECharts.js +2 -1
- package/components/file/File.js +63 -71
- package/components/iconButton/IconButton.js +2 -1
- package/components/map/Map.js +14 -22
- package/components/progress/Progress.js +2 -1
- package/components/radio/Radio.js +45 -53
- package/components/select/Select.js +102 -110
- package/components/tree/Tree.js +10 -17
- package/dist/formio.contrib.js +2 -2
- package/dist/formio.contrib.min.js +1 -1
- package/dist/formio.contrib.min.js.LICENSE.txt +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +27 -27
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +27 -27
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/package.json +1 -1
package/Formio.js
CHANGED
|
@@ -1724,7 +1724,7 @@ Formio.projectUrlSet = false;
|
|
|
1724
1724
|
Formio.plugins = [];
|
|
1725
1725
|
Formio.cache = {};
|
|
1726
1726
|
Formio.Providers = _providers.default;
|
|
1727
|
-
Formio.version = '0.1.
|
|
1727
|
+
Formio.version = '0.1.22';
|
|
1728
1728
|
Formio.pathType = '';
|
|
1729
1729
|
Formio.events = new _EventEmitter.default();
|
|
1730
1730
|
Formio.cdn = new _CDN.default();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
|
+
require("core-js/modules/es.object.to-string.js");
|
|
4
5
|
require("core-js/modules/es.reflect.construct.js");
|
|
5
6
|
require("core-js/modules/es.reflect.get.js");
|
|
6
7
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
@@ -17,12 +18,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
18
|
value: true
|
|
18
19
|
});
|
|
19
20
|
exports.default = void 0;
|
|
20
|
-
require("core-js/modules/es.object.to-string.js");
|
|
21
21
|
require("core-js/modules/es.regexp.exec.js");
|
|
22
22
|
require("core-js/modules/es.string.replace.js");
|
|
23
23
|
require("core-js/modules/es.string.trim.js");
|
|
24
24
|
require("core-js/modules/es.object.get-prototype-of.js");
|
|
25
25
|
var _Field = _interopRequireDefault(require("../_classes/field/Field"));
|
|
26
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
26
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
28
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
28
29
|
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); } }
|
|
@@ -54,20 +55,12 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
54
55
|
return _super.call(this, component, options, data);
|
|
55
56
|
}
|
|
56
57
|
_createClass(Data, [{
|
|
57
|
-
key: "get",
|
|
58
|
-
value: function get(path, obj) {
|
|
59
|
-
var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
|
|
60
|
-
return path.split('.').reduce(function (res, key) {
|
|
61
|
-
return res[key] || fb;
|
|
62
|
-
}, obj);
|
|
63
|
-
}
|
|
64
|
-
}, {
|
|
65
58
|
key: "parseTpl",
|
|
66
|
-
value: function parseTpl(template, map
|
|
67
|
-
var _this = this;
|
|
59
|
+
value: function parseTpl(template, map) {
|
|
68
60
|
return template.replace(/\$\{.+?}/g, function (match) {
|
|
61
|
+
var _$get;
|
|
69
62
|
var path = match.substr(2, match.length - 3).trim();
|
|
70
|
-
return
|
|
63
|
+
return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
|
|
71
64
|
});
|
|
72
65
|
}
|
|
73
66
|
}, {
|
|
@@ -78,11 +71,11 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
78
71
|
}, {
|
|
79
72
|
key: "attach",
|
|
80
73
|
value: function attach(element) {
|
|
81
|
-
var
|
|
74
|
+
var _this = this;
|
|
82
75
|
var refs = {};
|
|
83
76
|
this.loadRefs(element, refs);
|
|
84
77
|
setTimeout(function () {
|
|
85
|
-
|
|
78
|
+
_this.setValue();
|
|
86
79
|
}, 100);
|
|
87
80
|
return _get(_getPrototypeOf(Data.prototype), "attach", this).call(this, element);
|
|
88
81
|
}
|
|
@@ -121,7 +114,7 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
121
114
|
url: this.component.url
|
|
122
115
|
}), {
|
|
123
116
|
data: this.rootValue
|
|
124
|
-
}
|
|
117
|
+
})).url;
|
|
125
118
|
if (element) {
|
|
126
119
|
element.src = url;
|
|
127
120
|
element.height = this.component.height + "";
|
|
@@ -141,7 +134,7 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
141
134
|
url: self.component.url
|
|
142
135
|
}), {
|
|
143
136
|
data: self.rootValue
|
|
144
|
-
}
|
|
137
|
+
})).url;
|
|
145
138
|
}, this.component.interval * 1000);
|
|
146
139
|
this.interval = interval;
|
|
147
140
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
|
+
require("core-js/modules/es.object.to-string.js");
|
|
4
5
|
require("core-js/modules/es.reflect.construct.js");
|
|
5
6
|
require("core-js/modules/es.reflect.get.js");
|
|
6
7
|
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
@@ -17,13 +18,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
18
|
value: true
|
|
18
19
|
});
|
|
19
20
|
exports.default = void 0;
|
|
20
|
-
require("core-js/modules/es.object.to-string.js");
|
|
21
21
|
require("core-js/modules/es.regexp.exec.js");
|
|
22
22
|
require("core-js/modules/es.string.replace.js");
|
|
23
23
|
require("core-js/modules/es.string.trim.js");
|
|
24
24
|
require("core-js/modules/es.object.get-prototype-of.js");
|
|
25
25
|
var _Formio = require("../../Formio");
|
|
26
26
|
var _Checkbox = _interopRequireDefault(require("../checkbox/Checkbox"));
|
|
27
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
27
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
29
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
29
30
|
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); } }
|
|
@@ -47,20 +48,12 @@ var CustomCheckBox = /*#__PURE__*/function (_CheckboxComponent) {
|
|
|
47
48
|
return _super.call(this, component, options, data);
|
|
48
49
|
}
|
|
49
50
|
_createClass(CustomCheckBox, [{
|
|
50
|
-
key: "get",
|
|
51
|
-
value: function get(path, obj) {
|
|
52
|
-
var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
|
|
53
|
-
return path.split('.').reduce(function (res, key) {
|
|
54
|
-
return res[key] || fb;
|
|
55
|
-
}, obj);
|
|
56
|
-
}
|
|
57
|
-
}, {
|
|
58
51
|
key: "parseTpl",
|
|
59
|
-
value: function parseTpl(template, map
|
|
60
|
-
var _this = this;
|
|
52
|
+
value: function parseTpl(template, map) {
|
|
61
53
|
return template.replace(/\$\{.+?}/g, function (match) {
|
|
54
|
+
var _$get;
|
|
62
55
|
var path = match.substr(2, match.length - 3).trim();
|
|
63
|
-
return
|
|
56
|
+
return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
|
|
64
57
|
});
|
|
65
58
|
}
|
|
66
59
|
}, {
|
|
@@ -81,10 +74,10 @@ var CustomCheckBox = /*#__PURE__*/function (_CheckboxComponent) {
|
|
|
81
74
|
try {
|
|
82
75
|
parsedOptions = JSON.parse(this.parseTpl(options || '{"headers":{}}', {
|
|
83
76
|
data: this.rootValue
|
|
84
|
-
}
|
|
77
|
+
}));
|
|
85
78
|
parsedBody = JSON.parse(this.parseTpl(body || '{}', {
|
|
86
79
|
data: this.rootValue
|
|
87
|
-
}
|
|
80
|
+
}));
|
|
88
81
|
} catch (e) {
|
|
89
82
|
console.log(e);
|
|
90
83
|
}
|
|
@@ -41,6 +41,7 @@ require("core-js/modules/es.regexp.to-string.js");
|
|
|
41
41
|
require("core-js/modules/es.object.get-prototype-of.js");
|
|
42
42
|
var _utils = require("../../utils/utils");
|
|
43
43
|
var _File = _interopRequireDefault(require("../file/File"));
|
|
44
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
44
45
|
var _fileProcessor = _interopRequireDefault(require("../../providers/processor/fileProcessor"));
|
|
45
46
|
var _browserMd5File = _interopRequireDefault(require("browser-md5-file"));
|
|
46
47
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -96,7 +97,7 @@ var CustomFile = /*#__PURE__*/function (_FileComponent) {
|
|
|
96
97
|
try {
|
|
97
98
|
options = JSON.parse(_this.parseTpl(options, {
|
|
98
99
|
data: _this.rootValue
|
|
99
|
-
}
|
|
100
|
+
}));
|
|
100
101
|
} catch (e) {
|
|
101
102
|
console.log(e);
|
|
102
103
|
}
|
|
@@ -140,27 +141,19 @@ var CustomFile = /*#__PURE__*/function (_FileComponent) {
|
|
|
140
141
|
value: function getValue() {
|
|
141
142
|
return this.component.value;
|
|
142
143
|
}
|
|
143
|
-
}, {
|
|
144
|
-
key: "get",
|
|
145
|
-
value: function get(path, obj) {
|
|
146
|
-
var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
|
|
147
|
-
return path.split('.').reduce(function (res, key) {
|
|
148
|
-
return res[key] || fb;
|
|
149
|
-
}, obj);
|
|
150
|
-
}
|
|
151
144
|
}, {
|
|
152
145
|
key: "parseTpl",
|
|
153
|
-
value: function parseTpl(template, map
|
|
154
|
-
var _this2 = this;
|
|
146
|
+
value: function parseTpl(template, map) {
|
|
155
147
|
return template.replace(/\$\{.+?}/g, function (match) {
|
|
148
|
+
var _$get;
|
|
156
149
|
var path = match.substr(2, match.length - 3).trim();
|
|
157
|
-
return
|
|
150
|
+
return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
|
|
158
151
|
});
|
|
159
152
|
}
|
|
160
153
|
}, {
|
|
161
154
|
key: "upload",
|
|
162
155
|
value: function upload(files) {
|
|
163
|
-
var
|
|
156
|
+
var _this2 = this;
|
|
164
157
|
// Only allow one upload if not multiple.
|
|
165
158
|
if (!this.component.multiple) {
|
|
166
159
|
if (this.statuses.length) {
|
|
@@ -175,7 +168,7 @@ var CustomFile = /*#__PURE__*/function (_FileComponent) {
|
|
|
175
168
|
/* eslint-disable max-statements */
|
|
176
169
|
Array.prototype.forEach.call(files, /*#__PURE__*/function () {
|
|
177
170
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
|
|
178
|
-
var bmf, hash, fileName, fileUpload, fileWithSameNameUploaded, fileWithSameNameUploadedWithError, dir, fileService, storage,
|
|
171
|
+
var bmf, hash, fileName, fileUpload, fileWithSameNameUploaded, fileWithSameNameUploadedWithError, dir, fileService, storage, _this2$component$opti, options, url, groupKey, groupPermissions, fileKey, groupResourceId, processedFile, fileProcessorHandler, filePromise;
|
|
179
172
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
180
173
|
while (1) switch (_context.prev = _context.next) {
|
|
181
174
|
case 0:
|
|
@@ -191,87 +184,87 @@ var CustomFile = /*#__PURE__*/function (_FileComponent) {
|
|
|
191
184
|
});
|
|
192
185
|
case 3:
|
|
193
186
|
hash = _context.sent;
|
|
194
|
-
fileName = (0, _utils.uniqueName)(file.name,
|
|
187
|
+
fileName = (0, _utils.uniqueName)(file.name, _this2.component.fileNameTemplate, _this2.evalContext());
|
|
195
188
|
fileUpload = {
|
|
196
189
|
originalName: file.name,
|
|
197
190
|
name: fileName,
|
|
198
191
|
size: file.size,
|
|
199
192
|
status: 'info',
|
|
200
|
-
message:
|
|
193
|
+
message: _this2.t('Processing file. Please wait...'),
|
|
201
194
|
hash: hash,
|
|
202
195
|
progress: 0
|
|
203
196
|
}; // Check if file with the same name is being uploaded
|
|
204
|
-
fileWithSameNameUploaded =
|
|
197
|
+
fileWithSameNameUploaded = _this2.dataValue.some(function (fileStatus) {
|
|
205
198
|
return fileStatus.originalName === file.name;
|
|
206
199
|
});
|
|
207
|
-
fileWithSameNameUploadedWithError =
|
|
200
|
+
fileWithSameNameUploadedWithError = _this2.statuses.findIndex(function (fileStatus) {
|
|
208
201
|
return fileStatus.originalName === file.name && fileStatus.status === 'error';
|
|
209
202
|
});
|
|
210
203
|
if (fileWithSameNameUploaded) {
|
|
211
204
|
fileUpload.status = 'error';
|
|
212
|
-
fileUpload.message =
|
|
205
|
+
fileUpload.message = _this2.t('File with the same name is already uploaded');
|
|
213
206
|
}
|
|
214
207
|
if (fileWithSameNameUploadedWithError !== -1) {
|
|
215
|
-
|
|
216
|
-
|
|
208
|
+
_this2.statuses.splice(fileWithSameNameUploadedWithError, 1);
|
|
209
|
+
_this2.redraw();
|
|
217
210
|
}
|
|
218
211
|
|
|
219
212
|
// Check file pattern
|
|
220
|
-
if (
|
|
213
|
+
if (_this2.component.filePattern && !_this2.validatePattern(file, _this2.component.filePattern)) {
|
|
221
214
|
fileUpload.status = 'error';
|
|
222
|
-
fileUpload.message =
|
|
223
|
-
pattern:
|
|
215
|
+
fileUpload.message = _this2.t('File is the wrong type; it must be {{ pattern }}', {
|
|
216
|
+
pattern: _this2.component.filePattern
|
|
224
217
|
});
|
|
225
218
|
}
|
|
226
219
|
|
|
227
220
|
// Check file minimum size
|
|
228
|
-
if (
|
|
221
|
+
if (_this2.component.fileMinSize && !_this2.validateMinSize(file, _this2.component.fileMinSize)) {
|
|
229
222
|
fileUpload.status = 'error';
|
|
230
|
-
fileUpload.message =
|
|
231
|
-
size:
|
|
223
|
+
fileUpload.message = _this2.t('File is too small; it must be at least {{ size }}', {
|
|
224
|
+
size: _this2.component.fileMinSize
|
|
232
225
|
});
|
|
233
226
|
}
|
|
234
227
|
|
|
235
228
|
// Check file maximum size
|
|
236
|
-
if (
|
|
229
|
+
if (_this2.component.fileMaxSize && !_this2.validateMaxSize(file, _this2.component.fileMaxSize)) {
|
|
237
230
|
fileUpload.status = 'error';
|
|
238
|
-
fileUpload.message =
|
|
239
|
-
size:
|
|
231
|
+
fileUpload.message = _this2.t('File is too big; it must be at most {{ size }}', {
|
|
232
|
+
size: _this2.component.fileMaxSize
|
|
240
233
|
});
|
|
241
234
|
}
|
|
242
235
|
|
|
243
236
|
// Get a unique name for this file to keep file collisions from occurring.
|
|
244
|
-
dir =
|
|
245
|
-
fileService =
|
|
237
|
+
dir = _this2.interpolate(_this2.component.dir || '');
|
|
238
|
+
fileService = _this2.fileService;
|
|
246
239
|
if (!fileService) {
|
|
247
240
|
fileUpload.status = 'error';
|
|
248
|
-
fileUpload.message =
|
|
241
|
+
fileUpload.message = _this2.t('File Service not provided.');
|
|
249
242
|
}
|
|
250
|
-
|
|
251
|
-
|
|
243
|
+
_this2.statuses.push(fileUpload);
|
|
244
|
+
_this2.redraw();
|
|
252
245
|
if (!(fileUpload.status !== 'error')) {
|
|
253
246
|
_context.next = 52;
|
|
254
247
|
break;
|
|
255
248
|
}
|
|
256
|
-
if (
|
|
249
|
+
if (_this2.component.privateDownload) {
|
|
257
250
|
file.private = true;
|
|
258
251
|
}
|
|
259
|
-
storage =
|
|
260
|
-
|
|
252
|
+
storage = _this2.component.storage;
|
|
253
|
+
_this2$component$opti = _this2.component.options, options = _this2$component$opti === void 0 ? {} : _this2$component$opti;
|
|
261
254
|
try {
|
|
262
|
-
options = JSON.parse(
|
|
263
|
-
data:
|
|
264
|
-
}
|
|
255
|
+
options = JSON.parse(_this2.parseTpl(options, {
|
|
256
|
+
data: _this2.rootValue
|
|
257
|
+
}));
|
|
265
258
|
} catch (e) {
|
|
266
259
|
console.log(e);
|
|
267
260
|
}
|
|
268
261
|
// 解析options变量
|
|
269
|
-
url =
|
|
262
|
+
url = _this2.interpolate(_this2.component.url, {
|
|
270
263
|
file: fileUpload
|
|
271
264
|
});
|
|
272
265
|
groupKey = null;
|
|
273
266
|
groupPermissions = null; // Iterate through form components to find group resource if one exists
|
|
274
|
-
|
|
267
|
+
_this2.root.everyComponent(function (element) {
|
|
275
268
|
var _element$component, _element$component2;
|
|
276
269
|
if ((_element$component = element.component) !== null && _element$component !== void 0 && _element$component.submissionAccess || (_element$component2 = element.component) !== null && _element$component2 !== void 0 && _element$component2.defaultPermission) {
|
|
277
270
|
groupPermissions = !element.component.submissionAccess ? [{
|
|
@@ -283,20 +276,20 @@ var CustomFile = /*#__PURE__*/function (_FileComponent) {
|
|
|
283
276
|
});
|
|
284
277
|
}
|
|
285
278
|
});
|
|
286
|
-
fileKey =
|
|
287
|
-
groupResourceId = groupKey ?
|
|
279
|
+
fileKey = _this2.component.fileKey || 'file';
|
|
280
|
+
groupResourceId = groupKey ? _this2.currentForm.submission.data[groupKey]._id : null;
|
|
288
281
|
processedFile = null;
|
|
289
|
-
if (!
|
|
282
|
+
if (!_this2.root.options.fileProcessor) {
|
|
290
283
|
_context.next = 49;
|
|
291
284
|
break;
|
|
292
285
|
}
|
|
293
286
|
_context.prev = 31;
|
|
294
|
-
if (
|
|
295
|
-
|
|
287
|
+
if (_this2.refs.fileProcessingLoader) {
|
|
288
|
+
_this2.refs.fileProcessingLoader.style.display = 'block';
|
|
296
289
|
}
|
|
297
|
-
fileProcessorHandler = (0, _fileProcessor.default)(
|
|
290
|
+
fileProcessorHandler = (0, _fileProcessor.default)(_this2.fileService, _this2.root.options.fileProcessor);
|
|
298
291
|
_context.next = 36;
|
|
299
|
-
return fileProcessorHandler(file,
|
|
292
|
+
return fileProcessorHandler(file, _this2.component.properties);
|
|
300
293
|
case 36:
|
|
301
294
|
processedFile = _context.sent;
|
|
302
295
|
_context.next = 46;
|
|
@@ -305,57 +298,57 @@ var CustomFile = /*#__PURE__*/function (_FileComponent) {
|
|
|
305
298
|
_context.prev = 39;
|
|
306
299
|
_context.t0 = _context["catch"](31);
|
|
307
300
|
fileUpload.status = 'error';
|
|
308
|
-
fileUpload.message =
|
|
309
|
-
|
|
310
|
-
|
|
301
|
+
fileUpload.message = _this2.t('File processing has been failed.');
|
|
302
|
+
_this2.fileDropHidden = false;
|
|
303
|
+
_this2.redraw();
|
|
311
304
|
return _context.abrupt("return");
|
|
312
305
|
case 46:
|
|
313
306
|
_context.prev = 46;
|
|
314
|
-
if (
|
|
315
|
-
|
|
307
|
+
if (_this2.refs.fileProcessingLoader) {
|
|
308
|
+
_this2.refs.fileProcessingLoader.style.display = 'none';
|
|
316
309
|
}
|
|
317
310
|
return _context.finish(46);
|
|
318
311
|
case 49:
|
|
319
|
-
fileUpload.message =
|
|
320
|
-
|
|
312
|
+
fileUpload.message = _this2.t('Starting upload.');
|
|
313
|
+
_this2.redraw();
|
|
321
314
|
filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,
|
|
322
315
|
// Progress callback
|
|
323
316
|
function (evt) {
|
|
324
317
|
fileUpload.status = 'progress';
|
|
325
318
|
fileUpload.progress = parseInt(String(100.0 * evt.loaded / evt.total));
|
|
326
319
|
delete fileUpload.message;
|
|
327
|
-
|
|
320
|
+
_this2.redraw();
|
|
328
321
|
}, url, options, fileKey, groupPermissions, groupResourceId,
|
|
329
322
|
// Upload start callback
|
|
330
323
|
function () {
|
|
331
|
-
|
|
324
|
+
_this2.emit('fileUploadingStart', filePromise);
|
|
332
325
|
},
|
|
333
326
|
// Abort upload callback
|
|
334
327
|
function (abort) {
|
|
335
|
-
return
|
|
328
|
+
return _this2.abortUpload = abort;
|
|
336
329
|
}).then(function (fileInfo) {
|
|
337
|
-
var index =
|
|
330
|
+
var index = _this2.statuses.indexOf(fileUpload);
|
|
338
331
|
if (index !== -1) {
|
|
339
|
-
|
|
332
|
+
_this2.statuses.splice(index, 1);
|
|
340
333
|
}
|
|
341
334
|
fileInfo.originalName = file.name;
|
|
342
335
|
fileInfo.hash = fileUpload.hash;
|
|
343
336
|
fileInfo.url = "".concat(url, "/").concat(fileInfo.name);
|
|
344
|
-
if (!
|
|
345
|
-
|
|
337
|
+
if (!_this2.hasValue()) {
|
|
338
|
+
_this2.dataValue = [];
|
|
346
339
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
340
|
+
_this2.dataValue.push(fileInfo);
|
|
341
|
+
_this2.fileDropHidden = false;
|
|
342
|
+
_this2.redraw();
|
|
343
|
+
_this2.triggerChange();
|
|
344
|
+
_this2.emit('fileUploadingEnd', filePromise);
|
|
352
345
|
}).catch(function (response) {
|
|
353
346
|
fileUpload.status = 'error';
|
|
354
347
|
fileUpload.message = typeof response === 'string' ? response : response.toString();
|
|
355
348
|
delete fileUpload.progress;
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
349
|
+
_this2.fileDropHidden = false;
|
|
350
|
+
_this2.redraw();
|
|
351
|
+
_this2.emit('fileUploadingEnd', filePromise);
|
|
359
352
|
});
|
|
360
353
|
case 52:
|
|
361
354
|
case "end":
|
|
@@ -113,27 +113,19 @@ var CustomRadio = /*#__PURE__*/function (_RadioComponent) {
|
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
}, {
|
|
117
|
-
key: "get",
|
|
118
|
-
value: function get(path, obj) {
|
|
119
|
-
var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
|
|
120
|
-
return path.split('.').reduce(function (res, key) {
|
|
121
|
-
return res[key] || fb;
|
|
122
|
-
}, obj);
|
|
123
|
-
}
|
|
124
116
|
}, {
|
|
125
117
|
key: "parseTpl",
|
|
126
|
-
value: function parseTpl(template, map
|
|
127
|
-
var _this2 = this;
|
|
118
|
+
value: function parseTpl(template, map) {
|
|
128
119
|
return template.replace(/\$\{.+?}/g, function (match) {
|
|
120
|
+
var _$get;
|
|
129
121
|
var path = match.substr(2, match.length - 3).trim();
|
|
130
|
-
return
|
|
122
|
+
return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
|
|
131
123
|
});
|
|
132
124
|
}
|
|
133
125
|
}, {
|
|
134
126
|
key: "loadItems",
|
|
135
127
|
value: function loadItems(url, search, headers, options, method, body) {
|
|
136
|
-
var
|
|
128
|
+
var _this2 = this;
|
|
137
129
|
// Ensure we have a method and remove any body if method is get
|
|
138
130
|
method = method || 'GET';
|
|
139
131
|
if (method.toUpperCase() === 'GET') {
|
|
@@ -149,10 +141,10 @@ var CustomRadio = /*#__PURE__*/function (_RadioComponent) {
|
|
|
149
141
|
try {
|
|
150
142
|
parsedOptions = JSON.parse(this.parseTpl(JSON.stringify(options), {
|
|
151
143
|
data: this.rootValue
|
|
152
|
-
}
|
|
144
|
+
}));
|
|
153
145
|
parsedBody = JSON.parse(this.parseTpl(JSON.stringify(body), {
|
|
154
146
|
data: this.rootValue
|
|
155
|
-
}
|
|
147
|
+
}));
|
|
156
148
|
}
|
|
157
149
|
// eslint-disable-next-line no-empty
|
|
158
150
|
catch (e) {}
|
|
@@ -161,19 +153,19 @@ var CustomRadio = /*#__PURE__*/function (_RadioComponent) {
|
|
|
161
153
|
headers.forEach(function (value, name) {
|
|
162
154
|
headers.set(name, self.parseTpl(value, {
|
|
163
155
|
data: self.rootValue
|
|
164
|
-
}
|
|
156
|
+
}));
|
|
165
157
|
});
|
|
166
158
|
parsedOptions.header = headers;
|
|
167
159
|
if (this.shouldLoad) {
|
|
168
160
|
this.loading = true;
|
|
169
161
|
_Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, parsedBody, parsedOptions).then(function (response) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
162
|
+
_this2.loading = false;
|
|
163
|
+
_this2.error = null;
|
|
164
|
+
_this2.setItems(response);
|
|
165
|
+
_this2.shouldLoad = false;
|
|
166
|
+
_this2.redraw();
|
|
175
167
|
}).catch(function (err) {
|
|
176
|
-
|
|
168
|
+
_this2.handleLoadingError(err);
|
|
177
169
|
});
|
|
178
170
|
}
|
|
179
171
|
}
|