@douyinfe/semi-ui 2.29.0 → 2.30.0-beta.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/css/semi.css +9 -2
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +170 -81
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/cascader/index.d.ts +2 -0
- package/lib/cjs/cascader/index.js +8 -0
- package/lib/cjs/locale/source/ar.js +5 -5
- package/lib/cjs/locale/source/de.js +5 -5
- package/lib/cjs/locale/source/en_GB.js +5 -5
- package/lib/cjs/locale/source/en_US.js +4 -4
- package/lib/cjs/locale/source/es.js +5 -5
- package/lib/cjs/locale/source/fr.js +5 -5
- package/lib/cjs/locale/source/id_ID.js +4 -4
- package/lib/cjs/locale/source/it.js +5 -5
- package/lib/cjs/locale/source/ja_JP.js +5 -5
- package/lib/cjs/locale/source/ko_KR.js +4 -4
- package/lib/cjs/locale/source/ms_MY.js +4 -4
- package/lib/cjs/locale/source/nl_NL.d.ts +1 -1
- package/lib/cjs/locale/source/nl_NL.js +6 -6
- package/lib/cjs/locale/source/pl_PL.js +4 -4
- package/lib/cjs/locale/source/pt_BR.js +5 -5
- package/lib/cjs/locale/source/ro.d.ts +13 -0
- package/lib/cjs/locale/source/ro.js +17 -4
- package/lib/cjs/locale/source/ru_RU.js +4 -4
- package/lib/cjs/locale/source/sv_SE.js +4 -4
- package/lib/cjs/locale/source/th_TH.js +5 -5
- package/lib/cjs/locale/source/tr_TR.js +5 -5
- package/lib/cjs/locale/source/vi_VN.js +5 -5
- package/lib/cjs/locale/source/zh_CN.js +4 -4
- package/lib/cjs/locale/source/zh_TW.js +4 -4
- package/lib/cjs/popconfirm/index.d.ts +11 -7
- package/lib/cjs/popconfirm/index.js +97 -60
- package/lib/cjs/popover/index.d.ts +7 -1
- package/lib/cjs/popover/index.js +15 -3
- package/lib/cjs/tooltip/index.d.ts +7 -3
- package/lib/cjs/tooltip/index.js +10 -0
- package/lib/es/cascader/index.d.ts +2 -0
- package/lib/es/cascader/index.js +8 -0
- package/lib/es/locale/source/ar.js +5 -5
- package/lib/es/locale/source/de.js +5 -5
- package/lib/es/locale/source/en_GB.js +5 -5
- package/lib/es/locale/source/en_US.js +4 -4
- package/lib/es/locale/source/es.js +5 -5
- package/lib/es/locale/source/fr.js +5 -5
- package/lib/es/locale/source/id_ID.js +4 -4
- package/lib/es/locale/source/it.js +5 -5
- package/lib/es/locale/source/ja_JP.js +5 -5
- package/lib/es/locale/source/ko_KR.js +4 -4
- package/lib/es/locale/source/ms_MY.js +4 -4
- package/lib/es/locale/source/nl_NL.d.ts +1 -1
- package/lib/es/locale/source/nl_NL.js +6 -6
- package/lib/es/locale/source/pl_PL.js +4 -4
- package/lib/es/locale/source/pt_BR.js +5 -5
- package/lib/es/locale/source/ro.d.ts +13 -0
- package/lib/es/locale/source/ro.js +17 -4
- package/lib/es/locale/source/ru_RU.js +4 -4
- package/lib/es/locale/source/sv_SE.js +4 -4
- package/lib/es/locale/source/th_TH.js +5 -5
- package/lib/es/locale/source/tr_TR.js +5 -5
- package/lib/es/locale/source/vi_VN.js +5 -5
- package/lib/es/locale/source/zh_CN.js +4 -4
- package/lib/es/locale/source/zh_TW.js +4 -4
- package/lib/es/popconfirm/index.d.ts +11 -7
- package/lib/es/popconfirm/index.js +95 -60
- package/lib/es/popover/index.d.ts +7 -1
- package/lib/es/popover/index.js +15 -3
- package/lib/es/tooltip/index.d.ts +7 -3
- package/lib/es/tooltip/index.js +10 -0
- package/package.json +9 -9
|
@@ -11,8 +11,8 @@ const local = {
|
|
|
11
11
|
code: 'zh-TW',
|
|
12
12
|
dateFnsLocale: _locale.zhTW,
|
|
13
13
|
Pagination: {
|
|
14
|
-
pageSize: '
|
|
15
|
-
total: '
|
|
14
|
+
pageSize: '每頁項目數:${pageSize}',
|
|
15
|
+
total: '總頁數:${total}',
|
|
16
16
|
jumpTo: '跳至',
|
|
17
17
|
page: '頁'
|
|
18
18
|
},
|
|
@@ -153,8 +153,8 @@ const local = {
|
|
|
153
153
|
clear: '清空',
|
|
154
154
|
selectAll: '全選',
|
|
155
155
|
clearSelectAll: '取消全選',
|
|
156
|
-
total: '
|
|
157
|
-
selected: '
|
|
156
|
+
total: '總項目數:${total}',
|
|
157
|
+
selected: '選取的項目數:${total}'
|
|
158
158
|
},
|
|
159
159
|
Form: {
|
|
160
160
|
optional: '(可選)'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { PopconfirmAdapter } from '@douyinfe/semi-foundation/lib/cjs/popconfirm/popconfirmFoundation';
|
|
3
|
+
import PopconfirmFoundation, { PopconfirmAdapter } from '@douyinfe/semi-foundation/lib/cjs/popconfirm/popconfirmFoundation';
|
|
4
4
|
import BaseComponent from '../_base/baseComponent';
|
|
5
|
-
import { PopoverProps } from '../popover';
|
|
6
|
-
import { Position, Trigger } from '../tooltip';
|
|
5
|
+
import Popover, { PopoverProps } from '../popover';
|
|
6
|
+
import { Position, Trigger, RenderContentProps } from '../tooltip';
|
|
7
7
|
import { ButtonProps } from '../button';
|
|
8
8
|
import { Type as ButtonType } from '../button/Button';
|
|
9
9
|
import { ContextValue } from '../configProvider/context';
|
|
@@ -12,7 +12,6 @@ export interface PopconfirmProps extends PopoverProps {
|
|
|
12
12
|
cancelText?: string;
|
|
13
13
|
cancelButtonProps?: ButtonProps;
|
|
14
14
|
cancelType?: ButtonType;
|
|
15
|
-
content?: React.ReactNode;
|
|
16
15
|
defaultVisible?: boolean;
|
|
17
16
|
disabled?: boolean;
|
|
18
17
|
icon?: React.ReactNode;
|
|
@@ -41,7 +40,7 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
41
40
|
static propTypes: {
|
|
42
41
|
motion: PropTypes.Requireable<NonNullable<boolean | object>>;
|
|
43
42
|
disabled: PropTypes.Requireable<boolean>;
|
|
44
|
-
content: PropTypes.Requireable<any
|
|
43
|
+
content: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
|
|
45
44
|
title: PropTypes.Requireable<any>;
|
|
46
45
|
prefixCls: PropTypes.Requireable<string>;
|
|
47
46
|
className: PropTypes.Requireable<string>;
|
|
@@ -78,6 +77,9 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
78
77
|
onConfirm: (...args: any[]) => void;
|
|
79
78
|
onClickOutSide: (...args: any[]) => void;
|
|
80
79
|
};
|
|
80
|
+
footerRef: React.RefObject<HTMLDivElement | null>;
|
|
81
|
+
popoverRef: React.RefObject<Popover | null>;
|
|
82
|
+
foundation: PopconfirmFoundation;
|
|
81
83
|
constructor(props: PopconfirmProps);
|
|
82
84
|
context: ContextValue;
|
|
83
85
|
static getDerivedStateFromProps(props: PopconfirmProps, state: PopconfirmState): Partial<PopconfirmState>;
|
|
@@ -85,9 +87,11 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
|
|
|
85
87
|
handleCancel: (e: React.MouseEvent) => void;
|
|
86
88
|
handleConfirm: (e: React.MouseEvent) => void;
|
|
87
89
|
handleVisibleChange: (visible: boolean) => void;
|
|
88
|
-
handleClickOutSide: (e: React.MouseEvent) =>
|
|
90
|
+
handleClickOutSide: (e: React.MouseEvent) => void;
|
|
89
91
|
stopImmediatePropagation: (e: React.SyntheticEvent) => void;
|
|
90
92
|
renderControls(): JSX.Element;
|
|
91
|
-
renderConfirmPopCard(
|
|
93
|
+
renderConfirmPopCard: ({ initialFocusRef }: {
|
|
94
|
+
initialFocusRef?: RenderContentProps<any>['initialFocusRef'];
|
|
95
|
+
}) => JSX.Element;
|
|
92
96
|
render(): string | number | boolean | React.ReactFragment | JSX.Element;
|
|
93
97
|
}
|
|
@@ -5,6 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
var _omit2 = _interopRequireDefault(require("lodash/omit"));
|
|
9
|
+
|
|
10
|
+
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
11
|
+
|
|
8
12
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
9
13
|
|
|
10
14
|
var _noop2 = _interopRequireDefault(require("lodash/noop"));
|
|
@@ -62,12 +66,74 @@ class Popconfirm extends _baseComponent.default {
|
|
|
62
66
|
|
|
63
67
|
this.stopImmediatePropagation = e => e && e.nativeEvent && e.nativeEvent.stopImmediatePropagation();
|
|
64
68
|
|
|
69
|
+
this.renderConfirmPopCard = _ref => {
|
|
70
|
+
let {
|
|
71
|
+
initialFocusRef
|
|
72
|
+
} = _ref;
|
|
73
|
+
const {
|
|
74
|
+
content,
|
|
75
|
+
title,
|
|
76
|
+
className,
|
|
77
|
+
style,
|
|
78
|
+
cancelType,
|
|
79
|
+
icon,
|
|
80
|
+
prefixCls
|
|
81
|
+
} = this.props;
|
|
82
|
+
const {
|
|
83
|
+
direction
|
|
84
|
+
} = this.context;
|
|
85
|
+
const popCardCls = (0, _classnames.default)(prefixCls, className, {
|
|
86
|
+
[`${prefixCls}-rtl`]: direction === 'rtl'
|
|
87
|
+
});
|
|
88
|
+
const showTitle = title !== null && typeof title !== 'undefined';
|
|
89
|
+
const showContent = !(content === null || typeof content === 'undefined');
|
|
90
|
+
return (
|
|
91
|
+
/*#__PURE__*/
|
|
92
|
+
|
|
93
|
+
/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */
|
|
94
|
+
_react.default.createElement("div", {
|
|
95
|
+
className: popCardCls,
|
|
96
|
+
onClick: this.stopImmediatePropagation,
|
|
97
|
+
style: style
|
|
98
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
99
|
+
className: `${prefixCls}-inner`
|
|
100
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
className: `${prefixCls}-header`
|
|
102
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
103
|
+
className: `${prefixCls}-header-icon`,
|
|
104
|
+
"x-semi-prop": "icon"
|
|
105
|
+
}, /*#__PURE__*/_react.default.isValidElement(icon) ? icon : null), /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
+
className: `${prefixCls}-header-body`
|
|
107
|
+
}, showTitle ? /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
+
className: `${prefixCls}-header-title`,
|
|
109
|
+
"x-semi-prop": "title"
|
|
110
|
+
}, title) : null), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
111
|
+
className: `${prefixCls}-btn-close`,
|
|
112
|
+
icon: /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, null),
|
|
113
|
+
size: "small",
|
|
114
|
+
theme: 'borderless',
|
|
115
|
+
type: cancelType,
|
|
116
|
+
onClick: this.handleCancel
|
|
117
|
+
})), showContent ? /*#__PURE__*/_react.default.createElement("div", {
|
|
118
|
+
className: `${prefixCls}-body`,
|
|
119
|
+
"x-semi-prop": "content"
|
|
120
|
+
}, (0, _isFunction2.default)(content) ? content({
|
|
121
|
+
initialFocusRef
|
|
122
|
+
}) : content) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
+
className: `${prefixCls}-footer`,
|
|
124
|
+
ref: this.footerRef
|
|
125
|
+
}, this.renderControls())))
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
65
129
|
this.state = {
|
|
66
130
|
cancelLoading: false,
|
|
67
131
|
confirmLoading: false,
|
|
68
132
|
visible: props.defaultVisible || false
|
|
69
133
|
};
|
|
70
134
|
this.foundation = new _popconfirmFoundation.default(this.adapter);
|
|
135
|
+
this.footerRef = /*#__PURE__*/_react.default.createRef();
|
|
136
|
+
this.popoverRef = /*#__PURE__*/_react.default.createRef();
|
|
71
137
|
}
|
|
72
138
|
|
|
73
139
|
static getDerivedStateFromProps(props, state) {
|
|
@@ -97,7 +163,28 @@ class Popconfirm extends _baseComponent.default {
|
|
|
97
163
|
notifyConfirm: e => this.props.onConfirm(e),
|
|
98
164
|
notifyCancel: e => this.props.onCancel(e),
|
|
99
165
|
notifyVisibleChange: visible => this.props.onVisibleChange(visible),
|
|
100
|
-
notifyClickOutSide: e => this.props.onClickOutSide(e)
|
|
166
|
+
notifyClickOutSide: e => this.props.onClickOutSide(e),
|
|
167
|
+
focusCancelButton: () => {
|
|
168
|
+
var _a, _b;
|
|
169
|
+
|
|
170
|
+
const buttonNode = (_b = (_a = this.footerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.querySelector('[data-type=cancel]');
|
|
171
|
+
buttonNode === null || buttonNode === void 0 ? void 0 : buttonNode.focus({
|
|
172
|
+
preventScroll: true
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
focusOkButton: () => {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
|
|
178
|
+
const buttonNode = (_b = (_a = this.footerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.querySelector('[data-type=ok]');
|
|
179
|
+
buttonNode === null || buttonNode === void 0 ? void 0 : buttonNode.focus({
|
|
180
|
+
preventScroll: true
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
focusPrevFocusElement: () => {
|
|
184
|
+
var _a;
|
|
185
|
+
|
|
186
|
+
(_a = this.popoverRef.current) === null || _a === void 0 ? void 0 : _a.focusTrigger();
|
|
187
|
+
}
|
|
101
188
|
});
|
|
102
189
|
}
|
|
103
190
|
|
|
@@ -117,68 +204,17 @@ class Popconfirm extends _baseComponent.default {
|
|
|
117
204
|
return /*#__PURE__*/_react.default.createElement(_localeConsumer.default, {
|
|
118
205
|
componentName: "Popconfirm"
|
|
119
206
|
}, (locale, localeCode) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_button.default, Object.assign({
|
|
207
|
+
"data-type": "cancel",
|
|
120
208
|
type: cancelType,
|
|
121
209
|
onClick: this.handleCancel,
|
|
122
210
|
loading: cancelLoading
|
|
123
|
-
}, cancelButtonProps), cancelText || (0, _get2.default)(locale, 'cancel')), /*#__PURE__*/_react.default.createElement(_button.default, Object.assign({
|
|
211
|
+
}, (0, _omit2.default)(cancelButtonProps, 'autoFocus')), cancelText || (0, _get2.default)(locale, 'cancel')), /*#__PURE__*/_react.default.createElement(_button.default, Object.assign({
|
|
212
|
+
"data-type": "ok",
|
|
124
213
|
type: okType,
|
|
125
214
|
theme: "solid",
|
|
126
215
|
onClick: this.handleConfirm,
|
|
127
216
|
loading: confirmLoading
|
|
128
|
-
}, okButtonProps), okText || (0, _get2.default)(locale, 'confirm'))));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
renderConfirmPopCard() {
|
|
132
|
-
const {
|
|
133
|
-
content,
|
|
134
|
-
title,
|
|
135
|
-
className,
|
|
136
|
-
style,
|
|
137
|
-
cancelType,
|
|
138
|
-
icon,
|
|
139
|
-
prefixCls
|
|
140
|
-
} = this.props;
|
|
141
|
-
const {
|
|
142
|
-
direction
|
|
143
|
-
} = this.context;
|
|
144
|
-
const popCardCls = (0, _classnames.default)(prefixCls, className, {
|
|
145
|
-
[`${prefixCls}-rtl`]: direction === 'rtl'
|
|
146
|
-
});
|
|
147
|
-
const showTitle = title !== null && typeof title !== 'undefined';
|
|
148
|
-
const showContent = !(content === null || typeof content === 'undefined');
|
|
149
|
-
return (
|
|
150
|
-
/*#__PURE__*/
|
|
151
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
152
|
-
_react.default.createElement("div", {
|
|
153
|
-
className: popCardCls,
|
|
154
|
-
onClick: this.stopImmediatePropagation,
|
|
155
|
-
style: style
|
|
156
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
157
|
-
className: `${prefixCls}-inner`
|
|
158
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
159
|
-
className: `${prefixCls}-header`
|
|
160
|
-
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
161
|
-
className: `${prefixCls}-header-icon`,
|
|
162
|
-
"x-semi-prop": "icon"
|
|
163
|
-
}, /*#__PURE__*/_react.default.isValidElement(icon) ? icon : null), /*#__PURE__*/_react.default.createElement("div", {
|
|
164
|
-
className: `${prefixCls}-header-body`
|
|
165
|
-
}, showTitle ? /*#__PURE__*/_react.default.createElement("div", {
|
|
166
|
-
className: `${prefixCls}-header-title`,
|
|
167
|
-
"x-semi-prop": "title"
|
|
168
|
-
}, title) : null), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
169
|
-
className: `${prefixCls}-btn-close`,
|
|
170
|
-
icon: /*#__PURE__*/_react.default.createElement(_semiIcons.IconClose, null),
|
|
171
|
-
size: "small",
|
|
172
|
-
theme: 'borderless',
|
|
173
|
-
type: cancelType,
|
|
174
|
-
onClick: this.handleCancel
|
|
175
|
-
})), showContent ? /*#__PURE__*/_react.default.createElement("div", {
|
|
176
|
-
className: `${prefixCls}-body`,
|
|
177
|
-
"x-semi-prop": "content"
|
|
178
|
-
}, content) : null, /*#__PURE__*/_react.default.createElement("div", {
|
|
179
|
-
className: `${prefixCls}-footer`
|
|
180
|
-
}, this.renderControls())))
|
|
181
|
-
);
|
|
217
|
+
}, (0, _omit2.default)(okButtonProps, 'autoFocus')), okText || (0, _get2.default)(locale, 'confirm'))));
|
|
182
218
|
}
|
|
183
219
|
|
|
184
220
|
render() {
|
|
@@ -206,7 +242,6 @@ class Popconfirm extends _baseComponent.default {
|
|
|
206
242
|
const {
|
|
207
243
|
visible
|
|
208
244
|
} = this.state;
|
|
209
|
-
const popContent = this.renderConfirmPopCard();
|
|
210
245
|
const popProps = {
|
|
211
246
|
onVisibleChange: this.handleVisibleChange,
|
|
212
247
|
className: _constants.cssClasses.POPOVER,
|
|
@@ -217,8 +252,10 @@ class Popconfirm extends _baseComponent.default {
|
|
|
217
252
|
popProps.trigger = 'custom';
|
|
218
253
|
}
|
|
219
254
|
|
|
220
|
-
return /*#__PURE__*/_react.default.createElement(_popover.default, Object.assign({
|
|
221
|
-
|
|
255
|
+
return /*#__PURE__*/_react.default.createElement(_popover.default, Object.assign({
|
|
256
|
+
ref: this.popoverRef
|
|
257
|
+
}, attrs, {
|
|
258
|
+
content: this.renderConfirmPopCard,
|
|
222
259
|
visible: visible,
|
|
223
260
|
position: position
|
|
224
261
|
}, popProps), children);
|
|
@@ -231,7 +268,7 @@ Popconfirm.contextType = _context.default;
|
|
|
231
268
|
Popconfirm.propTypes = {
|
|
232
269
|
motion: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.func, _propTypes.default.object]),
|
|
233
270
|
disabled: _propTypes.default.bool,
|
|
234
|
-
content: _propTypes.default.
|
|
271
|
+
content: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
235
272
|
title: _propTypes.default.any,
|
|
236
273
|
prefixCls: _propTypes.default.string,
|
|
237
274
|
className: _propTypes.default.string,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { ContextValue } from '../configProvider/context';
|
|
4
|
-
import { ArrowBounding, Position, TooltipProps, Trigger, RenderContentProps } from '../tooltip/index';
|
|
4
|
+
import Tooltip, { ArrowBounding, Position, TooltipProps, Trigger, RenderContentProps } from '../tooltip/index';
|
|
5
5
|
import '@douyinfe/semi-foundation/lib/cjs/popover/popover.css';
|
|
6
6
|
import { BaseProps } from '../_base/baseComponent';
|
|
7
7
|
import type { ArrowProps } from './Arrow';
|
|
@@ -101,6 +101,12 @@ declare class Popover extends React.PureComponent<PopoverProps, PopoverState> {
|
|
|
101
101
|
disableFocusListener: boolean;
|
|
102
102
|
};
|
|
103
103
|
context: ContextValue;
|
|
104
|
+
tooltipRef: React.RefObject<Tooltip | null>;
|
|
105
|
+
constructor(props: PopoverProps);
|
|
106
|
+
/**
|
|
107
|
+
* focus on tooltip trigger
|
|
108
|
+
*/
|
|
109
|
+
focusTrigger: () => void;
|
|
104
110
|
renderPopCard: ({ initialFocusRef }: {
|
|
105
111
|
initialFocusRef: RenderContentProps['initialFocusRef'];
|
|
106
112
|
}) => JSX.Element;
|
package/lib/cjs/popover/index.js
CHANGED
|
@@ -42,8 +42,17 @@ const positionSet = _constants.strings.POSITION_SET;
|
|
|
42
42
|
const triggerSet = _constants.strings.TRIGGER_SET;
|
|
43
43
|
|
|
44
44
|
class Popover extends _react.default.PureComponent {
|
|
45
|
-
constructor() {
|
|
46
|
-
super(
|
|
45
|
+
constructor(props) {
|
|
46
|
+
super(props);
|
|
47
|
+
/**
|
|
48
|
+
* focus on tooltip trigger
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
this.focusTrigger = () => {
|
|
52
|
+
var _a;
|
|
53
|
+
|
|
54
|
+
(_a = this.tooltipRef.current) === null || _a === void 0 ? void 0 : _a.focusTrigger();
|
|
55
|
+
};
|
|
47
56
|
|
|
48
57
|
this.renderPopCard = _ref => {
|
|
49
58
|
let {
|
|
@@ -81,6 +90,8 @@ class Popover extends _react.default.PureComponent {
|
|
|
81
90
|
};
|
|
82
91
|
return !(0, _isFunction2.default)(content) ? content : content(contentProps);
|
|
83
92
|
};
|
|
93
|
+
|
|
94
|
+
this.tooltipRef = /*#__PURE__*/_react.default.createRef();
|
|
84
95
|
}
|
|
85
96
|
|
|
86
97
|
render() {
|
|
@@ -114,7 +125,8 @@ class Popover extends _react.default.PureComponent {
|
|
|
114
125
|
|
|
115
126
|
const role = trigger === 'click' || trigger === 'custom' ? 'dialog' : 'tooltip';
|
|
116
127
|
return /*#__PURE__*/_react.default.createElement(_index.default, Object.assign({
|
|
117
|
-
guardFocus: true
|
|
128
|
+
guardFocus: true,
|
|
129
|
+
ref: this.tooltipRef
|
|
118
130
|
}, attr, {
|
|
119
131
|
trigger: trigger,
|
|
120
132
|
position: position,
|
|
@@ -15,10 +15,10 @@ export interface ArrowBounding {
|
|
|
15
15
|
width?: number;
|
|
16
16
|
height?: number;
|
|
17
17
|
}
|
|
18
|
-
export interface RenderContentProps {
|
|
19
|
-
initialFocusRef?: React.RefObject<
|
|
18
|
+
export interface RenderContentProps<T = HTMLElement> {
|
|
19
|
+
initialFocusRef?: React.RefObject<T>;
|
|
20
20
|
}
|
|
21
|
-
export declare type RenderContent = (props: RenderContentProps) => React.ReactNode;
|
|
21
|
+
export declare type RenderContent<T = HTMLElement> = (props: RenderContentProps<T>) => React.ReactNode;
|
|
22
22
|
export interface TooltipProps extends BaseProps {
|
|
23
23
|
children?: React.ReactNode;
|
|
24
24
|
motion?: boolean;
|
|
@@ -172,6 +172,10 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
172
172
|
get adapter(): TooltipAdapter<TooltipProps, TooltipState>;
|
|
173
173
|
componentDidMount(): void;
|
|
174
174
|
componentWillUnmount(): void;
|
|
175
|
+
/**
|
|
176
|
+
* focus on tooltip trigger
|
|
177
|
+
*/
|
|
178
|
+
focusTrigger(): void;
|
|
175
179
|
isSpecial: (elem: React.ReactNode | HTMLElement | any) => boolean | "disabled" | "loading";
|
|
176
180
|
didLeave: () => void;
|
|
177
181
|
/** for transition - end */
|
package/lib/cjs/tooltip/index.js
CHANGED
|
@@ -262,6 +262,8 @@ class Tooltip extends _baseComponent.default {
|
|
|
262
262
|
zIndex
|
|
263
263
|
}
|
|
264
264
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
265
|
+
// listen keyboard event, don't move tabIndex -1
|
|
266
|
+
tabIndex: -1,
|
|
265
267
|
className: `${_constants.BASE_CLASS_PREFIX}-portal-inner`,
|
|
266
268
|
style: portalInnerStyle,
|
|
267
269
|
ref: this.setContainerEl,
|
|
@@ -609,6 +611,14 @@ class Tooltip extends _baseComponent.default {
|
|
|
609
611
|
this.mounted = false;
|
|
610
612
|
this.foundation.destroy();
|
|
611
613
|
}
|
|
614
|
+
/**
|
|
615
|
+
* focus on tooltip trigger
|
|
616
|
+
*/
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
focusTrigger() {
|
|
620
|
+
this.foundation.focusTrigger();
|
|
621
|
+
}
|
|
612
622
|
/** for transition - end */
|
|
613
623
|
|
|
614
624
|
|
|
@@ -195,6 +195,8 @@ declare class Cascader extends BaseComponent<CascaderProps, CascaderState> {
|
|
|
195
195
|
handleItemHover: (e: MouseEvent, item: Entity) => void;
|
|
196
196
|
onItemCheckboxClick: (item: Entity | Data) => void;
|
|
197
197
|
handleListScroll: (e: React.UIEvent<HTMLUListElement, UIEvent>, ind: number) => void;
|
|
198
|
+
close(): void;
|
|
199
|
+
open(): void;
|
|
198
200
|
renderContent: () => JSX.Element;
|
|
199
201
|
renderPlusN: (hiddenTag: Array<ReactNode>) => JSX.Element;
|
|
200
202
|
renderMultipleTags: () => JSX.Element;
|
package/lib/es/cascader/index.js
CHANGED
|
@@ -3,8 +3,8 @@ const local = {
|
|
|
3
3
|
code: 'ar',
|
|
4
4
|
dateFnsLocale: arSA,
|
|
5
5
|
Pagination: {
|
|
6
|
-
pageSize: '
|
|
7
|
-
total: '
|
|
6
|
+
pageSize: 'العناصر في كل صفحة: ${pageSize}',
|
|
7
|
+
total: 'إجمالي الصفحات: ${total}',
|
|
8
8
|
jumpTo: 'اقفز إلى',
|
|
9
9
|
page: ' الصفحات'
|
|
10
10
|
},
|
|
@@ -80,7 +80,7 @@ const local = {
|
|
|
80
80
|
Sun: 'الأحد'
|
|
81
81
|
},
|
|
82
82
|
localeFormatToken: {
|
|
83
|
-
FORMAT_SWITCH_DATE: 'dd
|
|
83
|
+
FORMAT_SWITCH_DATE: 'yyyy/MM/dd'
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
Popconfirm: {
|
|
@@ -144,8 +144,8 @@ const local = {
|
|
|
144
144
|
clear: 'واضح',
|
|
145
145
|
selectAll: 'اختر الكل',
|
|
146
146
|
clearSelectAll: 'إلغاء تحديد الكل',
|
|
147
|
-
total: "
|
|
148
|
-
selected: "
|
|
147
|
+
total: "إجمالي العناصر: ${total}",
|
|
148
|
+
selected: "العناصر المحددة: ${total}"
|
|
149
149
|
},
|
|
150
150
|
Form: {
|
|
151
151
|
optional: '(اختياري)'
|
|
@@ -3,8 +3,8 @@ const local = {
|
|
|
3
3
|
code: 'de',
|
|
4
4
|
dateFnsLocale: de,
|
|
5
5
|
Pagination: {
|
|
6
|
-
pageSize: '${pageSize}
|
|
7
|
-
total: '${total}
|
|
6
|
+
pageSize: 'Elemente pro Seite: ${pageSize}',
|
|
7
|
+
total: 'Seiten gesamt: ${total}',
|
|
8
8
|
jumpTo: 'Springen zu',
|
|
9
9
|
page: ' Seiten'
|
|
10
10
|
},
|
|
@@ -80,7 +80,7 @@ const local = {
|
|
|
80
80
|
Sun: 'So.'
|
|
81
81
|
},
|
|
82
82
|
localeFormatToken: {
|
|
83
|
-
FORMAT_SWITCH_DATE: 'yyyy
|
|
83
|
+
FORMAT_SWITCH_DATE: 'dd.MM.yyyy'
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
Popconfirm: {
|
|
@@ -144,8 +144,8 @@ const local = {
|
|
|
144
144
|
clear: 'Löschen',
|
|
145
145
|
selectAll: 'Alles auswählen',
|
|
146
146
|
clearSelectAll: 'Alles abwählen',
|
|
147
|
-
total: '
|
|
148
|
-
selected: '${total}
|
|
147
|
+
total: 'Elemente gesamt: ${total}',
|
|
148
|
+
selected: 'Elemente ausgewählt: ${total}'
|
|
149
149
|
},
|
|
150
150
|
Form: {
|
|
151
151
|
optional: '(Optional)'
|
|
@@ -3,8 +3,8 @@ const local = {
|
|
|
3
3
|
code: 'en-GB',
|
|
4
4
|
dateFnsLocale: enGB,
|
|
5
5
|
Pagination: {
|
|
6
|
-
pageSize: '${pageSize}
|
|
7
|
-
total: '${total}
|
|
6
|
+
pageSize: 'Items per page: ${pageSize}',
|
|
7
|
+
total: 'Total pages: ${total}',
|
|
8
8
|
jumpTo: 'Jump to',
|
|
9
9
|
page: ' page'
|
|
10
10
|
},
|
|
@@ -80,7 +80,7 @@ const local = {
|
|
|
80
80
|
Sun: 'Sun'
|
|
81
81
|
},
|
|
82
82
|
localeFormatToken: {
|
|
83
|
-
FORMAT_SWITCH_DATE: '
|
|
83
|
+
FORMAT_SWITCH_DATE: 'MM/dd/yyyy'
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
Popconfirm: {
|
|
@@ -144,8 +144,8 @@ const local = {
|
|
|
144
144
|
clear: 'Clear',
|
|
145
145
|
selectAll: 'Select all',
|
|
146
146
|
clearSelectAll: 'Unselect all',
|
|
147
|
-
total: 'Total ${total}
|
|
148
|
-
selected: '${total}
|
|
147
|
+
total: 'Total items: ${total}',
|
|
148
|
+
selected: 'Items selected: ${total}'
|
|
149
149
|
},
|
|
150
150
|
Form: {
|
|
151
151
|
optional: '(optional)'
|
|
@@ -3,8 +3,8 @@ const local = {
|
|
|
3
3
|
code: 'en-US',
|
|
4
4
|
dateFnsLocale: enUS,
|
|
5
5
|
Pagination: {
|
|
6
|
-
pageSize: '${pageSize}
|
|
7
|
-
total: '${total}
|
|
6
|
+
pageSize: 'Items per page: ${pageSize}',
|
|
7
|
+
total: 'Total pages: ${total}',
|
|
8
8
|
jumpTo: 'Jump to',
|
|
9
9
|
page: ' page'
|
|
10
10
|
},
|
|
@@ -144,8 +144,8 @@ const local = {
|
|
|
144
144
|
clear: 'Clear',
|
|
145
145
|
selectAll: 'Select all',
|
|
146
146
|
clearSelectAll: 'Unselect all',
|
|
147
|
-
total: 'Total ${total}
|
|
148
|
-
selected: '${total}
|
|
147
|
+
total: 'Total items: ${total}',
|
|
148
|
+
selected: 'Items selected: ${total}'
|
|
149
149
|
},
|
|
150
150
|
Form: {
|
|
151
151
|
optional: '(optional)'
|
|
@@ -8,8 +8,8 @@ const locale = {
|
|
|
8
8
|
code: 'es',
|
|
9
9
|
dateFnsLocale: es,
|
|
10
10
|
Pagination: {
|
|
11
|
-
pageSize: '${pageSize}
|
|
12
|
-
total: '${total}
|
|
11
|
+
pageSize: 'Elementos por página: ${pageSize}',
|
|
12
|
+
total: 'Páginas totales: ${total}',
|
|
13
13
|
jumpTo: 'Ir a',
|
|
14
14
|
page: ' páginas'
|
|
15
15
|
},
|
|
@@ -85,7 +85,7 @@ const locale = {
|
|
|
85
85
|
Sun: 'Dom'
|
|
86
86
|
},
|
|
87
87
|
localeFormatToken: {
|
|
88
|
-
FORMAT_SWITCH_DATE: 'yyyy
|
|
88
|
+
FORMAT_SWITCH_DATE: 'dd/MM/yyyy'
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
Popconfirm: {
|
|
@@ -149,8 +149,8 @@ const locale = {
|
|
|
149
149
|
clear: 'Limpiar',
|
|
150
150
|
selectAll: 'Seleccionar todo',
|
|
151
151
|
clearSelectAll: 'Deseleccionar todo',
|
|
152
|
-
total: '
|
|
153
|
-
selected: '${total}
|
|
152
|
+
total: 'Elementos totales: ${total}',
|
|
153
|
+
selected: 'Elementos seleccionados: ${total}'
|
|
154
154
|
},
|
|
155
155
|
Form: {
|
|
156
156
|
optional: '(opcional)'
|
|
@@ -3,8 +3,8 @@ const local = {
|
|
|
3
3
|
code: 'fr',
|
|
4
4
|
dateFnsLocale: fr,
|
|
5
5
|
Pagination: {
|
|
6
|
-
pageSize: '${pageSize}
|
|
7
|
-
total: '${total}
|
|
6
|
+
pageSize: 'Éléments par page : ${pageSize}',
|
|
7
|
+
total: 'Total des pages : ${total}',
|
|
8
8
|
jumpTo: 'Sauter à',
|
|
9
9
|
page: ' pages'
|
|
10
10
|
},
|
|
@@ -80,7 +80,7 @@ const local = {
|
|
|
80
80
|
Sun: 'dim.'
|
|
81
81
|
},
|
|
82
82
|
localeFormatToken: {
|
|
83
|
-
FORMAT_SWITCH_DATE: 'yyyy
|
|
83
|
+
FORMAT_SWITCH_DATE: 'dd/MM/yyyy'
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
Popconfirm: {
|
|
@@ -144,8 +144,8 @@ const local = {
|
|
|
144
144
|
clear: 'Supprimer',
|
|
145
145
|
selectAll: 'Sélectionner tout',
|
|
146
146
|
clearSelectAll: 'Désélectionner tout',
|
|
147
|
-
total: '
|
|
148
|
-
selected: '${total}
|
|
147
|
+
total: 'Total des éléments : ${total}',
|
|
148
|
+
selected: 'Éléments sélectionnés : ${total}'
|
|
149
149
|
},
|
|
150
150
|
Form: {
|
|
151
151
|
optional: '(optionnel)'
|
|
@@ -3,8 +3,8 @@ const local = {
|
|
|
3
3
|
code: 'id-ID',
|
|
4
4
|
dateFnsLocale: id,
|
|
5
5
|
Pagination: {
|
|
6
|
-
pageSize: '${pageSize}
|
|
7
|
-
total: '${total}
|
|
6
|
+
pageSize: 'Item per halaman: ${pageSize}',
|
|
7
|
+
total: 'Total halaman: ${total}',
|
|
8
8
|
jumpTo: 'Langsung ke',
|
|
9
9
|
page: ' halaman'
|
|
10
10
|
},
|
|
@@ -144,8 +144,8 @@ const local = {
|
|
|
144
144
|
clear: 'Bersihkan',
|
|
145
145
|
selectAll: 'Pilih Semua',
|
|
146
146
|
clearSelectAll: 'Nyahpilih Semua',
|
|
147
|
-
total: 'Total ${total}
|
|
148
|
-
selected: '${total}
|
|
147
|
+
total: 'Total item: ${total}',
|
|
148
|
+
selected: 'Item dipilih: ${total}'
|
|
149
149
|
},
|
|
150
150
|
Form: {
|
|
151
151
|
optional: '(opsional)'
|
|
@@ -3,8 +3,8 @@ const local = {
|
|
|
3
3
|
code: 'it',
|
|
4
4
|
dateFnsLocale: it,
|
|
5
5
|
Pagination: {
|
|
6
|
-
pageSize: '${pageSize}
|
|
7
|
-
total: '${total}
|
|
6
|
+
pageSize: 'Elementi per pagina: ${pageSize}',
|
|
7
|
+
total: 'Pagine totali: ${total}',
|
|
8
8
|
jumpTo: 'Vai a',
|
|
9
9
|
page: ' pagine'
|
|
10
10
|
},
|
|
@@ -80,7 +80,7 @@ const local = {
|
|
|
80
80
|
Sun: 'Dom'
|
|
81
81
|
},
|
|
82
82
|
localeFormatToken: {
|
|
83
|
-
FORMAT_SWITCH_DATE: 'yyyy
|
|
83
|
+
FORMAT_SWITCH_DATE: 'dd/MM/yyyy'
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
Popconfirm: {
|
|
@@ -144,8 +144,8 @@ const local = {
|
|
|
144
144
|
clear: 'Cancella',
|
|
145
145
|
selectAll: 'Seleziona tutto',
|
|
146
146
|
clearSelectAll: 'Deseleziona tutto',
|
|
147
|
-
total: '
|
|
148
|
-
selected: '${total}
|
|
147
|
+
total: 'Elementi totali: ${total}',
|
|
148
|
+
selected: 'Elementi selezionati: ${total}'
|
|
149
149
|
},
|
|
150
150
|
Form: {
|
|
151
151
|
optional: '(opzionale)'
|