acud 1.4.3 → 1.4.4

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/dist/acud.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! acud v1.4.3 */
1
+ /*! acud v1.4.4 */
2
2
  /* color */
3
3
  /* 默认颜色 */
4
4
  /* 通用-icon */
package/dist/acud.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! acud v1.4.3 */
1
+ /*! acud v1.4.4 */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("react"), require("react-dom"));
@@ -6106,12 +6106,12 @@ var Menus = /*#__PURE__*/function (_React$Component) {
6106
6106
  if (isPlaceTop) {
6107
6107
  var prevMenuBottom = Number(Object(_utils__WEBPACK_IMPORTED_MODULE_18__["getElementStyle"])(prevMenu).bottom.replace('px', ''));
6108
6108
  var currentMenuPaddingBottom = Number(Object(_utils__WEBPACK_IMPORTED_MODULE_18__["getElementStyle"])(currentMenu).paddingBottom.replace('px', ''));
6109
- var bottom = prevMenu.offsetHeight + prevMenuBottom + currentMenuPaddingBottom + prevMenu.scrollTop - _this6.menuItems[i - 1].offsetTop - currentMenu.offsetHeight;
6109
+ var bottom = prevMenu.offsetHeight + prevMenuBottom + currentMenuPaddingBottom + _this6.menuItems[i - 1].parentElement.scrollTop - _this6.menuItems[i - 1].offsetTop - currentMenu.offsetHeight;
6110
6110
  currentMenu.style.bottom = (bottom < 0 ? 0 : bottom) + 'px';
6111
6111
  } else {
6112
6112
  var prevMenuPaddingTop = Number(Object(_utils__WEBPACK_IMPORTED_MODULE_18__["getElementStyle"])(currentMenu).paddingTop.replace('px', ''));
6113
6113
  var prevMenuTop = Number(Object(_utils__WEBPACK_IMPORTED_MODULE_18__["getElementStyle"])(prevMenu).top.replace('px', ''));
6114
- var prevMenuItemsTopSum = prevMenuTop + _this6.menuItems[i - 1].offsetTop - prevMenu.scrollTop - prevMenuPaddingTop;
6114
+ var prevMenuItemsTopSum = prevMenuTop + _this6.menuItems[i - 1].offsetTop - _this6.menuItems[i - 1].parentElement.scrollTop - prevMenuPaddingTop;
6115
6115
  var menuWrapTop = _this6.menuWrap.parentElement.getBoundingClientRect().top;
6116
6116
  var currentMenuHeight = currentMenu.offsetHeight;
6117
6117
  var currentMenuMaxTop = clientHeight - menuWrapTop - currentMenuHeight - menusEdgeBuffer;
@@ -52269,6 +52269,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52269
52269
  newVisibleRecommendArea >= originIntersectionRecommendArea)) {
52270
52270
  prevFlipRef.current.bt = true;
52271
52271
  nextOffsetY = tmpNextOffsetY;
52272
+ popupOffsetY = -popupOffsetY;
52272
52273
  nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
52273
52274
  } else {
52274
52275
  prevFlipRef.current.bt = false;
@@ -52292,6 +52293,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52292
52293
  _newVisibleRecommendArea >= originIntersectionRecommendArea)) {
52293
52294
  prevFlipRef.current.tb = true;
52294
52295
  nextOffsetY = _tmpNextOffsetY;
52296
+ popupOffsetY = -popupOffsetY;
52295
52297
  nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
52296
52298
  } else {
52297
52299
  prevFlipRef.current.tb = false;
@@ -52321,6 +52323,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52321
52323
  _newVisibleRecommendArea2 >= originIntersectionRecommendArea)) {
52322
52324
  prevFlipRef.current.rl = true;
52323
52325
  nextOffsetX = tmpNextOffsetX;
52326
+ popupOffsetX = -popupOffsetX;
52324
52327
  nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
52325
52328
  } else {
52326
52329
  prevFlipRef.current.rl = false;
@@ -52344,6 +52347,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52344
52347
  _newVisibleRecommendArea3 >= originIntersectionRecommendArea)) {
52345
52348
  prevFlipRef.current.lr = true;
52346
52349
  nextOffsetX = _tmpNextOffsetX;
52350
+ popupOffsetX = -popupOffsetX;
52347
52351
  nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
52348
52352
  } else {
52349
52353
  prevFlipRef.current.lr = false;
@@ -52356,7 +52360,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52356
52360
  if (typeof numShiftX === 'number') {
52357
52361
  // Left
52358
52362
  if (nextPopupX < visibleRegionArea.left) {
52359
- nextOffsetX -= nextPopupX - visibleRegionArea.left;
52363
+ nextOffsetX -= nextPopupX - visibleRegionArea.left - popupOffsetX;
52360
52364
  if (targetRect.x + targetWidth < visibleRegionArea.left + numShiftX) {
52361
52365
  nextOffsetX += targetRect.x - visibleRegionArea.left + targetWidth - numShiftX;
52362
52366
  }
@@ -52364,7 +52368,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52364
52368
 
52365
52369
  // Right
52366
52370
  if (nextPopupRight > visibleRegionArea.right) {
52367
- nextOffsetX -= nextPopupRight - visibleRegionArea.right;
52371
+ nextOffsetX -= nextPopupRight - visibleRegionArea.right - popupOffsetX;
52368
52372
  if (targetRect.x > visibleRegionArea.right - numShiftX) {
52369
52373
  nextOffsetX += targetRect.x - visibleRegionArea.right + numShiftX;
52370
52374
  }
@@ -52374,7 +52378,10 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52374
52378
  if (typeof numShiftY === 'number') {
52375
52379
  // Top
52376
52380
  if (nextPopupY < visibleRegionArea.top) {
52377
- nextOffsetY -= nextPopupY - visibleRegionArea.top + popupOffsetY;
52381
+ nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY;
52382
+
52383
+ // When target if far away from visible area
52384
+ // Stop shift
52378
52385
  if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
52379
52386
  nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
52380
52387
  }
@@ -52473,7 +52480,7 @@ __webpack_require__.r(__webpack_exports__);
52473
52480
 
52474
52481
 
52475
52482
 
52476
- function useWatch(open, target, popup, onAlign) {
52483
+ function useWatch(open, target, popup, onAlign, onScroll) {
52477
52484
  Object(rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_1__["default"])(function () {
52478
52485
  if (open && target && popup) {
52479
52486
  var targetElement = target;
@@ -52484,6 +52491,7 @@ function useWatch(open, target, popup, onAlign) {
52484
52491
  var mergedList = new Set([win].concat(Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(targetScrollList), Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(popupScrollList)));
52485
52492
  function notifyScroll() {
52486
52493
  onAlign();
52494
+ onScroll();
52487
52495
  }
52488
52496
  mergedList.forEach(function (scroller) {
52489
52497
  scroller.addEventListener('scroll', notifyScroll, {
@@ -52878,12 +52886,23 @@ function generateTrigger() {
52878
52886
  scaleY = _useAlign2[8],
52879
52887
  alignInfo = _useAlign2[9],
52880
52888
  onAlign = _useAlign2[10];
52889
+ var _useAction = Object(_hooks_useAction__WEBPACK_IMPORTED_MODULE_15__["default"])(mobile, action, showAction, hideAction),
52890
+ _useAction2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_useAction, 2),
52891
+ showActions = _useAction2[0],
52892
+ hideActions = _useAction2[1];
52893
+ var clickToShow = showActions.has('click');
52894
+ var clickToHide = hideActions.has('click') || hideActions.has('contextMenu');
52881
52895
  var triggerAlign = Object(rc_util_es_hooks_useEvent__WEBPACK_IMPORTED_MODULE_8__["default"])(function () {
52882
52896
  if (!inMotion) {
52883
52897
  onAlign();
52884
52898
  }
52885
52899
  });
52886
- Object(_hooks_useWatch__WEBPACK_IMPORTED_MODULE_17__["default"])(mergedOpen, targetEle, popupEle, triggerAlign);
52900
+ var onScroll = function onScroll() {
52901
+ if (openRef.current && alignPoint && clickToHide) {
52902
+ triggerOpen(false);
52903
+ }
52904
+ };
52905
+ Object(_hooks_useWatch__WEBPACK_IMPORTED_MODULE_17__["default"])(mergedOpen, targetEle, popupEle, triggerAlign, onScroll);
52887
52906
  Object(rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_10__["default"])(function () {
52888
52907
  triggerAlign();
52889
52908
  }, [mousePos, popupPlacement]);
@@ -52946,11 +52965,6 @@ function generateTrigger() {
52946
52965
  };
52947
52966
 
52948
52967
  // =========================== Action ===========================
52949
- var _useAction = Object(_hooks_useAction__WEBPACK_IMPORTED_MODULE_15__["default"])(mobile, action, showAction, hideAction),
52950
- _useAction2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_useAction, 2),
52951
- showActions = _useAction2[0],
52952
- hideActions = _useAction2[1];
52953
-
52954
52968
  /**
52955
52969
  * Util wrapper for trigger action
52956
52970
  */
@@ -52969,8 +52983,6 @@ function generateTrigger() {
52969
52983
  }
52970
52984
 
52971
52985
  // ======================= Action: Click ========================
52972
- var clickToShow = showActions.has('click');
52973
- var clickToHide = hideActions.has('click') || hideActions.has('contextMenu');
52974
52986
  if (clickToShow || clickToHide) {
52975
52987
  cloneProps.onClick = function (event) {
52976
52988
  var _originChildProps$onC;
@@ -103100,6 +103112,7 @@ var FormStore = /*#__PURE__*/Object(_babel_runtime_helpers_esm_createClass__WEBP
103100
103112
  };
103101
103113
  // =========================== Validate ===========================
103102
103114
  this.validateFields = function (arg1, arg2) {
103115
+ var _options;
103103
103116
  _this.warningUnhooked();
103104
103117
  var nameList;
103105
103118
  var options;
@@ -103116,27 +103129,12 @@ var FormStore = /*#__PURE__*/Object(_babel_runtime_helpers_esm_createClass__WEBP
103116
103129
  // We temp save the path which need trigger for `onFieldsChange`
103117
103130
  var TMP_SPLIT = String(Date.now());
103118
103131
  var validateNamePathList = new Set();
103132
+ var recursive = (_options = options) === null || _options === void 0 ? void 0 : _options.recursive;
103119
103133
  _this.getFieldEntities(true).forEach(function (field) {
103120
- var _options;
103121
103134
  // Add field if not provide `nameList`
103122
103135
  if (!provideNameList) {
103123
103136
  namePathList.push(field.getNamePath());
103124
103137
  }
103125
- /**
103126
- * Recursive validate if configured.
103127
- * TODO: perf improvement @zombieJ
103128
- */
103129
- if (((_options = options) === null || _options === void 0 ? void 0 : _options.recursive) && provideNameList) {
103130
- var namePath = field.getNamePath();
103131
- if (
103132
- // nameList[i] === undefined 说明是以 nameList 开头的
103133
- // ['name'] -> ['name','list']
103134
- namePath.every(function (nameUnit, i) {
103135
- return nameList[i] === nameUnit || nameList[i] === undefined;
103136
- })) {
103137
- namePathList.push(namePath);
103138
- }
103139
- }
103140
103138
  // Skip if without rule
103141
103139
  if (!field.props.rules || !field.props.rules.length) {
103142
103140
  return;
@@ -103144,7 +103142,7 @@ var FormStore = /*#__PURE__*/Object(_babel_runtime_helpers_esm_createClass__WEBP
103144
103142
  var fieldNamePath = field.getNamePath();
103145
103143
  validateNamePathList.add(fieldNamePath.join(TMP_SPLIT));
103146
103144
  // Add field validate rule in to promise list
103147
- if (!provideNameList || Object(_utils_valueUtil__WEBPACK_IMPORTED_MODULE_14__["containsNamePath"])(namePathList, fieldNamePath)) {
103145
+ if (!provideNameList || Object(_utils_valueUtil__WEBPACK_IMPORTED_MODULE_14__["containsNamePath"])(namePathList, fieldNamePath, recursive)) {
103148
103146
  var promise = field.validateRules(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({
103149
103147
  validateMessages: Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({}, _utils_messages__WEBPACK_IMPORTED_MODULE_12__["defaultValidateMessages"]), _this.validateMessages)
103150
103148
  }, options));
@@ -103966,17 +103964,34 @@ function cloneByNamePathList(store, namePathList) {
103966
103964
  });
103967
103965
  return newStore;
103968
103966
  }
103967
+ /**
103968
+ * Check if `namePathList` includes `namePath`.
103969
+ * @param namePathList A list of `InternalNamePath[]`
103970
+ * @param namePath Compare `InternalNamePath`
103971
+ * @param partialMatch True will make `[a, b]` match `[a, b, c]`
103972
+ */
103969
103973
  function containsNamePath(namePathList, namePath) {
103974
+ var partialMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
103970
103975
  return namePathList && namePathList.some(function (path) {
103971
- return matchNamePath(path, namePath);
103976
+ return matchNamePath(namePath, path, partialMatch);
103972
103977
  });
103973
103978
  }
103974
- function matchNamePath(namePath, changedNamePath) {
103975
- if (!namePath || !changedNamePath || namePath.length !== changedNamePath.length) {
103979
+ /**
103980
+ * Check if `namePath` is super set or equal of `subNamePath`.
103981
+ * @param namePath A list of `InternalNamePath[]`
103982
+ * @param subNamePath Compare `InternalNamePath`
103983
+ * @param partialMatch True will make `[a, b]` match `[a, b, c]`
103984
+ */
103985
+ function matchNamePath(namePath, subNamePath) {
103986
+ var partialMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
103987
+ if (!namePath || !subNamePath) {
103988
+ return false;
103989
+ }
103990
+ if (!partialMatch && namePath.length !== subNamePath.length) {
103976
103991
  return false;
103977
103992
  }
103978
- return namePath.every(function (nameUnit, i) {
103979
- return changedNamePath[i] === nameUnit;
103993
+ return subNamePath.every(function (nameUnit, i) {
103994
+ return namePath[i] === nameUnit;
103980
103995
  });
103981
103996
  }
103982
103997
  function isSimilar(source, target) {
@@ -115527,6 +115542,7 @@ var Input = function Input(_ref, ref) {
115527
115542
  autoFocus: autoFocus,
115528
115543
  className: classnames__WEBPACK_IMPORTED_MODULE_2___default()("".concat(prefixCls, "-selection-search-input"), (_inputNode2 = inputNode) === null || _inputNode2 === void 0 ? void 0 : (_inputNode2$props = _inputNode2.props) === null || _inputNode2$props === void 0 ? void 0 : _inputNode2$props.className),
115529
115544
  role: 'combobox',
115545
+ 'aria-label': 'Search',
115530
115546
  'aria-expanded': open,
115531
115547
  'aria-haspopup': 'listbox',
115532
115548
  'aria-owns': "".concat(id, "_list"),