@oceanbase/ui 0.2.13 → 0.2.15
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/ui.min.css +1 -1
- package/dist/ui.min.js +1 -1
- package/es/Action/Item.js +6 -8
- package/es/BackgroundTaskManager/index.d.ts +5 -5
- package/es/BackgroundTaskManager/index.js +1 -1
- package/es/BasicLayout/Header.d.ts +1 -1
- package/es/BasicLayout/Header.js +4 -4
- package/es/BasicLayout/index.d.ts +3 -2
- package/es/BasicLayout/index.js +6 -7
- package/es/BasicLayout/style/index.d.ts +7 -3
- package/es/BatchOperationBar/index.d.ts +3 -3
- package/es/Boundary/constant.d.ts +4 -4
- package/es/ContentWithIcon/index.d.ts +21 -0
- package/es/ContentWithIcon/index.js +110 -0
- package/{lib/ContentWithQuestion → es/ContentWithIcon}/index.less +5 -1
- package/es/DocDialog/index.js +1 -2
- package/es/FullscreenBox/index.d.ts +1 -1
- package/es/Highlight/index.d.ts +2 -2
- package/es/LocaleDropdown/index.d.ts +1 -1
- package/es/Login/ActivateForm.d.ts +1 -1
- package/es/Login/ActivateForm.js +5 -5
- package/es/Login/LoginForm.d.ts +1 -1
- package/es/Login/RegisterForm.d.ts +1 -1
- package/es/Login/RegisterForm.js +5 -5
- package/es/Login/index.d.ts +2 -2
- package/es/Lottie/index.d.ts +2 -1
- package/es/NavMenu/index.js +5 -6
- package/es/PageContainer/ItemRender.js +3 -3
- package/es/PageContainer/index.d.ts +2 -2
- package/es/PageContainer/index.js +2 -3
- package/es/PageContainer/style/index.d.ts +6 -2
- package/es/Password/index.d.ts +2 -2
- package/es/Ranger/QuickPicker.d.ts +2 -1
- package/es/Ranger/Ranger.d.ts +3 -3
- package/es/Ranger/index.d.ts +1 -32
- package/es/SideTip/index.d.ts +4 -4
- package/es/TagSelect/Group.d.ts +23 -0
- package/es/TagSelect/Group.js +121 -0
- package/es/TagSelect/Item.d.ts +17 -0
- package/es/TagSelect/Item.js +84 -0
- package/es/TagSelect/TagSelectContext.d.ts +13 -0
- package/es/TagSelect/TagSelectContext.js +3 -0
- package/es/TagSelect/index.d.ts +6 -0
- package/es/TagSelect/index.js +6 -0
- package/es/TagSelect/style/index.d.ts +9 -0
- package/es/TagSelect/style/index.js +98 -0
- package/es/TreeSearch/index.d.ts +1 -1
- package/es/Welcome/index.d.ts +2 -2
- package/es/_util/genComponentStyleHook.d.ts +6 -2
- package/es/_util/genComponentStyleHook.js +5 -5
- package/es/_util/useNavigate.d.ts +2 -0
- package/es/_util/useNavigate.js +7 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +3 -2
- package/es/interface.d.ts +1 -1
- package/es/locale/en-US.js +2 -2
- package/es/locale/index.d.ts +2 -2
- package/es/locale/zh-CN.js +2 -2
- package/es/locale/zh-TW.js +2 -2
- package/lib/Action/Item.js +5 -7
- package/lib/BackgroundTaskManager/index.d.ts +5 -5
- package/lib/BackgroundTaskManager/index.js +1 -1
- package/lib/BasicLayout/Header.d.ts +1 -1
- package/lib/BasicLayout/Header.js +4 -4
- package/lib/BasicLayout/index.d.ts +3 -2
- package/lib/BasicLayout/index.js +6 -6
- package/lib/BasicLayout/style/index.d.ts +7 -3
- package/lib/BatchOperationBar/index.d.ts +3 -3
- package/lib/Boundary/constant.d.ts +4 -4
- package/lib/ContentWithIcon/index.d.ts +21 -0
- package/lib/ContentWithIcon/index.js +130 -0
- package/{es/ContentWithQuestion → lib/ContentWithIcon}/index.less +5 -1
- package/lib/DocDialog/index.js +1 -2
- package/lib/FullscreenBox/index.d.ts +1 -1
- package/lib/Highlight/index.d.ts +2 -2
- package/lib/LocaleDropdown/index.d.ts +1 -1
- package/lib/Login/ActivateForm.d.ts +1 -1
- package/lib/Login/ActivateForm.js +5 -5
- package/lib/Login/LoginForm.d.ts +1 -1
- package/lib/Login/RegisterForm.d.ts +1 -1
- package/lib/Login/RegisterForm.js +5 -5
- package/lib/Login/index.d.ts +2 -2
- package/lib/Lottie/index.d.ts +2 -1
- package/lib/NavMenu/index.js +5 -6
- package/lib/PageContainer/ItemRender.js +3 -3
- package/lib/PageContainer/index.d.ts +2 -2
- package/lib/PageContainer/index.js +2 -3
- package/lib/PageContainer/style/index.d.ts +6 -2
- package/lib/Password/index.d.ts +2 -2
- package/lib/Ranger/QuickPicker.d.ts +2 -1
- package/lib/Ranger/Ranger.d.ts +3 -3
- package/lib/Ranger/index.d.ts +1 -32
- package/lib/SideTip/index.d.ts +4 -4
- package/lib/TagSelect/Group.d.ts +23 -0
- package/lib/TagSelect/Group.js +128 -0
- package/lib/TagSelect/Item.d.ts +17 -0
- package/lib/TagSelect/Item.js +108 -0
- package/lib/TagSelect/TagSelectContext.d.ts +13 -0
- package/lib/TagSelect/TagSelectContext.js +27 -0
- package/lib/TagSelect/index.d.ts +6 -0
- package/lib/TagSelect/index.js +37 -0
- package/lib/TagSelect/style/index.d.ts +9 -0
- package/lib/TagSelect/style/index.js +152 -0
- package/lib/TreeSearch/index.d.ts +1 -1
- package/lib/Welcome/index.d.ts +2 -2
- package/lib/_util/genComponentStyleHook.d.ts +6 -2
- package/lib/_util/genComponentStyleHook.js +3 -3
- package/lib/_util/useNavigate.d.ts +2 -0
- package/lib/_util/{useHistory.js → useNavigate.js} +10 -11
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -3
- package/lib/interface.d.ts +1 -1
- package/lib/locale/en-US.js +1 -1
- package/lib/locale/index.d.ts +2 -2
- package/lib/locale/zh-CN.js +1 -1
- package/lib/locale/zh-TW.js +1 -1
- package/package.json +10 -11
- package/es/ContentWithQuestion/index.d.ts +0 -13
- package/es/ContentWithQuestion/index.js +0 -46
- package/es/_util/useHistory.d.ts +0 -4
- package/es/_util/useHistory.js +0 -13
- package/lib/ContentWithQuestion/index.d.ts +0 -13
- package/lib/ContentWithQuestion/index.js +0 -76
- package/lib/_util/useHistory.d.ts +0 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IconComponentProps } from '@oceanbase/icons/es/components/Icon';
|
|
2
2
|
import type { PageContainerProps as AntPageContainerProps, PageHeaderProps as AntPageHeaderProps } from '@ant-design/pro-components';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export
|
|
4
|
+
export type ReloadType = boolean | IconComponentProps | React.ReactNode;
|
|
5
5
|
export interface PageContainerLocale {
|
|
6
6
|
reload?: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type PageHeaderProps = AntPageHeaderProps & {
|
|
9
9
|
reload?: ReloadType;
|
|
10
10
|
};
|
|
11
11
|
export interface PageContainerProps extends AntPageContainerProps {
|
|
@@ -56,7 +56,7 @@ var PageContainer = ({
|
|
|
56
56
|
const { getPrefixCls } = (0, import_react.useContext)(import_design.ConfigProvider.ConfigContext);
|
|
57
57
|
const rootPrefixCls = getPrefixCls();
|
|
58
58
|
const prefixCls = getPrefixCls("pro-page-container", customizePrefixCls);
|
|
59
|
-
const { wrapSSR
|
|
59
|
+
const { wrapSSR } = (0, import_style.default)(prefixCls);
|
|
60
60
|
const { reload, subTitle, breadcrumb } = header || {};
|
|
61
61
|
const reloadProps = (0, import_lodash.isObject)(reload) && !import_react.default.isValidElement(reload) ? reload : {};
|
|
62
62
|
const reloadCls = (0, import_classnames.default)(
|
|
@@ -79,8 +79,7 @@ var PageContainer = ({
|
|
|
79
79
|
{
|
|
80
80
|
[`${prefixCls}-no-page-header`]: noHasHeader
|
|
81
81
|
},
|
|
82
|
-
className
|
|
83
|
-
hashId
|
|
82
|
+
className
|
|
84
83
|
);
|
|
85
84
|
return wrapSSR(
|
|
86
85
|
/* @__PURE__ */ import_react.default.createElement(
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { PageContainerToken } from '@ant-design/pro-layout/es/components/PageContainer/style';
|
|
2
|
-
import type { GenerateStyle } from '
|
|
3
|
+
import type { GenerateStyle } from '@oceanbase/design/es/theme';
|
|
3
4
|
export declare const genPageContainerStyle: GenerateStyle<PageContainerToken>;
|
|
4
|
-
declare const _default: (prefixCls: string) =>
|
|
5
|
+
declare const _default: (prefixCls: string) => {
|
|
6
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
|
|
7
|
+
hashId: string;
|
|
8
|
+
};
|
|
5
9
|
export default _default;
|
package/lib/Password/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PasswordProps as
|
|
1
|
+
import type { PasswordProps as InputPasswordProps } from '@oceanbase/design/es/input';
|
|
2
2
|
import type { LocaleWrapperProps } from '../locale/LocaleWrapper';
|
|
3
3
|
import type { Validator } from './Content';
|
|
4
4
|
export interface PasswordLocale {
|
|
@@ -13,7 +13,7 @@ export interface PasswordLocale {
|
|
|
13
13
|
copyPassword: string;
|
|
14
14
|
andKeepItProperly: string;
|
|
15
15
|
}
|
|
16
|
-
export interface PasswordProps extends LocaleWrapperProps, Omit<
|
|
16
|
+
export interface PasswordProps extends LocaleWrapperProps, Omit<InputPasswordProps, 'onChange'> {
|
|
17
17
|
value?: string;
|
|
18
18
|
onChange?: (value?: string) => void;
|
|
19
19
|
rules?: Validator[];
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { LocaleWrapperProps } from '../locale/LocaleWrapper';
|
|
3
3
|
import type { RangeValue } from './Ranger';
|
|
4
4
|
import type { RangeOption } from './typing';
|
|
5
|
-
export
|
|
5
|
+
export type QuickType = 'select' | 'dropdown';
|
|
6
6
|
interface IProps extends LocaleWrapperProps {
|
|
7
7
|
selects: RangeOption[];
|
|
8
8
|
type?: QuickType;
|
|
@@ -12,6 +12,7 @@ interface IProps extends LocaleWrapperProps {
|
|
|
12
12
|
name?: string;
|
|
13
13
|
defaultName?: string;
|
|
14
14
|
isMoment?: boolean;
|
|
15
|
+
size?: 'small' | 'large' | 'middle';
|
|
15
16
|
}
|
|
16
17
|
declare const _default: (props: IProps) => React.JSX.Element;
|
|
17
18
|
export default _default;
|
package/lib/Ranger/Ranger.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Dayjs } from 'dayjs';
|
|
2
2
|
import type { Moment } from 'moment';
|
|
3
3
|
import './index.less';
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
4
|
+
export type RangeName = 'customize' | string;
|
|
5
|
+
export type RangeValue = [Moment, Moment] | [Dayjs, Dayjs];
|
|
6
|
+
export type RangeDateValue = {
|
|
7
7
|
name: RangeName;
|
|
8
8
|
range: RangeValue;
|
|
9
9
|
};
|
package/lib/Ranger/index.d.ts
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import InternalRanger from './Ranger';
|
|
3
|
-
import type { RangeOption } from './typing';
|
|
4
|
-
declare type InternalRangerType = typeof InternalRanger;
|
|
5
|
-
interface RangerType extends InternalRangerType {
|
|
6
|
-
NEAR_1_MINUTES: RangeOption;
|
|
7
|
-
NEAR_5_MINUTES: RangeOption;
|
|
8
|
-
NEAR_10_MINUTES: RangeOption;
|
|
9
|
-
NEAR_20_MINUTES: RangeOption;
|
|
10
|
-
NEAR_30_MINUTES: RangeOption;
|
|
11
|
-
NEAR_1_HOURS: RangeOption;
|
|
12
|
-
NEAR_2_HOURS: RangeOption;
|
|
13
|
-
NEAR_3_HOURS: RangeOption;
|
|
14
|
-
NEAR_6_HOURS: RangeOption;
|
|
15
|
-
TODAY: RangeOption;
|
|
16
|
-
YESTERDAY: RangeOption;
|
|
17
|
-
TOMORROW: RangeOption;
|
|
18
|
-
THIS_WEEK: RangeOption;
|
|
19
|
-
LAST_WEEK: RangeOption;
|
|
20
|
-
NEXT_WEEK: RangeOption;
|
|
21
|
-
THIS_MONTH: RangeOption;
|
|
22
|
-
LAST_MONTH: RangeOption;
|
|
23
|
-
NEXT_MONTH: RangeOption;
|
|
24
|
-
THIS_QUARTER: RangeOption;
|
|
25
|
-
LAST_QUARTER: RangeOption;
|
|
26
|
-
NEXT_QUARTER: RangeOption;
|
|
27
|
-
THIS_YEAR: RangeOption;
|
|
28
|
-
LAST_YEAR: RangeOption;
|
|
29
|
-
NEXT_YEAR: RangeOption;
|
|
30
|
-
QuickPicker: typeof QuickPicker;
|
|
31
|
-
}
|
|
32
|
-
declare const Ranger: RangerType;
|
|
1
|
+
declare const Ranger: any;
|
|
33
2
|
export default Ranger;
|
package/lib/SideTip/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { BadgeProps } from '
|
|
2
|
-
import type { TooltipPropsWithTitle } from '
|
|
1
|
+
import type { BadgeProps } from '@oceanbase/design/es/badge/index';
|
|
2
|
+
import type { TooltipPropsWithTitle } from '@oceanbase/design/es/tooltip/index';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import type { LocaleWrapperProps } from '../locale/LocaleWrapper';
|
|
5
5
|
import './index.less';
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type SideTipType = 'primary' | 'default';
|
|
7
|
+
export type SideTipSize = 'small' | 'default';
|
|
8
8
|
export interface Position {
|
|
9
9
|
/**
|
|
10
10
|
* @title 距离右侧
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export type TagSelectValueType = string | number;
|
|
3
|
+
export interface TagSelectOptionType {
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
value: TagSelectValueType;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onChange?: (e: any) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface TagSelectGroupProps {
|
|
11
|
+
title?: string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
multiple?: boolean;
|
|
16
|
+
defaultValue?: TagSelectValueType | Array<TagSelectValueType>;
|
|
17
|
+
value?: TagSelectValueType | Array<TagSelectValueType>;
|
|
18
|
+
size?: string;
|
|
19
|
+
options?: Array<TagSelectOptionType | string | number>;
|
|
20
|
+
onChange?: (value: Array<TagSelectValueType> | TagSelectValueType) => void;
|
|
21
|
+
}
|
|
22
|
+
declare const Group: React.FC<TagSelectGroupProps>;
|
|
23
|
+
export default Group;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/TagSelect/Group.tsx
|
|
30
|
+
var Group_exports = {};
|
|
31
|
+
__export(Group_exports, {
|
|
32
|
+
default: () => Group_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Group_exports);
|
|
35
|
+
var import_classnames = __toESM(require("classnames"));
|
|
36
|
+
var import_util = require("../_util");
|
|
37
|
+
var import_react = __toESM(require("react"));
|
|
38
|
+
var import_TagSelectContext = __toESM(require("./TagSelectContext"));
|
|
39
|
+
var import_Item = __toESM(require("./Item"));
|
|
40
|
+
var import_style = __toESM(require("./style"));
|
|
41
|
+
function toArray(value) {
|
|
42
|
+
let res = value;
|
|
43
|
+
if (value === void 0) {
|
|
44
|
+
res = [];
|
|
45
|
+
} else if (!Array.isArray(value)) {
|
|
46
|
+
res = [value];
|
|
47
|
+
}
|
|
48
|
+
return res;
|
|
49
|
+
}
|
|
50
|
+
var Group = ({
|
|
51
|
+
title,
|
|
52
|
+
multiple,
|
|
53
|
+
defaultValue,
|
|
54
|
+
size = "middle",
|
|
55
|
+
options = [],
|
|
56
|
+
children,
|
|
57
|
+
className,
|
|
58
|
+
...restProps
|
|
59
|
+
}) => {
|
|
60
|
+
const prefix = (0, import_util.getPrefix)("tag-select");
|
|
61
|
+
const { wrapSSR, hashId } = (0, import_style.default)(prefix);
|
|
62
|
+
const [value, setValue] = (0, import_react.useState)(toArray(defaultValue || restProps.value));
|
|
63
|
+
const [registeredValues, setRegisteredValues] = import_react.default.useState([]);
|
|
64
|
+
const registerValue = (val) => {
|
|
65
|
+
setRegisteredValues((prev) => [...prev, val]);
|
|
66
|
+
};
|
|
67
|
+
(0, import_react.useEffect)(() => {
|
|
68
|
+
if ("value" in restProps) {
|
|
69
|
+
setValue(toArray(restProps.value));
|
|
70
|
+
}
|
|
71
|
+
}, [restProps.value]);
|
|
72
|
+
const handleValueChange = (v) => {
|
|
73
|
+
var _a;
|
|
74
|
+
const registeredValue = value.filter((v1) => registeredValues.includes(v1));
|
|
75
|
+
const newValue = [...registeredValue];
|
|
76
|
+
const index = newValue.indexOf(v);
|
|
77
|
+
const checkedValue = index === -1 ? v : void 0;
|
|
78
|
+
if (multiple) {
|
|
79
|
+
if (index === -1) {
|
|
80
|
+
newValue.push(v);
|
|
81
|
+
} else {
|
|
82
|
+
newValue.splice(index, 1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (!("value" in restProps)) {
|
|
86
|
+
setValue(multiple ? newValue : [checkedValue]);
|
|
87
|
+
}
|
|
88
|
+
(_a = restProps.onChange) == null ? void 0 : _a.call(restProps, multiple ? newValue : checkedValue);
|
|
89
|
+
};
|
|
90
|
+
const contextValue = {
|
|
91
|
+
multiple,
|
|
92
|
+
size,
|
|
93
|
+
value,
|
|
94
|
+
disabled: restProps.disabled,
|
|
95
|
+
onChange: restProps.onChange,
|
|
96
|
+
registerValue,
|
|
97
|
+
handleValueChange
|
|
98
|
+
};
|
|
99
|
+
const memoOptions = (0, import_react.useMemo)(() => {
|
|
100
|
+
return options.map((option) => {
|
|
101
|
+
if (typeof option === "string" || typeof option === "number") {
|
|
102
|
+
return { label: option, value: option };
|
|
103
|
+
}
|
|
104
|
+
return option;
|
|
105
|
+
});
|
|
106
|
+
}, [options]);
|
|
107
|
+
const childrenNode = options.length ? memoOptions.map((option) => /* @__PURE__ */ import_react.default.createElement(
|
|
108
|
+
import_Item.default,
|
|
109
|
+
{
|
|
110
|
+
key: option.value.toString(),
|
|
111
|
+
disabled: "disabled" in option ? option.disabled : restProps.disabled,
|
|
112
|
+
value: option.value,
|
|
113
|
+
onChange: option.onChange,
|
|
114
|
+
style: option.style,
|
|
115
|
+
checked: value == null ? void 0 : value.includes(option.value)
|
|
116
|
+
},
|
|
117
|
+
option.label
|
|
118
|
+
)) : children;
|
|
119
|
+
const groupCls = (0, import_classnames.default)(
|
|
120
|
+
`${prefix}-container`,
|
|
121
|
+
hashId,
|
|
122
|
+
className
|
|
123
|
+
);
|
|
124
|
+
return wrapSSR(
|
|
125
|
+
/* @__PURE__ */ import_react.default.createElement(import_TagSelectContext.default.Provider, { value: contextValue }, /* @__PURE__ */ import_react.default.createElement("div", { className: groupCls }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}-title` }, title), childrenNode))
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
var Group_default = Group;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TagSelectValueType } from './Group';
|
|
3
|
+
export interface TagSelectItemProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
cover?: React.ReactNode;
|
|
6
|
+
value?: string | number;
|
|
7
|
+
defaultChecked?: boolean;
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
title?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
multiple?: boolean;
|
|
13
|
+
handleChange?: (value: TagSelectValueType) => void;
|
|
14
|
+
onChange?: (e: any) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const Item: React.FC<TagSelectItemProps>;
|
|
17
|
+
export default Item;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/TagSelect/Item.tsx
|
|
30
|
+
var Item_exports = {};
|
|
31
|
+
__export(Item_exports, {
|
|
32
|
+
default: () => Item_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Item_exports);
|
|
35
|
+
var import_rc_checkbox = __toESM(require("rc-checkbox"));
|
|
36
|
+
var import_classnames = __toESM(require("classnames"));
|
|
37
|
+
var import_lodash = require("lodash");
|
|
38
|
+
var import_react = __toESM(require("react"));
|
|
39
|
+
var import_style = __toESM(require("./style"));
|
|
40
|
+
var import_util = require("../_util");
|
|
41
|
+
var import_TagSelectContext = __toESM(require("./TagSelectContext"));
|
|
42
|
+
var Item = ({
|
|
43
|
+
children,
|
|
44
|
+
handleChange,
|
|
45
|
+
onChange,
|
|
46
|
+
cover,
|
|
47
|
+
...restProps
|
|
48
|
+
}) => {
|
|
49
|
+
const [checked, setChecked] = (0, import_react.useState)(restProps.defaultChecked);
|
|
50
|
+
const coverType = typeof cover;
|
|
51
|
+
const prefixCls = (0, import_util.getPrefix)("tag-select");
|
|
52
|
+
const { wrapSSR, hashId } = (0, import_style.default)(prefixCls);
|
|
53
|
+
const tagSelectGroup = import_react.default.useContext(import_TagSelectContext.default);
|
|
54
|
+
const wrapperClassName = (0, import_classnames.default)(
|
|
55
|
+
`${prefixCls}-wrapper`,
|
|
56
|
+
{
|
|
57
|
+
[`${prefixCls}-checked`]: checked,
|
|
58
|
+
multiple: tagSelectGroup.multiple,
|
|
59
|
+
[`${prefixCls}-${tagSelectGroup.size}`]: tagSelectGroup.size,
|
|
60
|
+
[`${prefixCls}-disabled`]: tagSelectGroup.disabled || restProps.disabled,
|
|
61
|
+
[`${prefixCls}-img`]: coverType === "string",
|
|
62
|
+
[`${prefixCls}-custom`]: coverType !== "string"
|
|
63
|
+
},
|
|
64
|
+
hashId
|
|
65
|
+
);
|
|
66
|
+
(0, import_react.useEffect)(() => {
|
|
67
|
+
if ((0, import_lodash.isBoolean)(restProps.checked)) {
|
|
68
|
+
setChecked(restProps.checked);
|
|
69
|
+
}
|
|
70
|
+
}, [restProps.checked]);
|
|
71
|
+
(0, import_react.useEffect)(() => {
|
|
72
|
+
var _a;
|
|
73
|
+
return (_a = tagSelectGroup.registerValue) == null ? void 0 : _a.call(tagSelectGroup, restProps.value);
|
|
74
|
+
}, [restProps.value]);
|
|
75
|
+
(0, import_react.useEffect)(() => {
|
|
76
|
+
var _a;
|
|
77
|
+
if (((_a = tagSelectGroup.value) == null ? void 0 : _a.includes(restProps.value)) || restProps.checked || restProps.defaultChecked) {
|
|
78
|
+
setChecked(true);
|
|
79
|
+
} else {
|
|
80
|
+
setChecked(false);
|
|
81
|
+
}
|
|
82
|
+
}, [tagSelectGroup.value, restProps.value]);
|
|
83
|
+
const renderCover = () => {
|
|
84
|
+
return coverType === "string" ? /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefixCls}-cover` }, /* @__PURE__ */ import_react.default.createElement("img", { src: cover, alt: "tagselect" })) : cover;
|
|
85
|
+
};
|
|
86
|
+
return wrapSSR(
|
|
87
|
+
/* @__PURE__ */ import_react.default.createElement("label", { className: wrapperClassName, style: restProps.style }, /* @__PURE__ */ import_react.default.createElement(
|
|
88
|
+
import_rc_checkbox.default,
|
|
89
|
+
{
|
|
90
|
+
...restProps,
|
|
91
|
+
checked,
|
|
92
|
+
prefixCls,
|
|
93
|
+
onChange: (e) => {
|
|
94
|
+
if (!("checked" in restProps) && !Object.keys(tagSelectGroup).length) {
|
|
95
|
+
setChecked(e.target.checked);
|
|
96
|
+
}
|
|
97
|
+
if (onChange) {
|
|
98
|
+
onChange(e);
|
|
99
|
+
}
|
|
100
|
+
if (tagSelectGroup.handleValueChange) {
|
|
101
|
+
tagSelectGroup.handleValueChange(e.target.value);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
), cover ? renderCover() : /* @__PURE__ */ import_react.default.createElement("span", null, children))
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
var Item_default = Item;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { TagSelectValueType } from './Group';
|
|
3
|
+
export type TagSelectContextProps = {
|
|
4
|
+
multiple?: boolean;
|
|
5
|
+
size?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
value?: Array<TagSelectValueType>;
|
|
8
|
+
onChange?: (value: Array<TagSelectValueType> | TagSelectValueType) => void;
|
|
9
|
+
registerValue?: (val: TagSelectValueType) => void;
|
|
10
|
+
handleValueChange?: (val: TagSelectValueType) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const TagSelectContext: import("react").Context<TagSelectContextProps>;
|
|
13
|
+
export default TagSelectContext;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/TagSelect/TagSelectContext.ts
|
|
20
|
+
var TagSelectContext_exports = {};
|
|
21
|
+
__export(TagSelectContext_exports, {
|
|
22
|
+
default: () => TagSelectContext_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(TagSelectContext_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var TagSelectContext = (0, import_react.createContext)({});
|
|
27
|
+
var TagSelectContext_default = TagSelectContext;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/TagSelect/index.tsx
|
|
30
|
+
var TagSelect_exports = {};
|
|
31
|
+
__export(TagSelect_exports, {
|
|
32
|
+
default: () => TagSelect_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(TagSelect_exports);
|
|
35
|
+
var import_Group = __toESM(require("./Group"));
|
|
36
|
+
var import_Item = __toESM(require("./Item"));
|
|
37
|
+
var TagSelect_default = { Group: import_Group.default, Item: import_Item.default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FullToken, GenerateStyle } from 'antd/lib/theme/internal';
|
|
3
|
+
export type TagSelectToken = FullToken<any>;
|
|
4
|
+
export declare const genTagSelectStyle: GenerateStyle<TagSelectToken>;
|
|
5
|
+
declare const _default: (prefixCls: string) => {
|
|
6
|
+
wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
|
|
7
|
+
hashId: string;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|