@aloudata/aloudata-design 2.4.1 → 2.5.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.
@@ -0,0 +1,3 @@
1
+ import { Badge, BadgeProps } from 'antd';
2
+ export type { BadgeProps };
3
+ export default Badge;
@@ -0,0 +1,2 @@
1
+ import { Badge } from 'antd';
2
+ export default Badge;
@@ -0,0 +1,2 @@
1
+ import '../../style';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import "../../style";
2
+ import "./index.less";
@@ -0,0 +1 @@
1
+ @import '../../style/index.less';
@@ -58,6 +58,9 @@ export default function Dropdown(props) {
58
58
  if (menu !== null && menu !== void 0 && menu.onClick) {
59
59
  menu.onClick(info);
60
60
  }
61
+ if (info.keepOpen) {
62
+ return;
63
+ }
61
64
  if (!isOpenControlled) {
62
65
  setDropdownOpen(false);
63
66
  }
@@ -37,4 +37,5 @@ export interface MenuInfo {
37
37
  key: string;
38
38
  keyPath: string[];
39
39
  domEvent: MouseEvent | KeyboardEvent;
40
+ keepOpen?: boolean;
40
41
  }
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import { TDirection } from '..';
3
- import type { SizeType } from '../../ConfigProvider/SizeContext';
4
- import './index.less';
3
+ import type { SizeType } from '../../ConfigProvider/sizeContext';
5
4
  interface ICustomIconProps {
6
5
  size?: SizeType;
7
6
  tip?: React.ReactNode;
8
7
  direction: TDirection;
8
+ spinning?: boolean;
9
+ className?: string;
10
+ inContainer?: boolean;
9
11
  }
10
- declare const Icon: (props: ICustomIconProps) => React.JSX.Element;
12
+ declare const Icon: (props: ICustomIconProps) => React.JSX.Element | null;
11
13
  export default Icon;
@@ -1,14 +1,21 @@
1
- import { LoadingDuotone } from "../../Icon";
2
1
  import classNames from 'classnames';
3
2
  import React from 'react';
4
- import "./index.less";
3
+ import { LoadingDuotone } from "../../Icon";
5
4
  var Icon = function Icon(props) {
6
5
  var size = props.size,
7
6
  tip = props.tip,
8
- direction = props.direction;
9
- return /*#__PURE__*/React.createElement("div", {
10
- className: classNames('spinner', {
11
- 'spinner-horizontal': direction === 'horizontal'
7
+ direction = props.direction,
8
+ _props$spinning = props.spinning,
9
+ spinning = _props$spinning === void 0 ? true : _props$spinning,
10
+ className = props.className,
11
+ inContainer = props.inContainer;
12
+ if (!spinning) return null;
13
+ return /*#__PURE__*/React.createElement(React.Fragment, null, inContainer && /*#__PURE__*/React.createElement("div", {
14
+ className: "spinner-mask"
15
+ }), /*#__PURE__*/React.createElement("div", {
16
+ className: classNames('spinner', className, {
17
+ 'spinner-horizontal': direction === 'horizontal',
18
+ 'spinner-center': inContainer
12
19
  })
13
20
  }, /*#__PURE__*/React.createElement("div", {
14
21
  className: classNames('spinner-inner', {
@@ -22,8 +29,8 @@ var Icon = function Icon(props) {
22
29
  size: 64
23
30
  }), size !== 'small' && size !== 'large' && /*#__PURE__*/React.createElement(LoadingDuotone, {
24
31
  size: 40
25
- })), /*#__PURE__*/React.createElement("div", {
32
+ })), tip && /*#__PURE__*/React.createElement("div", {
26
33
  className: "spinner-text"
27
- }, tip));
34
+ }, tip)));
28
35
  };
29
36
  export default Icon;
@@ -1,9 +1,13 @@
1
- import { SpinProps as AntdSpinProps } from 'antd';
2
1
  import React from 'react';
3
2
  export type TDirection = 'vertical' | 'horizontal';
4
- export interface SpinProps extends Omit<AntdSpinProps, 'size'> {
3
+ export interface SpinProps {
5
4
  size?: 'small' | 'large' | 'middle';
6
5
  direction?: TDirection;
6
+ children?: React.ReactElement;
7
+ tip?: React.ReactNode;
8
+ spinning?: boolean;
9
+ wrapperClassName?: string;
10
+ className?: string;
7
11
  }
8
- declare function CustomSpin(props: SpinProps): React.JSX.Element;
12
+ declare function CustomSpin(props: SpinProps): React.JSX.Element | null;
9
13
  export default CustomSpin;
@@ -1,30 +1,63 @@
1
- var _excluded = ["size", "tip", "direction"];
2
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
- import { Spin } from 'antd';
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
7
  import classNames from 'classnames';
7
- import React from 'react';
8
+ import React, { isValidElement } from 'react';
9
+ import { cloneElement, isFragment, isReactComponent } from "../_utils/reactNode";
8
10
  import CustomIcon from "./CustomIcon";
9
11
  function CustomSpin(props) {
10
12
  var size = props.size,
11
13
  tip = props.tip,
12
14
  _props$direction = props.direction,
13
15
  direction = _props$direction === void 0 ? 'vertical' : _props$direction,
14
- restProps = _objectWithoutProperties(props, _excluded);
15
- var spinSize = 'default';
16
- if (size === 'middle') {
17
- spinSize = 'default';
16
+ children = props.children,
17
+ spinning = props.spinning,
18
+ wrapperClassName = props.wrapperClassName,
19
+ className = props.className;
20
+ if (!children) {
21
+ return CustomIcon({
22
+ size: size,
23
+ tip: tip,
24
+ direction: direction,
25
+ spinning: spinning,
26
+ className: className
27
+ });
28
+ }
29
+ if (! /*#__PURE__*/isValidElement(children)) {
30
+ return children;
18
31
  }
19
- return /*#__PURE__*/React.createElement(Spin, _extends({}, restProps, {
20
- className: classNames('ald-spin', props.className),
21
- indicator: /*#__PURE__*/React.createElement(CustomIcon, {
22
- size: props.size,
32
+ if (isFragment(children) || isReactComponent(children)) {
33
+ return /*#__PURE__*/React.createElement('div', {
34
+ style: {
35
+ position: 'relative'
36
+ },
37
+ className: classNames(wrapperClassName)
38
+ }, [children, CustomIcon({
39
+ size: size,
23
40
  tip: tip,
24
- direction: direction
25
- }),
26
- tip: null,
27
- size: spinSize
28
- }));
41
+ direction: direction,
42
+ inContainer: true,
43
+ spinning: spinning,
44
+ className: className
45
+ })]);
46
+ } else {
47
+ return cloneElement(children, {
48
+ style: _objectSpread({
49
+ position: 'relative'
50
+ }, children.props.style),
51
+ className: classNames(wrapperClassName, children.props.className),
52
+ children: [children.props.children, CustomIcon({
53
+ size: size,
54
+ tip: tip,
55
+ direction: direction,
56
+ spinning: spinning,
57
+ inContainer: true,
58
+ className: className
59
+ })]
60
+ });
61
+ }
29
62
  }
30
63
  export default CustomSpin;
@@ -1,5 +1,3 @@
1
- @import '../../style/themes/default/themeColor.module.less';
2
-
3
1
  @spinner-size-large: 64px;
4
2
  @spinner-size-middle: 40px;
5
3
  @spinner-size-small: 20px;
@@ -37,6 +35,23 @@
37
35
  }
38
36
  }
39
37
 
38
+ .spinner-center {
39
+ position: absolute;
40
+ top: 50%;
41
+ left: 50%;
42
+ transform: translate(-50%, -50%);
43
+ }
44
+
45
+ .spinner-mask {
46
+ position: absolute;
47
+ top: 0;
48
+ left: 0;
49
+ width: 100%;
50
+ height: 100%;
51
+ opacity: 0.4;
52
+ background: var(--alias-colors-bg-skeleton-subtler, #fff);
53
+ }
54
+
40
55
  .spinner-text {
41
56
  color: var(--alias-colors-text-subtle, #4b5563);
42
57
  }
@@ -1,4 +1,5 @@
1
1
  @import '../../style/index.less';
2
+ @import './customIcon.less';
2
3
 
3
4
  .ant-spin.ald-spin {
4
5
  display: flex !important;
@@ -135,9 +135,7 @@ function Table(props, ref) {
135
135
  }, [onRowClick]);
136
136
 
137
137
  // 渲染 body
138
- var bodyContent = /*#__PURE__*/React.createElement(Spin, {
139
- spinning: !!loading
140
- }, /*#__PURE__*/React.createElement("div", {
138
+ var bodyContent = /*#__PURE__*/React.createElement("div", {
141
139
  className: prefixCls('body'),
142
140
  style: {
143
141
  width: tableInstance.getTotalSize()
@@ -160,8 +158,10 @@ function Table(props, ref) {
160
158
  }
161
159
  }, flexRender(cell.column.columnDef.cell, cell.getContext()));
162
160
  }));
163
- })));
164
- var tableContent = y && totalSize ? /*#__PURE__*/React.createElement("div", {
161
+ }));
162
+ var tableContent = y && totalSize ? /*#__PURE__*/React.createElement(Spin, {
163
+ spinning: !!loading
164
+ }, /*#__PURE__*/React.createElement("div", {
165
165
  className: prefixCls('content')
166
166
  }, /*#__PURE__*/React.createElement("div", {
167
167
  className: prefixCls('header'),
@@ -176,9 +176,16 @@ function Table(props, ref) {
176
176
  }, /*#__PURE__*/React.createElement(ScrollArea, {
177
177
  onViewportScroll: onBodyScroll,
178
178
  ref: tableBodyRef
179
- }, bodyContent))) : /*#__PURE__*/React.createElement("div", {
179
+ }, bodyContent)))) : /*#__PURE__*/React.createElement("div", {
180
180
  className: prefixCls('content')
181
- }, headerContent, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ScrollArea, {
181
+ }, !!loading && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
182
+ className: prefixCls('spin-mask')
183
+ }), /*#__PURE__*/React.createElement(Spin, null, /*#__PURE__*/React.createElement("div", {
184
+ className: prefixCls('spin'),
185
+ style: {
186
+ position: 'absolute'
187
+ }
188
+ }))), headerContent, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ScrollArea, {
182
189
  onViewportScroll: onBodyScroll,
183
190
  ref: tableBodyRef
184
191
  }, bodyContent)));
@@ -22,6 +22,32 @@
22
22
  display: flex;
23
23
  flex-direction: column;
24
24
  border-spacing: 0;
25
+ position: relative;
26
+
27
+ .ald-table-spin {
28
+ position: absolute;
29
+ top: 0;
30
+ left: 0;
31
+ width: 100%;
32
+ height: 300px;
33
+ max-height: 100%;
34
+ z-index: 2;
35
+
36
+ .spinner-mask {
37
+ opacity: 0;
38
+ }
39
+ }
40
+
41
+ .ald-table-spin-mask {
42
+ position: absolute;
43
+ top: 0;
44
+ left: 0;
45
+ width: 100%;
46
+ height: 100%;
47
+ background: #fff;
48
+ opacity: 0.4;
49
+ z-index: 1;
50
+ }
25
51
  }
26
52
 
27
53
  .ald-table-resizer {
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  export declare const isValidElement: typeof React.isValidElement;
3
3
  export declare function isFragment(child: any): boolean;
4
+ export declare function isReactComponent(child: any): boolean;
4
5
  type AnyObject = Record<PropertyKey, any>;
5
6
  type RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | void);
6
7
  export declare function replaceElement(element: React.ReactNode, replacement: React.ReactNode, props?: RenderProps): React.ReactNode;
@@ -4,6 +4,9 @@ export { isValidElement };
4
4
  export function isFragment(child) {
5
5
  return child && isValidElement(child) && child.type === React.Fragment;
6
6
  }
7
+ export function isReactComponent(child) {
8
+ return child && isValidElement(child) && typeof child.type === 'function';
9
+ }
7
10
  export function replaceElement(element, replacement, props) {
8
11
  if (!isValidElement(element)) {
9
12
  return replacement;