@aloudata/aloudata-design 2.11.0 → 2.12.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.
- package/dist/ColorPicker/index.js +8 -4
- package/dist/ConfigProvider/defaultRenderEmpty.js +4 -2
- package/dist/ConfigProvider/index.js +9 -1
- package/dist/DataPreviewTable/components/Body/Error.js +6 -2
- package/dist/DataPreviewTable/index.js +6 -2
- package/dist/DoubleCircleIcon/index.d.ts +1 -1
- package/dist/Empty/index.js +5 -1
- package/dist/HighlightText/index.js +2 -1
- package/dist/InputSearch/index.js +6 -2
- package/dist/List/Item.js +2 -1
- package/dist/MemberPicker/components/MemberSelection.js +6 -2
- package/dist/MemberPicker/components/MultipleOption.js +6 -2
- package/dist/MemberPicker/components/Panel.js +8 -4
- package/dist/MemberPicker/components/PanelWrapper.d.ts +1 -1
- package/dist/MemberPicker/components/PanelWrapper.js +10 -6
- package/dist/MemberPicker/components/SelectedMemberTags.js +6 -2
- package/dist/MemberPicker/components/SelectorFooter.js +7 -3
- package/dist/MemberPicker/components/SingleOption.js +6 -2
- package/dist/MemberPicker/components/UserGroupSelection.js +7 -3
- package/dist/MemberPicker/index.js +35 -31
- package/dist/Modal/index.js +17 -23
- package/dist/OverflowCount/style/index.less +1 -0
- package/dist/Radio/components/Group/index.d.ts +1 -1
- package/dist/Select/index.js +6 -2
- package/dist/Steps/matchMedia.mock.d.ts +1 -0
- package/dist/Steps/matchMedia.mock.js +7 -6
- package/dist/Table/components/ErrorBoundary.d.ts +1 -0
- package/dist/Table/components/ErrorBoundary.js +8 -3
- package/dist/Table/components/Footer/index.js +9 -5
- package/dist/Tree/Tree.js +9 -5
- package/dist/ald.min.css +1 -1
- package/dist/locale/default.d.ts +59 -2
- package/dist/locale/default.js +18 -2
- package/dist/locale/en_US.d.ts +49 -2
- package/dist/locale/en_US.js +41 -121
- package/dist/locale/zh_CN.d.ts +49 -2
- package/dist/locale/zh_CN.js +41 -120
- package/dist/message/index.js +3 -1
- package/dist/notification/index.js +10 -7
- package/package.json +7 -1
- package/dist/Modal/locale.d.ts +0 -7
- package/dist/Modal/locale.js +0 -18
- package/dist/locale-provider/LocaleReceiver.d.ts +0 -4
- package/dist/locale-provider/LocaleReceiver.js +0 -3
- package/dist/locale-provider/context.d.ts +0 -7
- package/dist/locale-provider/context.js +0 -3
- package/dist/locale-provider/default.d.ts +0 -2
- package/dist/locale-provider/default.js +0 -2
- package/dist/locale-provider/en_US.d.ts +0 -2
- package/dist/locale-provider/en_US.js +0 -2
- package/dist/locale-provider/index.d.ts +0 -65
- package/dist/locale-provider/index.js +0 -80
- package/dist/locale-provider/style/index.d.ts +0 -1
- package/dist/locale-provider/style/index.js +0 -1
- package/dist/locale-provider/style/index.less +0 -2
- package/dist/locale-provider/zh_CN.d.ts +0 -2
- package/dist/locale-provider/zh_CN.js +0 -2
|
@@ -9,9 +9,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
9
9
|
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; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import { default as cls } from 'classnames';
|
|
12
|
-
import React, { useEffect, useRef, useState } from 'react';
|
|
12
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
13
13
|
import Dropdown from "../Dropdown";
|
|
14
14
|
import { FoldDownFill } from "../Icon";
|
|
15
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
15
16
|
import { colors as defaultColors, specialColors } from "./constant";
|
|
16
17
|
function getLocalRecentColors(localStorageKey) {
|
|
17
18
|
if (!window.localStorage) {
|
|
@@ -41,6 +42,9 @@ export default function ColorPicker(_ref) {
|
|
|
41
42
|
localStorageKey = _ref$localStorageKey === void 0 ? 'ald_recent_colors' : _ref$localStorageKey,
|
|
42
43
|
_ref$disabled = _ref.disabled,
|
|
43
44
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
45
|
+
var _useContext = useContext(LocaleContext),
|
|
46
|
+
locale = _useContext.locale;
|
|
47
|
+
var t = getTranslator(locale);
|
|
44
48
|
var _useState = useState(false),
|
|
45
49
|
_useState2 = _slicedToArray(_useState, 2),
|
|
46
50
|
open = _useState2[0],
|
|
@@ -98,9 +102,9 @@ export default function ColorPicker(_ref) {
|
|
|
98
102
|
style: {
|
|
99
103
|
backgroundColor: defaultColor
|
|
100
104
|
}
|
|
101
|
-
})),
|
|
105
|
+
})), t.ColorPicker.default), /*#__PURE__*/React.createElement("div", {
|
|
102
106
|
className: 'standard'
|
|
103
|
-
}, /*#__PURE__*/React.createElement("p", null,
|
|
107
|
+
}, /*#__PURE__*/React.createElement("p", null, t.ColorPicker.standardColor), /*#__PURE__*/React.createElement("div", {
|
|
104
108
|
className: 'items'
|
|
105
109
|
}, defaultColors.map(function (color) {
|
|
106
110
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -123,7 +127,7 @@ export default function ColorPicker(_ref) {
|
|
|
123
127
|
}));
|
|
124
128
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
125
129
|
className: 'recent'
|
|
126
|
-
}, /*#__PURE__*/React.createElement("p", null,
|
|
130
|
+
}, /*#__PURE__*/React.createElement("p", null, t.ColorPicker.recentlyUsed), /*#__PURE__*/React.createElement("div", {
|
|
127
131
|
className: 'items'
|
|
128
132
|
}, recentColors.map(function (color) {
|
|
129
133
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -17,8 +17,10 @@ var defaultRenderEmpty = function defaultRenderEmpty(componentName) {
|
|
|
17
17
|
case 'Transfer':
|
|
18
18
|
case 'Mentions':
|
|
19
19
|
return /*#__PURE__*/React.createElement(Empty, {
|
|
20
|
-
image: Empty.PRESENTED_IMAGE_SEARCH_SMALL
|
|
21
|
-
|
|
20
|
+
image: Empty.PRESENTED_IMAGE_SEARCH_SMALL
|
|
21
|
+
// 没有地方用到
|
|
22
|
+
// title="无数据"
|
|
23
|
+
,
|
|
22
24
|
className: "".concat(prefix, "-small")
|
|
23
25
|
});
|
|
24
26
|
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
import { ConfigProvider } from 'antd';
|
|
3
|
+
import antdEnUS from 'antd/locale/en_US';
|
|
4
|
+
import antdZhCN from 'antd/locale/zh_CN';
|
|
3
5
|
import React from 'react';
|
|
6
|
+
import { LocaleContext, defaultLocale } from "../locale/default";
|
|
4
7
|
import getUserListContext from "./getUserList";
|
|
5
8
|
import useGetUserList from "./hooks/useGetUserList";
|
|
6
9
|
import SizeContext from "./sizeContext";
|
|
7
10
|
export { ConfigContext } from 'antd/lib/config-provider';
|
|
8
11
|
export { ConfigConsumer } from 'antd/lib/config-provider/';
|
|
9
12
|
var AldCustomConfigProvider = function AldCustomConfigProvider(props) {
|
|
13
|
+
var _props$locale;
|
|
10
14
|
var children = props.children,
|
|
11
15
|
getUsersByIds = props.getUsersByIds,
|
|
12
16
|
getUsersByKeywords = props.getUsersByKeywords;
|
|
@@ -26,7 +30,11 @@ var AldCustomConfigProvider = function AldCustomConfigProvider(props) {
|
|
|
26
30
|
fontFamily: "Inter,'PingFang SC', system-ui, -apple-system, blinkmacsystemfont,\n 'Helvetica Neue', 'Segoe UI', helvetica, arial, 'Microsoft YaHei',\n 'WenQuanYi Micro Hei', sans-serif;"
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
|
-
}, props
|
|
33
|
+
}, props, {
|
|
34
|
+
locale: ((_props$locale = props.locale) === null || _props$locale === void 0 ? void 0 : _props$locale.locale) === 'zh-cn' ? antdZhCN : antdEnUS
|
|
35
|
+
}), /*#__PURE__*/React.createElement(LocaleContext.Provider, {
|
|
36
|
+
value: props.locale || defaultLocale
|
|
37
|
+
}, childNode));
|
|
30
38
|
};
|
|
31
39
|
AldCustomConfigProvider.ConfigContext = ConfigProvider.ConfigContext;
|
|
32
40
|
AldCustomConfigProvider.SizeContext = SizeContext;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import React, { memo } from 'react';
|
|
1
|
+
import React, { memo, useContext } from 'react';
|
|
2
2
|
import Result from "../../../Result";
|
|
3
|
+
import { LocaleContext, getTranslator } from "../../../locale/default";
|
|
3
4
|
function ErrorBody(props) {
|
|
5
|
+
var _useContext = useContext(LocaleContext),
|
|
6
|
+
locale = _useContext.locale;
|
|
7
|
+
var t = getTranslator(locale);
|
|
4
8
|
var wrapWidth = props.wrapWidth,
|
|
5
9
|
_props$errorMsg = props.errorMsg,
|
|
6
|
-
errorMsg = _props$errorMsg === void 0 ?
|
|
10
|
+
errorMsg = _props$errorMsg === void 0 ? t.DataPreviewTable.loadFailed : _props$errorMsg;
|
|
7
11
|
return /*#__PURE__*/React.createElement("div", {
|
|
8
12
|
className: "ald-data-preview-table-error",
|
|
9
13
|
style: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
2
|
+
import React, { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
|
|
3
3
|
import Progress from "../Progress";
|
|
4
4
|
import ScrollArea from "../ScrollArea";
|
|
5
5
|
import Spin from "../Spin";
|
|
6
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
6
7
|
import Body from "./components/Body";
|
|
7
8
|
import Error from "./components/Body/Error";
|
|
8
9
|
import Header from "./components/Header";
|
|
@@ -10,6 +11,9 @@ import { CELL_HEIGHT, DEFAULT_HEADER_HEIGHT } from "./constant";
|
|
|
10
11
|
import useDirection from "./hooks/useDirection";
|
|
11
12
|
var DataPreviewTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
12
13
|
var _wrapRef$current5;
|
|
14
|
+
var _useContext = useContext(LocaleContext),
|
|
15
|
+
locale = _useContext.locale;
|
|
16
|
+
var t = getTranslator(locale);
|
|
13
17
|
var _props$columns = props.columns,
|
|
14
18
|
columns = _props$columns === void 0 ? [] : _props$columns,
|
|
15
19
|
_props$datasource = props.datasource,
|
|
@@ -21,7 +25,7 @@ var DataPreviewTable = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
21
25
|
loading = props.loading,
|
|
22
26
|
dataStatus = props.dataStatus,
|
|
23
27
|
_props$errorMsg = props.errorMsg,
|
|
24
|
-
errorMsg = _props$errorMsg === void 0 ?
|
|
28
|
+
errorMsg = _props$errorMsg === void 0 ? t.DataPreviewTable.dataLoadFailed : _props$errorMsg;
|
|
25
29
|
var realHeaderHeight = Math.max(headerHeight, DEFAULT_HEADER_HEIGHT);
|
|
26
30
|
var contentHeight = useMemo(function () {
|
|
27
31
|
return datasource.length * CELL_HEIGHT + realHeaderHeight;
|
|
@@ -5,6 +5,6 @@ declare const DoubleCircleIcon: (props: {
|
|
|
5
5
|
size?: number | undefined;
|
|
6
6
|
innerColor?: string | undefined;
|
|
7
7
|
children: React.ReactNode;
|
|
8
|
-
type?: "warning" | "error" | "
|
|
8
|
+
type?: "warning" | "error" | "info" | "success" | undefined;
|
|
9
9
|
}) => React.JSX.Element;
|
|
10
10
|
export default DoubleCircleIcon;
|
package/dist/Empty/index.js
CHANGED
|
@@ -9,6 +9,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import _ from 'lodash';
|
|
11
11
|
import * as React from 'react';
|
|
12
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
12
13
|
import DataEmptyImg from "./image/Data";
|
|
13
14
|
import SearchEmptyImg from "./image/Search";
|
|
14
15
|
import SearchEmptySmallImage from "./image/SearchSmall";
|
|
@@ -20,12 +21,15 @@ var workbookEmptyImg = /*#__PURE__*/React.createElement(WorkbookEmptyImg, null);
|
|
|
20
21
|
var dataEmptyImg = /*#__PURE__*/React.createElement(DataEmptyImg, null);
|
|
21
22
|
var searchEmptySmallImage = /*#__PURE__*/React.createElement(SearchEmptySmallImage, null);
|
|
22
23
|
var Empty = function Empty(props) {
|
|
24
|
+
var _React$useContext = React.useContext(LocaleContext),
|
|
25
|
+
locale = _React$useContext.locale;
|
|
26
|
+
var t = getTranslator(locale);
|
|
23
27
|
var className = props.className,
|
|
24
28
|
_props$image = props.image,
|
|
25
29
|
image = _props$image === void 0 ? props.size === 'small' ? searchEmptySmallImage : searchEmptyImg : _props$image,
|
|
26
30
|
description = props.description,
|
|
27
31
|
_props$title = props.title,
|
|
28
|
-
title = _props$title === void 0 ?
|
|
32
|
+
title = _props$title === void 0 ? t.Empty.noContentFound : _props$title,
|
|
29
33
|
size = props.size,
|
|
30
34
|
children = props.children,
|
|
31
35
|
imageStyle = props.imageStyle,
|
|
@@ -17,7 +17,8 @@ export default function HighlightText(props) {
|
|
|
17
17
|
var regex = new RegExp("(".concat(trimKeyword, ")"), 'gi');
|
|
18
18
|
var parts = text.split(regex);
|
|
19
19
|
return /*#__PURE__*/React.createElement("span", {
|
|
20
|
-
className: className
|
|
20
|
+
className: className,
|
|
21
|
+
title: children
|
|
21
22
|
}, parts.map(function (part, index) {
|
|
22
23
|
return regex.test(part) ? /*#__PURE__*/React.createElement("span", {
|
|
23
24
|
key: index,
|
|
@@ -11,11 +11,15 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
11
11
|
import { useDebounceFn } from 'ahooks';
|
|
12
12
|
import classnames from 'classnames';
|
|
13
13
|
import _ from 'lodash';
|
|
14
|
-
import React, { useCallback, useState } from 'react';
|
|
14
|
+
import React, { useCallback, useContext, useState } from 'react';
|
|
15
15
|
import { SearchLine } from "../Icon";
|
|
16
16
|
import Input from "../Input";
|
|
17
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
17
18
|
var DEFAULT_WIDTH = 68;
|
|
18
19
|
export default function InputSearch(props) {
|
|
20
|
+
var _useContext = useContext(LocaleContext),
|
|
21
|
+
locale = _useContext.locale;
|
|
22
|
+
var t = getTranslator(locale);
|
|
19
23
|
var onSearch = props.onSearch,
|
|
20
24
|
className = props.className,
|
|
21
25
|
_props$debounce = props.debounce,
|
|
@@ -60,7 +64,7 @@ export default function InputSearch(props) {
|
|
|
60
64
|
prefix: /*#__PURE__*/React.createElement(SearchLine, {
|
|
61
65
|
size: 16
|
|
62
66
|
}),
|
|
63
|
-
placeholder: placeholder ||
|
|
67
|
+
placeholder: placeholder || t.InputSearch.search,
|
|
64
68
|
allowClear: true,
|
|
65
69
|
defaultValue: defaultValue
|
|
66
70
|
}));
|
package/dist/List/Item.js
CHANGED
|
@@ -22,7 +22,8 @@ export var Meta = function Meta(_ref) {
|
|
|
22
22
|
var content = /*#__PURE__*/React.createElement("div", {
|
|
23
23
|
className: "".concat(prefixCls, "-item-meta-content")
|
|
24
24
|
}, title && /*#__PURE__*/React.createElement("div", {
|
|
25
|
-
className: classnames("".concat(prefixCls, "-item-meta-content-title"), _defineProperty({}, "".concat(prefixCls, "-item-meta-content-title-no-description"), !description))
|
|
25
|
+
className: classnames("".concat(prefixCls, "-item-meta-content-title"), _defineProperty({}, "".concat(prefixCls, "-item-meta-content-title-no-description"), !description)),
|
|
26
|
+
title: typeof title === 'string' ? title : ''
|
|
26
27
|
}, title), description && /*#__PURE__*/React.createElement("div", {
|
|
27
28
|
className: "".concat(prefixCls, "-item-meta-content-description"),
|
|
28
29
|
title: typeof description === 'string' ? description : ''
|
|
@@ -7,11 +7,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
7
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import _ from 'lodash';
|
|
10
|
-
import React, { useDeferredValue, useEffect, useState } from 'react';
|
|
10
|
+
import React, { useContext, useDeferredValue, useEffect, useState } from 'react';
|
|
11
11
|
import Empty from "../../Empty";
|
|
12
12
|
import { SearchLine } from "../../Icon";
|
|
13
13
|
import Input from "../../Input";
|
|
14
14
|
import Spin from "../../Spin";
|
|
15
|
+
import { LocaleContext, getTranslator } from "../../locale/default";
|
|
15
16
|
import { isUser } from "../utils/getUsersWithUserId";
|
|
16
17
|
import MultipleOption from "./MultipleOption";
|
|
17
18
|
import { userDisplayNameIsRepeated } from "./Panel";
|
|
@@ -19,6 +20,9 @@ import SingleOption from "./SingleOption";
|
|
|
19
20
|
export var OPTION_HEIGHT = 36;
|
|
20
21
|
export var WRAPPER_HEIGHT = 300;
|
|
21
22
|
export default function MemberSelection(props) {
|
|
23
|
+
var _useContext = useContext(LocaleContext),
|
|
24
|
+
locale = _useContext.locale;
|
|
25
|
+
var t = getTranslator(locale);
|
|
22
26
|
var className = props.className,
|
|
23
27
|
userList = props.userList,
|
|
24
28
|
multiple = props.multiple,
|
|
@@ -64,7 +68,7 @@ export default function MemberSelection(props) {
|
|
|
64
68
|
setSearchValue(e.target.value);
|
|
65
69
|
}
|
|
66
70
|
}), userList.length === 0 && !loading && /*#__PURE__*/React.createElement(Empty, {
|
|
67
|
-
title:
|
|
71
|
+
title: t.MemberPicker.noData,
|
|
68
72
|
size: "small",
|
|
69
73
|
image: Empty.PRESENTED_IMAGE_SEARCH,
|
|
70
74
|
className: "ald-member-picker-member-list-empty"
|
|
@@ -2,8 +2,9 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2
2
|
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; }
|
|
3
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
4
|
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); }
|
|
5
|
+
import { LocaleContext, getTranslator } from "../../locale/default";
|
|
5
6
|
import classnames from 'classnames';
|
|
6
|
-
import React from 'react';
|
|
7
|
+
import React, { useContext } from 'react';
|
|
7
8
|
import Checkbox from "../../Checkbox";
|
|
8
9
|
import { EUserType } from "../../ConfigProvider/getUserList";
|
|
9
10
|
import TextLink from "../../TextLink/index";
|
|
@@ -11,6 +12,9 @@ import { getAccount, getId, getPhoto } from "../utils";
|
|
|
11
12
|
import { isUserGroup } from "../utils/getUsersWithUserId";
|
|
12
13
|
import NickLabel from "./NickLabel";
|
|
13
14
|
export default function MultipleList(params) {
|
|
15
|
+
var _useContext = useContext(LocaleContext),
|
|
16
|
+
locale = _useContext.locale;
|
|
17
|
+
var t = getTranslator(locale);
|
|
14
18
|
var disabled = params.disabled,
|
|
15
19
|
user = params.user,
|
|
16
20
|
selected = params.selected,
|
|
@@ -54,5 +58,5 @@ export default function MultipleList(params) {
|
|
|
54
58
|
e.stopPropagation();
|
|
55
59
|
e.preventDefault();
|
|
56
60
|
}
|
|
57
|
-
},
|
|
61
|
+
}, t.MemberPicker.subLevel));
|
|
58
62
|
}
|
|
@@ -14,8 +14,9 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
import classNames from 'classnames';
|
|
16
16
|
import { EUserType } from "../../ConfigProvider/getUserList";
|
|
17
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
17
|
+
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
18
18
|
import Tabs from "../../Tabs";
|
|
19
|
+
import { LocaleContext, getTranslator } from "../../locale/default";
|
|
19
20
|
import { EMemberPicker } from "../interface";
|
|
20
21
|
import { getId } from "../utils";
|
|
21
22
|
import { isUser, isUserGroup } from "../utils/getUsersWithUserId";
|
|
@@ -30,6 +31,9 @@ export var userDisplayNameIsRepeated = function userDisplayNameIsRepeated(userLi
|
|
|
30
31
|
};
|
|
31
32
|
export default function Panel(props) {
|
|
32
33
|
var _classNames;
|
|
34
|
+
var _useContext = useContext(LocaleContext),
|
|
35
|
+
locale = _useContext.locale;
|
|
36
|
+
var t = getTranslator(locale);
|
|
33
37
|
var type = props.type,
|
|
34
38
|
multiple = props.multiple,
|
|
35
39
|
dropdownWidth = props.dropdownWidth,
|
|
@@ -123,17 +127,17 @@ export default function Panel(props) {
|
|
|
123
127
|
destroyInactiveTabPane: true,
|
|
124
128
|
items: [{
|
|
125
129
|
key: 'user',
|
|
126
|
-
label:
|
|
130
|
+
label: t.MemberPicker.users,
|
|
127
131
|
children: userSelection
|
|
128
132
|
}, {
|
|
129
133
|
key: 'userGroup',
|
|
130
|
-
label:
|
|
134
|
+
label: t.MemberPicker.userGroups,
|
|
131
135
|
children: userGroupSelection
|
|
132
136
|
}],
|
|
133
137
|
className: "ald-member-tabs"
|
|
134
138
|
});
|
|
135
139
|
}
|
|
136
|
-
}, [dataList, panelWidth, selectedUsers, onSelectionChange, onSearchValueChange, lockedIds, props.loading, type]);
|
|
140
|
+
}, [t, dataList, panelWidth, selectedUsers, onSelectionChange, onSearchValueChange, lockedIds, props.loading, type]);
|
|
137
141
|
return /*#__PURE__*/React.createElement("div", {
|
|
138
142
|
className: classNames(className, 'ald-member-picker-wrapper', (_classNames = {}, _defineProperty(_classNames, 'ald-member-picker-multiple', multiple), _defineProperty(_classNames, 'ald-member-picker-single', !multiple), _classNames)),
|
|
139
143
|
style: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IUserGroup, TUser, TUserGroupValue, TUserValue } from "../../ConfigProvider/getUserList";
|
|
2
1
|
import React from 'react';
|
|
2
|
+
import { IUserGroup, TUser, TUserGroupValue, TUserValue } from '../../ConfigProvider/getUserList';
|
|
3
3
|
import { EMemberPicker, IUser, MemberPickerValue } from '../interface';
|
|
4
4
|
interface IProps {
|
|
5
5
|
type: EMemberPicker;
|
|
@@ -7,10 +7,11 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
8
|
import { message } from "../..";
|
|
9
9
|
import ConfigProvider from "../../ConfigProvider";
|
|
10
|
-
import { EUserType } from "../../ConfigProvider/getUserList";
|
|
11
10
|
import { useRequest } from 'ahooks';
|
|
12
11
|
import _ from 'lodash';
|
|
13
|
-
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
12
|
+
import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import { EUserType } from "../../ConfigProvider/getUserList";
|
|
14
|
+
import { LocaleContext, getTranslator } from "../../locale/default";
|
|
14
15
|
import { isUser, isUserGroup } from "../utils/getUsersWithUserId";
|
|
15
16
|
import Panel from "./Panel";
|
|
16
17
|
export var PanelWrapper = function PanelWrapper(_ref) {
|
|
@@ -23,6 +24,9 @@ export var PanelWrapper = function PanelWrapper(_ref) {
|
|
|
23
24
|
className = _ref.className,
|
|
24
25
|
_ref$lockedIds = _ref.lockedIds,
|
|
25
26
|
lockedIds = _ref$lockedIds === void 0 ? [] : _ref$lockedIds;
|
|
27
|
+
var _useContext = useContext(LocaleContext),
|
|
28
|
+
locale = _useContext.locale;
|
|
29
|
+
var t = getTranslator(locale);
|
|
26
30
|
var _ConfigProvider$useGe = ConfigProvider.useGetUserList(),
|
|
27
31
|
getUsersByIds = _ConfigProvider$useGe.getUsersByIds,
|
|
28
32
|
getUsersByKeywords = _ConfigProvider$useGe.getUsersByKeywords;
|
|
@@ -48,10 +52,10 @@ export var PanelWrapper = function PanelWrapper(_ref) {
|
|
|
48
52
|
return function (_ref2) {
|
|
49
53
|
_objectDestructuringEmpty(_ref2);
|
|
50
54
|
return Promise.reject({
|
|
51
|
-
message:
|
|
55
|
+
message: t.MemberPicker.pleaseConfigGetUserByKeywordsMethod
|
|
52
56
|
});
|
|
53
57
|
};
|
|
54
|
-
}, [getUsersByKeywords]);
|
|
58
|
+
}, [getUsersByKeywords, t.MemberPicker.pleaseConfigGetUserByKeywordsMethod]);
|
|
55
59
|
var queryByIds = useMemo(function () {
|
|
56
60
|
if (getUsersByIds) {
|
|
57
61
|
return getUsersByIds;
|
|
@@ -59,10 +63,10 @@ export var PanelWrapper = function PanelWrapper(_ref) {
|
|
|
59
63
|
return function (_ref3) {
|
|
60
64
|
_objectDestructuringEmpty(_ref3);
|
|
61
65
|
return Promise.reject({
|
|
62
|
-
message:
|
|
66
|
+
message: t.MemberPicker.pleaseConfigGetUserByIdsMethod
|
|
63
67
|
});
|
|
64
68
|
};
|
|
65
|
-
}, [getUsersByIds]);
|
|
69
|
+
}, [getUsersByIds, t.MemberPicker.pleaseConfigGetUserByIdsMethod]);
|
|
66
70
|
var _useRequest = useRequest(function () {
|
|
67
71
|
return queryByKeywords(searchString);
|
|
68
72
|
}, {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { LocaleContext, getTranslator } from "../../locale/default";
|
|
1
2
|
import classNames from 'classnames';
|
|
2
3
|
import _ from 'lodash';
|
|
3
|
-
import React from 'react';
|
|
4
|
+
import React, { useContext } from 'react';
|
|
4
5
|
import { CloseMLine } from "../../Icon";
|
|
5
6
|
import ScrollArea from "../../ScrollArea";
|
|
6
7
|
import { getAccount, getId, getPhoto } from "../utils";
|
|
@@ -13,11 +14,14 @@ export default function SelectedMemberTags(props) {
|
|
|
13
14
|
_props$lockedIds = props.lockedIds,
|
|
14
15
|
lockedIds = _props$lockedIds === void 0 ? [] : _props$lockedIds,
|
|
15
16
|
userList = props.userList;
|
|
17
|
+
var _useContext = useContext(LocaleContext),
|
|
18
|
+
locale = _useContext.locale;
|
|
19
|
+
var t = getTranslator(locale);
|
|
16
20
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
21
|
className: classNames(className, 'ald-member-picker-selected-member-tags-wrap')
|
|
18
22
|
}, /*#__PURE__*/React.createElement("div", {
|
|
19
23
|
className: 'ald-member-picker-has-selected'
|
|
20
|
-
},
|
|
24
|
+
}, t.MemberPicker.selectedTotal(selectedUsers.length)), /*#__PURE__*/React.createElement(ScrollArea, {
|
|
21
25
|
style: {
|
|
22
26
|
maxHeight: 'calc(100% - 20px)',
|
|
23
27
|
overflow: 'hidden'
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
3
|
import Button from "../../Button";
|
|
4
|
+
import { LocaleContext, getTranslator } from "../../locale/default";
|
|
4
5
|
export default function SelectorFooter(props) {
|
|
6
|
+
var _useContext = useContext(LocaleContext),
|
|
7
|
+
locale = _useContext.locale;
|
|
8
|
+
var t = getTranslator(locale);
|
|
5
9
|
var className = props.className;
|
|
6
10
|
return /*#__PURE__*/React.createElement("div", {
|
|
7
11
|
className: classNames(className, 'ald-member-picker-footer')
|
|
8
12
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
9
13
|
onClick: props.onCancel,
|
|
10
14
|
type: "secondary"
|
|
11
|
-
},
|
|
15
|
+
}, t.MemberPicker.cancel), /*#__PURE__*/React.createElement(Button, {
|
|
12
16
|
onClick: props.onOk,
|
|
13
17
|
type: "primary"
|
|
14
|
-
},
|
|
18
|
+
}, t.MemberPicker.confirm));
|
|
15
19
|
}
|
|
@@ -2,14 +2,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2
2
|
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; }
|
|
3
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
4
|
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); }
|
|
5
|
+
import { LocaleContext, getTranslator } from "../../locale/default";
|
|
5
6
|
import classnames from 'classnames';
|
|
6
|
-
import React from 'react';
|
|
7
|
+
import React, { useContext } from 'react';
|
|
7
8
|
import { EUserType } from "../../ConfigProvider/getUserList";
|
|
8
9
|
import TextLink from "../../TextLink/index";
|
|
9
10
|
import { getAccount, getId, getPhoto } from "../utils";
|
|
10
11
|
import { isUserGroup } from "../utils/getUsersWithUserId";
|
|
11
12
|
import NickLabel from "./NickLabel";
|
|
12
13
|
export default function SingleOption(params) {
|
|
14
|
+
var _useContext = useContext(LocaleContext),
|
|
15
|
+
locale = _useContext.locale;
|
|
16
|
+
var t = getTranslator(locale);
|
|
13
17
|
var disabled = params.disabled,
|
|
14
18
|
user = params.user,
|
|
15
19
|
selected = params.selected,
|
|
@@ -48,5 +52,5 @@ export default function SingleOption(params) {
|
|
|
48
52
|
e.stopPropagation();
|
|
49
53
|
e.preventDefault();
|
|
50
54
|
}
|
|
51
|
-
},
|
|
55
|
+
}, t.MemberPicker.subLevel));
|
|
52
56
|
}
|
|
@@ -7,12 +7,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
7
|
import { Breadcrumb } from 'antd';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import _ from 'lodash';
|
|
10
|
-
import React, { useState } from 'react';
|
|
10
|
+
import React, { useContext, useState } from 'react';
|
|
11
11
|
import Empty from "../../Empty";
|
|
12
12
|
import { ChevronLeftLine, SearchLine } from "../../Icon";
|
|
13
13
|
import Input from "../../Input";
|
|
14
14
|
import ScrollArea from "../../ScrollArea";
|
|
15
15
|
import Spin from "../../Spin";
|
|
16
|
+
import { LocaleContext, getTranslator } from "../../locale/default";
|
|
16
17
|
import { isUserGroup } from "../utils/getUsersWithUserId";
|
|
17
18
|
import MultipleOption from "./MultipleOption";
|
|
18
19
|
import SingleOption from "./SingleOption";
|
|
@@ -25,6 +26,9 @@ var UserGroupSelection = function UserGroupSelection(_ref) {
|
|
|
25
26
|
loading = _ref.loading,
|
|
26
27
|
width = _ref.width,
|
|
27
28
|
lockedIds = _ref.lockedIds;
|
|
29
|
+
var _useContext = useContext(LocaleContext),
|
|
30
|
+
locale = _useContext.locale;
|
|
31
|
+
var t = getTranslator(locale);
|
|
28
32
|
var _useState = useState(''),
|
|
29
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
30
34
|
searchKey = _useState2[0],
|
|
@@ -68,7 +72,7 @@ var UserGroupSelection = function UserGroupSelection(_ref) {
|
|
|
68
72
|
setSearchKey(e.target.value);
|
|
69
73
|
}
|
|
70
74
|
}), userGroupList.length === 0 && !loading && /*#__PURE__*/React.createElement(Empty, {
|
|
71
|
-
title:
|
|
75
|
+
title: t.MemberPicker.noData,
|
|
72
76
|
size: "small",
|
|
73
77
|
image: Empty.PRESENTED_IMAGE_SEARCH,
|
|
74
78
|
className: "ald-member-picker-member-list-empty"
|
|
@@ -85,7 +89,7 @@ var UserGroupSelection = function UserGroupSelection(_ref) {
|
|
|
85
89
|
className: "ald-member-picker-breadcrumb-item-inner"
|
|
86
90
|
}, /*#__PURE__*/React.createElement(ChevronLeftLine, {
|
|
87
91
|
size: 16
|
|
88
|
-
}),
|
|
92
|
+
}), t.MemberPicker.userGroups)), groupPath.map(function (group) {
|
|
89
93
|
return /*#__PURE__*/React.createElement(Breadcrumb.Item, {
|
|
90
94
|
className: "ald-member-picker-breadcrumb-item",
|
|
91
95
|
key: group.groupId,
|
|
@@ -17,39 +17,43 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
17
17
|
import { usePrevious, useRequest } from 'ahooks';
|
|
18
18
|
import classNames from 'classnames';
|
|
19
19
|
import _ from 'lodash';
|
|
20
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
20
|
+
import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
21
21
|
import Avatar from "../Avatar";
|
|
22
22
|
import ConfigProvider from "../ConfigProvider";
|
|
23
23
|
import { EUserType } from "../ConfigProvider/getUserList";
|
|
24
24
|
import { UserGroup } from "../Icon";
|
|
25
25
|
import Select from "../Select";
|
|
26
|
+
import { LocaleContext, getTranslator } from "../locale/default";
|
|
26
27
|
import message from "../message";
|
|
27
28
|
import Panel from "./components/Panel";
|
|
28
29
|
import MemberPanel from "./components/PanelWrapper";
|
|
29
30
|
import { EMemberPicker } from "./interface";
|
|
30
31
|
import { isUser, isUserGroup } from "./utils/getUsersWithUserId";
|
|
31
|
-
var Component = function Component(
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
32
|
+
var Component = function Component(props) {
|
|
33
|
+
var _useContext = useContext(LocaleContext),
|
|
34
|
+
locale = _useContext.locale;
|
|
35
|
+
var t = getTranslator(locale);
|
|
36
|
+
var value = props.value,
|
|
37
|
+
_props$type = props.type,
|
|
38
|
+
type = _props$type === void 0 ? EMemberPicker.USER : _props$type,
|
|
39
|
+
onChange = props.onChange,
|
|
40
|
+
multiple = props.multiple,
|
|
41
|
+
dropdownWidth = props.dropdownWidth,
|
|
42
|
+
open = props.open,
|
|
43
|
+
onOpenChange = props.onOpenChange,
|
|
44
|
+
_props$placeholder = props.placeholder,
|
|
45
|
+
placeholder = _props$placeholder === void 0 ? t.MemberPicker.select : _props$placeholder,
|
|
46
|
+
className = props.className,
|
|
47
|
+
allowClear = props.allowClear,
|
|
48
|
+
disabled = props.disabled,
|
|
49
|
+
_onClear = props.onClear,
|
|
50
|
+
size = props.size,
|
|
51
|
+
_props$selectType = props.selectType,
|
|
52
|
+
selectType = _props$selectType === void 0 ? 'secondary' : _props$selectType,
|
|
53
|
+
propPrefix = props.prefix,
|
|
54
|
+
_props$lockedIds = props.lockedIds,
|
|
55
|
+
lockedIds = _props$lockedIds === void 0 ? [] : _props$lockedIds,
|
|
56
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
53
57
|
var _ConfigProvider$useGe = ConfigProvider.useGetUserList(),
|
|
54
58
|
getUsersByIds = _ConfigProvider$useGe.getUsersByIds,
|
|
55
59
|
getUsersByKeywords = _ConfigProvider$useGe.getUsersByKeywords;
|
|
@@ -82,24 +86,24 @@ var Component = function Component(_ref) {
|
|
|
82
86
|
if (getUsersByKeywords) {
|
|
83
87
|
return getUsersByKeywords;
|
|
84
88
|
}
|
|
85
|
-
return function (
|
|
86
|
-
_objectDestructuringEmpty(
|
|
89
|
+
return function (_ref) {
|
|
90
|
+
_objectDestructuringEmpty(_ref);
|
|
87
91
|
return Promise.reject({
|
|
88
|
-
message:
|
|
92
|
+
message: t.MemberPicker.pleaseConfigGetUserByKeywordsMethod
|
|
89
93
|
});
|
|
90
94
|
};
|
|
91
|
-
}, [getUsersByKeywords]);
|
|
95
|
+
}, [getUsersByKeywords, t.MemberPicker.pleaseConfigGetUserByKeywordsMethod]);
|
|
92
96
|
var queryByIds = useMemo(function () {
|
|
93
97
|
if (getUsersByIds) {
|
|
94
98
|
return getUsersByIds;
|
|
95
99
|
}
|
|
96
|
-
return function (
|
|
97
|
-
_objectDestructuringEmpty(
|
|
100
|
+
return function (_ref2) {
|
|
101
|
+
_objectDestructuringEmpty(_ref2);
|
|
98
102
|
return Promise.reject({
|
|
99
|
-
message:
|
|
103
|
+
message: t.MemberPicker.pleaseConfigGetUserByIdsMethod
|
|
100
104
|
});
|
|
101
105
|
};
|
|
102
|
-
}, [getUsersByIds]);
|
|
106
|
+
}, [getUsersByIds, t.MemberPicker.pleaseConfigGetUserByIdsMethod]);
|
|
103
107
|
var _useRequest = useRequest(function () {
|
|
104
108
|
return queryByKeywords(searchString);
|
|
105
109
|
}, {
|