@jswork/antd-components 1.0.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.
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { SearchProps } from 'antd/es/input';
3
+ type StdEventTarget = {
4
+ target: {
5
+ value: any;
6
+ };
7
+ };
8
+ type StdCallback = (inEvent: StdEventTarget) => void;
9
+ type Props = {
10
+ className?: string;
11
+ value?: boolean;
12
+ onChange?: StdCallback;
13
+ onSearch?: StdCallback;
14
+ autoComplete?: boolean;
15
+ } & SearchProps;
16
+ export declare class AcSearch extends React.Component<Props> {
17
+ static displayName: string;
18
+ static defaultProps: {
19
+ onChange: any;
20
+ onSearch: any;
21
+ autoComplete: boolean;
22
+ placeholder: string;
23
+ };
24
+ get complete(): "on" | "off";
25
+ handleSearch: (inEvent: any) => void;
26
+ render(): JSX.Element;
27
+ }
28
+ export {};
@@ -0,0 +1,31 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+ type StdEventTarget = {
3
+ target: {
4
+ value: any;
5
+ };
6
+ };
7
+ type StdCallback = (inEvent: StdEventTarget) => void;
8
+ type TemplateCallback = (item: {
9
+ item: any;
10
+ index: number;
11
+ }) => React.ReactNode;
12
+ type Props = {
13
+ className?: string;
14
+ items?: any[];
15
+ onChange?: StdCallback;
16
+ onSearch?: StdCallback;
17
+ template?: TemplateCallback;
18
+ } & HTMLAttributes<any>;
19
+ export declare class AcSelect extends React.Component<Props> {
20
+ static displayName: string;
21
+ static defaultProps: {
22
+ placeholder: string;
23
+ items: never[];
24
+ template: (args: any) => JSX.Element;
25
+ onChange: any;
26
+ onSearch: any;
27
+ };
28
+ handleChange: (inValue: any) => void;
29
+ render(): JSX.Element;
30
+ }
31
+ export {};
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { SliderRangeProps } from 'antd/es/slider';
3
+ type StdEventTarget = {
4
+ target: {
5
+ value: any;
6
+ };
7
+ };
8
+ type StdCallback = (inEvent: StdEventTarget) => void;
9
+ type Props = {
10
+ className?: string;
11
+ range?: true;
12
+ onChange?: StdCallback;
13
+ } & Omit<SliderRangeProps, 'range'>;
14
+ export declare class AcSliderRange extends React.Component<Props> {
15
+ static displayName: string;
16
+ static defaultProps: {
17
+ onChange: any;
18
+ };
19
+ handleChange: (inEvent: any) => void;
20
+ render(): JSX.Element;
21
+ }
22
+ export {};
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { SliderSingleProps } from 'antd';
3
+ type StdEventTarget = {
4
+ target: {
5
+ value: any;
6
+ };
7
+ };
8
+ type StdCallback = (inEvent: StdEventTarget) => void;
9
+ type Props = {
10
+ className?: string;
11
+ onChange?: StdCallback;
12
+ } & SliderSingleProps;
13
+ export declare class AcSlider extends React.Component<Props> {
14
+ static displayName: string;
15
+ static defaultProps: {
16
+ onChange: any;
17
+ };
18
+ handleChange: (inEvent: any) => void;
19
+ render(): JSX.Element;
20
+ }
21
+ export {};
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { SwitchProps } from 'antd';
3
+ type StdEventTarget = {
4
+ target: {
5
+ value: any;
6
+ };
7
+ };
8
+ type StdCallback = (inEvent: StdEventTarget) => void;
9
+ type Props = {
10
+ className?: string;
11
+ value?: boolean;
12
+ onChange?: StdCallback;
13
+ } & SwitchProps;
14
+ export declare class AcSwitch extends React.Component<Props> {
15
+ static displayName: string;
16
+ static defaultProps: {
17
+ onChange: any;
18
+ };
19
+ handleChange: (inEvent: any) => void;
20
+ render(): JSX.Element;
21
+ }
22
+ export {};
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { TextAreaProps } from 'antd/es/input';
3
+ type StdEventTarget = {
4
+ target: {
5
+ value: any;
6
+ };
7
+ };
8
+ type StdCallback = (inEvent: StdEventTarget) => void;
9
+ type Props = {
10
+ className?: string;
11
+ value?: boolean;
12
+ onChange?: StdCallback;
13
+ } & TextAreaProps;
14
+ export declare class AcTextarea extends React.Component<Props> {
15
+ static displayName: string;
16
+ static defaultProps: {
17
+ onChange: any;
18
+ };
19
+ render(): JSX.Element;
20
+ }
21
+ export {};
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { TimePickerProps } from 'antd';
3
+ import dayjs from 'dayjs';
4
+ type StdEventTarget = {
5
+ target: {
6
+ value: any;
7
+ };
8
+ };
9
+ type StdCallback = (inEvent: StdEventTarget) => void;
10
+ type Props = {
11
+ className?: string;
12
+ value?: string | dayjs.Dayjs;
13
+ defaultValue?: string | dayjs.Dayjs;
14
+ onChange?: StdCallback;
15
+ } & Omit<TimePickerProps, 'value' | 'defaultValue'>;
16
+ export declare class AcTimePicker extends React.Component<Props> {
17
+ static displayName: string;
18
+ static defaultProps: {
19
+ onChange: any;
20
+ format: string;
21
+ };
22
+ handleChange: (inEvent: any) => void;
23
+ parse: (inValue: any) => dayjs.Dayjs;
24
+ stringify: (inValue: any) => any;
25
+ normalize: (inValues: any) => any;
26
+ render(): JSX.Element;
27
+ }
28
+ export {};
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ import { TransferProps } from 'antd';
3
+ type StdEventTarget = {
4
+ target: {
5
+ value: any;
6
+ };
7
+ };
8
+ type StdCallback = (inEvent: StdEventTarget) => void;
9
+ type TemplateCallback = (item: {
10
+ item: any;
11
+ }, options?: any) => React.ReactNode;
12
+ type Props = {
13
+ className?: string;
14
+ items?: any[];
15
+ template: TemplateCallback;
16
+ value?: any[];
17
+ defaultValue?: any[];
18
+ onChange?: StdCallback;
19
+ } & TransferProps<any>;
20
+ export declare class AcTransfer extends React.Component<Props> {
21
+ static displayName: string;
22
+ static defaultProps: {
23
+ items: never[];
24
+ template: ({ item }: {
25
+ item: any;
26
+ }, options?: any) => React.ReactNode;
27
+ defaultValue: never[];
28
+ onChange: any;
29
+ };
30
+ get templateCallback(): any;
31
+ state: {
32
+ value: any[] | undefined;
33
+ };
34
+ handleChange: (inEvent: any) => void;
35
+ render(): JSX.Element;
36
+ }
37
+ export {};
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { TreeSelectProps } from 'antd';
3
+ type StdEventTarget = {
4
+ target: {
5
+ value: any;
6
+ };
7
+ };
8
+ type StdCallback = (inEvent: StdEventTarget) => void;
9
+ type Props = {
10
+ className?: string;
11
+ items?: any[];
12
+ template?: any;
13
+ itemsKey?: string | ((index: number, item: any) => any);
14
+ onChange?: StdCallback;
15
+ } & TreeSelectProps;
16
+ export declare class AcTreeSelect extends React.Component<Props> {
17
+ static displayName: string;
18
+ static defaultProps: {
19
+ items: never[];
20
+ template: ({ item }: {
21
+ item: any;
22
+ }, cb: any) => JSX.Element;
23
+ itemsKey: string;
24
+ onChange: any;
25
+ };
26
+ get childView(): any;
27
+ handleChange: (inValue: any) => void;
28
+ render(): JSX.Element;
29
+ }
30
+ export {};
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { TreeProps } from 'antd';
3
+ type Props = {
4
+ className?: string;
5
+ items?: any[];
6
+ template?: any;
7
+ itemsKey?: string | ((index: number, item: any) => any);
8
+ directory?: boolean;
9
+ } & TreeProps;
10
+ export declare class AcTree extends React.Component<Props> {
11
+ static displayName: string;
12
+ static defaultProps: {
13
+ directory: boolean;
14
+ items: never[];
15
+ template: ({ item }: {
16
+ item: any;
17
+ }, cb: any) => JSX.Element;
18
+ itemsKey: string;
19
+ };
20
+ get childView(): any;
21
+ render(): JSX.Element | null;
22
+ }
23
+ export {};
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { DraggerProps } from 'antd/es/upload';
3
+ type StdEventTarget = {
4
+ target: {
5
+ value: any;
6
+ };
7
+ };
8
+ type StdCallback = (inEvent: StdEventTarget) => void;
9
+ type Props = {
10
+ className?: string;
11
+ value?: any[];
12
+ defaultValue?: any[];
13
+ onChange?: StdCallback;
14
+ } & DraggerProps;
15
+ export declare class AcUploadDragger extends React.Component<Props> {
16
+ static displayName: string;
17
+ static defaultProps: {
18
+ onChange: any;
19
+ };
20
+ handleTemplate: (node: any, file: any, fileList: any) => JSX.Element;
21
+ render(): JSX.Element;
22
+ }
23
+ export {};
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import { DraggerProps } from 'antd/es/upload';
3
+ import { UploadChangeParam } from 'antd/es/upload/interface';
4
+ import { UploadFile } from 'antd';
5
+ type StdEventTarget = {
6
+ target: {
7
+ value: any;
8
+ };
9
+ };
10
+ type StdCallback = (inEvent: StdEventTarget) => void;
11
+ type Props = {
12
+ className?: string;
13
+ value?: any[];
14
+ onChange?: StdCallback;
15
+ } & DraggerProps;
16
+ type State = {
17
+ fileList: UploadFile[];
18
+ };
19
+ export declare class AcUploadPictureCard extends React.Component<Props, State> {
20
+ static displayName: string;
21
+ static defaultProps: {
22
+ onChange: any;
23
+ };
24
+ private rootRef;
25
+ private sortable;
26
+ private viewer;
27
+ state: {
28
+ fileList: any[];
29
+ };
30
+ componentDidMount(): Promise<void>;
31
+ mountSortable(el: any): void;
32
+ mountViewer(el: any): Promise<void>;
33
+ componentWillUnmount(): void;
34
+ handlePreview: (file: UploadFile<any>) => void;
35
+ handleChange: (inEvent: UploadChangeParam<UploadFile<any>>) => void;
36
+ handleSortEnd: (inEvent: any) => void;
37
+ doChange: (inValue: any) => void;
38
+ previewFile: (file: any) => Promise<string>;
39
+ render(): JSX.Element;
40
+ }
41
+ export {};
package/dist/main.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ export * from './lib/breadcrumb';
2
+ export * from './lib/checkable-all';
3
+ export * from './lib/checkable-tag';
4
+ export * from './lib/checkbox';
5
+ export * from './lib/checkbox-group';
6
+ export * from './lib/date-picker';
7
+ export * from './lib/editable-tag-group';
8
+ export * from './lib/input';
9
+ export * from './lib/input-number';
10
+ export * from './lib/pre-select';
11
+ export * from './lib/radio-group';
12
+ export * from './lib/range-picker';
13
+ export * from './lib/rate';
14
+ export * from './lib/search';
15
+ export * from './lib/select';
16
+ export * from './lib/slider';
17
+ export * from './lib/slider-range';
18
+ export * from './lib/switch';
19
+ export * from './lib/textarea';
20
+ export * from './lib/time-picker';
21
+ export * from './lib/transfer';
22
+ export * from './lib/tree';
23
+ export * from './lib/tree-select';
24
+ export * from './lib/upload-dragger';
25
+ export * from './lib/upload-picture-card';
package/dist/style.css ADDED
@@ -0,0 +1,147 @@
1
+ @charset "UTF-8";
2
+ .ac-checkable-tag {
3
+ user-select: none;
4
+ }
5
+ .ac-checkable-tag[disabled] {
6
+ pointer-events: none;
7
+ opacity: 0.7;
8
+ }
9
+
10
+ .ant-upload.ant-upload-dragger,
11
+ .ant-upload.ant-upload-drag {
12
+ border: 5px dashed rgba(0, 0, 0, 0.16);
13
+ border-radius: 5px;
14
+ }
15
+ .ant-upload.ant-upload-dragger:hover,
16
+ .ant-upload.ant-upload-drag:hover {
17
+ border: 5px dashed rgba(64, 169, 255, 0.8196078431);
18
+ }
19
+
20
+ .ac-checkable-tag {
21
+ user-select: none;
22
+ background: #ededed;
23
+ }
24
+ .ac-checkable-tag.ant-tag-checkable-checked {
25
+ background: #1677ff;
26
+ }
27
+ .ac-checkable-tag > [role=img] {
28
+ margin-left: 2px;
29
+ }
30
+
31
+ .ac-checkable-all {
32
+ --ac-checkable-all-active-bg: #1677ff;
33
+ --ac-checkable-all-inactive-bg: #ededed;
34
+ }
35
+ .ac-checkable-all .ac-is-aside {
36
+ border-radius: 3px;
37
+ }
38
+ .ac-checkable-all .ac-is-item {
39
+ padding: 1px 7px;
40
+ background: var(--ac-checkable-all-inactive-bg);
41
+ }
42
+ .ac-checkable-all .ac-is-item.ant-tag-checkable-checked {
43
+ background: var(--ac-checkable-all-active-bg);
44
+ }
45
+
46
+ .ac-editable-tag-group {
47
+ display: inline-block;
48
+ }
49
+ .ac-editable-tag-group .ant-tag {
50
+ margin-bottom: 5px;
51
+ padding-right: 15px;
52
+ position: relative;
53
+ }
54
+ .ac-editable-tag-group .ant-btn {
55
+ position: relative;
56
+ padding-left: 15px;
57
+ }
58
+ .ac-editable-tag-group__input input {
59
+ border-color: transparent;
60
+ background: none;
61
+ text-align: center;
62
+ }
63
+ .ac-editable-tag-group__create {
64
+ font-size: 12px;
65
+ line-height: 22px;
66
+ }
67
+ .ac-editable-tag-group__plus {
68
+ width: 10px;
69
+ height: 10px;
70
+ opacity: 0.3;
71
+ cursor: pointer;
72
+ position: relative;
73
+ display: inline-block;
74
+ }
75
+ .ac-editable-tag-group__plus:hover {
76
+ opacity: 1;
77
+ }
78
+ .ac-editable-tag-group__plus:before, .ac-editable-tag-group__plus:after {
79
+ position: absolute;
80
+ left: 0;
81
+ content: "";
82
+ height: 10px;
83
+ width: 1px;
84
+ background-color: #333;
85
+ }
86
+ .ac-editable-tag-group__plus:before {
87
+ transform: rotate(90deg);
88
+ }
89
+ .ac-editable-tag-group__plus:after {
90
+ transform: rotate(180deg);
91
+ }
92
+ .ac-editable-tag-group__close {
93
+ position: absolute;
94
+ right: 0;
95
+ top: 50%;
96
+ transform: translateY(-50%);
97
+ width: 10px;
98
+ height: 10px;
99
+ opacity: 0.3;
100
+ cursor: pointer;
101
+ }
102
+ .ac-editable-tag-group__close:hover {
103
+ opacity: 1;
104
+ }
105
+ .ac-editable-tag-group__close:before, .ac-editable-tag-group__close:after {
106
+ position: absolute;
107
+ left: 0;
108
+ content: "";
109
+ height: 10px;
110
+ width: 1px;
111
+ background-color: #333;
112
+ }
113
+ .ac-editable-tag-group__close:before {
114
+ transform: rotate(45deg);
115
+ }
116
+ .ac-editable-tag-group__close:after {
117
+ transform: rotate(-45deg);
118
+ }
119
+
120
+ .ac-upload-picture-card {
121
+ /**
122
+ 定义 css 变量,可以改变 image-item 的大小
123
+ */
124
+ }
125
+ .ac-upload-picture-card .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container,
126
+ .ac-upload-picture-card .ant-upload.ant-upload-select {
127
+ --ac-upload-images-size: 102px;
128
+ border-width: 3px !important;
129
+ width: var(--ac-upload-images-size) !important;
130
+ height: var(--ac-upload-images-size) !important;
131
+ }
132
+ .ac-upload-picture-card .ant-upload-list-item-container {
133
+ user-select: none;
134
+ }
135
+ .ac-upload-picture-card .ant-upload-list-item-container:hover .ant-upload-list-item {
136
+ border-width: 2px !important;
137
+ border-style: dashed !important;
138
+ border-color: orange !important;
139
+ }
140
+ .ac-upload-picture-card__modal {
141
+ width: 800px;
142
+ text-align: center;
143
+ }
144
+ .ac-upload-picture-card__modal .is-img {
145
+ width: 100%;
146
+ height: 100%;
147
+ }
@@ -0,0 +1,179 @@
1
+ .ac-checkable-tag {
2
+ user-select: none;
3
+ &[disabled] {
4
+ pointer-events: none;
5
+ opacity: 0.7;
6
+ }
7
+ }
8
+
9
+ // upload-dragger
10
+ // .dragger for < 5.0.0
11
+ // .drag for 5.0.0+
12
+ .ant-upload.ant-upload-dragger,
13
+ .ant-upload.ant-upload-drag {
14
+ border: 5px dashed rgb(0 0 0 / 16%);
15
+ border-radius: 5px;
16
+
17
+ &:hover {
18
+ border: 5px dashed #40a9ffd1;
19
+ }
20
+ }
21
+
22
+ .ac-checkable-tag {
23
+ user-select: none;
24
+ background: #ededed;
25
+
26
+ &.ant-tag-checkable-checked {
27
+ background: #1677ff;
28
+ }
29
+
30
+ > [role="img"] {
31
+ margin-left: 2px;
32
+ }
33
+ }
34
+
35
+ .ac-checkable-all {
36
+ --ac-checkable-all-active-bg: #1677ff;
37
+ --ac-checkable-all-inactive-bg: #ededed;
38
+
39
+ .ac-is-aside {
40
+ border-radius: 3px;
41
+ }
42
+
43
+ .ac-is-item {
44
+ padding: 1px 7px;
45
+ background: var(--ac-checkable-all-inactive-bg);
46
+
47
+ &.ant-tag-checkable-checked {
48
+ background: var(--ac-checkable-all-active-bg)
49
+ }
50
+ }
51
+ }
52
+
53
+ .ac-editable-tag-group {
54
+ display: inline-block;
55
+
56
+ .ant-tag {
57
+ margin-bottom: 5px;
58
+ padding-right: 15px;
59
+ position: relative;
60
+ }
61
+
62
+ .ant-btn {
63
+ position: relative;
64
+ padding-left: 15px;
65
+ }
66
+
67
+ &__input {
68
+ input {
69
+ border-color: transparent;
70
+ background: none;
71
+ text-align: center;
72
+ }
73
+ }
74
+
75
+ &__create {
76
+ font-size: 12px;
77
+ line-height: 22px;
78
+ }
79
+
80
+ &__plus {
81
+ width: 10px;
82
+ height: 10px;
83
+ opacity: 0.3;
84
+ cursor: pointer;
85
+ position: relative;
86
+ display: inline-block;
87
+
88
+ &:hover {
89
+ opacity: 1;
90
+ }
91
+
92
+ &:before,
93
+ &:after {
94
+ position: absolute;
95
+ left: 0;
96
+ content: "";
97
+ height: 10px;
98
+ width: 1px;
99
+ background-color: #333;
100
+ }
101
+
102
+ &:before {
103
+ transform: rotate(90deg);
104
+ }
105
+
106
+ &:after {
107
+ transform: rotate(180deg);
108
+ }
109
+ }
110
+
111
+ &__close {
112
+ position: absolute;
113
+ right: 0;
114
+ top: 50%;
115
+ transform: translateY(-50%);
116
+ width: 10px;
117
+ height: 10px;
118
+ opacity: 0.3;
119
+ cursor: pointer;
120
+
121
+ &:hover {
122
+ opacity: 1;
123
+ }
124
+
125
+ &:before,
126
+ &:after {
127
+ position: absolute;
128
+ left: 0;
129
+ content: "";
130
+ height: 10px;
131
+ width: 1px;
132
+ background-color: #333;
133
+ }
134
+
135
+ &:before {
136
+ transform: rotate(45deg);
137
+ }
138
+
139
+ &:after {
140
+ transform: rotate(-45deg);
141
+ }
142
+ }
143
+ }
144
+
145
+
146
+ .ac-upload-picture-card {
147
+ /**
148
+ 定义 css 变量,可以改变 image-item 的大小
149
+ */
150
+ .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container,
151
+ .ant-upload.ant-upload-select {
152
+ --ac-upload-images-size: 102px;
153
+ border-width: 3px !important;
154
+ width: var(--ac-upload-images-size) !important;
155
+ height: var(--ac-upload-images-size) !important;
156
+ }
157
+
158
+ .ant-upload-list-item-container {
159
+ user-select: none;
160
+
161
+ &:hover {
162
+ .ant-upload-list-item {
163
+ border-width: 2px !important;
164
+ border-style: dashed !important;
165
+ border-color: orange !important;
166
+ }
167
+ }
168
+ }
169
+
170
+ &__modal {
171
+ width: 800px;
172
+ text-align: center;
173
+
174
+ .is-img {
175
+ width: 100%;
176
+ height: 100%;
177
+ }
178
+ }
179
+ }