formiojs-eorion 0.1.41 → 0.1.43
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/CustomTabs/editForm/Tabs.edit.display.js +1 -1
- package/components/Data/Data.js +40 -2
- package/components/Data/editForm/Data.edit.display.js +18 -5
- package/components/DataChinaGrid/editForm/Data.edit.display.js +1 -1
- package/components/DataChinaGridRow/editForm/Data.edit.display.js +1 -1
- package/components/Flex/editForm/Flex.edit.display.js +1 -1
- package/components/builder.js +2 -0
- package/components/iconButton/editForm/IconButton.edit.display.js +2 -2
- package/components/index.js +2 -0
- package/components/range/Range.form.js +26 -0
- package/components/range/Range.js +292 -0
- package/components/range/editForm/Range.edit.data.js +36 -0
- package/components/range/editForm/Range.edit.display.js +183 -0
- package/components/well/editForm/Well.edit.display.js +1 -1
- package/dist/formio.contrib.js +24 -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 +78 -13
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +78 -13
- 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/templates/bootstrap/data/form.ejs.js +2 -8
- package/templates/bootstrap/index.js +3 -1
- package/templates/bootstrap/range/form.ejs.js +45 -0
- package/templates/bootstrap/range/index.js +12 -0
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.43';
|
|
1728
1728
|
Formio.pathType = '';
|
|
1729
1729
|
Formio.events = new _EventEmitter.default();
|
|
1730
1730
|
Formio.cdn = new _CDN.default();
|
|
@@ -131,7 +131,7 @@ var _default = [{
|
|
|
131
131
|
editor: 'ace',
|
|
132
132
|
input: true,
|
|
133
133
|
defaultValue: '',
|
|
134
|
-
tooltip: '自定义的style:json格式,ex:{
|
|
134
|
+
tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}',
|
|
135
135
|
weight: 51
|
|
136
136
|
}];
|
|
137
137
|
exports.default = _default;
|
package/components/Data/Data.js
CHANGED
|
@@ -129,7 +129,8 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
129
129
|
refValue: 'single',
|
|
130
130
|
refSubValue: 'single',
|
|
131
131
|
refHeaderContent: 'single',
|
|
132
|
-
refSparkLineTitle: 'single'
|
|
132
|
+
refSparkLineTitle: 'single',
|
|
133
|
+
refIcon: 'single'
|
|
133
134
|
};
|
|
134
135
|
this.loadRefs(element, refs);
|
|
135
136
|
var dataContainer = this.refs.dataContainer;
|
|
@@ -165,11 +166,20 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
165
166
|
// 点击事件
|
|
166
167
|
switch (clickEventType) {
|
|
167
168
|
case 'newProcessInstance':
|
|
169
|
+
var params = self.component['click-event-params'];
|
|
170
|
+
try {
|
|
171
|
+
params = JSON.parse(self.parseTpl(params, {
|
|
172
|
+
data: self.rootValue
|
|
173
|
+
}));
|
|
174
|
+
} catch (e) {
|
|
175
|
+
params = {};
|
|
176
|
+
}
|
|
168
177
|
window.startProcessByDrawer({
|
|
169
178
|
processKey: self.component['click-event-process-def-key'],
|
|
170
179
|
label: '启动',
|
|
171
180
|
field: self.component['key'],
|
|
172
|
-
lockDrawer: self.component['click-event-lock-drawer']
|
|
181
|
+
lockDrawer: self.component['click-event-lock-drawer'],
|
|
182
|
+
preData: params
|
|
173
183
|
});
|
|
174
184
|
break;
|
|
175
185
|
case 'taskListPanel':
|
|
@@ -196,6 +206,9 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
196
206
|
var customStyleStr = this.component['custom-style-bg'];
|
|
197
207
|
if (customStyleStr && customStyleStr.length > 0) {
|
|
198
208
|
try {
|
|
209
|
+
customStyleStr = this.parseTpl(customStyleStr, {
|
|
210
|
+
data: this.rootValue
|
|
211
|
+
});
|
|
199
212
|
_lodash.default.forEach(JSON.parse(customStyleStr), function (value, key) {
|
|
200
213
|
_this2.refs.dataContainer.style[key] = value;
|
|
201
214
|
});
|
|
@@ -206,6 +219,9 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
206
219
|
customStyleStr = this.component['custom-style-title'];
|
|
207
220
|
if (customStyleStr && customStyleStr.length > 0) {
|
|
208
221
|
try {
|
|
222
|
+
customStyleStr = this.parseTpl(customStyleStr, {
|
|
223
|
+
data: this.rootValue
|
|
224
|
+
});
|
|
209
225
|
_lodash.default.forEach(JSON.parse(customStyleStr), function (value, key) {
|
|
210
226
|
_this2.refs.refHeader.style[key] = value;
|
|
211
227
|
});
|
|
@@ -216,6 +232,9 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
216
232
|
customStyleStr = this.component['custom-style-sub-title'];
|
|
217
233
|
if (customStyleStr && customStyleStr.length > 0) {
|
|
218
234
|
try {
|
|
235
|
+
customStyleStr = this.parseTpl(customStyleStr, {
|
|
236
|
+
data: this.rootValue
|
|
237
|
+
});
|
|
219
238
|
_lodash.default.forEach(JSON.parse(customStyleStr), function (value, key) {
|
|
220
239
|
_this2.refs.refSubHeader.style[key] = value;
|
|
221
240
|
});
|
|
@@ -226,6 +245,9 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
226
245
|
customStyleStr = this.component['custom-style-value'];
|
|
227
246
|
if (customStyleStr && customStyleStr.length > 0) {
|
|
228
247
|
try {
|
|
248
|
+
customStyleStr = this.parseTpl(customStyleStr, {
|
|
249
|
+
data: this.rootValue
|
|
250
|
+
});
|
|
229
251
|
_lodash.default.forEach(JSON.parse(customStyleStr), function (value, key) {
|
|
230
252
|
_this2.refs.refValue.style[key] = value;
|
|
231
253
|
});
|
|
@@ -236,6 +258,9 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
236
258
|
customStyleStr = this.component['custom-style-sub-value'];
|
|
237
259
|
if (customStyleStr && customStyleStr.length > 0) {
|
|
238
260
|
try {
|
|
261
|
+
customStyleStr = this.parseTpl(customStyleStr, {
|
|
262
|
+
data: this.rootValue
|
|
263
|
+
});
|
|
239
264
|
_lodash.default.forEach(JSON.parse(customStyleStr), function (value, key) {
|
|
240
265
|
_this2.refs.refSubValue.style[key] = value;
|
|
241
266
|
});
|
|
@@ -295,6 +320,19 @@ var Data = /*#__PURE__*/function (_Component) {
|
|
|
295
320
|
this.component['value-field'] = (_this$component$value = this.component['value-field']) !== null && _this$component$value !== void 0 ? _this$component$value : this.component.field;
|
|
296
321
|
this.component['value-url'] = (_this$component$value2 = this.component['value-url']) !== null && _this$component$value2 !== void 0 ? _this$component$value2 : this.component.url;
|
|
297
322
|
|
|
323
|
+
// icon
|
|
324
|
+
if (this.component['icon-field']) {
|
|
325
|
+
var icon = this.parseTpl(this.component['icon-field'], {
|
|
326
|
+
data: this.rootValue
|
|
327
|
+
});
|
|
328
|
+
this.refs.refIcon.className = "fa-fw ".concat(icon);
|
|
329
|
+
var iconColor = this.parseTpl(this.component['icon-color'], {
|
|
330
|
+
data: this.rootValue
|
|
331
|
+
});
|
|
332
|
+
this.refs.refIcon.style.color = iconColor;
|
|
333
|
+
} else {
|
|
334
|
+
this.refs.refIcon.style.display = "none";
|
|
335
|
+
}
|
|
298
336
|
// header
|
|
299
337
|
if (this.component['header']) {
|
|
300
338
|
var header = this.parseTpl(this.component['header'], {
|
|
@@ -18,7 +18,7 @@ var _default = [{
|
|
|
18
18
|
editor: 'ace',
|
|
19
19
|
input: true,
|
|
20
20
|
defaultValue: '',
|
|
21
|
-
tooltip: '自定义的style:json格式,ex:{
|
|
21
|
+
tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}',
|
|
22
22
|
weight: 1
|
|
23
23
|
}, {
|
|
24
24
|
type: 'input',
|
|
@@ -34,7 +34,7 @@ var _default = [{
|
|
|
34
34
|
editor: 'ace',
|
|
35
35
|
input: true,
|
|
36
36
|
defaultValue: '',
|
|
37
|
-
tooltip: '自定义的style:json格式,ex:{
|
|
37
|
+
tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}',
|
|
38
38
|
weight: 1
|
|
39
39
|
}, {
|
|
40
40
|
type: 'input',
|
|
@@ -51,7 +51,7 @@ var _default = [{
|
|
|
51
51
|
editor: 'ace',
|
|
52
52
|
input: true,
|
|
53
53
|
defaultValue: '',
|
|
54
|
-
tooltip: '自定义的style:json
|
|
54
|
+
tooltip: '自定义的style:json格式(支持变量),ex:{"border":"none","border-radius":"30px"}',
|
|
55
55
|
weight: 2
|
|
56
56
|
}, {
|
|
57
57
|
type: 'panel',
|
|
@@ -129,7 +129,7 @@ var _default = [{
|
|
|
129
129
|
editor: 'ace',
|
|
130
130
|
input: true,
|
|
131
131
|
defaultValue: '',
|
|
132
|
-
tooltip: '自定义的style:json格式,ex:{
|
|
132
|
+
tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}'
|
|
133
133
|
}]
|
|
134
134
|
}, {
|
|
135
135
|
type: 'panel',
|
|
@@ -162,7 +162,7 @@ var _default = [{
|
|
|
162
162
|
editor: 'ace',
|
|
163
163
|
input: true,
|
|
164
164
|
defaultValue: '',
|
|
165
|
-
tooltip: '自定义的style:json格式,ex:{
|
|
165
|
+
tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}'
|
|
166
166
|
}]
|
|
167
167
|
}, {
|
|
168
168
|
type: 'panel',
|
|
@@ -385,6 +385,19 @@ var _default = [{
|
|
|
385
385
|
}, ['newProcessInstance']]
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
+
}, {
|
|
389
|
+
label: '参数传递',
|
|
390
|
+
key: 'click-event-params',
|
|
391
|
+
type: 'textarea',
|
|
392
|
+
editor: 'ace',
|
|
393
|
+
tooltip: 'json格式,ex:{"border":"none","border-radius":"30px"}',
|
|
394
|
+
conditional: {
|
|
395
|
+
json: {
|
|
396
|
+
in: [{
|
|
397
|
+
var: 'data.click-event-type'
|
|
398
|
+
}, ['newProcessInstance']]
|
|
399
|
+
}
|
|
400
|
+
}
|
|
388
401
|
}, {
|
|
389
402
|
type: 'input',
|
|
390
403
|
label: 'URL',
|
|
@@ -284,7 +284,7 @@ var _default = [{
|
|
|
284
284
|
editor: 'ace',
|
|
285
285
|
input: true,
|
|
286
286
|
defaultValue: {},
|
|
287
|
-
tooltip: '自定义的style:json格式,ex:{
|
|
287
|
+
tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}',
|
|
288
288
|
weight: 2
|
|
289
289
|
}, {
|
|
290
290
|
type: 'input',
|
|
@@ -209,7 +209,7 @@ var _default = [{
|
|
|
209
209
|
editor: 'ace',
|
|
210
210
|
input: true,
|
|
211
211
|
defaultValue: {},
|
|
212
|
-
tooltip: '自定义的style:json格式,ex:{
|
|
212
|
+
tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}',
|
|
213
213
|
weight: 3
|
|
214
214
|
}, {
|
|
215
215
|
type: 'panel',
|
|
@@ -36,7 +36,7 @@ var _default = [{
|
|
|
36
36
|
input: true,
|
|
37
37
|
weight: 149,
|
|
38
38
|
defaultValue: "{}",
|
|
39
|
-
tooltip: '自定义的style:json格式,ex:{
|
|
39
|
+
tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}'
|
|
40
40
|
}, {
|
|
41
41
|
weight: 149,
|
|
42
42
|
type: 'number',
|
package/components/builder.js
CHANGED
|
@@ -76,7 +76,9 @@ var _ECharts = _interopRequireDefault(require("./echarts/ECharts.form"));
|
|
|
76
76
|
var _IconButton = _interopRequireDefault(require("./iconButton/IconButton.form"));
|
|
77
77
|
var _ButtonGroups = _interopRequireDefault(require("./buttonGroups/ButtonGroups.form"));
|
|
78
78
|
var _File2 = _interopRequireDefault(require("./file_china_grid/File.form"));
|
|
79
|
+
var _Range = _interopRequireDefault(require("./range/Range.form"));
|
|
79
80
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
81
|
+
// Components.range.editForm = RangeForm;
|
|
80
82
|
_.default.fileUds.editForm = _File2.default;
|
|
81
83
|
_.default.buttonGroups.editForm = _ButtonGroups.default;
|
|
82
84
|
_.default.iconButton.editForm = _IconButton.default;
|
|
@@ -12,7 +12,7 @@ var _default = [{
|
|
|
12
12
|
input: true,
|
|
13
13
|
weight: 1,
|
|
14
14
|
defaultValue: "{}",
|
|
15
|
-
tooltip: '自定义的style:json格式,ex:{
|
|
15
|
+
tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}'
|
|
16
16
|
}, {
|
|
17
17
|
type: 'panel',
|
|
18
18
|
label: '图标设置',
|
|
@@ -54,7 +54,7 @@ var _default = [{
|
|
|
54
54
|
editor: 'ace',
|
|
55
55
|
input: true,
|
|
56
56
|
defaultValue: "{}",
|
|
57
|
-
tooltip: '自定义的style:json格式,ex:{
|
|
57
|
+
tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}'
|
|
58
58
|
}]
|
|
59
59
|
}, {
|
|
60
60
|
type: 'panel',
|
package/components/index.js
CHANGED
|
@@ -85,8 +85,10 @@ var _ECharts = _interopRequireDefault(require("./echarts/ECharts"));
|
|
|
85
85
|
var _IconButton = _interopRequireDefault(require("./iconButton/IconButton"));
|
|
86
86
|
var _ButtonGroups = _interopRequireDefault(require("./buttonGroups/ButtonGroups"));
|
|
87
87
|
var _File2 = _interopRequireDefault(require("./file_china_grid/File"));
|
|
88
|
+
var _Range = _interopRequireDefault(require("./range/Range"));
|
|
88
89
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
89
90
|
var _default = {
|
|
91
|
+
// range: RangeComponent,
|
|
90
92
|
fileUds: _File2.default,
|
|
91
93
|
map: _Map.default,
|
|
92
94
|
locationInputTextField: _LocationInputTextField.default,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
require("core-js/modules/es.array.concat.js");
|
|
8
|
+
var _Components = _interopRequireDefault(require("../Components"));
|
|
9
|
+
var _RangeEdit = _interopRequireDefault(require("./editForm/Range.edit.data"));
|
|
10
|
+
var _RangeEdit2 = _interopRequireDefault(require("./editForm/Range.edit.display"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _default() {
|
|
13
|
+
for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
|
+
extend[_key] = arguments[_key];
|
|
15
|
+
}
|
|
16
|
+
return _Components.default.baseEditForm.apply(_Components.default, [[{
|
|
17
|
+
key: 'display',
|
|
18
|
+
components: _RangeEdit2.default
|
|
19
|
+
}, {
|
|
20
|
+
key: 'data',
|
|
21
|
+
components: _RangeEdit.default
|
|
22
|
+
}, {
|
|
23
|
+
key: 'addons',
|
|
24
|
+
ignore: true
|
|
25
|
+
}]].concat(extend));
|
|
26
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
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");
|
|
5
|
+
require("core-js/modules/es.reflect.construct.js");
|
|
6
|
+
require("core-js/modules/es.reflect.get.js");
|
|
7
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
8
|
+
require("core-js/modules/es.symbol.to-primitive.js");
|
|
9
|
+
require("core-js/modules/es.date.to-primitive.js");
|
|
10
|
+
require("core-js/modules/es.symbol.js");
|
|
11
|
+
require("core-js/modules/es.symbol.description.js");
|
|
12
|
+
require("core-js/modules/es.number.constructor.js");
|
|
13
|
+
require("core-js/modules/es.symbol.iterator.js");
|
|
14
|
+
require("core-js/modules/es.array.iterator.js");
|
|
15
|
+
require("core-js/modules/es.string.iterator.js");
|
|
16
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
17
|
+
Object.defineProperty(exports, "__esModule", {
|
|
18
|
+
value: true
|
|
19
|
+
});
|
|
20
|
+
exports.default = void 0;
|
|
21
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
22
|
+
require("core-js/modules/es.string.replace.js");
|
|
23
|
+
require("core-js/modules/es.string.trim.js");
|
|
24
|
+
require("core-js/modules/es.function.name.js");
|
|
25
|
+
require("core-js/modules/es.array.concat.js");
|
|
26
|
+
require("core-js/modules/es.object.get-prototype-of.js");
|
|
27
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
28
|
+
var _Field2 = _interopRequireDefault(require("../_classes/field/Field"));
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
|
+
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); } }
|
|
32
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
33
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
34
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
35
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
36
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
37
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
38
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
40
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
41
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
42
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
44
|
+
var RangeComponent = /*#__PURE__*/function (_Field) {
|
|
45
|
+
_inherits(RangeComponent, _Field);
|
|
46
|
+
var _super = _createSuper(RangeComponent);
|
|
47
|
+
function RangeComponent(component, options, data) {
|
|
48
|
+
var _this;
|
|
49
|
+
_classCallCheck(this, RangeComponent);
|
|
50
|
+
_this = _super.call(this, component, options, data);
|
|
51
|
+
_this.previousValue = _this.dataValue || null;
|
|
52
|
+
return _this;
|
|
53
|
+
}
|
|
54
|
+
_createClass(RangeComponent, [{
|
|
55
|
+
key: "parseTpl",
|
|
56
|
+
value: function parseTpl(template, map) {
|
|
57
|
+
return template.replace(/\$\{.+?}/g, function (match) {
|
|
58
|
+
var _$get;
|
|
59
|
+
var path = match.substr(2, match.length - 3).trim();
|
|
60
|
+
return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "defaultSchema",
|
|
65
|
+
get: function get() {
|
|
66
|
+
return RangeComponent.schema();
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "defaultValue",
|
|
70
|
+
get: function get() {
|
|
71
|
+
var defaultValue = _get(_getPrototypeOf(RangeComponent.prototype), "defaultValue", this);
|
|
72
|
+
if (!defaultValue && this.component.defaultValue === false) {
|
|
73
|
+
defaultValue = this.component.defaultValue;
|
|
74
|
+
}
|
|
75
|
+
return defaultValue;
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "labelClass",
|
|
79
|
+
get: function get() {
|
|
80
|
+
var className = '';
|
|
81
|
+
if (this.isInputComponent && !this.options.inputsOnly && this.component.validate && this.component.validate.required) {
|
|
82
|
+
className += ' field-required';
|
|
83
|
+
}
|
|
84
|
+
return "".concat(className);
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "hasSetValue",
|
|
88
|
+
get: function get() {
|
|
89
|
+
return this.hasValue();
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
key: "inputInfo",
|
|
93
|
+
get: function get() {
|
|
94
|
+
var info = _get(_getPrototypeOf(RangeComponent.prototype), "elementInfo", this).call(this);
|
|
95
|
+
info.type = 'input';
|
|
96
|
+
info.changeEvent = 'click';
|
|
97
|
+
info.attr.type = this.component.inputType || 'range';
|
|
98
|
+
info.attr.class = 'form-range-input';
|
|
99
|
+
if (this.component.name) {
|
|
100
|
+
info.attr.name = "data[".concat(this.component.name, "]");
|
|
101
|
+
}
|
|
102
|
+
info.attr.value = this.component.value ? this.component.value : 0;
|
|
103
|
+
info.label = this.t(this.component.label, {
|
|
104
|
+
_userInput: true
|
|
105
|
+
});
|
|
106
|
+
info.labelClass = this.labelClass;
|
|
107
|
+
return info;
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "render",
|
|
111
|
+
value: function render() {
|
|
112
|
+
return _get(_getPrototypeOf(RangeComponent.prototype), "render", this).call(this, this.renderTemplate('range', {
|
|
113
|
+
input: this.inputInfo,
|
|
114
|
+
checked: this.checked,
|
|
115
|
+
tooltip: this.interpolate(this.t(this.component.tooltip) || '', {
|
|
116
|
+
_userInput: true
|
|
117
|
+
}).replace(/(?:\r\n|\r|\n)/g, '<br />')
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
}, {
|
|
121
|
+
key: "attach",
|
|
122
|
+
value: function attach(element) {
|
|
123
|
+
var _this2 = this;
|
|
124
|
+
this.loadRefs(element, {
|
|
125
|
+
input: 'multiple'
|
|
126
|
+
});
|
|
127
|
+
this.input = this.refs.input[0];
|
|
128
|
+
if (this.refs.input) {
|
|
129
|
+
this.addEventListener(this.input, this.inputInfo.changeEvent, function () {
|
|
130
|
+
return _this2.updateValue(null, {
|
|
131
|
+
modified: true
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
this.addShortcut(this.input);
|
|
135
|
+
}
|
|
136
|
+
return _get(_getPrototypeOf(RangeComponent.prototype), "attach", this).call(this, element);
|
|
137
|
+
}
|
|
138
|
+
}, {
|
|
139
|
+
key: "detach",
|
|
140
|
+
value: function detach(element) {
|
|
141
|
+
if (element && this.input) {
|
|
142
|
+
this.removeShortcut(this.input);
|
|
143
|
+
}
|
|
144
|
+
_get(_getPrototypeOf(RangeComponent.prototype), "detach", this).call(this);
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "emptyValue",
|
|
148
|
+
get: function get() {
|
|
149
|
+
return this.component.inputType === 'radio' ? null : false;
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
key: "isEmpty",
|
|
153
|
+
value: function isEmpty() {
|
|
154
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.dataValue;
|
|
155
|
+
return _get(_getPrototypeOf(RangeComponent.prototype), "isEmpty", this).call(this, value) || value === false;
|
|
156
|
+
}
|
|
157
|
+
}, {
|
|
158
|
+
key: "key",
|
|
159
|
+
get: function get() {
|
|
160
|
+
return this.component.name ? this.component.name : _get(_getPrototypeOf(RangeComponent.prototype), "key", this);
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
key: "getValueAt",
|
|
164
|
+
value: function getValueAt(index) {
|
|
165
|
+
if (this.component.name) {
|
|
166
|
+
return this.refs.input[index].checked ? this.component.value : '';
|
|
167
|
+
}
|
|
168
|
+
return !!this.refs.input[index].checked;
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "getValue",
|
|
172
|
+
value: function getValue() {
|
|
173
|
+
var value = _get(_getPrototypeOf(RangeComponent.prototype), "getValue", this).call(this);
|
|
174
|
+
if (this.component.name) {
|
|
175
|
+
return value ? this.setCheckedState(value) : this.setCheckedState(this.dataValue);
|
|
176
|
+
} else {
|
|
177
|
+
return value === '' ? this.dataValue : !!value;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}, {
|
|
181
|
+
key: "checked",
|
|
182
|
+
get: function get() {
|
|
183
|
+
if (this.component.name) {
|
|
184
|
+
return this.dataValue === this.component.value;
|
|
185
|
+
}
|
|
186
|
+
return !!this.dataValue;
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
189
|
+
key: "setCheckedState",
|
|
190
|
+
value: function setCheckedState(value) {
|
|
191
|
+
if (!this.input) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (this.component.name) {
|
|
195
|
+
this.input.value = value === this.component.value ? this.component.value : 0;
|
|
196
|
+
this.input.checked = value === this.component.value ? 1 : 0;
|
|
197
|
+
} else if (value === 'on') {
|
|
198
|
+
this.input.value = 1;
|
|
199
|
+
this.input.checked = 1;
|
|
200
|
+
} else if (value === 'off') {
|
|
201
|
+
this.input.value = 0;
|
|
202
|
+
this.input.checked = 0;
|
|
203
|
+
} else if (value) {
|
|
204
|
+
this.input.value = 1;
|
|
205
|
+
this.input.checked = 1;
|
|
206
|
+
} else {
|
|
207
|
+
this.input.value = 0;
|
|
208
|
+
this.input.checked = 0;
|
|
209
|
+
}
|
|
210
|
+
if (this.input.checked) {
|
|
211
|
+
this.input.setAttribute('checked', true);
|
|
212
|
+
} else {
|
|
213
|
+
this.input.removeAttribute('checked');
|
|
214
|
+
}
|
|
215
|
+
return value;
|
|
216
|
+
}
|
|
217
|
+
}, {
|
|
218
|
+
key: "setValue",
|
|
219
|
+
value: function setValue(value) {
|
|
220
|
+
var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
221
|
+
if (this.setCheckedState(value) !== undefined || !this.input && value !== undefined && (this.visible || this.conditionallyVisible() || !this.component.clearOnHide)) {
|
|
222
|
+
var changed = this.updateValue(value, flags);
|
|
223
|
+
if (this.isHtmlRenderMode() && flags && flags.fromSubmission && changed) {
|
|
224
|
+
this.redraw();
|
|
225
|
+
}
|
|
226
|
+
return changed;
|
|
227
|
+
}
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
}, {
|
|
231
|
+
key: "getValueAsString",
|
|
232
|
+
value: function getValueAsString(value) {
|
|
233
|
+
var _this$component = this.component,
|
|
234
|
+
componentName = _this$component.name,
|
|
235
|
+
componentValue = _this$component.value;
|
|
236
|
+
var hasValue = componentName ? _lodash.default.isEqual(value, componentValue) : value;
|
|
237
|
+
return this.t(hasValue ? 'Yes' : 'No');
|
|
238
|
+
}
|
|
239
|
+
}, {
|
|
240
|
+
key: "updateValue",
|
|
241
|
+
value: function updateValue(value, flags) {
|
|
242
|
+
// If this is a radio and is alredy checked, uncheck it.
|
|
243
|
+
if (this.component.name && flags.modified && this.dataValue === this.component.value) {
|
|
244
|
+
this.input.checked = 0;
|
|
245
|
+
this.input.value = 0;
|
|
246
|
+
this.dataValue = '';
|
|
247
|
+
}
|
|
248
|
+
var changed = _get(_getPrototypeOf(RangeComponent.prototype), "updateValue", this).call(this, value, flags);
|
|
249
|
+
|
|
250
|
+
// Update attributes of the input element
|
|
251
|
+
if (changed && this.input) {
|
|
252
|
+
if (this.input.checked) {
|
|
253
|
+
this.input.setAttribute('checked', 'true');
|
|
254
|
+
} else {
|
|
255
|
+
this.input.removeAttribute('checked');
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return changed;
|
|
259
|
+
}
|
|
260
|
+
}], [{
|
|
261
|
+
key: "schema",
|
|
262
|
+
value: function schema() {
|
|
263
|
+
for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
264
|
+
extend[_key] = arguments[_key];
|
|
265
|
+
}
|
|
266
|
+
return _Field2.default.schema.apply(_Field2.default, [{
|
|
267
|
+
type: 'range',
|
|
268
|
+
inputType: 'range',
|
|
269
|
+
label: 'Range',
|
|
270
|
+
key: 'range',
|
|
271
|
+
fieldSet: false,
|
|
272
|
+
max_val: 100,
|
|
273
|
+
min_val: 0,
|
|
274
|
+
step_val: 1
|
|
275
|
+
}].concat(extend));
|
|
276
|
+
}
|
|
277
|
+
}, {
|
|
278
|
+
key: "builderInfo",
|
|
279
|
+
get: function get() {
|
|
280
|
+
return {
|
|
281
|
+
title: 'Range',
|
|
282
|
+
group: 'basic',
|
|
283
|
+
icon: 'dot-circle-o',
|
|
284
|
+
weight: 80,
|
|
285
|
+
documentation: '/userguide/forms/form-components#range',
|
|
286
|
+
schema: RangeComponent.schema()
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}]);
|
|
290
|
+
return RangeComponent;
|
|
291
|
+
}(_Field2.default);
|
|
292
|
+
exports.default = RangeComponent;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = [{
|
|
8
|
+
weight: 0,
|
|
9
|
+
type: 'number',
|
|
10
|
+
input: true,
|
|
11
|
+
defaultValue: 100,
|
|
12
|
+
key: 'max_val',
|
|
13
|
+
label: '最大值'
|
|
14
|
+
}, {
|
|
15
|
+
weight: 0,
|
|
16
|
+
type: 'number',
|
|
17
|
+
input: true,
|
|
18
|
+
key: 'min_val',
|
|
19
|
+
defaultValue: 0,
|
|
20
|
+
label: '最小值'
|
|
21
|
+
}, {
|
|
22
|
+
weight: 0,
|
|
23
|
+
type: 'number',
|
|
24
|
+
input: true,
|
|
25
|
+
key: 'step_val',
|
|
26
|
+
defaultValue: 1,
|
|
27
|
+
label: '步进'
|
|
28
|
+
}, {
|
|
29
|
+
weight: 0,
|
|
30
|
+
type: 'number',
|
|
31
|
+
input: true,
|
|
32
|
+
key: 'step_val',
|
|
33
|
+
defaultValue: 1,
|
|
34
|
+
label: '步进'
|
|
35
|
+
}];
|
|
36
|
+
exports.default = _default;
|