shineout 3.4.4-beta.6 → 3.5.0-beta.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/cjs/index.js CHANGED
@@ -492,5 +492,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
492
492
  // 此文件由脚本自动生成,请勿直接修改。
493
493
  // This file was generated automatically by a script. Please do not modify it directly.
494
494
  var _default = exports.default = {
495
- version: '3.4.4-beta.6'
495
+ version: '3.5.0-beta.1'
496
496
  };
package/dist/shineout.js CHANGED
@@ -11984,7 +11984,7 @@ var handleStyle = function handleStyle(style) {
11984
11984
  };
11985
11985
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
11986
11986
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
11987
- /* harmony default export */ var version = ('3.4.4-beta.6');
11987
+ /* harmony default export */ var version = ('3.5.0-beta.1');
11988
11988
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
11989
11989
 
11990
11990
 
@@ -26226,71 +26226,8 @@ var textarea_input = objectSpread2_default()(objectSpread2_default()(objectSprea
26226
26226
  resize: 'vertical'
26227
26227
  },
26228
26228
  info: {
26229
- position: 'absolute',
26230
- zIndex: 1000,
26231
- '&[dir=ltr]': {
26232
- right: '0'
26233
- },
26234
- '&[dir=rtl]': {
26235
- left: '0'
26236
- },
26237
- '&$bottomLeft': {
26238
- right: 'auto'
26239
- },
26240
- '&$bottomRight': {
26241
- left: 'auto'
26242
- },
26243
- top: '100%',
26244
- transformOrigin: '100% 0',
26245
- marginTop: '10px',
26246
- animation: 'so-input-fade .16s ease-in',
26247
- maxWidth: '400px',
26248
- padding: '5px 8px',
26249
26229
  background: src.textareaInfoBackgroundColor,
26250
- borderRadius: src.textareaBorderRadius,
26251
- boxShadow: "0 0 0 1px ".concat(src.textareaBorderColor),
26252
- fontSize: '12px',
26253
- color: src.textareaInfoFontColor,
26254
- '&::before': {
26255
- display: 'block',
26256
- position: 'absolute',
26257
- bottom: '100%',
26258
- transform: 'rotate(45deg) translateY(3px)',
26259
- width: '6px',
26260
- height: '6px',
26261
- borderTop: "1px solid ".concat(src.textareaBorderColor),
26262
- borderLeft: "1px solid ".concat(src.textareaBorderColor),
26263
- background: 'inherit',
26264
- content: "' '"
26265
- },
26266
- '&[dir=ltr]::before': {
26267
- right: '4px'
26268
- },
26269
- '&[dir=rtl]::before': {
26270
- left: '8px'
26271
- },
26272
- '&$bottomLeft::before': {
26273
- left: '8px',
26274
- right: 'auto'
26275
- },
26276
- '&$bottomRight::before': {
26277
- right: '4px',
26278
- left: 'auto'
26279
- }
26280
- },
26281
- bottomLeft: {
26282
- left: 0
26283
- },
26284
- bottomRight: {
26285
- right: 0
26286
- },
26287
- infoError: {
26288
- boxShadow: "0 0 0 1px ".concat(src.textareaInfoErrorBorderColor),
26289
- color: src.textareaInfoErrorFontColor,
26290
- background: src.textareaInfoErrorBackgroundColor,
26291
- '&::before': {
26292
- borderColor: src.textareaInfoErrorBorderColor
26293
- }
26230
+ color: src.textareaInfoFontColor
26294
26231
  },
26295
26232
  shadow: {
26296
26233
  position: 'absolute',
@@ -30134,22 +30071,23 @@ var getPopoverPosition = function getPopoverPosition(target) {
30134
30071
  var popupRect = popup === null || popup === void 0 ? void 0 : popup.getBoundingClientRect();
30135
30072
  if (verticalPoint > windowHeight / 2) position = 'top';else position = 'bottom';
30136
30073
 
30074
+ // TODO: 暂时移除,另考虑方案
30137
30075
  // 如果渲染了弹出内容,则根据弹出内容宽度计算是否自动调整位置
30138
- if (popupRect) {
30139
- if ((popupRect === null || popupRect === void 0 ? void 0 : popupRect.width) / 2 > rect.left) {
30140
- position += '-left';
30141
- }
30142
- if ((popupRect === null || popupRect === void 0 ? void 0 : popupRect.width) / 2 > windowWidth - rect.right) {
30143
- position += '-right';
30144
- }
30145
- } else {
30146
- // 兜底计算
30147
- if (horizontalPoint > windowWidth * 0.6) {
30148
- position += '-right';
30149
- } else if (horizontalPoint < windowWidth * 0.4) {
30150
- position += '-left';
30151
- }
30076
+ // if (popupRect && popupRect?.width) {
30077
+ // if (popupRect?.width / 2 > rect.left) {
30078
+ // position += '-left';
30079
+ // }
30080
+ // if (popupRect?.width / 2 > windowWidth - rect.right) {
30081
+ // position += '-right';
30082
+ // }
30083
+ // } else {
30084
+ // 兜底计算
30085
+ if (horizontalPoint > windowWidth * 0.6) {
30086
+ position += '-right';
30087
+ } else if (horizontalPoint < windowWidth * 0.4) {
30088
+ position += '-left';
30152
30089
  }
30090
+ // }
30153
30091
  }
30154
30092
  return position;
30155
30093
  };
@@ -33797,6 +33735,9 @@ var useTip = function useTip(props) {
33797
33735
  jssStyle = props.jssStyle;
33798
33736
  var config = useConfig();
33799
33737
  var dfp = config.direction === 'rtl' ? 'bottom-right' : 'bottom-left';
33738
+ if (typeof popover === 'string') {
33739
+ dfp = popover;
33740
+ }
33800
33741
  var styles = popoverProps !== null && popoverProps !== void 0 && popoverProps.style && popoverProps !== null && popoverProps !== void 0 && (_popoverProps$style = popoverProps.style) !== null && _popoverProps$style !== void 0 && _popoverProps$style.width ? popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.style : Object.assign({
33801
33742
  minWidth: 200,
33802
33743
  maxWidth: 400
@@ -39473,8 +39414,18 @@ var useListSelectMultiple = function useListSelectMultiple(props) {
39473
39414
 
39474
39415
 
39475
39416
 
39417
+ var defaultFormat = function defaultFormat(d) {
39418
+ return d;
39419
+ };
39420
+ var defaultRenderItem = function defaultRenderItem(d) {
39421
+ return d;
39422
+ };
39476
39423
  var checkbox_group_Group = function Group(props0) {
39477
39424
  var _jssStyle$checkbox;
39425
+ var _props0$format = props0.format,
39426
+ format = _props0$format === void 0 ? defaultFormat : _props0$format,
39427
+ _props0$renderItem = props0.renderItem,
39428
+ renderItem = _props0$renderItem === void 0 ? defaultRenderItem : _props0$renderItem;
39478
39429
  var props = use_with_form_config(props0);
39479
39430
  var children = props.children,
39480
39431
  className = props.className,
@@ -39498,7 +39449,7 @@ var checkbox_group_Group = function Group(props0) {
39498
39449
  prediction: props.prediction,
39499
39450
  separator: props.separator,
39500
39451
  disabled: disabled,
39501
- format: props.format,
39452
+ format: format,
39502
39453
  keygen: props.keygen,
39503
39454
  data: props.data || []
39504
39455
  };
@@ -39518,7 +39469,6 @@ var checkbox_group_Group = function Group(props0) {
39518
39469
  return datum.check(d);
39519
39470
  });
39520
39471
  var getContent = function getContent(d, index) {
39521
- var renderItem = props.renderItem;
39522
39472
  if (typeof renderItem === 'string' && d) {
39523
39473
  return d[renderItem];
39524
39474
  }
@@ -39565,14 +39515,6 @@ var checkbox_group_Group = function Group(props0) {
39565
39515
  });
39566
39516
  }
39567
39517
  };
39568
- checkbox_group_Group.defaultProps = {
39569
- format: function format(d) {
39570
- return d;
39571
- },
39572
- renderItem: function renderItem(d) {
39573
- return d;
39574
- }
39575
- };
39576
39518
  /* harmony default export */ var checkbox_group = (checkbox_group_Group);
39577
39519
  ;// CONCATENATED MODULE: ./src/checkbox/group.tsx
39578
39520
 
@@ -45309,7 +45251,7 @@ var textarea_defaultInfo = function defaultInfo(num, msg) {
45309
45251
  return new Error(text);
45310
45252
  };
45311
45253
  var textarea_Textarea = function Textarea(props0) {
45312
- var _jssStyle$textarea, _ref, _ref2;
45254
+ var _jssStyle$textarea, _ref, _ref2, _infoState$error;
45313
45255
  var props = use_with_form_config(props0);
45314
45256
  var info = props.info,
45315
45257
  suffix = props.suffix,
@@ -45400,36 +45342,48 @@ var textarea_Textarea = function Textarea(props0) {
45400
45342
 
45401
45343
  // forwardProps
45402
45344
  var forwardProps = removeProps(resetProps, objectSpread2_default()(objectSpread2_default()(objectSpread2_default()(objectSpread2_default()(objectSpread2_default()({}, inputAbleParams), autosizeParams), tipProps), formatParams), innerTitleProps));
45403
- var getInfo = function getInfo() {
45345
+ var getInfoState = function getInfoState() {
45404
45346
  var notNumber = typeof info !== 'number';
45405
45347
  if (typeof info !== 'function' && typeof_default()(info) !== 'object' && notNumber) return null;
45406
45348
  var infoContent;
45407
- var infoPosition;
45408
45349
  if (typeof_default()(info) === 'object') {
45409
45350
  infoContent = info.content;
45410
- infoPosition = info.position;
45411
45351
  } else {
45412
45352
  infoContent = info;
45413
45353
  }
45414
45354
  var notContentNumber = typeof infoContent !== 'number';
45415
45355
  var textInfo = notContentNumber ? infoContent : textarea_defaultInfo.bind(null, infoContent);
45416
- var res = textInfo(inputAbleProps.value);
45417
- // empty
45418
- if (!res) return null;
45419
- var isError = res instanceof Error;
45420
- var text = isError ? res.message : res;
45356
+ var error = textInfo(inputAbleProps.value);
45357
+ if (!error) return null;
45358
+ var isError = error instanceof Error;
45359
+ var text = isError ? error.message : error;
45421
45360
  if (!isError && !focused) return null;
45422
- return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
45361
+ return {
45362
+ text: text,
45363
+ error: error
45364
+ };
45365
+ };
45366
+ var infoState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(getInfoState, [info, inputAbleProps.value, focused]);
45367
+ var infoPopoverProps = {
45368
+ popover: resetProps.popover || (typeof_default()(info) === 'object' ? info.position : 'bottom-right'),
45369
+ popoverProps: Object.assign({
45423
45370
  style: {
45424
- minWidth: 'auto'
45425
- },
45426
- dir: config.direction,
45427
- className: classnames_default()(textareaClasses === null || textareaClasses === void 0 ? void 0 : textareaClasses.info, !!isError && (textareaClasses === null || textareaClasses === void 0 ? void 0 : textareaClasses.infoError), infoPosition === 'bottom-left' && (textareaClasses === null || textareaClasses === void 0 ? void 0 : textareaClasses.bottomLeft), infoPosition === 'bottom-right' && (textareaClasses === null || textareaClasses === void 0 ? void 0 : textareaClasses.bottomRight)),
45428
- children: text
45429
- }, 'info');
45371
+ width: 'auto'
45372
+ }
45373
+ }, resetProps.popoverProps),
45374
+ error: infoState !== null && infoState !== void 0 && infoState.error && (infoState === null || infoState === void 0 ? void 0 : infoState.error) instanceof Error ? infoState === null || infoState === void 0 || (_infoState$error = infoState.error) === null || _infoState$error === void 0 ? void 0 : _infoState$error.message : undefined,
45375
+ tip: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
45376
+ className: textareaClasses === null || textareaClasses === void 0 ? void 0 : textareaClasses.info,
45377
+ children: infoState === null || infoState === void 0 ? void 0 : infoState.text
45378
+ })
45430
45379
  };
45380
+ var infoPopoverNode = use_tip(objectSpread2_default()(objectSpread2_default()({}, infoPopoverProps), {}, {
45381
+ focused: focused,
45382
+ rootRef: rootRef,
45383
+ jssStyle: jssStyle
45384
+ }));
45431
45385
  var mergeSuffix = /*#__PURE__*/(0,jsx_runtime.jsxs)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
45432
- children: [suffix, getInfo(), tipNode, isFunc(renderFooter) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
45386
+ children: [suffix, tipNode, (infoState === null || infoState === void 0 ? void 0 : infoState.text) && infoPopoverNode, isFunc(renderFooter) && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
45433
45387
  onMouseDown: function onMouseDown(e) {
45434
45388
  e.preventDefault();
45435
45389
  },
@@ -54583,8 +54537,18 @@ var useListSelectSingle = function useListSelectSingle(props) {
54583
54537
 
54584
54538
 
54585
54539
 
54540
+ var radio_group_defaultFormat = function defaultFormat(d) {
54541
+ return d;
54542
+ };
54543
+ var radio_group_defaultRenderItem = function defaultRenderItem(d) {
54544
+ return d;
54545
+ };
54586
54546
  var radio_group_Group = function Group(props0) {
54587
54547
  var _jssStyle$radio;
54548
+ var _props0$format = props0.format,
54549
+ format = _props0$format === void 0 ? radio_group_defaultFormat : _props0$format,
54550
+ _props0$renderItem = props0.renderItem,
54551
+ renderItem = _props0$renderItem === void 0 ? radio_group_defaultRenderItem : _props0$renderItem;
54588
54552
  var props = use_with_form_config(props0);
54589
54553
  var children = props.children,
54590
54554
  className = props.className,
@@ -54608,7 +54572,7 @@ var radio_group_Group = function Group(props0) {
54608
54572
  onChange: inputAbleProps.onChange,
54609
54573
  prediction: props.prediction,
54610
54574
  disabled: disabled,
54611
- format: props.format,
54575
+ format: format,
54612
54576
  keygen: props.keygen,
54613
54577
  data: props.data || []
54614
54578
  };
@@ -54623,7 +54587,6 @@ var radio_group_Group = function Group(props0) {
54623
54587
  return datum.check(d);
54624
54588
  });
54625
54589
  var getContent = function getContent(d, index) {
54626
- var renderItem = props.renderItem;
54627
54590
  if (typeof renderItem === 'string') {
54628
54591
  return d[renderItem];
54629
54592
  }
@@ -54698,14 +54661,6 @@ var radio_group_Group = function Group(props0) {
54698
54661
  children: Radios
54699
54662
  });
54700
54663
  };
54701
- radio_group_Group.defaultProps = {
54702
- format: function format(d) {
54703
- return d;
54704
- },
54705
- renderItem: function renderItem(d) {
54706
- return d;
54707
- }
54708
- };
54709
54664
  /* harmony default export */ var radio_group = (radio_group_Group);
54710
54665
  ;// CONCATENATED MODULE: ./src/radio/group.tsx
54711
54666
 
@@ -57306,6 +57261,33 @@ var useTableVirtual = function useTableVirtual(props) {
57306
57261
  props.scrollRef.current.scrollTop = beforeHeight;
57307
57262
  }
57308
57263
  });
57264
+ var scrollColumnByLeft = usePersistFn(function (targetLeft) {
57265
+ if (targetLeft < 0) return;
57266
+ var scrollEl = props.scrollRef.current;
57267
+ if (!scrollEl) return;
57268
+ // scrollLeft max
57269
+ var max = scrollEl.scrollWidth - scrollEl.clientWidth;
57270
+ var left = Math.min(targetLeft, max);
57271
+ if (left === scrollEl.scrollLeft) return;
57272
+ setLeft(left);
57273
+ scrollEl.scrollLeft = left;
57274
+ });
57275
+ var scrollColumnIntoView = usePersistFn(function (colKey) {
57276
+ if (colKey === undefined) return;
57277
+ var col = props.columns.find(function (col) {
57278
+ return col.key === colKey;
57279
+ });
57280
+ if (!col || col.fixed) return;
57281
+ var left = 0;
57282
+ for (var i = 0, len = col.index; i < len; i++) {
57283
+ if (props.columns[i].fixed) {
57284
+ left = 0;
57285
+ } else {
57286
+ left += props.colgroup[i];
57287
+ }
57288
+ }
57289
+ scrollColumnByLeft(left);
57290
+ });
57309
57291
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
57310
57292
  var scrollRefHeight = props.scrollRef.current ? props.scrollRef.current.clientHeight : 0;
57311
57293
  var tableRefHeight = props.innerRef.current ? props.innerRef.current.clientHeight : 0;
@@ -57369,7 +57351,9 @@ var useTableVirtual = function useTableVirtual(props) {
57369
57351
  handleScroll: handleScroll,
57370
57352
  setRowHeight: setRowHeight,
57371
57353
  getTranslate: getTranslate,
57372
- scrollToIndex: scrollToIndex
57354
+ scrollToIndex: scrollToIndex,
57355
+ scrollColumnByLeft: scrollColumnByLeft,
57356
+ scrollColumnIntoView: scrollColumnIntoView
57373
57357
  };
57374
57358
  };
57375
57359
  /* harmony default export */ var use_table_virtual = (useTableVirtual);
@@ -58767,6 +58751,7 @@ var emptyRef = {
58767
58751
  disabled: !virtual,
58768
58752
  data: treeData,
58769
58753
  columns: columns,
58754
+ colgroup: colgroup,
58770
58755
  rowsInView: props.rowsInView || 20,
58771
58756
  rowHeight: props.rowHeight || 40,
58772
58757
  scrollRef: scrollRef,
@@ -59058,7 +59043,9 @@ var emptyRef = {
59058
59043
  };
59059
59044
  var tableFunc = useLatestObj({
59060
59045
  scrollToIndex: virtualInfo.scrollToIndex,
59061
- getRenderIndexByData: getRenderIndexByData
59046
+ getRenderIndexByData: getRenderIndexByData,
59047
+ scrollColumnIntoView: virtualInfo.scrollColumnIntoView,
59048
+ scrollColumnByLeft: virtualInfo.scrollColumnByLeft
59062
59049
  });
59063
59050
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
59064
59051
  if (props.tableRef) {
@@ -65280,7 +65267,7 @@ var upload_interface = __webpack_require__(8821);
65280
65267
 
65281
65268
 
65282
65269
  /* harmony default export */ var src_0 = ({
65283
- version: '3.4.4-beta.6'
65270
+ version: '3.5.0-beta.1'
65284
65271
  });
65285
65272
  }();
65286
65273
  /******/ return __webpack_exports__;