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.
Files changed (44) hide show
  1. package/Formio.js +1 -1
  2. package/components/Chart/Chart.js +9 -16
  3. package/components/CustomCheckBox/CustomCheckBox.js +7 -14
  4. package/components/CustomFile/CustomFile.js +65 -72
  5. package/components/CustomRadio/CustomRadio.js +13 -21
  6. package/components/CustomSelect/CustomSelect.js +32 -40
  7. package/components/CustomTable/CustomTable.js +7 -15
  8. package/components/CustomTextArea/CustomTextArea.js +4 -3
  9. package/components/CustomTextField/CustomTextField.js +7 -14
  10. package/components/Data/Data.js +15 -23
  11. package/components/DataChinaGrid/Data.js +2 -1
  12. package/components/DataChinaGridRow/Data.js +2 -1
  13. package/components/DataSource/DataSource.js +2 -1
  14. package/components/Department/Department.js +10 -17
  15. package/components/LocationInputTextField/LocationInputTextField.js +7 -14
  16. package/components/NocodbFile/NocodbFile.js +65 -72
  17. package/components/QrCode/QrCode.js +6 -13
  18. package/components/ScanInputTextField/ScanInputTextField.js +7 -14
  19. package/components/TaskCalendar/TaskCalendar.js +8 -16
  20. package/components/_classes/Department/Department.js +10 -17
  21. package/components/button/Button.js +2 -1
  22. package/components/echarts/ECharts.js +2 -1
  23. package/components/file/File.js +63 -71
  24. package/components/iconButton/IconButton.js +2 -1
  25. package/components/map/Map.js +14 -22
  26. package/components/progress/Progress.js +2 -1
  27. package/components/radio/Radio.js +45 -53
  28. package/components/select/Select.js +102 -110
  29. package/components/tree/Tree.js +10 -17
  30. package/dist/formio.contrib.js +2 -2
  31. package/dist/formio.contrib.min.js +1 -1
  32. package/dist/formio.contrib.min.js.LICENSE.txt +1 -1
  33. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  34. package/dist/formio.form.js +27 -27
  35. package/dist/formio.form.min.js +1 -1
  36. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  37. package/dist/formio.full.js +27 -27
  38. package/dist/formio.full.min.js +1 -1
  39. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  40. package/dist/formio.js +1 -1
  41. package/dist/formio.min.js +1 -1
  42. package/dist/formio.min.js.LICENSE.txt +1 -1
  43. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  44. package/package.json +1 -1
@@ -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 NocodbFile = /*#__PURE__*/function (_FileComponent) {
96
97
  try {
97
98
  options = JSON.parse(_this.parseTpl(options, {
98
99
  data: _this.rootValue
99
- }, null));
100
+ }));
100
101
  } catch (e) {
101
102
  console.log(e);
102
103
  }
@@ -140,27 +141,19 @@ var NocodbFile = /*#__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, fallback) {
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 _this2.get(path, map, fallback);
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 _this3 = this;
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 NocodbFile = /*#__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, _this3$component$opti, options, url, groupKey, groupPermissions, fileKey, groupResourceId, processedFile, fileProcessorHandler, filePromise;
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 NocodbFile = /*#__PURE__*/function (_FileComponent) {
191
184
  });
192
185
  case 3:
193
186
  hash = _context.sent;
194
- fileName = (0, _utils.uniqueName)(file.name, _this3.component.fileNameTemplate, _this3.evalContext());
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: _this3.t('Processing file. Please wait...'),
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 = _this3.dataValue.some(function (fileStatus) {
197
+ fileWithSameNameUploaded = _this2.dataValue.some(function (fileStatus) {
205
198
  return fileStatus.originalName === file.name;
206
199
  });
207
- fileWithSameNameUploadedWithError = _this3.statuses.findIndex(function (fileStatus) {
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 = _this3.t('File with the same name is already uploaded');
205
+ fileUpload.message = _this2.t('File with the same name is already uploaded');
213
206
  }
214
207
  if (fileWithSameNameUploadedWithError !== -1) {
215
- _this3.statuses.splice(fileWithSameNameUploadedWithError, 1);
216
- _this3.redraw();
208
+ _this2.statuses.splice(fileWithSameNameUploadedWithError, 1);
209
+ _this2.redraw();
217
210
  }
218
211
 
219
212
  // Check file pattern
220
- if (_this3.component.filePattern && !_this3.validatePattern(file, _this3.component.filePattern)) {
213
+ if (_this2.component.filePattern && !_this2.validatePattern(file, _this2.component.filePattern)) {
221
214
  fileUpload.status = 'error';
222
- fileUpload.message = _this3.t('File is the wrong type; it must be {{ pattern }}', {
223
- pattern: _this3.component.filePattern
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 (_this3.component.fileMinSize && !_this3.validateMinSize(file, _this3.component.fileMinSize)) {
221
+ if (_this2.component.fileMinSize && !_this2.validateMinSize(file, _this2.component.fileMinSize)) {
229
222
  fileUpload.status = 'error';
230
- fileUpload.message = _this3.t('File is too small; it must be at least {{ size }}', {
231
- size: _this3.component.fileMinSize
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 (_this3.component.fileMaxSize && !_this3.validateMaxSize(file, _this3.component.fileMaxSize)) {
229
+ if (_this2.component.fileMaxSize && !_this2.validateMaxSize(file, _this2.component.fileMaxSize)) {
237
230
  fileUpload.status = 'error';
238
- fileUpload.message = _this3.t('File is too big; it must be at most {{ size }}', {
239
- size: _this3.component.fileMaxSize
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 = _this3.interpolate(_this3.component.dir || '');
245
- fileService = _this3.fileService;
237
+ dir = _this2.interpolate(_this2.component.dir || '');
238
+ fileService = _this2.fileService;
246
239
  if (!fileService) {
247
240
  fileUpload.status = 'error';
248
- fileUpload.message = _this3.t('File Service not provided.');
241
+ fileUpload.message = _this2.t('File Service not provided.');
249
242
  }
250
- _this3.statuses.push(fileUpload);
251
- _this3.redraw();
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 (_this3.component.privateDownload) {
249
+ if (_this2.component.privateDownload) {
257
250
  file.private = true;
258
251
  }
259
- storage = _this3.component.storage;
260
- _this3$component$opti = _this3.component.options, options = _this3$component$opti === void 0 ? {} : _this3$component$opti;
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(_this3.parseTpl(options, {
263
- data: _this3.rootValue
264
- }, null));
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 = _this3.interpolate(_this3.component.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
- _this3.root.everyComponent(function (element) {
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 NocodbFile = /*#__PURE__*/function (_FileComponent) {
283
276
  });
284
277
  }
285
278
  });
286
- fileKey = _this3.component.fileKey || 'file';
287
- groupResourceId = groupKey ? _this3.currentForm.submission.data[groupKey]._id : null;
279
+ fileKey = _this2.component.fileKey || 'file';
280
+ groupResourceId = groupKey ? _this2.currentForm.submission.data[groupKey]._id : null;
288
281
  processedFile = null;
289
- if (!_this3.root.options.fileProcessor) {
282
+ if (!_this2.root.options.fileProcessor) {
290
283
  _context.next = 49;
291
284
  break;
292
285
  }
293
286
  _context.prev = 31;
294
- if (_this3.refs.fileProcessingLoader) {
295
- _this3.refs.fileProcessingLoader.style.display = 'block';
287
+ if (_this2.refs.fileProcessingLoader) {
288
+ _this2.refs.fileProcessingLoader.style.display = 'block';
296
289
  }
297
- fileProcessorHandler = (0, _fileProcessor.default)(_this3.fileService, _this3.root.options.fileProcessor);
290
+ fileProcessorHandler = (0, _fileProcessor.default)(_this2.fileService, _this2.root.options.fileProcessor);
298
291
  _context.next = 36;
299
- return fileProcessorHandler(file, _this3.component.properties);
292
+ return fileProcessorHandler(file, _this2.component.properties);
300
293
  case 36:
301
294
  processedFile = _context.sent;
302
295
  _context.next = 46;
@@ -305,60 +298,60 @@ var NocodbFile = /*#__PURE__*/function (_FileComponent) {
305
298
  _context.prev = 39;
306
299
  _context.t0 = _context["catch"](31);
307
300
  fileUpload.status = 'error';
308
- fileUpload.message = _this3.t('File processing has been failed.');
309
- _this3.fileDropHidden = false;
310
- _this3.redraw();
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 (_this3.refs.fileProcessingLoader) {
315
- _this3.refs.fileProcessingLoader.style.display = 'none';
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 = _this3.t('Starting upload.');
320
- _this3.redraw();
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
- _this3.redraw();
320
+ _this2.redraw();
328
321
  }, url, options, fileKey, groupPermissions, groupResourceId,
329
322
  // Upload start callback
330
323
  function () {
331
- _this3.emit('fileUploadingStart', filePromise);
324
+ _this2.emit('fileUploadingStart', filePromise);
332
325
  },
333
326
  // Abort upload callback
334
327
  function (abort) {
335
- return _this3.abortUpload = abort;
328
+ return _this2.abortUpload = abort;
336
329
  }).then(function (fileInfo) {
337
330
  if (fileInfo.data.length > 0) {
338
331
  fileInfo.data = fileInfo.data[0];
339
332
  }
340
- var index = _this3.statuses.indexOf(fileUpload);
333
+ var index = _this2.statuses.indexOf(fileUpload);
341
334
  if (index !== -1) {
342
- _this3.statuses.splice(index, 1);
335
+ _this2.statuses.splice(index, 1);
343
336
  }
344
337
  fileInfo.originalName = file.name;
345
338
  fileInfo.hash = fileUpload.hash;
346
339
  fileInfo.url = "".concat(url.split("/api/")[0], "/").concat(fileInfo.data.signedPath);
347
- if (!_this3.hasValue()) {
348
- _this3.dataValue = [];
340
+ if (!_this2.hasValue()) {
341
+ _this2.dataValue = [];
349
342
  }
350
- _this3.dataValue.push(fileInfo);
351
- _this3.fileDropHidden = false;
352
- _this3.redraw();
353
- _this3.triggerChange();
354
- _this3.emit('fileUploadingEnd', filePromise);
343
+ _this2.dataValue.push(fileInfo);
344
+ _this2.fileDropHidden = false;
345
+ _this2.redraw();
346
+ _this2.triggerChange();
347
+ _this2.emit('fileUploadingEnd', filePromise);
355
348
  }).catch(function (response) {
356
349
  fileUpload.status = 'error';
357
350
  fileUpload.message = typeof response === 'string' ? response : response.toString();
358
351
  delete fileUpload.progress;
359
- _this3.fileDropHidden = false;
360
- _this3.redraw();
361
- _this3.emit('fileUploadingEnd', filePromise);
352
+ _this2.fileDropHidden = false;
353
+ _this2.redraw();
354
+ _this2.emit('fileUploadingEnd', filePromise);
362
355
  });
363
356
  case 52:
364
357
  case "end":
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", {
12
12
  value: true
13
13
  });
14
14
  exports.default = void 0;
15
- require("core-js/modules/es.object.to-string.js");
16
15
  require("core-js/modules/es.regexp.exec.js");
17
16
  require("core-js/modules/es.string.replace.js");
18
17
  require("core-js/modules/es.string.trim.js");
@@ -21,9 +20,11 @@ require("core-js/modules/es.symbol.to-primitive.js");
21
20
  require("core-js/modules/es.date.to-primitive.js");
22
21
  require("core-js/modules/es.symbol.js");
23
22
  require("core-js/modules/es.symbol.description.js");
23
+ require("core-js/modules/es.object.to-string.js");
24
24
  require("core-js/modules/es.number.constructor.js");
25
25
  var _Field = _interopRequireDefault(require("../_classes/field/Field"));
26
26
  var _qrcodejs2Fix = _interopRequireDefault(require("qrcodejs2-fix"));
27
+ var _lodash = _interopRequireDefault(require("lodash"));
27
28
  var _QrCode = _interopRequireDefault(require("./QrCode.form"));
28
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
30
  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); }
@@ -82,21 +83,13 @@ var QrCode = /*#__PURE__*/function (_FieldComponent) {
82
83
  value: function getValue() {
83
84
  return this.component.value;
84
85
  }
85
- }, {
86
- key: "get",
87
- value: function get(path, obj) {
88
- var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
89
- return path.split('.').reduce(function (res, key) {
90
- return res[key] || fb;
91
- }, obj);
92
- }
93
86
  }, {
94
87
  key: "parseTpl",
95
- value: function parseTpl(template, map, fallback) {
96
- var _this = this;
88
+ value: function parseTpl(template, map) {
97
89
  return template.replace(/\$\{.+?}/g, function (match) {
90
+ var _$get;
98
91
  var path = match.substr(2, match.length - 3).trim();
99
- return _this.get(path, map, fallback);
92
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
100
93
  });
101
94
  }
102
95
 
@@ -114,7 +107,7 @@ var QrCode = /*#__PURE__*/function (_FieldComponent) {
114
107
  new _qrcodejs2Fix.default(canvas, {
115
108
  text: this.parseTpl(this.component.value, {
116
109
  data: this.rootValue
117
- }, null),
110
+ }),
118
111
  width: this.component.width,
119
112
  height: this.component.width,
120
113
  colorDark: '#000000',
@@ -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 _TextField = _interopRequireDefault(require("../textfield/TextField"));
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 ScanInputTextField = /*#__PURE__*/function (_TextFieldComponent) {
47
48
  return _super.call(this, component, options, data);
48
49
  }
49
50
  _createClass(ScanInputTextField, [{
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, fallback) {
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 _this.get(path, map, fallback);
56
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
64
57
  });
65
58
  }
66
59
  }, {
@@ -81,10 +74,10 @@ var ScanInputTextField = /*#__PURE__*/function (_TextFieldComponent) {
81
74
  try {
82
75
  parsedOptions = JSON.parse(this.parseTpl(options || '{"headers":{}}', {
83
76
  data: this.rootValue
84
- }, null));
77
+ }));
85
78
  parsedBody = JSON.parse(this.parseTpl(body || '{}', {
86
79
  data: this.rootValue
87
- }, null));
80
+ }));
88
81
  } catch (e) {
89
82
  console.log(e);
90
83
  }
@@ -123,22 +123,14 @@ var TaskCalendar = /*#__PURE__*/function (_Component) {
123
123
  return _this;
124
124
  }
125
125
  _createClass(TaskCalendar, [{
126
- key: "get",
127
- value: function get(path, obj) {
128
- var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
129
- return path.split('.').reduce(function (res, key) {
130
- return res[key] || fb;
131
- }, obj);
132
- }
133
- }, {
134
126
  key: "parseTpl",
135
- value: function parseTpl(template, map, fallback) {
136
- var _this2 = this;
127
+ value: function parseTpl(template, map) {
137
128
  if (template && template.length > 0) {
138
129
  try {
139
130
  return template.replace(/\$\{.+?}/g, function (match) {
131
+ var _$get;
140
132
  var path = match.substr(2, match.length - 3).trim();
141
- return _this2.get(path, map, fallback);
133
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
142
134
  });
143
135
  } catch (e) {
144
136
  console.log(e);
@@ -162,12 +154,12 @@ var TaskCalendar = /*#__PURE__*/function (_Component) {
162
154
  }, {
163
155
  key: "attach",
164
156
  value: function attach(element) {
165
- var _this3 = this;
157
+ var _this2 = this;
166
158
  var refs = {};
167
159
  this.loadRefs(element, refs);
168
160
  element.querySelector('#qr-code-container').style.width = '100%';
169
161
  setTimeout(function () {
170
- _this3.setValue('');
162
+ _this2.setValue('');
171
163
  }, 100);
172
164
  return _get(_getPrototypeOf(TaskCalendar.prototype), "attach", this).call(this, element);
173
165
  }
@@ -227,7 +219,7 @@ var TaskCalendar = /*#__PURE__*/function (_Component) {
227
219
  if (self.component['data-source-url']) {
228
220
  url = self.parseTpl(self.component['data-source-url'], {
229
221
  data: self.rootValue
230
- }, null);
222
+ });
231
223
  if (url.startsWith('http')) {
232
224
  url = new URL(url);
233
225
  } else {
@@ -239,7 +231,7 @@ var TaskCalendar = /*#__PURE__*/function (_Component) {
239
231
  self.component.request['headers'].forEach(function (header) {
240
232
  headers["".concat(header.key)] = self.parseTpl(header.value, {
241
233
  data: self.rootValue
242
- }, null);
234
+ });
243
235
  });
244
236
  // 搜索
245
237
  if (self.component['dataSource'] === 'url') {} else if (self.component['dataSource'] === 'noco_db') {
@@ -249,7 +241,7 @@ var TaskCalendar = /*#__PURE__*/function (_Component) {
249
241
  if (item.value && item.value.length > 0) {
250
242
  var conditionVal = self.parseTpl(item.value, {
251
243
  data: self.rootValue
252
- }, null);
244
+ });
253
245
  if (index === 0 && item.logical_operator === '~not') {
254
246
  where += "(".concat(item.name, ",").concat(item.operator, ",").concat(conditionVal, ")");
255
247
  } else {
@@ -19,10 +19,10 @@ Object.defineProperty(exports, "__esModule", {
19
19
  value: true
20
20
  });
21
21
  exports.default = void 0;
22
- require("core-js/modules/es.object.to-string.js");
23
22
  require("core-js/modules/es.regexp.exec.js");
24
23
  require("core-js/modules/es.string.replace.js");
25
24
  require("core-js/modules/es.string.trim.js");
25
+ require("core-js/modules/es.object.to-string.js");
26
26
  require("core-js/modules/web.dom-collections.for-each.js");
27
27
  require("core-js/modules/es.array.concat.js");
28
28
  require("core-js/modules/es.function.name.js");
@@ -31,6 +31,7 @@ require("core-js/modules/es.string.includes.js");
31
31
  require("core-js/modules/es.object.get-prototype-of.js");
32
32
  var _Formio = require("../../Formio");
33
33
  var _Field = _interopRequireDefault(require("../_classes/field/Field"));
34
+ var _lodash = _interopRequireDefault(require("lodash"));
34
35
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
36
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
36
37
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -60,20 +61,12 @@ var Data = /*#__PURE__*/function (_FieldComponent) {
60
61
  return _this;
61
62
  }
62
63
  _createClass(Data, [{
63
- key: "get",
64
- value: function get(path, obj) {
65
- var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
66
- return path.split('.').reduce(function (res, key) {
67
- return res[key] || fb;
68
- }, obj);
69
- }
70
- }, {
71
64
  key: "parseTpl",
72
- value: function parseTpl(template, map, fallback) {
73
- var _this2 = this;
65
+ value: function parseTpl(template, map) {
74
66
  return template.replace(/\$\{.+?}/g, function (match) {
67
+ var _$get;
75
68
  var path = match.substr(2, match.length - 3).trim();
76
- return _this2.get(path, map, fallback);
69
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
77
70
  });
78
71
  }
79
72
  }, {
@@ -92,7 +85,7 @@ var Data = /*#__PURE__*/function (_FieldComponent) {
92
85
  }, {
93
86
  key: "attach",
94
87
  value: function attach(element) {
95
- var _this3 = this;
88
+ var _this2 = this;
96
89
  var refs = {};
97
90
  var self = this;
98
91
  this.loadRefs(element, refs);
@@ -109,10 +102,10 @@ var Data = /*#__PURE__*/function (_FieldComponent) {
109
102
  try {
110
103
  parsedOptions = JSON.parse(this.parseTpl(options || '{"headers":{}}', {
111
104
  data: this.rootValue
112
- }, null));
105
+ }));
113
106
  parsedBody = JSON.parse(this.parseTpl(body || '{}', {
114
107
  data: this.rootValue
115
- }, null));
108
+ }));
116
109
  } catch (e) {
117
110
  console.log(e);
118
111
  }
@@ -154,10 +147,10 @@ var Data = /*#__PURE__*/function (_FieldComponent) {
154
147
  setTimeout(function () {
155
148
  self.setValue(self.initValue);
156
149
  }, 300);
157
- return _get(_getPrototypeOf(Data.prototype), "attach", _this3).call(_this3, element);
150
+ return _get(_getPrototypeOf(Data.prototype), "attach", _this2).call(_this2, element);
158
151
  }).catch(function (e) {
159
152
  self.isInitData = true;
160
- return _get(_getPrototypeOf(Data.prototype), "attach", _this3).call(_this3, element);
153
+ return _get(_getPrototypeOf(Data.prototype), "attach", _this2).call(_this2, element);
161
154
  });
162
155
  }
163
156
  // Allow basic component functionality to attach like field logic and tooltips.
@@ -333,6 +333,7 @@ var ButtonComponent = /*#__PURE__*/function (_Field) {
333
333
  key: "parseTpl",
334
334
  value: function parseTpl(template, map) {
335
335
  return template.replace(/\$\{.+?}/g, function (match) {
336
+ var _strTmp;
336
337
  var path = match.substr(2, match.length - 3).trim();
337
338
  var strTmp = _lodash.default.get(map, path);
338
339
  if (strTmp === undefined) {
@@ -342,7 +343,7 @@ var ButtonComponent = /*#__PURE__*/function (_Field) {
342
343
  strTmp = JSON.stringify(strTmp);
343
344
  }
344
345
  }
345
- return strTmp;
346
+ return (_strTmp = strTmp) !== null && _strTmp !== void 0 ? _strTmp : '--';
346
347
  });
347
348
  }
348
349
  }, {
@@ -91,8 +91,9 @@ var ECharts = /*#__PURE__*/function (_FieldComponent) {
91
91
  key: "parseTpl",
92
92
  value: function parseTpl(template, map) {
93
93
  return template.replace(/\$\{.+?}/g, function (match) {
94
+ var _$get;
94
95
  var path = match.substr(2, match.length - 3).trim();
95
- var strTmp = _lodash.default.get(map, path);
96
+ var strTmp = (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
96
97
  if (strTmp === undefined) {
97
98
  strTmp = null;
98
99
  } else {