@signalplus/params-about 0.1.18 → 0.1.21

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/index.d.ts CHANGED
@@ -51,9 +51,9 @@ declare class ParamRenderer extends PureComponent<ParamRendererProps> {
51
51
  interface ParentSelectorOption {
52
52
  parentId?: string | number;
53
53
  $paramId: string | number;
54
- name: string;
54
+ name?: string;
55
55
  disabled?: boolean;
56
- valueType?: ParamType;
56
+ valueType: ParamType;
57
57
  children?: ParentSelectorOption[];
58
58
  [key: string]: any;
59
59
  }
@@ -65,7 +65,7 @@ interface ParentSelectorProps extends BaseInputProps {
65
65
 
66
66
  interface ParamFormData {
67
67
  parentId?: string;
68
- paramId?: string;
68
+ $paramId?: string;
69
69
  key: string;
70
70
  name?: string;
71
71
  valueType: ParamType;
@@ -174,8 +174,9 @@ interface ImageUploadProps extends BaseInputProps {
174
174
 
175
175
  interface ParamGroupEditorData {
176
176
  parentId: string;
177
- paramId?: string;
177
+ $paramId?: string;
178
178
  name: string;
179
+ valueType?: ParamType;
179
180
  descriptionUrl?: string;
180
181
  }
181
182
  interface ParamGroupEditorProps extends Required<Pick<ImageUploadProps, 'getSignedUrl' | 'handleUpload'>> {
@@ -226,6 +227,11 @@ interface ParamMoverProps {
226
227
  * */
227
228
  targetParams: (string | number)[];
228
229
  allParams: NonNullable<ParentSelectorProps['parentOptions']>;
230
+ /**
231
+ * 最大层级(包括参数)
232
+ * @default 3
233
+ * */
234
+ maxLevel?: number;
229
235
  onSubmit?(params: NonNullable<ParentSelectorProps['parentOptions']>): any;
230
236
  }
231
237
  declare function initState(props: ParamMoverProps): {
package/lib/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Bundle of @signalplus/params-about
3
- * Generated: 2022-04-10
4
- * Version: 0.1.18
3
+ * Generated: 2022-04-11
4
+ * Version: 0.1.21
5
5
  * License: MIT
6
6
  * Author: 2631541504@qq.com
7
7
  */
@@ -1530,7 +1530,7 @@ var ParamFormModalEl = /*#__PURE__*/function (_PureComponent2) {
1530
1530
  get: function get() {
1531
1531
  var _this$props$initialVa;
1532
1532
 
1533
- return Boolean((_this$props$initialVa = this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.paramId);
1533
+ return Boolean((_this$props$initialVa = this.props.initialValues) === null || _this$props$initialVa === void 0 ? void 0 : _this$props$initialVa.$paramId);
1534
1534
  }
1535
1535
  }, {
1536
1536
  key: "render",
@@ -2026,7 +2026,7 @@ var ParamGroupEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
2026
2026
  get: function get() {
2027
2027
  var _this$props$initialVa2;
2028
2028
 
2029
- return Boolean((_this$props$initialVa2 = this.props.initialValues) === null || _this$props$initialVa2 === void 0 ? void 0 : _this$props$initialVa2.paramId);
2029
+ return Boolean((_this$props$initialVa2 = this.props.initialValues) === null || _this$props$initialVa2 === void 0 ? void 0 : _this$props$initialVa2.$paramId);
2030
2030
  }
2031
2031
  }, {
2032
2032
  key: "render",
@@ -2036,7 +2036,7 @@ var ParamGroupEditorModalEl = /*#__PURE__*/function (_PureComponent2) {
2036
2036
  return /*#__PURE__*/React.createElement(Modal, {
2037
2037
  key: String(this.state.visible),
2038
2038
  width: 640,
2039
- title: ((_this$props$initialVa3 = this.props.initialValues) === null || _this$props$initialVa3 === void 0 ? void 0 : _this$props$initialVa3.paramId) ? '编辑参数组' : '新增参数组',
2039
+ title: ((_this$props$initialVa3 = this.props.initialValues) === null || _this$props$initialVa3 === void 0 ? void 0 : _this$props$initialVa3.$paramId) ? '编辑参数组' : '新增参数组',
2040
2040
  closable: false,
2041
2041
  visible: this.state.visible,
2042
2042
  footer: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
@@ -2082,20 +2082,31 @@ var ParamGroupEditorModal = /*#__PURE__*/function () {
2082
2082
  _defineProperty(ParamGroupEditorModal, "el", new ReactGlobalComp('param-group-editor-modal', ParamGroupEditorModalEl));
2083
2083
 
2084
2084
  function genOptions(props) {
2085
- var filter = function filter(it) {
2086
- return it.valueType === ParamType.ParamGroup;
2085
+ var _props$maxLevel = props.maxLevel,
2086
+ maxLevel = _props$maxLevel === void 0 ? 3 : _props$maxLevel;
2087
+
2088
+ var filter = function filter(it, level) {
2089
+ return it.valueType === ParamType.ParamGroup && level < maxLevel;
2087
2090
  };
2088
2091
 
2089
- var cvt = function cvt(it) {
2092
+ var cvt = function cvt(it, level) {
2090
2093
  var _it$children;
2091
2094
 
2092
2095
  return _objectSpread2(_objectSpread2({}, it), {}, {
2093
2096
  disabled: props.targetParams.includes(String(it.$paramId)),
2094
- children: (_it$children = it.children) === null || _it$children === void 0 ? void 0 : _it$children.filter(filter).map(cvt)
2097
+ children: (_it$children = it.children) === null || _it$children === void 0 ? void 0 : _it$children.filter(function ($it) {
2098
+ return filter($it, level + 1);
2099
+ }).map(function ($it) {
2100
+ return cvt($it, level + 1);
2101
+ })
2095
2102
  });
2096
2103
  };
2097
2104
 
2098
- return props.allParams.map(cvt) || [];
2105
+ return props.allParams.filter(function (it) {
2106
+ return filter(it, 1);
2107
+ }).map(function (it) {
2108
+ return cvt(it, 1);
2109
+ }) || [];
2099
2110
  }
2100
2111
 
2101
2112
  function genParamsMap(props) {
@@ -2192,7 +2203,10 @@ var ParamMover = /*#__PURE__*/function (_PureComponent) {
2192
2203
  return /*#__PURE__*/React.createElement(ParentSelector, Object.assign({}, props, {
2193
2204
  parentOptions: _this3.state.options
2194
2205
  }));
2195
- }
2206
+ },
2207
+ validator: validatorCvt(function (val) {
2208
+ return emptyValidator(val);
2209
+ })
2196
2210
  }];
2197
2211
  return items;
2198
2212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalplus/params-about",
3
- "version": "0.1.18",
3
+ "version": "0.1.21",
4
4
  "description": "A description for the module",
5
5
  "main": "./lib/umd/index.js",
6
6
  "module": "./lib/es/index.js",