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
@@ -16,7 +16,6 @@ Object.defineProperty(exports, "__esModule", {
16
16
  value: true
17
17
  });
18
18
  exports.default = void 0;
19
- require("core-js/modules/es.object.to-string.js");
20
19
  require("core-js/modules/es.regexp.exec.js");
21
20
  require("core-js/modules/es.string.replace.js");
22
21
  require("core-js/modules/es.string.trim.js");
@@ -25,6 +24,7 @@ require("core-js/modules/es.array.sort.js");
25
24
  require("core-js/modules/es.array.includes.js");
26
25
  require("core-js/modules/es.string.includes.js");
27
26
  require("core-js/modules/es.array.filter.js");
27
+ require("core-js/modules/es.object.to-string.js");
28
28
  require("core-js/modules/web.dom-collections.for-each.js");
29
29
  require("core-js/modules/es.object.keys.js");
30
30
  require("core-js/modules/es.number.constructor.js");
@@ -61,26 +61,18 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
61
61
  return _super.call(this, component, options, data);
62
62
  }
63
63
  _createClass(CustomSelect, [{
64
- key: "get",
65
- value: function get(path, obj) {
66
- var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
67
- return path.split('.').reduce(function (res, key) {
68
- return res[key] || fb;
69
- }, obj);
70
- }
71
- }, {
72
64
  key: "parseTpl",
73
- value: function parseTpl(template, map, fallback) {
74
- var _this = this;
65
+ value: function parseTpl(template, map) {
75
66
  return template.replace(/\$\{.+?}/g, function (match) {
67
+ var _$get;
76
68
  var path = match.substr(2, match.length - 3).trim();
77
- return _this.get(path, map, fallback);
69
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
78
70
  });
79
71
  }
80
72
  }, {
81
73
  key: "loadItems",
82
74
  value: function loadItems(url, search, headers, options, method, body) {
83
- var _this2 = this;
75
+ var _this = this;
84
76
  options = options || {};
85
77
 
86
78
  // See if we should load items or not.
@@ -142,7 +134,7 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
142
134
  if (!_lodash.default.isEmpty(query)) {
143
135
  // Add the query string.
144
136
  url += (!url.includes('?') ? '?' : '&') + _Formio.GlobalFormio.serialize(query, function (item) {
145
- return _this2.interpolate(item);
137
+ return _this.interpolate(item);
146
138
  });
147
139
  }
148
140
 
@@ -160,10 +152,10 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
160
152
  try {
161
153
  parsedOptions = JSON.parse(this.parseTpl(JSON.stringify(options), {
162
154
  data: this.rootValue
163
- }, null));
155
+ }));
164
156
  parsedBody = JSON.parse(this.parseTpl(JSON.stringify(body), {
165
157
  data: this.rootValue
166
- }, null));
158
+ }));
167
159
  }
168
160
  // eslint-disable-next-line no-empty
169
161
  catch (e) {}
@@ -172,7 +164,7 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
172
164
  headers.forEach(function (value, name) {
173
165
  headers.set(name, self.parseTpl(value, {
174
166
  data: self.rootValue
175
- }, null));
167
+ }));
176
168
  });
177
169
  parsedOptions.header = headers;
178
170
  this.loading = true;
@@ -181,28 +173,28 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
181
173
  url: url
182
174
  }), {
183
175
  data: this.rootValue
184
- }, null)).url;
176
+ })).url;
185
177
  } catch (e) {}
186
178
  _Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, parsedBody, parsedOptions).then(function (response) {
187
- _this2.loading = false;
188
- _this2.error = null;
189
- _this2.setItems(response, !!search);
179
+ _this.loading = false;
180
+ _this.error = null;
181
+ _this.setItems(response, !!search);
190
182
  }).catch(function (err) {
191
183
  console.log(err);
192
- if (_this2.itemsFromUrl) {
184
+ if (_this.itemsFromUrl) {
193
185
  console.log('err');
194
- _this2.setItems([], null);
195
- _this2.disableInfiniteScroll();
186
+ _this.setItems([], null);
187
+ _this.disableInfiniteScroll();
196
188
  }
197
- _this2.isScrollLoading = false;
198
- _this2.handleLoadingError(err);
189
+ _this.isScrollLoading = false;
190
+ _this.handleLoadingError(err);
199
191
  });
200
192
  }
201
193
  }, {
202
194
  key: "normalizeSingleValue",
203
195
  value: function normalizeSingleValue(value, retainObject) {
204
196
  var _this$root,
205
- _this3 = this;
197
+ _this2 = this;
206
198
  if (_lodash.default.isNil(value)) {
207
199
  return;
208
200
  }
@@ -221,7 +213,7 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
221
213
  submission.metadata.selectData = {};
222
214
  }
223
215
  var selectedTemplateData = _lodash.default.pickBy(this.templateData, function (value, key) {
224
- var dataValues = _lodash.default.isArray(_this3.dataValue) ? _this3.dataValue : [_this3.dataValue];
216
+ var dataValues = _lodash.default.isArray(_this2.dataValue) ? _this2.dataValue : [_this2.dataValue];
225
217
  return _lodash.default.includes(dataValues, key);
226
218
  });
227
219
  _lodash.default.set(submission.metadata.selectData, this.path, _lodash.default.cloneDeep(selectedTemplateData));
@@ -326,16 +318,16 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
326
318
  }, {
327
319
  key: "normalizeValue",
328
320
  value: function normalizeValue(value) {
329
- var _this4 = this;
321
+ var _this3 = this;
330
322
  if (this.component.multiple && Array.isArray(value)) {
331
323
  var dataType = this.component.dataType || 'auto';
332
324
  if (dataType === 'stringarray') {
333
325
  return value.map(function (singleValue) {
334
- return _this4.normalizeSingleValue(singleValue, true);
326
+ return _this3.normalizeSingleValue(singleValue, true);
335
327
  }).join(',');
336
328
  } else {
337
329
  return value.map(function (singleValue) {
338
- return _this4.normalizeSingleValue(singleValue, true);
330
+ return _this3.normalizeSingleValue(singleValue, true);
339
331
  });
340
332
  }
341
333
  }
@@ -381,7 +373,7 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
381
373
  }, {
382
374
  key: "setValue",
383
375
  value: function setValue(value) {
384
- var _this5 = this;
376
+ var _this4 = this;
385
377
  var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
386
378
  fromSubmission: false,
387
379
  noUpdateEvent: false
@@ -425,7 +417,7 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
425
417
  }
426
418
  if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {
427
419
  this.itemsLoaded.then(function () {
428
- _this5.redraw();
420
+ _this4.redraw();
429
421
  });
430
422
  return changed;
431
423
  }
@@ -446,8 +438,8 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
446
438
 
447
439
  // Add the value options.
448
440
  this.itemsLoaded.then(function () {
449
- _this5.addValueOptions();
450
- _this5.setChoicesValue(value, hasPreviousValue, flags);
441
+ _this4.addValueOptions();
442
+ _this4.setChoicesValue(value, hasPreviousValue, flags);
451
443
  });
452
444
  return changed;
453
445
  }
@@ -456,7 +448,7 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
456
448
  }, {
457
449
  key: "setItems",
458
450
  value: function setItems(items, fromSearch) {
459
- var _this6 = this,
451
+ var _this5 = this,
460
452
  _this$choices,
461
453
  _this$choices$input;
462
454
  // If the items is a string, then parse as JSON.
@@ -509,7 +501,7 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
509
501
  if (!_lodash.default.isEmpty(this.dataValue) && this.component.idPath) {
510
502
  var selectedOptionId = _lodash.default.get(this.dataValue, this.component.idPath, null);
511
503
  var newOptionWithSameId = !_lodash.default.isNil(selectedOptionId) && items.find(function (item) {
512
- var itemId = _lodash.default.get(item, _this6.component.idPath);
504
+ var itemId = _lodash.default.get(item, _this5.component.idPath);
513
505
  return itemId === selectedOptionId;
514
506
  });
515
507
  if (newOptionWithSameId) {
@@ -529,9 +521,9 @@ var CustomSelect = /*#__PURE__*/function (_SelectComponent) {
529
521
  // Iterate through each of the items.
530
522
  _lodash.default.each(items, function (item, index) {
531
523
  // preventing references of the components inside the form to the parent form when building forms
532
- if (_this6.root && _this6.root.options.editForm && _this6.root.options.editForm._id && _this6.root.options.editForm._id === item._id) return;
533
- var itemValueAndLabel = _this6.selectValueAndLabel(item);
534
- _this6.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _lodash.default.get(item, _this6.component.idPath, String(index)));
524
+ if (_this5.root && _this5.root.options.editForm && _this5.root.options.editForm._id && _this5.root.options.editForm._id === item._id) return;
525
+ var itemValueAndLabel = _this5.selectValueAndLabel(item);
526
+ _this5.addOption(itemValueAndLabel.value, itemValueAndLabel.label, {}, _lodash.default.get(item, _this5.component.idPath, String(index)));
535
527
  });
536
528
  if (this.choices) {
537
529
  this.choices.setChoices(this.selectOptions.filter(function (option) {
@@ -497,23 +497,15 @@ var CustomTableComponent = /*#__PURE__*/function (_FieldComponent) {
497
497
  value: function render() {
498
498
  return _get(_getPrototypeOf(CustomTableComponent.prototype), "render", this).call(this, this.renderTemplate('emptyTable'));
499
499
  }
500
- }, {
501
- key: "get",
502
- value: function get(path, obj) {
503
- var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
504
- return path.split('.').reduce(function (res, key) {
505
- return res[key] || fb;
506
- }, obj);
507
- }
508
500
  }, {
509
501
  key: "parseTpl",
510
- value: function parseTpl(template, map, fallback) {
511
- var _this2 = this;
502
+ value: function parseTpl(template, map) {
512
503
  if (template && template.length > 0) {
513
504
  try {
514
505
  return template.replace(/\$\{.+?}/g, function (match) {
506
+ var _$get;
515
507
  var path = match.substr(2, match.length - 3).trim();
516
- return _this2.get(path, map, fallback);
508
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
517
509
  });
518
510
  } catch (e) {
519
511
  console.log(e);
@@ -524,7 +516,7 @@ var CustomTableComponent = /*#__PURE__*/function (_FieldComponent) {
524
516
  }, {
525
517
  key: "attach",
526
518
  value: function attach(element) {
527
- var _this3 = this;
519
+ var _this2 = this;
528
520
  var refs = {
529
521
  placeTable: 'single',
530
522
  tableEmpty: 'single',
@@ -534,7 +526,7 @@ var CustomTableComponent = /*#__PURE__*/function (_FieldComponent) {
534
526
  };
535
527
  this.loadRefs(element, refs);
536
528
  setTimeout(function () {
537
- _this3.setValue('');
529
+ _this2.setValue('');
538
530
  }, 100);
539
531
  return _get(_getPrototypeOf(CustomTableComponent.prototype), "attach", this).call(this, element);
540
532
  }
@@ -566,7 +558,7 @@ var CustomTableComponent = /*#__PURE__*/function (_FieldComponent) {
566
558
  try {
567
559
  headers = this.parseTpl(this.component.data.headers, {
568
560
  data: this.rootValue
569
- }, null);
561
+ });
570
562
  if (typeof headers === 'string') {
571
563
  headers = JSON.parse(headers);
572
564
  }
@@ -581,7 +573,7 @@ var CustomTableComponent = /*#__PURE__*/function (_FieldComponent) {
581
573
  url: this.component.data.url
582
574
  }), {
583
575
  data: self.rootValue
584
- }, null)).url;
576
+ })).url;
585
577
  this.getField(url, function (data) {
586
578
  self.setTableByData(data);
587
579
  }, headers);
@@ -51,8 +51,9 @@ var CustomTextArea = /*#__PURE__*/function (_TextAreaComponent) {
51
51
  key: "parseTpl",
52
52
  value: function parseTpl(template, map) {
53
53
  return template.replace(/\$\{.+?}/g, function (match) {
54
+ var _$get;
54
55
  var path = match.substr(2, match.length - 3).trim();
55
- return _lodash.default.get(map, path);
56
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
56
57
  });
57
58
  }
58
59
  }, {
@@ -86,10 +87,10 @@ var CustomTextArea = /*#__PURE__*/function (_TextAreaComponent) {
86
87
  try {
87
88
  parsedOptions = JSON.parse(this.parseTpl(options || '{"headers":{}}', {
88
89
  data: this.rootValue
89
- }, null));
90
+ }));
90
91
  parsedBody = JSON.parse(this.parseTpl(body || '{}', {
91
92
  data: this.rootValue
92
- }, null));
93
+ }));
93
94
  } catch (e) {
94
95
  console.log(e);
95
96
  }
@@ -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 CustomTextField = /*#__PURE__*/function (_TextFieldComponent) {
47
48
  return _super.call(this, component, options, data);
48
49
  }
49
50
  _createClass(CustomTextField, [{
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 CustomTextField = /*#__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
  }
@@ -190,23 +190,15 @@ var Data = /*#__PURE__*/function (_Component) {
190
190
  }, 100);
191
191
  return _get(_getPrototypeOf(Data.prototype), "attach", this).call(this, element);
192
192
  }
193
- }, {
194
- key: "get",
195
- value: function get(path, obj) {
196
- var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
197
- return path.split('.').reduce(function (res, key) {
198
- return res[key] || fb;
199
- }, obj);
200
- }
201
193
  }, {
202
194
  key: "parseTpl",
203
- value: function parseTpl(template, map, fallback) {
204
- var _this3 = this;
195
+ value: function parseTpl(template, map) {
205
196
  if (template && template.length > 0) {
206
197
  try {
207
198
  return template.replace(/\$\{.+?}/g, function (match) {
199
+ var _$get;
208
200
  var path = match.substr(2, match.length - 3).trim();
209
- return _this3.get(path, map, fallback);
201
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
210
202
  });
211
203
  } catch (e) {
212
204
  console.log(e);
@@ -235,7 +227,7 @@ var Data = /*#__PURE__*/function (_Component) {
235
227
  }, {
236
228
  key: "setValue",
237
229
  value: function setValue(value) {
238
- var _this4 = this;
230
+ var _this3 = this;
239
231
  var self = this;
240
232
  try {
241
233
  var _this$component$icon, _this$component$icon2, _this$component$value, _this$component$value2;
@@ -262,12 +254,12 @@ var Data = /*#__PURE__*/function (_Component) {
262
254
  if (this.component['value-url']) {
263
255
  var url = this.parseTpl(this.component['value-url'], {
264
256
  data: this.rootValue
265
- }, null);
257
+ });
266
258
  var headers = {};
267
259
  try {
268
260
  headers = this.parseTpl(this.component['value-headers'], {
269
261
  data: this.rootValue
270
- }, null);
262
+ });
271
263
  if (typeof headers === 'string') {
272
264
  headers = JSON.parse(headers);
273
265
  }
@@ -279,9 +271,9 @@ var Data = /*#__PURE__*/function (_Component) {
279
271
  var newValueHeaders = this.component['new-value-headers'];
280
272
  newValueHeaders.forEach(function (header) {
281
273
  if (header.key && header.key.length > 0 && header.value && header.value.length > 0) {
282
- headers["".concat(header.key)] = _this4.parseTpl(header.value, {
283
- data: _this4.rootValue
284
- }, null);
274
+ headers["".concat(header.key)] = _this3.parseTpl(header.value, {
275
+ data: _this3.rootValue
276
+ });
285
277
  }
286
278
  });
287
279
  }
@@ -295,7 +287,7 @@ var Data = /*#__PURE__*/function (_Component) {
295
287
  if (this.component['subValue-url']) {
296
288
  var _url = this.parseTpl(this.component['subValue-url'], {
297
289
  data: this.rootValue
298
- }, null);
290
+ });
299
291
  this.getField(_url, this.component['subValue-field'], function (field) {
300
292
  container.querySelector('.unit-container').textContent = field;
301
293
  }, {});
@@ -326,12 +318,12 @@ var Data = /*#__PURE__*/function (_Component) {
326
318
  // url
327
319
  var _url2 = this.parseTpl(this.component['sparkLine-url'], {
328
320
  data: this.rootValue
329
- }, null);
321
+ });
330
322
  var _headers = {};
331
323
  try {
332
324
  _headers = self.parseTpl(self.component['sparkLine-headers'], {
333
325
  data: self.rootValue
334
- }, null);
326
+ });
335
327
  if (typeof _headers === 'string') {
336
328
  _headers = JSON.parse(_headers);
337
329
  }
@@ -343,9 +335,9 @@ var Data = /*#__PURE__*/function (_Component) {
343
335
  var _newValueHeaders = this.component['new-sparkLine-headers'];
344
336
  _newValueHeaders.forEach(function (header) {
345
337
  if (header.key && header.key.length > 0 && header.value && header.value.length > 0) {
346
- _headers["".concat(header.key)] = _this4.parseTpl(header.value, {
347
- data: _this4.rootValue
348
- }, null);
338
+ _headers["".concat(header.key)] = _this3.parseTpl(header.value, {
339
+ data: _this3.rootValue
340
+ });
349
341
  }
350
342
  });
351
343
  }
@@ -130,8 +130,9 @@ var DataChinaGrid = /*#__PURE__*/function (_Component) {
130
130
  if (template && template.length > 0) {
131
131
  try {
132
132
  return template.replace(/\$\{.+?}/g, function (match) {
133
+ var _$get;
133
134
  var path = match.substr(2, match.length - 3).trim();
134
- return _lodash.default.get(map, path);
135
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
135
136
  });
136
137
  } catch (e) {
137
138
  console.log(e);
@@ -131,8 +131,9 @@ var DataChinaGridRow = /*#__PURE__*/function (_Component) {
131
131
  if (template && template.length > 0) {
132
132
  try {
133
133
  return template.replace(/\$\{.+?}/g, function (match) {
134
+ var _$get;
134
135
  var path = match.substr(2, match.length - 3).trim();
135
- return _lodash.default.get(map, path);
136
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
136
137
  });
137
138
  } catch (e) {
138
139
  console.log(e);
@@ -184,8 +184,9 @@ var DataSourceComponent = /*#__PURE__*/function (_FieldComponent) {
184
184
  if (template && template.length > 0) {
185
185
  try {
186
186
  return template.replace(/\$\{.+?}/g, function (match) {
187
+ var _$get;
187
188
  var path = match.substr(2, match.length - 3).trim();
188
- return _lodash.default.get(map, path);
189
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
189
190
  });
190
191
  } catch (e) {
191
192
  console.log(e);
@@ -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.
@@ -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.array.concat.js");
25
25
  require("core-js/modules/es.object.get-prototype-of.js");
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 LocationInputTextField = /*#__PURE__*/function (_TextFieldComponent) {
47
48
  return _super.call(this, component, options, data);
48
49
  }
49
50
  _createClass(LocationInputTextField, [{
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
  }, {
@@ -86,7 +79,7 @@ var LocationInputTextField = /*#__PURE__*/function (_TextFieldComponent) {
86
79
  var geocoder = new AMap.Geocoder({});
87
80
  var address = self.parseTpl(self.component['source-form'], {
88
81
  data: self.rootValue
89
- }, null);
82
+ });
90
83
  geocoder.getLocation(address, function (status, result) {
91
84
  if (status === "complete" && result.info === "OK") {
92
85
  // result中对应详细地理坐标信息
@@ -115,7 +108,7 @@ var LocationInputTextField = /*#__PURE__*/function (_TextFieldComponent) {
115
108
  var geocoder = new AMap.Geocoder({});
116
109
  var address = self.parseTpl(self.component['source-form'], {
117
110
  data: self.rootValue
118
- }, null);
111
+ });
119
112
  geocoder.getLocation(address, function (status, result) {
120
113
  if (status === "complete" && result.info === "OK") {
121
114
  // result中对应详细地理坐标信息