@byteluck-fe/model-driven-settings 2.5.0-alpha.9 → 2.5.0-beta.1

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.
@@ -17,29 +17,10 @@ function _createClass(Constructor, protoProps, staticProps) {
17
17
  if (staticProps) _defineProperties(Constructor, staticProps);
18
18
  return Constructor;
19
19
  }
20
- function _defineProperty(obj, key, value) {
21
- if (key in obj) {
22
- Object.defineProperty(obj, key, {
23
- value: value,
24
- enumerable: true,
25
- configurable: true,
26
- writable: true
27
- });
28
- } else {
29
- obj[key] = value;
30
- }
31
- return obj;
32
- }
33
20
  export var BaseProps = /*#__PURE__*/ function() {
34
21
  "use strict";
35
22
  function BaseProps(props) {
36
23
  _classCallCheck(this, BaseProps);
37
- /**
38
- * 显示隐藏
39
- * */ _defineProperty(this, "visible", void 0);
40
- /**
41
- * 开启表达式
42
- * */ _defineProperty(this, "expression", void 0);
43
24
  var _props_visible;
44
25
  this.visible = (_props_visible = props === null || props === void 0 ? void 0 : props.visible) !== null && _props_visible !== void 0 ? _props_visible : true;
45
26
  var _props_expression;
@@ -9,19 +9,6 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
- function _defineProperty(obj, key, value) {
13
- if (key in obj) {
14
- Object.defineProperty(obj, key, {
15
- value: value,
16
- enumerable: true,
17
- configurable: true,
18
- writable: true
19
- });
20
- } else {
21
- obj[key] = value;
22
- }
23
- return obj;
24
- }
25
12
  function _getPrototypeOf(o) {
26
13
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
27
14
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -91,7 +78,6 @@ export var CheckboxProps = /*#__PURE__*/ function(BaseProps) {
91
78
  _classCallCheck(this, CheckboxProps);
92
79
  var _this;
93
80
  _this = _super.call(this, props);
94
- _defineProperty(_assertThisInitialized(_this), "options", void 0);
95
81
  var _props_options;
96
82
  _this.options = (_props_options = props === null || props === void 0 ? void 0 : props.options) !== null && _props_options !== void 0 ? _props_options : [];
97
83
  return _this;
@@ -9,19 +9,6 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
- function _defineProperty(obj, key, value) {
13
- if (key in obj) {
14
- Object.defineProperty(obj, key, {
15
- value: value,
16
- enumerable: true,
17
- configurable: true,
18
- writable: true
19
- });
20
- } else {
21
- obj[key] = value;
22
- }
23
- return obj;
24
- }
25
12
  function _getPrototypeOf(o) {
26
13
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
27
14
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -91,9 +78,6 @@ export var InputNumberProps = /*#__PURE__*/ function(BaseProps) {
91
78
  _classCallCheck(this, InputNumberProps);
92
79
  var _this;
93
80
  _this = _super.call(this, props);
94
- _defineProperty(_assertThisInitialized(_this), "max", void 0);
95
- _defineProperty(_assertThisInitialized(_this), "min", void 0);
96
- _defineProperty(_assertThisInitialized(_this), "placeholder", void 0);
97
81
  var _props_max;
98
82
  _this.max = (_props_max = props === null || props === void 0 ? void 0 : props.max) !== null && _props_max !== void 0 ? _props_max : "";
99
83
  var _props_min;
@@ -9,19 +9,6 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
- function _defineProperty(obj, key, value) {
13
- if (key in obj) {
14
- Object.defineProperty(obj, key, {
15
- value: value,
16
- enumerable: true,
17
- configurable: true,
18
- writable: true
19
- });
20
- } else {
21
- obj[key] = value;
22
- }
23
- return obj;
24
- }
25
12
  function _getPrototypeOf(o) {
26
13
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
27
14
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -91,10 +78,6 @@ export var InputProps = /*#__PURE__*/ function(BaseProps) {
91
78
  _classCallCheck(this, InputProps);
92
79
  var _this;
93
80
  _this = _super.call(this, props);
94
- _defineProperty(_assertThisInitialized(_this), "maxLength", void 0);
95
- _defineProperty(_assertThisInitialized(_this), "minLength", void 0);
96
- _defineProperty(_assertThisInitialized(_this), "placeholder", void 0);
97
- _defineProperty(_assertThisInitialized(_this), "i18n", void 0);
98
81
  var _props_maxLength;
99
82
  _this.maxLength = (_props_maxLength = props === null || props === void 0 ? void 0 : props.maxLength) !== null && _props_maxLength !== void 0 ? _props_maxLength : "";
100
83
  var _props_minLength;
@@ -9,19 +9,6 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
- function _defineProperty(obj, key, value) {
13
- if (key in obj) {
14
- Object.defineProperty(obj, key, {
15
- value: value,
16
- enumerable: true,
17
- configurable: true,
18
- writable: true
19
- });
20
- } else {
21
- obj[key] = value;
22
- }
23
- return obj;
24
- }
25
12
  function _getPrototypeOf(o) {
26
13
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
27
14
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -91,8 +78,6 @@ export var RadioProps = /*#__PURE__*/ function(BaseProps) {
91
78
  _classCallCheck(this, RadioProps);
92
79
  var _this;
93
80
  _this = _super.call(this, props);
94
- _defineProperty(_assertThisInitialized(_this), "options", void 0);
95
- _defineProperty(_assertThisInitialized(_this), "showType", void 0);
96
81
  var _props_options;
97
82
  _this.options = (_props_options = props === null || props === void 0 ? void 0 : props.options) !== null && _props_options !== void 0 ? _props_options : [];
98
83
  var _props_showType;
@@ -9,19 +9,6 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
- function _defineProperty(obj, key, value) {
13
- if (key in obj) {
14
- Object.defineProperty(obj, key, {
15
- value: value,
16
- enumerable: true,
17
- configurable: true,
18
- writable: true
19
- });
20
- } else {
21
- obj[key] = value;
22
- }
23
- return obj;
24
- }
25
12
  function _getPrototypeOf(o) {
26
13
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
27
14
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -91,8 +78,6 @@ export var SelectProps = /*#__PURE__*/ function(BaseProps) {
91
78
  _classCallCheck(this, SelectProps);
92
79
  var _this;
93
80
  _this = _super.call(this, props);
94
- _defineProperty(_assertThisInitialized(_this), "placeholder", void 0);
95
- _defineProperty(_assertThisInitialized(_this), "options", void 0);
96
81
  var _props_placeholder;
97
82
  _this.placeholder = (_props_placeholder = props === null || props === void 0 ? void 0 : props.placeholder) !== null && _props_placeholder !== void 0 ? _props_placeholder : "";
98
83
  var _props_options;
@@ -9,19 +9,6 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
- function _defineProperty(obj, key, value) {
13
- if (key in obj) {
14
- Object.defineProperty(obj, key, {
15
- value: value,
16
- enumerable: true,
17
- configurable: true,
18
- writable: true
19
- });
20
- } else {
21
- obj[key] = value;
22
- }
23
- return obj;
24
- }
25
12
  function _getPrototypeOf(o) {
26
13
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
27
14
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -91,9 +78,6 @@ export var SwitchProps = /*#__PURE__*/ function(BaseProps) {
91
78
  _classCallCheck(this, SwitchProps);
92
79
  var _this;
93
80
  _this = _super.call(this, props);
94
- _defineProperty(_assertThisInitialized(_this), "showType", void 0);
95
- _defineProperty(_assertThisInitialized(_this), "tips", void 0);
96
- _defineProperty(_assertThisInitialized(_this), "disabled", void 0);
97
81
  var _props_showType;
98
82
  _this.showType = (_props_showType = props === null || props === void 0 ? void 0 : props.showType) !== null && _props_showType !== void 0 ? _props_showType : "switch";
99
83
  var _props_tips;
@@ -9,19 +9,6 @@ function _classCallCheck(instance, Constructor) {
9
9
  throw new TypeError("Cannot call a class as a function");
10
10
  }
11
11
  }
12
- function _defineProperty(obj, key, value) {
13
- if (key in obj) {
14
- Object.defineProperty(obj, key, {
15
- value: value,
16
- enumerable: true,
17
- configurable: true,
18
- writable: true
19
- });
20
- } else {
21
- obj[key] = value;
22
- }
23
- return obj;
24
- }
25
12
  function _getPrototypeOf(o) {
26
13
  _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
27
14
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -91,12 +78,6 @@ export var TextareaProps = /*#__PURE__*/ function(BaseProps) {
91
78
  _classCallCheck(this, TextareaProps);
92
79
  var _this;
93
80
  _this = _super.call(this, props);
94
- _defineProperty(_assertThisInitialized(_this), "maxLength", void 0);
95
- _defineProperty(_assertThisInitialized(_this), "minLength", void 0);
96
- _defineProperty(_assertThisInitialized(_this), "placeholder", void 0);
97
- _defineProperty(_assertThisInitialized(_this), "i18n", void 0);
98
- _defineProperty(_assertThisInitialized(_this), "maxRows", void 0);
99
- _defineProperty(_assertThisInitialized(_this), "minRows", void 0);
100
81
  var _props_maxLength;
101
82
  _this.maxLength = (_props_maxLength = props === null || props === void 0 ? void 0 : props.maxLength) !== null && _props_maxLength !== void 0 ? _props_maxLength : "";
102
83
  var _props_minLength;
@@ -3,28 +3,10 @@ function _classCallCheck(instance, Constructor) {
3
3
  throw new TypeError("Cannot call a class as a function");
4
4
  }
5
5
  }
6
- function _defineProperty(obj, key, value) {
7
- if (key in obj) {
8
- Object.defineProperty(obj, key, {
9
- value: value,
10
- enumerable: true,
11
- configurable: true,
12
- writable: true
13
- });
14
- } else {
15
- obj[key] = value;
16
- }
17
- return obj;
18
- }
19
6
  export var Group = function Group(schema) {
20
7
  "use strict";
21
8
  _classCallCheck(this, Group);
22
- _defineProperty(this, "type", "group");
23
- _defineProperty(this, "title", void 0);
24
- _defineProperty(this, "required", void 0);
25
- _defineProperty(this, "items", void 0);
26
- _defineProperty(this, "tips", void 0);
27
- _defineProperty(this, "fromId", void 0);
9
+ this.type = "group";
28
10
  var _schema_title;
29
11
  this.title = (_schema_title = schema.title) !== null && _schema_title !== void 0 ? _schema_title : "";
30
12
  var _schema_required;
@@ -3,49 +3,12 @@ function _classCallCheck(instance, Constructor) {
3
3
  throw new TypeError("Cannot call a class as a function");
4
4
  }
5
5
  }
6
- function _defineProperties(target, props) {
7
- for(var i = 0; i < props.length; i++){
8
- var descriptor = props[i];
9
- descriptor.enumerable = descriptor.enumerable || false;
10
- descriptor.configurable = true;
11
- if ("value" in descriptor) descriptor.writable = true;
12
- Object.defineProperty(target, descriptor.key, descriptor);
13
- }
14
- }
15
- function _createClass(Constructor, protoProps, staticProps) {
16
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17
- if (staticProps) _defineProperties(Constructor, staticProps);
18
- return Constructor;
19
- }
20
- function _defineProperty(obj, key, value) {
21
- if (key in obj) {
22
- Object.defineProperty(obj, key, {
23
- value: value,
24
- enumerable: true,
25
- configurable: true,
26
- writable: true
27
- });
28
- } else {
29
- obj[key] = value;
30
- }
31
- return obj;
32
- }
33
6
  import { BaseProps } from "../props/base";
34
7
  import { error, isPlainObject, noop } from "@byteluck-fe/model-driven-shared";
35
8
  export var Setting = /*#__PURE__*/ function() {
36
9
  "use strict";
37
10
  function Setting(schema) {
38
11
  _classCallCheck(this, Setting);
39
- _defineProperty(this, "type", void 0);
40
- _defineProperty(this, "label", void 0);
41
- _defineProperty(this, "key", void 0);
42
- _defineProperty(this, "component", void 0);
43
- _defineProperty(this, "effect", void 0);
44
- _defineProperty(this, "scopeEffect", void 0);
45
- _defineProperty(this, "defaultValue", void 0);
46
- _defineProperty(this, "validator", void 0);
47
- _defineProperty(this, "props", void 0);
48
- _defineProperty(this, "effectKeys", void 0);
49
12
  this.type = schema.type;
50
13
  this.label = schema.label;
51
14
  this.key = schema.key;
@@ -61,59 +24,46 @@ export var Setting = /*#__PURE__*/ function() {
61
24
  // private init
62
25
  this.effectKeys = Object.keys(this.effect);
63
26
  }
64
- _createClass(Setting, [
65
- {
66
- key: "filterEffects",
67
- value: function filterEffects(effectKey) {
68
- var _this = this;
69
- if (effectKey === "") {
70
- return Object.values(this.effect);
71
- }
72
- return this.effectKeys.filter(function(key) {
73
- // 触发规则:effectKeys => effectFns
74
- // dataBind => dataBind
75
- // dataBind.fieldCode => dataBind、dataBind.fieldCode
76
- var regexp = new RegExp("^".concat(key, "(\\.\\w+)*$"));
77
- return regexp.test(effectKey);
78
- }).map(function(key) {
79
- return _this.effect[key];
80
- });
81
- }
82
- },
83
- {
84
- key: "callEffectFn",
85
- value: function callEffectFn(effectFn, args) {
86
- try {
87
- var result = effectFn.apply(null, args);
88
- if (isPlainObject(result)) {
89
- Object.assign(this.props, result);
90
- }
91
- } catch (e) {
92
- error("effect error \n ".concat(e));
93
- }
94
- }
95
- },
96
- {
97
- key: "callEffect",
98
- value: function callEffect(effectKey) {
99
- for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
100
- args[_key - 1] = arguments[_key];
101
- }
102
- var _this = this;
103
- this.filterEffects(effectKey).forEach(function(fn) {
104
- return _this.callEffectFn(fn, args);
105
- });
106
- }
107
- },
108
- {
109
- key: "callScopeEffect",
110
- value: function callScopeEffect() {
111
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
112
- args[_key] = arguments[_key];
113
- }
114
- this.callEffectFn(this.scopeEffect, args);
27
+ var _proto = Setting.prototype;
28
+ _proto.filterEffects = function filterEffects(effectKey) {
29
+ var _this = this;
30
+ if (effectKey === "") {
31
+ return Object.values(this.effect);
32
+ }
33
+ return this.effectKeys.filter(function(key) {
34
+ // 触发规则:effectKeys => effectFns
35
+ // dataBind => dataBind
36
+ // dataBind.fieldCode => dataBind、dataBind.fieldCode
37
+ var regexp = new RegExp("^".concat(key, "(\\.\\w+)*$"));
38
+ return regexp.test(effectKey);
39
+ }).map(function(key) {
40
+ return _this.effect[key];
41
+ });
42
+ };
43
+ _proto.callEffectFn = function callEffectFn(effectFn, args) {
44
+ try {
45
+ var result = effectFn.apply(null, args);
46
+ if (isPlainObject(result)) {
47
+ Object.assign(this.props, result);
115
48
  }
49
+ } catch (e) {
50
+ error("effect error \n ".concat(e));
51
+ }
52
+ };
53
+ _proto.callEffect = function callEffect(effectKey) {
54
+ for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
55
+ args[_key - 1] = arguments[_key];
56
+ }
57
+ var _this = this;
58
+ this.filterEffects(effectKey).forEach(function(fn) {
59
+ return _this.callEffectFn(fn, args);
60
+ });
61
+ };
62
+ _proto.callScopeEffect = function callScopeEffect() {
63
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
64
+ args[_key] = arguments[_key];
116
65
  }
117
- ]);
66
+ this.callEffectFn(this.scopeEffect, args);
67
+ };
118
68
  return Setting;
119
69
  }();
@@ -3,28 +3,13 @@ function _classCallCheck(instance, Constructor) {
3
3
  throw new TypeError("Cannot call a class as a function");
4
4
  }
5
5
  }
6
- function _defineProperty(obj, key, value) {
7
- if (key in obj) {
8
- Object.defineProperty(obj, key, {
9
- value: value,
10
- enumerable: true,
11
- configurable: true,
12
- writable: true
13
- });
14
- } else {
15
- obj[key] = value;
16
- }
17
- return obj;
18
- }
19
6
  export function isTabSchema(schema) {
20
7
  return "type" in schema && schema.type === "tab";
21
8
  }
22
9
  export var Tab = function Tab(schema) {
23
10
  "use strict";
24
11
  _classCallCheck(this, Tab);
25
- _defineProperty(this, "type", "tab");
26
- _defineProperty(this, "title", void 0);
27
- _defineProperty(this, "items", void 0);
12
+ this.type = "tab";
28
13
  this.title = schema.title;
29
14
  this.items = schema.items;
30
15
  };