shineout 3.3.0-beta.11 → 3.3.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.
@@ -1,8 +1,9 @@
1
1
  import { ModalProps } from '../modal/modal.type';
2
+ import { type } from '../utils';
2
3
  /**
3
4
  * @title Drawer
4
5
  */
5
- export interface DrawerProps extends Omit<ModalProps, 'moveable'> {
6
+ interface DrawerPropsOrgin extends Omit<ModalProps, 'moveable'> {
6
7
  /** *
7
8
  * @en 弹出位置
8
9
  * @cn Pop-up position
@@ -22,3 +23,5 @@ export interface DrawerProps extends Omit<ModalProps, 'moveable'> {
22
23
  */
23
24
  height?: number | string;
24
25
  }
26
+ export type DrawerProps = type.RequireAWithB<DrawerPropsOrgin, 'type', 'title'>;
27
+ export {};
package/cjs/index.js CHANGED
@@ -476,5 +476,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
476
476
  // 此文件由脚本自动生成,请勿直接修改。
477
477
  // This file was generated automatically by a script. Please do not modify it directly.
478
478
  var _default = exports.default = {
479
- version: '3.3.0-beta.11'
479
+ version: '3.3.0-beta.13'
480
480
  };
@@ -17,8 +17,9 @@ import normalizeWheel from './dom/normalizeWheel';
17
17
  import * as position from './dom/popover';
18
18
  import ready from './dom/ready';
19
19
  import isJson from './validate/isJson';
20
+ import * as type from './type';
20
21
  import accept from './accept';
21
22
  declare const validate: () => void;
22
23
  declare const cssAccessors: {};
23
24
  declare const cssInject: {};
24
- export { classname, clone, color, flat, func, hash, is, number, objects, shallowEqual, string, tree, detect, doc, element, normalizeWheel, position, ready, isJson, validate, cssAccessors, cssInject, accept, };
25
+ export { classname, clone, color, flat, func, hash, is, number, objects, shallowEqual, string, tree, detect, doc, element, normalizeWheel, position, ready, isJson, validate, cssAccessors, cssInject, type, accept, };
@@ -49,7 +49,7 @@ Object.defineProperty(exports, "shallowEqual", {
49
49
  return _shallowEqual.default;
50
50
  }
51
51
  });
52
- exports.validate = exports.tree = exports.string = void 0;
52
+ exports.validate = exports.type = exports.tree = exports.string = void 0;
53
53
  var _classname = _interopRequireDefault(require("./classname"));
54
54
  var clone = _interopRequireWildcard(require("./clone"));
55
55
  exports.clone = clone;
@@ -82,6 +82,8 @@ var position = _interopRequireWildcard(require("./dom/popover"));
82
82
  exports.position = position;
83
83
  var _ready = _interopRequireDefault(require("./dom/ready"));
84
84
  var _isJson = _interopRequireDefault(require("./validate/isJson"));
85
+ var type = _interopRequireWildcard(require("./type"));
86
+ exports.type = type;
85
87
  var _accept = _interopRequireDefault(require("./accept"));
86
88
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
87
89
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -0,0 +1,3 @@
1
+ export type RequireAWithB<T, A extends keyof T, B extends keyof T> = (Omit<T, A> & {
2
+ [K in A]?: never;
3
+ }) | (T & Required<Pick<T, B>>) | (T & Required<Pick<T, A | B>>);
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/dist/shineout.js CHANGED
@@ -338,6 +338,13 @@ return /******/ (function() { // webpackBootstrap
338
338
 
339
339
 
340
340
 
341
+ /***/ }),
342
+
343
+ /***/ 514:
344
+ /***/ (function() {
345
+
346
+
347
+
341
348
  /***/ }),
342
349
 
343
350
  /***/ 4689:
@@ -6568,6 +6575,7 @@ __webpack_require__.d(src_utils_namespaceObject, {
6568
6575
  shallowEqual: function() { return utils_shallowEqual; },
6569
6576
  string: function() { return strings_namespaceObject; },
6570
6577
  tree: function() { return src_utils_tree_namespaceObject; },
6578
+ type: function() { return type; },
6571
6579
  validate: function() { return src_utils_validate; }
6572
6580
  });
6573
6581
 
@@ -11960,7 +11968,7 @@ var handleStyle = function handleStyle(style) {
11960
11968
  };
11961
11969
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
11962
11970
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
11963
- /* harmony default export */ var version = ('3.3.0-beta.11');
11971
+ /* harmony default export */ var version = ('3.3.0-beta.13');
11964
11972
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
11965
11973
 
11966
11974
 
@@ -20668,10 +20676,6 @@ var modalStyle = objectSpread2_default()(objectSpread2_default()({}, animationSt
20668
20676
  display: 'flex',
20669
20677
  marginBottom: src.modalPanelGap
20670
20678
  },
20671
- headerEmptyTitle: {
20672
- marginBottom: 0,
20673
- height: 0
20674
- },
20675
20679
  headerIcon: {
20676
20680
  '$wrapper &': {
20677
20681
  marginRight: src.modalHeaderIconMarginEnd,
@@ -20683,6 +20687,9 @@ var modalStyle = objectSpread2_default()(objectSpread2_default()({}, animationSt
20683
20687
  alignItems: 'center'
20684
20688
  }
20685
20689
  },
20690
+ emptyIcon: {
20691
+ position: 'absolute'
20692
+ },
20686
20693
  headerTitle: {
20687
20694
  flex: '1',
20688
20695
  minWidth: 0,
@@ -20717,6 +20724,16 @@ var modalStyle = objectSpread2_default()(objectSpread2_default()({}, animationSt
20717
20724
  })
20718
20725
  }
20719
20726
  },
20727
+ emptyClose: {
20728
+ position: 'absolute',
20729
+ top: 12,
20730
+ right: 12,
20731
+ marginTop: 0,
20732
+ '$wrapperDrawer &': {
20733
+ top: 4,
20734
+ right: 4
20735
+ }
20736
+ },
20720
20737
  body: {
20721
20738
  flex: '1 1 auto',
20722
20739
  minHeight: '1px',
@@ -28140,6 +28157,15 @@ var isFirefox = function isFirefox() {
28140
28157
  if (!is_isBrowser()) return false;
28141
28158
  return navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
28142
28159
  };
28160
+ var isChromeLowerThan = function isChromeLowerThan(version) {
28161
+ // 服务器端渲染时,不执行版本检查
28162
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
28163
+ return false;
28164
+ }
28165
+ var ua = navigator.userAgent;
28166
+ var chrome = ua.match(/chrome\/(\d+)/i);
28167
+ return Boolean(chrome && chrome[1] && parseInt(chrome[1], 10) < version);
28168
+ };
28143
28169
  function isDomElement(element) {
28144
28170
  return (typeof HTMLElement === "undefined" ? "undefined" : typeof_default()(HTMLElement)) === 'object' ? element instanceof HTMLElement // DOM2
28145
28171
  : element && typeof_default()(element) === 'object' && element !== null && element.nodeType === 1 && typeof element.nodeName === 'string';
@@ -43270,24 +43296,34 @@ var Modal = function Modal(props) {
43270
43296
  }, []);
43271
43297
 
43272
43298
  // render
43273
-
43274
- var renderIcon = function renderIcon() {
43299
+ var renderIcon = function renderIcon(isEmptyTitle) {
43300
+ var iconRoot = classnames_default()(modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.headerIcon, isEmptyTitle && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.emptyIcon));
43275
43301
  return /*#__PURE__*/(0,jsx_runtime.jsx)(alert_icon, {
43276
43302
  jssStyle: props.jssStyle,
43277
43303
  type: props.type,
43278
- className: modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.headerIcon
43304
+ className: iconRoot
43279
43305
  });
43280
43306
  };
43281
43307
  var renderHeader = function renderHeader() {
43282
- var showCloseIcon = maskCloseAble === null || !!maskCloseAble;
43308
+ var showCloseIcon = (maskCloseAble === null || !!maskCloseAble) && !props.hideClose;
43283
43309
  var isEmptyTitle = !props.title && props.title !== 0;
43310
+ if (isEmptyTitle) {
43311
+ var closeRoot = classnames_default()(modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.headerClose, modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.emptyClose);
43312
+ return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
43313
+ children: [renderIcon(isEmptyTitle), showCloseIcon && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
43314
+ className: closeRoot,
43315
+ onClick: handleClose,
43316
+ children: icons_config.modal.Close
43317
+ })]
43318
+ });
43319
+ }
43284
43320
  return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
43285
- className: classnames_default()(modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.header, isEmptyTitle && (modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.headerEmptyTitle)),
43321
+ className: modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.header,
43286
43322
  onMouseDown: props.moveable ? moveInfo.handleMouseDown : undefined,
43287
43323
  children: [renderIcon(), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
43288
43324
  className: modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.headerTitle,
43289
43325
  children: props.title
43290
- }), showCloseIcon && !props.hideClose && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
43326
+ }), showCloseIcon && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
43291
43327
  className: modalClasses === null || modalClasses === void 0 ? void 0 : modalClasses.headerClose,
43292
43328
  onClick: handleClose,
43293
43329
  children: icons_config.modal.Close
@@ -47793,7 +47829,8 @@ var Scroll = function Scroll(props) {
47793
47829
  var containerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
47794
47830
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
47795
47831
  timer: null,
47796
- isMouseDown: false
47832
+ isMouseDown: false,
47833
+ lastPaddingTop: 0
47797
47834
  }),
47798
47835
  context = _useRef.current;
47799
47836
  var _props$scrollHeight = props.scrollHeight,
@@ -47822,10 +47859,17 @@ var Scroll = function Scroll(props) {
47822
47859
  overflow: 'hidden',
47823
47860
  position: 'sticky'
47824
47861
  }, isRtl ? 'right' : 'left', 0), "top", 0);
47862
+ var pd = context.lastPaddingTop;
47863
+ if (height > 0 && scrollHeight > 0) {
47864
+ pd = Math.max(0, Math.floor(scrollHeight - height));
47865
+ context.lastPaddingTop = pd;
47866
+ }
47825
47867
  var placeStyle = {
47826
- paddingTop: height > 0 && scrollHeight > 0 ? Math.max(0, Math.floor(scrollHeight - height)) : 0,
47868
+ paddingTop: pd,
47827
47869
  width: scrollWidth,
47828
- overflow: 'hidden',
47870
+ overflow: props.isScrollY ? 'hidden' : 'auto hidden',
47871
+ height: props.isScrollY ? 0 : 1,
47872
+ marginTop: props.isScrollY ? 0 : -1,
47829
47873
  lineHeight: 0
47830
47874
  };
47831
47875
  var handleScroll = usePersistFn(function (e) {
@@ -55086,6 +55130,10 @@ var useTableLayout = function useTableLayout(props) {
55086
55130
  });
55087
55131
  };
55088
55132
  var changeColGroup = function changeColGroup(cols, adjust) {
55133
+ // 修改`Table`被display:none时,表格头样式错乱的问题
55134
+ if (cols && cols.every(function (v) {
55135
+ return v === 0;
55136
+ })) return;
55089
55137
  setColgroup(cols);
55090
55138
  setAdjust(adjust);
55091
55139
  if (!adjust) {
@@ -55269,16 +55317,17 @@ var useTableLayout = function useTableLayout(props) {
55269
55317
  (_cancelFunc = cancelFunc) === null || _cancelFunc === void 0 || _cancelFunc();
55270
55318
  };
55271
55319
  }, [scrollRef.current]);
55272
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
55320
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
55273
55321
  if (adjust) {
55274
55322
  getColgroup(adjust === 'drag');
55275
55323
  setAdjust(false);
55276
55324
  } else {
55277
55325
  checkFloat();
55278
- checkScroll();
55326
+ // checkScroll();
55279
55327
  // 拖拽列会导致 scrollWidth 变化
55280
55328
  syncScrollWidth();
55281
55329
  }
55330
+ checkScroll();
55282
55331
  }, [colgroup]);
55283
55332
  return {
55284
55333
  isScrollX: !!isScrollX,
@@ -55545,7 +55594,6 @@ var useTableTree = function useTableTree(props) {
55545
55594
 
55546
55595
 
55547
55596
 
55548
-
55549
55597
  var useTableVirtual = function useTableVirtual(props) {
55550
55598
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
55551
55599
  _useState2 = slicedToArray_default()(_useState, 2),
@@ -55563,7 +55611,6 @@ var useTableVirtual = function useTableVirtual(props) {
55563
55611
  _useState8 = slicedToArray_default()(_useState7, 2),
55564
55612
  startIndex = _useState8[0],
55565
55613
  setStartIndex = _useState8[1];
55566
- var preIndex = usePrevious(startIndex);
55567
55614
  var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
55568
55615
  _useState10 = slicedToArray_default()(_useState9, 2),
55569
55616
  offsetY = _useState10[0],
@@ -55576,7 +55623,8 @@ var useTableVirtual = function useTableVirtual(props) {
55576
55623
  rateTimer: null,
55577
55624
  topTimer: null,
55578
55625
  controlScrollRate: null,
55579
- heightCallback: null
55626
+ heightCallback: null,
55627
+ preIndex: null
55580
55628
  }),
55581
55629
  context = _useRef.current;
55582
55630
  var getTranslate = usePersistFn(function (left, top) {
@@ -55609,6 +55657,8 @@ var useTableVirtual = function useTableVirtual(props) {
55609
55657
  if (context.shouldUpdateHeight) {
55610
55658
  setHeight(getContentHeight(props.data.length - 1));
55611
55659
  }
55660
+ var preIndex = context.preIndex;
55661
+ // 解决: 从下往上滚 由于高度变化会导致滚动条跳动
55612
55662
  if (preIndex && preIndex > startIndex && startIndex === index) {
55613
55663
  // 发生在顶部
55614
55664
  if (context.heightCallback) return;
@@ -55713,6 +55763,16 @@ var useTableVirtual = function useTableVirtual(props) {
55713
55763
  props.scrollRef.current.scrollTop = beforeHeight;
55714
55764
  }
55715
55765
  });
55766
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
55767
+ // 记录preIndex
55768
+ context.preIndex = startIndex;
55769
+ }, [startIndex]);
55770
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
55771
+ // 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
55772
+ return function () {
55773
+ context.preIndex = null;
55774
+ };
55775
+ }, [props.data]);
55716
55776
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
55717
55777
  if (props.disabled) return;
55718
55778
  if (offsetY) {
@@ -56000,9 +56060,10 @@ var Colgroup = function Colgroup(props) {
56000
56060
  return /*#__PURE__*/(0,jsx_runtime.jsx)("colgroup", {
56001
56061
  children: colgroup === null || colgroup === void 0 ? void 0 : colgroup.map(function (item, index) {
56002
56062
  var isLast = index === colgroup.length - 1;
56063
+ var width = isLast && props.shouldLastColAuto ? undefined : item;
56003
56064
  return /*#__PURE__*/(0,jsx_runtime.jsx)("col", {
56004
56065
  style: {
56005
- width: isLast && props.shouldLastColAuto ? undefined : item
56066
+ width: width
56006
56067
  }
56007
56068
  }, columns[index].key);
56008
56069
  })
@@ -57219,8 +57280,6 @@ var emptyRef = {
57219
57280
  jssStyle: props.jssStyle,
57220
57281
  colgroup: colgroup
57221
57282
  };
57222
- var headWrapperClass = classnames_default()(tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.headWrapper, isScrollY && scrollBarWidth && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.scrollY));
57223
- var footWrapperClass = classnames_default()(tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.footWrapper, isScrollY && scrollBarWidth && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.scrollY));
57224
57283
  var fixRightNum = (isRtl ? -1 * maxScrollLeft : maxScrollLeft) - virtualInfo.innerLeft;
57225
57284
  var Wrapper = props.sticky ? src_sticky_sticky : (external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment;
57226
57285
  var sticky = typeof_default()(props.sticky) === 'object' ? props.sticky : {
@@ -57233,7 +57292,10 @@ var emptyRef = {
57233
57292
  css: sticky === null || sticky === void 0 ? void 0 : sticky.css,
57234
57293
  parent: tableRef === null || tableRef === void 0 ? void 0 : tableRef.current
57235
57294
  };
57236
- if (!virtual && !isScrollY && !props.sticky && (_props$data3 = props.data) !== null && _props$data3 !== void 0 && _props$data3.length) {
57295
+ var isRenderBaseTable = !virtual && !isScrollY && !props.sticky && ((_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : _props$data3.length);
57296
+ var headWrapperClass = classnames_default()(tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.headWrapper, isScrollY && scrollBarWidth && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.scrollY));
57297
+ var footWrapperClass = classnames_default()(tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.footWrapper, isScrollY && scrollBarWidth && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.scrollY));
57298
+ if (isRenderBaseTable) {
57237
57299
  return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
57238
57300
  ref: scrollRef,
57239
57301
  className: tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.bodyWrapper,
@@ -57271,6 +57333,7 @@ var emptyRef = {
57271
57333
  scrollHeight: virtual ? virtualInfo.scrollHeight : tbodyHeight,
57272
57334
  onScroll: handleVirtualScroll,
57273
57335
  defaultHeight: context.emptyHeight,
57336
+ isScrollY: isScrollY,
57274
57337
  children: /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
57275
57338
  style: {
57276
57339
  width: width,
@@ -58305,6 +58368,7 @@ src_textarea_textarea_0.displayName = 'ShineoutTextarea';
58305
58368
 
58306
58369
 
58307
58370
 
58371
+ var defaultDelay = 0;
58308
58372
  var Tooltip = function Tooltip(props) {
58309
58373
  var _jssStyle$tooltip;
58310
58374
  var _props$trigger = props.trigger,
@@ -58324,11 +58388,13 @@ var Tooltip = function Tooltip(props) {
58324
58388
  var tooltipClasses = jssStyle === null || jssStyle === void 0 || (_jssStyle$tooltip = jssStyle.tooltip) === null || _jssStyle$tooltip === void 0 ? void 0 : _jssStyle$tooltip.call(jssStyle);
58325
58389
  var config = useConfig();
58326
58390
  var childrenProps = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.isValidElement)(children) ? children === null || children === void 0 ? void 0 : children.props : {};
58391
+ var delay = props.delay || props.mouseEnterDelay || defaultDelay;
58327
58392
  var _usePopup = use_popup({
58328
58393
  position: popsitionProps,
58329
58394
  trigger: trigger,
58330
58395
  autoMode: 'popover',
58331
58396
  priorityDirection: priorityDirection,
58397
+ mouseEnterDelay: delay,
58332
58398
  targetEvents: disabledChild ? {} : childrenProps
58333
58399
  }),
58334
58400
  open = _usePopup.open,
@@ -63137,6 +63203,8 @@ var popover_getPosition = function getPosition(position, el) {
63137
63203
  return false;
63138
63204
  }
63139
63205
  }
63206
+ // EXTERNAL MODULE: ./src/utils/type.ts
63207
+ var type = __webpack_require__(514);
63140
63208
  ;// CONCATENATED MODULE: ./src/utils/accept.ts
63141
63209
  function accept_attrAccept(file, acceptedFiles) {
63142
63210
  if (file && acceptedFiles) {
@@ -63178,6 +63246,7 @@ function accept_attrAccept(file, acceptedFiles) {
63178
63246
 
63179
63247
 
63180
63248
 
63249
+
63181
63250
  // import validate from './validate';
63182
63251
 
63183
63252
 
@@ -63473,7 +63542,7 @@ var upload_interface = __webpack_require__(8821);
63473
63542
 
63474
63543
 
63475
63544
  /* harmony default export */ var src_0 = ({
63476
- version: '3.3.0-beta.11'
63545
+ version: '3.3.0-beta.13'
63477
63546
  });
63478
63547
  }();
63479
63548
  /******/ return __webpack_exports__;