@aloudata/aloudata-design 2.0.5 → 2.2.0

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.
Files changed (38) hide show
  1. package/dist/Checkbox/type.d.ts +1 -0
  2. package/dist/DataPreviewTable/components/Body/index.js +1 -0
  3. package/dist/DataPreviewTable/style/index.less +4 -0
  4. package/dist/Dropdown/index.d.ts +1 -1
  5. package/dist/Dropdown/index.js +58 -18
  6. package/dist/Dropdown/style/index.less +12 -101
  7. package/dist/IconButton/index.js +1 -2
  8. package/dist/InputSearch/index.d.ts +12 -0
  9. package/dist/InputSearch/index.js +67 -0
  10. package/dist/InputSearch/style/index.d.ts +2 -0
  11. package/dist/InputSearch/style/index.js +2 -0
  12. package/dist/InputSearch/style/index.less +60 -0
  13. package/dist/Menu/index.d.ts +36 -20
  14. package/dist/Menu/index.js +110 -49
  15. package/dist/Menu/style/index.less +116 -73
  16. package/dist/RenameInput/index.d.ts +15 -0
  17. package/dist/RenameInput/index.js +98 -0
  18. package/dist/RenameInput/style/index.d.ts +2 -0
  19. package/dist/RenameInput/style/index.js +2 -0
  20. package/dist/RenameInput/style/index.less +54 -0
  21. package/dist/Select/index.js +0 -3
  22. package/dist/User/index.d.ts +9 -0
  23. package/dist/User/index.js +26 -0
  24. package/dist/User/style/index.d.ts +2 -0
  25. package/dist/User/style/index.js +2 -0
  26. package/dist/User/style/index.less +37 -0
  27. package/dist/ald.min.css +1 -1
  28. package/dist/index.d.ts +4 -1
  29. package/dist/index.js +3 -0
  30. package/dist/index.less +3 -0
  31. package/dist/notification/index.d.ts +8 -4
  32. package/package.json +2 -1
  33. package/dist/Menu/Divider.d.ts +0 -4
  34. package/dist/Menu/Divider.js +0 -6
  35. package/dist/Menu/MenuItem.d.ts +0 -30
  36. package/dist/Menu/MenuItem.js +0 -6
  37. package/dist/Menu/SubMenu.d.ts +0 -26
  38. package/dist/Menu/SubMenu.js +0 -18
@@ -1,54 +1,115 @@
1
- var _excluded = ["className", "items"];
2
- 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); }
3
- 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); }
4
- 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; }
5
- 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; }
6
- 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; }
7
- 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; }
8
- 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; }
9
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
10
- 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); }
11
- import { Menu as AntdMenu } from 'antd';
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ import { ControlledMenu, MenuDivider, MenuHeader, MenuItem, SubMenu } from '@szhsin/react-menu';
12
8
  import classNames from 'classnames';
13
- import React from 'react';
14
- import { ChevronRightLine } from "../Icon";
15
- import Divider from "./Divider";
16
- import MenuItem from "./MenuItem";
17
- import SubMenu from "./SubMenu";
18
- function isSubMenuType(item) {
19
- return item.children !== undefined;
20
- }
21
- export function addPopupOffset(items) {
22
- if (typeof items === 'undefined') {
23
- return;
24
- }
25
- var OFFSET_WIDTH = 1;
26
- var OFFSET_HEIGHT = 0;
27
- return items.map(function (item) {
28
- if (isSubMenuType(item)) {
29
- return _objectSpread(_objectSpread({
30
- popupOffset: [OFFSET_WIDTH, OFFSET_HEIGHT]
31
- }, item), {}, {
32
- children: addPopupOffset(item.children),
33
- expandIcon: /*#__PURE__*/React.createElement(ChevronRightLine, {
34
- size: 16
35
- })
36
- });
37
- }
38
- return item;
39
- }, []);
40
- }
9
+ import _ from 'lodash';
10
+ import React, { useRef } from 'react';
11
+ import { CheckLightLine, ChevronRightLine } from "../Icon";
41
12
  export default function Menu(props) {
42
13
  var className = props.className,
43
14
  items = props.items,
44
- otherProps = _objectWithoutProperties(props, _excluded);
45
- return /*#__PURE__*/React.createElement(AntdMenu, _extends({
46
- className: classNames(className, 'ald-menu')
47
- }, otherProps, {
48
- items: addPopupOffset(items),
49
- theme: "light"
50
- }));
15
+ onMenuClick = props.onClick,
16
+ selectedKeys = props.selectedKeys;
17
+ var getMenuItems = function getMenuItems(items) {
18
+ var parentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
19
+ return items.map(function (item, index) {
20
+ if (isDivideMenuItem(item)) {
21
+ return /*#__PURE__*/React.createElement(MenuDivider, {
22
+ key: "divider_".concat(index)
23
+ });
24
+ }
25
+ if (isHeaderMenuItem(item)) {
26
+ return /*#__PURE__*/React.createElement(MenuHeader, {
27
+ key: "header_".concat(index)
28
+ }, item.label);
29
+ }
30
+ var currPath = [].concat(_toConsumableArray(parentPath), [item.key]);
31
+ var titleStr = _.isString(item.label) ? item.label : '';
32
+ if (isSubMenuItem(item)) {
33
+ var subMenuItemLabel = /*#__PURE__*/React.createElement("div", {
34
+ className: "ald-menu-item-label",
35
+ title: titleStr
36
+ }, item.icon ? /*#__PURE__*/React.createElement("div", {
37
+ className: "ald-menu-item-label-icon"
38
+ }, item.icon) : null, /*#__PURE__*/React.createElement("div", {
39
+ className: "ald-menu-item-label-text"
40
+ }, item.label), /*#__PURE__*/React.createElement("div", {
41
+ className: "ald-menu-item-right"
42
+ }, /*#__PURE__*/React.createElement(ChevronRightLine, {
43
+ size: 16
44
+ })));
45
+ return /*#__PURE__*/React.createElement(SubMenu, {
46
+ key: item.key,
47
+ label: subMenuItemLabel,
48
+ disabled: item.disabled,
49
+ gap: 0,
50
+ menuClassName: classNames('ald-menu-submenu-popup', item.popupClassName),
51
+ overflow: isLeafMenu(item.children) ? 'auto' : undefined
52
+ }, getMenuItems(item.children, currPath));
53
+ }
54
+ return /*#__PURE__*/React.createElement(MenuItem, {
55
+ key: item.key,
56
+ className: classNames(item.className, {
57
+ 'ald-menu-item-danger': item.danger,
58
+ 'ald-menu-item-selected': selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys.includes(item.key)
59
+ }),
60
+ disabled: item.disabled,
61
+ onClick: function onClick(_ref) {
62
+ var syntheticEvent = _ref.syntheticEvent;
63
+ var menuInfo = {
64
+ key: item.key,
65
+ keyPath: currPath,
66
+ domEvent: syntheticEvent
67
+ };
68
+ if (item.onClick) {
69
+ item.onClick(menuInfo);
70
+ }
71
+ if (onMenuClick) {
72
+ onMenuClick(menuInfo);
73
+ }
74
+ }
75
+ }, /*#__PURE__*/React.createElement("div", {
76
+ className: "ald-menu-item-label",
77
+ title: titleStr
78
+ }, item.icon ? /*#__PURE__*/React.createElement("div", {
79
+ className: "ald-menu-item-label-icon"
80
+ }, item.icon) : null, /*#__PURE__*/React.createElement("div", {
81
+ className: "ald-menu-item-label-text"
82
+ }, item.label), (selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys.includes(item.key)) && /*#__PURE__*/React.createElement("div", {
83
+ className: "ald-menu-item-selected-icon"
84
+ }, /*#__PURE__*/React.createElement(CheckLightLine, null))));
85
+ });
86
+ };
87
+ var ref = useRef(null);
88
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
89
+ style: {
90
+ display: 'none '
91
+ },
92
+ ref: ref
93
+ }), /*#__PURE__*/React.createElement(ControlledMenu, {
94
+ state: "open",
95
+ anchorRef: ref,
96
+ className: classNames(className, 'ald-menu'),
97
+ position: "auto",
98
+ viewScroll: "auto",
99
+ overflow: isLeafMenu(items) ? 'auto' : undefined
100
+ }, getMenuItems(items || [])));
101
+ }
102
+ function isHeaderMenuItem(menuItem) {
103
+ return 'type' in menuItem && menuItem.type === 'header';
104
+ }
105
+ function isDivideMenuItem(menuItem) {
106
+ return 'type' in menuItem && menuItem.type === 'divider';
107
+ }
108
+ function isSubMenuItem(menuItem) {
109
+ return 'children' in menuItem;
51
110
  }
52
- Menu.Item = MenuItem;
53
- Menu.Divider = Divider;
54
- Menu.SubMenu = SubMenu;
111
+ function isLeafMenu(menuItems) {
112
+ return !_.some(menuItems, function (item) {
113
+ return isSubMenuItem(item);
114
+ });
115
+ }
@@ -1,104 +1,147 @@
1
+ /* stylelint-disable selector-class-pattern */
2
+
1
3
  @import '../../style/index.less';
4
+ // @import '~@szhsin/react-menu/dist/index.css';
5
+ // @import '~@szhsin/react-menu/dist/transitions/slide.css';
6
+
7
+ @menu-item-horizontal-padding: 12px;
8
+ @menu-width: 168px + 2 * @menu-item-horizontal-padding;
9
+ @max-menu-width: 300px;
2
10
 
3
- // Menu 和子menu的 ul样式
4
- .menu-content {
11
+ .menuContainerStyle {
12
+ display: flex;
13
+ padding: var(--alias-padding-50minus1, 4px) 0;
14
+ flex-direction: column;
15
+ align-items: flex-start;
16
+ align-self: stretch;
17
+ border-radius: var(--alias-radius-75, 6px);
18
+ border: 1px solid var(--alias-colors-border-strong, #d1d5db);
5
19
  background: var(--alias-colors-bg-skeleton-subtler, #fff);
6
- border-radius: 0;
7
- box-shadow: none;
8
- padding: 0;
20
+ box-shadow: 0 10px 18px -2px #00000014;
21
+ min-width: @menu-width;
22
+ max-width: @max-menu-width;
23
+ z-index: 999;
24
+ }
25
+
26
+ .ald-menu {
27
+ position: relative !important;
9
28
 
10
- .ant-menu-item-divider,
11
- .ant-menu-submenu-title-divider {
12
- background-color: var(--alias-colors-border-subtle, #f3f4f6);
29
+ ul,
30
+ li {
31
+ list-style: none;
13
32
  margin: 0;
33
+ box-sizing: border-box;
14
34
  }
15
35
 
16
- .ant-menu-item-selected {
17
- background-color: unset;
36
+ & > .szh-menu {
37
+ position: relative !important;
38
+ top: auto !important;
39
+ left: auto !important;
18
40
  }
19
41
 
20
- // menu项样式
21
- .ant-menu-item,
22
- .ant-menu-submenu .ant-menu-submenu-title {
42
+ .szh-menu {
43
+ .menuContainerStyle();
44
+ }
45
+
46
+ .szh-menu__item {
23
47
  display: flex;
48
+ padding: var(--alias-padding-100minus1, 8px) var(--alias-padding-150, 12px)
49
+ var(--alias-padding-100, 8px) var(--alias-padding-150, 12px);
24
50
  align-items: center;
25
- justify-content: space-between;
26
- padding: var(--alias-padding-100, 8px) var(--alias-padding-150, 12px);
27
- color: var(--alias-colors-text-default, #1f2937);
28
- font-size: 14px;
29
- font-style: normal;
30
- font-weight: 400;
51
+ gap: var(--alias-spacing-75, 6px);
52
+ align-self: stretch;
53
+ background: var(--alias-colors-bg-transp, rgba(0, 0, 0, 0));
54
+ width: 100%;
31
55
  line-height: 20px;
32
- height: auto;
33
- margin: 0;
34
- width: auto;
35
- gap: var(--alias-spacing-50, 4px);
36
- border-radius: 0;
56
+ max-width: @max-menu-width;
57
+ cursor: pointer;
58
+ }
37
59
 
38
- &:hover {
39
- background-color: unset;
40
- }
60
+ .szh-menu__item--hover {
61
+ background: var(--alias-colors-bg-interaction-hover, rgba(0, 0, 0, 0.05));
62
+ }
41
63
 
42
- .ant-dropdown-menu-item-icon {
43
- font-size: 20px;
44
- margin: 0;
45
- }
64
+ .szh-menu__submenu {
65
+ width: 100%;
66
+ }
67
+
68
+ .szh-menu__item--disabled {
69
+ color: var(--alias-colors-text-disabled, rgba(0, 0, 0, 0.25));
70
+ cursor: default;
46
71
 
47
- .ant-menu-title-content.ant-menu-title-content {
48
- text-overflow: ellipsis;
49
- overflow: hidden;
50
- white-space: nowrap;
51
- margin-left: 0;
52
- flex: 1;
72
+ .ald-menu-item-label-icon,
73
+ &.ald-menu-item-selected {
74
+ color: var(--alias-colors-text-disabled, rgba(0, 0, 0, 0.25));
53
75
  }
76
+ }
54
77
 
55
- svg {
56
- flex-shrink: 0;
78
+ .szh-menu__divider {
79
+ width: 100%;
80
+ height: 0;
81
+ position: relative;
82
+ padding: 4px 0;
83
+
84
+ &::after {
85
+ content: '';
86
+ display: block;
87
+ position: absolute;
88
+ top: 50%;
89
+ left: 0;
90
+ right: 0;
91
+ height: 1px;
92
+ background: var(--alias-colors-border-subtle, #f3f4f6);
57
93
  }
58
94
  }
59
95
 
60
- .ant-menu-submenu {
61
- border-radius: 0;
96
+ .ald-menu-item-danger {
97
+ color: #b91c1c;
62
98
  }
63
99
 
64
- .ant-menu-item.ant-menu-item-disabled {
65
- cursor: default;
66
- color: var(--alias-colors-text-disabled, rgba(0, 0, 0, 0.25));
100
+ .ald-menu-item-label {
101
+ display: flex;
102
+ width: 100%;
103
+ gap: var(--alias-spacing-75, 6px);
104
+ justify-content: space-between;
105
+ }
67
106
 
68
- &:hover {
69
- background-color: var(--alias-colors-bg-transp, rgba(0, 0, 0, 0));
70
- }
107
+ .ald-menu-item-label-icon {
108
+ flex: 0 0 auto;
71
109
  }
72
110
 
73
- .ant-menu-item:hover,
74
- .ant-menu-submenu:hover,
75
- .ant-menu-submenu.ant-menu-submenu-active {
76
- background-color: var(
77
- --alias-colors-bg-interaction-hover,
78
- rgba(0, 0, 0, 0.05)
79
- );
111
+ .ald-menu-item-label-text {
112
+ flex: 1 1 auto;
113
+ overflow: hidden;
114
+ text-overflow: ellipsis;
115
+ white-space: nowrap;
80
116
  }
81
- }
82
117
 
83
- // 容器样式
84
- .menu-wrap {
85
- border: 1px solid var(--alias-colors-border-strong, #d1d5db);
86
- border-radius: var(--alias-radius-75, 6px);
87
- box-shadow: 0 10px 18px -2px rgba(0, 0, 0, 0.08);
88
- overflow: hidden;
89
- padding: 2px 0;
90
- }
118
+ .ald-menu-item-right {
119
+ flex: 0 0 auto;
120
+ display: flex;
121
+ align-items: center;
122
+ color: #9ca3af;
123
+ gap: var(--alias-spacing-75, 6px);
124
+ }
91
125
 
92
- // menu菜单
93
- .ant-menu-root.ant-menu {
94
- border: none;
95
- .menu-content();
96
- }
126
+ .ald-menu-item-selected {
127
+ color: #126fdd;
128
+ }
129
+
130
+ .ald-menu-item-selected-icon {
131
+ display: flex;
132
+ align-items: center;
133
+ }
97
134
 
98
- .ant-menu-submenu.ant-menu-submenu-popup {
99
- .menu-wrap();
100
- // 二级菜单中的ul
101
- .ant-menu-sub {
102
- .menu-content();
135
+ .ald-menu-submenu-popup {
136
+ transform: translateY(-4px);
137
+ }
138
+
139
+ .szh-menu__header {
140
+ padding: var(--alias-padding-100, 8px) var(--alias-padding-150, 12px)
141
+ var(--alias-padding-50, 4px) var(--alias-padding-150, 12px);
142
+ color: var(--alias-colors-text-subtlest, #9ca3af);
143
+ line-height: 16px;
144
+ font-size: 12px;
145
+ cursor: default;
103
146
  }
104
147
  }
@@ -0,0 +1,15 @@
1
+ import React, { CSSProperties } from 'react';
2
+ interface IProps {
3
+ value: string;
4
+ onConfirm?: (value: string) => void;
5
+ onError?: (value: string) => void;
6
+ className?: string;
7
+ width?: number;
8
+ fontStyle?: CSSProperties;
9
+ focus?: boolean;
10
+ maxLength?: number;
11
+ distance?: [left: number, right: number];
12
+ validateValue?: (value: string) => boolean;
13
+ }
14
+ declare const RenameInput: ({ value: propsValue, onConfirm, className, width, fontStyle, focus, maxLength, validateValue, onError, }: IProps) => React.JSX.Element;
15
+ export default RenameInput;
@@ -0,0 +1,98 @@
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); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import classNames from 'classnames';
14
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
15
+ var defaultWidth = 20;
16
+ var RenameInput = function RenameInput(_ref) {
17
+ var propsValue = _ref.value,
18
+ onConfirm = _ref.onConfirm,
19
+ className = _ref.className,
20
+ width = _ref.width,
21
+ fontStyle = _ref.fontStyle,
22
+ _ref$focus = _ref.focus,
23
+ focus = _ref$focus === void 0 ? false : _ref$focus,
24
+ maxLength = _ref.maxLength,
25
+ validateValue = _ref.validateValue,
26
+ onError = _ref.onError;
27
+ var _useState = useState(propsValue),
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ value = _useState2[0],
30
+ setValue = _useState2[1];
31
+ var divRef = useRef(null);
32
+ var inputRef = useRef(null);
33
+ var handleBlur = useCallback(function () {
34
+ var _inputRef$current;
35
+ onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(value);
36
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.blur();
37
+ }, [onConfirm, value]);
38
+ useEffect(function () {
39
+ if (!width && divRef.current && inputRef.current) {
40
+ var _divRef$current;
41
+ var tempWidth = ((_divRef$current = divRef.current) === null || _divRef$current === void 0 ? void 0 : _divRef$current.offsetWidth) || defaultWidth;
42
+ inputRef.current.style.width = tempWidth + 'px';
43
+ }
44
+ }, [width, value]);
45
+ useEffect(function () {
46
+ setValue(propsValue);
47
+ }, [propsValue]);
48
+ useEffect(function () {
49
+ if (focus && inputRef.current) {
50
+ inputRef.current.select();
51
+ }
52
+ }, [focus]);
53
+ return /*#__PURE__*/React.createElement("div", {
54
+ className: "ald-rename-input"
55
+ }, /*#__PURE__*/React.createElement("input", {
56
+ className: classNames(className, 'ald-rename-input-wrapper'),
57
+ style: _objectSpread(_objectSpread({}, fontStyle), {}, {
58
+ width: width
59
+ }),
60
+ value: value,
61
+ ref: inputRef,
62
+ onChange: function onChange(e) {
63
+ return setValue(e.target.value.trim());
64
+ },
65
+ onBlur: function onBlur(e) {
66
+ if (!validateValue || validateValue(e.target.value.trim())) {
67
+ handleBlur();
68
+ } else {
69
+ onError === null || onError === void 0 ? void 0 : onError(value);
70
+ setValue(propsValue);
71
+ }
72
+ },
73
+ autoFocus: focus,
74
+ onFocus: function onFocus() {
75
+ var _inputRef$current2;
76
+ (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.select();
77
+ },
78
+ maxLength: maxLength,
79
+ onKeyUp: function onKeyUp(e) {
80
+ if (e.key === 'Enter') {
81
+ var _inputRef$current3;
82
+ if (!validateValue || validateValue(((_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value.trim()) || '')) {
83
+ var _inputRef$current4;
84
+ (_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.blur();
85
+ } else {
86
+ var _inputRef$current5;
87
+ onError === null || onError === void 0 ? void 0 : onError(((_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.value.trim()) || '');
88
+ setValue(propsValue);
89
+ }
90
+ }
91
+ }
92
+ }), /*#__PURE__*/React.createElement("div", {
93
+ ref: divRef,
94
+ className: "ald-rename-input-div",
95
+ style: _objectSpread({}, fontStyle)
96
+ }, value));
97
+ };
98
+ export default RenameInput;
@@ -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,54 @@
1
+ @import '../../style/index.less';
2
+
3
+ .ald-rename-input {
4
+ min-width: 10px;
5
+ height: 22px;
6
+ max-width: 100%;
7
+ display: flex;
8
+ align-items: center;
9
+ border: 1px solid transparent;
10
+ }
11
+
12
+ .ald-rename-input-wrapper {
13
+ box-sizing: border-box;
14
+ height: 24px;
15
+ border: 0;
16
+ padding: 2px;
17
+ font-size: 13px;
18
+ max-width: 100% !important;
19
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
20
+ 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',
21
+ 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
22
+
23
+ &:hover {
24
+ border: 1px solid var(--alias-colors-border-strong, #d1d5db);
25
+ margin-left: -1px;
26
+ margin-right: 1px;
27
+ }
28
+
29
+ &:focus {
30
+ border: 1px solid var(--alias-colors-border-selected, #126fdd);
31
+ box-shadow: 0 0 0 1px #126fdd;
32
+ margin-left: -1px;
33
+ margin-right: 1px;
34
+ }
35
+ }
36
+
37
+ .ald-rename-input-div {
38
+ bottom: 0;
39
+ font-weight: 400;
40
+ border: 1px solid transparent;
41
+ padding: 0;
42
+ margin-left: -1px;
43
+ min-width: 1px;
44
+ max-width: 100%;
45
+ position: fixed;
46
+ pointer-events: none;
47
+ white-space: pre;
48
+ visibility: hidden;
49
+ overflow: hidden;
50
+ font-size: 13px;
51
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
52
+ 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',
53
+ 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
54
+ }
@@ -369,11 +369,8 @@ var Select = /*#__PURE__*/forwardRef(function (props, ref) {
369
369
  var classList = target.classList;
370
370
  if (classList.contains('ant-select')) {
371
371
  if (classList.contains('ant-select-focused')) {
372
- console.log(222, JSON.stringify(classList));
373
372
  setIsFocus(true);
374
373
  } else {
375
- console.log(111);
376
- console.log(JSON.stringify(classList));
377
374
  setIsFocus(false);
378
375
  }
379
376
  }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface IUserProps {
3
+ src: React.ReactNode | string;
4
+ nickname: string;
5
+ size?: 'small' | 'middle' | 'large';
6
+ nicknameClassName?: string;
7
+ }
8
+ declare function User({ src, nickname, size, nicknameClassName, }: IUserProps): React.JSX.Element;
9
+ export default User;
@@ -0,0 +1,26 @@
1
+ import classNames from 'classnames';
2
+ import React from 'react';
3
+ import Avatar from "../Avatar";
4
+ var getAvatarSize = function getAvatarSize(size) {
5
+ return {
6
+ small: 16,
7
+ middle: 20,
8
+ large: 24
9
+ }[size];
10
+ };
11
+ function User(_ref) {
12
+ var src = _ref.src,
13
+ nickname = _ref.nickname,
14
+ _ref$size = _ref.size,
15
+ size = _ref$size === void 0 ? 'middle' : _ref$size,
16
+ nicknameClassName = _ref.nicknameClassName;
17
+ return /*#__PURE__*/React.createElement("div", {
18
+ className: classNames('ald-user', "ald-user-".concat(size))
19
+ }, /*#__PURE__*/React.createElement(Avatar, {
20
+ src: src,
21
+ size: getAvatarSize(size || 'middle')
22
+ }), /*#__PURE__*/React.createElement("div", {
23
+ className: classNames('ald-user-text', nicknameClassName)
24
+ }, nickname));
25
+ }
26
+ export default User;
@@ -0,0 +1,2 @@
1
+ import '../../style';
2
+ import './index.less';
@@ -0,0 +1,2 @@
1
+ import "../../style";
2
+ import "./index.less";