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/components/file/File.js
CHANGED
|
@@ -681,27 +681,19 @@ var FileComponent = /*#__PURE__*/function (_Field) {
|
|
|
681
681
|
value: function validateMaxSize(file, val) {
|
|
682
682
|
return file.size - 0.1 <= this.translateScalars(val);
|
|
683
683
|
}
|
|
684
|
-
}, {
|
|
685
|
-
key: "get",
|
|
686
|
-
value: function get(path, obj) {
|
|
687
|
-
var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
|
|
688
|
-
return path.split('.').reduce(function (res, key) {
|
|
689
|
-
return res[key] || fb;
|
|
690
|
-
}, obj);
|
|
691
|
-
}
|
|
692
684
|
}, {
|
|
693
685
|
key: "parseTpl",
|
|
694
|
-
value: function parseTpl(template, map
|
|
695
|
-
var _this5 = this;
|
|
686
|
+
value: function parseTpl(template, map) {
|
|
696
687
|
return template.replace(/\$\{.+?}/g, function (match) {
|
|
688
|
+
var _$get;
|
|
697
689
|
var path = match.substr(2, match.length - 3).trim();
|
|
698
|
-
return
|
|
690
|
+
return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
|
|
699
691
|
});
|
|
700
692
|
}
|
|
701
693
|
}, {
|
|
702
694
|
key: "upload",
|
|
703
695
|
value: function upload(files) {
|
|
704
|
-
var
|
|
696
|
+
var _this5 = this;
|
|
705
697
|
// Only allow one upload if not multiple.
|
|
706
698
|
if (!this.component.multiple) {
|
|
707
699
|
if (this.statuses.length) {
|
|
@@ -716,7 +708,7 @@ var FileComponent = /*#__PURE__*/function (_Field) {
|
|
|
716
708
|
/* eslint-disable max-statements */
|
|
717
709
|
Array.prototype.forEach.call(files, /*#__PURE__*/function () {
|
|
718
710
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(file) {
|
|
719
|
-
var bmf, hash, fileName, escapedFileName, fileUpload, fileWithSameNameUploaded, fileWithSameNameUploadedWithError, dir, fileService, storage,
|
|
711
|
+
var bmf, hash, fileName, escapedFileName, fileUpload, fileWithSameNameUploaded, fileWithSameNameUploadedWithError, dir, fileService, storage, _this5$component$opti, options, url, groupKey, groupPermissions, fileKey, groupResourceId, processedFile, fileProcessorHandler, filePromise;
|
|
720
712
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
721
713
|
while (1) switch (_context.prev = _context.next) {
|
|
722
714
|
case 0:
|
|
@@ -732,86 +724,86 @@ var FileComponent = /*#__PURE__*/function (_Field) {
|
|
|
732
724
|
});
|
|
733
725
|
case 3:
|
|
734
726
|
hash = _context.sent;
|
|
735
|
-
fileName = (0, _utils.uniqueName)(file.name,
|
|
727
|
+
fileName = (0, _utils.uniqueName)(file.name, _this5.component.fileNameTemplate, _this5.evalContext());
|
|
736
728
|
escapedFileName = file.name ? file.name.replaceAll('<', '<').replaceAll('>', '>') : file.name;
|
|
737
729
|
fileUpload = {
|
|
738
730
|
originalName: escapedFileName,
|
|
739
731
|
name: fileName,
|
|
740
732
|
size: file.size,
|
|
741
733
|
status: 'info',
|
|
742
|
-
message:
|
|
734
|
+
message: _this5.t('Processing file. Please wait...'),
|
|
743
735
|
hash: hash
|
|
744
736
|
}; // Check if file with the same name is being uploaded
|
|
745
|
-
fileWithSameNameUploaded =
|
|
737
|
+
fileWithSameNameUploaded = _this5.dataValue.some(function (fileStatus) {
|
|
746
738
|
return fileStatus.originalName === file.name;
|
|
747
739
|
});
|
|
748
|
-
fileWithSameNameUploadedWithError =
|
|
740
|
+
fileWithSameNameUploadedWithError = _this5.statuses.findIndex(function (fileStatus) {
|
|
749
741
|
return fileStatus.originalName === file.name && fileStatus.status === 'error';
|
|
750
742
|
});
|
|
751
743
|
if (fileWithSameNameUploaded) {
|
|
752
744
|
fileUpload.status = 'error';
|
|
753
|
-
fileUpload.message =
|
|
745
|
+
fileUpload.message = _this5.t('File with the same name is already uploaded');
|
|
754
746
|
}
|
|
755
747
|
if (fileWithSameNameUploadedWithError !== -1) {
|
|
756
|
-
|
|
757
|
-
|
|
748
|
+
_this5.statuses.splice(fileWithSameNameUploadedWithError, 1);
|
|
749
|
+
_this5.redraw();
|
|
758
750
|
}
|
|
759
751
|
|
|
760
752
|
// Check file pattern
|
|
761
|
-
if (
|
|
753
|
+
if (_this5.component.filePattern && !_this5.validatePattern(file, _this5.component.filePattern)) {
|
|
762
754
|
fileUpload.status = 'error';
|
|
763
|
-
fileUpload.message =
|
|
764
|
-
pattern:
|
|
755
|
+
fileUpload.message = _this5.t('File is the wrong type; it must be {{ pattern }}', {
|
|
756
|
+
pattern: _this5.component.filePattern
|
|
765
757
|
});
|
|
766
758
|
}
|
|
767
759
|
|
|
768
760
|
// Check file minimum size
|
|
769
|
-
if (
|
|
761
|
+
if (_this5.component.fileMinSize && !_this5.validateMinSize(file, _this5.component.fileMinSize)) {
|
|
770
762
|
fileUpload.status = 'error';
|
|
771
|
-
fileUpload.message =
|
|
772
|
-
size:
|
|
763
|
+
fileUpload.message = _this5.t('File is too small; it must be at least {{ size }}', {
|
|
764
|
+
size: _this5.component.fileMinSize
|
|
773
765
|
});
|
|
774
766
|
}
|
|
775
767
|
|
|
776
768
|
// Check file maximum size
|
|
777
|
-
if (
|
|
769
|
+
if (_this5.component.fileMaxSize && !_this5.validateMaxSize(file, _this5.component.fileMaxSize)) {
|
|
778
770
|
fileUpload.status = 'error';
|
|
779
|
-
fileUpload.message =
|
|
780
|
-
size:
|
|
771
|
+
fileUpload.message = _this5.t('File is too big; it must be at most {{ size }}', {
|
|
772
|
+
size: _this5.component.fileMaxSize
|
|
781
773
|
});
|
|
782
774
|
}
|
|
783
775
|
|
|
784
776
|
// Get a unique name for this file to keep file collisions from occurring.
|
|
785
|
-
dir =
|
|
786
|
-
fileService =
|
|
777
|
+
dir = _this5.interpolate(_this5.component.dir || '');
|
|
778
|
+
fileService = _this5.fileService;
|
|
787
779
|
if (!fileService) {
|
|
788
780
|
fileUpload.status = 'error';
|
|
789
|
-
fileUpload.message =
|
|
781
|
+
fileUpload.message = _this5.t('File Service not provided.');
|
|
790
782
|
}
|
|
791
|
-
|
|
792
|
-
|
|
783
|
+
_this5.statuses.push(fileUpload);
|
|
784
|
+
_this5.redraw();
|
|
793
785
|
if (!(fileUpload.status !== 'error')) {
|
|
794
786
|
_context.next = 53;
|
|
795
787
|
break;
|
|
796
788
|
}
|
|
797
|
-
if (
|
|
789
|
+
if (_this5.component.privateDownload) {
|
|
798
790
|
file.private = true;
|
|
799
791
|
}
|
|
800
|
-
storage =
|
|
801
|
-
|
|
792
|
+
storage = _this5.component.storage;
|
|
793
|
+
_this5$component$opti = _this5.component.options, options = _this5$component$opti === void 0 ? {} : _this5$component$opti;
|
|
802
794
|
try {
|
|
803
|
-
options = JSON.parse(
|
|
804
|
-
data:
|
|
805
|
-
}
|
|
795
|
+
options = JSON.parse(_this5.parseTpl(options, {
|
|
796
|
+
data: _this5.rootValue
|
|
797
|
+
}));
|
|
806
798
|
} catch (e) {
|
|
807
799
|
console.log(e);
|
|
808
800
|
}
|
|
809
|
-
url =
|
|
801
|
+
url = _this5.interpolate(_this5.component.url, {
|
|
810
802
|
file: fileUpload
|
|
811
803
|
});
|
|
812
804
|
groupKey = null;
|
|
813
805
|
groupPermissions = null; //Iterate through form components to find group resource if one exists
|
|
814
|
-
|
|
806
|
+
_this5.root.everyComponent(function (element) {
|
|
815
807
|
var _element$component, _element$component2;
|
|
816
808
|
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) {
|
|
817
809
|
groupPermissions = !element.component.submissionAccess ? [{
|
|
@@ -823,20 +815,20 @@ var FileComponent = /*#__PURE__*/function (_Field) {
|
|
|
823
815
|
});
|
|
824
816
|
}
|
|
825
817
|
});
|
|
826
|
-
fileKey =
|
|
827
|
-
groupResourceId = groupKey ?
|
|
818
|
+
fileKey = _this5.component.fileKey || 'file';
|
|
819
|
+
groupResourceId = groupKey ? _this5.currentForm.submission.data[groupKey]._id : null;
|
|
828
820
|
processedFile = null;
|
|
829
|
-
if (!
|
|
821
|
+
if (!_this5.root.options.fileProcessor) {
|
|
830
822
|
_context.next = 50;
|
|
831
823
|
break;
|
|
832
824
|
}
|
|
833
825
|
_context.prev = 32;
|
|
834
|
-
if (
|
|
835
|
-
|
|
826
|
+
if (_this5.refs.fileProcessingLoader) {
|
|
827
|
+
_this5.refs.fileProcessingLoader.style.display = 'block';
|
|
836
828
|
}
|
|
837
|
-
fileProcessorHandler = (0, _fileProcessor.default)(
|
|
829
|
+
fileProcessorHandler = (0, _fileProcessor.default)(_this5.fileService, _this5.root.options.fileProcessor);
|
|
838
830
|
_context.next = 37;
|
|
839
|
-
return fileProcessorHandler(file,
|
|
831
|
+
return fileProcessorHandler(file, _this5.component.properties);
|
|
840
832
|
case 37:
|
|
841
833
|
processedFile = _context.sent;
|
|
842
834
|
_context.next = 47;
|
|
@@ -845,56 +837,56 @@ var FileComponent = /*#__PURE__*/function (_Field) {
|
|
|
845
837
|
_context.prev = 40;
|
|
846
838
|
_context.t0 = _context["catch"](32);
|
|
847
839
|
fileUpload.status = 'error';
|
|
848
|
-
fileUpload.message =
|
|
849
|
-
|
|
850
|
-
|
|
840
|
+
fileUpload.message = _this5.t('File processing has been failed.');
|
|
841
|
+
_this5.fileDropHidden = false;
|
|
842
|
+
_this5.redraw();
|
|
851
843
|
return _context.abrupt("return");
|
|
852
844
|
case 47:
|
|
853
845
|
_context.prev = 47;
|
|
854
|
-
if (
|
|
855
|
-
|
|
846
|
+
if (_this5.refs.fileProcessingLoader) {
|
|
847
|
+
_this5.refs.fileProcessingLoader.style.display = 'none';
|
|
856
848
|
}
|
|
857
849
|
return _context.finish(47);
|
|
858
850
|
case 50:
|
|
859
|
-
fileUpload.message =
|
|
860
|
-
|
|
851
|
+
fileUpload.message = _this5.t('Starting upload.');
|
|
852
|
+
_this5.redraw();
|
|
861
853
|
filePromise = fileService.uploadFile(storage, processedFile || file, fileName, dir,
|
|
862
854
|
// Progress callback
|
|
863
855
|
function (evt) {
|
|
864
856
|
fileUpload.status = 'progress';
|
|
865
857
|
fileUpload.progress = parseInt(100.0 * evt.loaded / evt.total);
|
|
866
858
|
delete fileUpload.message;
|
|
867
|
-
|
|
859
|
+
_this5.redraw();
|
|
868
860
|
}, url, options, fileKey, groupPermissions, groupResourceId,
|
|
869
861
|
// Upload start callback
|
|
870
862
|
function () {
|
|
871
|
-
|
|
863
|
+
_this5.emit('fileUploadingStart', filePromise);
|
|
872
864
|
},
|
|
873
865
|
// Abort upload callback
|
|
874
866
|
function (abort) {
|
|
875
|
-
return
|
|
867
|
+
return _this5.abortUpload = abort;
|
|
876
868
|
}).then(function (fileInfo) {
|
|
877
|
-
var index =
|
|
869
|
+
var index = _this5.statuses.indexOf(fileUpload);
|
|
878
870
|
if (index !== -1) {
|
|
879
|
-
|
|
871
|
+
_this5.statuses.splice(index, 1);
|
|
880
872
|
}
|
|
881
873
|
fileInfo.originalName = escapedFileName;
|
|
882
874
|
fileInfo.hash = fileUpload.hash;
|
|
883
|
-
if (!
|
|
884
|
-
|
|
875
|
+
if (!_this5.hasValue()) {
|
|
876
|
+
_this5.dataValue = [];
|
|
885
877
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
878
|
+
_this5.dataValue.push(fileInfo);
|
|
879
|
+
_this5.fileDropHidden = false;
|
|
880
|
+
_this5.redraw();
|
|
881
|
+
_this5.triggerChange();
|
|
882
|
+
_this5.emit('fileUploadingEnd', filePromise);
|
|
891
883
|
}).catch(function (response) {
|
|
892
884
|
fileUpload.status = 'error';
|
|
893
885
|
fileUpload.message = typeof response === 'string' ? response : response.toString();
|
|
894
886
|
delete fileUpload.progress;
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
887
|
+
_this5.fileDropHidden = false;
|
|
888
|
+
_this5.redraw();
|
|
889
|
+
_this5.emit('fileUploadingEnd', filePromise);
|
|
898
890
|
});
|
|
899
891
|
case 53:
|
|
900
892
|
case "end":
|
|
@@ -131,8 +131,9 @@ var IconButton = /*#__PURE__*/function (_FieldComponent) {
|
|
|
131
131
|
key: "parseTpl",
|
|
132
132
|
value: function parseTpl(template, map) {
|
|
133
133
|
return template.replace(/\$\{.+?}/g, function (match) {
|
|
134
|
+
var _$get;
|
|
134
135
|
var path = match.substr(2, match.length - 3).trim();
|
|
135
|
-
var strTmp = _lodash.default.get(map, path);
|
|
136
|
+
var strTmp = (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
|
|
136
137
|
if (strTmp === undefined) {
|
|
137
138
|
strTmp = null;
|
|
138
139
|
} else {
|
package/components/map/Map.js
CHANGED
|
@@ -9,13 +9,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
value: true
|
|
10
10
|
});
|
|
11
11
|
exports.default = void 0;
|
|
12
|
-
require("core-js/modules/es.object.to-string.js");
|
|
13
12
|
require("core-js/modules/es.regexp.exec.js");
|
|
14
13
|
require("core-js/modules/es.string.replace.js");
|
|
15
14
|
require("core-js/modules/es.string.trim.js");
|
|
16
15
|
require("core-js/modules/es.array.map.js");
|
|
17
16
|
require("core-js/modules/es.string.starts-with.js");
|
|
18
17
|
require("core-js/modules/es.array.iterator.js");
|
|
18
|
+
require("core-js/modules/es.object.to-string.js");
|
|
19
19
|
require("core-js/modules/es.string.iterator.js");
|
|
20
20
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
21
21
|
require("core-js/modules/web.url.js");
|
|
@@ -94,21 +94,13 @@ var Map = /*#__PURE__*/function (_FieldComponent) {
|
|
|
94
94
|
value: function getValue() {
|
|
95
95
|
return this.component.value;
|
|
96
96
|
}
|
|
97
|
-
}, {
|
|
98
|
-
key: "get",
|
|
99
|
-
value: function get(path, obj) {
|
|
100
|
-
var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
|
|
101
|
-
return path.split('.').reduce(function (res, key) {
|
|
102
|
-
return res[key] || fb;
|
|
103
|
-
}, obj);
|
|
104
|
-
}
|
|
105
97
|
}, {
|
|
106
98
|
key: "parseTpl",
|
|
107
|
-
value: function parseTpl(template, map
|
|
108
|
-
var _this2 = this;
|
|
99
|
+
value: function parseTpl(template, map) {
|
|
109
100
|
return template.replace(/\$\{.+?}/g, function (match) {
|
|
101
|
+
var _$get;
|
|
110
102
|
var path = match.substr(2, match.length - 3).trim();
|
|
111
|
-
return
|
|
103
|
+
return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
|
|
112
104
|
});
|
|
113
105
|
}
|
|
114
106
|
|
|
@@ -121,7 +113,7 @@ var Map = /*#__PURE__*/function (_FieldComponent) {
|
|
|
121
113
|
}, {
|
|
122
114
|
key: "setValue",
|
|
123
115
|
value: function setValue(value) {
|
|
124
|
-
var
|
|
116
|
+
var _this2 = this;
|
|
125
117
|
var self = this;
|
|
126
118
|
if (!self.element) {
|
|
127
119
|
return true;
|
|
@@ -149,7 +141,7 @@ var Map = /*#__PURE__*/function (_FieldComponent) {
|
|
|
149
141
|
if (self.component['data-source-url']) {
|
|
150
142
|
var url = self.parseTpl(self.component['data-source-url'], {
|
|
151
143
|
data: self.rootValue
|
|
152
|
-
}
|
|
144
|
+
});
|
|
153
145
|
if (url.startsWith('http')) {
|
|
154
146
|
url = new URL(url);
|
|
155
147
|
} else {
|
|
@@ -162,7 +154,7 @@ var Map = /*#__PURE__*/function (_FieldComponent) {
|
|
|
162
154
|
self.component.request['headers'].forEach(function (header) {
|
|
163
155
|
headers["".concat(header.key)] = self.parseTpl(header.value, {
|
|
164
156
|
data: self.rootValue
|
|
165
|
-
}
|
|
157
|
+
});
|
|
166
158
|
});
|
|
167
159
|
}
|
|
168
160
|
// 搜索
|
|
@@ -173,7 +165,7 @@ var Map = /*#__PURE__*/function (_FieldComponent) {
|
|
|
173
165
|
if (item.value && item.value.length > 0) {
|
|
174
166
|
var conditionVal = self.parseTpl(item.value, {
|
|
175
167
|
data: self.rootValue
|
|
176
|
-
}
|
|
168
|
+
});
|
|
177
169
|
if (index === 0 && item.logical_operator === '~not') {
|
|
178
170
|
where += "(".concat(item.name, ",").concat(item.operator, ",").concat(conditionVal, ")");
|
|
179
171
|
} else {
|
|
@@ -300,7 +292,7 @@ var Map = /*#__PURE__*/function (_FieldComponent) {
|
|
|
300
292
|
// 自定义中心点
|
|
301
293
|
var customCenter = self.parseTpl(self.component["customCenter"], {
|
|
302
294
|
data: self.rootValue
|
|
303
|
-
}
|
|
295
|
+
});
|
|
304
296
|
if (customCenter && customCenter.length > 0 && customCenter.split(',').length === 2) {
|
|
305
297
|
var lng, lat;
|
|
306
298
|
lng = customCenter.split(',')[0];
|
|
@@ -329,9 +321,9 @@ var Map = /*#__PURE__*/function (_FieldComponent) {
|
|
|
329
321
|
if (reqMethod === 'GET') {
|
|
330
322
|
xhr.send();
|
|
331
323
|
} else if (reqMethod === 'POST') {
|
|
332
|
-
var reqData = JSON.parse(
|
|
324
|
+
var reqData = JSON.parse(_this2.parseTpl(JSON.stringify(self.component.request['body']) || '{}', {
|
|
333
325
|
data: self.rootValue
|
|
334
|
-
}
|
|
326
|
+
}));
|
|
335
327
|
xhr.send(JSON.stringify(reqData));
|
|
336
328
|
}
|
|
337
329
|
} catch (e) {
|
|
@@ -346,14 +338,14 @@ var Map = /*#__PURE__*/function (_FieldComponent) {
|
|
|
346
338
|
var lng, lat;
|
|
347
339
|
var lnglat = self.parseTpl(self.component["data-source-value"], {
|
|
348
340
|
data: self.rootValue
|
|
349
|
-
}
|
|
341
|
+
});
|
|
350
342
|
if (lnglat && lnglat.length > 0 && lnglat.split(',').length === 2) {
|
|
351
343
|
lng = lnglat.split(',')[0];
|
|
352
344
|
lat = lnglat.split(',')[1];
|
|
353
345
|
}
|
|
354
346
|
var lnglatTitle = self.parseTpl(self.component["data-source-value-title"], {
|
|
355
347
|
data: self.rootValue
|
|
356
|
-
}
|
|
348
|
+
});
|
|
357
349
|
var markerList = [new AMap.Marker({
|
|
358
350
|
position: new AMap.LngLat(lng, lat),
|
|
359
351
|
//经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
|
|
@@ -418,7 +410,7 @@ var Map = /*#__PURE__*/function (_FieldComponent) {
|
|
|
418
410
|
// 自定义中心点
|
|
419
411
|
var customCenter = self.parseTpl(self.component["customCenter"], {
|
|
420
412
|
data: self.rootValue
|
|
421
|
-
}
|
|
413
|
+
});
|
|
422
414
|
if (customCenter && customCenter.length > 0 && customCenter.split(',').length === 2) {
|
|
423
415
|
var _lng2, _lat2;
|
|
424
416
|
_lng2 = customCenter.split(',')[0];
|
|
@@ -93,8 +93,9 @@ var Progress = /*#__PURE__*/function (_FieldComponent) {
|
|
|
93
93
|
key: "parseTpl",
|
|
94
94
|
value: function parseTpl(template, map) {
|
|
95
95
|
return template.replace(/\$\{.+?}/g, function (match) {
|
|
96
|
+
var _$get;
|
|
96
97
|
var path = match.substr(2, match.length - 3).trim();
|
|
97
|
-
var strTmp = _lodash.default.get(map, path);
|
|
98
|
+
var strTmp = (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
|
|
98
99
|
if (strTmp === undefined) {
|
|
99
100
|
strTmp = null;
|
|
100
101
|
} else {
|
|
@@ -16,13 +16,13 @@ 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");
|
|
23
22
|
require("core-js/modules/es.function.name.js");
|
|
24
23
|
require("core-js/modules/es.array.concat.js");
|
|
25
24
|
require("core-js/modules/es.array.iterator.js");
|
|
25
|
+
require("core-js/modules/es.object.to-string.js");
|
|
26
26
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
27
27
|
require("core-js/modules/web.dom-collections.for-each.js");
|
|
28
28
|
require("core-js/modules/es.regexp.to-string.js");
|
|
@@ -68,20 +68,12 @@ var RadioComponent = /*#__PURE__*/function (_ListComponent) {
|
|
|
68
68
|
return _this;
|
|
69
69
|
}
|
|
70
70
|
_createClass(RadioComponent, [{
|
|
71
|
-
key: "get",
|
|
72
|
-
value: function get(path, obj) {
|
|
73
|
-
var fb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "${".concat(path, "}");
|
|
74
|
-
return path.split('.').reduce(function (res, key) {
|
|
75
|
-
return res[key] || fb;
|
|
76
|
-
}, obj);
|
|
77
|
-
}
|
|
78
|
-
}, {
|
|
79
71
|
key: "parseTpl",
|
|
80
|
-
value: function parseTpl(template, map
|
|
81
|
-
var _this2 = this;
|
|
72
|
+
value: function parseTpl(template, map) {
|
|
82
73
|
return template.replace(/\$\{.+?}/g, function (match) {
|
|
74
|
+
var _$get;
|
|
83
75
|
var path = match.substr(2, match.length - 3).trim();
|
|
84
|
-
return
|
|
76
|
+
return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
|
|
85
77
|
});
|
|
86
78
|
}
|
|
87
79
|
}, {
|
|
@@ -127,7 +119,7 @@ var RadioComponent = /*#__PURE__*/function (_ListComponent) {
|
|
|
127
119
|
}, {
|
|
128
120
|
key: "init",
|
|
129
121
|
value: function init() {
|
|
130
|
-
var
|
|
122
|
+
var _this2 = this;
|
|
131
123
|
_get(_getPrototypeOf(RadioComponent.prototype), "init", this).call(this);
|
|
132
124
|
this.templateData = {};
|
|
133
125
|
this.validators = this.validators.concat(['select', 'onlyAvailableItems']);
|
|
@@ -139,15 +131,15 @@ var RadioComponent = /*#__PURE__*/function (_ListComponent) {
|
|
|
139
131
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
140
132
|
args[_key] = arguments[_key];
|
|
141
133
|
}
|
|
142
|
-
return
|
|
134
|
+
return _this2.updateItems.apply(_this2, args);
|
|
143
135
|
}, 100);
|
|
144
136
|
this.triggerUpdate = function () {
|
|
145
137
|
// Make sure we always resolve the previous promise before reassign it
|
|
146
|
-
if (typeof
|
|
147
|
-
|
|
138
|
+
if (typeof _this2.itemsLoadedResolve === 'function') {
|
|
139
|
+
_this2.itemsLoadedResolve();
|
|
148
140
|
}
|
|
149
|
-
|
|
150
|
-
|
|
141
|
+
_this2.itemsLoaded = new _nativePromiseOnly.default(function (resolve) {
|
|
142
|
+
_this2.itemsLoadedResolve = resolve;
|
|
151
143
|
});
|
|
152
144
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
153
145
|
args[_key2] = arguments[_key2];
|
|
@@ -158,7 +150,7 @@ var RadioComponent = /*#__PURE__*/function (_ListComponent) {
|
|
|
158
150
|
return triggerUpdate.apply(void 0, _toConsumableArray(updateArgs));
|
|
159
151
|
};
|
|
160
152
|
this.itemsLoaded = new _nativePromiseOnly.default(function (resolve) {
|
|
161
|
-
|
|
153
|
+
_this2.itemsLoadedResolve = resolve;
|
|
162
154
|
});
|
|
163
155
|
this.shouldLoad = true;
|
|
164
156
|
this.loadedOptions = [];
|
|
@@ -177,30 +169,30 @@ var RadioComponent = /*#__PURE__*/function (_ListComponent) {
|
|
|
177
169
|
}, {
|
|
178
170
|
key: "attach",
|
|
179
171
|
value: function attach(element) {
|
|
180
|
-
var
|
|
172
|
+
var _this3 = this;
|
|
181
173
|
this.loadRefs(element, {
|
|
182
174
|
input: 'multiple',
|
|
183
175
|
wrapper: 'multiple'
|
|
184
176
|
});
|
|
185
177
|
this.refs.input.forEach(function (input, index) {
|
|
186
|
-
|
|
187
|
-
|
|
178
|
+
_this3.addEventListener(input, _this3.inputInfo.changeEvent, function () {
|
|
179
|
+
_this3.updateValue(null, {
|
|
188
180
|
modified: true
|
|
189
181
|
});
|
|
190
182
|
});
|
|
191
|
-
if (
|
|
192
|
-
|
|
183
|
+
if (_this3.component.values[index]) {
|
|
184
|
+
_this3.addShortcut(input, _this3.component.values[index].shortcut);
|
|
193
185
|
}
|
|
194
|
-
if (
|
|
195
|
-
var dataValue =
|
|
196
|
-
if (!_lodash.default.isString(
|
|
197
|
-
dataValue = _lodash.default.toString(
|
|
186
|
+
if (_this3.isRadio) {
|
|
187
|
+
var dataValue = _this3.dataValue;
|
|
188
|
+
if (!_lodash.default.isString(_this3.dataValue)) {
|
|
189
|
+
dataValue = _lodash.default.toString(_this3.dataValue);
|
|
198
190
|
}
|
|
199
191
|
input.checked = dataValue === input.value;
|
|
200
|
-
|
|
192
|
+
_this3.addEventListener(input, 'keyup', function (event) {
|
|
201
193
|
if (event.key === ' ' && dataValue === input.value) {
|
|
202
194
|
event.preventDefault();
|
|
203
|
-
|
|
195
|
+
_this3.updateValue(null, {
|
|
204
196
|
modified: true
|
|
205
197
|
});
|
|
206
198
|
}
|
|
@@ -214,11 +206,11 @@ var RadioComponent = /*#__PURE__*/function (_ListComponent) {
|
|
|
214
206
|
}, {
|
|
215
207
|
key: "detach",
|
|
216
208
|
value: function detach(element) {
|
|
217
|
-
var
|
|
209
|
+
var _this4 = this;
|
|
218
210
|
if (element && this.refs.input) {
|
|
219
211
|
this.refs.input.forEach(function (input, index) {
|
|
220
|
-
if (
|
|
221
|
-
|
|
212
|
+
if (_this4.component.values[index]) {
|
|
213
|
+
_this4.removeShortcut(input, _this4.component.values[index].shortcut);
|
|
222
214
|
}
|
|
223
215
|
});
|
|
224
216
|
}
|
|
@@ -241,7 +233,7 @@ var RadioComponent = /*#__PURE__*/function (_ListComponent) {
|
|
|
241
233
|
}, {
|
|
242
234
|
key: "validateValueAvailability",
|
|
243
235
|
value: function validateValueAvailability(setting, value) {
|
|
244
|
-
var
|
|
236
|
+
var _this5 = this;
|
|
245
237
|
if (!(0, _utils.boolValue)(setting) || !value) {
|
|
246
238
|
return true;
|
|
247
239
|
}
|
|
@@ -249,7 +241,7 @@ var RadioComponent = /*#__PURE__*/function (_ListComponent) {
|
|
|
249
241
|
if (values) {
|
|
250
242
|
return values.findIndex(function (_ref) {
|
|
251
243
|
var optionValue = _ref.value;
|
|
252
|
-
return
|
|
244
|
+
return _this5.normalizeValue(optionValue) === value;
|
|
253
245
|
}) !== -1;
|
|
254
246
|
}
|
|
255
247
|
return false;
|
|
@@ -282,7 +274,7 @@ var RadioComponent = /*#__PURE__*/function (_ListComponent) {
|
|
|
282
274
|
}, {
|
|
283
275
|
key: "loadItems",
|
|
284
276
|
value: function loadItems(url, search, headers, options, method, body) {
|
|
285
|
-
var
|
|
277
|
+
var _this6 = this;
|
|
286
278
|
// Ensure we have a method and remove any body if method is get
|
|
287
279
|
method = method || 'GET';
|
|
288
280
|
if (method.toUpperCase() === 'GET') {
|
|
@@ -296,59 +288,59 @@ var RadioComponent = /*#__PURE__*/function (_ListComponent) {
|
|
|
296
288
|
try {
|
|
297
289
|
url = this.parseTpl(url, {
|
|
298
290
|
data: this.rootValue
|
|
299
|
-
}
|
|
291
|
+
});
|
|
300
292
|
} catch (e) {
|
|
301
293
|
console.log(e);
|
|
302
294
|
}
|
|
303
295
|
if (this.shouldLoad || url !== this.loadedUrl) {
|
|
304
296
|
this.loading = true;
|
|
305
297
|
_Formio.GlobalFormio.makeRequest(this.options.formio, 'select', url, method, body, options).then(function (response) {
|
|
306
|
-
|
|
307
|
-
|
|
298
|
+
_this6.loading = false;
|
|
299
|
+
_this6.error = null;
|
|
308
300
|
// If they provided select values, then we need to get them instead.
|
|
309
301
|
var items = response;
|
|
310
|
-
if (
|
|
311
|
-
items = _lodash.default.get(items,
|
|
302
|
+
if (_this6.component.selectValues) {
|
|
303
|
+
items = _lodash.default.get(items, _this6.component.selectValues, items) || [];
|
|
312
304
|
}
|
|
313
|
-
|
|
305
|
+
_this6.setItems(items);
|
|
314
306
|
// 缓存当前选项的url,判断下次是否刷新
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
307
|
+
_this6.loadedUrl = url;
|
|
308
|
+
_this6.shouldLoad = false;
|
|
309
|
+
_this6.redraw();
|
|
318
310
|
}).catch(function (err) {
|
|
319
311
|
console.log(err);
|
|
320
|
-
|
|
312
|
+
_this6.handleLoadingError(err);
|
|
321
313
|
});
|
|
322
314
|
}
|
|
323
315
|
}
|
|
324
316
|
}, {
|
|
325
317
|
key: "setItems",
|
|
326
318
|
value: function setItems(items) {
|
|
327
|
-
var
|
|
319
|
+
var _this7 = this;
|
|
328
320
|
this.loadedOptions = items === null || items === void 0 ? void 0 : items.map(function (item) {
|
|
329
321
|
return {
|
|
330
|
-
value: item[
|
|
331
|
-
label:
|
|
322
|
+
value: item[_this7.component.valueProperty],
|
|
323
|
+
label: _this7.itemTemplate(item, item[_this7.component.valueProperty])
|
|
332
324
|
};
|
|
333
325
|
});
|
|
334
326
|
}
|
|
335
327
|
}, {
|
|
336
328
|
key: "setSelectedClasses",
|
|
337
329
|
value: function setSelectedClasses() {
|
|
338
|
-
var
|
|
330
|
+
var _this8 = this;
|
|
339
331
|
if (this.refs.wrapper) {
|
|
340
332
|
//add/remove selected option class
|
|
341
333
|
var value = this.dataValue;
|
|
342
334
|
this.refs.wrapper.forEach(function (wrapper, index) {
|
|
343
|
-
var input =
|
|
335
|
+
var input = _this8.refs.input[index];
|
|
344
336
|
var checked = input.type === 'checkbox' ? value[input.value] : input.value.toString() === value.toString();
|
|
345
337
|
if (checked) {
|
|
346
338
|
//add class to container when selected
|
|
347
|
-
|
|
339
|
+
_this8.addClass(wrapper, _this8.optionSelectedClass);
|
|
348
340
|
//change "checked" attribute
|
|
349
341
|
input.setAttribute('checked', 'true');
|
|
350
342
|
} else {
|
|
351
|
-
|
|
343
|
+
_this8.removeClass(wrapper, _this8.optionSelectedClass);
|
|
352
344
|
input.removeAttribute('checked');
|
|
353
345
|
}
|
|
354
346
|
});
|