doui-react 1.0.2 → 2.0.1-dev
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/api/component/common.d.ts +2 -2
- package/es/api/component/common.js +3 -0
- package/es/api/component/global-style.d.ts +0 -1
- package/es/api/component/global-style.js +2 -3
- package/es/api/component/react-dom.js +20 -28
- package/es/button/component/index.js +8 -9
- package/es/button/type/index.d.ts +3 -7
- package/es/checkbox/type/index.d.ts +1 -1
- package/es/date-picker/component/index.js +13 -17
- package/es/date-picker/type/index.d.ts +5 -14
- package/es/form/component/constant.js +2 -2
- package/es/form/component/form-item-map.d.ts +2 -1
- package/es/form/component/form-item-map.js +2 -1
- package/es/form/component/form-item.js +1 -3
- package/es/form/component/form-list.d.ts +2 -2
- package/es/form/component/utils.d.ts +37 -27
- package/es/form/component/utils.js +2 -2
- package/es/form/style/form-item.d.ts +1 -1
- package/es/form/style/form-item.js +4 -11
- package/es/form/style/index.js +2 -2
- package/es/form/type/form-item.d.ts +5 -6
- package/es/form/type/form-list.d.ts +2 -2
- package/es/form/type/index.d.ts +3 -3
- package/es/grid/component/pagination.d.ts +72 -15
- package/es/hooks/hook/use-fetch.js +5 -12
- package/es/icon/hook/index.d.ts +108 -103
- package/es/input/component/number.d.ts +1 -1
- package/es/input/component/number.js +8 -30
- package/es/input/component/utils.d.ts +0 -1
- package/es/input/component/utils.js +0 -3
- package/es/input/type/index.d.ts +3 -3
- package/es/modal-prompt/component/utils.js +2 -1
- package/es/modal-prompt/type/index.d.ts +2 -2
- package/es/open-modal/component/footer.d.ts +1 -1
- package/es/open-modal/component/footer.js +2 -4
- package/es/open-modal/component/index.js +16 -1
- package/es/open-modal/component/modal.js +16 -6
- package/es/open-modal/component/utils.js +2 -6
- package/es/open-modal/hook/use-modal.js +1 -1
- package/es/open-modal/style/index.js +2 -2
- package/es/open-modal/style/wrap.js +1 -1
- package/es/open-modal/type/index.d.ts +6 -1
- package/es/radio/component/abstract-box.d.ts +68 -96
- package/es/radio/component/abstract-box.js +1 -5
- package/es/radio/component/use-radio.d.ts +7 -5
- package/es/radio/component/utils.js +1 -1
- package/es/radio/type/index.d.ts +2 -2
- package/es/select/component/use-select-options.d.ts +1 -1
- package/es/select/component/use-select-options.js +5 -2
- package/es/select/component/use-select.js +4 -7
- package/es/select/component/utils.d.ts +1 -2
- package/es/select/type/index.d.ts +3 -2
- package/es/stack/style/index.d.ts +2 -1
- package/es/switch/type/index.d.ts +2 -2
- package/es/table/component/action-button.js +0 -1
- package/es/table/component/filter.d.ts +1 -1
- package/es/table/component/filter.js +1 -1
- package/es/table/component/sort.d.ts +1 -1
- package/es/table/component/time.js +2 -2
- package/es/table/component/utils.d.ts +3 -77
- package/es/table/component/utils.js +5 -8
- package/es/table/hook/search.d.ts +1 -1
- package/es/table/hook/search.js +8 -6
- package/es/table/type/action.d.ts +2 -7
- package/es/table/type/column.d.ts +3 -3
- package/es/tabs/component/utils.d.ts +8 -8
- package/es/tabs/type/index.d.ts +1 -1
- package/es/text/component/index.js +15 -16
- package/es/text/component/use-text.d.ts +3 -2
- package/es/text/component/use-text.js +12 -19
- package/es/text/component/utils.d.ts +1 -1
- package/es/text/style/index.js +1 -1
- package/es/text/type/index.d.ts +2 -2
- package/es/tooltip/component/index.d.ts +34 -24
- package/es/tooltip/component/index.js +6 -2
- package/es/tooltip/type/index.d.ts +1 -1
- package/es/tree/component/index.d.ts +1 -1
- package/es/tree/style/index.js +1 -1
- package/es/tree-select/component/use-tree-select.js +4 -4
- package/es/tree-select/style/index.js +1 -1
- package/es/virtual-list/component/index.d.ts +1 -1
- package/es/virtual-list/component/index.js +4 -2
- package/es/virtual-list/type/index.d.ts +2 -1
- package/lib/api/component/common.d.ts +2 -2
- package/lib/api/component/common.js +3 -0
- package/lib/api/component/global-style.d.ts +0 -1
- package/lib/api/component/global-style.js +3 -4
- package/lib/api/component/react-dom.js +22 -30
- package/lib/button/component/index.js +8 -9
- package/lib/button/type/index.d.ts +3 -7
- package/lib/checkbox/type/index.d.ts +1 -1
- package/lib/date-picker/component/index.js +13 -17
- package/lib/date-picker/type/index.d.ts +5 -14
- package/lib/form/component/constant.js +2 -2
- package/lib/form/component/form-item-map.d.ts +2 -1
- package/lib/form/component/form-item-map.js +2 -1
- package/lib/form/component/form-item.js +1 -3
- package/lib/form/component/form-list.d.ts +2 -2
- package/lib/form/component/utils.d.ts +37 -27
- package/lib/form/component/utils.js +2 -2
- package/lib/form/style/form-item.d.ts +1 -1
- package/lib/form/style/form-item.js +4 -11
- package/lib/form/style/index.js +1 -1
- package/lib/form/type/form-item.d.ts +5 -6
- package/lib/form/type/form-list.d.ts +2 -2
- package/lib/form/type/index.d.ts +3 -3
- package/lib/grid/component/pagination.d.ts +72 -15
- package/lib/hooks/hook/use-fetch.js +5 -12
- package/lib/icon/hook/index.d.ts +108 -103
- package/lib/input/component/number.d.ts +1 -1
- package/lib/input/component/number.js +7 -28
- package/lib/input/component/utils.d.ts +0 -1
- package/lib/input/component/utils.js +0 -4
- package/lib/input/type/index.d.ts +3 -3
- package/lib/modal-prompt/component/utils.js +2 -1
- package/lib/modal-prompt/type/index.d.ts +2 -2
- package/lib/open-modal/component/footer.d.ts +1 -1
- package/lib/open-modal/component/footer.js +2 -4
- package/lib/open-modal/component/index.js +17 -1
- package/lib/open-modal/component/modal.js +14 -4
- package/lib/open-modal/component/utils.js +2 -6
- package/lib/open-modal/hook/use-modal.js +1 -1
- package/lib/open-modal/style/index.js +1 -1
- package/lib/open-modal/style/wrap.js +1 -1
- package/lib/open-modal/type/index.d.ts +6 -1
- package/lib/radio/component/abstract-box.d.ts +68 -96
- package/lib/radio/component/abstract-box.js +1 -5
- package/lib/radio/component/use-radio.d.ts +7 -5
- package/lib/radio/component/utils.js +1 -1
- package/lib/radio/type/index.d.ts +2 -2
- package/lib/select/component/use-select-options.d.ts +1 -1
- package/lib/select/component/use-select-options.js +5 -2
- package/lib/select/component/use-select.js +4 -7
- package/lib/select/component/utils.d.ts +1 -2
- package/lib/select/type/index.d.ts +3 -2
- package/lib/stack/style/index.d.ts +2 -1
- package/lib/switch/type/index.d.ts +2 -2
- package/lib/table/component/action-button.js +0 -1
- package/lib/table/component/filter.d.ts +1 -1
- package/lib/table/component/filter.js +1 -1
- package/lib/table/component/sort.d.ts +1 -1
- package/lib/table/component/time.js +2 -2
- package/lib/table/component/utils.d.ts +3 -77
- package/lib/table/component/utils.js +5 -8
- package/lib/table/hook/search.d.ts +1 -1
- package/lib/table/hook/search.js +8 -6
- package/lib/table/type/action.d.ts +2 -7
- package/lib/table/type/column.d.ts +3 -3
- package/lib/tabs/component/utils.d.ts +8 -8
- package/lib/tabs/type/index.d.ts +1 -1
- package/lib/text/component/index.js +15 -16
- package/lib/text/component/use-text.d.ts +3 -2
- package/lib/text/component/use-text.js +11 -18
- package/lib/text/component/utils.d.ts +1 -1
- package/lib/text/style/index.js +1 -1
- package/lib/text/type/index.d.ts +2 -2
- package/lib/tooltip/component/index.d.ts +34 -24
- package/lib/tooltip/component/index.js +6 -2
- package/lib/tooltip/type/index.d.ts +1 -1
- package/lib/tree/component/index.d.ts +1 -1
- package/lib/tree/style/index.js +1 -1
- package/lib/tree-select/component/use-tree-select.js +4 -4
- package/lib/tree-select/style/index.js +1 -1
- package/lib/virtual-list/component/index.d.ts +1 -1
- package/lib/virtual-list/component/index.js +4 -2
- package/lib/virtual-list/type/index.d.ts +2 -1
- package/package.json +10 -13
|
@@ -3,7 +3,7 @@ interface DisplayValueProps extends Pick<BaseSelectProps, 'value' | 'options'> {
|
|
|
3
3
|
filterNotExistValue?: boolean;
|
|
4
4
|
}
|
|
5
5
|
export declare function getDisplayValue({ value, options, filterNotExistValue }: DisplayValueProps): any;
|
|
6
|
-
export declare function useSelectOptions<T = any>({ value, loading, options, __callback__, shouldRerenderOptions, __filterNotExistValue__: filterNotExistValue, ...props }: BaseSelectProps): T & {
|
|
6
|
+
export declare function useSelectOptions<T = any>({ value, loading, options, __callback__, __callbackDeps__, shouldRerenderOptions, __filterNotExistValue__: filterNotExistValue, ...props }: BaseSelectProps): T & {
|
|
7
7
|
value: any;
|
|
8
8
|
options: import("..").SelectOptions | undefined;
|
|
9
9
|
displayOptions: any[];
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getDisplayValue = getDisplayValue;
|
|
8
8
|
exports.useSelectOptions = useSelectOptions;
|
|
9
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
12
|
var _form = require("../../form");
|
|
12
13
|
var _utils = require("../../form/component/utils");
|
|
@@ -14,7 +15,7 @@ var _hooks = require("../../hooks");
|
|
|
14
15
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
15
16
|
var _react = require("react");
|
|
16
17
|
var _utils2 = require("./utils");
|
|
17
|
-
var _excluded = ["value", "loading", "options", "__callback__", "shouldRerenderOptions", "__filterNotExistValue__"];
|
|
18
|
+
var _excluded = ["value", "loading", "options", "__callback__", "__callbackDeps__", "shouldRerenderOptions", "__filterNotExistValue__"];
|
|
18
19
|
var selectOptionsPropKeys = ['options', 'search', 'sort', 'renderLabel', 'presetProcessOption', 'finalProcessOption'];
|
|
19
20
|
function parseSelectOptionsAndRestProps(props) {
|
|
20
21
|
var selectOptionsProps = _lodash.default.pick(props, selectOptionsPropKeys);
|
|
@@ -44,6 +45,8 @@ function useSelectOptions(_ref2) {
|
|
|
44
45
|
loading = _ref2.loading,
|
|
45
46
|
options = _ref2.options,
|
|
46
47
|
__callback__ = _ref2.__callback__,
|
|
48
|
+
_ref2$__callbackDeps_ = _ref2.__callbackDeps__,
|
|
49
|
+
__callbackDeps__ = _ref2$__callbackDeps_ === void 0 ? [] : _ref2$__callbackDeps_,
|
|
47
50
|
shouldRerenderOptions = _ref2.shouldRerenderOptions,
|
|
48
51
|
filterNotExistValue = _ref2.__filterNotExistValue__,
|
|
49
52
|
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
@@ -69,7 +72,7 @@ function useSelectOptions(_ref2) {
|
|
|
69
72
|
};
|
|
70
73
|
__callback__ === null || __callback__ === void 0 || __callback__(params);
|
|
71
74
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
72
|
-
}, [memoValue, memoOptions, finalLoading]);
|
|
75
|
+
}, [memoValue, memoOptions, finalLoading].concat((0, _toConsumableArray2.default)(__callbackDeps__)));
|
|
73
76
|
var displayOptions = (0, _react.useMemo)(function () {
|
|
74
77
|
return (0, _utils2.generateOptions)((0, _objectSpread2.default)({
|
|
75
78
|
options: memoOptions
|
|
@@ -64,10 +64,7 @@ function renderMaxTag(omittedValues) {
|
|
|
64
64
|
return (0, _jsxRuntime.jsxs)(_text.Text, {
|
|
65
65
|
autoShowTooltip: false,
|
|
66
66
|
tooltip: {
|
|
67
|
-
title: tooltip
|
|
68
|
-
align: {
|
|
69
|
-
offset: [0, 0]
|
|
70
|
-
}
|
|
67
|
+
title: tooltip
|
|
71
68
|
},
|
|
72
69
|
children: ["+", omittedValues.length, "..."]
|
|
73
70
|
});
|
|
@@ -110,7 +107,7 @@ function useSelect(_ref3) {
|
|
|
110
107
|
})),
|
|
111
108
|
displayOptions = _useSelectOptions.displayOptions,
|
|
112
109
|
restSelectProps = (0, _objectWithoutProperties2.default)(_useSelectOptions, _excluded2);
|
|
113
|
-
function
|
|
110
|
+
function onOpenChange(open) {
|
|
114
111
|
setOpen(open);
|
|
115
112
|
setSearch('');
|
|
116
113
|
}
|
|
@@ -130,7 +127,7 @@ function useSelect(_ref3) {
|
|
|
130
127
|
optionFilterProp: 'originLabel',
|
|
131
128
|
optionLabelProp: 'originLabel',
|
|
132
129
|
getPopupContainer: _api.getPopupContainer,
|
|
133
|
-
|
|
130
|
+
popupRender: customRenderDropdown,
|
|
134
131
|
maxTagPlaceholder: renderMaxTag
|
|
135
132
|
}, (0, _utils.getComponentProps)(restSelectProps)), {}, {
|
|
136
133
|
placeholder: placeholder,
|
|
@@ -138,6 +135,6 @@ function useSelect(_ref3) {
|
|
|
138
135
|
loading: loading,
|
|
139
136
|
options: displayOptions,
|
|
140
137
|
onSearch: showSearch ? setSearch : undefined,
|
|
141
|
-
|
|
138
|
+
onOpenChange: onOpenChange
|
|
142
139
|
});
|
|
143
140
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { FormValues } from "../../form";
|
|
2
2
|
import { BaseSelectProps, SelectOptions } from "..";
|
|
3
|
-
import { DependencyList } from 'react';
|
|
4
3
|
export declare function generateOptions({ options, sort, ...rest }: BaseSelectProps): any[];
|
|
5
4
|
export declare function getOptionsValue(options?: SelectOptions): (string | number)[];
|
|
6
5
|
interface DependenciesProps {
|
|
7
6
|
values?: FormValues;
|
|
8
|
-
deps?:
|
|
7
|
+
deps?: string[];
|
|
9
8
|
search: string;
|
|
10
9
|
isFunctionOptions: boolean;
|
|
11
10
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BaseComponentProps, FunctionReturn } from "../../api";
|
|
2
2
|
import { UseFetchOptions } from "../../hooks";
|
|
3
3
|
import { TextProps } from "../../text";
|
|
4
|
-
import { SelectProps as AntdSelectProps } from 'antd/
|
|
4
|
+
import { SelectProps as AntdSelectProps } from 'antd/es/select';
|
|
5
5
|
import { BaseOptionType, DefaultOptionType } from 'rc-select/lib/Select';
|
|
6
|
-
import { ReactNode } from 'react';
|
|
6
|
+
import { DependencyList, ReactNode } from 'react';
|
|
7
7
|
/**
|
|
8
8
|
* @noExtends
|
|
9
9
|
*/
|
|
@@ -54,6 +54,7 @@ export interface BaseSelectProps {
|
|
|
54
54
|
*/
|
|
55
55
|
__filterNotExistValue__?: boolean;
|
|
56
56
|
__callback__?(props: SelectCallbackProps): void;
|
|
57
|
+
__callbackDeps__?: DependencyList;
|
|
57
58
|
}
|
|
58
59
|
type UnionType = Omit<AntdSelectProps, 'options'> & Omit<BaseSelectProps, 'options'> & BaseComponentProps;
|
|
59
60
|
export interface SelectProps extends UnionType {
|
|
@@ -12,7 +12,8 @@ export declare const alignMap: {
|
|
|
12
12
|
between: string;
|
|
13
13
|
};
|
|
14
14
|
export declare function getAlign(align: HStackProps['align']): string;
|
|
15
|
-
|
|
15
|
+
type WidthFlexStyle = Pick<HStackProps, 'width' | 'style' | 'flex'>;
|
|
16
|
+
export declare function getWidthAndFlex({ width, style, flex }: WidthFlexStyle): import("@emotion/react").SerializedStyles;
|
|
16
17
|
declare const style: {
|
|
17
18
|
hStack: (props: Partial<HStackProps>) => import("@emotion/react").SerializedStyles;
|
|
18
19
|
vStack: (props: Partial<VStackProps>) => import("@emotion/react").SerializedStyles;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseComponentProps, FunctionReturn } from "../../api";
|
|
2
|
-
import { SwitchProps as AntdSwitchProps } from 'antd/
|
|
3
|
-
import { EllipsisConfig } from 'antd/
|
|
2
|
+
import { SwitchProps as AntdSwitchProps } from 'antd/es/switch';
|
|
3
|
+
import { EllipsisConfig } from 'antd/es/typography/Base';
|
|
4
4
|
export interface SwitchProps extends AntdSwitchProps, BaseComponentProps {
|
|
5
5
|
/**
|
|
6
6
|
* @description 提示信息
|
|
@@ -24,7 +24,6 @@ function generateAction(action, params) {
|
|
|
24
24
|
disabled: (0, _api.executeFunction)(action.disabled, params),
|
|
25
25
|
tooltip: (0, _api.executeFunction)(action.tooltip, params),
|
|
26
26
|
confirm: (0, _api.executeFunction)(action.confirm, params),
|
|
27
|
-
confirmMessage: (0, _api.executeFunction)(action.confirmMessage, params),
|
|
28
27
|
onClick: function onClick() {
|
|
29
28
|
var _action$onClick;
|
|
30
29
|
return (_action$onClick = action.onClick) === null || _action$onClick === void 0 ? void 0 : _action$onClick.call(action, params);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Column } from '../type';
|
|
2
2
|
export declare function getSortColumn({ dataIndex, sort }: Column): {
|
|
3
|
-
sorter: import("antd/
|
|
3
|
+
sorter: import("antd/es/table/interface").CompareFn<any>;
|
|
4
4
|
} | {
|
|
5
5
|
sorter: (a: any, b: any) => any;
|
|
6
6
|
};
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.Time = Time;
|
|
8
|
-
var
|
|
8
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
9
9
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
10
10
|
var defaultFormat = 'YYYY-MM-DD hh:mm:ss A';
|
|
11
11
|
function Time(_ref) {
|
|
@@ -14,6 +14,6 @@ function Time(_ref) {
|
|
|
14
14
|
var timeFormat = column.timeFormat;
|
|
15
15
|
var format = timeFormat || defaultFormat;
|
|
16
16
|
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
17
|
-
children: (0,
|
|
17
|
+
children: (0, _dayjs.default)(+children).format(format)
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { FormInstance, FormProps } from "../../form";
|
|
3
|
-
import {
|
|
2
|
+
import type { ColumnType } from 'antd/es/table';
|
|
3
|
+
import type { TableRowSelection } from 'antd/es/table/interface';
|
|
4
4
|
import { Column, DataSource, GetSearchColumn, TableContext, TableProps } from '../type';
|
|
5
5
|
import { Actions } from './actions';
|
|
6
6
|
import { Editor } from './editor';
|
|
@@ -19,81 +19,7 @@ export declare const componentMap: {
|
|
|
19
19
|
editor: typeof Editor;
|
|
20
20
|
default: (props: any) => any;
|
|
21
21
|
};
|
|
22
|
-
export declare function generateColumns({ columns, getSearchColumn }: GenerateColumnsProps):
|
|
23
|
-
render: (current: any, record: Record<string, any>, index: number) => import("react").ReactNode;
|
|
24
|
-
dataIndex?: string | undefined;
|
|
25
|
-
type?: "link" | "switch" | "time" | "actions" | "selection" | "editor" | undefined;
|
|
26
|
-
width?: string | number | undefined;
|
|
27
|
-
minWidth?: string | number | undefined;
|
|
28
|
-
maxWidth?: string | number | undefined;
|
|
29
|
-
rows?: number | undefined;
|
|
30
|
-
timeFormat?: string | undefined;
|
|
31
|
-
disabled?: boolean | ((props: import("../type").CommonProps) => boolean) | undefined;
|
|
32
|
-
tooltip?: import("react").ReactNode | ((props: import("../type").CommonProps) => import("react").ReactNode);
|
|
33
|
-
onClick?(props: import("../type").CommonProps): any;
|
|
34
|
-
search?: boolean | string[] | ((props: import("../type").CustomFilterProps) => boolean) | undefined;
|
|
35
|
-
placeholder?: string | undefined;
|
|
36
|
-
sort?: boolean | import("antd/lib/table/interface").CompareFn<any> | {
|
|
37
|
-
compare?: import("antd/lib/table/interface").CompareFn<any> | undefined;
|
|
38
|
-
multiple?: number | undefined;
|
|
39
|
-
} | undefined;
|
|
40
|
-
filters?: (boolean | import("react").Key | import("antd/lib/table/interface").ColumnFilterItem)[] | undefined;
|
|
41
|
-
filterBy?: string[] | ((props: import("../type").CustomFilterProps) => boolean) | undefined;
|
|
42
|
-
actions?: import("../type").ActionProps[] | ((props: import("../type").CommonProps) => import("../type").ActionProps[]) | undefined;
|
|
43
|
-
editorProps?: import("../../form").FormItemProps | ((props: import("../type").CommonProps) => import("../../form").FormItemProps) | undefined;
|
|
44
|
-
className?: string | undefined;
|
|
45
|
-
title?: import("antd/lib/table/interface").ColumnTitle<any>;
|
|
46
|
-
responsive?: import("antd/lib/_util/responsiveObserve").Breakpoint[] | undefined;
|
|
47
|
-
align?: import("rc-table/lib/interface").AlignType | undefined;
|
|
48
|
-
fixed?: import("rc-table/lib/interface").FixedType | undefined;
|
|
49
|
-
colSpan?: number | undefined;
|
|
50
|
-
rowSpan?: number | undefined;
|
|
51
|
-
key?: import("react").Key | undefined;
|
|
52
|
-
shouldCellUpdate?: ((record: any, prevRecord: any) => boolean) | undefined;
|
|
53
|
-
onCell?: import("rc-table/lib/interface").GetComponentProps<any> | undefined;
|
|
54
|
-
onCellClick?: ((record: any, e: import("react").MouseEvent<HTMLElement, MouseEvent>) => void) | undefined;
|
|
55
|
-
onHeaderCell?: import("rc-table/lib/interface").GetComponentProps<import("rc-table/lib/interface").ColumnType<any> | import("rc-table/lib/interface").ColumnGroupType<any>> | undefined;
|
|
56
|
-
sorter?: boolean | import("antd/lib/table/interface").CompareFn<any> | {
|
|
57
|
-
compare?: import("antd/lib/table/interface").CompareFn<any> | undefined;
|
|
58
|
-
multiple?: number | undefined;
|
|
59
|
-
} | undefined;
|
|
60
|
-
sortOrder?: import("antd/lib/table/interface").SortOrder | undefined;
|
|
61
|
-
defaultSortOrder?: import("antd/lib/table/interface").SortOrder | undefined;
|
|
62
|
-
sortDirections?: import("antd/lib/table/interface").SortOrder[] | undefined;
|
|
63
|
-
showSorterTooltip?: boolean | import("antd").TooltipProps | undefined;
|
|
64
|
-
filtered?: boolean | undefined;
|
|
65
|
-
filterDropdown?: import("react").ReactNode | ((props: import("antd/lib/table/interface").FilterDropdownProps) => import("react").ReactNode);
|
|
66
|
-
filterMultiple?: boolean | undefined;
|
|
67
|
-
filteredValue?: import("antd/lib/table/interface").FilterValue | null | undefined;
|
|
68
|
-
defaultFilteredValue?: import("antd/lib/table/interface").FilterValue | null | undefined;
|
|
69
|
-
filterIcon?: import("react").ReactNode | ((filtered: boolean) => import("react").ReactNode);
|
|
70
|
-
filterMode?: "menu" | "tree" | undefined;
|
|
71
|
-
filterSearch?: import("antd/lib/table/interface").FilterSearchType<import("antd/lib/table/interface").ColumnFilterItem> | undefined;
|
|
72
|
-
onFilter?: ((value: boolean | import("react").Key, record: any) => boolean) | undefined;
|
|
73
|
-
filterDropdownVisible?: boolean | undefined;
|
|
74
|
-
filterDropdownOpen?: boolean | undefined;
|
|
75
|
-
onFilterDropdownVisibleChange?: ((visible: boolean) => void) | undefined;
|
|
76
|
-
onFilterDropdownOpenChange?: ((open: boolean) => void) | undefined;
|
|
77
|
-
filterResetToDefaultFilteredValue?: boolean | undefined;
|
|
78
|
-
onChange?: ((selectedRowKeys: import("react").Key[], selectedRows: any[], info: {
|
|
79
|
-
type: import("antd/lib/table/interface").RowSelectMethod;
|
|
80
|
-
}) => void) | undefined;
|
|
81
|
-
onSelect?: import("antd/lib/table/interface").SelectionSelectFn<any> | undefined;
|
|
82
|
-
columnWidth?: string | number | undefined;
|
|
83
|
-
preserveSelectedRowKeys?: boolean | undefined;
|
|
84
|
-
selectedRowKeys?: import("react").Key[] | undefined;
|
|
85
|
-
defaultSelectedRowKeys?: import("react").Key[] | undefined;
|
|
86
|
-
getCheckboxProps?: ((record: any) => Partial<Omit<import("antd").CheckboxProps, "defaultChecked" | "checked">>) | undefined;
|
|
87
|
-
onSelectMultiple?: ((selected: boolean, selectedRows: any[], changeRows: any[]) => void) | undefined;
|
|
88
|
-
onSelectAll?: ((selected: boolean, selectedRows: any[], changeRows: any[]) => void) | undefined;
|
|
89
|
-
onSelectInvert?: ((selectedRowKeys: import("react").Key[]) => void) | undefined;
|
|
90
|
-
onSelectNone?: (() => void) | undefined;
|
|
91
|
-
selections?: boolean | import("antd/lib/table/hooks/useSelection").INTERNAL_SELECTION_ITEM[] | undefined;
|
|
92
|
-
hideSelectAll?: boolean | undefined;
|
|
93
|
-
columnTitle?: import("react").ReactNode;
|
|
94
|
-
checkStrictly?: boolean | undefined;
|
|
95
|
-
renderCell?: ((value: boolean, record: any, index: number, originNode: import("react").ReactNode) => import("react").ReactNode | import("rc-table/lib/interface").RenderedCell<any>) | undefined;
|
|
96
|
-
}[];
|
|
22
|
+
export declare function generateColumns({ columns, getSearchColumn }: GenerateColumnsProps): ColumnType<any>[];
|
|
97
23
|
interface RowSelectionProps {
|
|
98
24
|
rowKey: string;
|
|
99
25
|
columns: Column[];
|
|
@@ -41,9 +41,7 @@ var componentMap = exports.componentMap = {
|
|
|
41
41
|
function generateColumns(_ref) {
|
|
42
42
|
var columns = _ref.columns,
|
|
43
43
|
getSearchColumn = _ref.getSearchColumn;
|
|
44
|
-
return _lodash.default.
|
|
45
|
-
return column.width !== 0;
|
|
46
|
-
}).map(function (column) {
|
|
44
|
+
return _lodash.default.map(columns, function (column) {
|
|
47
45
|
var newColumn = _lodash.default.clone(column);
|
|
48
46
|
var search = newColumn.search,
|
|
49
47
|
sort = newColumn.sort,
|
|
@@ -151,8 +149,7 @@ function getRowSelection(_ref3) {
|
|
|
151
149
|
return;
|
|
152
150
|
}
|
|
153
151
|
var selectedRowKeys = context.selectedRowKeys,
|
|
154
|
-
setSelectedRowKeys = context.setSelectedRowKeys
|
|
155
|
-
dataSource = context.dataSource;
|
|
152
|
+
setSelectedRowKeys = context.setSelectedRowKeys;
|
|
156
153
|
var type = column.type,
|
|
157
154
|
disabled = column.disabled,
|
|
158
155
|
onClick = column.onClick,
|
|
@@ -175,14 +172,14 @@ function getRowSelection(_ref3) {
|
|
|
175
172
|
var rowKeys = keys || _lodash.default.map(selectedRows, rowKey);
|
|
176
173
|
setSelectedRowKeys(rowKeys);
|
|
177
174
|
},
|
|
178
|
-
onSelectAll: function onSelectAll(selected) {
|
|
175
|
+
onSelectAll: function onSelectAll(selected, selectedRows) {
|
|
179
176
|
if (selected) {
|
|
180
|
-
var
|
|
177
|
+
var _selected = _lodash.default.filter(selectedRows, function (record) {
|
|
181
178
|
return !(0, _api.executeFunction)(disabled, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, context), {}, {
|
|
182
179
|
record: record
|
|
183
180
|
}));
|
|
184
181
|
});
|
|
185
|
-
setSelectedRowKeys(_lodash.default.map(
|
|
182
|
+
setSelectedRowKeys(_lodash.default.map(_selected, rowKey));
|
|
186
183
|
return;
|
|
187
184
|
}
|
|
188
185
|
setSelectedRowKeys([]);
|
package/lib/table/hook/search.js
CHANGED
|
@@ -101,12 +101,14 @@ function getSearchableColumn(column) {
|
|
|
101
101
|
}
|
|
102
102
|
return filter.apply(void 0, [column].concat(args));
|
|
103
103
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
filterDropdownProps: {
|
|
105
|
+
onOpenChange: function onOpenChange(visible) {
|
|
106
|
+
if (visible) {
|
|
107
|
+
setTimeout(function () {
|
|
108
|
+
var _currentInput;
|
|
109
|
+
return (_currentInput = currentInput) === null || _currentInput === void 0 ? void 0 : _currentInput.focus();
|
|
110
|
+
}, 30);
|
|
111
|
+
}
|
|
110
112
|
}
|
|
111
113
|
},
|
|
112
114
|
render: function render(text) {
|
|
@@ -3,7 +3,7 @@ import { ButtonProps } from "../../button";
|
|
|
3
3
|
import { FormListActionProps, FormListProps } from "../../form";
|
|
4
4
|
import { TableContext } from "..";
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
|
-
type ButtonType = Omit<ButtonProps & Partial<FormListActionProps> & Pick<FormListProps, 'focusFirstOnAdd'>, 'icon' | 'show' | 'disabled' | 'tooltip' | 'confirm' | '
|
|
6
|
+
type ButtonType = Omit<ButtonProps & Partial<FormListActionProps> & Pick<FormListProps, 'focusFirstOnAdd'>, 'icon' | 'show' | 'disabled' | 'tooltip' | 'confirm' | 'onClick'>;
|
|
7
7
|
export interface ActionProps extends ButtonType {
|
|
8
8
|
/**
|
|
9
9
|
* @description 图标
|
|
@@ -33,12 +33,7 @@ export interface ActionProps extends ButtonType {
|
|
|
33
33
|
* @default false
|
|
34
34
|
* @link TableContext: #tablecontext
|
|
35
35
|
*/
|
|
36
|
-
confirm?:
|
|
37
|
-
/**
|
|
38
|
-
* @description 确认信息
|
|
39
|
-
* @link TableContext: #tablecontext
|
|
40
|
-
*/
|
|
41
|
-
confirmMessage?: ReactNode | ((props: TableContext) => ReactNode);
|
|
36
|
+
confirm?: ButtonProps['confirm'] | ((props: TableContext) => ButtonProps['confirm']);
|
|
42
37
|
/**
|
|
43
38
|
* @description 点击回调
|
|
44
39
|
* @link TableContext: #tablecontext
|
|
@@ -2,10 +2,10 @@ import { FunctionReturn } from "../../api";
|
|
|
2
2
|
import { FormItemProps } from "../../form";
|
|
3
3
|
import { ActionProps, CommonProps } from "..";
|
|
4
4
|
import { componentMap } from "../component/utils";
|
|
5
|
-
import { ColumnType } from 'antd/
|
|
6
|
-
import { ColumnFilterItem, TableRowSelection } from 'antd/
|
|
5
|
+
import type { ColumnType } from 'antd/es/table';
|
|
6
|
+
import type { ColumnFilterItem, TableRowSelection } from 'antd/es/table/interface';
|
|
7
7
|
import React, { ReactNode } from 'react';
|
|
8
|
-
type UnionColumnType = Omit<ColumnType<any>, 'ellipsis' | 'filters'> & Omit<TableRowSelection<any>, 'type'>;
|
|
8
|
+
type UnionColumnType = Omit<ColumnType<any>, 'ellipsis' | 'filters' | 'minWidth' | 'maxWidth'> & Omit<TableRowSelection<any>, 'type'>;
|
|
9
9
|
export interface Column extends UnionColumnType {
|
|
10
10
|
/**
|
|
11
11
|
* @description 字段名
|
|
@@ -6,19 +6,19 @@ export declare function getRenderTabBar({ type, items, size, tabBarGutter, tabBa
|
|
|
6
6
|
export declare function generateTabItems({ items }: TabsProps): {
|
|
7
7
|
label: import("@emotion/react/jsx-runtime").JSX.Element;
|
|
8
8
|
key: string;
|
|
9
|
+
className?: string | undefined;
|
|
9
10
|
style?: import("react").CSSProperties | undefined;
|
|
10
11
|
children?: import("react").ReactNode;
|
|
11
|
-
|
|
12
|
-
id?: string | undefined;
|
|
13
|
-
icon?: import("react").ReactNode;
|
|
12
|
+
closable?: boolean | undefined;
|
|
14
13
|
prefixCls?: string | undefined;
|
|
14
|
+
closeIcon?: import("react").ReactNode;
|
|
15
|
+
forceRender?: boolean | undefined;
|
|
15
16
|
disabled?: boolean | undefined;
|
|
16
|
-
|
|
17
|
+
id?: string | undefined;
|
|
18
|
+
active?: boolean | undefined;
|
|
19
|
+
icon?: import("react").ReactNode;
|
|
17
20
|
destroyInactiveTabPane?: boolean | undefined;
|
|
18
|
-
|
|
19
|
-
closable?: boolean | undefined;
|
|
20
|
-
closeIcon?: import("react").ReactNode;
|
|
21
|
+
animated?: boolean | undefined;
|
|
21
22
|
tabKey?: string | undefined;
|
|
22
|
-
active?: boolean | undefined;
|
|
23
23
|
}[];
|
|
24
24
|
export {};
|
package/lib/tabs/type/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SelectOption } from "../../select";
|
|
2
2
|
import { TabsProps as AntdTabsProps } from 'antd';
|
|
3
|
-
import { TabsType } from 'antd/
|
|
3
|
+
import { TabsType } from 'antd/es/tabs';
|
|
4
4
|
import { Tab } from 'rc-tabs/lib/interface';
|
|
5
5
|
export interface TabProps extends Tab, Omit<SelectOption, 'label'> {
|
|
6
6
|
}
|
|
@@ -13,6 +13,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
13
13
|
var _ = require("./..");
|
|
14
14
|
var _tooltip = require("../../tooltip");
|
|
15
15
|
var _antd = require("antd");
|
|
16
|
+
var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer"));
|
|
16
17
|
var _style = _interopRequireDefault(require("../style"));
|
|
17
18
|
var _useText2 = require("./use-text");
|
|
18
19
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
@@ -38,12 +39,11 @@ function Text(_ref) {
|
|
|
38
39
|
_ref$autoShowTooltip = _ref.autoShowTooltip,
|
|
39
40
|
autoShowTooltip = _ref$autoShowTooltip === void 0 ? true : _ref$autoShowTooltip,
|
|
40
41
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
41
|
-
var _useText = (0, _useText2.useText)(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
key = _useText.key;
|
|
42
|
+
var _useText = (0, _useText2.useText)(),
|
|
43
|
+
key = _useText.key,
|
|
44
|
+
onResize = _useText.onResize;
|
|
45
45
|
if (tooltip === false || !rows) {
|
|
46
|
-
return (0, _jsxRuntime.jsx)("
|
|
46
|
+
return (0, _jsxRuntime.jsx)("span", (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
47
47
|
css: _style.default.wordBreak
|
|
48
48
|
}, props), {}, {
|
|
49
49
|
children: children
|
|
@@ -51,19 +51,18 @@ function Text(_ref) {
|
|
|
51
51
|
}
|
|
52
52
|
var ellipsis = {
|
|
53
53
|
rows: rows,
|
|
54
|
-
tooltip: (0, _tooltip.getTooltipProps)((0, _objectSpread2.default)({
|
|
55
|
-
align: {
|
|
56
|
-
offset: [0, 5]
|
|
57
|
-
}
|
|
58
|
-
}, (0, _.generateTooltip)(tooltip !== null && tooltip !== void 0 ? tooltip : children)))
|
|
54
|
+
tooltip: (0, _tooltip.getTooltipProps)((0, _objectSpread2.default)({}, (0, _.generateTooltip)(tooltip !== null && tooltip !== void 0 ? tooltip : children)))
|
|
59
55
|
};
|
|
60
56
|
if (autoShowTooltip) {
|
|
61
|
-
return (0, _jsxRuntime.jsx)(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
return (0, _jsxRuntime.jsx)(_rcResizeObserver.default, {
|
|
58
|
+
onResize: onResize,
|
|
59
|
+
children: (0, _jsxRuntime.jsx)(Paragraph, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
60
|
+
css: _style.default.wrapper
|
|
61
|
+
}, props), {}, {
|
|
62
|
+
ellipsis: ellipsis,
|
|
63
|
+
children: children
|
|
64
|
+
}), key)
|
|
65
|
+
});
|
|
67
66
|
}
|
|
68
67
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, ellipsis.tooltip), {}, {
|
|
69
68
|
children: (0, _jsxRuntime.jsx)(Paragraph, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
@@ -7,25 +7,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useText = useText;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _hooks = require("../../hooks");
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
setKey = _useState2[1];
|
|
18
|
-
var reset = (0, _hooks.useDebounce)(setKey, 150);
|
|
19
|
-
(0, _hooks.useWindowResize)(function (_ref2) {
|
|
20
|
-
var width = _ref2.width;
|
|
21
|
-
return reset(width);
|
|
10
|
+
function useText() {
|
|
11
|
+
var _useSafeState = (0, _hooks.useSafeState)(0),
|
|
12
|
+
_useSafeState2 = (0, _slicedToArray2.default)(_useSafeState, 2),
|
|
13
|
+
key = _useSafeState2[0],
|
|
14
|
+
setKey = _useSafeState2[1];
|
|
15
|
+
var reset = (0, _hooks.useDebounce)(setKey, 150, {
|
|
16
|
+
leading: false
|
|
22
17
|
});
|
|
23
|
-
|
|
24
|
-
// 修复某些场景下,tooltip 会自动显示的问题
|
|
25
|
-
(0, _reactUse.useUpdateEffect)(function () {
|
|
26
|
-
reset(Date.now());
|
|
27
|
-
}, [children]);
|
|
28
18
|
return {
|
|
29
|
-
key: key
|
|
19
|
+
key: key,
|
|
20
|
+
onResize: function onResize(size) {
|
|
21
|
+
return reset(size.width);
|
|
22
|
+
}
|
|
30
23
|
};
|
|
31
24
|
}
|
package/lib/text/style/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _templateObject, _templateObject2;
|
|
11
11
|
var style = {
|
|
12
|
-
wrapper: (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &.ant-typography {\n color: inherit;\n margin-bottom: 0;\n max-width: 100%;\n }\n "]))),
|
|
12
|
+
wrapper: (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &.ant-typography {\n font-size: inherit;\n color: inherit;\n margin-bottom: 0;\n max-width: 100%;\n }\n "]))),
|
|
13
13
|
wordBreak: (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n white-space: pre-wrap;\n word-wrap: break-word;\n word-break: break-word;\n "])))
|
|
14
14
|
};
|
|
15
15
|
var _default = exports.default = style;
|
package/lib/text/type/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EllipsisConfig } from 'antd/
|
|
2
|
-
import type { TypographyProps } from 'antd/
|
|
1
|
+
import { EllipsisConfig } from 'antd/es/typography/Base';
|
|
2
|
+
import type { TypographyProps } from 'antd/es/typography/Typography';
|
|
3
3
|
export interface TextProps extends Omit<TypographyProps<any>, 'onChange'> {
|
|
4
4
|
/**
|
|
5
5
|
* @description 最多显示的行数,设置为 `0` 时,不显示省略号
|