formiojs-eorion 0.1.15 → 0.1.16
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/DataSource/DataSource.js +94 -86
- package/components/_classes/component/Component.js +11 -0
- package/components/_classes/component/editForm/Component.edit.data.js +1 -0
- package/components/echarts/ECharts.js +1 -1
- package/components/progress/Progress.js +1 -1
- package/dist/formio.contrib.js +3 -3
- 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 +8 -8
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +8 -8
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/package.json +1 -1
package/Formio.js
CHANGED
|
@@ -1724,7 +1724,7 @@ Formio.projectUrlSet = false;
|
|
|
1724
1724
|
Formio.plugins = [];
|
|
1725
1725
|
Formio.cache = {};
|
|
1726
1726
|
Formio.Providers = _providers.default;
|
|
1727
|
-
Formio.version = '0.1.
|
|
1727
|
+
Formio.version = '0.1.16';
|
|
1728
1728
|
Formio.pathType = '';
|
|
1729
1729
|
Formio.events = new _EventEmitter.default();
|
|
1730
1730
|
Formio.cdn = new _CDN.default();
|
|
@@ -162,7 +162,7 @@ var DataSourceComponent = /*#__PURE__*/function (_FieldComponent) {
|
|
|
162
162
|
}
|
|
163
163
|
if (this.component.dataSource !== "file") {
|
|
164
164
|
setTimeout(function () {
|
|
165
|
-
_this.setValue(
|
|
165
|
+
_this.setValue(null);
|
|
166
166
|
}, 100);
|
|
167
167
|
}
|
|
168
168
|
return _get(_getPrototypeOf(DataSourceComponent.prototype), "attach", this).call(this, element);
|
|
@@ -197,104 +197,112 @@ var DataSourceComponent = /*#__PURE__*/function (_FieldComponent) {
|
|
|
197
197
|
key: "setValue",
|
|
198
198
|
value: function setValue(value) {
|
|
199
199
|
var self = this;
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
data: self.rootValue
|
|
200
|
+
if (value) {
|
|
201
|
+
_get(_getPrototypeOf(DataSourceComponent.prototype), "setValue", this).call(this, value, {
|
|
202
|
+
noUpdateEvent: true,
|
|
203
|
+
noValidate: true,
|
|
204
|
+
resetValue: true
|
|
206
205
|
});
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
url = new URL(url, window.location.origin);
|
|
206
|
+
} else {
|
|
207
|
+
if (self.component['dataSource'] === 'file') {
|
|
208
|
+
return true;
|
|
211
209
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
var headers = {};
|
|
215
|
-
self.component.request['headers'].forEach(function (header) {
|
|
216
|
-
headers["".concat(header.key)] = self.parseTpl(header.value, {
|
|
210
|
+
if (self.component['data-source-url']) {
|
|
211
|
+
var url = self.parseTpl(self.component['data-source-url'], {
|
|
217
212
|
data: self.rootValue
|
|
218
213
|
});
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
var where = '';
|
|
224
|
-
self.component.data['noco_db_conditions'].forEach(function (item, index) {
|
|
225
|
-
if (item.value && item.value.length > 0) {
|
|
226
|
-
var conditionVal = self.parseTpl(item.value, {
|
|
227
|
-
data: self.rootValue
|
|
228
|
-
});
|
|
229
|
-
if (index === 0 && item.logical_operator === '~not') {
|
|
230
|
-
where += "(".concat(item.name, ",").concat(item.operator, ",").concat(conditionVal, ")");
|
|
231
|
-
} else {
|
|
232
|
-
where += "".concat(item.logical_operator, "(").concat(item.name, ",").concat(item.operator, ",").concat(conditionVal, ")");
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
params.where = where;
|
|
214
|
+
if (url.startsWith('http')) {
|
|
215
|
+
url = new URL(url);
|
|
216
|
+
} else {
|
|
217
|
+
url = new URL(url, window.location.origin);
|
|
237
218
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
self.lastestReqTime = lastestReqTime;
|
|
245
|
-
var xhr = new XMLHttpRequest();
|
|
246
|
-
var reqMethod = self.component.request['method'];
|
|
247
|
-
if (reqMethod === 'GET') {
|
|
248
|
-
xhr.open('GET', "".concat(url.origin).concat(url.pathname, "?").concat(searchParams.toString()), true);
|
|
249
|
-
xhr.responseType = 'json';
|
|
250
|
-
Object.keys(headers).forEach(function (key) {
|
|
251
|
-
xhr.setRequestHeader(key, headers["".concat(key)]);
|
|
252
|
-
});
|
|
253
|
-
} else if (reqMethod === 'POST') {
|
|
254
|
-
xhr.open('POST', "".concat(url.origin).concat(url.pathname, "?").concat(searchParams.toString()), true);
|
|
255
|
-
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
256
|
-
xhr.responseType = 'json';
|
|
257
|
-
Object.keys(headers).forEach(function (key) {
|
|
258
|
-
xhr.setRequestHeader(key, headers["".concat(key)]);
|
|
219
|
+
var searchParams = new URLSearchParams(url.search);
|
|
220
|
+
var params = {};
|
|
221
|
+
var headers = {};
|
|
222
|
+
self.component.request['headers'].forEach(function (header) {
|
|
223
|
+
headers["".concat(header.key)] = self.parseTpl(header.value, {
|
|
224
|
+
data: self.rootValue
|
|
259
225
|
});
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
if (
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
226
|
+
});
|
|
227
|
+
// 搜索
|
|
228
|
+
if (self.component['dataSource'] === 'url') {} else if (self.component['dataSource'] === 'noco_db') {
|
|
229
|
+
if (self.component.data['noco_db_conditions']) {
|
|
230
|
+
var where = '';
|
|
231
|
+
self.component.data['noco_db_conditions'].forEach(function (item, index) {
|
|
232
|
+
if (item.value && item.value.length > 0) {
|
|
233
|
+
var conditionVal = self.parseTpl(item.value, {
|
|
234
|
+
data: self.rootValue
|
|
235
|
+
});
|
|
236
|
+
if (index === 0 && item.logical_operator === '~not') {
|
|
237
|
+
where += "(".concat(item.name, ",").concat(item.operator, ",").concat(conditionVal, ")");
|
|
238
|
+
} else {
|
|
239
|
+
where += "".concat(item.logical_operator, "(").concat(item.name, ",").concat(item.operator, ",").concat(conditionVal, ")");
|
|
240
|
+
}
|
|
271
241
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
242
|
+
});
|
|
243
|
+
params.where = where;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
Object.keys(params).forEach(function (key) {
|
|
247
|
+
searchParams.set(key, params["".concat(key)]);
|
|
248
|
+
});
|
|
249
|
+
try {
|
|
250
|
+
var lastestReqTime = new Date().getTime();
|
|
251
|
+
self.lastestReqTime = lastestReqTime;
|
|
252
|
+
var xhr = new XMLHttpRequest();
|
|
253
|
+
var reqMethod = self.component.request['method'];
|
|
254
|
+
if (reqMethod === 'GET') {
|
|
255
|
+
xhr.open('GET', "".concat(url.origin).concat(url.pathname, "?").concat(searchParams.toString()), true);
|
|
256
|
+
xhr.responseType = 'json';
|
|
257
|
+
Object.keys(headers).forEach(function (key) {
|
|
258
|
+
xhr.setRequestHeader(key, headers["".concat(key)]);
|
|
259
|
+
});
|
|
260
|
+
} else if (reqMethod === 'POST') {
|
|
261
|
+
xhr.open('POST', "".concat(url.origin).concat(url.pathname, "?").concat(searchParams.toString()), true);
|
|
262
|
+
xhr.setRequestHeader('Content-Type', 'application/json');
|
|
263
|
+
xhr.responseType = 'json';
|
|
264
|
+
Object.keys(headers).forEach(function (key) {
|
|
265
|
+
xhr.setRequestHeader(key, headers["".concat(key)]);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
xhr.onload = function () {
|
|
269
|
+
var status = xhr.status;
|
|
270
|
+
if (status === 200) {
|
|
271
|
+
// 确保最后更新的数据是最新一次请求的接口数据
|
|
272
|
+
if (lastestReqTime - self.lastestReqTime === 0) {
|
|
273
|
+
var dataPath = self.component.request['dataPath'];
|
|
274
|
+
if (dataPath && dataPath.length > 0) {
|
|
275
|
+
self.dataValue = _lodash.default.get(xhr.response, dataPath);
|
|
276
|
+
} else {
|
|
277
|
+
self.dataValue = xhr.response;
|
|
280
278
|
}
|
|
281
|
-
|
|
279
|
+
self.getRoot().triggerChange({
|
|
280
|
+
fromBlur: false
|
|
281
|
+
}, {
|
|
282
|
+
instance: self,
|
|
283
|
+
component: self.component,
|
|
284
|
+
value: self.dataValue,
|
|
285
|
+
flags: {
|
|
286
|
+
fromBlur: false
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
282
290
|
}
|
|
291
|
+
};
|
|
292
|
+
if (reqMethod === 'GET') {
|
|
293
|
+
xhr.send();
|
|
294
|
+
} else if (reqMethod === 'POST') {
|
|
295
|
+
var reqData = JSON.parse(this.parseTpl(JSON.stringify(self.component.request['body']) || '{}', {
|
|
296
|
+
data: self.rootValue
|
|
297
|
+
}));
|
|
298
|
+
xhr.send(JSON.stringify(reqData));
|
|
283
299
|
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
xhr.send();
|
|
287
|
-
} else if (reqMethod === 'POST') {
|
|
288
|
-
var reqData = JSON.parse(this.parseTpl(JSON.stringify(self.component.request['body']) || '{}', {
|
|
289
|
-
data: self.rootValue
|
|
290
|
-
}));
|
|
291
|
-
xhr.send(JSON.stringify(reqData));
|
|
300
|
+
} catch (e) {
|
|
301
|
+
console.log(e);
|
|
292
302
|
}
|
|
293
|
-
} catch (e) {
|
|
294
|
-
console.log(e);
|
|
295
303
|
}
|
|
304
|
+
return true;
|
|
296
305
|
}
|
|
297
|
-
return true;
|
|
298
306
|
}
|
|
299
307
|
}], [{
|
|
300
308
|
key: "schema",
|
|
@@ -2323,6 +2323,17 @@ var Component = /*#__PURE__*/function (_Element) {
|
|
|
2323
2323
|
}
|
|
2324
2324
|
return empty;
|
|
2325
2325
|
}
|
|
2326
|
+
if (["redrawOn", "refreshOn"].includes(this.key)) {
|
|
2327
|
+
// 特殊处理redrawOn/refreshOn,全部转为multiple
|
|
2328
|
+
var value = _lodash.default.get(this._data, this.key);
|
|
2329
|
+
if (value && value.length === 0) {
|
|
2330
|
+
var _empty = this.component.multiple ? [] : this.emptyValue;
|
|
2331
|
+
return _empty;
|
|
2332
|
+
}
|
|
2333
|
+
if (!_lodash.default.isArray(value)) {
|
|
2334
|
+
return [value];
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2326
2337
|
return _lodash.default.get(this._data, this.key);
|
|
2327
2338
|
}
|
|
2328
2339
|
|
|
@@ -146,7 +146,7 @@ exports.default = ECharts;
|
|
|
146
146
|
_defineProperty(ECharts, "builderInfo", {
|
|
147
147
|
title: 'ECharts',
|
|
148
148
|
group: 'advanced',
|
|
149
|
-
icon: 'chart',
|
|
149
|
+
icon: 'chart-line',
|
|
150
150
|
weight: 70,
|
|
151
151
|
documentation: 'http://help.form.io/userguide/#echarts',
|
|
152
152
|
schema: ECharts.schema()
|
|
@@ -167,7 +167,7 @@ exports.default = Progress;
|
|
|
167
167
|
_defineProperty(Progress, "builderInfo", {
|
|
168
168
|
title: 'Progress',
|
|
169
169
|
group: 'advanced',
|
|
170
|
-
icon: '
|
|
170
|
+
icon: 'bars-progress',
|
|
171
171
|
weight: 70,
|
|
172
172
|
documentation: 'http://help.form.io/userguide/#progress',
|
|
173
173
|
schema: Progress.schema()
|