@hi-ui/dropdown 4.0.5 → 4.0.6

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/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @hi-ui/dropdown
2
+
3
+ ## 4.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2491](https://github.com/XiaoMi/hiui/pull/2491) [`80262b227`](https://github.com/XiaoMi/hiui/commit/80262b227cbab0799007fd931c93c2848204b48c) Thanks [@safga](https://github.com/safga)! - fix: 增加 dataItem 设置 disable 后样式
@@ -109,6 +109,7 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (_a, ref) {
109
109
  value: item.id,
110
110
  menu: menu,
111
111
  onClick: function onClick() {
112
+ if (item.disabled) return;
112
113
  _onClick === null || _onClick === void 0 ? void 0 : _onClick(item.id);
113
114
 
114
115
  if (!typeAssertion.isArray(item.children)) {
@@ -231,7 +232,7 @@ var DropdownMenuItem = /*#__PURE__*/React.forwardRef(function (_a, ref) {
231
232
  getTriggerProps = _useDropdown.getTriggerProps,
232
233
  getMenuProps = _useDropdown.getMenuProps;
233
234
 
234
- var cls = classname.cx(prefixCls, className, menuVisible && prefixCls + "--active");
235
+ var cls = classname.cx(prefixCls, className, menuVisible && prefixCls + "--active", disabled && prefixCls + "--disabled");
235
236
  var shouldUseLink = href && !disabled;
236
237
  return /*#__PURE__*/React__default["default"].createElement("li", Object.assign({
237
238
  ref: ref,
@@ -12,7 +12,7 @@
12
12
  Object.defineProperty(exports, '__esModule', {
13
13
  value: true
14
14
  });
15
- var css_248z = ".hi-v4-dropdown {display: inline-block; }.hi-v4-dropdown-menu {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;background-color: var(--hi-v4-color-static-white, #fff);border-radius: var(--hi-v4-border-radius-md, 4px);font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);color: var(--hi-v4-color-gray-700, #1f2733);width: var(--hi-v4-dropdown-menu-width, 180px); }.hi-v4-dropdown-menu-item {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;list-style: none;margin: 0;box-sizing: border-box;overflow: visible;padding: var(--hi-v4-spacing-2, 4px) 0; }.hi-v4-dropdown-menu-item__link {color: var(--hi-v4-color-gray-700, #1f2733);width: 100%;text-decoration: none;-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-dropdown-menu-item__arrow {-webkit-transform: rotate(-90deg);transform: rotate(-90deg); }.hi-v4-dropdown-menu-item__trigger {-webkit-box-sizing: border-box;box-sizing: border-box;width: 100%;height: 100%;cursor: pointer;border-radius: var(--hi-v4-border-radius-md, 4px);padding: var(--hi-v4-spacing-4, 8px) var(--hi-v4-spacing-6, 12px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between; }.hi-v4-dropdown-menu-item__trigger:hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-dropdown-menu-item--active > .hi-v4-dropdown-menu-item__trigger {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-dropdown-divider {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;list-style: none;background-color: var(--hi-v4-color-gray-200, #ebedf0);width: 100%;height: 1px;margin: var(--hi-v4-spacing-4, 8px) 0; }";
15
+ var css_248z = ".hi-v4-dropdown {display: inline-block; }.hi-v4-dropdown-menu {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;background-color: var(--hi-v4-color-static-white, #fff);border-radius: var(--hi-v4-border-radius-md, 4px);font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);color: var(--hi-v4-color-gray-700, #1f2733);width: var(--hi-v4-dropdown-menu-width, 180px); }.hi-v4-dropdown-menu-item {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;list-style: none;margin: 0;box-sizing: border-box;overflow: visible;padding: var(--hi-v4-spacing-2, 4px) 0; }.hi-v4-dropdown-menu-item__link {color: var(--hi-v4-color-gray-700, #1f2733);width: 100%;text-decoration: none;-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-dropdown-menu-item__arrow {-webkit-transform: rotate(-90deg);transform: rotate(-90deg); }.hi-v4-dropdown-menu-item__trigger {-webkit-box-sizing: border-box;box-sizing: border-box;width: 100%;height: 100%;cursor: pointer;border-radius: var(--hi-v4-border-radius-md, 4px);padding: var(--hi-v4-spacing-4, 8px) var(--hi-v4-spacing-6, 12px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between; }.hi-v4-dropdown-menu-item:not(.hi-v4-dropdown-menu-item--disabled) > .hi-v4-dropdown-menu-item__trigger:hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-dropdown-menu-item--active:not(.hi-v4-dropdown-menu-item--disabled) > .hi-v4-dropdown-menu-item__trigger {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-dropdown-menu-item--disabled > .hi-v4-dropdown-menu-item__trigger {cursor: not-allowed;color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-dropdown-divider {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;list-style: none;background-color: var(--hi-v4-color-gray-200, #ebedf0);width: 100%;height: 1px;margin: var(--hi-v4-spacing-4, 8px) 0; }";
16
16
 
17
17
  var __styleInject__ = require('inject-head-style')["default"];
18
18
 
@@ -81,6 +81,7 @@ var Dropdown = /*#__PURE__*/forwardRef(function (_a, ref) {
81
81
  value: item.id,
82
82
  menu: menu,
83
83
  onClick: function onClick() {
84
+ if (item.disabled) return;
84
85
  _onClick === null || _onClick === void 0 ? void 0 : _onClick(item.id);
85
86
 
86
87
  if (!isArray(item.children)) {
@@ -203,7 +204,7 @@ var DropdownMenuItem = /*#__PURE__*/forwardRef(function (_a, ref) {
203
204
  getTriggerProps = _useDropdown.getTriggerProps,
204
205
  getMenuProps = _useDropdown.getMenuProps;
205
206
 
206
- var cls = cx(prefixCls, className, menuVisible && prefixCls + "--active");
207
+ var cls = cx(prefixCls, className, menuVisible && prefixCls + "--active", disabled && prefixCls + "--disabled");
207
208
  var shouldUseLink = href && !disabled;
208
209
  return /*#__PURE__*/React.createElement("li", Object.assign({
209
210
  ref: ref,
@@ -8,7 +8,7 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  import __styleInject__ from 'inject-head-style';
11
- var css_248z = ".hi-v4-dropdown {display: inline-block; }.hi-v4-dropdown-menu {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;background-color: var(--hi-v4-color-static-white, #fff);border-radius: var(--hi-v4-border-radius-md, 4px);font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);color: var(--hi-v4-color-gray-700, #1f2733);width: var(--hi-v4-dropdown-menu-width, 180px); }.hi-v4-dropdown-menu-item {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;list-style: none;margin: 0;box-sizing: border-box;overflow: visible;padding: var(--hi-v4-spacing-2, 4px) 0; }.hi-v4-dropdown-menu-item__link {color: var(--hi-v4-color-gray-700, #1f2733);width: 100%;text-decoration: none;-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-dropdown-menu-item__arrow {-webkit-transform: rotate(-90deg);transform: rotate(-90deg); }.hi-v4-dropdown-menu-item__trigger {-webkit-box-sizing: border-box;box-sizing: border-box;width: 100%;height: 100%;cursor: pointer;border-radius: var(--hi-v4-border-radius-md, 4px);padding: var(--hi-v4-spacing-4, 8px) var(--hi-v4-spacing-6, 12px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between; }.hi-v4-dropdown-menu-item__trigger:hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-dropdown-menu-item--active > .hi-v4-dropdown-menu-item__trigger {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-dropdown-divider {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;list-style: none;background-color: var(--hi-v4-color-gray-200, #ebedf0);width: 100%;height: 1px;margin: var(--hi-v4-spacing-4, 8px) 0; }";
11
+ var css_248z = ".hi-v4-dropdown {display: inline-block; }.hi-v4-dropdown-menu {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;background-color: var(--hi-v4-color-static-white, #fff);border-radius: var(--hi-v4-border-radius-md, 4px);font-size: var(--hi-v4-text-size-md, 0.875rem);padding: var(--hi-v4-spacing-4, 8px);color: var(--hi-v4-color-gray-700, #1f2733);width: var(--hi-v4-dropdown-menu-width, 180px); }.hi-v4-dropdown-menu-item {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;list-style: none;margin: 0;box-sizing: border-box;overflow: visible;padding: var(--hi-v4-spacing-2, 4px) 0; }.hi-v4-dropdown-menu-item__link {color: var(--hi-v4-color-gray-700, #1f2733);width: 100%;text-decoration: none;-webkit-box-sizing: border-box;box-sizing: border-box; }.hi-v4-dropdown-menu-item__arrow {-webkit-transform: rotate(-90deg);transform: rotate(-90deg); }.hi-v4-dropdown-menu-item__trigger {-webkit-box-sizing: border-box;box-sizing: border-box;width: 100%;height: 100%;cursor: pointer;border-radius: var(--hi-v4-border-radius-md, 4px);padding: var(--hi-v4-spacing-4, 8px) var(--hi-v4-spacing-6, 12px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between; }.hi-v4-dropdown-menu-item:not(.hi-v4-dropdown-menu-item--disabled) > .hi-v4-dropdown-menu-item__trigger:hover {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-dropdown-menu-item--active:not(.hi-v4-dropdown-menu-item--disabled) > .hi-v4-dropdown-menu-item__trigger {background-color: var(--hi-v4-color-gray-100, #f2f4f7); }.hi-v4-dropdown-menu-item--disabled > .hi-v4-dropdown-menu-item__trigger {cursor: not-allowed;color: var(--hi-v4-color-gray-500, #929aa6); }.hi-v4-dropdown-divider {-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0;padding: 0;list-style: none;background-color: var(--hi-v4-color-gray-200, #ebedf0);width: 100%;height: 1px;margin: var(--hi-v4-spacing-4, 8px) 0; }";
12
12
 
13
13
  __styleInject__(css_248z);
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/dropdown",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -67,6 +67,5 @@
67
67
  "@hi-ui/hi-build": "^4.0.1",
68
68
  "react": "^17.0.1",
69
69
  "react-dom": "^17.0.1"
70
- },
71
- "gitHead": "686243832edd8a2d114ac385d0910838233c1e85"
70
+ }
72
71
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 Xiaomi
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.