@hi-ui/hiui 2.15.11 → 2.15.12
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/es/_util/SwitchVersion.js +40 -0
- package/es/_util/depreactedPropsCompat.js +58 -0
- package/es/_util/index.js +31 -0
- package/es/_util/warning.js +2 -2
- package/es/alert/Alert.js +126 -0
- package/es/alert/__tests__/index.test.js +84 -0
- package/es/alert/index.js +6 -147
- package/es/alert/style/index.css +1 -1
- package/es/badge/Badge.js +82 -0
- package/es/badge/__tests__/index.test.js +82 -0
- package/es/badge/index.js +9 -87
- package/es/badge/style/index.css +1 -1
- package/es/badge/style/index.js +0 -0
- package/es/breadcrumb/__tests__/index.test.js +61 -0
- package/es/breadcrumb/index.js +85 -0
- package/es/breadcrumb/style/index.css +1 -0
- package/es/button/Button.js +62 -60
- package/es/button/ButtonGroup.js +24 -40
- package/es/button/IconLoading.js +6 -6
- package/es/button/__tests__/index.test.js +221 -0
- package/es/button/index.js +3 -2
- package/es/button/style/index.css +1 -1
- package/es/card/__tests__/index.test.js +179 -0
- package/es/card/index.js +61 -57
- package/es/card/style/index.css +1 -1
- package/es/carousel/__tests__/index.test.js +104 -0
- package/es/carousel/index.js +219 -0
- package/es/carousel/style/index.css +1 -0
- package/es/carousel/style/index.js +3 -0
- package/es/cascader/Cascader.js +190 -133
- package/es/cascader/Menu.js +168 -0
- package/es/cascader/__tests__/index.test.js +392 -0
- package/es/cascader/index.js +5 -2
- package/es/cascader/style/cascader.css +1 -1
- package/es/cascader/style/menu.css +1 -1
- package/es/checkbox/Checkbox.js +136 -0
- package/es/checkbox/Group.js +194 -0
- package/es/checkbox/__tests__/index.test.js +226 -0
- package/es/checkbox/checkbox-legacy/Base.js +212 -0
- package/es/checkbox/checkbox-legacy/CheckBox.js +157 -0
- package/es/checkbox/checkbox-legacy/index.js +15 -0
- package/es/checkbox/checkbox-legacy/style/index.css +1 -0
- package/es/checkbox/checkbox-legacy/style/index.js +3 -0
- package/es/checkbox/index.js +13 -4
- package/es/checkbox/style/index.css +1 -1
- package/es/collapse/__tests__/index.test.js +111 -0
- package/es/collapse/index.js +88 -110
- package/es/collapse/style/index.css +1 -1
- package/es/confirm/index.js +39 -60
- package/es/context/index.js +45 -51
- package/es/counter/Counter.js +339 -0
- package/es/counter/__tests__/index.test.js +134 -0
- package/es/counter/counter-legacy/index.js +267 -0
- package/es/counter/index.js +6 -270
- package/es/counter/style/index.css +1 -1
- package/es/date-picker/BasePicker.js +380 -302
- package/es/date-picker/Calender.js +326 -98
- package/es/date-picker/DatePanel.js +194 -213
- package/es/date-picker/DatePicker.js +143 -47
- package/es/date-picker/DateRangePanel.js +272 -208
- package/es/date-picker/Modal.js +18 -32
- package/es/date-picker/Time.js +231 -345
- package/es/date-picker/TimeList.js +246 -0
- package/es/date-picker/TimePanel.js +28 -41
- package/es/date-picker/TimePeriodPanel.js +27 -46
- package/es/date-picker/TimePicker.js +44 -46
- package/es/date-picker/TimeRangePanel.js +33 -51
- package/es/date-picker/Type.js +5 -1
- package/es/date-picker/WeekRangePanel.js +254 -175
- package/es/date-picker/YMRangePanel.js +364 -0
- package/es/date-picker/__tests__/index.test.js +956 -0
- package/es/date-picker/constants.js +14 -28
- package/es/date-picker/dateUtil.js +221 -52
- package/es/date-picker/datepicker-legacy/BasePicker.js +511 -0
- package/es/date-picker/datepicker-legacy/Calender.js +422 -0
- package/es/date-picker/datepicker-legacy/DatePanel.js +455 -0
- package/es/date-picker/datepicker-legacy/DatePicker.js +103 -0
- package/es/date-picker/datepicker-legacy/DateRangePanel.js +488 -0
- package/es/date-picker/datepicker-legacy/Modal.js +67 -0
- package/es/date-picker/datepicker-legacy/Time.js +405 -0
- package/es/date-picker/datepicker-legacy/TimePanel.js +85 -0
- package/es/date-picker/datepicker-legacy/TimePeriodPanel.js +118 -0
- package/es/date-picker/datepicker-legacy/TimePicker.js +78 -0
- package/es/date-picker/datepicker-legacy/TimeRangePanel.js +90 -0
- package/es/date-picker/datepicker-legacy/Type.js +31 -0
- package/es/date-picker/datepicker-legacy/WeekRangePanel.js +337 -0
- package/es/date-picker/datepicker-legacy/constants.js +79 -0
- package/es/date-picker/datepicker-legacy/dateUtil.js +258 -0
- package/es/date-picker/datepicker-legacy/index.js +15 -0
- package/es/date-picker/datepicker-legacy/local.js +11 -0
- package/es/date-picker/datepicker-legacy/style/index.css +1 -0
- package/es/date-picker/datepicker-legacy/style/index.js +3 -0
- package/es/date-picker/datepicker-legacy/style/timepicker.css +1 -0
- package/es/date-picker/datepicker-legacy/util.js +60 -0
- package/es/date-picker/index.js +5 -2
- package/es/date-picker/style/index.css +1 -1
- package/es/date-picker/toLunar.js +172 -0
- package/es/date-picker/util.js +101 -8
- package/es/dropdown/Dropdown.js +191 -203
- package/es/dropdown/DropdownButton.js +102 -0
- package/es/dropdown/DropdownMenu.js +107 -0
- package/es/dropdown/DropdownMenuItem.js +172 -0
- package/es/dropdown/__tests__/index.test.js +313 -0
- package/es/dropdown/index.js +69 -4
- package/es/dropdown/style/index.css +1 -1
- package/es/dropdown/style/index.js +0 -2
- package/es/dropdown/{__test__ → tests}/index.test.js +7 -7
- package/es/dropdown/utils.js +35 -0
- package/es/ficon/index.js +16 -30
- package/es/form/Form.js +176 -0
- package/es/form/{item.js → Item.js} +52 -60
- package/es/form/__tests__/index.test.js +571 -0
- package/es/form/index.js +6 -171
- package/es/form/style/index.css +1 -1
- package/es/grid/__tests__/index.test.js +100 -0
- package/es/grid/index.js +36 -56
- package/es/icon/index.js +23 -38
- package/es/index.js +61 -9
- package/es/input/Input.js +400 -0
- package/es/input/__tests__/index.test.js +376 -0
- package/es/input/index.js +26 -347
- package/es/input/input-legacy/index.js +341 -0
- package/es/input/input-legacy/util.js +176 -0
- package/es/input/style/index.css +1 -1
- package/es/input/util.js +26 -18
- package/es/lib/withDragDropContext.js +2 -2
- package/es/loading/Loading.js +173 -0
- package/es/loading/__tests__/index.test.js +110 -0
- package/es/loading/index.js +5 -129
- package/es/loading/style/index.css +0 -0
- package/es/loading/style/index.js +0 -0
- package/es/locales/en-US.js +45 -9
- package/es/locales/index.js +16 -2
- package/es/locales/zh-CN.js +46 -10
- package/es/locales/zh-Hant-HK.js +123 -0
- package/es/locales/zh-Hant-TW.js +125 -0
- package/es/menu/Item.js +34 -51
- package/es/menu/Menu.js +414 -0
- package/es/menu/SubMenu.js +63 -90
- package/es/menu/Title.js +37 -51
- package/es/menu/__tests__/index.test.js +274 -0
- package/es/menu/index.js +12 -419
- package/es/menu/style/index.css +1 -1
- package/es/message/__tests__/index.test.js +71 -0
- package/es/message/index.js +58 -0
- package/es/message/style/index.css +1 -0
- package/es/message/style/index.js +5 -0
- package/es/modal/__tests__/index.test.js +178 -0
- package/es/modal/index.js +85 -77
- package/es/modal/style/index.css +1 -1
- package/es/nav-menu/NavMenu.js +44 -61
- package/es/nav-menu/__test__/index.test.js +8 -8
- package/es/nav-menu/__tests__/index.test.js +23 -0
- package/es/nav-menu/index.js +2 -2
- package/es/notice/Notice.js +136 -0
- package/es/notice/NoticeContainer.js +107 -0
- package/es/notice/__tests__/index.test.js +174 -0
- package/es/notice/index.js +66 -0
- package/es/notice/style/index.css +1 -0
- package/es/notice/style/index.js +5 -0
- package/es/notification/HandleNotification/index.js +216 -0
- package/es/notification/HandleNotification/style/index.css +1 -0
- package/es/notification/HandleNotification/style/index.js +5 -0
- package/es/notification/__tests__/index.test.js +114 -0
- package/es/notification/index.js +68 -231
- package/es/notification/style/index.css +1 -1
- package/es/notification/style/index.js +0 -0
- package/es/pagination/Pager.js +7 -9
- package/es/pagination/Pagination.js +134 -133
- package/es/pagination/__tests__/index.test.js +244 -0
- package/es/pagination/index.js +9 -8
- package/es/pagination/style/index.css +1 -1
- package/es/panel/index.js +28 -46
- package/es/popover/__test__/index.test.js +10 -10
- package/es/popover/__tests__/index.test.js +152 -0
- package/es/popover/index.js +77 -83
- package/es/popper/index.js +68 -64
- package/es/popper/style/index.css +1 -1
- package/es/preview/index.js +529 -0
- package/es/preview/style/index.css +1 -0
- package/es/preview/style/index.js +3 -0
- package/es/progress/BarProgress.js +107 -43
- package/es/progress/CircleProgress.js +13 -14
- package/es/progress/DashboardProgress.js +11 -13
- package/es/progress/Progress.js +102 -0
- package/es/progress/__tests__/index.test.js +131 -0
- package/es/progress/index.js +8 -100
- package/es/progress/style/index.css +1 -1
- package/es/radio/Group.js +199 -0
- package/es/radio/Radio.js +147 -0
- package/es/radio/__tests__/index.test.js +127 -0
- package/es/radio/index.js +10 -216
- package/es/radio/{__test__ → radio-legacy/__test__}/index.test.js +13 -13
- package/es/radio/radio-legacy/index.js +214 -0
- package/es/radio/radio-legacy/style/index.css +1 -0
- package/es/radio/radio-legacy/style/index.js +3 -0
- package/es/radio/style/index.css +1 -1
- package/es/rate/Icons.js +70 -70
- package/es/rate/Rate.js +75 -108
- package/es/rate/__tests__/index.test.js +124 -0
- package/es/rate/index.js +5 -2
- package/es/rate/style/index.css +1 -1
- package/es/select/Select.js +330 -265
- package/es/select/SelectDropdown.js +223 -79
- package/es/select/SelectInput.js +120 -91
- package/es/select/__tests__/index.test.js +505 -0
- package/es/select/index.js +6 -4
- package/es/select/select-legacy/Option.js +78 -0
- package/es/select/select-legacy/Select.js +702 -0
- package/es/select/select-legacy/SelectDropdown.js +157 -0
- package/es/select/select-legacy/SelectInput.js +308 -0
- package/es/select/select-legacy/common.js +19 -0
- package/es/select/select-legacy/index.js +16 -0
- package/es/select/style/select-dropdown.css +1 -1
- package/es/select/style/select-input.css +1 -1
- package/es/stepper/Stepper.js +147 -0
- package/es/stepper/__tests__/index.test.js +161 -0
- package/es/stepper/index.js +21 -127
- package/es/stepper/style/index.css +1 -1
- package/es/style/icon/diyIcon.css +1 -1
- package/es/style/icon/index.css +1 -1
- package/es/switch/__tests__/index.test.js +68 -0
- package/es/switch/index.js +26 -46
- package/es/switch/style/index.css +1 -1
- package/es/table/Body.js +294 -0
- package/es/table/ClickOuterside.js +95 -0
- package/es/table/Footer.js +171 -0
- package/es/table/Header.js +320 -0
- package/es/table/TableContent.js +101 -0
- package/es/table/__tests__/index.test.js +129 -0
- package/es/table/checkbox/index.js +36 -47
- package/es/table/checkbox/style/index.css +1 -0
- package/es/table/checkbox/style/index.js +3 -0
- package/es/table/index.js +269 -314
- package/es/table/menu/index.js +34 -44
- package/es/table/prefix.js +2 -2
- package/es/table/style/Table.css +1 -1
- package/es/table/style/index.css +1 -1
- package/es/tabs/ItemDropdown.js +45 -65
- package/es/tabs/TabPane.js +26 -44
- package/es/tabs/Tabs.js +110 -111
- package/es/tabs/__tests__/index.test.js +329 -0
- package/es/tabs/index.js +9 -3
- package/es/tabs/style/index.css +1 -1
- package/es/tabs/tabs-legacy/ItemDropdown.js +162 -0
- package/es/tabs/tabs-legacy/TabPane.js +70 -0
- package/es/tabs/tabs-legacy/Tabs.js +291 -0
- package/es/tabs/tabs-legacy/index.js +18 -0
- package/es/tabs/tabs-legacy/style/index.css +1 -0
- package/es/tabs/tabs-legacy/style/index.js +3 -0
- package/es/tag/__tests__/index.test.js +46 -0
- package/es/tag/index.js +86 -0
- package/es/tag/style/index.css +1 -0
- package/es/tag/style/index.js +3 -0
- package/es/timeline/__tests__/index.test.js +198 -0
- package/es/timeline/index.js +206 -136
- package/es/timeline/style/index.css +1 -1
- package/es/tooltip/__tests__/index.test.js +166 -0
- package/es/tooltip/index.js +93 -52
- package/es/tooltip/style/index.css +1 -1
- package/es/transfer/Item.js +73 -71
- package/es/transfer/Transfer.js +558 -0
- package/es/transfer/__tests__/index.test.js +210 -0
- package/es/transfer/index.js +4 -443
- package/es/transfer/style/index.css +1 -1
- package/es/tree/IconLoading.js +38 -0
- package/es/tree/Tree.js +94 -111
- package/es/tree/TreeDivider.js +6 -6
- package/es/tree/TreeItem.js +217 -123
- package/es/tree/TreeNode.js +472 -333
- package/es/tree/__tests__/index.test.js +599 -0
- package/es/tree/index.js +9 -2
- package/es/tree/style/index.css +1 -1
- package/es/tree/tree-legacy/Tree.js +330 -0
- package/es/tree/tree-legacy/TreeDivider.js +25 -0
- package/es/tree/tree-legacy/TreeItem.js +326 -0
- package/es/tree/tree-legacy/TreeNode.js +711 -0
- package/es/tree/tree-legacy/index.js +13 -0
- package/es/tree/tree-legacy/style/index.css +1 -0
- package/es/tree/tree-legacy/style/index.js +3 -0
- package/es/tree/tree-legacy/util.js +434 -0
- package/es/tree/util.js +8 -256
- package/es/upload/Upload.js +292 -200
- package/es/upload/UploadAvatar.js +61 -79
- package/es/upload/UploadClick.js +62 -60
- package/es/upload/UploadDrag.js +63 -66
- package/es/upload/UploadPhoto.js +86 -75
- package/es/upload/UploadPictureCard.js +53 -60
- package/es/upload/__tests__/index.test.js +760 -0
- package/es/upload/index.js +8 -71
- package/es/upload/main.js +83 -0
- package/es/upload/style/index.css +1 -1
- package/es/upload/tool.js +0 -1
- package/es/upload/{Preview.js → upload-legacy/Preview.js} +48 -62
- package/es/upload/upload-legacy/Upload.js +431 -0
- package/es/upload/upload-legacy/UploadAvatar.js +318 -0
- package/es/upload/upload-legacy/UploadClick.js +121 -0
- package/es/upload/upload-legacy/UploadDrag.js +176 -0
- package/es/upload/upload-legacy/UploadPhoto.js +179 -0
- package/es/upload/upload-legacy/UploadPictureCard.js +122 -0
- package/es/upload/upload-legacy/index.js +67 -0
- package/es/upload/upload-legacy/style/index.css +1 -0
- package/es/upload/upload-legacy/style/index.js +5 -0
- package/es/upload/upload-legacy/tool.js +84 -0
- package/es/watermark/index.js +97 -0
- package/es/watermark/watermark.js +263 -0
- package/package.json +1 -1
- package/es/alert/__test__/index.test.js +0 -67
- package/es/button/__test__/index.test.js +0 -29
- package/es/cascader/__test__/index.test.js +0 -283
- package/es/cascader/menu.js +0 -155
- package/es/checkbox/Base.js +0 -205
- package/es/checkbox/CheckBox.js +0 -185
- package/es/collapse/__test__/index.test.js +0 -58
- package/es/counter/__test__/index.test.js +0 -52
- package/es/menu/ItemGroup.js +0 -81
- package/es/modal/__test__/index.test.js +0 -123
- package/es/notification/__test__/index.test.js +0 -56
- package/es/pagination/__test__/index.test.js +0 -140
- package/es/rate/__test__/index.test.js +0 -54
- package/es/select/Option.js +0 -93
- package/es/select/__test__/index.test.js +0 -429
- package/es/style/color/colors.css +0 -0
- package/es/style/index.css +0 -0
- package/es/style/mixins/colors.css +0 -0
- package/es/style/mixins/index.css +0 -0
- package/es/style/theme/dark.css +0 -0
- package/es/style/theme/default.css +0 -0
- package/es/switch/__test__/index.test.js +0 -39
- package/es/table/__test__/index.test.js +0 -73
- package/es/table/body.js +0 -318
- package/es/table/clickOuterside.js +0 -115
- package/es/table/footer.js +0 -196
- package/es/table/header.js +0 -337
- package/es/table/pover.js +0 -154
- package/es/table/tableContent.js +0 -120
- package/es/timeline/__test__/index.test.js +0 -49
- package/es/timeline/foldingItem.js +0 -82
- package/es/tooltip/__test__/index.test.js +0 -67
- package/es/transfer/__test__/index.test.js +0 -11
- /package/es/{style → breadcrumb/style}/index.js +0 -0
- /package/es/checkbox/{common.js → checkbox-legacy/common.js} +0 -0
- /package/es/upload/{style → upload-legacy/style}/preview.css +0 -0
- /package/es/upload/{style → upload-legacy/style}/preview.js +0 -0
package/es/cascader/menu.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
var _loading = _interopRequireDefault(require("../loading"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
19
|
-
|
|
20
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
-
|
|
22
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
23
|
-
|
|
24
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
27
|
-
|
|
28
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
29
|
-
|
|
30
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
31
|
-
|
|
32
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
|
-
|
|
34
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
35
|
-
|
|
36
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
37
|
-
|
|
38
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
-
|
|
40
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
|
-
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
|
-
|
|
44
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
45
|
-
|
|
46
|
-
var Menu = /*#__PURE__*/function (_Component) {
|
|
47
|
-
_inherits(Menu, _Component);
|
|
48
|
-
|
|
49
|
-
var _super = _createSuper(Menu);
|
|
50
|
-
|
|
51
|
-
function Menu() {
|
|
52
|
-
_classCallCheck(this, Menu);
|
|
53
|
-
|
|
54
|
-
return _super.apply(this, arguments);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
_createClass(Menu, [{
|
|
58
|
-
key: "root",
|
|
59
|
-
value: function root() {
|
|
60
|
-
return this.props.root();
|
|
61
|
-
}
|
|
62
|
-
}, {
|
|
63
|
-
key: "getOptionValues",
|
|
64
|
-
value: function getOptionValues(values, optionValue, index) {
|
|
65
|
-
if (index === 0) {
|
|
66
|
-
return [optionValue];
|
|
67
|
-
} else {
|
|
68
|
-
return values.slice(0, index).concat([optionValue]);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}, {
|
|
72
|
-
key: "renderMenus",
|
|
73
|
-
value: function renderMenus() {
|
|
74
|
-
var _this = this;
|
|
75
|
-
|
|
76
|
-
var _this$props = this.props,
|
|
77
|
-
value = _this$props.value,
|
|
78
|
-
options = _this$props.options,
|
|
79
|
-
onSelect = _this$props.onSelect;
|
|
80
|
-
var root = this.root();
|
|
81
|
-
var menus = [];
|
|
82
|
-
var valueKey = root.valueKey();
|
|
83
|
-
var labelKey = root.labelKey();
|
|
84
|
-
var childrenKey = root.childrenKey();
|
|
85
|
-
var currentOptions = options.slice();
|
|
86
|
-
var deep = 0;
|
|
87
|
-
|
|
88
|
-
var _loop = function _loop() {
|
|
89
|
-
var currentValue = value[deep];
|
|
90
|
-
|
|
91
|
-
var _currentOptions = currentOptions.slice();
|
|
92
|
-
|
|
93
|
-
currentOptions = false;
|
|
94
|
-
menus.push( /*#__PURE__*/_react["default"].createElement("ul", {
|
|
95
|
-
className: "hi-cascader-menu",
|
|
96
|
-
key: deep
|
|
97
|
-
}, _currentOptions.length === 0 && /*#__PURE__*/_react["default"].createElement(_loading["default"], {
|
|
98
|
-
size: "small"
|
|
99
|
-
}), _currentOptions.map(function (option) {
|
|
100
|
-
var optionValue = option[valueKey];
|
|
101
|
-
var hasChildren = Array.isArray(option[childrenKey]);
|
|
102
|
-
var isExpanded = hasChildren && optionValue === currentValue; // const expandIcon = isExpanded ? 'icon-right' : 'icon-right'
|
|
103
|
-
|
|
104
|
-
var expandIcon = 'icon-right';
|
|
105
|
-
var optionValues = option.jointOption ? optionValue : _this.getOptionValues(value, optionValue, deep); // jointOption为true代表搜索拼接出来的option,直接取value即可
|
|
106
|
-
|
|
107
|
-
if (isExpanded) {
|
|
108
|
-
currentOptions = option[childrenKey];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
112
|
-
className: (0, _classnames["default"])('hi-cascader-menu__item', {
|
|
113
|
-
'hi-cascader-menu__item-expanded': hasChildren,
|
|
114
|
-
'hi-cascader-menu__item-disabled': !!option.disabled,
|
|
115
|
-
'hi-cascader-menu__item-active': currentValue === optionValue
|
|
116
|
-
}),
|
|
117
|
-
onClick: function onClick(e) {
|
|
118
|
-
e.stopPropagation();
|
|
119
|
-
!option.disabled && onSelect(optionValues, hasChildren);
|
|
120
|
-
},
|
|
121
|
-
key: optionValue
|
|
122
|
-
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
123
|
-
className: "hi-cascader-menu__item--label"
|
|
124
|
-
}, option[labelKey]), hasChildren && /*#__PURE__*/_react["default"].createElement("i", {
|
|
125
|
-
className: (0, _classnames["default"])('hi-cascader-menu__item--icon', 'hi-icon', expandIcon)
|
|
126
|
-
}));
|
|
127
|
-
})));
|
|
128
|
-
deep++;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
while (currentOptions) {
|
|
132
|
-
_loop();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return menus;
|
|
136
|
-
}
|
|
137
|
-
}, {
|
|
138
|
-
key: "render",
|
|
139
|
-
value: function render() {
|
|
140
|
-
var menus = this.renderMenus();
|
|
141
|
-
return menus;
|
|
142
|
-
}
|
|
143
|
-
}]);
|
|
144
|
-
|
|
145
|
-
return Menu;
|
|
146
|
-
}(_react.Component);
|
|
147
|
-
|
|
148
|
-
_defineProperty(Menu, "propTypes", {
|
|
149
|
-
value: _propTypes["default"].array,
|
|
150
|
-
options: _propTypes["default"].array,
|
|
151
|
-
onSelect: _propTypes["default"].func
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
var _default = Menu;
|
|
155
|
-
exports["default"] = _default;
|
package/es/checkbox/Base.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
|
|
12
|
-
var _common = _interopRequireDefault(require("./common"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
21
|
-
|
|
22
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
-
|
|
24
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
25
|
-
|
|
26
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
27
|
-
|
|
28
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
|
-
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
-
|
|
32
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
-
|
|
34
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
35
|
-
|
|
36
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
-
|
|
38
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
-
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
42
|
-
var Base = /*#__PURE__*/function (_Component) {
|
|
43
|
-
_inherits(Base, _Component);
|
|
44
|
-
|
|
45
|
-
var _super = _createSuper(Base);
|
|
46
|
-
|
|
47
|
-
function Base(props) {
|
|
48
|
-
var _this;
|
|
49
|
-
|
|
50
|
-
_classCallCheck(this, Base);
|
|
51
|
-
|
|
52
|
-
_this = _super.call(this, props);
|
|
53
|
-
_this.state = {
|
|
54
|
-
checked: props.checked,
|
|
55
|
-
disabled: props.disabled,
|
|
56
|
-
value: props.value,
|
|
57
|
-
part: false,
|
|
58
|
-
onChange: props.onChange || function () {}
|
|
59
|
-
};
|
|
60
|
-
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
|
61
|
-
return _this;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
_createClass(Base, [{
|
|
65
|
-
key: "componentDidMount",
|
|
66
|
-
value: function componentDidMount() {
|
|
67
|
-
var root = _common["default"].getRoot(this.props.name);
|
|
68
|
-
|
|
69
|
-
if (this.state.checked) {
|
|
70
|
-
root && root.setState({
|
|
71
|
-
part: true
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}, {
|
|
76
|
-
key: "componentWillReceiveProps",
|
|
77
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
78
|
-
if ('checked' in nextProps) {
|
|
79
|
-
this.setState({
|
|
80
|
-
checked: nextProps.checked,
|
|
81
|
-
disabled: nextProps.disabled
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
key: "handleChange",
|
|
87
|
-
value: function handleChange(data) {
|
|
88
|
-
var value = data.value,
|
|
89
|
-
checked = data.checked,
|
|
90
|
-
name = data.name,
|
|
91
|
-
all = data.all;
|
|
92
|
-
var checkedList = [];
|
|
93
|
-
|
|
94
|
-
if (all) {
|
|
95
|
-
var list = _common["default"].getAll(all);
|
|
96
|
-
|
|
97
|
-
var root = _common["default"].getRoot(all);
|
|
98
|
-
|
|
99
|
-
var num = 0;
|
|
100
|
-
list.map(function (item) {
|
|
101
|
-
if (item.state.disabled && item.state.checked) {
|
|
102
|
-
num++;
|
|
103
|
-
checkedList.push(item.state.value);
|
|
104
|
-
return;
|
|
105
|
-
} else if (checked) {
|
|
106
|
-
num++;
|
|
107
|
-
checkedList.push(item.state.value);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
item.setState({
|
|
111
|
-
checked: checked
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
root && root.setState({
|
|
115
|
-
part: !!(num > 0 && num < list.length)
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (name) {
|
|
120
|
-
var allRef = _common["default"].getAll(name);
|
|
121
|
-
|
|
122
|
-
var _root = _common["default"].getRoot(name);
|
|
123
|
-
|
|
124
|
-
if (_root) {
|
|
125
|
-
var t = allRef.filter(function (item) {
|
|
126
|
-
return item.state.checked === true;
|
|
127
|
-
});
|
|
128
|
-
var part = false;
|
|
129
|
-
var _checked = false;
|
|
130
|
-
t.length < allRef.length && t.length !== 0 && (part = true);
|
|
131
|
-
t.length === allRef.length && (_checked = true);
|
|
132
|
-
|
|
133
|
-
_root.setState({
|
|
134
|
-
part: part,
|
|
135
|
-
checked: _checked
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
checkedList = t.map(function (item) {
|
|
139
|
-
return item.state.value;
|
|
140
|
-
});
|
|
141
|
-
} else {
|
|
142
|
-
var _t = allRef.filter(function (item) {
|
|
143
|
-
return item.state.checked === true;
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
checkedList = _t.map(function (item) {
|
|
147
|
-
return item.state.value;
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (name || all) {
|
|
153
|
-
var _root2 = _common["default"].getRoot(name || all);
|
|
154
|
-
|
|
155
|
-
_root2 ? _root2.state.onChange(checkedList, value, checked) : this.state.onChange(checkedList, value, checked);
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
this.state.onChange(value, checked);
|
|
160
|
-
}
|
|
161
|
-
}, {
|
|
162
|
-
key: "render",
|
|
163
|
-
value: function render() {
|
|
164
|
-
var _this2 = this;
|
|
165
|
-
|
|
166
|
-
var _this$state = this.state,
|
|
167
|
-
disabled = _this$state.disabled,
|
|
168
|
-
checked = _this$state.checked,
|
|
169
|
-
part = _this$state.part;
|
|
170
|
-
var _this$props = this.props,
|
|
171
|
-
value = _this$props.value,
|
|
172
|
-
name = _this$props.name,
|
|
173
|
-
all = _this$props.all,
|
|
174
|
-
content = _this$props.content;
|
|
175
|
-
var labelClass = (0, _classnames["default"])('hi-checkbox', disabled && 'hi-checkbox--disabled', checked && 'hi-checkbox--checked', part && "hi-checkbox--part");
|
|
176
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
177
|
-
className: labelClass,
|
|
178
|
-
onClick: function onClick() {
|
|
179
|
-
if (disabled) return;
|
|
180
|
-
|
|
181
|
-
_this2.setState({
|
|
182
|
-
checked: !_this2.state.checked,
|
|
183
|
-
part: false
|
|
184
|
-
}, function () {
|
|
185
|
-
_this2.handleChange({
|
|
186
|
-
value: value,
|
|
187
|
-
checked: _this2.state.checked,
|
|
188
|
-
name: name,
|
|
189
|
-
all: all
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
194
|
-
className: "hi-checkbox__input"
|
|
195
|
-
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
196
|
-
className: "hi-checkbox__label"
|
|
197
|
-
}, content));
|
|
198
|
-
}
|
|
199
|
-
}]);
|
|
200
|
-
|
|
201
|
-
return Base;
|
|
202
|
-
}(_react.Component);
|
|
203
|
-
|
|
204
|
-
var _default = Base;
|
|
205
|
-
exports["default"] = _default;
|
package/es/checkbox/CheckBox.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _Base = _interopRequireDefault(require("./Base"));
|
|
13
|
-
|
|
14
|
-
var _common = _interopRequireDefault(require("./common"));
|
|
15
|
-
|
|
16
|
-
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
21
|
-
|
|
22
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
-
|
|
24
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
25
|
-
|
|
26
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
|
-
|
|
28
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
29
|
-
|
|
30
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
31
|
-
|
|
32
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
33
|
-
|
|
34
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
-
|
|
36
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
37
|
-
|
|
38
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
39
|
-
|
|
40
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
|
-
|
|
42
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
43
|
-
|
|
44
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
|
-
|
|
46
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
47
|
-
|
|
48
|
-
var CheckBox = /*#__PURE__*/function (_Component) {
|
|
49
|
-
_inherits(CheckBox, _Component);
|
|
50
|
-
|
|
51
|
-
var _super = _createSuper(CheckBox);
|
|
52
|
-
|
|
53
|
-
function CheckBox() {
|
|
54
|
-
_classCallCheck(this, CheckBox);
|
|
55
|
-
|
|
56
|
-
return _super.apply(this, arguments);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
_createClass(CheckBox, [{
|
|
60
|
-
key: "componentWillReceiveProps",
|
|
61
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
62
|
-
var groups = _common["default"].getAll(nextProps.name);
|
|
63
|
-
|
|
64
|
-
var list = this.props.list;
|
|
65
|
-
var arr = [];
|
|
66
|
-
list && list.length > 0 && list.forEach(function (item) {
|
|
67
|
-
var value = item.value || item.text;
|
|
68
|
-
groups && groups.length > 0 && groups.forEach(function (g) {
|
|
69
|
-
if (g.state.value === value) {
|
|
70
|
-
arr.push(g);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
_common["default"].replace(nextProps.name, arr);
|
|
76
|
-
}
|
|
77
|
-
}, {
|
|
78
|
-
key: "componentWillUnmount",
|
|
79
|
-
value: function componentWillUnmount() {
|
|
80
|
-
_common["default"].remove(this.props.name || this.props.all);
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
key: "shouldComponentUpdate",
|
|
84
|
-
value: function shouldComponentUpdate(nextProps, nextState) {
|
|
85
|
-
if (this.props.list && (0, _isEqual["default"])(this.props.list, nextProps.list)) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
}, {
|
|
92
|
-
key: "renderCheckBoxGroup",
|
|
93
|
-
value: function renderCheckBoxGroup(list) {
|
|
94
|
-
var _this = this;
|
|
95
|
-
|
|
96
|
-
return /*#__PURE__*/_react["default"].createElement("div", null, list && list.map(function (item, index) {
|
|
97
|
-
if (_typeof(item) === 'object') {
|
|
98
|
-
var value = item.value,
|
|
99
|
-
text = item.text,
|
|
100
|
-
checked = item.checked,
|
|
101
|
-
disabled = item.disabled;
|
|
102
|
-
return /*#__PURE__*/_react["default"].createElement(_Base["default"], {
|
|
103
|
-
ref: function ref(el) {
|
|
104
|
-
_this.props.name && _common["default"].add(_this.props.name, el);
|
|
105
|
-
},
|
|
106
|
-
content: text || '',
|
|
107
|
-
value: value || text,
|
|
108
|
-
checked: checked,
|
|
109
|
-
disabled: disabled,
|
|
110
|
-
key: value || text,
|
|
111
|
-
onChange: _this.props.onChange,
|
|
112
|
-
name: _this.props.name
|
|
113
|
-
});
|
|
114
|
-
} else if (typeof item === 'string') {
|
|
115
|
-
return /*#__PURE__*/_react["default"].createElement(_Base["default"], {
|
|
116
|
-
ref: function ref(el) {
|
|
117
|
-
_this.props.name && _common["default"].add(_this.props.name, el);
|
|
118
|
-
},
|
|
119
|
-
content: item || '',
|
|
120
|
-
value: item || '',
|
|
121
|
-
checked: false,
|
|
122
|
-
disabled: false,
|
|
123
|
-
key: item,
|
|
124
|
-
onChange: _this.props.onChange,
|
|
125
|
-
name: _this.props.name
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
key: "render",
|
|
132
|
-
value: function render() {
|
|
133
|
-
var _this2 = this;
|
|
134
|
-
|
|
135
|
-
var _this$props = this.props,
|
|
136
|
-
list = _this$props.list,
|
|
137
|
-
checked = _this$props.checked,
|
|
138
|
-
disabled = _this$props.disabled,
|
|
139
|
-
text = _this$props.text,
|
|
140
|
-
children = _this$props.children,
|
|
141
|
-
value = _this$props.value,
|
|
142
|
-
name = _this$props.name,
|
|
143
|
-
all = _this$props.all,
|
|
144
|
-
onChange = _this$props.onChange;
|
|
145
|
-
|
|
146
|
-
if (list) {
|
|
147
|
-
return this.renderCheckBoxGroup(list);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return /*#__PURE__*/_react["default"].createElement(_Base["default"], {
|
|
151
|
-
ref: function ref(el) {
|
|
152
|
-
_this2.props.name && _common["default"].add(_this2.props.name, el);
|
|
153
|
-
_this2.props.all && _common["default"].addRoot(_this2.props.all, el);
|
|
154
|
-
},
|
|
155
|
-
content: text || children,
|
|
156
|
-
value: value || text || children,
|
|
157
|
-
checked: checked,
|
|
158
|
-
disabled: disabled,
|
|
159
|
-
name: name,
|
|
160
|
-
all: all,
|
|
161
|
-
onChange: onChange
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}]);
|
|
165
|
-
|
|
166
|
-
return CheckBox;
|
|
167
|
-
}(_react.Component);
|
|
168
|
-
|
|
169
|
-
_defineProperty(CheckBox, "_type", 'CheckBox');
|
|
170
|
-
|
|
171
|
-
_defineProperty(CheckBox, "propTypes", {
|
|
172
|
-
onChange: _propTypes["default"].func,
|
|
173
|
-
checked: _propTypes["default"].bool,
|
|
174
|
-
disabled: _propTypes["default"].bool,
|
|
175
|
-
value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number, _propTypes["default"].bool]),
|
|
176
|
-
list: _propTypes["default"].array
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
_defineProperty(CheckBox, "defaultProps", {
|
|
180
|
-
checked: false,
|
|
181
|
-
value: ''
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
var _default = CheckBox;
|
|
185
|
-
exports["default"] = _default;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _reactTestRenderer = _interopRequireDefault(require("react-test-renderer"));
|
|
8
|
-
|
|
9
|
-
var _ = _interopRequireDefault(require("../"));
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
|
|
13
|
-
var changeCallback = jest.fn(function (key) {
|
|
14
|
-
return key;
|
|
15
|
-
});
|
|
16
|
-
describe('Collapse', function () {
|
|
17
|
-
it('手风琴模式&不可点击状态测试成功', function () {
|
|
18
|
-
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
|
|
19
|
-
onChange: changeCallback,
|
|
20
|
-
accordion: true,
|
|
21
|
-
arrow: "right"
|
|
22
|
-
}, /*#__PURE__*/_react["default"].createElement(_["default"].Panel, {
|
|
23
|
-
disabled: true,
|
|
24
|
-
header: "panel title 1"
|
|
25
|
-
}, /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 1"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 1"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 1")), /*#__PURE__*/_react["default"].createElement(_["default"].Panel, {
|
|
26
|
-
header: "panel title 2"
|
|
27
|
-
}, /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 2"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 2"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 2")), /*#__PURE__*/_react["default"].createElement(_["default"].Panel, {
|
|
28
|
-
header: "panel title 3"
|
|
29
|
-
}, /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 3"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 3"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 3"))));
|
|
30
|
-
expect(wrapper.find('.collapse-item--show')).toHaveLength(0);
|
|
31
|
-
wrapper.find('.collapse-item__head').at(0).simulate('click'); // test disabled
|
|
32
|
-
|
|
33
|
-
expect(wrapper.find('.collapse-item--show')).toHaveLength(0);
|
|
34
|
-
wrapper.find('.collapse-item__head').at(1).simulate('click');
|
|
35
|
-
expect(wrapper.find('.collapse-item--show')).toHaveLength(1);
|
|
36
|
-
wrapper.find('.collapse-item__head').at(2).simulate('click');
|
|
37
|
-
expect(wrapper.find('.collapse-item--show')).toHaveLength(1);
|
|
38
|
-
expect(changeCallback.mock.results[1].value).toBe('2');
|
|
39
|
-
});
|
|
40
|
-
it('非手风琴模式&默认激活测试成功', function () {
|
|
41
|
-
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
|
|
42
|
-
onChange: changeCallback,
|
|
43
|
-
activeKey: "2",
|
|
44
|
-
arrow: "left"
|
|
45
|
-
}, /*#__PURE__*/_react["default"].createElement(_["default"].Panel, {
|
|
46
|
-
header: "panel title 1"
|
|
47
|
-
}, /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 1"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 1"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 1")), /*#__PURE__*/_react["default"].createElement(_["default"].Panel, {
|
|
48
|
-
header: "panel title 2"
|
|
49
|
-
}, /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 2"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 2"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 2")), /*#__PURE__*/_react["default"].createElement(_["default"].Panel, {
|
|
50
|
-
header: "panel title 3"
|
|
51
|
-
}, /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 3"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 3"), /*#__PURE__*/_react["default"].createElement("p", null, "Collapse Panel Content 3"))));
|
|
52
|
-
expect(wrapper.find('.collapse-item--show')).toHaveLength(1); // 测试默认激活
|
|
53
|
-
|
|
54
|
-
wrapper.find('.collapse-item__head').at(0).simulate('click');
|
|
55
|
-
expect(wrapper.find('.collapse-item--show')).toHaveLength(2);
|
|
56
|
-
expect(changeCallback.mock.results[2].value).toEqual(['2', '0']);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = _interopRequireDefault(require("react"));
|
|
4
|
-
|
|
5
|
-
var _enzyme = require("enzyme");
|
|
6
|
-
|
|
7
|
-
var _ = _interopRequireDefault(require("../"));
|
|
8
|
-
|
|
9
|
-
var _module = require("module");
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
|
|
13
|
-
var changeCallback = jest.fn(function (val) {
|
|
14
|
-
return val;
|
|
15
|
-
});
|
|
16
|
-
describe('Counter', function () {
|
|
17
|
-
it('基础操作', function () {
|
|
18
|
-
var wrapper = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(_["default"], {
|
|
19
|
-
value: "4",
|
|
20
|
-
step: "1",
|
|
21
|
-
min: "-10",
|
|
22
|
-
max: "10",
|
|
23
|
-
onChange: changeCallback
|
|
24
|
-
}));
|
|
25
|
-
expect(wrapper.find('input').props().value).toEqual('4');
|
|
26
|
-
wrapper.find('.hi-counter-plus').simulate('click'); // +1
|
|
27
|
-
|
|
28
|
-
expect(wrapper.find('input').props().value).toEqual('5');
|
|
29
|
-
wrapper.find('.hi-counter-minus').simulate('click'); // -1
|
|
30
|
-
|
|
31
|
-
expect(wrapper.find('input').props().value).toEqual('4');
|
|
32
|
-
wrapper.find('input').simulate('change', {
|
|
33
|
-
target: {
|
|
34
|
-
value: '100'
|
|
35
|
-
}
|
|
36
|
-
}); // 测试超过最大值
|
|
37
|
-
|
|
38
|
-
wrapper.find('input').simulate('blur');
|
|
39
|
-
expect(wrapper.find('input').props().value).toEqual('10');
|
|
40
|
-
expect(wrapper.find('.hi-counter-plus').hasClass('disabled')).toEqual(true); // 已达到最大值时+不可点击
|
|
41
|
-
|
|
42
|
-
wrapper.find('input').simulate('change', {
|
|
43
|
-
target: {
|
|
44
|
-
value: '-100'
|
|
45
|
-
}
|
|
46
|
-
}); // 测试超过最小值
|
|
47
|
-
|
|
48
|
-
wrapper.find('input').simulate('blur');
|
|
49
|
-
expect(wrapper.find('input').props().value).toEqual('-10');
|
|
50
|
-
expect(wrapper.find('.hi-counter-minus').hasClass('disabled')).toEqual(true); // 已达到最小值时-不可点击
|
|
51
|
-
});
|
|
52
|
-
});
|