shineout 3.7.0-beta.12 → 3.7.0-beta.13

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/shineout.js CHANGED
@@ -12217,7 +12217,7 @@ var handleStyle = function handleStyle(style) {
12217
12217
  };
12218
12218
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12219
12219
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12220
- /* harmony default export */ var version = ('3.7.0-beta.12');
12220
+ /* harmony default export */ var version = ('3.7.0-beta.13');
12221
12221
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12222
12222
 
12223
12223
 
@@ -17622,12 +17622,14 @@ var cascaderStyle = objectSpread2_default()(objectSpread2_default()({
17622
17622
  visibility: 'hidden'
17623
17623
  },
17624
17624
  moreWrapper: {
17625
- // width: 248,
17626
- // height: 72,
17625
+ width: 'max-content',
17627
17626
  maxWidth: 400,
17628
17627
  maxHeight: 160,
17629
17628
  overflow: 'auto',
17630
- padding: "".concat(src.cascaderMorePaddingY, " ").concat(src.cascaderMorePaddingX)
17629
+ padding: "".concat(src.cascaderMorePaddingY, " ").concat(src.cascaderMorePaddingX),
17630
+ '& $tag': {
17631
+ maxWidth: 'none'
17632
+ }
17631
17633
  },
17632
17634
  virtualList: {
17633
17635
  margin: 0,
@@ -19758,9 +19760,14 @@ var ImageStyle = objectSpread2_default()(objectSpread2_default()({
19758
19760
  },
19759
19761
  fill: {
19760
19762
  '& $inner': {
19761
- backgroundSize: 'cover',
19762
- backgroundPosition: '50% 50%',
19763
- backgroundRepeat: 'no-repeat'
19763
+ '& > img': {
19764
+ position: 'absolute',
19765
+ top: '50%',
19766
+ left: '50%',
19767
+ transform: 'translate(-50%, -50%)',
19768
+ maxWidth: 'none',
19769
+ maxHeight: 'none'
19770
+ }
19764
19771
  }
19765
19772
  },
19766
19773
  previewMask: {
@@ -23430,10 +23437,14 @@ var selectStyle = objectSpread2_default()(objectSpread2_default()({
23430
23437
  visibility: 'hidden'
23431
23438
  },
23432
23439
  moreWrapper: {
23440
+ width: 'max-content',
23433
23441
  maxWidth: 400,
23434
23442
  maxHeight: 160,
23435
23443
  overflow: 'auto',
23436
23444
  padding: "".concat(src.selectMorePaddingY, " ").concat(src.selectMorePaddingX),
23445
+ '& $tag': {
23446
+ maxWidth: 'none'
23447
+ },
23437
23448
  '&:hover': {
23438
23449
  '& $clearIcon': {
23439
23450
  display: 'inline-block'
@@ -25632,9 +25643,19 @@ var switchStyle = objectSpread2_default()(objectSpread2_default()({
25632
25643
  var useSwitchStyle = styled(src_switch_switch, 'switch');
25633
25644
 
25634
25645
  /* harmony default export */ var shineout_style_src_switch = ((/* unused pure expression or super */ null && (useSwitchStyle)));
25646
+ ;// CONCATENATED MODULE: ../shineout-style/src/mixin/custom-scrollbar.ts
25647
+ function customScrollBar(info) {
25648
+ return {
25649
+ 'scrollbar-color': info.background,
25650
+ '&::-webkit-scrollbar': {
25651
+ background: info.background
25652
+ }
25653
+ };
25654
+ }
25635
25655
  ;// CONCATENATED MODULE: ../shineout-style/src/table/table.ts
25636
25656
 
25637
25657
 
25658
+
25638
25659
  var cellBaseIndex = 4;
25639
25660
  var fixedIndex = 6;
25640
25661
  var resizeIndex = 8;
@@ -25849,6 +25870,13 @@ var tableStyle = objectSpread2_default()(objectSpread2_default()({
25849
25870
  zIndex: fixedIndex + 1
25850
25871
  }
25851
25872
  },
25873
+ scrollY: {
25874
+ '&$headWrapper, &$footWrapper': objectSpread2_default()({
25875
+ overflow: 'hidden scroll'
25876
+ }, customScrollBar({
25877
+ background: 'transparent'
25878
+ }))
25879
+ },
25852
25880
  emptyWrapper: {
25853
25881
  minHeight: '170px',
25854
25882
  width: '100%',
@@ -28652,10 +28680,14 @@ var treeSelectStyle = objectSpread2_default()(objectSpread2_default()({
28652
28680
  visibility: 'hidden'
28653
28681
  },
28654
28682
  moreWrapper: {
28683
+ width: 'max-content',
28655
28684
  maxWidth: 400,
28656
28685
  maxHeight: 160,
28657
28686
  overflow: 'auto',
28658
- padding: "".concat(src.treeSelectMorePaddingY, " ").concat(src.treeSelectMorePaddingX)
28687
+ padding: "".concat(src.treeSelectMorePaddingY, " ").concat(src.treeSelectMorePaddingX),
28688
+ '& $tag': {
28689
+ maxWidth: 'none'
28690
+ }
28659
28691
  },
28660
28692
  virtualList: {
28661
28693
  margin: 0,
@@ -33984,9 +34016,16 @@ var accordion_jssStyle = {
33984
34016
  var ModalSubmit = function ModalSubmit(props) {
33985
34017
  var modalFormContext = useFormFooter();
33986
34018
  var handleClick = usePersistFn(function (e) {
33987
- var _props$onClick;
33988
- (_props$onClick = props.onClick) === null || _props$onClick === void 0 || _props$onClick.call(props, e);
33989
- modalFormContext === null || modalFormContext === void 0 || modalFormContext.func.submit();
34019
+ var _modalFormContext$fun;
34020
+ if (modalFormContext !== null && modalFormContext !== void 0 && (_modalFormContext$fun = modalFormContext.func) !== null && _modalFormContext$fun !== void 0 && _modalFormContext$fun.hasSubmit) {
34021
+ modalFormContext === null || modalFormContext === void 0 || modalFormContext.func.submit(true, function () {
34022
+ var _props$onClick;
34023
+ return (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, e);
34024
+ });
34025
+ } else {
34026
+ var _props$onClick2;
34027
+ (_props$onClick2 = props.onClick) === null || _props$onClick2 === void 0 || _props$onClick2.call(props, e);
34028
+ }
33990
34029
  });
33991
34030
  return /*#__PURE__*/(0,jsx_runtime.jsx)(base_src_button_button, objectSpread2_default()(objectSpread2_default()({
33992
34031
  htmlType: "button",
@@ -40435,6 +40474,10 @@ var More = function More(props) {
40435
40474
  className: compressedClassName,
40436
40475
  visible: visible,
40437
40476
  onVisibleChange: setVisible,
40477
+ getPopupContainer: function getPopupContainer() {
40478
+ var _props$morePopoverCon;
40479
+ return (_props$morePopoverCon = props.morePopoverContainer) === null || _props$morePopoverCon === void 0 ? void 0 : _props$morePopoverCon.current;
40480
+ },
40438
40481
  children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
40439
40482
  className: styles.moreWrapper,
40440
40483
  onClick: function onClick(e) {
@@ -40729,7 +40772,8 @@ var result_Result = function Result(props) {
40729
40772
  compressed: compressed,
40730
40773
  renderCompressed: renderCompressed,
40731
40774
  compressedClassName: compressedClassName,
40732
- showNum: moreNumber
40775
+ showNum: moreNumber,
40776
+ morePopoverContainer: props.morePopoverContainer
40733
40777
  }, 'more');
40734
40778
  var renderResult = function renderResult() {
40735
40779
  if (empty) {
@@ -41283,7 +41327,8 @@ var Cascader = function Cascader(props0) {
41283
41327
  onResultItemClick: handleResultItemClick,
41284
41328
  checkUnMatched: checkUnMatched,
41285
41329
  getDataByValues: getDataByValues,
41286
- setInputText: setInputText
41330
+ setInputText: setInputText,
41331
+ morePopoverContainer: targetRef
41287
41332
  })
41288
41333
  });
41289
41334
  return /*#__PURE__*/(0,jsx_runtime.jsx)(PopupProvider, {
@@ -49429,7 +49474,8 @@ var useForm = function useForm(props) {
49429
49474
  size = props.size,
49430
49475
  colon = props.colon,
49431
49476
  formName = props.name,
49432
- scrollParent = props.scrollParent;
49477
+ scrollParent = props.scrollParent,
49478
+ isControl = props.isControl;
49433
49479
  var deepSetOptions = {
49434
49480
  removeUndefined: removeUndefined,
49435
49481
  forceSet: true
@@ -49685,13 +49731,16 @@ var useForm = function useForm(props) {
49685
49731
  var values = Object.keys(vals);
49686
49732
  // 针对 name 为数组模式,如 datepicker 的 name={['startTime', 'endTime']} 时,前者校验可能需要依赖后者,因此需要提前将后者数据整合至 draft 用于多字段整合校验
49687
49733
  values.forEach(function (key) {
49688
- deepSet(draft, key, vals[key], deepSetOptions);
49734
+ // upload组件返回的可能是函数: (prev) => [...prev, file]
49735
+ var valueOfKey = typeof vals[key] === 'function' ? vals[key](getValue(key)) : vals[key];
49736
+ deepSet(draft, key, valueOfKey, deepSetOptions);
49689
49737
  });
49690
49738
  values.forEach(function (key) {
49691
49739
  if (option.validate) {
49692
49740
  var _context$validateMap$;
49693
49741
  (_context$validateMap$ = context.validateMap[key]) === null || _context$validateMap$ === void 0 || _context$validateMap$.forEach(function (validate) {
49694
- validate(key, vals[key], current(draft));
49742
+ var valueOfKey = typeof vals[key] === 'function' ? vals[key](getValue(key)) : vals[key];
49743
+ validate(key, valueOfKey, current(draft));
49695
49744
  });
49696
49745
  }
49697
49746
  });
@@ -49747,6 +49796,7 @@ var useForm = function useForm(props) {
49747
49796
  });
49748
49797
  var submit = use_persist_fn(function () {
49749
49798
  var withValidate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
49799
+ var callback = arguments.length > 1 ? arguments[1] : undefined;
49750
49800
  if (disabled) return;
49751
49801
  if (context.submitLock) {
49752
49802
  return;
@@ -49764,32 +49814,29 @@ var useForm = function useForm(props) {
49764
49814
  while (1) switch (_context.prev = _context.next) {
49765
49815
  case 0:
49766
49816
  if (withValidate) {
49767
- _context.next = 3;
49817
+ _context.next = 4;
49768
49818
  break;
49769
49819
  }
49770
49820
  (_props$onSubmit = props.onSubmit) === null || _props$onSubmit === void 0 || _props$onSubmit.call(props, (_context$value = context.value) !== null && _context$value !== void 0 ? _context$value : {});
49821
+ callback === null || callback === void 0 || callback();
49771
49822
  return _context.abrupt("return");
49772
- case 3:
49773
- _context.next = 5;
49823
+ case 4:
49824
+ _context.next = 6;
49774
49825
  return validateFields(undefined, {
49775
49826
  ignoreBind: true
49776
49827
  }).catch(function (e) {
49777
49828
  return e;
49778
49829
  });
49779
- case 5:
49830
+ case 6:
49780
49831
  result = _context.sent;
49781
- if (!(result === true)) {
49782
- _context.next = 11;
49783
- break;
49832
+ if (result === true) {
49833
+ (_props$onSubmit2 = props.onSubmit) === null || _props$onSubmit2 === void 0 || _props$onSubmit2.call(props, (_context$value2 = context.value) !== null && _context$value2 !== void 0 ? _context$value2 : {});
49834
+ if (activeEl) activeEl.focus();
49835
+ } else {
49836
+ handleSubmitError(result);
49784
49837
  }
49785
- (_props$onSubmit2 = props.onSubmit) === null || _props$onSubmit2 === void 0 || _props$onSubmit2.call(props, (_context$value2 = context.value) !== null && _context$value2 !== void 0 ? _context$value2 : {});
49786
- if (activeEl) activeEl.focus();
49787
- _context.next = 13;
49788
- break;
49789
- case 11:
49790
- handleSubmitError(result);
49791
- return _context.abrupt("return");
49792
- case 13:
49838
+ callback === null || callback === void 0 || callback();
49839
+ case 9:
49793
49840
  case "end":
49794
49841
  return _context.stop();
49795
49842
  }
@@ -49989,7 +50036,10 @@ var useForm = function useForm(props) {
49989
50036
  external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect(function () {
49990
50037
  context.removeLock = false;
49991
50038
  // 内部 onChange 改的 value, 不需要更新
49992
- if (props.value === context.value) return;
50039
+ if (props.value === context.value) {
50040
+ if (!isControl) update();
50041
+ return;
50042
+ }
49993
50043
  if (initValidate && !context.resetTime) {
49994
50044
  var keys = Object.keys(context.validateMap).filter(function (key) {
49995
50045
  var oldValue = deepGet(preValue || emptyObj, key);
@@ -50059,11 +50109,12 @@ var Form = function Form(props) {
50059
50109
  rest = objectWithoutProperties_default()(props, form_excluded);
50060
50110
  var formClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$form = jssStyle.form) === null || _jssStyle$form === void 0 ? void 0 : _jssStyle$form.call(jssStyle);
50061
50111
  var modalFormContext = useFormFooter();
50112
+ var isControl = ('value' in props);
50062
50113
  var inputAbleParams = {
50063
50114
  value: props.value,
50064
50115
  onChange: props.onChange,
50065
50116
  defaultValue: props.defaultValue,
50066
- control: 'value' in props,
50117
+ control: isControl,
50067
50118
  beforeChange: undefined,
50068
50119
  reserveAble: false
50069
50120
  };
@@ -50074,7 +50125,8 @@ var Form = function Form(props) {
50074
50125
  var _useForm = use_form(objectSpread2_default()(objectSpread2_default()({}, rest), {}, {
50075
50126
  value: value,
50076
50127
  onChange: onChange,
50077
- formElRef: formElRef
50128
+ formElRef: formElRef,
50129
+ isControl: isControl
50078
50130
  })),
50079
50131
  Provider = _useForm.Provider,
50080
50132
  ProviderProps = _useForm.ProviderProps,
@@ -51207,6 +51259,10 @@ var useImage = function useImage() {
51207
51259
  _React$useState2 = slicedToArray_default()(_React$useState, 2),
51208
51260
  status = _React$useState2[0],
51209
51261
  setStatus = _React$useState2[1];
51262
+ var _React$useState3 = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useState({}),
51263
+ _React$useState4 = slicedToArray_default()(_React$useState3, 2),
51264
+ imgCoverStyle = _React$useState4[0],
51265
+ setImgCoverStyle = _React$useState4[1];
51210
51266
  var elementRef = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useRef(null);
51211
51267
  var getUrl = function getUrl(url) {
51212
51268
  var auto = 'autoSSL' in props ? autoSSL : use_image_config.autoSSL;
@@ -51241,6 +51297,35 @@ var useImage = function useImage() {
51241
51297
  };
51242
51298
  img.src = getUrl(alt);
51243
51299
  };
51300
+ var handleCoverStyle = function handleCoverStyle(img) {
51301
+ var container = elementRef === null || elementRef === void 0 ? void 0 : elementRef.current;
51302
+ if (!container) return;
51303
+
51304
+ // 根据容器的宽高获取宽高比
51305
+ var containerWidth = container.clientWidth;
51306
+ var containerHeight = container.clientHeight;
51307
+ var containerRatio = containerWidth / containerHeight;
51308
+
51309
+ // 根据图片的自然尺寸获取宽高比
51310
+ var imageWidth = img.naturalWidth;
51311
+ var imageHeight = img.naturalHeight;
51312
+ var imageRatio = imageWidth / imageHeight;
51313
+
51314
+ // 判断宽高比,决定图片填充策略
51315
+ if (imageRatio > containerRatio) {
51316
+ // 图片更宽,宽度占满容器,高度自适应
51317
+ setImgCoverStyle({
51318
+ height: '100%',
51319
+ width: 'auto'
51320
+ });
51321
+ } else {
51322
+ // 图片更高,填满容器高度
51323
+ setImgCoverStyle({
51324
+ width: '100%',
51325
+ height: 'auto'
51326
+ });
51327
+ }
51328
+ };
51244
51329
  var markToRender = function markToRender() {
51245
51330
  if (!src) {
51246
51331
  handleAlt();
@@ -51248,7 +51333,10 @@ var useImage = function useImage() {
51248
51333
  }
51249
51334
  var img = new window.Image();
51250
51335
  img.onload = function () {
51251
- return setStatus(SRC);
51336
+ setStatus(SRC);
51337
+ if (props.fit === 'fill') {
51338
+ handleCoverStyle(img);
51339
+ }
51252
51340
  };
51253
51341
  img.onerror = function (e) {
51254
51342
  return handleError(SRC, e);
@@ -51277,7 +51365,9 @@ var useImage = function useImage() {
51277
51365
  alt: alt,
51278
51366
  draggable: !noImgDrag
51279
51367
  });
51280
- return objectSpread2_default()({}, mergedEventHandlers);
51368
+ return objectSpread2_default()({
51369
+ style: imgCoverStyle
51370
+ }, mergedEventHandlers);
51281
51371
  };
51282
51372
  var getImageDivProps = function getImageDivProps() {
51283
51373
  var externalProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -52045,7 +52135,8 @@ var Image = function Image(props) {
52045
52135
  href: href,
52046
52136
  lazy: lazy,
52047
52137
  autoSSL: autoSSL,
52048
- noImgDrag: noImgDrag
52138
+ noImgDrag: noImgDrag,
52139
+ fit: fit
52049
52140
  }, rest)),
52050
52141
  status = _useImage.status,
52051
52142
  getRootProps = _useImage.getRootProps,
@@ -52124,7 +52215,7 @@ var Image = function Image(props) {
52124
52215
 
52125
52216
  // 渲染 img / div 类型的内部标签
52126
52217
  var renderInner = function renderInner(src) {
52127
- return fit === 'fill' || fit === 'fit' ? renderDivInnerEl(src) : renderImgeInnerEl(src);
52218
+ return fit === 'fit' ? renderDivInnerEl(src) : renderImgeInnerEl(src);
52128
52219
  };
52129
52220
 
52130
52221
  // 默认占位图
@@ -55661,7 +55752,8 @@ function Select(props0) {
55661
55752
  checkUnMatched: checkUnMatched,
55662
55753
  onRemove: handleRemove,
55663
55754
  classes: styles,
55664
- setInputText: setInputText
55755
+ setInputText: setInputText,
55756
+ morePopoverContainer: targetRef
55665
55757
  })
55666
55758
  });
55667
55759
  return /*#__PURE__*/(0,jsx_runtime.jsx)(PopupProvider, {
@@ -63513,10 +63605,15 @@ var emptyRef = {
63513
63605
  theadAndTfootHeight: context.theadAndTfootHeight
63514
63606
  });
63515
63607
  var syncHeaderScroll = usePersistFn(function (left) {
63516
- var _theadRef$current2;
63608
+ var _tableRef$current;
63517
63609
  if (props.hideHeader || !props.sticky) return;
63518
- if (!(theadRef !== null && theadRef !== void 0 && (_theadRef$current2 = theadRef.current) !== null && _theadRef$current2 !== void 0 && _theadRef$current2.parentElement)) return;
63519
- theadRef.current.parentElement.scrollLeft = left;
63610
+ var headerScrollers = (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.querySelectorAll(".".concat(tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.headWrapper));
63611
+ headerScrollers === null || headerScrollers === void 0 || headerScrollers.forEach(function (item) {
63612
+ if (!item) return;
63613
+ if (item.scrollLeft !== left) {
63614
+ item.scrollLeft = left;
63615
+ }
63616
+ });
63520
63617
  });
63521
63618
 
63522
63619
  // 简单表格的滚动事件
@@ -63658,7 +63755,7 @@ var emptyRef = {
63658
63755
  parent: tableRef === null || tableRef === void 0 ? void 0 : tableRef.current
63659
63756
  };
63660
63757
  var isRenderVirtualTable = virtual || props.sticky || !((_props$data3 = props.data) !== null && _props$data3 !== void 0 && _props$data3.length);
63661
- var headWrapperClass = classnames_default()(tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.headWrapper);
63758
+ var headWrapperClass = classnames_default()(tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.headWrapper, props.sticky && isScrollY && tableClasses.scrollY);
63662
63759
  var footWrapperClass = classnames_default()(tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.footWrapper);
63663
63760
  var renderHeadMirrorScroller = function renderHeadMirrorScroller() {
63664
63761
  var _scrollRef$current, _scrollRef$current2, _scrollRef$current3;
@@ -63707,7 +63804,6 @@ var emptyRef = {
63707
63804
  if (!scrollRefWidth || !mirrorScrollRefWidth || !showScroll) return null;
63708
63805
  var options = props.showBottomScrollbar === true ? {} : props.showBottomScrollbar;
63709
63806
  var scrollerStickyProps = {
63710
- scrollContainer: options.scrollContainer || document.body,
63711
63807
  bottom: options.bottom || 0,
63712
63808
  zIndex: options.zIndex || defaultZIndex + 1,
63713
63809
  parent: tableRef === null || tableRef === void 0 ? void 0 : tableRef.current
@@ -63736,24 +63832,21 @@ var emptyRef = {
63736
63832
  })
63737
63833
  }));
63738
63834
  };
63739
- var $headTable = /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
63740
- style: {
63741
- width: width
63742
- },
63743
- ref: theadRef,
63744
- children: [Group, /*#__PURE__*/(0,jsx_runtime.jsx)(thead, objectSpread2_default()({}, headCommonProps))]
63835
+ var $headTable = /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
63836
+ className: headWrapperClass,
63837
+ children: /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
63838
+ style: {
63839
+ width: width
63840
+ },
63841
+ ref: theadRef,
63842
+ children: [Group, /*#__PURE__*/(0,jsx_runtime.jsx)(thead, objectSpread2_default()({}, headCommonProps))]
63843
+ })
63745
63844
  });
63746
63845
  if (isRenderVirtualTable) {
63747
63846
  var _props$data4;
63748
63847
  return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
63749
63848
  children: [renderHeadMirrorScroller(), !props.hideHeader && props.sticky && /*#__PURE__*/(0,jsx_runtime.jsx)(StickyWrapper, objectSpread2_default()(objectSpread2_default()({}, stickyProps), {}, {
63750
- children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
63751
- className: headWrapperClass,
63752
- style: {
63753
- overflow: 'hidden'
63754
- },
63755
- children: $headTable
63756
- })
63849
+ children: $headTable
63757
63850
  })), /*#__PURE__*/(0,jsx_runtime.jsxs)(scroll_table, {
63758
63851
  style: {
63759
63852
  display: 'flex',
@@ -63768,10 +63861,7 @@ var emptyRef = {
63768
63861
  defaultHeight: context.emptyHeight,
63769
63862
  isScrollY: isScrollY,
63770
63863
  isScrollX: isScrollX,
63771
- children: [!props.hideHeader && !props.sticky && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
63772
- className: headWrapperClass,
63773
- children: $headTable
63774
- }), !!((_props$data4 = props.data) !== null && _props$data4 !== void 0 && _props$data4.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
63864
+ children: [!props.hideHeader && !props.sticky && $headTable, !!((_props$data4 = props.data) !== null && _props$data4 !== void 0 && _props$data4.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
63775
63865
  style: {
63776
63866
  width: width,
63777
63867
  transform: virtualInfo.translateStyle
@@ -63833,10 +63923,10 @@ var emptyRef = {
63833
63923
 
63834
63924
  // handle head and foot scroll
63835
63925
  var handleHeaderWheel = usePersistFn(function (e) {
63836
- var _theadRef$current3;
63926
+ var _theadRef$current2;
63837
63927
  var scrollEl = scrollRef.current;
63838
63928
  if (!scrollEl) return;
63839
- if (!(theadRef !== null && theadRef !== void 0 && (_theadRef$current3 = theadRef.current) !== null && _theadRef$current3 !== void 0 && _theadRef$current3.parentElement)) return;
63929
+ if (!(theadRef !== null && theadRef !== void 0 && (_theadRef$current2 = theadRef.current) !== null && _theadRef$current2 !== void 0 && _theadRef$current2.parentElement)) return;
63840
63930
  var max = scrollEl.scrollWidth - scrollEl.clientWidth;
63841
63931
  var scrollLeft = scrollEl.scrollLeft + e.deltaX;
63842
63932
  if (scrollLeft === scrollEl.scrollLeft) {
@@ -65660,6 +65750,7 @@ var TransferOperate = function TransferOperate(props) {
65660
65750
 
65661
65751
 
65662
65752
 
65753
+
65663
65754
  var Transfer = function Transfer(props) {
65664
65755
  var _jssStyle$transfer;
65665
65756
  var jssStyle = props.jssStyle,
@@ -65734,7 +65825,7 @@ var Transfer = function Transfer(props) {
65734
65825
  sourceSelectedKeys = _useTransfer.sourceSelectedKeys,
65735
65826
  targetSelectedKeys = _useTransfer.targetSelectedKeys,
65736
65827
  onFilter = _useTransfer.onFilter,
65737
- onSelectChange = _useTransfer.onSelectChange;
65828
+ _onSelectChange = _useTransfer.onSelectChange;
65738
65829
  var styles = (jssStyle === null || jssStyle === void 0 || (_jssStyle$transfer = jssStyle.transfer) === null || _jssStyle$transfer === void 0 ? void 0 : _jssStyle$transfer.call(jssStyle)) || {};
65739
65830
  var rootClass = classnames_default()(styles.rootClass, styles.transfer, className, defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()({}, styles.simple, simple), styles.small, size === 'small'), styles.large, size === 'large'), styles.equalPanelWidth, equalPanelWidth));
65740
65831
  var renderOperations = function renderOperations() {
@@ -65808,7 +65899,15 @@ var Transfer = function Transfer(props) {
65808
65899
  searchPlaceholder: placeholder,
65809
65900
  renderFilter: renderFilter,
65810
65901
  onFilter: onFilterProp ? onFilter : undefined,
65811
- onSelectChange: onSelectChange
65902
+ onSelectChange: function onSelectChange(keys) {
65903
+ if (isSource) {
65904
+ var newAllKeys = Array.from(new Set([].concat(toConsumableArray_default()(keys), toConsumableArray_default()(targetSelectedKeys || []))));
65905
+ _onSelectChange(newAllKeys, keys, targetSelectedKeys);
65906
+ } else {
65907
+ var _newAllKeys = Array.from(new Set([].concat(toConsumableArray_default()(keys), toConsumableArray_default()(sourceSelectedKeys || []))));
65908
+ _onSelectChange(_newAllKeys, sourceSelectedKeys, keys);
65909
+ }
65910
+ }
65812
65911
  });
65813
65912
  };
65814
65913
  var renderSourceList = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
@@ -66440,7 +66539,8 @@ var TreeSelect = function TreeSelect(props0) {
66440
66539
  getDataByValues: getResultByValue,
66441
66540
  onRemove: handleRemove,
66442
66541
  classes: styles,
66443
- setInputText: setInputText
66542
+ setInputText: setInputText,
66543
+ morePopoverContainer: targetRef
66444
66544
  })
66445
66545
  });
66446
66546
  return /*#__PURE__*/(0,jsx_runtime.jsx)(PopupProvider, {
@@ -66711,6 +66811,7 @@ function attrAccept(file, acceptedFiles) {
66711
66811
 
66712
66812
 
66713
66813
 
66814
+
66714
66815
  var VALIDATORITEMS = [{
66715
66816
  key: 'size',
66716
66817
  param: function param(blob) {
@@ -66744,11 +66845,12 @@ var promised = function promised(action) {
66744
66845
  resolve(true);
66745
66846
  });
66746
66847
  };
66848
+ var defaultValue = [];
66747
66849
  var useUpload = function useUpload(props) {
66748
66850
  var _props$limit = props.limit,
66749
66851
  limit = _props$limit === void 0 ? 100 : _props$limit,
66750
66852
  _props$value = props.value,
66751
- value = _props$value === void 0 ? [] : _props$value;
66853
+ value = _props$value === void 0 ? defaultValue : _props$value;
66752
66854
  var accept = props.forceAccept || props.accept;
66753
66855
  var forceAccept = !!props.forceAccept;
66754
66856
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({}),
@@ -66868,21 +66970,22 @@ var useUpload = function useUpload(props) {
66868
66970
  responseType: props.responseType,
66869
66971
  onStart: props.onStart,
66870
66972
  onProgress: function onProgress(e, msg) {
66871
- if (throttle) return;
66973
+ var percent = typeof e.percent === 'number' ? e.percent : e.loaded / e.total * 100;
66974
+ if (throttle && percent !== 100) return;
66872
66975
  throttle = true;
66873
66976
  setTimeout(function () {
66874
66977
  throttle = false;
66875
66978
  }, 16);
66876
- var percent = typeof e.percent === 'number' ? e.percent : e.loaded / e.total * 100;
66877
- var filesState = latestState.filesState;
66878
- var newFiles = objectSpread2_default()({}, filesState);
66879
- if (!newFiles[id]) return;
66880
- newFiles[id].process = percent;
66881
- if (msg) newFiles[id].message = msg;
66882
- setFiles(newFiles);
66883
- if (typeof props.onProgress === 'function') {
66884
- props.onProgress(newFiles[id]);
66885
- }
66979
+ setFiles(function (files) {
66980
+ return utils_immer_produce(files, function (draft) {
66981
+ if (!draft[id]) return draft;
66982
+ draft[id].process = percent;
66983
+ if (msg) draft[id].message = msg;
66984
+ if (typeof props.onProgress === 'function') {
66985
+ props.onProgress(draft[id]);
66986
+ }
66987
+ });
66988
+ });
66886
66989
  },
66887
66990
  onLoad: function onLoad(xhr) {
66888
66991
  if (!/^2|1223/.test("".concat(xhr.status))) {
@@ -66910,11 +67013,17 @@ var useUpload = function useUpload(props) {
66910
67013
  delete draft[id];
66911
67014
  });
66912
67015
  });
66913
- // add value
66914
- var values = utils_immer_produce(latestState.value, function (draft) {
66915
- draft.push(result);
66916
- });
66917
- props.onChange(values);
67016
+ if (props.functionalOnChange) {
67017
+ // 回调型 setState不会丢值
67018
+ props.onChange(function (prev) {
67019
+ return [].concat(toConsumableArray_default()(prev || []), [result]);
67020
+ });
67021
+ } else {
67022
+ var latestValue = latestState.value;
67023
+ var newValue = toConsumableArray_default()(latestValue);
67024
+ newValue.push(result);
67025
+ props.onChange(newValue);
67026
+ }
66918
67027
  }
66919
67028
  },
66920
67029
  onError: function onError(xhr) {
@@ -67032,48 +67141,60 @@ var useUpload = function useUpload(props) {
67032
67141
  error = _context2.sent;
67033
67142
  case 21:
67034
67143
  if (!(error instanceof Error)) {
67035
- _context2.next = 30;
67144
+ _context2.next = 29;
67036
67145
  break;
67037
67146
  }
67038
67147
  if (validatorHandle(error, blob)) {
67039
- _context2.next = 26;
67148
+ _context2.next = 25;
67040
67149
  break;
67041
67150
  }
67042
- delete newFiles[id];
67043
- setFiles(objectSpread2_default()({}, newFiles));
67151
+ setFiles(function (prev) {
67152
+ return utils_immer_produce(prev, function (draft) {
67153
+ delete draft[id];
67154
+ });
67155
+ });
67044
67156
  return _context2.abrupt("return", 0);
67045
- case 26:
67157
+ case 25:
67046
67158
  fileRecord.message = error.message;
67047
67159
  fileRecord.status = 3;
67048
- setFiles(objectSpread2_default()({}, newFiles));
67160
+ setFiles(function (prev) {
67161
+ return objectSpread2_default()(objectSpread2_default()({}, prev), {}, defineProperty_default()({}, id, fileRecord));
67162
+ });
67049
67163
  return _context2.abrupt("return", 0);
67050
- case 30:
67164
+ case 29:
67051
67165
  if (!props.beforeUpload) {
67052
- _context2.next = 37;
67166
+ _context2.next = 36;
67053
67167
  break;
67054
67168
  }
67055
67169
  beforeUploadResult = props.beforeUpload(blob); // @ts-ignoreq
67056
67170
  if (!(beforeUploadResult && beforeUploadResult.then)) {
67057
- _context2.next = 35;
67171
+ _context2.next = 34;
67058
67172
  break;
67059
67173
  }
67060
67174
  props.beforeUpload(blob).then(function (args) {
67061
67175
  if (args.status !== 'error') {
67062
67176
  newFiles[id].xhr = uploadFile(id, blob, fileRecord.src);
67063
- setFiles(objectSpread2_default()({}, newFiles));
67177
+ setFiles(function (prev) {
67178
+ return objectSpread2_default()(objectSpread2_default()({}, prev), {}, defineProperty_default()({}, id, fileRecord));
67179
+ });
67064
67180
  }
67065
67181
  }).catch(function () {
67066
- delete newFiles[id];
67067
- setFiles(objectSpread2_default()({}, newFiles));
67182
+ setFiles(function (prev) {
67183
+ return utils_immer_produce(prev, function (draft) {
67184
+ delete draft[id];
67185
+ });
67186
+ });
67068
67187
  });
67069
67188
  return _context2.abrupt("return", 0);
67070
- case 35:
67071
- _context2.next = 39;
67189
+ case 34:
67190
+ _context2.next = 38;
67072
67191
  break;
67073
- case 37:
67192
+ case 36:
67074
67193
  fileRecord.xhr = uploadFile(id, blob, fileRecord.src);
67075
- setFiles(objectSpread2_default()({}, newFiles));
67076
- case 39:
67194
+ setFiles(function (prev) {
67195
+ return objectSpread2_default()(objectSpread2_default()({}, prev), {}, defineProperty_default()({}, id, fileRecord));
67196
+ });
67197
+ case 38:
67077
67198
  case "end":
67078
67199
  return _context2.stop();
67079
67200
  }
@@ -67471,7 +67592,8 @@ var Upload = function Upload(props0) {
67471
67592
  invalidImage: getLocale(locale, 'invalidImage')
67472
67593
  },
67473
67594
  value: value,
67474
- onChange: onChange
67595
+ onChange: onChange,
67596
+ functionalOnChange: props.functionalOnChange
67475
67597
  })),
67476
67598
  func = _useUpload.func,
67477
67599
  files = _useUpload.files,
@@ -70255,7 +70377,7 @@ var upload_interface = __webpack_require__(8821);
70255
70377
 
70256
70378
 
70257
70379
  /* harmony default export */ var src_0 = ({
70258
- version: '3.7.0-beta.12'
70380
+ version: '3.7.0-beta.13'
70259
70381
  });
70260
70382
  }();
70261
70383
  /******/ return __webpack_exports__;