@akinon/ui-select 0.3.0 → 0.5.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/cjs/index.d.ts +3 -3
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/types.d.ts +68 -0
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/types.d.ts +68 -0
- package/package.json +3 -9
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SelectProps as AntSelectProps } from 'antd';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
export declare const Select: ({
|
|
2
|
+
import type { SelectProps } from './types';
|
|
3
|
+
export declare const Select: ({ ...restSelectProps }: SelectProps) => React.JSX.Element;
|
|
4
|
+
export type * from './types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,MAAM,2BAA4B,WAAW,sBAEzD,CAAC;AAEF,mBAAmB,SAAS,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.Select = void 0;
|
|
|
15
15
|
const antd_1 = require("antd");
|
|
16
16
|
const React = require("react");
|
|
17
17
|
const Select = (_a) => {
|
|
18
|
-
var
|
|
19
|
-
return
|
|
18
|
+
var restSelectProps = __rest(_a, []);
|
|
19
|
+
return React.createElement(antd_1.Select, Object.assign({ size: "large" }, restSelectProps));
|
|
20
20
|
};
|
|
21
21
|
exports.Select = Select;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface BaseOptionType {
|
|
2
|
+
disabled?: boolean;
|
|
3
|
+
className?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
[name: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DefaultOptionType extends BaseOptionType {
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
value?: string | number | null;
|
|
11
|
+
children?: Omit<DefaultOptionType, 'children'>[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type SelectHandler<ValueType, OptionType> = (
|
|
15
|
+
value: ValueType,
|
|
16
|
+
option: OptionType
|
|
17
|
+
) => void;
|
|
18
|
+
|
|
19
|
+
export type ArrayElementType<T> = T extends (infer E)[] ? E : T;
|
|
20
|
+
|
|
21
|
+
export interface SelectProps<
|
|
22
|
+
ValueType = string | number | boolean,
|
|
23
|
+
OptionType extends BaseOptionType = DefaultOptionType
|
|
24
|
+
> extends BaseSelectPropsWithoutPrivate {
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
allowClear?: boolean;
|
|
27
|
+
prefixCls?: string;
|
|
28
|
+
id?: string;
|
|
29
|
+
fieldNames?: FieldNames;
|
|
30
|
+
searchValue?: string;
|
|
31
|
+
onSearch?: (value: string) => void;
|
|
32
|
+
autoClearSearchValue?: boolean;
|
|
33
|
+
onSelect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
34
|
+
onDeselect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
35
|
+
filterOption?: boolean | FilterFunc<OptionType>;
|
|
36
|
+
filterSort?: (optionA: OptionType, optionB: OptionType) => number;
|
|
37
|
+
optionFilterProp?: string;
|
|
38
|
+
optionLabelProp?: string;
|
|
39
|
+
size?: 'small' | 'middle' | 'large';
|
|
40
|
+
options?: OptionType[];
|
|
41
|
+
optionRender?: (
|
|
42
|
+
oriOption: FlattenOptionData<BaseOptionType>,
|
|
43
|
+
info: {
|
|
44
|
+
index: number;
|
|
45
|
+
}
|
|
46
|
+
) => React.ReactNode;
|
|
47
|
+
defaultActiveFirstOption?: boolean;
|
|
48
|
+
virtual?: boolean;
|
|
49
|
+
direction?: 'ltr' | 'rtl';
|
|
50
|
+
listHeight?: number;
|
|
51
|
+
listItemHeight?: number;
|
|
52
|
+
labelRender?: (props: LabelInValueType) => React.ReactNode;
|
|
53
|
+
menuItemSelectedIcon?: RenderNode;
|
|
54
|
+
mode?: 'combobox' | 'multiple' | 'tags';
|
|
55
|
+
labelInValue?: boolean;
|
|
56
|
+
value?: ValueType | null;
|
|
57
|
+
defaultValue?: ValueType | null;
|
|
58
|
+
maxCount?: number;
|
|
59
|
+
onChange?: (value: ValueType, option?: OptionType | OptionType[]) => void;
|
|
60
|
+
rootClassName?: string;
|
|
61
|
+
suffixIcon?: React.ReactNode;
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
showArrow?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @default "outlined"
|
|
66
|
+
*/
|
|
67
|
+
variant?: 'outlined' | 'borderless' | 'filled';
|
|
68
|
+
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SelectProps as AntSelectProps } from 'antd';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
export declare const Select: ({
|
|
2
|
+
import type { SelectProps } from './types';
|
|
3
|
+
export declare const Select: ({ ...restSelectProps }: SelectProps) => React.JSX.Element;
|
|
4
|
+
export type * from './types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,MAAM,2BAA4B,WAAW,sBAEzD,CAAC;AAEF,mBAAmB,SAAS,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -12,6 +12,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { Select as AntSelect } from 'antd';
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
export const Select = (_a) => {
|
|
15
|
-
var
|
|
16
|
-
return
|
|
15
|
+
var restSelectProps = __rest(_a, []);
|
|
16
|
+
return React.createElement(AntSelect, Object.assign({ size: "large" }, restSelectProps));
|
|
17
17
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export interface BaseOptionType {
|
|
2
|
+
disabled?: boolean;
|
|
3
|
+
className?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
[name: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DefaultOptionType extends BaseOptionType {
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
value?: string | number | null;
|
|
11
|
+
children?: Omit<DefaultOptionType, 'children'>[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type SelectHandler<ValueType, OptionType> = (
|
|
15
|
+
value: ValueType,
|
|
16
|
+
option: OptionType
|
|
17
|
+
) => void;
|
|
18
|
+
|
|
19
|
+
export type ArrayElementType<T> = T extends (infer E)[] ? E : T;
|
|
20
|
+
|
|
21
|
+
export interface SelectProps<
|
|
22
|
+
ValueType = string | number | boolean,
|
|
23
|
+
OptionType extends BaseOptionType = DefaultOptionType
|
|
24
|
+
> extends BaseSelectPropsWithoutPrivate {
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
allowClear?: boolean;
|
|
27
|
+
prefixCls?: string;
|
|
28
|
+
id?: string;
|
|
29
|
+
fieldNames?: FieldNames;
|
|
30
|
+
searchValue?: string;
|
|
31
|
+
onSearch?: (value: string) => void;
|
|
32
|
+
autoClearSearchValue?: boolean;
|
|
33
|
+
onSelect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
34
|
+
onDeselect?: SelectHandler<ArrayElementType<ValueType>, OptionType>;
|
|
35
|
+
filterOption?: boolean | FilterFunc<OptionType>;
|
|
36
|
+
filterSort?: (optionA: OptionType, optionB: OptionType) => number;
|
|
37
|
+
optionFilterProp?: string;
|
|
38
|
+
optionLabelProp?: string;
|
|
39
|
+
size?: 'small' | 'middle' | 'large';
|
|
40
|
+
options?: OptionType[];
|
|
41
|
+
optionRender?: (
|
|
42
|
+
oriOption: FlattenOptionData<BaseOptionType>,
|
|
43
|
+
info: {
|
|
44
|
+
index: number;
|
|
45
|
+
}
|
|
46
|
+
) => React.ReactNode;
|
|
47
|
+
defaultActiveFirstOption?: boolean;
|
|
48
|
+
virtual?: boolean;
|
|
49
|
+
direction?: 'ltr' | 'rtl';
|
|
50
|
+
listHeight?: number;
|
|
51
|
+
listItemHeight?: number;
|
|
52
|
+
labelRender?: (props: LabelInValueType) => React.ReactNode;
|
|
53
|
+
menuItemSelectedIcon?: RenderNode;
|
|
54
|
+
mode?: 'combobox' | 'multiple' | 'tags';
|
|
55
|
+
labelInValue?: boolean;
|
|
56
|
+
value?: ValueType | null;
|
|
57
|
+
defaultValue?: ValueType | null;
|
|
58
|
+
maxCount?: number;
|
|
59
|
+
onChange?: (value: ValueType, option?: OptionType | OptionType[]) => void;
|
|
60
|
+
rootClassName?: string;
|
|
61
|
+
suffixIcon?: React.ReactNode;
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
showArrow?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* @default "outlined"
|
|
66
|
+
*/
|
|
67
|
+
variant?: 'outlined' | 'borderless' | 'filled';
|
|
68
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/ui-select",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
"copyfiles": "^2.4.1",
|
|
17
17
|
"rimraf": "^5.0.5",
|
|
18
18
|
"typescript": "^5.2.2",
|
|
19
|
-
"@akinon/
|
|
20
|
-
"@akinon/vite-config": "0.4.0",
|
|
21
|
-
"@akinon/typescript-config": "0.2.0"
|
|
19
|
+
"@akinon/typescript-config": "0.4.0"
|
|
22
20
|
},
|
|
23
21
|
"peerDependencies": {
|
|
24
22
|
"react": ">=18",
|
|
@@ -38,12 +36,8 @@
|
|
|
38
36
|
"build": "pnpm run build:esm && pnpm run build:commonjs && pnpm run copy:files",
|
|
39
37
|
"build:esm": "tsc --outDir dist/esm",
|
|
40
38
|
"build:commonjs": "tsc --module commonjs --outDir dist/cjs",
|
|
41
|
-
"copy:files": "copyfiles -u 1 src
|
|
39
|
+
"copy:files": "copyfiles -u 1 \"src/**/*.!(ts|tsx)\" dist/esm && copyfiles -u 1 \"src/**/*.!(ts|tsx)\" dist/cjs",
|
|
42
40
|
"clean": "rimraf dist/",
|
|
43
|
-
"lint": "eslint *.ts*",
|
|
44
|
-
"test": "vitest run",
|
|
45
|
-
"test:ui": "vitest --ui",
|
|
46
|
-
"test:watch": "vitest watch",
|
|
47
41
|
"typecheck": "tsc --noEmit"
|
|
48
42
|
}
|
|
49
43
|
}
|