@signalplus/params-about 0.1.10 → 0.1.13

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
@@ -49,6 +49,7 @@ declare class ParamRenderer extends PureComponent<ParamRendererProps> {
49
49
  }
50
50
 
51
51
  interface ParentSelectorOption {
52
+ parentId?: string | number;
52
53
  $paramId: string | number;
53
54
  name: string;
54
55
  disabled?: boolean;
@@ -217,13 +218,13 @@ declare class ParamGroupEditorModal {
217
218
  }
218
219
 
219
220
  interface ParamMoverData {
220
- parentId: string;
221
+ parentId: string | number;
221
222
  }
222
223
  interface ParamMoverProps {
223
224
  /**
224
225
  * 需要确保 targetParams 的元素之间无父子或者祖先子孙关系
225
226
  * */
226
- targetParams: string[];
227
+ targetParams: (string | number)[];
227
228
  allParams: NonNullable<ParentSelectorProps['parentOptions']>;
228
229
  onSubmit?(params: NonNullable<ParentSelectorProps['parentOptions']>): any;
229
230
  }
package/lib/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Bundle of @signalplus/params-about
3
3
  * Generated: 2022-04-10
4
- * Version: 0.1.10
4
+ * Version: 0.1.13
5
5
  * License: MIT
6
6
  * Author: 2631541504@qq.com
7
7
  */
@@ -2081,21 +2081,29 @@ var ParamGroupEditorModal = /*#__PURE__*/function () {
2081
2081
 
2082
2082
  _defineProperty(ParamGroupEditorModal, "el", new ReactGlobalComp('param-group-editor-modal', ParamGroupEditorModalEl));
2083
2083
 
2084
- function genOptions(props) {
2084
+ function genOptions(props, paramsMap) {
2085
2085
  var filter = function filter(it) {
2086
- return it.valueType !== ParamType.ParamGroup;
2086
+ return it.valueType === ParamType.ParamGroup;
2087
2087
  };
2088
2088
 
2089
+ var paramsAndParent = props.targetParams.flatMap(function (id) {
2090
+ var _paramsMap$id;
2091
+
2092
+ return [id, (_paramsMap$id = paramsMap[id]) === null || _paramsMap$id === void 0 ? void 0 : _paramsMap$id.$paramId].filter(function (it) {
2093
+ return it !== undefined;
2094
+ });
2095
+ });
2096
+
2089
2097
  var cvt = function cvt(it) {
2090
2098
  var _it$children;
2091
2099
 
2092
2100
  return _objectSpread2(_objectSpread2({}, it), {}, {
2093
- disabled: props.targetParams.includes(String(it.$paramId)),
2101
+ disabled: paramsAndParent.includes(String(it.$paramId)),
2094
2102
  children: (_it$children = it.children) === null || _it$children === void 0 ? void 0 : _it$children.filter(filter).map(cvt)
2095
2103
  });
2096
2104
  };
2097
2105
 
2098
- return props.allParams.filter(filter).map(cvt) || [];
2106
+ return props.allParams.map(cvt) || [];
2099
2107
  }
2100
2108
 
2101
2109
  function genParamsMap(props) {
@@ -2115,10 +2123,11 @@ function genParamsMap(props) {
2115
2123
  }
2116
2124
 
2117
2125
  function initState(props) {
2126
+ var paramsMap = genParamsMap(props);
2118
2127
  return {
2119
2128
  preProps: props,
2120
- options: genOptions(props),
2121
- paramsMap: genParamsMap(props)
2129
+ options: genOptions(props, paramsMap),
2130
+ paramsMap: paramsMap
2122
2131
  };
2123
2132
  }
2124
2133
 
@@ -2226,7 +2235,7 @@ var ParamMover = /*#__PURE__*/function (_PureComponent) {
2226
2235
  state.paramsMap = genParamsMap(props);
2227
2236
 
2228
2237
  if (props.targetParams !== state.preProps.targetParams) {
2229
- state.options = genOptions(props);
2238
+ state.options = genOptions(props, state.paramsMap);
2230
2239
  }
2231
2240
  }
2232
2241
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalplus/params-about",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
4
4
  "description": "A description for the module",
5
5
  "main": "./lib/umd/index.js",
6
6
  "module": "./lib/es/index.js",