@aloudata/aloudata-design 0.2.0-beta.18 → 0.2.0-beta.19
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/es/Input/components/Input/index.d.ts +10 -5
- package/es/Navigator/components/Menu/index.js +2 -2
- package/es/Select/OptionsList/OptionItem/RenderLabelIcon.d.ts +1 -0
- package/es/Select/OptionsList/OptionItem/RenderLabelIcon.js +1 -0
- package/es/Select/OptionsList/index.js +1 -0
- package/es/Select/Selector/index.js +6 -4
- package/es/Select/interface.d.ts +3 -0
- package/es/Select/style/index.less +1 -1
- package/es/Table/index.d.ts +1 -1
- package/es/Table/index.js +9 -2
- package/es/Table/interface.d.ts +2 -0
- package/lib/Input/components/Input/index.d.ts +10 -5
- package/lib/Navigator/components/Menu/index.js +2 -2
- package/lib/Select/OptionsList/OptionItem/RenderLabelIcon.d.ts +1 -0
- package/lib/Select/OptionsList/OptionItem/RenderLabelIcon.js +2 -0
- package/lib/Select/OptionsList/index.js +1 -0
- package/lib/Select/Selector/index.js +6 -4
- package/lib/Select/interface.d.ts +3 -0
- package/lib/Select/style/index.less +1 -1
- package/lib/Table/index.d.ts +1 -1
- package/lib/Table/index.js +9 -2
- package/lib/Table/interface.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { InputProps, InputRef } from 'antd/lib/input/Input';
|
|
3
|
+
interface IShowCountProps {
|
|
4
|
+
formatter: (args: {
|
|
5
|
+
count: number;
|
|
6
|
+
maxLength?: number;
|
|
7
|
+
}) => string;
|
|
8
|
+
}
|
|
4
9
|
export declare type TSize = 'small' | 'default' | 'large';
|
|
5
|
-
export
|
|
10
|
+
export type { InputRef };
|
|
6
11
|
declare type ChangeEventHandler = (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
12
|
export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' | 'allowClear' | 'disabled' | 'showCount' | 'maxLength' | 'value' | 'defaultValue' | 'onPressEnter' | 'onChange'> {
|
|
8
13
|
/**
|
|
@@ -33,7 +38,7 @@ export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' |
|
|
|
33
38
|
* @default false
|
|
34
39
|
* @type boolean | { formatter: (args: { count: number; maxLength?: number; }) => string; };
|
|
35
40
|
*/
|
|
36
|
-
showCount?: boolean |
|
|
41
|
+
showCount?: boolean | IShowCountProps;
|
|
37
42
|
/**
|
|
38
43
|
* @description 最大长度
|
|
39
44
|
*/
|
|
@@ -57,5 +62,5 @@ export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' |
|
|
|
57
62
|
*/
|
|
58
63
|
onChange?: ChangeEventHandler;
|
|
59
64
|
}
|
|
60
|
-
declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<
|
|
65
|
+
declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<InputRef>>;
|
|
61
66
|
export default Input;
|
|
@@ -47,14 +47,14 @@ function Menu(props) {
|
|
|
47
47
|
|
|
48
48
|
if (isOpen) {
|
|
49
49
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
50
|
-
type: "
|
|
50
|
+
type: "arrow_drop_up",
|
|
51
51
|
size: 20,
|
|
52
52
|
className: "ald-nav-menu-icon-right"
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
57
|
-
type: "
|
|
57
|
+
type: "arrow_drop_down",
|
|
58
58
|
size: 20,
|
|
59
59
|
className: "ald-nav-menu-icon-right"
|
|
60
60
|
});
|
|
@@ -161,6 +161,7 @@ var OptionsList = function OptionsList(props, ref) {
|
|
|
161
161
|
}, multiple && renderAllOptions(), data.length > ZERO_LENGTH ? data.map(function (option, index) {
|
|
162
162
|
return /*#__PURE__*/React.createElement(ForwardRenderTooltip, {
|
|
163
163
|
tooltip: option === null || option === void 0 ? void 0 : option.tooltip,
|
|
164
|
+
key: option === null || option === void 0 ? void 0 : option.value,
|
|
164
165
|
render: /*#__PURE__*/React.createElement(ForwardRenderOption, _objectSpread({
|
|
165
166
|
option: option,
|
|
166
167
|
prefixCls: prefixCls,
|
|
@@ -40,6 +40,8 @@ import color from '../../style/themes/default/themeColor.module.less';
|
|
|
40
40
|
var ZERO = 0;
|
|
41
41
|
var ICON_LARGE_SIZE = 20;
|
|
42
42
|
var ICON_SMALL_SIZE = 16;
|
|
43
|
+
var FIRST_INDEX = 0;
|
|
44
|
+
var REVERSE_INDEX = -1;
|
|
43
45
|
|
|
44
46
|
var defaultArrowComponent = function defaultArrowComponent(prefix, size) {
|
|
45
47
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -163,14 +165,14 @@ var Selector = function Selector(props, ref) {
|
|
|
163
165
|
|
|
164
166
|
var renderMultipleValue = function renderMultipleValue() {
|
|
165
167
|
// @ts-ignore
|
|
166
|
-
var
|
|
168
|
+
var allTooltipTitleNode = value === null || value === void 0 ? void 0 : value.reduce(function (prev, curr) {
|
|
167
169
|
var item = getOptionByValue(curr);
|
|
168
170
|
|
|
169
171
|
if (item) {
|
|
170
|
-
return [].concat(_toConsumableArray(prev), [(item === null || item === void 0 ? void 0 : item.title) || (item === null || item === void 0 ? void 0 : item.label)]);
|
|
172
|
+
return [].concat(_toConsumableArray(prev), [(item === null || item === void 0 ? void 0 : item.title) || optionLabelRenderer(curr, getOptionByValue(curr)) || (item === null || item === void 0 ? void 0 : item.label), ',']);
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
return [].concat(_toConsumableArray(prev), [curr]);
|
|
175
|
+
return [].concat(_toConsumableArray(prev), [curr, ',']);
|
|
174
176
|
}, []);
|
|
175
177
|
|
|
176
178
|
if (Array.isArray(value) && value.length === filteredOptions.length && !isEmpty(value)) {
|
|
@@ -188,7 +190,7 @@ var Selector = function Selector(props, ref) {
|
|
|
188
190
|
return !input && !isNil(value) ? /*#__PURE__*/React.createElement(Tooltip // @ts-ignore
|
|
189
191
|
, {
|
|
190
192
|
// @ts-ignore
|
|
191
|
-
title:
|
|
193
|
+
title: allTooltipTitleNode.slice(FIRST_INDEX, REVERSE_INDEX),
|
|
192
194
|
placement: "top",
|
|
193
195
|
getTooltipContainer: function getTooltipContainer() {
|
|
194
196
|
var _selectorRef$current4;
|
package/es/Select/interface.d.ts
CHANGED
|
@@ -117,6 +117,9 @@ export interface ISelectProps {
|
|
|
117
117
|
labelRenderer?: (input: string) => (option: IOption, isGroup: boolean) => React.ReactNode;
|
|
118
118
|
searchPredicate?: (input: string) => _.ListIterateeCustom<IOption, boolean>;
|
|
119
119
|
matchPredicate?: (input: string) => _.ListIterateeCustom<IOption, boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* @description 渲染选中条目对应的内容
|
|
122
|
+
*/
|
|
120
123
|
optionLabelRenderer?: (value: string | number, option?: IOption) => React.ReactNode;
|
|
121
124
|
/**
|
|
122
125
|
* @description 选中值改变时的回调
|
package/es/Table/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ITableProps } from './interface';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<ITableProps<Record<string, unknown>>, "onChange" | "loading" | "data" | "columns" | "total" | "renderHeaderLeft" | "renderHeaderRight" | "onRowSelected" | "loadMore" | "hasNextPage" | "sortable" | "defaultSort" | "resizeColumn" | "sortDirections" | "showHeader" | "innerScroll"> & React.RefAttributes<unknown>>;
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<ITableProps<Record<string, unknown>>, "onChange" | "loading" | "data" | "columns" | "total" | "renderHeaderLeft" | "renderHeaderRight" | "onRowSelected" | "loadMore" | "hasNextPage" | "sortable" | "defaultSort" | "resizeColumn" | "sortDirections" | "showHeader" | "innerScroll" | "scrollThreshold" | "rowKey"> & React.RefAttributes<unknown>>;
|
|
4
4
|
export default _default;
|
package/es/Table/index.js
CHANGED
|
@@ -59,7 +59,10 @@ function Table(_ref, ref) {
|
|
|
59
59
|
_ref$onChange = _ref.onChange,
|
|
60
60
|
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
61
61
|
_ref$innerScroll = _ref.innerScroll,
|
|
62
|
-
innerScroll = _ref$innerScroll === void 0 ? false : _ref$innerScroll
|
|
62
|
+
innerScroll = _ref$innerScroll === void 0 ? false : _ref$innerScroll,
|
|
63
|
+
_ref$scrollThreshold = _ref.scrollThreshold,
|
|
64
|
+
scrollThreshold = _ref$scrollThreshold === void 0 ? '150px' : _ref$scrollThreshold,
|
|
65
|
+
rowKey = _ref.rowKey;
|
|
63
66
|
|
|
64
67
|
var _React$useState = React.useState(null),
|
|
65
68
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -182,6 +185,9 @@ function Table(_ref, ref) {
|
|
|
182
185
|
data: data,
|
|
183
186
|
disableMultiSort: true,
|
|
184
187
|
disableSortBy: !sortable,
|
|
188
|
+
getRowId: typeof rowKey === 'string' ? function () {
|
|
189
|
+
return rowKey;
|
|
190
|
+
} : rowKey,
|
|
185
191
|
initialState: {
|
|
186
192
|
sortBy: getInitSortBy()
|
|
187
193
|
}
|
|
@@ -396,7 +402,8 @@ function Table(_ref, ref) {
|
|
|
396
402
|
next: loadMore,
|
|
397
403
|
hasMore: !!hasNextPage,
|
|
398
404
|
loader: LoadingNode,
|
|
399
|
-
scrollableTarget: RANDOM_ID
|
|
405
|
+
scrollableTarget: RANDOM_ID,
|
|
406
|
+
scrollThreshold: scrollThreshold
|
|
400
407
|
}, renderRowList()) : renderRowList());
|
|
401
408
|
};
|
|
402
409
|
|
package/es/Table/interface.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { InputProps, InputRef } from 'antd/lib/input/Input';
|
|
3
|
+
interface IShowCountProps {
|
|
4
|
+
formatter: (args: {
|
|
5
|
+
count: number;
|
|
6
|
+
maxLength?: number;
|
|
7
|
+
}) => string;
|
|
8
|
+
}
|
|
4
9
|
export declare type TSize = 'small' | 'default' | 'large';
|
|
5
|
-
export
|
|
10
|
+
export type { InputRef };
|
|
6
11
|
declare type ChangeEventHandler = (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
12
|
export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' | 'allowClear' | 'disabled' | 'showCount' | 'maxLength' | 'value' | 'defaultValue' | 'onPressEnter' | 'onChange'> {
|
|
8
13
|
/**
|
|
@@ -33,7 +38,7 @@ export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' |
|
|
|
33
38
|
* @default false
|
|
34
39
|
* @type boolean | { formatter: (args: { count: number; maxLength?: number; }) => string; };
|
|
35
40
|
*/
|
|
36
|
-
showCount?: boolean |
|
|
41
|
+
showCount?: boolean | IShowCountProps;
|
|
37
42
|
/**
|
|
38
43
|
* @description 最大长度
|
|
39
44
|
*/
|
|
@@ -57,5 +62,5 @@ export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' |
|
|
|
57
62
|
*/
|
|
58
63
|
onChange?: ChangeEventHandler;
|
|
59
64
|
}
|
|
60
|
-
declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<
|
|
65
|
+
declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<InputRef>>;
|
|
61
66
|
export default Input;
|
|
@@ -64,14 +64,14 @@ function Menu(props) {
|
|
|
64
64
|
|
|
65
65
|
if (isOpen) {
|
|
66
66
|
return /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
67
|
-
type: "
|
|
67
|
+
type: "arrow_drop_up",
|
|
68
68
|
size: 20,
|
|
69
69
|
className: "ald-nav-menu-icon-right"
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
return /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
74
|
-
type: "
|
|
74
|
+
type: "arrow_drop_down",
|
|
75
75
|
size: 20,
|
|
76
76
|
className: "ald-nav-menu-icon-right"
|
|
77
77
|
});
|
|
@@ -13,6 +13,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _lodash = require("lodash");
|
|
15
15
|
|
|
16
|
+
require("antd/lib/checkbox/style");
|
|
17
|
+
|
|
16
18
|
var _Icon = _interopRequireDefault(require("../../../Icon"));
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -178,6 +178,7 @@ var OptionsList = function OptionsList(props, ref) {
|
|
|
178
178
|
}, multiple && renderAllOptions(), data.length > ZERO_LENGTH ? data.map(function (option, index) {
|
|
179
179
|
return /*#__PURE__*/_react.default.createElement(_OptionItem.ForwardRenderTooltip, {
|
|
180
180
|
tooltip: option === null || option === void 0 ? void 0 : option.tooltip,
|
|
181
|
+
key: option === null || option === void 0 ? void 0 : option.value,
|
|
181
182
|
render: /*#__PURE__*/_react.default.createElement(_OptionItem.ForwardRenderOption, _objectSpread({
|
|
182
183
|
option: option,
|
|
183
184
|
prefixCls: prefixCls,
|
|
@@ -62,6 +62,8 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
62
62
|
var ZERO = 0;
|
|
63
63
|
var ICON_LARGE_SIZE = 20;
|
|
64
64
|
var ICON_SMALL_SIZE = 16;
|
|
65
|
+
var FIRST_INDEX = 0;
|
|
66
|
+
var REVERSE_INDEX = -1;
|
|
65
67
|
|
|
66
68
|
var defaultArrowComponent = function defaultArrowComponent(prefix, size) {
|
|
67
69
|
return /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
@@ -185,14 +187,14 @@ var Selector = function Selector(props, ref) {
|
|
|
185
187
|
|
|
186
188
|
var renderMultipleValue = function renderMultipleValue() {
|
|
187
189
|
// @ts-ignore
|
|
188
|
-
var
|
|
190
|
+
var allTooltipTitleNode = value === null || value === void 0 ? void 0 : value.reduce(function (prev, curr) {
|
|
189
191
|
var item = getOptionByValue(curr);
|
|
190
192
|
|
|
191
193
|
if (item) {
|
|
192
|
-
return [].concat(_toConsumableArray(prev), [(item === null || item === void 0 ? void 0 : item.title) || (item === null || item === void 0 ? void 0 : item.label)]);
|
|
194
|
+
return [].concat(_toConsumableArray(prev), [(item === null || item === void 0 ? void 0 : item.title) || optionLabelRenderer(curr, getOptionByValue(curr)) || (item === null || item === void 0 ? void 0 : item.label), ',']);
|
|
193
195
|
}
|
|
194
196
|
|
|
195
|
-
return [].concat(_toConsumableArray(prev), [curr]);
|
|
197
|
+
return [].concat(_toConsumableArray(prev), [curr, ',']);
|
|
196
198
|
}, []);
|
|
197
199
|
|
|
198
200
|
if (Array.isArray(value) && value.length === filteredOptions.length && !(0, _lodash.isEmpty)(value)) {
|
|
@@ -210,7 +212,7 @@ var Selector = function Selector(props, ref) {
|
|
|
210
212
|
return !input && !(0, _lodash.isNil)(value) ? /*#__PURE__*/_react.default.createElement(_Tooltip.default // @ts-ignore
|
|
211
213
|
, {
|
|
212
214
|
// @ts-ignore
|
|
213
|
-
title:
|
|
215
|
+
title: allTooltipTitleNode.slice(FIRST_INDEX, REVERSE_INDEX),
|
|
214
216
|
placement: "top",
|
|
215
217
|
getTooltipContainer: function getTooltipContainer() {
|
|
216
218
|
var _selectorRef$current4;
|
|
@@ -117,6 +117,9 @@ export interface ISelectProps {
|
|
|
117
117
|
labelRenderer?: (input: string) => (option: IOption, isGroup: boolean) => React.ReactNode;
|
|
118
118
|
searchPredicate?: (input: string) => _.ListIterateeCustom<IOption, boolean>;
|
|
119
119
|
matchPredicate?: (input: string) => _.ListIterateeCustom<IOption, boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* @description 渲染选中条目对应的内容
|
|
122
|
+
*/
|
|
120
123
|
optionLabelRenderer?: (value: string | number, option?: IOption) => React.ReactNode;
|
|
121
124
|
/**
|
|
122
125
|
* @description 选中值改变时的回调
|
package/lib/Table/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ITableProps } from './interface';
|
|
3
|
-
declare const _default: React.ForwardRefExoticComponent<Pick<ITableProps<Record<string, unknown>>, "onChange" | "loading" | "data" | "columns" | "total" | "renderHeaderLeft" | "renderHeaderRight" | "onRowSelected" | "loadMore" | "hasNextPage" | "sortable" | "defaultSort" | "resizeColumn" | "sortDirections" | "showHeader" | "innerScroll"> & React.RefAttributes<unknown>>;
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<ITableProps<Record<string, unknown>>, "onChange" | "loading" | "data" | "columns" | "total" | "renderHeaderLeft" | "renderHeaderRight" | "onRowSelected" | "loadMore" | "hasNextPage" | "sortable" | "defaultSort" | "resizeColumn" | "sortDirections" | "showHeader" | "innerScroll" | "scrollThreshold" | "rowKey"> & React.RefAttributes<unknown>>;
|
|
4
4
|
export default _default;
|
package/lib/Table/index.js
CHANGED
|
@@ -81,7 +81,10 @@ function Table(_ref, ref) {
|
|
|
81
81
|
_ref$onChange = _ref.onChange,
|
|
82
82
|
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
83
83
|
_ref$innerScroll = _ref.innerScroll,
|
|
84
|
-
innerScroll = _ref$innerScroll === void 0 ? false : _ref$innerScroll
|
|
84
|
+
innerScroll = _ref$innerScroll === void 0 ? false : _ref$innerScroll,
|
|
85
|
+
_ref$scrollThreshold = _ref.scrollThreshold,
|
|
86
|
+
scrollThreshold = _ref$scrollThreshold === void 0 ? '150px' : _ref$scrollThreshold,
|
|
87
|
+
rowKey = _ref.rowKey;
|
|
85
88
|
|
|
86
89
|
var _React$useState = _react.default.useState(null),
|
|
87
90
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -204,6 +207,9 @@ function Table(_ref, ref) {
|
|
|
204
207
|
data: data,
|
|
205
208
|
disableMultiSort: true,
|
|
206
209
|
disableSortBy: !sortable,
|
|
210
|
+
getRowId: typeof rowKey === 'string' ? function () {
|
|
211
|
+
return rowKey;
|
|
212
|
+
} : rowKey,
|
|
207
213
|
initialState: {
|
|
208
214
|
sortBy: getInitSortBy()
|
|
209
215
|
}
|
|
@@ -420,7 +426,8 @@ function Table(_ref, ref) {
|
|
|
420
426
|
next: loadMore,
|
|
421
427
|
hasMore: !!hasNextPage,
|
|
422
428
|
loader: LoadingNode,
|
|
423
|
-
scrollableTarget: RANDOM_ID
|
|
429
|
+
scrollableTarget: RANDOM_ID,
|
|
430
|
+
scrollThreshold: scrollThreshold
|
|
424
431
|
}, renderRowList()) : renderRowList());
|
|
425
432
|
};
|
|
426
433
|
|
package/lib/Table/interface.d.ts
CHANGED