@sheinx/base 3.5.7 → 3.5.8-beta.2

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.
@@ -609,7 +609,7 @@ var Cascader = function Cascader(props0) {
609
609
  if (filterText !== undefined) {
610
610
  updatePath();
611
611
  }
612
- }, [filterText]);
612
+ }, [filterText, firstMatchNode]);
613
613
  (0, _react.useEffect)(function () {
614
614
  updatePathByValue();
615
615
 
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,QAAA,MAAM,YAAY,oGA6HjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,QAAA,MAAM,YAAY,oGAqIjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -82,6 +82,7 @@ var CascaderNode = function CascaderNode(props) {
82
82
  handleChange(null, !checked);
83
83
  };
84
84
  var isHoverAble = expandTrigger === 'hover' || expandTrigger === 'hover-only';
85
+ var isRealLeafNode = !hasChildren && !uncertainChildren;
85
86
  var getEvents = function getEvents() {
86
87
  var events = {};
87
88
  if (expandTrigger !== 'hover-only' || !hasChildren) {
@@ -90,6 +91,9 @@ var CascaderNode = function CascaderNode(props) {
90
91
  if (isHoverAble) {
91
92
  events.onMouseEnter = handlePathChange;
92
93
  if (multiple) events.onClick = handleSelect;
94
+ } else if (isRealLeafNode && multiple) {
95
+ // 非hover模式下: 末级节点支持整个节点区域点击选中checkbox
96
+ events.onClick = handleSelect;
93
97
  }
94
98
  return events;
95
99
  };
@@ -122,9 +126,10 @@ var CascaderNode = function CascaderNode(props) {
122
126
  }
123
127
  return null;
124
128
  };
129
+ var events = getEvents();
125
130
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({
126
131
  className: rootClass
127
- }, getEvents()), {}, {
132
+ }, events), {}, {
128
133
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
129
134
  className: (0, _classnames.default)(styles.optionInner),
130
135
  children: [multiple && !(shouldFinal && hasChildren) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_checkbox.default
@@ -135,7 +140,7 @@ var CascaderNode = function CascaderNode(props) {
135
140
  className: styles.optionCheckbox,
136
141
  checked: datum.getChecked(id),
137
142
  disabled: isDisabled,
138
- onChange: isHoverAble && multiple ? undefined : handleChange
143
+ onChange: events.onClick === handleSelect ? undefined : handleChange
139
144
  }), renderContent(), renderIcon()]
140
145
  })
141
146
  }));
@@ -602,7 +602,7 @@ var Cascader = function Cascader(props0) {
602
602
  if (filterText !== undefined) {
603
603
  updatePath();
604
604
  }
605
- }, [filterText]);
605
+ }, [filterText, firstMatchNode]);
606
606
  useEffect(function () {
607
607
  updatePathByValue();
608
608
 
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,QAAA,MAAM,YAAY,oGA6HjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["node.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAQ,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOhD,QAAA,MAAM,YAAY,oGAqIjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -76,6 +76,7 @@ var CascaderNode = function CascaderNode(props) {
76
76
  handleChange(null, !checked);
77
77
  };
78
78
  var isHoverAble = expandTrigger === 'hover' || expandTrigger === 'hover-only';
79
+ var isRealLeafNode = !hasChildren && !uncertainChildren;
79
80
  var getEvents = function getEvents() {
80
81
  var events = {};
81
82
  if (expandTrigger !== 'hover-only' || !hasChildren) {
@@ -84,6 +85,9 @@ var CascaderNode = function CascaderNode(props) {
84
85
  if (isHoverAble) {
85
86
  events.onMouseEnter = handlePathChange;
86
87
  if (multiple) events.onClick = handleSelect;
88
+ } else if (isRealLeafNode && multiple) {
89
+ // 非hover模式下: 末级节点支持整个节点区域点击选中checkbox
90
+ events.onClick = handleSelect;
87
91
  }
88
92
  return events;
89
93
  };
@@ -116,9 +120,10 @@ var CascaderNode = function CascaderNode(props) {
116
120
  }
117
121
  return null;
118
122
  };
123
+ var events = getEvents();
119
124
  return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
120
125
  className: rootClass
121
- }, getEvents()), {}, {
126
+ }, events), {}, {
122
127
  children: /*#__PURE__*/_jsxs("div", {
123
128
  className: classNames(styles.optionInner),
124
129
  children: [multiple && !(shouldFinal && hasChildren) && /*#__PURE__*/_jsx(Checkbox
@@ -129,7 +134,7 @@ var CascaderNode = function CascaderNode(props) {
129
134
  className: styles.optionCheckbox,
130
135
  checked: datum.getChecked(id),
131
136
  disabled: isDisabled,
132
- onChange: isHoverAble && multiple ? undefined : handleChange
137
+ onChange: events.onClick === handleSelect ? undefined : handleChange
133
138
  }), renderContent(), renderIcon()]
134
139
  })
135
140
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.5.7",
3
+ "version": "3.5.8-beta.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "module": "./esm/index.js",
11
11
  "typings": "./cjs/index.d.ts",
12
12
  "dependencies": {
13
- "@sheinx/hooks": "3.5.7",
13
+ "@sheinx/hooks": "3.5.8-beta.2",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.1.3-alpha.0"