acud 1.4.0 → 1.4.1

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.0 */
1
+ /*! acud v1.4.1 */
2
2
  /* color */
3
3
  /* 默认颜色 */
4
4
  /* 通用-icon */
package/dist/acud.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! acud v1.4.0 */
1
+ /*! acud v1.4.1 */
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"));
@@ -6072,8 +6072,8 @@ var Menus = /*#__PURE__*/function (_React$Component) {
6072
6072
  return;
6073
6073
  }
6074
6074
  var isPlaceTop = ['topLeft', 'topRight'].includes(popupPlacement);
6075
- var clientHeight = document.body.clientHeight;
6076
- var clientWidth = document.body.clientWidth;
6075
+ var clientHeight = window.innerHeight;
6076
+ var clientWidth = window.innerWidth;
6077
6077
  var _loop = function _loop() {
6078
6078
  var currentMenu = _this6.menus[i];
6079
6079
  var prevMenu = _this6.menus[i - 1];
@@ -16057,6 +16057,24 @@ var placements = {
16057
16057
  overflow: autoAdjustOverflow,
16058
16058
  offset: [4, 0],
16059
16059
  targetOffset: targetOffset
16060
+ },
16061
+ leftTop: {
16062
+ points: ['tr', 'tl'],
16063
+ overflow: autoAdjustOverflow,
16064
+ offset: [-4, 0],
16065
+ targetOffset: targetOffset
16066
+ },
16067
+ leftCenter: {
16068
+ points: ['cr', 'cl'],
16069
+ overflow: autoAdjustOverflow,
16070
+ offset: [-4, 0],
16071
+ targetOffset: targetOffset
16072
+ },
16073
+ leftBottom: {
16074
+ points: ['cr', 'cl'],
16075
+ overflow: autoAdjustOverflow,
16076
+ offset: [-4, 0],
16077
+ targetOffset: targetOffset
16060
16078
  }
16061
16079
  };
16062
16080
  /* harmony default export */ __webpack_exports__["default"] = (placements);
@@ -52251,6 +52269,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52251
52269
  newVisibleRecommendArea >= originIntersectionRecommendArea)) {
52252
52270
  prevFlipRef.current.bt = true;
52253
52271
  nextOffsetY = tmpNextOffsetY;
52272
+ popupOffsetY = -popupOffsetY;
52254
52273
  nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
52255
52274
  } else {
52256
52275
  prevFlipRef.current.bt = false;
@@ -52274,6 +52293,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52274
52293
  _newVisibleRecommendArea >= originIntersectionRecommendArea)) {
52275
52294
  prevFlipRef.current.tb = true;
52276
52295
  nextOffsetY = _tmpNextOffsetY;
52296
+ popupOffsetY = -popupOffsetY;
52277
52297
  nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
52278
52298
  } else {
52279
52299
  prevFlipRef.current.tb = false;
@@ -52303,6 +52323,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52303
52323
  _newVisibleRecommendArea2 >= originIntersectionRecommendArea)) {
52304
52324
  prevFlipRef.current.rl = true;
52305
52325
  nextOffsetX = tmpNextOffsetX;
52326
+ popupOffsetX = -popupOffsetX;
52306
52327
  nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
52307
52328
  } else {
52308
52329
  prevFlipRef.current.rl = false;
@@ -52326,6 +52347,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52326
52347
  _newVisibleRecommendArea3 >= originIntersectionRecommendArea)) {
52327
52348
  prevFlipRef.current.lr = true;
52328
52349
  nextOffsetX = _tmpNextOffsetX;
52350
+ popupOffsetX = -popupOffsetX;
52329
52351
  nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
52330
52352
  } else {
52331
52353
  prevFlipRef.current.lr = false;
@@ -52338,7 +52360,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52338
52360
  if (typeof numShiftX === 'number') {
52339
52361
  // Left
52340
52362
  if (nextPopupX < visibleRegionArea.left) {
52341
- nextOffsetX -= nextPopupX - visibleRegionArea.left;
52363
+ nextOffsetX -= nextPopupX - visibleRegionArea.left - popupOffsetX;
52342
52364
  if (targetRect.x + targetWidth < visibleRegionArea.left + numShiftX) {
52343
52365
  nextOffsetX += targetRect.x - visibleRegionArea.left + targetWidth - numShiftX;
52344
52366
  }
@@ -52346,7 +52368,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52346
52368
 
52347
52369
  // Right
52348
52370
  if (nextPopupRight > visibleRegionArea.right) {
52349
- nextOffsetX -= nextPopupRight - visibleRegionArea.right;
52371
+ nextOffsetX -= nextPopupRight - visibleRegionArea.right - popupOffsetX;
52350
52372
  if (targetRect.x > visibleRegionArea.right - numShiftX) {
52351
52373
  nextOffsetX += targetRect.x - visibleRegionArea.right + numShiftX;
52352
52374
  }
@@ -52356,7 +52378,10 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52356
52378
  if (typeof numShiftY === 'number') {
52357
52379
  // Top
52358
52380
  if (nextPopupY < visibleRegionArea.top) {
52359
- nextOffsetY -= nextPopupY - visibleRegionArea.top + popupOffsetY;
52381
+ nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY;
52382
+
52383
+ // When target if far away from visible area
52384
+ // Stop shift
52360
52385
  if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
52361
52386
  nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
52362
52387
  }
@@ -52455,7 +52480,7 @@ __webpack_require__.r(__webpack_exports__);
52455
52480
 
52456
52481
 
52457
52482
 
52458
- function useWatch(open, target, popup, onAlign) {
52483
+ function useWatch(open, target, popup, onAlign, onScroll) {
52459
52484
  Object(rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_1__["default"])(function () {
52460
52485
  if (open && target && popup) {
52461
52486
  var targetElement = target;
@@ -52466,6 +52491,7 @@ function useWatch(open, target, popup, onAlign) {
52466
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)));
52467
52492
  function notifyScroll() {
52468
52493
  onAlign();
52494
+ onScroll();
52469
52495
  }
52470
52496
  mergedList.forEach(function (scroller) {
52471
52497
  scroller.addEventListener('scroll', notifyScroll, {
@@ -52860,12 +52886,23 @@ function generateTrigger() {
52860
52886
  scaleY = _useAlign2[8],
52861
52887
  alignInfo = _useAlign2[9],
52862
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');
52863
52895
  var triggerAlign = Object(rc_util_es_hooks_useEvent__WEBPACK_IMPORTED_MODULE_8__["default"])(function () {
52864
52896
  if (!inMotion) {
52865
52897
  onAlign();
52866
52898
  }
52867
52899
  });
52868
- 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);
52869
52906
  Object(rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_10__["default"])(function () {
52870
52907
  triggerAlign();
52871
52908
  }, [mousePos, popupPlacement]);
@@ -52928,11 +52965,6 @@ function generateTrigger() {
52928
52965
  };
52929
52966
 
52930
52967
  // =========================== Action ===========================
52931
- var _useAction = Object(_hooks_useAction__WEBPACK_IMPORTED_MODULE_15__["default"])(mobile, action, showAction, hideAction),
52932
- _useAction2 = Object(_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_useAction, 2),
52933
- showActions = _useAction2[0],
52934
- hideActions = _useAction2[1];
52935
-
52936
52968
  /**
52937
52969
  * Util wrapper for trigger action
52938
52970
  */
@@ -52951,8 +52983,6 @@ function generateTrigger() {
52951
52983
  }
52952
52984
 
52953
52985
  // ======================= Action: Click ========================
52954
- var clickToShow = showActions.has('click');
52955
- var clickToHide = hideActions.has('click') || hideActions.has('contextMenu');
52956
52986
  if (clickToShow || clickToHide) {
52957
52987
  cloneProps.onClick = function (event) {
52958
52988
  var _originChildProps$onC;
@@ -103082,6 +103112,7 @@ var FormStore = /*#__PURE__*/Object(_babel_runtime_helpers_esm_createClass__WEBP
103082
103112
  };
103083
103113
  // =========================== Validate ===========================
103084
103114
  this.validateFields = function (arg1, arg2) {
103115
+ var _options;
103085
103116
  _this.warningUnhooked();
103086
103117
  var nameList;
103087
103118
  var options;
@@ -103098,27 +103129,12 @@ var FormStore = /*#__PURE__*/Object(_babel_runtime_helpers_esm_createClass__WEBP
103098
103129
  // We temp save the path which need trigger for `onFieldsChange`
103099
103130
  var TMP_SPLIT = String(Date.now());
103100
103131
  var validateNamePathList = new Set();
103132
+ var recursive = (_options = options) === null || _options === void 0 ? void 0 : _options.recursive;
103101
103133
  _this.getFieldEntities(true).forEach(function (field) {
103102
- var _options;
103103
103134
  // Add field if not provide `nameList`
103104
103135
  if (!provideNameList) {
103105
103136
  namePathList.push(field.getNamePath());
103106
103137
  }
103107
- /**
103108
- * Recursive validate if configured.
103109
- * TODO: perf improvement @zombieJ
103110
- */
103111
- if (((_options = options) === null || _options === void 0 ? void 0 : _options.recursive) && provideNameList) {
103112
- var namePath = field.getNamePath();
103113
- if (
103114
- // nameList[i] === undefined 说明是以 nameList 开头的
103115
- // ['name'] -> ['name','list']
103116
- namePath.every(function (nameUnit, i) {
103117
- return nameList[i] === nameUnit || nameList[i] === undefined;
103118
- })) {
103119
- namePathList.push(namePath);
103120
- }
103121
- }
103122
103138
  // Skip if without rule
103123
103139
  if (!field.props.rules || !field.props.rules.length) {
103124
103140
  return;
@@ -103126,7 +103142,7 @@ var FormStore = /*#__PURE__*/Object(_babel_runtime_helpers_esm_createClass__WEBP
103126
103142
  var fieldNamePath = field.getNamePath();
103127
103143
  validateNamePathList.add(fieldNamePath.join(TMP_SPLIT));
103128
103144
  // Add field validate rule in to promise list
103129
- 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)) {
103130
103146
  var promise = field.validateRules(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({
103131
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)
103132
103148
  }, options));
@@ -103948,17 +103964,34 @@ function cloneByNamePathList(store, namePathList) {
103948
103964
  });
103949
103965
  return newStore;
103950
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
+ */
103951
103973
  function containsNamePath(namePathList, namePath) {
103974
+ var partialMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
103952
103975
  return namePathList && namePathList.some(function (path) {
103953
- return matchNamePath(path, namePath);
103976
+ return matchNamePath(namePath, path, partialMatch);
103954
103977
  });
103955
103978
  }
103956
- function matchNamePath(namePath, changedNamePath) {
103957
- 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) {
103958
103991
  return false;
103959
103992
  }
103960
- return namePath.every(function (nameUnit, i) {
103961
- return changedNamePath[i] === nameUnit;
103993
+ return subNamePath.every(function (nameUnit, i) {
103994
+ return namePath[i] === nameUnit;
103962
103995
  });
103963
103996
  }
103964
103997
  function isSimilar(source, target) {
@@ -115509,6 +115542,7 @@ var Input = function Input(_ref, ref) {
115509
115542
  autoFocus: autoFocus,
115510
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),
115511
115544
  role: 'combobox',
115545
+ 'aria-label': 'Search',
115512
115546
  'aria-expanded': open,
115513
115547
  'aria-haspopup': 'listbox',
115514
115548
  'aria-owns': "".concat(id, "_list"),