@douyinfe/semi-foundation 2.19.0-beta.0 → 2.19.0
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/anchor/anchor.scss +1 -8
- package/anchor/rtl.scss +0 -1
- package/anchor/variables.scss +1 -0
- package/calendar/eventUtil.ts +8 -7
- package/calendar/foundation.ts +14 -14
- package/datePicker/monthsGridFoundation.ts +10 -3
- package/dropdown/foundation.ts +2 -1
- package/dropdown/menuFoundation.ts +2 -1
- package/getBabelConfig.js +0 -12
- package/lib/cjs/anchor/anchor.css +1 -10
- package/lib/cjs/anchor/anchor.scss +1 -8
- package/lib/cjs/anchor/constants.js +1 -4
- package/lib/cjs/anchor/foundation.js +5 -12
- package/lib/cjs/anchor/linkFoundation.js +4 -9
- package/lib/cjs/anchor/rtl.scss +0 -1
- package/lib/cjs/anchor/variables.scss +1 -0
- package/lib/cjs/autoComplete/constants.js +1 -4
- package/lib/cjs/autoComplete/foundation.js +14 -33
- package/lib/cjs/autoComplete/optionFoundation.js +4 -9
- package/lib/cjs/avatar/constants.js +1 -4
- package/lib/cjs/avatar/foundation.js +4 -9
- package/lib/cjs/backtop/constants.js +1 -4
- package/lib/cjs/backtop/foundation.js +4 -9
- package/lib/cjs/badge/constants.js +1 -4
- package/lib/cjs/banner/constants.js +1 -4
- package/lib/cjs/banner/foundation.js +4 -9
- package/lib/cjs/base/constants.js +2 -6
- package/lib/cjs/base/env.js +1 -4
- package/lib/cjs/base/foundation.js +5 -10
- package/lib/cjs/base/index.js +3 -6
- package/lib/cjs/breadcrumb/constants.js +1 -4
- package/lib/cjs/breadcrumb/foundation.js +6 -13
- package/lib/cjs/breadcrumb/itemFoundation.js +4 -9
- package/lib/cjs/button/constants.js +1 -4
- package/lib/cjs/calendar/constants.js +1 -4
- package/lib/cjs/calendar/eventUtil.d.ts +3 -3
- package/lib/cjs/calendar/eventUtil.js +28 -53
- package/lib/cjs/calendar/foundation.js +63 -85
- package/lib/cjs/card/constants.js +1 -4
- package/lib/cjs/carousel/constants.js +1 -4
- package/lib/cjs/carousel/foundation.js +5 -12
- package/lib/cjs/cascader/constants.js +1 -4
- package/lib/cjs/cascader/foundation.js +55 -100
- package/lib/cjs/cascader/util.js +9 -30
- package/lib/cjs/checkbox/checkboxFoundation.js +6 -13
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +9 -18
- package/lib/cjs/checkbox/constants.js +1 -4
- package/lib/cjs/collapse/constants.js +1 -4
- package/lib/cjs/collapse/foundation.js +9 -20
- package/lib/cjs/collapsible/constants.js +1 -4
- package/lib/cjs/datePicker/_utils/formatter.js +3 -12
- package/lib/cjs/datePicker/_utils/getDayOfWeek.js +1 -4
- package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +1 -4
- package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +5 -10
- package/lib/cjs/datePicker/_utils/getFullDateOffset.js +3 -6
- package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +2 -11
- package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +1 -4
- package/lib/cjs/datePicker/_utils/getMonthTable.js +2 -11
- package/lib/cjs/datePicker/_utils/getMonthsInYear.js +3 -16
- package/lib/cjs/datePicker/_utils/getYears.js +2 -9
- package/lib/cjs/datePicker/_utils/index.js +16 -30
- package/lib/cjs/datePicker/_utils/isAfter.js +3 -6
- package/lib/cjs/datePicker/_utils/isBefore.js +3 -6
- package/lib/cjs/datePicker/_utils/isBetween.js +3 -6
- package/lib/cjs/datePicker/_utils/isDate.js +1 -4
- package/lib/cjs/datePicker/_utils/isSameDay.js +3 -6
- package/lib/cjs/datePicker/_utils/isTimestamp.js +3 -6
- package/lib/cjs/datePicker/_utils/isUnixTimestamp.js +3 -6
- package/lib/cjs/datePicker/_utils/isValidDate.js +1 -4
- package/lib/cjs/datePicker/_utils/isWithinInterval.js +3 -6
- package/lib/cjs/datePicker/_utils/parser.js +1 -4
- package/lib/cjs/datePicker/constants.js +3 -10
- package/lib/cjs/datePicker/foundation.js +42 -85
- package/lib/cjs/datePicker/inputFoundation.js +7 -20
- package/lib/cjs/datePicker/monthFoundation.js +5 -12
- package/lib/cjs/datePicker/monthsGridFoundation.js +47 -68
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +4 -9
- package/lib/cjs/descriptions/constants.js +1 -4
- package/lib/cjs/divider/constants.js +1 -4
- package/lib/cjs/dropdown/constants.js +1 -4
- package/lib/cjs/dropdown/foundation.js +7 -15
- package/lib/cjs/dropdown/menuFoundation.js +11 -31
- package/lib/cjs/empty/constants.js +1 -4
- package/lib/cjs/form/constants.js +1 -4
- package/lib/cjs/form/foundation.js +64 -104
- package/lib/cjs/form/interface.js +1 -3
- package/lib/cjs/form/utils.js +14 -29
- package/lib/cjs/grid/constants.js +1 -4
- package/lib/cjs/icons/constants.js +1 -4
- package/lib/cjs/input/constants.js +1 -4
- package/lib/cjs/input/foundation.js +7 -18
- package/lib/cjs/input/textareaFoundation.js +6 -13
- package/lib/cjs/input/util/calculateNodeHeight.js +3 -17
- package/lib/cjs/input/util/getSizingData.js +5 -10
- package/lib/cjs/inputNumber/constants.js +4 -11
- package/lib/cjs/inputNumber/foundation.js +11 -30
- package/lib/cjs/layout/constants.js +1 -4
- package/lib/cjs/list/constants.js +1 -4
- package/lib/cjs/modal/constants.js +1 -4
- package/lib/cjs/modal/modalContentFoundation.js +4 -9
- package/lib/cjs/modal/modalFoundation.js +4 -9
- package/lib/cjs/navigation/NavItem.js +6 -21
- package/lib/cjs/navigation/constants.js +1 -4
- package/lib/cjs/navigation/foundation.js +22 -37
- package/lib/cjs/navigation/itemFoundation.js +4 -9
- package/lib/cjs/navigation/subNavFoundation.js +10 -21
- package/lib/cjs/notification/constants.js +1 -4
- package/lib/cjs/notification/notificationFoundation.js +5 -12
- package/lib/cjs/notification/notificationListFoundation.js +4 -9
- package/lib/cjs/overflowList/constants.js +3 -10
- package/lib/cjs/overflowList/foundation.js +12 -29
- package/lib/cjs/pagination/constants.js +1 -4
- package/lib/cjs/pagination/foundation.js +18 -37
- package/lib/cjs/popconfirm/constants.js +1 -4
- package/lib/cjs/popconfirm/popconfirmFoundation.js +3 -6
- package/lib/cjs/popover/constants.js +2 -9
- package/lib/cjs/progress/constants.js +1 -4
- package/lib/cjs/radio/constants.js +1 -4
- package/lib/cjs/radio/radioFoundation.js +3 -6
- package/lib/cjs/radio/radioGroupFoundation.js +6 -11
- package/lib/cjs/radio/radioInnerFoundation.js +5 -10
- package/lib/cjs/rating/constants.js +1 -4
- package/lib/cjs/rating/foundation.js +7 -20
- package/lib/cjs/scrollList/constants.js +1 -4
- package/lib/cjs/scrollList/foundation.js +3 -6
- package/lib/cjs/scrollList/itemFoundation.js +8 -21
- package/lib/cjs/scrollList/scrollTo.js +1 -4
- package/lib/cjs/select/constants.js +1 -4
- package/lib/cjs/select/foundation.js +56 -98
- package/lib/cjs/select/optionFoundation.js +4 -9
- package/lib/cjs/sideSheet/constants.js +1 -4
- package/lib/cjs/sideSheet/sideSheetFoundation.js +6 -15
- package/lib/cjs/skeleton/constants.js +1 -4
- package/lib/cjs/slider/constants.js +1 -4
- package/lib/cjs/slider/foundation.js +13 -24
- package/lib/cjs/space/constants.js +1 -4
- package/lib/cjs/spin/constants.js +1 -4
- package/lib/cjs/spin/foundation.js +5 -12
- package/lib/cjs/steps/constants.js +1 -4
- package/lib/cjs/switch/constants.js +1 -4
- package/lib/cjs/switch/foundation.js +4 -9
- package/lib/cjs/table/bodyFoundation.js +9 -22
- package/lib/cjs/table/cellFoundation.js +3 -6
- package/lib/cjs/table/constants.js +1 -4
- package/lib/cjs/table/foundation.js +76 -117
- package/lib/cjs/table/tableRowFoundation.js +3 -6
- package/lib/cjs/table/tableSelectionCellFoundation.js +3 -6
- package/lib/cjs/table/utils.js +42 -71
- package/lib/cjs/tabs/constants.js +1 -4
- package/lib/cjs/tabs/foundation.js +8 -23
- package/lib/cjs/tag/constants.js +1 -4
- package/lib/cjs/tagInput/constants.js +1 -4
- package/lib/cjs/tagInput/foundation.js +12 -31
- package/lib/cjs/tagInput/utils/getSplitedArray.js +3 -6
- package/lib/cjs/timePicker/ComboxFoundation.js +10 -29
- package/lib/cjs/timePicker/constants.js +1 -4
- package/lib/cjs/timePicker/foundation.js +26 -45
- package/lib/cjs/timePicker/inputFoundation.js +4 -9
- package/lib/cjs/timePicker/utils/index.js +7 -14
- package/lib/cjs/timePicker/utils/localeDate.js +2 -9
- package/lib/cjs/timeline/constants.js +1 -4
- package/lib/cjs/toast/constants.js +1 -4
- package/lib/cjs/toast/toastFoundation.js +5 -12
- package/lib/cjs/toast/toastListFoundation.js +5 -12
- package/lib/cjs/tooltip/constants.js +1 -4
- package/lib/cjs/tooltip/foundation.js +29 -56
- package/lib/cjs/transfer/constants.js +1 -4
- package/lib/cjs/transfer/foundation.js +24 -47
- package/lib/cjs/transfer/transferUtils.js +16 -45
- package/lib/cjs/tree/constants.js +1 -4
- package/lib/cjs/tree/foundation.js +41 -76
- package/lib/cjs/tree/treeUtil.js +60 -107
- package/lib/cjs/treeSelect/constants.js +1 -4
- package/lib/cjs/treeSelect/foundation.js +49 -82
- package/lib/cjs/typography/constants.js +1 -4
- package/lib/cjs/upload/constants.js +1 -4
- package/lib/cjs/upload/foundation.js +56 -112
- package/lib/cjs/upload/utils.js +13 -32
- package/lib/cjs/utils/Event.js +9 -23
- package/lib/cjs/utils/FocusHandle.js +6 -15
- package/lib/cjs/utils/Logger.js +1 -4
- package/lib/cjs/utils/Store.js +5 -20
- package/lib/cjs/utils/a11y.js +8 -13
- package/lib/cjs/utils/array.js +6 -15
- package/lib/cjs/utils/arrayMove.js +3 -12
- package/lib/cjs/utils/classnames.js +6 -15
- package/lib/cjs/utils/date-fns-extra.js +7 -18
- package/lib/cjs/utils/dom.js +5 -12
- package/lib/cjs/utils/function.js +1 -4
- package/lib/cjs/utils/getDataAttr.js +2 -13
- package/lib/cjs/utils/getHighlight.js +7 -22
- package/lib/cjs/utils/getMotionObjFromProps.js +4 -9
- package/lib/cjs/utils/index.js +5 -15
- package/lib/cjs/utils/isBothNaN.js +1 -4
- package/lib/cjs/utils/isElement.js +1 -4
- package/lib/cjs/utils/isEnterPress.js +3 -6
- package/lib/cjs/utils/isEscPress.js +3 -6
- package/lib/cjs/utils/isNullOrUndefined.js +1 -4
- package/lib/cjs/utils/isNumber.js +1 -4
- package/lib/cjs/utils/isObject.js +1 -4
- package/lib/cjs/utils/isPromise.js +3 -6
- package/lib/cjs/utils/isString.js +1 -4
- package/lib/cjs/utils/keyCode.js +1 -4
- package/lib/cjs/utils/log.js +3 -6
- package/lib/cjs/utils/number.js +1 -4
- package/lib/cjs/utils/object.js +10 -27
- package/lib/cjs/utils/set.js +4 -9
- package/lib/cjs/utils/shallowEqualObjects.js +3 -10
- package/lib/cjs/utils/touchPolyfill.js +5 -12
- package/lib/cjs/utils/type.js +1 -3
- package/lib/cjs/utils/uuid.js +3 -14
- package/lib/cjs/utils/warning.js +1 -4
- package/lib/es/anchor/anchor.css +1 -10
- package/lib/es/anchor/anchor.scss +1 -8
- package/lib/es/anchor/foundation.js +2 -4
- package/lib/es/anchor/linkFoundation.js +1 -2
- package/lib/es/anchor/rtl.scss +0 -1
- package/lib/es/anchor/variables.scss +1 -0
- package/lib/es/autoComplete/foundation.js +11 -26
- package/lib/es/autoComplete/optionFoundation.js +1 -2
- package/lib/es/avatar/foundation.js +1 -2
- package/lib/es/backtop/foundation.js +1 -2
- package/lib/es/banner/foundation.js +1 -2
- package/lib/es/base/foundation.js +2 -3
- package/lib/es/breadcrumb/foundation.js +3 -6
- package/lib/es/breadcrumb/itemFoundation.js +1 -2
- package/lib/es/calendar/eventUtil.d.ts +3 -3
- package/lib/es/calendar/eventUtil.js +27 -56
- package/lib/es/calendar/foundation.js +60 -90
- package/lib/es/carousel/foundation.js +2 -4
- package/lib/es/cascader/foundation.js +49 -94
- package/lib/es/cascader/util.js +6 -21
- package/lib/es/checkbox/checkboxFoundation.js +3 -6
- package/lib/es/checkbox/checkboxGroupFoundation.js +6 -9
- package/lib/es/collapse/foundation.js +6 -10
- package/lib/es/datePicker/_utils/formatter.js +2 -5
- package/lib/es/datePicker/_utils/getDefaultPickerDate.js +2 -3
- package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +1 -4
- package/lib/es/datePicker/_utils/getMonthTable.js +1 -5
- package/lib/es/datePicker/_utils/getMonthsInYear.js +2 -9
- package/lib/es/datePicker/_utils/getYears.js +1 -3
- package/lib/es/datePicker/constants.js +2 -7
- package/lib/es/datePicker/foundation.js +39 -70
- package/lib/es/datePicker/inputFoundation.js +4 -11
- package/lib/es/datePicker/monthFoundation.js +2 -4
- package/lib/es/datePicker/monthsGridFoundation.js +40 -55
- package/lib/es/datePicker/yearAndMonthFoundation.js +1 -2
- package/lib/es/dropdown/foundation.js +4 -7
- package/lib/es/dropdown/menuFoundation.js +8 -21
- package/lib/es/form/foundation.js +59 -91
- package/lib/es/form/utils.js +11 -19
- package/lib/es/input/foundation.js +4 -9
- package/lib/es/input/textareaFoundation.js +3 -5
- package/lib/es/input/util/calculateNodeHeight.js +2 -10
- package/lib/es/input/util/getSizingData.js +2 -5
- package/lib/es/inputNumber/constants.js +3 -8
- package/lib/es/inputNumber/foundation.js +8 -18
- package/lib/es/modal/modalContentFoundation.js +1 -2
- package/lib/es/modal/modalFoundation.js +1 -2
- package/lib/es/navigation/NavItem.js +5 -11
- package/lib/es/navigation/foundation.js +19 -25
- package/lib/es/navigation/itemFoundation.js +1 -3
- package/lib/es/navigation/subNavFoundation.js +7 -13
- package/lib/es/notification/notificationFoundation.js +2 -4
- package/lib/es/notification/notificationListFoundation.js +1 -3
- package/lib/es/overflowList/constants.js +2 -3
- package/lib/es/overflowList/foundation.js +9 -23
- package/lib/es/pagination/foundation.js +15 -28
- package/lib/es/popover/constants.js +1 -2
- package/lib/es/radio/radioGroupFoundation.js +3 -4
- package/lib/es/radio/radioInnerFoundation.js +2 -3
- package/lib/es/rating/foundation.js +4 -13
- package/lib/es/scrollList/itemFoundation.js +5 -13
- package/lib/es/select/foundation.js +50 -88
- package/lib/es/select/optionFoundation.js +1 -2
- package/lib/es/sideSheet/sideSheetFoundation.js +3 -7
- package/lib/es/slider/foundation.js +10 -16
- package/lib/es/spin/foundation.js +2 -4
- package/lib/es/switch/foundation.js +1 -2
- package/lib/es/table/bodyFoundation.js +6 -11
- package/lib/es/table/foundation.js +67 -93
- package/lib/es/table/utils.js +33 -51
- package/lib/es/tabs/foundation.js +5 -18
- package/lib/es/tagInput/foundation.js +9 -21
- package/lib/es/timePicker/ComboxFoundation.js +7 -16
- package/lib/es/timePicker/foundation.js +23 -37
- package/lib/es/timePicker/inputFoundation.js +1 -2
- package/lib/es/timePicker/utils/index.js +4 -6
- package/lib/es/timePicker/utils/localeDate.js +1 -2
- package/lib/es/toast/toastFoundation.js +2 -4
- package/lib/es/toast/toastListFoundation.js +2 -4
- package/lib/es/tooltip/foundation.js +26 -46
- package/lib/es/transfer/foundation.js +21 -43
- package/lib/es/transfer/transferUtils.js +13 -33
- package/lib/es/tree/foundation.js +38 -70
- package/lib/es/tree/treeUtil.js +57 -109
- package/lib/es/treeSelect/foundation.js +45 -73
- package/lib/es/upload/foundation.js +52 -118
- package/lib/es/upload/utils.js +12 -25
- package/lib/es/utils/Event.js +5 -12
- package/lib/es/utils/FocusHandle.js +3 -7
- package/lib/es/utils/Store.js +4 -12
- package/lib/es/utils/a11y.js +5 -6
- package/lib/es/utils/array.js +3 -5
- package/lib/es/utils/arrayMove.js +2 -6
- package/lib/es/utils/classnames.js +3 -6
- package/lib/es/utils/date-fns-extra.js +6 -14
- package/lib/es/utils/dom.js +1 -2
- package/lib/es/utils/getDataAttr.js +1 -5
- package/lib/es/utils/getHighlight.js +4 -14
- package/lib/es/utils/getMotionObjFromProps.js +1 -2
- package/lib/es/utils/object.js +7 -15
- package/lib/es/utils/set.js +1 -2
- package/lib/es/utils/shallowEqualObjects.js +2 -5
- package/lib/es/utils/touchPolyfill.js +2 -6
- package/lib/es/utils/uuid.js +2 -7
- package/package.json +2 -4
- package/select/foundation.ts +2 -2
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
6
|
-
|
|
7
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
8
|
-
|
|
9
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
10
|
-
|
|
11
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
4
|
value: true
|
|
13
5
|
});
|
|
14
|
-
|
|
15
6
|
exports.default = void 0;
|
|
16
7
|
|
|
17
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
18
|
-
|
|
19
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/map"));
|
|
20
|
-
|
|
21
|
-
var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
|
|
22
|
-
|
|
23
|
-
var _values2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/values"));
|
|
24
|
-
|
|
25
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
26
|
-
|
|
27
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
28
|
-
|
|
29
|
-
var _map2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
30
|
-
|
|
31
|
-
var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
|
|
32
|
-
|
|
33
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/keys"));
|
|
34
|
-
|
|
35
|
-
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
|
|
36
|
-
|
|
37
8
|
var _toPath2 = _interopRequireDefault(require("lodash/toPath"));
|
|
38
9
|
|
|
39
10
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
@@ -50,16 +21,16 @@ var _utils = require("./utils");
|
|
|
50
21
|
|
|
51
22
|
var _scrollIntoViewIfNeeded = _interopRequireDefault(require("scroll-into-view-if-needed"));
|
|
52
23
|
|
|
53
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
54
25
|
|
|
55
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor =
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
|
|
27
|
+
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
56
29
|
|
|
57
30
|
/* eslint-disable prefer-const, max-len */
|
|
58
31
|
class FormFoundation extends _foundation.default {
|
|
59
32
|
constructor(adapter) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
super((0, _assign.default)({}, adapter));
|
|
33
|
+
super(Object.assign({}, adapter));
|
|
63
34
|
/*
|
|
64
35
|
Also need to read initValue here, because the Form level can set the initial value,
|
|
65
36
|
and the Field level can also set the initial value.
|
|
@@ -84,31 +55,31 @@ class FormFoundation extends _foundation.default {
|
|
|
84
55
|
// key: fieldName
|
|
85
56
|
// value: { field, fieldApi, keepState, initValue}
|
|
86
57
|
|
|
87
|
-
this.fields = new
|
|
58
|
+
this.fields = new Map(); // Record all registered fields
|
|
88
59
|
|
|
89
60
|
this.registered = {}; // Record all registered ArrayField
|
|
90
61
|
|
|
91
|
-
this.registeredArrayField = new
|
|
92
|
-
this.register =
|
|
93
|
-
this.unRegister =
|
|
94
|
-
this.registerArrayField =
|
|
95
|
-
this.unRegisterArrayField =
|
|
96
|
-
this.getArrayField =
|
|
97
|
-
this.updateArrayField =
|
|
98
|
-
this.getField =
|
|
99
|
-
this.setValues =
|
|
100
|
-
this.updateStateValue =
|
|
101
|
-
this.updateStateError =
|
|
102
|
-
this.updateStateTouched =
|
|
103
|
-
this.getFormState =
|
|
104
|
-
this.getValue =
|
|
105
|
-
this.getError =
|
|
106
|
-
this.getTouched =
|
|
107
|
-
this.getInitValues =
|
|
108
|
-
this.getInitValue =
|
|
109
|
-
this.getFormProps =
|
|
110
|
-
this.getFieldExist =
|
|
111
|
-
this.scrollToField =
|
|
62
|
+
this.registeredArrayField = new Map();
|
|
63
|
+
this.register = this.register.bind(this);
|
|
64
|
+
this.unRegister = this.unRegister.bind(this);
|
|
65
|
+
this.registerArrayField = this.registerArrayField.bind(this);
|
|
66
|
+
this.unRegisterArrayField = this.unRegisterArrayField.bind(this);
|
|
67
|
+
this.getArrayField = this.getArrayField.bind(this);
|
|
68
|
+
this.updateArrayField = this.updateArrayField.bind(this);
|
|
69
|
+
this.getField = this.getField.bind(this);
|
|
70
|
+
this.setValues = this.setValues.bind(this);
|
|
71
|
+
this.updateStateValue = this.updateStateValue.bind(this);
|
|
72
|
+
this.updateStateError = this.updateStateError.bind(this);
|
|
73
|
+
this.updateStateTouched = this.updateStateTouched.bind(this);
|
|
74
|
+
this.getFormState = this.getFormState.bind(this);
|
|
75
|
+
this.getValue = this.getValue.bind(this);
|
|
76
|
+
this.getError = this.getError.bind(this);
|
|
77
|
+
this.getTouched = this.getTouched.bind(this);
|
|
78
|
+
this.getInitValues = this.getInitValues.bind(this);
|
|
79
|
+
this.getInitValue = this.getInitValue.bind(this);
|
|
80
|
+
this.getFormProps = this.getFormProps.bind(this);
|
|
81
|
+
this.getFieldExist = this.getFieldExist.bind(this);
|
|
82
|
+
this.scrollToField = this.scrollToField.bind(this);
|
|
112
83
|
}
|
|
113
84
|
|
|
114
85
|
init() {
|
|
@@ -154,7 +125,7 @@ class FormFoundation extends _foundation.default {
|
|
|
154
125
|
|
|
155
126
|
try {
|
|
156
127
|
if (!targetField.keepState) {
|
|
157
|
-
ObjectUtil.remove(
|
|
128
|
+
ObjectUtil.remove(this.data.values, field);
|
|
158
129
|
ObjectUtil.remove(this.data.errors, field);
|
|
159
130
|
ObjectUtil.remove(this.data.touched, field);
|
|
160
131
|
}
|
|
@@ -187,7 +158,7 @@ class FormFoundation extends _foundation.default {
|
|
|
187
158
|
}
|
|
188
159
|
|
|
189
160
|
updateArrayField(arrayField, updateValue) {
|
|
190
|
-
const mergeVal =
|
|
161
|
+
const mergeVal = Object.assign(Object.assign({}, this.registeredArrayField.get(arrayField)), updateValue);
|
|
191
162
|
this.registeredArrayField.set(arrayField, mergeVal);
|
|
192
163
|
}
|
|
193
164
|
|
|
@@ -211,7 +182,7 @@ class FormFoundation extends _foundation.default {
|
|
|
211
182
|
const {
|
|
212
183
|
validateFields
|
|
213
184
|
} = this.getProps();
|
|
214
|
-
return new
|
|
185
|
+
return new Promise((resolve, reject) => {
|
|
215
186
|
let maybePromisedErrors;
|
|
216
187
|
|
|
217
188
|
try {
|
|
@@ -272,12 +243,12 @@ class FormFoundation extends _foundation.default {
|
|
|
272
243
|
values
|
|
273
244
|
} = this.data; // When there is no custom validation function at Form level, perform validation of each Field
|
|
274
245
|
|
|
275
|
-
return new
|
|
246
|
+
return new Promise((resolve, reject) => {
|
|
276
247
|
let promiseSet = [];
|
|
277
248
|
|
|
278
249
|
const targetFields = this._getOperateFieldMap(fieldPaths);
|
|
279
250
|
|
|
280
|
-
|
|
251
|
+
targetFields.forEach((field, fieldPath) => {
|
|
281
252
|
// Call each fieldApi for verification
|
|
282
253
|
const fieldValue = this.getValue(fieldPath); // When centralized verification, no need to trigger forceUpdate and notify
|
|
283
254
|
|
|
@@ -289,8 +260,7 @@ class FormFoundation extends _foundation.default {
|
|
|
289
260
|
promiseSet.push(validateResult);
|
|
290
261
|
field.fieldApi.setTouched(true, opts);
|
|
291
262
|
});
|
|
292
|
-
|
|
293
|
-
_promise.default.all(promiseSet).then(() => {
|
|
263
|
+
Promise.all(promiseSet).then(() => {
|
|
294
264
|
// After the centralized verification is completed, trigger notify and forceUpdate once.
|
|
295
265
|
this._adapter.notifyChange(this.data);
|
|
296
266
|
|
|
@@ -343,16 +313,14 @@ class FormFoundation extends _foundation.default {
|
|
|
343
313
|
|
|
344
314
|
|
|
345
315
|
_getNestedField(path) {
|
|
346
|
-
var _context21;
|
|
347
|
-
|
|
348
316
|
const allRegisterField = this.fields;
|
|
349
|
-
const allFieldPath =
|
|
350
|
-
let nestedFieldPath = new
|
|
351
|
-
|
|
317
|
+
const allFieldPath = [...allRegisterField].map(item => item[0]);
|
|
318
|
+
let nestedFieldPath = new Map();
|
|
319
|
+
allFieldPath.forEach(item => {
|
|
352
320
|
let itemPath = (0, _toPath2.default)(item);
|
|
353
321
|
let targetPath = (0, _toPath2.default)(path);
|
|
354
322
|
|
|
355
|
-
if (
|
|
323
|
+
if (targetPath.every((path, i) => targetPath[i] === itemPath[i])) {
|
|
356
324
|
const realField = allRegisterField.get(item);
|
|
357
325
|
nestedFieldPath.set(item, realField);
|
|
358
326
|
}
|
|
@@ -362,17 +330,17 @@ class FormFoundation extends _foundation.default {
|
|
|
362
330
|
|
|
363
331
|
|
|
364
332
|
_getOperateFieldMap(fieldPaths) {
|
|
365
|
-
let targetFields = new
|
|
333
|
+
let targetFields = new Map();
|
|
366
334
|
|
|
367
335
|
if (!(0, _isUndefined2.default)(fieldPaths)) {
|
|
368
336
|
// reset or validate specific fields
|
|
369
|
-
|
|
337
|
+
fieldPaths.forEach(path => {
|
|
370
338
|
const field = this.fields.get(path); // may be undefined, if exists two fields like 'a[0]'、'a[1]', but user directly call reset(['a']) / validate(['a'])
|
|
371
339
|
|
|
372
340
|
if ((0, _isUndefined2.default)(field)) {
|
|
373
341
|
const nestedFields = this._getNestedField(path);
|
|
374
342
|
|
|
375
|
-
targetFields = new
|
|
343
|
+
targetFields = new Map([...targetFields, ...nestedFields]);
|
|
376
344
|
} else {
|
|
377
345
|
targetFields.set(path, field);
|
|
378
346
|
}
|
|
@@ -389,7 +357,7 @@ class FormFoundation extends _foundation.default {
|
|
|
389
357
|
reset(fieldPaths) {
|
|
390
358
|
const targetFields = this._getOperateFieldMap(fieldPaths);
|
|
391
359
|
|
|
392
|
-
|
|
360
|
+
targetFields.forEach(field => {
|
|
393
361
|
field.fieldApi.reset();
|
|
394
362
|
});
|
|
395
363
|
|
|
@@ -405,15 +373,13 @@ class FormFoundation extends _foundation.default {
|
|
|
405
373
|
}
|
|
406
374
|
|
|
407
375
|
_resetArrayField() {
|
|
408
|
-
var _context22;
|
|
409
|
-
|
|
410
376
|
/*
|
|
411
377
|
When Reset, arrayField needs to be processed separately. Restore the key/value of arrayField in formState according to the initial value
|
|
412
378
|
Update the key inside the arrayField to make it actively renderer
|
|
413
379
|
Reset时,arrayField需要单独处理, 根据初始值还原 arrayField在formState中的key/value, 更新 arrayField内部的key,使其主动rerender
|
|
414
380
|
*/
|
|
415
|
-
const arrayFieldPaths = [...
|
|
416
|
-
|
|
381
|
+
const arrayFieldPaths = [...this.registeredArrayField.keys()];
|
|
382
|
+
arrayFieldPaths.forEach(path => {
|
|
417
383
|
const arrayFieldState = this.registeredArrayField.get(path);
|
|
418
384
|
const arrayFieldInitValue = arrayFieldState.initValue;
|
|
419
385
|
this.updateStateValue(path, arrayFieldInitValue, {
|
|
@@ -429,9 +395,7 @@ class FormFoundation extends _foundation.default {
|
|
|
429
395
|
|
|
430
396
|
|
|
431
397
|
injectErrorToField(errors) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
(0, _forEach.default)(_context23 = this.fields).call(_context23, field => {
|
|
398
|
+
this.fields.forEach(field => {
|
|
435
399
|
const fieldError = ObjectUtil.get(errors, field.field);
|
|
436
400
|
const opts = {
|
|
437
401
|
notNotify: true,
|
|
@@ -448,20 +412,20 @@ class FormFoundation extends _foundation.default {
|
|
|
448
412
|
|
|
449
413
|
switch (true) {
|
|
450
414
|
case !isAllField && !needClone:
|
|
451
|
-
result = ObjectUtil.get(
|
|
415
|
+
result = ObjectUtil.get(this.data.values, field);
|
|
452
416
|
break;
|
|
453
417
|
|
|
454
418
|
case !isAllField && needClone:
|
|
455
|
-
fieldValue = ObjectUtil.get(
|
|
419
|
+
fieldValue = ObjectUtil.get(this.data.values, field);
|
|
456
420
|
result = this._adapter.cloneDeep(fieldValue);
|
|
457
421
|
break;
|
|
458
422
|
|
|
459
423
|
case isAllField && !needClone:
|
|
460
|
-
result =
|
|
424
|
+
result = Object.assign({}, this.data.values);
|
|
461
425
|
break;
|
|
462
426
|
|
|
463
427
|
case isAllField && needClone:
|
|
464
|
-
result = this._adapter.cloneDeep(
|
|
428
|
+
result = this._adapter.cloneDeep(this.data.values);
|
|
465
429
|
break;
|
|
466
430
|
|
|
467
431
|
default:
|
|
@@ -472,15 +436,13 @@ class FormFoundation extends _foundation.default {
|
|
|
472
436
|
}
|
|
473
437
|
|
|
474
438
|
setValues(values, _ref) {
|
|
475
|
-
var _context24;
|
|
476
|
-
|
|
477
439
|
let {
|
|
478
440
|
isOverride = false
|
|
479
441
|
} = _ref;
|
|
480
442
|
|
|
481
443
|
const _values = this._adapter.cloneDeep(values);
|
|
482
444
|
|
|
483
|
-
|
|
445
|
+
this.fields.forEach(field => {
|
|
484
446
|
const value = ObjectUtil.get(_values, field.field); // When calling setValues to override the values, only need to trigger onValueChange and onChange once, so setNotNotify of setValue to true
|
|
485
447
|
// 调用setValues进行值的覆盖时,只需要回调一次onValueChange、onChange即可,所以此处将setValue的notNotify置为true
|
|
486
448
|
|
|
@@ -492,10 +454,8 @@ class FormFoundation extends _foundation.default {
|
|
|
492
454
|
}); // if there exists any arrayField component in this form
|
|
493
455
|
|
|
494
456
|
if (this.registeredArrayField.size) {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
const arrayFieldPaths = [...(0, _keys.default)(_context25 = this.registeredArrayField).call(_context25)];
|
|
498
|
-
(0, _forEach.default)(arrayFieldPaths).call(arrayFieldPaths, path => {
|
|
457
|
+
const arrayFieldPaths = [...this.registeredArrayField.keys()];
|
|
458
|
+
arrayFieldPaths.forEach(path => {
|
|
499
459
|
this.updateArrayField(path, {
|
|
500
460
|
updateKey: new Date().valueOf()
|
|
501
461
|
});
|
|
@@ -512,7 +472,7 @@ class FormFoundation extends _foundation.default {
|
|
|
512
472
|
|
|
513
473
|
this._adapter.notifyChange(this.data);
|
|
514
474
|
|
|
515
|
-
this._adapter.notifyValueChange(
|
|
475
|
+
this._adapter.notifyValueChange(this.data.values, Object.assign({}, values));
|
|
516
476
|
|
|
517
477
|
this._adapter.forceUpdate();
|
|
518
478
|
} // update formState value
|
|
@@ -532,7 +492,7 @@ class FormFoundation extends _foundation.default {
|
|
|
532
492
|
const formAllowEmpty = this.getProp('allowEmpty'); // priority at Field level
|
|
533
493
|
|
|
534
494
|
const allowEmpty = fieldAllowEmpty ? fieldAllowEmpty : formAllowEmpty;
|
|
535
|
-
ObjectUtil.set(
|
|
495
|
+
ObjectUtil.set(this.data.values, field, value, allowEmpty);
|
|
536
496
|
/**
|
|
537
497
|
* When registering, setValue called when Field initValue is synchronized to FormState should not trigger notify
|
|
538
498
|
* but need to trigger forceUpdate, otherwise useFormState, useFieldState initial rendering will have problems
|
|
@@ -544,7 +504,7 @@ class FormFoundation extends _foundation.default {
|
|
|
544
504
|
if (!notNotify) {
|
|
545
505
|
this._adapter.notifyChange(this.data);
|
|
546
506
|
|
|
547
|
-
this._adapter.notifyValueChange(
|
|
507
|
+
this._adapter.notifyValueChange(this.data.values, {
|
|
548
508
|
[field]: value
|
|
549
509
|
});
|
|
550
510
|
}
|
|
@@ -622,9 +582,9 @@ class FormFoundation extends _foundation.default {
|
|
|
622
582
|
let nestedFields = this._getNestedField(field);
|
|
623
583
|
|
|
624
584
|
if (nestedFields.size) {
|
|
625
|
-
|
|
585
|
+
nestedFields.forEach(fieldStaff => {
|
|
626
586
|
let fieldPath = fieldStaff.field;
|
|
627
|
-
let newFieldVal = ObjectUtil.get(
|
|
587
|
+
let newFieldVal = ObjectUtil.get(this.data.values, fieldPath);
|
|
628
588
|
let nestedBatchUpdateOpts = {
|
|
629
589
|
notNotify: true,
|
|
630
590
|
notUpdate: true
|
|
@@ -654,7 +614,7 @@ class FormFoundation extends _foundation.default {
|
|
|
654
614
|
let nestedFields = this._getNestedField(field);
|
|
655
615
|
|
|
656
616
|
if (nestedFields.size) {
|
|
657
|
-
|
|
617
|
+
nestedFields.forEach(fieldStaff => {
|
|
658
618
|
let fieldPath = fieldStaff.field;
|
|
659
619
|
let newFieldError = ObjectUtil.get(this.data.errors, fieldPath);
|
|
660
620
|
let nestedBatchUpdateOpts = {
|
|
@@ -684,7 +644,7 @@ class FormFoundation extends _foundation.default {
|
|
|
684
644
|
let nestedFields = this._getNestedField(field);
|
|
685
645
|
|
|
686
646
|
if (nestedFields.size) {
|
|
687
|
-
|
|
647
|
+
nestedFields.forEach(fieldStaff => {
|
|
688
648
|
let fieldPath = fieldStaff.field;
|
|
689
649
|
let newFieldTouch = ObjectUtil.get(this.data.touched, fieldPath);
|
|
690
650
|
let nestedBatchUpdateOpts = {
|
|
@@ -736,7 +696,7 @@ class FormFoundation extends _foundation.default {
|
|
|
736
696
|
|
|
737
697
|
getFormApi() {
|
|
738
698
|
const fieldSetterApi = this.getFieldSetterApi();
|
|
739
|
-
return
|
|
699
|
+
return Object.assign(Object.assign({}, fieldSetterApi), {
|
|
740
700
|
reset: fields => this.reset(fields),
|
|
741
701
|
validate: fields => this.validate(fields),
|
|
742
702
|
getValue: field => this.getValue(field, {
|
|
@@ -774,7 +734,7 @@ class FormFoundation extends _foundation.default {
|
|
|
774
734
|
但如果是业务方用formApi调用getFormState时,行为无法预料,有可能会进行侵入式修改,所以用深克隆进行隔离
|
|
775
735
|
*/
|
|
776
736
|
if (!needClone) {
|
|
777
|
-
return
|
|
737
|
+
return Object.assign({}, this.data);
|
|
778
738
|
} else {
|
|
779
739
|
return this._adapter.cloneDeep(this.data);
|
|
780
740
|
}
|
|
@@ -787,8 +747,8 @@ class FormFoundation extends _foundation.default {
|
|
|
787
747
|
valid = Boolean(ObjectUtil.empty(this.data.errors));
|
|
788
748
|
} else {
|
|
789
749
|
// when trigger partial validate
|
|
790
|
-
const targetFieldStr = [...
|
|
791
|
-
|
|
750
|
+
const targetFieldStr = [...targetFields.keys()];
|
|
751
|
+
targetFieldStr.forEach(fieldStr => {
|
|
792
752
|
const fieldError = ObjectUtil.get(this.data.errors, fieldStr);
|
|
793
753
|
|
|
794
754
|
if (!(0, _utils.isValid)(fieldError)) {
|
|
@@ -837,7 +797,7 @@ class FormFoundation extends _foundation.default {
|
|
|
837
797
|
typeof autoScrollToError === 'object' ? scrollOpts = autoScrollToError : null;
|
|
838
798
|
|
|
839
799
|
if (timeout) {
|
|
840
|
-
(
|
|
800
|
+
setTimeout(() => this._getErrorFieldAndScroll(scrollOpts), 100);
|
|
841
801
|
} else {
|
|
842
802
|
this._getErrorFieldAndScroll(scrollOpts);
|
|
843
803
|
}
|
package/lib/cjs/form/utils.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.generateValidatesFromRules = generateValidatesFromRules;
|
|
12
7
|
exports.getDisplayName = getDisplayName;
|
|
13
8
|
exports.isRequired = isRequired;
|
|
@@ -15,29 +10,19 @@ exports.isValid = isValid;
|
|
|
15
10
|
exports.mergeOptions = mergeOptions;
|
|
16
11
|
exports.mergeProps = mergeProps;
|
|
17
12
|
|
|
18
|
-
var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
|
|
19
|
-
|
|
20
|
-
var _getOwnPropertySymbols = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols"));
|
|
21
|
-
|
|
22
|
-
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
23
|
-
|
|
24
|
-
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
25
|
-
|
|
26
|
-
var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
|
|
27
|
-
|
|
28
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
29
|
-
|
|
30
13
|
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
31
14
|
|
|
32
15
|
var _asyncValidator = _interopRequireDefault(require("async-validator"));
|
|
33
16
|
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
|
|
34
19
|
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
35
20
|
var t = {};
|
|
36
21
|
|
|
37
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) &&
|
|
22
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
38
23
|
|
|
39
|
-
if (s != null && typeof
|
|
40
|
-
if (
|
|
24
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
41
26
|
}
|
|
42
27
|
return t;
|
|
43
28
|
};
|
|
@@ -71,8 +56,8 @@ function isRequired() {
|
|
|
71
56
|
|
|
72
57
|
if (typeof rules === 'object' && 'required' in rules) {
|
|
73
58
|
required = rules.required;
|
|
74
|
-
} else if (
|
|
75
|
-
|
|
59
|
+
} else if (Array.isArray(rules) && rules.length) {
|
|
60
|
+
rules.forEach(rule => {
|
|
76
61
|
rule.required ? required = true : null;
|
|
77
62
|
});
|
|
78
63
|
}
|
|
@@ -85,8 +70,8 @@ function isValid(errors) {
|
|
|
85
70
|
|
|
86
71
|
if (typeof errors === 'string' && errors.length) {
|
|
87
72
|
valid = false;
|
|
88
|
-
} else if (
|
|
89
|
-
valid =
|
|
73
|
+
} else if (Array.isArray(errors) && errors.length) {
|
|
74
|
+
valid = errors.every(error => isValid(error));
|
|
90
75
|
} else if (typeof errors === 'boolean') {
|
|
91
76
|
valid = errors;
|
|
92
77
|
} else if (errors && typeof errors.$$typeof === 'symbol' && errors.$$typeof.toString() === 'Symbol(react.element)') {
|
|
@@ -101,7 +86,7 @@ function isValid(errors) {
|
|
|
101
86
|
function transformTrigger(trigger) {
|
|
102
87
|
let result = [];
|
|
103
88
|
|
|
104
|
-
if (
|
|
89
|
+
if (Array.isArray(trigger)) {
|
|
105
90
|
result = trigger;
|
|
106
91
|
}
|
|
107
92
|
|
|
@@ -124,7 +109,7 @@ function mergeOptions(opts, props) {
|
|
|
124
109
|
shouldInject: true,
|
|
125
110
|
shouldMemo: true
|
|
126
111
|
};
|
|
127
|
-
const options =
|
|
112
|
+
const options = Object.assign(Object.assign({}, defaultOpts), opts); // If the field attribute is declared, then the injection is carried out (mainly used to deal with the case where Checkbox and Radio are used separately from the Group); other cases are subject to options
|
|
128
113
|
|
|
129
114
|
const shouldInject = 'field' in props ? true : options.shouldInject;
|
|
130
115
|
return {
|
|
@@ -146,7 +131,7 @@ function mergeProps(props) {
|
|
|
146
131
|
stopValidateWithError: false
|
|
147
132
|
};
|
|
148
133
|
|
|
149
|
-
let _a =
|
|
134
|
+
let _a = Object.assign(Object.assign({}, defaultProps), props),
|
|
150
135
|
{
|
|
151
136
|
field,
|
|
152
137
|
label,
|
|
@@ -244,5 +229,5 @@ function mergeProps(props) {
|
|
|
244
229
|
}
|
|
245
230
|
|
|
246
231
|
function bothEmptyArray(val, otherVal) {
|
|
247
|
-
return
|
|
232
|
+
return Array.isArray(val) && Array.isArray(otherVal) && !val.length && !otherVal.length;
|
|
248
233
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
|
|
9
6
|
exports.cssClasses = void 0;
|
|
10
7
|
|
|
11
8
|
var _constants = require("../base/constants");
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
|
|
9
6
|
exports.strings = exports.numbers = exports.cssClasses = void 0;
|
|
10
7
|
|
|
11
8
|
var _constants = require("../base/constants");
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
|
|
9
6
|
exports.strings = exports.numbers = exports.cssClasses = void 0;
|
|
10
7
|
|
|
11
8
|
var _constants = require("../base/constants");
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
4
|
value: true
|
|
9
5
|
});
|
|
10
|
-
|
|
11
6
|
exports.default = void 0;
|
|
12
7
|
|
|
13
|
-
var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
|
|
14
|
-
|
|
15
|
-
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
16
|
-
|
|
17
|
-
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
18
|
-
|
|
19
8
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
20
9
|
|
|
21
10
|
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
|
@@ -32,9 +21,11 @@ var _constants = require("./constants");
|
|
|
32
21
|
|
|
33
22
|
var _keyCode = require("./../utils/keyCode");
|
|
34
23
|
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
35
26
|
class InputFoundation extends _foundation.default {
|
|
36
27
|
constructor(adapter) {
|
|
37
|
-
super(
|
|
28
|
+
super(Object.assign(Object.assign({}, InputFoundation.inputDefaultAdapter), adapter));
|
|
38
29
|
}
|
|
39
30
|
|
|
40
31
|
static get inputDefaultAdapter() {
|
|
@@ -180,7 +171,7 @@ class InputFoundation extends _foundation.default {
|
|
|
180
171
|
let truncatedValue = '';
|
|
181
172
|
|
|
182
173
|
for (let i = 1, len = value.length; i <= len; i++) {
|
|
183
|
-
const currentValue =
|
|
174
|
+
const currentValue = value.slice(0, i);
|
|
184
175
|
|
|
185
176
|
if (getValueLength(currentValue) > maxLength) {
|
|
186
177
|
return truncatedValue;
|
|
@@ -191,7 +182,7 @@ class InputFoundation extends _foundation.default {
|
|
|
191
182
|
|
|
192
183
|
return truncatedValue;
|
|
193
184
|
} else {
|
|
194
|
-
return
|
|
185
|
+
return value.slice(0, maxLength);
|
|
195
186
|
}
|
|
196
187
|
}
|
|
197
188
|
|
|
@@ -380,10 +371,8 @@ class InputFoundation extends _foundation.default {
|
|
|
380
371
|
|
|
381
372
|
|
|
382
373
|
handleModeEnterPress(e) {
|
|
383
|
-
var _context;
|
|
384
|
-
|
|
385
374
|
// trigger by Enter or Space key
|
|
386
|
-
if (
|
|
375
|
+
if (['Enter', ' '].includes(e === null || e === void 0 ? void 0 : e.key)) {
|
|
387
376
|
this.handlePreventMouseDown(e);
|
|
388
377
|
this.handleClickEye(e);
|
|
389
378
|
}
|