iglooform 2.4.32 → 2.4.33

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.
@@ -60,20 +60,15 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
60
60
  allChoose = _useState2[0],
61
61
  setAllChoose = _useState2[1];
62
62
 
63
- var _useState3 = useState(function () {
64
- return handleFilterDisable(allSelected, disabled);
65
- }),
66
- _useState4 = _slicedToArray(_useState3, 1),
67
- allCanChoose = _useState4[0];
68
-
63
+ var nowValidList = handleFilterDisable(allSelected, disabled);
69
64
  useEffect(function () {
70
65
  // 有可能用户配置的可选大于实际能选中的
71
- if (chooseed.length >= allCanChoose.length) {
66
+ if (chooseed.length >= nowValidList.length) {
72
67
  setAllChoose(true);
73
68
  } else {
74
69
  setAllChoose(false);
75
70
  }
76
- }, [chooseed.length, allCanChoose]);
71
+ }, [chooseed.length, allSelected]);
77
72
  return _jsxs("div", {
78
73
  className: "igloo-form-filter-drop-down-container-content-group",
79
74
  children: [_jsxs("div", {
@@ -100,10 +95,10 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
100
95
  }) : _jsx("span", {
101
96
  className: "igloo-form-filter-drop-down-container-content-group-title-action",
102
97
  onClick: function onClick() {
103
- typeof _onChange === 'function' && _onChange(allCanChoose);
98
+ typeof _onChange === 'function' && _onChange(nowValidList);
104
99
  valueConfirm({
105
100
  type: optionKey,
106
- value: allCanChoose
101
+ value: nowValidList
107
102
  });
108
103
  setAllChoose(true);
109
104
  },
@@ -259,7 +259,7 @@ var Element = function Element(_ref) {
259
259
  }));
260
260
 
261
261
  if (preview) {
262
- if (hideWhenPreview) return null;
262
+ if (hideWhenPreview || !display) return null;
263
263
  return component;
264
264
  }
265
265
 
@@ -97,6 +97,16 @@ var IglooSelect = function IglooSelect(_ref) {
97
97
  useEffect(function () {
98
98
  setDisplay(options);
99
99
  }, [options]);
100
+ useEffect(function () {
101
+ var setFieldValue = rest.setFieldValue;
102
+ var foundValue = options.find(function (option) {
103
+ return Array.isArray(valueProp) ? valueProp.includes(option.value) : option.value === valueProp;
104
+ });
105
+
106
+ if (!foundValue) {
107
+ typeof setFieldValue === 'function' && setFieldValue();
108
+ }
109
+ }, [valueProp, options]);
100
110
 
101
111
  var _useState7 = useState(false),
102
112
  _useState8 = _slicedToArray(_useState7, 2),
@@ -79,20 +79,15 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
79
79
  allChoose = _useState2[0],
80
80
  setAllChoose = _useState2[1];
81
81
 
82
- var _useState3 = (0, _react.useState)(function () {
83
- return handleFilterDisable(allSelected, disabled);
84
- }),
85
- _useState4 = _slicedToArray(_useState3, 1),
86
- allCanChoose = _useState4[0];
87
-
82
+ var nowValidList = handleFilterDisable(allSelected, disabled);
88
83
  (0, _react.useEffect)(function () {
89
84
  // 有可能用户配置的可选大于实际能选中的
90
- if (chooseed.length >= allCanChoose.length) {
85
+ if (chooseed.length >= nowValidList.length) {
91
86
  setAllChoose(true);
92
87
  } else {
93
88
  setAllChoose(false);
94
89
  }
95
- }, [chooseed.length, allCanChoose]);
90
+ }, [chooseed.length, allSelected]);
96
91
  return (0, _jsxRuntime.jsxs)("div", {
97
92
  className: "igloo-form-filter-drop-down-container-content-group",
98
93
  children: [(0, _jsxRuntime.jsxs)("div", {
@@ -119,10 +114,10 @@ var CratetCheckBoxFilter = function CratetCheckBoxFilter(props) {
119
114
  }) : (0, _jsxRuntime.jsx)("span", {
120
115
  className: "igloo-form-filter-drop-down-container-content-group-title-action",
121
116
  onClick: function onClick() {
122
- typeof _onChange === 'function' && _onChange(allCanChoose);
117
+ typeof _onChange === 'function' && _onChange(nowValidList);
123
118
  valueConfirm({
124
119
  type: optionKey,
125
- value: allCanChoose
120
+ value: nowValidList
126
121
  });
127
122
  setAllChoose(true);
128
123
  },
@@ -288,7 +288,7 @@ var Element = function Element(_ref) {
288
288
  }));
289
289
 
290
290
  if (preview) {
291
- if (hideWhenPreview) return null;
291
+ if (hideWhenPreview || !display) return null;
292
292
  return component;
293
293
  }
294
294
 
@@ -122,6 +122,16 @@ var IglooSelect = function IglooSelect(_ref) {
122
122
  (0, _react.useEffect)(function () {
123
123
  setDisplay(options);
124
124
  }, [options]);
125
+ (0, _react.useEffect)(function () {
126
+ var setFieldValue = rest.setFieldValue;
127
+ var foundValue = options.find(function (option) {
128
+ return Array.isArray(valueProp) ? valueProp.includes(option.value) : option.value === valueProp;
129
+ });
130
+
131
+ if (!foundValue) {
132
+ typeof setFieldValue === 'function' && setFieldValue();
133
+ }
134
+ }, [valueProp, options]);
125
135
 
126
136
  var _useState7 = (0, _react.useState)(false),
127
137
  _useState8 = _slicedToArray(_useState7, 2),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "2.4.32",
3
+ "version": "2.4.33",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",