@hi-ui/hiui 2.15.10 → 2.15.11
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 +3 -0
- package/es/_util/warning.js +2 -2
- package/es/alert/__test__/index.test.js +67 -0
- package/es/alert/index.js +147 -6
- package/es/alert/style/index.css +1 -1
- package/es/badge/index.js +87 -9
- package/es/badge/style/index.css +1 -1
- package/es/badge/style/index.js +0 -0
- package/es/button/Button.js +51 -59
- package/es/button/ButtonGroup.js +31 -23
- package/es/button/IconLoading.js +2 -2
- package/es/button/__test__/index.test.js +29 -0
- package/es/button/index.js +2 -3
- package/es/button/style/index.css +1 -1
- package/es/card/index.js +42 -54
- package/es/card/style/index.css +1 -1
- package/es/cascader/Cascader.js +116 -181
- package/es/cascader/__test__/index.test.js +283 -0
- package/es/cascader/index.js +2 -5
- package/es/cascader/menu.js +155 -0
- package/es/cascader/style/cascader.css +1 -1
- package/es/cascader/style/menu.css +1 -1
- package/es/checkbox/{checkbox-legacy/Base.js → Base.js} +31 -46
- package/es/checkbox/CheckBox.js +185 -0
- package/es/checkbox/index.js +4 -13
- package/es/checkbox/style/index.css +1 -1
- package/es/collapse/__test__/index.test.js +58 -0
- package/es/collapse/index.js +93 -79
- package/es/collapse/style/index.css +1 -1
- package/es/confirm/index.js +50 -37
- package/es/context/index.js +37 -39
- package/es/counter/__test__/index.test.js +52 -0
- package/es/counter/index.js +270 -6
- package/es/counter/style/index.css +1 -1
- package/es/date-picker/BasePicker.js +288 -374
- package/es/date-picker/Calender.js +90 -326
- package/es/date-picker/DatePanel.js +186 -175
- package/es/date-picker/DatePicker.js +51 -151
- package/es/date-picker/DateRangePanel.js +181 -253
- package/es/date-picker/Modal.js +25 -15
- package/es/date-picker/Time.js +336 -230
- package/es/date-picker/TimePanel.js +32 -27
- package/es/date-picker/TimePeriodPanel.js +32 -21
- package/es/date-picker/TimePicker.js +40 -42
- package/es/date-picker/TimeRangePanel.js +42 -32
- package/es/date-picker/Type.js +1 -5
- package/es/date-picker/WeekRangePanel.js +150 -237
- package/es/date-picker/constants.js +28 -14
- package/es/date-picker/dateUtil.js +52 -221
- package/es/date-picker/index.js +2 -5
- package/es/date-picker/style/index.css +1 -1
- package/es/date-picker/util.js +8 -101
- package/es/dropdown/Dropdown.js +199 -193
- package/es/dropdown/{tests → __test__}/index.test.js +2 -2
- package/es/dropdown/index.js +4 -73
- package/es/dropdown/style/index.css +1 -1
- package/es/dropdown/style/index.js +2 -0
- package/es/ficon/index.js +23 -13
- package/es/form/index.js +171 -6
- package/es/form/{Item.js → item.js} +53 -53
- package/es/form/style/index.css +1 -1
- package/es/grid/index.js +37 -25
- package/es/icon/index.js +32 -21
- package/es/index.js +9 -61
- package/es/input/index.js +345 -28
- package/es/input/style/index.css +1 -1
- package/es/input/util.js +18 -26
- package/es/lib/withDragDropContext.js +2 -2
- package/es/loading/index.js +129 -5
- package/es/loading/style/index.css +0 -0
- package/es/loading/style/index.js +0 -0
- package/es/locales/en-US.js +11 -45
- package/es/locales/index.js +2 -16
- package/es/locales/zh-CN.js +12 -46
- package/es/menu/Item.js +41 -32
- package/es/menu/ItemGroup.js +81 -0
- package/es/menu/SubMenu.js +74 -55
- package/es/menu/Title.js +42 -36
- package/es/menu/index.js +419 -12
- package/es/menu/style/index.css +1 -1
- package/es/modal/__test__/index.test.js +123 -0
- package/es/modal/index.js +61 -77
- package/es/modal/style/index.css +1 -1
- package/es/nav-menu/NavMenu.js +45 -31
- package/es/nav-menu/__test__/index.test.js +2 -2
- package/es/nav-menu/index.js +2 -2
- package/es/notification/__test__/index.test.js +56 -0
- package/es/notification/index.js +231 -68
- package/es/notification/style/index.css +1 -1
- package/es/notification/style/index.js +0 -0
- package/es/pagination/Pager.js +8 -6
- package/es/pagination/Pagination.js +115 -124
- package/es/pagination/__test__/index.test.js +140 -0
- package/es/pagination/index.js +8 -9
- package/es/pagination/style/index.css +1 -1
- package/es/panel/index.js +33 -23
- package/es/popover/__test__/index.test.js +2 -2
- package/es/popover/index.js +69 -71
- package/es/popper/index.js +54 -64
- package/es/popper/style/index.css +1 -1
- package/es/progress/BarProgress.js +43 -109
- package/es/progress/CircleProgress.js +10 -9
- package/es/progress/DashboardProgress.js +9 -7
- package/es/progress/index.js +100 -8
- package/es/progress/style/index.css +1 -1
- package/es/radio/{radio-legacy/__test__ → __test__}/index.test.js +10 -10
- package/es/radio/index.js +216 -10
- package/es/radio/style/index.css +1 -1
- package/es/rate/Icons.js +2 -2
- package/es/rate/Rate.js +90 -65
- package/es/rate/__test__/index.test.js +54 -0
- package/es/rate/index.js +2 -5
- package/es/rate/style/index.css +1 -1
- package/es/select/Option.js +93 -0
- package/es/select/Select.js +253 -325
- package/es/select/SelectDropdown.js +63 -215
- package/es/select/SelectInput.js +54 -88
- package/es/select/__test__/index.test.js +429 -0
- package/es/select/index.js +4 -6
- package/es/select/style/select-dropdown.css +1 -1
- package/es/select/style/select-input.css +1 -1
- package/es/stepper/index.js +127 -21
- package/es/stepper/style/index.css +1 -1
- package/es/style/color/colors.css +0 -0
- package/es/style/icon/diyIcon.css +1 -1
- package/es/style/icon/index.css +1 -1
- 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/{__tests__ → __test__}/index.test.js +2 -31
- package/es/switch/index.js +36 -24
- package/es/switch/style/index.css +1 -1
- package/es/table/__test__/index.test.js +73 -0
- package/es/table/{Body.js → body.js} +52 -36
- package/es/table/checkbox/index.js +36 -33
- package/es/table/clickOuterside.js +115 -0
- package/es/table/{Footer.js → footer.js} +41 -24
- package/es/table/{Header.js → header.js} +54 -41
- package/es/table/index.js +300 -262
- package/es/table/menu/index.js +34 -32
- package/es/table/pover.js +154 -0
- 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/table/tableContent.js +120 -0
- package/es/tabs/ItemDropdown.js +51 -39
- package/es/tabs/TabPane.js +35 -25
- package/es/tabs/Tabs.js +91 -98
- package/es/tabs/index.js +3 -9
- package/es/tabs/style/index.css +1 -1
- package/es/timeline/__test__/index.test.js +49 -0
- package/es/timeline/foldingItem.js +82 -0
- package/es/timeline/index.js +127 -203
- package/es/timeline/style/index.css +1 -1
- package/es/tooltip/__test__/index.test.js +67 -0
- package/es/tooltip/index.js +39 -86
- package/es/tooltip/style/index.css +1 -1
- package/es/transfer/Item.js +44 -53
- package/es/transfer/__test__/index.test.js +11 -0
- package/es/transfer/index.js +443 -4
- package/es/transfer/style/index.css +1 -1
- package/es/tree/Tree.js +86 -76
- package/es/tree/TreeDivider.js +3 -3
- package/es/tree/TreeItem.js +108 -204
- package/es/tree/TreeNode.js +318 -457
- package/es/tree/index.js +2 -9
- package/es/tree/style/index.css +1 -1
- package/es/tree/util.js +257 -9
- package/es/upload/{upload-legacy/Preview.js → Preview.js} +39 -33
- package/es/upload/Upload.js +193 -289
- package/es/upload/UploadAvatar.js +58 -44
- package/es/upload/UploadClick.js +45 -49
- package/es/upload/UploadDrag.js +43 -44
- package/es/upload/UploadPhoto.js +55 -70
- package/es/upload/UploadPictureCard.js +44 -39
- package/es/upload/index.js +71 -8
- package/es/upload/style/index.css +1 -1
- package/es/upload/tool.js +1 -0
- package/package.json +4 -1
- package/es/_util/SwitchVersion.js +0 -44
- package/es/_util/depreactedPropsCompat.js +0 -58
- package/es/_util/index.js +0 -32
- package/es/alert/Alert.js +0 -134
- package/es/alert/__tests__/index.test.js +0 -88
- package/es/badge/Badge.js +0 -90
- package/es/badge/__tests__/index.test.js +0 -82
- package/es/breadcrumb/__tests__/index.test.js +0 -61
- package/es/breadcrumb/index.js +0 -93
- package/es/breadcrumb/style/index.css +0 -1
- package/es/button/__tests__/index.test.js +0 -219
- package/es/card/__tests__/index.test.js +0 -169
- package/es/carousel/__tests__/index.test.js +0 -104
- package/es/carousel/index.js +0 -227
- package/es/carousel/style/index.css +0 -1
- package/es/carousel/style/index.js +0 -3
- package/es/cascader/Menu.js +0 -174
- package/es/cascader/__tests__/index.test.js +0 -389
- package/es/checkbox/Checkbox.js +0 -144
- package/es/checkbox/Group.js +0 -202
- package/es/checkbox/__tests__/index.test.js +0 -226
- package/es/checkbox/checkbox-legacy/CheckBox.js +0 -165
- package/es/checkbox/checkbox-legacy/index.js +0 -15
- package/es/checkbox/checkbox-legacy/style/index.css +0 -1
- package/es/checkbox/checkbox-legacy/style/index.js +0 -3
- package/es/collapse/__tests__/index.test.js +0 -111
- package/es/counter/Counter.js +0 -343
- package/es/counter/__tests__/index.test.js +0 -134
- package/es/counter/counter-legacy/index.js +0 -271
- package/es/date-picker/TimeList.js +0 -254
- package/es/date-picker/YMRangePanel.js +0 -372
- package/es/date-picker/__tests__/index.test.js +0 -961
- package/es/date-picker/datepicker-legacy/BasePicker.js +0 -519
- package/es/date-picker/datepicker-legacy/Calender.js +0 -430
- package/es/date-picker/datepicker-legacy/DatePanel.js +0 -463
- package/es/date-picker/datepicker-legacy/DatePicker.js +0 -107
- package/es/date-picker/datepicker-legacy/DateRangePanel.js +0 -496
- package/es/date-picker/datepicker-legacy/Modal.js +0 -71
- package/es/date-picker/datepicker-legacy/Time.js +0 -413
- package/es/date-picker/datepicker-legacy/TimePanel.js +0 -93
- package/es/date-picker/datepicker-legacy/TimePeriodPanel.js +0 -126
- package/es/date-picker/datepicker-legacy/TimePicker.js +0 -82
- package/es/date-picker/datepicker-legacy/TimeRangePanel.js +0 -98
- package/es/date-picker/datepicker-legacy/Type.js +0 -31
- package/es/date-picker/datepicker-legacy/WeekRangePanel.js +0 -345
- package/es/date-picker/datepicker-legacy/constants.js +0 -79
- package/es/date-picker/datepicker-legacy/dateUtil.js +0 -258
- package/es/date-picker/datepicker-legacy/index.js +0 -15
- package/es/date-picker/datepicker-legacy/local.js +0 -11
- package/es/date-picker/datepicker-legacy/style/index.css +0 -1
- package/es/date-picker/datepicker-legacy/style/index.js +0 -3
- package/es/date-picker/datepicker-legacy/style/timepicker.css +0 -1
- package/es/date-picker/datepicker-legacy/util.js +0 -60
- package/es/date-picker/toLunar.js +0 -172
- package/es/dropdown/DropdownButton.js +0 -106
- package/es/dropdown/DropdownMenu.js +0 -111
- package/es/dropdown/DropdownMenuItem.js +0 -178
- package/es/dropdown/__tests__/index.test.js +0 -317
- package/es/dropdown/utils.js +0 -35
- package/es/form/Form.js +0 -184
- package/es/form/__tests__/index.test.js +0 -575
- package/es/grid/__tests__/index.test.js +0 -104
- package/es/input/Input.js +0 -412
- package/es/input/__tests__/index.test.js +0 -381
- package/es/input/input-legacy/index.js +0 -353
- package/es/input/input-legacy/util.js +0 -176
- package/es/loading/Loading.js +0 -181
- package/es/loading/__tests__/index.test.js +0 -110
- package/es/locales/zh-Hant-HK.js +0 -121
- package/es/locales/zh-Hant-TW.js +0 -123
- package/es/menu/Menu.js +0 -422
- package/es/menu/__tests__/index.test.js +0 -279
- package/es/message/__tests__/index.test.js +0 -75
- package/es/message/index.js +0 -58
- package/es/message/style/index.css +0 -1
- package/es/message/style/index.js +0 -5
- package/es/modal/__tests__/index.test.js +0 -178
- package/es/nav-menu/__tests__/index.test.js +0 -27
- package/es/notice/Notice.js +0 -142
- package/es/notice/NoticeContainer.js +0 -113
- package/es/notice/__tests__/index.test.js +0 -174
- package/es/notice/index.js +0 -66
- package/es/notice/style/index.css +0 -1
- package/es/notice/style/index.js +0 -5
- package/es/notification/HandleNotification/index.js +0 -224
- package/es/notification/HandleNotification/style/index.css +0 -1
- package/es/notification/HandleNotification/style/index.js +0 -5
- package/es/notification/__tests__/index.test.js +0 -118
- package/es/pagination/__tests__/index.test.js +0 -248
- package/es/popover/__tests__/index.test.js +0 -152
- package/es/preview/index.js +0 -527
- package/es/preview/style/index.css +0 -1
- package/es/preview/style/index.js +0 -3
- package/es/progress/Progress.js +0 -110
- package/es/progress/__tests__/index.test.js +0 -131
- package/es/radio/Group.js +0 -203
- package/es/radio/Radio.js +0 -151
- package/es/radio/__tests__/index.test.js +0 -128
- package/es/radio/radio-legacy/index.js +0 -222
- package/es/radio/radio-legacy/style/index.css +0 -1
- package/es/radio/radio-legacy/style/index.js +0 -3
- package/es/rate/__tests__/index.test.js +0 -124
- package/es/select/__tests__/index.test.js +0 -505
- package/es/select/select-legacy/Option.js +0 -81
- package/es/select/select-legacy/Select.js +0 -710
- package/es/select/select-legacy/SelectDropdown.js +0 -164
- package/es/select/select-legacy/SelectInput.js +0 -312
- package/es/select/select-legacy/common.js +0 -19
- package/es/select/select-legacy/index.js +0 -16
- package/es/stepper/Stepper.js +0 -151
- package/es/stepper/__tests__/index.test.js +0 -161
- package/es/table/ClickOuterside.js +0 -103
- package/es/table/TableContent.js +0 -109
- package/es/table/__tests__/index.test.js +0 -133
- package/es/table/checkbox/style/index.css +0 -1
- package/es/table/checkbox/style/index.js +0 -3
- package/es/tabs/__tests__/index.test.js +0 -333
- package/es/tabs/tabs-legacy/ItemDropdown.js +0 -170
- package/es/tabs/tabs-legacy/TabPane.js +0 -78
- package/es/tabs/tabs-legacy/Tabs.js +0 -299
- package/es/tabs/tabs-legacy/index.js +0 -18
- package/es/tabs/tabs-legacy/style/index.css +0 -1
- package/es/tabs/tabs-legacy/style/index.js +0 -3
- package/es/tag/__tests__/index.test.js +0 -46
- package/es/tag/index.js +0 -94
- package/es/tag/style/index.css +0 -1
- package/es/tag/style/index.js +0 -3
- package/es/timeline/__tests__/index.test.js +0 -198
- package/es/tooltip/__tests__/index.test.js +0 -170
- package/es/transfer/Transfer.js +0 -566
- package/es/transfer/__tests__/index.test.js +0 -210
- package/es/tree/IconLoading.js +0 -38
- package/es/tree/__tests__/index.test.js +0 -603
- package/es/tree/tree-legacy/Tree.js +0 -337
- package/es/tree/tree-legacy/TreeDivider.js +0 -25
- package/es/tree/tree-legacy/TreeItem.js +0 -333
- package/es/tree/tree-legacy/TreeNode.js +0 -719
- package/es/tree/tree-legacy/index.js +0 -13
- package/es/tree/tree-legacy/style/index.css +0 -1
- package/es/tree/tree-legacy/style/index.js +0 -3
- package/es/tree/tree-legacy/util.js +0 -434
- package/es/upload/__tests__/index.test.js +0 -760
- package/es/upload/main.js +0 -91
- package/es/upload/upload-legacy/Upload.js +0 -435
- package/es/upload/upload-legacy/UploadAvatar.js +0 -322
- package/es/upload/upload-legacy/UploadClick.js +0 -125
- package/es/upload/upload-legacy/UploadDrag.js +0 -180
- package/es/upload/upload-legacy/UploadPhoto.js +0 -183
- package/es/upload/upload-legacy/UploadPictureCard.js +0 -126
- package/es/upload/upload-legacy/index.js +0 -75
- package/es/upload/upload-legacy/style/index.css +0 -1
- package/es/upload/upload-legacy/style/index.js +0 -5
- package/es/upload/upload-legacy/tool.js +0 -84
- package/es/watermark/index.js +0 -101
- package/es/watermark/watermark.js +0 -252
- /package/es/checkbox/{checkbox-legacy/common.js → common.js} +0 -0
- /package/es/{breadcrumb/style → style}/index.js +0 -0
- /package/es/upload/{upload-legacy/style → style}/preview.css +0 -0
- /package/es/upload/{upload-legacy/style → style}/preview.js +0 -0
package/es/ficon/index.js
CHANGED
|
@@ -1,39 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports["default"] = void 0;
|
|
9
7
|
|
|
10
|
-
var
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
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); }
|
|
15
13
|
|
|
16
|
-
|
|
14
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
15
|
|
|
18
|
-
var
|
|
16
|
+
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); } }
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
23
|
|
|
22
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (
|
|
24
|
+
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); }; }
|
|
23
25
|
|
|
24
|
-
function
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
27
|
+
|
|
28
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
+
|
|
30
|
+
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; } }
|
|
31
|
+
|
|
32
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
33
|
|
|
26
34
|
var Ficon = /*#__PURE__*/function (_React$Component) {
|
|
27
|
-
(
|
|
35
|
+
_inherits(Ficon, _React$Component);
|
|
28
36
|
|
|
29
37
|
var _super = _createSuper(Ficon);
|
|
30
38
|
|
|
31
39
|
function Ficon() {
|
|
32
|
-
(
|
|
40
|
+
_classCallCheck(this, Ficon);
|
|
41
|
+
|
|
33
42
|
return _super.apply(this, arguments);
|
|
34
43
|
}
|
|
35
44
|
|
|
36
|
-
(
|
|
45
|
+
_createClass(Ficon, [{
|
|
37
46
|
key: "render",
|
|
38
47
|
value: function render() {
|
|
39
48
|
var _this$props = this.props,
|
|
@@ -49,6 +58,7 @@ var Ficon = /*#__PURE__*/function (_React$Component) {
|
|
|
49
58
|
});
|
|
50
59
|
}
|
|
51
60
|
}]);
|
|
61
|
+
|
|
52
62
|
return Ficon;
|
|
53
63
|
}(_react["default"].Component);
|
|
54
64
|
|
package/es/form/index.js
CHANGED
|
@@ -1,21 +1,186 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports["default"] = void 0;
|
|
9
7
|
|
|
10
|
-
var
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _item = _interopRequireDefault(require("./item"));
|
|
13
13
|
|
|
14
14
|
var _context = _interopRequireDefault(require("../context"));
|
|
15
15
|
|
|
16
16
|
require("./style/index");
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
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
|
+
var PropTypes = require('prop-types');
|
|
47
|
+
|
|
48
|
+
var Form = /*#__PURE__*/function (_Component) {
|
|
49
|
+
_inherits(Form, _Component);
|
|
50
|
+
|
|
51
|
+
var _super = _createSuper(Form);
|
|
52
|
+
|
|
53
|
+
function Form(props) {
|
|
54
|
+
var _this;
|
|
55
|
+
|
|
56
|
+
_classCallCheck(this, Form);
|
|
57
|
+
|
|
58
|
+
_this = _super.call(this, props);
|
|
59
|
+
_this.state = {
|
|
60
|
+
fields: []
|
|
61
|
+
};
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_createClass(Form, [{
|
|
66
|
+
key: "getChildContext",
|
|
67
|
+
value: function getChildContext() {
|
|
68
|
+
return {
|
|
69
|
+
component: this
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "getClassNames",
|
|
74
|
+
value: function getClassNames() {
|
|
75
|
+
var _this$props = this.props,
|
|
76
|
+
labelPosition = _this$props.labelPosition,
|
|
77
|
+
inline = _this$props.inline;
|
|
78
|
+
var obj = {};
|
|
79
|
+
|
|
80
|
+
if (labelPosition) {
|
|
81
|
+
obj["hi-form--label--".concat(labelPosition)] = true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (inline) {
|
|
85
|
+
obj["hi-form--inline"] = true;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return obj;
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "addField",
|
|
92
|
+
value: function addField(field) {
|
|
93
|
+
this.setState(function (prevState) {
|
|
94
|
+
return {
|
|
95
|
+
fields: prevState.fields.concat(field)
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "removeField",
|
|
101
|
+
value: function removeField(prop) {
|
|
102
|
+
this.setState(function (prevState) {
|
|
103
|
+
return {
|
|
104
|
+
fields: prevState.fields.filter(function (field) {
|
|
105
|
+
return field.props.prop !== prop;
|
|
106
|
+
})
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "validate",
|
|
112
|
+
value: function validate(cb) {
|
|
113
|
+
var valid = true;
|
|
114
|
+
var count = 0;
|
|
115
|
+
var fields = this.state.fields;
|
|
116
|
+
|
|
117
|
+
if (fields.length === 0 && cb) {
|
|
118
|
+
cb(valid);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
fields.forEach(function (field) {
|
|
122
|
+
field.validate('', function (errors) {
|
|
123
|
+
if (errors) {
|
|
124
|
+
valid = false;
|
|
125
|
+
} else {
|
|
126
|
+
if (typeof cb === 'function' && ++count === fields.length) {
|
|
127
|
+
cb(valid);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}, {
|
|
134
|
+
key: "validateField",
|
|
135
|
+
value: function validateField(key, cb) {
|
|
136
|
+
var field = this.state.fields.filter(function (field) {
|
|
137
|
+
return field.props.prop === key;
|
|
138
|
+
})[0];
|
|
139
|
+
|
|
140
|
+
if (!field) {
|
|
141
|
+
throw new Error('must call validate Field with valid key string!');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
field.validate('', cb);
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
key: "resetValidates",
|
|
148
|
+
value: function resetValidates() {
|
|
149
|
+
this.state.fields.forEach(function (field) {
|
|
150
|
+
field.resetValidate();
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: "render",
|
|
155
|
+
value: function render() {
|
|
156
|
+
var children = this.props.children;
|
|
157
|
+
return /*#__PURE__*/_react["default"].createElement("form", {
|
|
158
|
+
className: (0, _classnames["default"])('hi-form', this.getClassNames())
|
|
159
|
+
}, children);
|
|
160
|
+
}
|
|
161
|
+
}]);
|
|
162
|
+
|
|
163
|
+
return Form;
|
|
164
|
+
}(_react.Component);
|
|
165
|
+
|
|
166
|
+
Form.childContextTypes = {
|
|
167
|
+
component: PropTypes.any
|
|
168
|
+
};
|
|
169
|
+
Form.propTypes = {
|
|
170
|
+
model: PropTypes.object,
|
|
171
|
+
rules: PropTypes.object,
|
|
172
|
+
labelPosition: PropTypes.oneOf(['right', 'left', 'top']),
|
|
173
|
+
labWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
174
|
+
inline: PropTypes.bool,
|
|
175
|
+
showColon: PropTypes.bool,
|
|
176
|
+
onSubmit: PropTypes.func
|
|
177
|
+
};
|
|
178
|
+
Form.defaultProps = {
|
|
179
|
+
size: 'small',
|
|
180
|
+
labelPosition: 'right',
|
|
181
|
+
showColon: true
|
|
182
|
+
};
|
|
183
|
+
var FormWrapper = (0, _context["default"])(Form);
|
|
184
|
+
FormWrapper.Item = _item["default"];
|
|
20
185
|
var _default = FormWrapper;
|
|
21
186
|
exports["default"] = _default;
|
|
@@ -1,53 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
3
|
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
6
|
exports["default"] = void 0;
|
|
11
7
|
|
|
12
|
-
var
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
9
|
|
|
14
|
-
var
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
11
|
|
|
16
|
-
var
|
|
12
|
+
var _asyncValidator = _interopRequireDefault(require("async-validator"));
|
|
17
13
|
|
|
18
|
-
var
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
15
|
|
|
20
|
-
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
23
19
|
|
|
24
|
-
var
|
|
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; }
|
|
25
21
|
|
|
26
|
-
|
|
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); }
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
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; }
|
|
29
25
|
|
|
30
|
-
|
|
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); }
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
35
|
|
|
34
|
-
function
|
|
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); }; }
|
|
35
37
|
|
|
36
|
-
function
|
|
38
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
37
39
|
|
|
38
|
-
function
|
|
40
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
41
|
|
|
40
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
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); }
|
|
41
45
|
|
|
42
46
|
var FormItem = /*#__PURE__*/function (_Component) {
|
|
43
|
-
(
|
|
47
|
+
_inherits(FormItem, _Component);
|
|
44
48
|
|
|
45
49
|
var _super = _createSuper(FormItem);
|
|
46
50
|
|
|
47
51
|
function FormItem(props, context) {
|
|
48
52
|
var _this;
|
|
49
53
|
|
|
50
|
-
(
|
|
54
|
+
_classCallCheck(this, FormItem);
|
|
55
|
+
|
|
51
56
|
_this = _super.call(this, props);
|
|
52
57
|
_this.state = {
|
|
53
58
|
error: '',
|
|
@@ -59,12 +64,12 @@ var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
59
64
|
return _this;
|
|
60
65
|
}
|
|
61
66
|
|
|
62
|
-
(
|
|
67
|
+
_createClass(FormItem, [{
|
|
63
68
|
key: "componentDidMount",
|
|
64
69
|
value: function componentDidMount() {
|
|
65
|
-
var
|
|
70
|
+
var prop = this.props.prop;
|
|
66
71
|
|
|
67
|
-
if (
|
|
72
|
+
if (prop) {
|
|
68
73
|
this.parent.addField(this);
|
|
69
74
|
this.valueInit();
|
|
70
75
|
}
|
|
@@ -72,12 +77,12 @@ var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
72
77
|
}, {
|
|
73
78
|
key: "componentWillUnmount",
|
|
74
79
|
value: function componentWillUnmount() {
|
|
75
|
-
this.parent.removeField(this.props.
|
|
80
|
+
this.parent.removeField(this.props.prop);
|
|
76
81
|
}
|
|
77
82
|
}, {
|
|
78
83
|
key: "valueInit",
|
|
79
84
|
value: function valueInit() {
|
|
80
|
-
var value = this.parent.props.model[this.props.
|
|
85
|
+
var value = this.parent.props.model[this.props.prop];
|
|
81
86
|
|
|
82
87
|
if (value === undefined) {
|
|
83
88
|
this.initValue = value;
|
|
@@ -90,7 +95,7 @@ var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
90
95
|
value: function getRules() {
|
|
91
96
|
var formRules = this.parent.props.rules;
|
|
92
97
|
var selfRules = this.props.rules;
|
|
93
|
-
formRules = formRules ? formRules[this.props.
|
|
98
|
+
formRules = formRules ? formRules[this.props.prop] : [];
|
|
94
99
|
return [].concat(selfRules || formRules || []);
|
|
95
100
|
}
|
|
96
101
|
}, {
|
|
@@ -106,12 +111,12 @@ var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
106
111
|
value: function getfieldValue() {
|
|
107
112
|
var model = this.parent.props.model;
|
|
108
113
|
|
|
109
|
-
if (!model || !this.props.
|
|
114
|
+
if (!model || !this.props.prop) {
|
|
110
115
|
return;
|
|
111
116
|
}
|
|
112
117
|
|
|
113
|
-
var keyList = this.props.
|
|
114
|
-
return keyList.length > 1 ? model[keyList[0]][keyList[1]] : model[this.props.
|
|
118
|
+
var keyList = this.props.prop.split(':');
|
|
119
|
+
return keyList.length > 1 ? model[keyList[0]][keyList[1]] : model[this.props.prop];
|
|
115
120
|
}
|
|
116
121
|
}, {
|
|
117
122
|
key: "validate",
|
|
@@ -131,8 +136,10 @@ var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
131
136
|
this.setState({
|
|
132
137
|
validating: true
|
|
133
138
|
});
|
|
134
|
-
var validator = new _asyncValidator["default"]((
|
|
135
|
-
|
|
139
|
+
var validator = new _asyncValidator["default"](_defineProperty({}, this.props.prop, rules));
|
|
140
|
+
|
|
141
|
+
var model = _defineProperty({}, this.props.prop, this.getfieldValue());
|
|
142
|
+
|
|
136
143
|
validator.validate(model, {
|
|
137
144
|
firstFields: true
|
|
138
145
|
}, function (errors) {
|
|
@@ -196,12 +203,6 @@ var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
196
203
|
this.validate('onChange');
|
|
197
204
|
}
|
|
198
205
|
}
|
|
199
|
-
}, {
|
|
200
|
-
key: "labelWidth",
|
|
201
|
-
get: function get() {
|
|
202
|
-
var labelWidth = this.props.labelWidth || this.parent.props.labelWidth;
|
|
203
|
-
return this.parent.props.labelPosition === 'top' ? false : labelWidth && parseInt(labelWidth);
|
|
204
|
-
}
|
|
205
206
|
}, {
|
|
206
207
|
key: "render",
|
|
207
208
|
value: function render() {
|
|
@@ -212,8 +213,7 @@ var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
212
213
|
label = _this$props.label,
|
|
213
214
|
required = _this$props.required,
|
|
214
215
|
className = _this$props.className,
|
|
215
|
-
shouldItemShowColon = _this$props.showColon
|
|
216
|
-
style = _this$props.style;
|
|
216
|
+
shouldItemShowColon = _this$props.showColon;
|
|
217
217
|
var _this$parent$props = this.parent.props,
|
|
218
218
|
shouldFormShowColon = _this$parent$props.showColon,
|
|
219
219
|
colon = _this$parent$props.localeDatas.form.colon;
|
|
@@ -226,14 +226,13 @@ var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
226
226
|
obj['hi-form-item--validating'] = validating;
|
|
227
227
|
obj['hi-form-item--required'] = this.isRequired() || required;
|
|
228
228
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
229
|
-
className: (0, _classnames["default"])('hi-form-item', className, obj)
|
|
230
|
-
style: style
|
|
229
|
+
className: (0, _classnames["default"])('hi-form-item', className, obj)
|
|
231
230
|
}, label || label === '' ? /*#__PURE__*/_react["default"].createElement("label", {
|
|
232
231
|
className: "hi-form-item__label",
|
|
233
232
|
style: {
|
|
234
233
|
width: this.labelWidth
|
|
235
234
|
}
|
|
236
|
-
}, typeof label === 'string' && label.trim()
|
|
235
|
+
}, typeof label === 'string' && label.trim(), shouldShowColon && colon) : /*#__PURE__*/_react["default"].createElement("span", {
|
|
237
236
|
className: "hi-form-item__span",
|
|
238
237
|
style: {
|
|
239
238
|
width: this.labelWidth
|
|
@@ -244,12 +243,10 @@ var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
244
243
|
onChange: function onChange() {
|
|
245
244
|
var _children$props;
|
|
246
245
|
|
|
247
|
-
|
|
248
|
-
|
|
246
|
+
children.props.onChange && (_children$props = children.props).onChange.apply(_children$props, arguments);
|
|
249
247
|
setTimeout(function () {
|
|
250
248
|
_this3.handleFieldChange();
|
|
251
249
|
});
|
|
252
|
-
return changeVal;
|
|
253
250
|
},
|
|
254
251
|
onBlur: function onBlur() {
|
|
255
252
|
var _children$props2;
|
|
@@ -263,7 +260,14 @@ var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
263
260
|
className: "hi-form-item--msg__error"
|
|
264
261
|
}, error)));
|
|
265
262
|
}
|
|
263
|
+
}, {
|
|
264
|
+
key: "labelWidth",
|
|
265
|
+
get: function get() {
|
|
266
|
+
var labelWidth = this.props.labelWidth || this.parent.props.labelWidth;
|
|
267
|
+
return this.parent.props.labelPosition === 'top' ? false : labelWidth && parseInt(labelWidth);
|
|
268
|
+
}
|
|
266
269
|
}]);
|
|
270
|
+
|
|
267
271
|
return FormItem;
|
|
268
272
|
}(_react.Component);
|
|
269
273
|
|
|
@@ -271,19 +275,15 @@ FormItem.contextTypes = {
|
|
|
271
275
|
component: _propTypes["default"].any
|
|
272
276
|
};
|
|
273
277
|
FormItem.propTypes = {
|
|
274
|
-
|
|
278
|
+
prop: _propTypes["default"].string,
|
|
275
279
|
rules: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].array]),
|
|
276
280
|
required: _propTypes["default"].bool,
|
|
277
281
|
label: _propTypes["default"].string,
|
|
278
282
|
labelWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
279
|
-
showColon: _propTypes["default"].bool
|
|
280
|
-
className: _propTypes["default"].string,
|
|
281
|
-
style: _propTypes["default"].object
|
|
283
|
+
showColon: _propTypes["default"].bool
|
|
282
284
|
};
|
|
283
285
|
FormItem.defaultProps = {
|
|
284
286
|
size: 'small'
|
|
285
287
|
};
|
|
286
|
-
|
|
287
|
-
var _default = (0, _util.depreactedPropsCompat)([['field', 'prop']])(FormItem);
|
|
288
|
-
|
|
288
|
+
var _default = FormItem;
|
|
289
289
|
exports["default"] = _default;
|
package/es/form/style/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.hi-form{max-width:100%;position:relative}.hi-form fieldset{margin:0;padding:0;border:0}.hi-form fieldset+fieldset{margin-top:16px}.hi-form legend{margin:0 0 16px;color:#666}.hi-form--inline{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.hi-form__title{-webkit-box-sizing:border-box;box-sizing:border-box;margin-top:0;margin-bottom:24px;font-size:16px;font-weight:400}.hi-form--label--left .hi-form-item__label{text-align:left}.hi-form--label--right .hi-form-item__label{text-align:right}.hi-form--label--top{padding-right:0;text-align:left}.hi-form--label--top.hi-form--inline .hi-form-item__span{min-height:32px}.hi-form--label--top .hi-form-item{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.hi-form
|
|
1
|
+
.hi-form{max-width:100%;position:relative}.hi-form fieldset{margin:0;padding:0;border:0}.hi-form fieldset+fieldset{margin-top:16px}.hi-form legend{margin:0 0 16px;color:#666}.hi-form--inline{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.hi-form__title{-webkit-box-sizing:border-box;box-sizing:border-box;margin-top:0;margin-bottom:24px;font-size:16px;font-weight:400}.hi-form--label--left .hi-form-item__label{text-align:left}.hi-form--label--right .hi-form-item__label{text-align:right}.hi-form--label--top{padding-right:0;text-align:left}.hi-form--label--top.hi-form--inline .hi-form-item__span{min-height:32px}.hi-form--label--top .hi-form-item{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.hi-form-item{display:-webkit-box;display:-ms-flexbox;display:flex;font-size:14px;margin-right:8px}.hi-form-item__label,.hi-form-item__span{-ms-flex-negative:0;flex-shrink:0;-webkit-box-sizing:border-box;box-sizing:border-box;vertical-align:top;color:#666;overflow-wrap:break-word}.hi-form-item__label{min-height:32px;padding-right:8px;line-height:32px}.hi-form-item__content{-webkit-box-flex:1;-ms-flex:1;flex:1;position:relative;vertical-align:top;min-height:32px}.hi-form-item__error .hi-input__inner{border-color:#f44141}.hi-form-item--msg__error{font-size:12px;min-height:24px;padding:2px 0;-webkit-box-sizing:border-box;box-sizing:border-box;line-height:20px;color:#f44141}.hi-form--inline .hi-form-item--msg__error{top:36px;left:0;line-height:18px}.hi-form-item--required .hi-form-item__label::before{margin-right:4px;content:'*';color:#f44141}.hi-form-item--fixed{position:absolute;top:0;right:0}
|