acud 1.4.1 → 1.4.3

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.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! acud v1.4.1 */
1
+ /*! acud v1.4.3 */
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"));
@@ -16071,7 +16071,7 @@ var placements = {
16071
16071
  targetOffset: targetOffset
16072
16072
  },
16073
16073
  leftBottom: {
16074
- points: ['cr', 'cl'],
16074
+ points: ['br', 'bl'],
16075
16075
  overflow: autoAdjustOverflow,
16076
16076
  offset: [-4, 0],
16077
16077
  targetOffset: targetOffset
@@ -52269,7 +52269,6 @@ 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;
52273
52272
  nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
52274
52273
  } else {
52275
52274
  prevFlipRef.current.bt = false;
@@ -52293,7 +52292,6 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52293
52292
  _newVisibleRecommendArea >= originIntersectionRecommendArea)) {
52294
52293
  prevFlipRef.current.tb = true;
52295
52294
  nextOffsetY = _tmpNextOffsetY;
52296
- popupOffsetY = -popupOffsetY;
52297
52295
  nextAlignInfo.points = [reversePoints(popupPoints, 0), reversePoints(targetPoints, 0)];
52298
52296
  } else {
52299
52297
  prevFlipRef.current.tb = false;
@@ -52323,7 +52321,6 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52323
52321
  _newVisibleRecommendArea2 >= originIntersectionRecommendArea)) {
52324
52322
  prevFlipRef.current.rl = true;
52325
52323
  nextOffsetX = tmpNextOffsetX;
52326
- popupOffsetX = -popupOffsetX;
52327
52324
  nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
52328
52325
  } else {
52329
52326
  prevFlipRef.current.rl = false;
@@ -52347,7 +52344,6 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52347
52344
  _newVisibleRecommendArea3 >= originIntersectionRecommendArea)) {
52348
52345
  prevFlipRef.current.lr = true;
52349
52346
  nextOffsetX = _tmpNextOffsetX;
52350
- popupOffsetX = -popupOffsetX;
52351
52347
  nextAlignInfo.points = [reversePoints(popupPoints, 1), reversePoints(targetPoints, 1)];
52352
52348
  } else {
52353
52349
  prevFlipRef.current.lr = false;
@@ -52360,7 +52356,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52360
52356
  if (typeof numShiftX === 'number') {
52361
52357
  // Left
52362
52358
  if (nextPopupX < visibleRegionArea.left) {
52363
- nextOffsetX -= nextPopupX - visibleRegionArea.left - popupOffsetX;
52359
+ nextOffsetX -= nextPopupX - visibleRegionArea.left;
52364
52360
  if (targetRect.x + targetWidth < visibleRegionArea.left + numShiftX) {
52365
52361
  nextOffsetX += targetRect.x - visibleRegionArea.left + targetWidth - numShiftX;
52366
52362
  }
@@ -52368,7 +52364,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52368
52364
 
52369
52365
  // Right
52370
52366
  if (nextPopupRight > visibleRegionArea.right) {
52371
- nextOffsetX -= nextPopupRight - visibleRegionArea.right - popupOffsetX;
52367
+ nextOffsetX -= nextPopupRight - visibleRegionArea.right;
52372
52368
  if (targetRect.x > visibleRegionArea.right - numShiftX) {
52373
52369
  nextOffsetX += targetRect.x - visibleRegionArea.right + numShiftX;
52374
52370
  }
@@ -52378,10 +52374,7 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
52378
52374
  if (typeof numShiftY === 'number') {
52379
52375
  // Top
52380
52376
  if (nextPopupY < visibleRegionArea.top) {
52381
- nextOffsetY -= nextPopupY - visibleRegionArea.top - popupOffsetY;
52382
-
52383
- // When target if far away from visible area
52384
- // Stop shift
52377
+ nextOffsetY -= nextPopupY - visibleRegionArea.top + popupOffsetY;
52385
52378
  if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
52386
52379
  nextOffsetY += targetRect.y - visibleRegionArea.top + targetHeight - numShiftY;
52387
52380
  }
@@ -52480,7 +52473,7 @@ __webpack_require__.r(__webpack_exports__);
52480
52473
 
52481
52474
 
52482
52475
 
52483
- function useWatch(open, target, popup, onAlign, onScroll) {
52476
+ function useWatch(open, target, popup, onAlign) {
52484
52477
  Object(rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_1__["default"])(function () {
52485
52478
  if (open && target && popup) {
52486
52479
  var targetElement = target;
@@ -52491,7 +52484,6 @@ function useWatch(open, target, popup, onAlign, onScroll) {
52491
52484
  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)));
52492
52485
  function notifyScroll() {
52493
52486
  onAlign();
52494
- onScroll();
52495
52487
  }
52496
52488
  mergedList.forEach(function (scroller) {
52497
52489
  scroller.addEventListener('scroll', notifyScroll, {
@@ -52886,23 +52878,12 @@ function generateTrigger() {
52886
52878
  scaleY = _useAlign2[8],
52887
52879
  alignInfo = _useAlign2[9],
52888
52880
  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');
52895
52881
  var triggerAlign = Object(rc_util_es_hooks_useEvent__WEBPACK_IMPORTED_MODULE_8__["default"])(function () {
52896
52882
  if (!inMotion) {
52897
52883
  onAlign();
52898
52884
  }
52899
52885
  });
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);
52886
+ Object(_hooks_useWatch__WEBPACK_IMPORTED_MODULE_17__["default"])(mergedOpen, targetEle, popupEle, triggerAlign);
52906
52887
  Object(rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_10__["default"])(function () {
52907
52888
  triggerAlign();
52908
52889
  }, [mousePos, popupPlacement]);
@@ -52965,6 +52946,11 @@ function generateTrigger() {
52965
52946
  };
52966
52947
 
52967
52948
  // =========================== 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
+
52968
52954
  /**
52969
52955
  * Util wrapper for trigger action
52970
52956
  */
@@ -52983,6 +52969,8 @@ function generateTrigger() {
52983
52969
  }
52984
52970
 
52985
52971
  // ======================= Action: Click ========================
52972
+ var clickToShow = showActions.has('click');
52973
+ var clickToHide = hideActions.has('click') || hideActions.has('contextMenu');
52986
52974
  if (clickToShow || clickToHide) {
52987
52975
  cloneProps.onClick = function (event) {
52988
52976
  var _originChildProps$onC;
@@ -103112,7 +103100,6 @@ var FormStore = /*#__PURE__*/Object(_babel_runtime_helpers_esm_createClass__WEBP
103112
103100
  };
103113
103101
  // =========================== Validate ===========================
103114
103102
  this.validateFields = function (arg1, arg2) {
103115
- var _options;
103116
103103
  _this.warningUnhooked();
103117
103104
  var nameList;
103118
103105
  var options;
@@ -103129,12 +103116,27 @@ var FormStore = /*#__PURE__*/Object(_babel_runtime_helpers_esm_createClass__WEBP
103129
103116
  // We temp save the path which need trigger for `onFieldsChange`
103130
103117
  var TMP_SPLIT = String(Date.now());
103131
103118
  var validateNamePathList = new Set();
103132
- var recursive = (_options = options) === null || _options === void 0 ? void 0 : _options.recursive;
103133
103119
  _this.getFieldEntities(true).forEach(function (field) {
103120
+ var _options;
103134
103121
  // Add field if not provide `nameList`
103135
103122
  if (!provideNameList) {
103136
103123
  namePathList.push(field.getNamePath());
103137
103124
  }
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
+ }
103138
103140
  // Skip if without rule
103139
103141
  if (!field.props.rules || !field.props.rules.length) {
103140
103142
  return;
@@ -103142,7 +103144,7 @@ var FormStore = /*#__PURE__*/Object(_babel_runtime_helpers_esm_createClass__WEBP
103142
103144
  var fieldNamePath = field.getNamePath();
103143
103145
  validateNamePathList.add(fieldNamePath.join(TMP_SPLIT));
103144
103146
  // Add field validate rule in to promise list
103145
- if (!provideNameList || Object(_utils_valueUtil__WEBPACK_IMPORTED_MODULE_14__["containsNamePath"])(namePathList, fieldNamePath, recursive)) {
103147
+ if (!provideNameList || Object(_utils_valueUtil__WEBPACK_IMPORTED_MODULE_14__["containsNamePath"])(namePathList, fieldNamePath)) {
103146
103148
  var promise = field.validateRules(Object(_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({
103147
103149
  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)
103148
103150
  }, options));
@@ -103964,34 +103966,17 @@ function cloneByNamePathList(store, namePathList) {
103964
103966
  });
103965
103967
  return newStore;
103966
103968
  }
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
- */
103973
103969
  function containsNamePath(namePathList, namePath) {
103974
- var partialMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
103975
103970
  return namePathList && namePathList.some(function (path) {
103976
- return matchNamePath(namePath, path, partialMatch);
103971
+ return matchNamePath(path, namePath);
103977
103972
  });
103978
103973
  }
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) {
103974
+ function matchNamePath(namePath, changedNamePath) {
103975
+ if (!namePath || !changedNamePath || namePath.length !== changedNamePath.length) {
103991
103976
  return false;
103992
103977
  }
103993
- return subNamePath.every(function (nameUnit, i) {
103994
- return namePath[i] === nameUnit;
103978
+ return namePath.every(function (nameUnit, i) {
103979
+ return changedNamePath[i] === nameUnit;
103995
103980
  });
103996
103981
  }
103997
103982
  function isSimilar(source, target) {
@@ -115542,7 +115527,6 @@ var Input = function Input(_ref, ref) {
115542
115527
  autoFocus: autoFocus,
115543
115528
  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),
115544
115529
  role: 'combobox',
115545
- 'aria-label': 'Search',
115546
115530
  'aria-expanded': open,
115547
115531
  'aria-haspopup': 'listbox',
115548
115532
  'aria-owns': "".concat(id, "_list"),