@jswork/antd-components 1.0.78 → 1.0.80
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/README.md +1 -56
- package/dist/main.cjs.js +77 -0
- package/dist/main.cjs.js.map +1 -0
- package/dist/main.d.mts +1062 -0
- package/dist/main.d.ts +1062 -34
- package/dist/main.esm.js +77 -0
- package/dist/main.esm.js.map +1 -0
- package/dist/style.css +2 -267
- package/dist/style.css.map +1 -0
- package/package.json +30 -75
- package/src/lib/_abstract-upload.tsx +131 -0
- package/src/lib/alert.tsx +53 -0
- package/src/lib/breadcrumb.tsx +40 -0
- package/src/lib/checkable-dropdown.tsx +170 -0
- package/src/lib/checkable-tag-list.tsx +122 -0
- package/src/lib/checkable-tag.tsx +101 -0
- package/src/lib/checkbox-group.tsx +72 -0
- package/src/lib/checkbox.tsx +59 -0
- package/src/lib/codeflask.tsx +17 -0
- package/src/lib/confirm-button.tsx +87 -0
- package/src/lib/date-picker.tsx +60 -0
- package/src/lib/editable-tag-group.tsx +234 -0
- package/src/lib/input-hidden.tsx +13 -0
- package/src/lib/input-number.tsx +52 -0
- package/src/lib/input-tags.tsx +140 -0
- package/src/lib/input-token.tsx +102 -0
- package/src/lib/input.tsx +58 -0
- package/src/lib/interactive-list.tsx +173 -0
- package/src/lib/pre-select.tsx +128 -0
- package/src/lib/radio-group.tsx +67 -0
- package/src/lib/range-picker.tsx +59 -0
- package/src/lib/rate.tsx +38 -0
- package/src/lib/search.tsx +49 -0
- package/src/lib/select.tsx +86 -0
- package/src/lib/slider-range.tsx +40 -0
- package/src/lib/slider.tsx +37 -0
- package/src/lib/switch.tsx +52 -0
- package/src/lib/textarea.tsx +29 -0
- package/src/lib/time-picker.tsx +66 -0
- package/src/lib/transfer.tsx +70 -0
- package/src/lib/tree-select.tsx +64 -0
- package/src/lib/tree.tsx +60 -0
- package/src/lib/upload-dragger.tsx +60 -0
- package/src/lib/upload-picture-card.tsx +56 -0
- package/src/lib/upload-picture.tsx +47 -0
- package/src/lib/upload.tsx +55 -0
- package/src/main.ts +34 -0
- package/src/style.scss +191 -0
- package/LICENSE.txt +0 -21
- package/dist/index.esm.js +0 -10
- package/dist/index.js +0 -10
- package/dist/lib/_abstract-upload.d.ts +0 -40
- package/dist/lib/alert.d.ts +0 -14
- package/dist/lib/breadcrumb.d.ts +0 -29
- package/dist/lib/checkable-dropdown.d.ts +0 -52
- package/dist/lib/checkable-tag-list.d.ts +0 -51
- package/dist/lib/checkable-tag.d.ts +0 -43
- package/dist/lib/checkbox-group.d.ts +0 -38
- package/dist/lib/checkbox.d.ts +0 -27
- package/dist/lib/codeflask.d.ts +0 -9
- package/dist/lib/confirm-button.d.ts +0 -23
- package/dist/lib/date-picker.d.ts +0 -26
- package/dist/lib/editable-tag-group.d.ts +0 -92
- package/dist/lib/input-hidden.d.ts +0 -7
- package/dist/lib/input-number.d.ts +0 -27
- package/dist/lib/input-tags.d.ts +0 -37
- package/dist/lib/input-token.d.ts +0 -39
- package/dist/lib/input.d.ts +0 -29
- package/dist/lib/interactive-list.d.ts +0 -56
- package/dist/lib/pre-select.d.ts +0 -57
- package/dist/lib/radio-group.d.ts +0 -42
- package/dist/lib/range-picker.d.ts +0 -27
- package/dist/lib/rate.d.ts +0 -23
- package/dist/lib/search.d.ts +0 -29
- package/dist/lib/select.d.ts +0 -43
- package/dist/lib/slider-range.d.ts +0 -23
- package/dist/lib/slider.d.ts +0 -22
- package/dist/lib/switch.d.ts +0 -27
- package/dist/lib/textarea.d.ts +0 -22
- package/dist/lib/time-picker.d.ts +0 -29
- package/dist/lib/transfer.d.ts +0 -37
- package/dist/lib/tree-select.d.ts +0 -32
- package/dist/lib/tree.d.ts +0 -31
- package/dist/lib/upload-dragger.d.ts +0 -28
- package/dist/lib/upload-picture-card.d.ts +0 -14
- package/dist/lib/upload-picture.d.ts +0 -14
- package/dist/lib/upload.d.ts +0 -28
- /package/{dist → src}/styles/input-tags.scss +0 -0
- /package/{dist → src}/styles/override.scss +0 -0
package/dist/style.css
CHANGED
|
@@ -1,267 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
.
|
|
3
|
-
.ant-upload.ant-upload-drag {
|
|
4
|
-
border: 5px dashed rgba(0, 0, 0, 0.16);
|
|
5
|
-
border-radius: 5px;
|
|
6
|
-
}
|
|
7
|
-
.ant-upload.ant-upload-dragger:hover,
|
|
8
|
-
.ant-upload.ant-upload-drag:hover {
|
|
9
|
-
border: 5px dashed rgba(64, 169, 255, 0.8196078431);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.ant-dropdown-menu .ant-dropdown-menu-item .ant-dropdown-menu-title-content {
|
|
13
|
-
display: block;
|
|
14
|
-
}
|
|
15
|
-
.ant-dropdown-menu .ant-dropdown-menu-item .ant-dropdown-menu-title-content .ant-checkbox-wrapper {
|
|
16
|
-
display: flex;
|
|
17
|
-
}
|
|
18
|
-
.ant-dropdown-menu .ant-dropdown-menu-item .ant-dropdown-menu-title-content .ant-checkbox-wrapper > span:last-child {
|
|
19
|
-
flex: 1;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.ac-input-tags {
|
|
23
|
-
display: flex;
|
|
24
|
-
flex-wrap: wrap;
|
|
25
|
-
align-items: center;
|
|
26
|
-
border: 1px solid #eee;
|
|
27
|
-
outline: 1px solid transparent;
|
|
28
|
-
transition: all 0.3s ease-in-out;
|
|
29
|
-
padding: 4px;
|
|
30
|
-
border-radius: 4px;
|
|
31
|
-
gap: 3px;
|
|
32
|
-
}
|
|
33
|
-
.ac-input-tags[data-disabled=true] {
|
|
34
|
-
opacity: 0.6;
|
|
35
|
-
cursor: not-allowed;
|
|
36
|
-
}
|
|
37
|
-
.ac-input-tags:not([data-disabled=true]) {
|
|
38
|
-
border-color: #4096ff;
|
|
39
|
-
outline-color: #73b2ff;
|
|
40
|
-
}
|
|
41
|
-
.ac-input-tags__tag {
|
|
42
|
-
display: inline-flex;
|
|
43
|
-
padding: 2px 4px;
|
|
44
|
-
border-radius: 6px;
|
|
45
|
-
}
|
|
46
|
-
.ac-input-tags__input {
|
|
47
|
-
appearance: none;
|
|
48
|
-
border: none;
|
|
49
|
-
background: none;
|
|
50
|
-
outline: none;
|
|
51
|
-
width: 100px;
|
|
52
|
-
height: 26px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.react-codeflask {
|
|
56
|
-
width: 100%;
|
|
57
|
-
outline: 1px solid #ccc;
|
|
58
|
-
position: relative;
|
|
59
|
-
--codeflask-loading-size: 40px;
|
|
60
|
-
}
|
|
61
|
-
.react-codeflask__spin {
|
|
62
|
-
background: rgba(255, 255, 255, 0.1);
|
|
63
|
-
backdrop-filter: blur(2px);
|
|
64
|
-
position: absolute;
|
|
65
|
-
z-index: 1000;
|
|
66
|
-
width: 100%;
|
|
67
|
-
height: 100%;
|
|
68
|
-
}
|
|
69
|
-
.react-codeflask__spin [hidden] {
|
|
70
|
-
display: none;
|
|
71
|
-
z-index: -1;
|
|
72
|
-
}
|
|
73
|
-
.react-codeflask__spin > img {
|
|
74
|
-
left: 50%;
|
|
75
|
-
top: 50%;
|
|
76
|
-
position: absolute;
|
|
77
|
-
transform: translate(-50%, -50%);
|
|
78
|
-
width: var(--codeflask-loading-size);
|
|
79
|
-
height: var(--codeflask-loading-size);
|
|
80
|
-
}
|
|
81
|
-
.react-codeflask[disabled] > .is-editor {
|
|
82
|
-
opacity: 0.6;
|
|
83
|
-
pointer-events: none;
|
|
84
|
-
}
|
|
85
|
-
.react-codeflask > .language-name {
|
|
86
|
-
position: absolute;
|
|
87
|
-
right: 40px;
|
|
88
|
-
top: 0;
|
|
89
|
-
z-index: 10;
|
|
90
|
-
padding: 0.1rem 0.3rem 0.15rem;
|
|
91
|
-
border-bottom-left-radius: 4px;
|
|
92
|
-
border-bottom-right-radius: 4px;
|
|
93
|
-
background: #627eee;
|
|
94
|
-
color: #eee;
|
|
95
|
-
font-family: "JetBrains Mono", Monaco, monospace, sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue";
|
|
96
|
-
font-size: 0.7rem;
|
|
97
|
-
}
|
|
98
|
-
.react-codeflask .is-formatter {
|
|
99
|
-
border: none;
|
|
100
|
-
position: absolute;
|
|
101
|
-
z-index: 10;
|
|
102
|
-
right: 2px;
|
|
103
|
-
top: 0;
|
|
104
|
-
padding: 3px 10px;
|
|
105
|
-
background: rgba(255, 255, 255, 0.6);
|
|
106
|
-
box-shadow: 0 1px 6px 0 rgba(32, 33, 36, 0.28);
|
|
107
|
-
transition: 0.3s;
|
|
108
|
-
border-radius: 4px;
|
|
109
|
-
}
|
|
110
|
-
.react-codeflask .is-formatter:active {
|
|
111
|
-
background: #ddd;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.ac-checkable-tag {
|
|
115
|
-
user-select: none;
|
|
116
|
-
background: #ededed;
|
|
117
|
-
}
|
|
118
|
-
.ac-checkable-tag[disabled] {
|
|
119
|
-
pointer-events: none;
|
|
120
|
-
opacity: 0.7;
|
|
121
|
-
}
|
|
122
|
-
.ac-checkable-tag.ant-tag-checkable-checked {
|
|
123
|
-
background: #1677ff;
|
|
124
|
-
}
|
|
125
|
-
.ac-checkable-tag > [role=img] {
|
|
126
|
-
margin-left: 2px;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.ac-checkable-tag-list {
|
|
130
|
-
--ac-checkable-tag-list-active-bg: #1677ff;
|
|
131
|
-
--ac-checkable-tag-list-inactive-bg: #ededed;
|
|
132
|
-
}
|
|
133
|
-
.ac-checkable-tag-list .ac-is-aside {
|
|
134
|
-
border-radius: 3px;
|
|
135
|
-
}
|
|
136
|
-
.ac-checkable-tag-list .ac-is-item {
|
|
137
|
-
padding: 1px 7px;
|
|
138
|
-
background: var(--ac-checkable-tag-list-inactive-bg);
|
|
139
|
-
}
|
|
140
|
-
.ac-checkable-tag-list .ac-is-item.ant-tag-checkable-checked {
|
|
141
|
-
background: var(--ac-checkable-tag-list-active-bg);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.ac-editable-tag-group {
|
|
145
|
-
display: inline-block;
|
|
146
|
-
}
|
|
147
|
-
.ac-editable-tag-group .ant-tag {
|
|
148
|
-
margin-bottom: 5px;
|
|
149
|
-
position: relative;
|
|
150
|
-
display: inline-flex;
|
|
151
|
-
align-items: center;
|
|
152
|
-
justify-content: space-between;
|
|
153
|
-
}
|
|
154
|
-
.ac-editable-tag-group .ant-btn {
|
|
155
|
-
position: relative;
|
|
156
|
-
padding-left: 15px;
|
|
157
|
-
}
|
|
158
|
-
.ac-editable-tag-group__input {
|
|
159
|
-
flex: 1;
|
|
160
|
-
}
|
|
161
|
-
.ac-editable-tag-group__input input {
|
|
162
|
-
border-color: transparent;
|
|
163
|
-
background: none;
|
|
164
|
-
text-align: center;
|
|
165
|
-
}
|
|
166
|
-
.ac-editable-tag-group__create {
|
|
167
|
-
font-size: 12px;
|
|
168
|
-
line-height: 22px;
|
|
169
|
-
}
|
|
170
|
-
.ac-editable-tag-group__plus {
|
|
171
|
-
width: 10px;
|
|
172
|
-
height: 10px;
|
|
173
|
-
opacity: 0.3;
|
|
174
|
-
cursor: pointer;
|
|
175
|
-
position: relative;
|
|
176
|
-
display: inline-block;
|
|
177
|
-
}
|
|
178
|
-
.ac-editable-tag-group__plus:hover {
|
|
179
|
-
opacity: 1;
|
|
180
|
-
}
|
|
181
|
-
.ac-editable-tag-group__plus:before, .ac-editable-tag-group__plus:after {
|
|
182
|
-
position: absolute;
|
|
183
|
-
left: 0;
|
|
184
|
-
content: "";
|
|
185
|
-
height: 10px;
|
|
186
|
-
width: 1px;
|
|
187
|
-
background-color: #333;
|
|
188
|
-
}
|
|
189
|
-
.ac-editable-tag-group__plus:before {
|
|
190
|
-
transform: rotate(90deg);
|
|
191
|
-
}
|
|
192
|
-
.ac-editable-tag-group__plus:after {
|
|
193
|
-
transform: rotate(180deg);
|
|
194
|
-
}
|
|
195
|
-
.ac-editable-tag-group__close {
|
|
196
|
-
position: relative;
|
|
197
|
-
margin-left: 3px;
|
|
198
|
-
width: 10px;
|
|
199
|
-
height: 10px;
|
|
200
|
-
opacity: 0.3;
|
|
201
|
-
cursor: pointer;
|
|
202
|
-
}
|
|
203
|
-
.ac-editable-tag-group__close:hover {
|
|
204
|
-
opacity: 1;
|
|
205
|
-
}
|
|
206
|
-
.ac-editable-tag-group__close:before, .ac-editable-tag-group__close:after {
|
|
207
|
-
position: absolute;
|
|
208
|
-
left: 0;
|
|
209
|
-
content: "";
|
|
210
|
-
height: 10px;
|
|
211
|
-
width: 1px;
|
|
212
|
-
background-color: #333;
|
|
213
|
-
}
|
|
214
|
-
.ac-editable-tag-group__close:before {
|
|
215
|
-
transform: rotate(45deg);
|
|
216
|
-
}
|
|
217
|
-
.ac-editable-tag-group__close:after {
|
|
218
|
-
transform: rotate(-45deg);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.ac-upload-picture-card {
|
|
222
|
-
/**
|
|
223
|
-
定义 css 变量,可以改变 image-item 的大小
|
|
224
|
-
*/
|
|
225
|
-
}
|
|
226
|
-
.ac-upload-picture-card .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container,
|
|
227
|
-
.ac-upload-picture-card .ant-upload.ant-upload-select {
|
|
228
|
-
--ac-upload-images-size: 102px;
|
|
229
|
-
border-width: 3px !important;
|
|
230
|
-
width: var(--ac-upload-images-size) !important;
|
|
231
|
-
height: var(--ac-upload-images-size) !important;
|
|
232
|
-
}
|
|
233
|
-
.ac-upload-picture-card .ant-upload-list-item-container {
|
|
234
|
-
user-select: none;
|
|
235
|
-
}
|
|
236
|
-
.ac-upload-picture-card .ant-upload-list-item-container:hover .ant-upload-list-item {
|
|
237
|
-
border-width: 2px !important;
|
|
238
|
-
border-style: dashed !important;
|
|
239
|
-
border-color: orange !important;
|
|
240
|
-
}
|
|
241
|
-
.ac-upload-picture-card__modal {
|
|
242
|
-
width: 800px;
|
|
243
|
-
text-align: center;
|
|
244
|
-
}
|
|
245
|
-
.ac-upload-picture-card__modal .is-img {
|
|
246
|
-
width: 100%;
|
|
247
|
-
height: 100%;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
.ac-checkable-dropdown__btn {
|
|
251
|
-
display: inline-flex;
|
|
252
|
-
align-items: center;
|
|
253
|
-
justify-content: space-between;
|
|
254
|
-
}
|
|
255
|
-
.ac-checkable-dropdown__btn .is-label {
|
|
256
|
-
overflow: hidden;
|
|
257
|
-
text-overflow: ellipsis;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.ac-upload-picture {
|
|
261
|
-
--ac-upload-picture-height: 120px;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
.ac-input-token__token {
|
|
265
|
-
user-select: none;
|
|
266
|
-
cursor: pointer;
|
|
267
|
-
}
|
|
1
|
+
.ant-upload.ant-upload-drag,.ant-upload.ant-upload-dragger{border:5px dashed rgba(0,0,0,.16);border-radius:5px}.ant-upload.ant-upload-drag:hover,.ant-upload.ant-upload-dragger:hover{border:5px dashed rgba(64,169,255,.82)}.ant-dropdown-menu .ant-dropdown-menu-item .ant-dropdown-menu-title-content{display:block}.ant-dropdown-menu .ant-dropdown-menu-item .ant-dropdown-menu-title-content .ant-checkbox-wrapper{display:flex}.ant-dropdown-menu .ant-dropdown-menu-item .ant-dropdown-menu-title-content .ant-checkbox-wrapper>span:last-child{flex:1}.ac-input-tags{align-items:center;border:1px solid #eee;border-radius:4px;display:flex;flex-wrap:wrap;gap:3px;outline:1px solid transparent;padding:4px;transition:all .3s ease-in-out}.ac-input-tags[data-disabled=true]{cursor:not-allowed;opacity:.6}.ac-input-tags:not([data-disabled=true]){border-color:#4096ff;outline-color:#73b2ff}.ac-input-tags__tag{border-radius:6px;display:inline-flex;padding:2px 4px}.ac-input-tags__input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;height:26px;outline:none;width:100px}.react-codeflask{outline:1px solid #ccc;position:relative;width:100%;--codeflask-loading-size:40px}.react-codeflask__spin{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background:hsla(0,0%,100%,.1);height:100%;position:absolute;width:100%;z-index:1000}.react-codeflask__spin [hidden]{display:none;z-index:-1}.react-codeflask__spin>img{height:var(--codeflask-loading-size);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--codeflask-loading-size)}.react-codeflask[disabled]>.is-editor{opacity:.6;pointer-events:none}.react-codeflask>.language-name{background:#627eee;border-bottom-left-radius:4px;border-bottom-right-radius:4px;color:#eee;font-family:JetBrains Mono,Monaco,monospace,sans-serif,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue;font-size:.7rem;padding:.1rem .3rem .15rem;position:absolute;right:40px;top:0;z-index:10}.react-codeflask .is-formatter{background:hsla(0,0%,100%,.6);border:none;border-radius:4px;box-shadow:0 1px 6px 0 rgba(32,33,36,.28);padding:3px 10px;position:absolute;right:2px;top:0;transition:.3s;z-index:10}.react-codeflask .is-formatter:active{background:#ddd}.ac-checkable-tag{background:#ededed;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ac-checkable-tag[disabled]{opacity:.7;pointer-events:none}.ac-checkable-tag.ant-tag-checkable-checked{background:#1677ff}.ac-checkable-tag>[role=img]{margin-left:2px}.ac-checkable-tag-list{--ac-checkable-tag-list-active-bg:#1677ff;--ac-checkable-tag-list-inactive-bg:#ededed}.ac-checkable-tag-list .ac-is-aside{border-radius:3px}.ac-checkable-tag-list .ac-is-item{background:var(--ac-checkable-tag-list-inactive-bg);padding:1px 7px}.ac-checkable-tag-list .ac-is-item.ant-tag-checkable-checked{background:var(--ac-checkable-tag-list-active-bg)}.ac-editable-tag-group{display:inline-block}.ac-editable-tag-group .ant-tag{align-items:center;display:inline-flex;justify-content:space-between;margin-bottom:5px;position:relative}.ac-editable-tag-group .ant-btn{padding-left:15px;position:relative}.ac-editable-tag-group__input{flex:1}.ac-editable-tag-group__input input{background:none;border-color:transparent;text-align:center}.ac-editable-tag-group__create{font-size:12px;line-height:22px}.ac-editable-tag-group__plus{cursor:pointer;display:inline-block;height:10px;opacity:.3;position:relative;width:10px}.ac-editable-tag-group__plus:hover{opacity:1}.ac-editable-tag-group__plus:after,.ac-editable-tag-group__plus:before{background-color:#333;content:"";height:10px;left:0;position:absolute;width:1px}.ac-editable-tag-group__plus:before{transform:rotate(90deg)}.ac-editable-tag-group__plus:after{transform:rotate(180deg)}.ac-editable-tag-group__close{cursor:pointer;height:10px;margin-left:3px;opacity:.3;position:relative;width:10px}.ac-editable-tag-group__close:hover{opacity:1}.ac-editable-tag-group__close:after,.ac-editable-tag-group__close:before{background-color:#333;content:"";height:10px;left:0;position:absolute;width:1px}.ac-editable-tag-group__close:before{transform:rotate(45deg)}.ac-editable-tag-group__close:after{transform:rotate(-45deg)}.ac-upload-picture-card .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container,.ac-upload-picture-card .ant-upload.ant-upload-select{--ac-upload-images-size:102px;border-width:3px!important;height:var(--ac-upload-images-size)!important;width:var(--ac-upload-images-size)!important}.ac-upload-picture-card .ant-upload-list-item-container{-webkit-user-select:none;-moz-user-select:none;user-select:none}.ac-upload-picture-card .ant-upload-list-item-container:hover .ant-upload-list-item{border:2px dashed orange!important}.ac-upload-picture-card__modal{text-align:center;width:800px}.ac-upload-picture-card__modal .is-img{height:100%;width:100%}.ac-checkable-dropdown__btn{align-items:center;display:inline-flex;justify-content:space-between}.ac-checkable-dropdown__btn .is-label{overflow:hidden;text-overflow:ellipsis}.ac-upload-picture{--ac-upload-picture-height:120px}.ac-input-token__token{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}
|
|
2
|
+
/*# sourceMappingURL=src/style.scss.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["src/style.scss"],"names":[],"mappings":"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","file":"src/style.scss","sourcesContent":["@charset \"UTF-8\";\n.ant-upload.ant-upload-dragger,\n.ant-upload.ant-upload-drag {\n border: 5px dashed rgba(0, 0, 0, 0.16);\n border-radius: 5px;\n}\n.ant-upload.ant-upload-dragger:hover,\n.ant-upload.ant-upload-drag:hover {\n border: 5px dashed rgba(64, 169, 255, 0.8196078431);\n}\n\n.ant-dropdown-menu .ant-dropdown-menu-item .ant-dropdown-menu-title-content {\n display: block;\n}\n.ant-dropdown-menu .ant-dropdown-menu-item .ant-dropdown-menu-title-content .ant-checkbox-wrapper {\n display: flex;\n}\n.ant-dropdown-menu .ant-dropdown-menu-item .ant-dropdown-menu-title-content .ant-checkbox-wrapper > span:last-child {\n flex: 1;\n}\n\n.ac-input-tags {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n border: 1px solid #eee;\n outline: 1px solid transparent;\n transition: all 0.3s ease-in-out;\n padding: 4px;\n border-radius: 4px;\n gap: 3px;\n}\n.ac-input-tags[data-disabled=true] {\n opacity: 0.6;\n cursor: not-allowed;\n}\n.ac-input-tags:not([data-disabled=true]) {\n border-color: #4096ff;\n outline-color: #73b2ff;\n}\n.ac-input-tags__tag {\n display: inline-flex;\n padding: 2px 4px;\n border-radius: 6px;\n}\n.ac-input-tags__input {\n appearance: none;\n border: none;\n background: none;\n outline: none;\n width: 100px;\n height: 26px;\n}\n\n.react-codeflask {\n width: 100%;\n outline: 1px solid #ccc;\n position: relative;\n --codeflask-loading-size: 40px;\n}\n.react-codeflask__spin {\n background: rgba(255, 255, 255, 0.1);\n backdrop-filter: blur(2px);\n position: absolute;\n z-index: 1000;\n width: 100%;\n height: 100%;\n}\n.react-codeflask__spin [hidden] {\n display: none;\n z-index: -1;\n}\n.react-codeflask__spin > img {\n left: 50%;\n top: 50%;\n position: absolute;\n transform: translate(-50%, -50%);\n width: var(--codeflask-loading-size);\n height: var(--codeflask-loading-size);\n}\n.react-codeflask[disabled] > .is-editor {\n opacity: 0.6;\n pointer-events: none;\n}\n.react-codeflask > .language-name {\n position: absolute;\n right: 40px;\n top: 0;\n z-index: 10;\n padding: 0.1rem 0.3rem 0.15rem;\n border-bottom-left-radius: 4px;\n border-bottom-right-radius: 4px;\n background: #627eee;\n color: #eee;\n font-family: \"JetBrains Mono\", Monaco, monospace, sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\";\n font-size: 0.7rem;\n}\n.react-codeflask .is-formatter {\n border: none;\n position: absolute;\n z-index: 10;\n right: 2px;\n top: 0;\n padding: 3px 10px;\n background: rgba(255, 255, 255, 0.6);\n box-shadow: 0 1px 6px 0 rgba(32, 33, 36, 0.28);\n transition: 0.3s;\n border-radius: 4px;\n}\n.react-codeflask .is-formatter:active {\n background: #ddd;\n}\n\n.ac-checkable-tag {\n user-select: none;\n background: #ededed;\n}\n.ac-checkable-tag[disabled] {\n pointer-events: none;\n opacity: 0.7;\n}\n.ac-checkable-tag.ant-tag-checkable-checked {\n background: #1677ff;\n}\n.ac-checkable-tag > [role=img] {\n margin-left: 2px;\n}\n\n.ac-checkable-tag-list {\n --ac-checkable-tag-list-active-bg: #1677ff;\n --ac-checkable-tag-list-inactive-bg: #ededed;\n}\n.ac-checkable-tag-list .ac-is-aside {\n border-radius: 3px;\n}\n.ac-checkable-tag-list .ac-is-item {\n padding: 1px 7px;\n background: var(--ac-checkable-tag-list-inactive-bg);\n}\n.ac-checkable-tag-list .ac-is-item.ant-tag-checkable-checked {\n background: var(--ac-checkable-tag-list-active-bg);\n}\n\n.ac-editable-tag-group {\n display: inline-block;\n}\n.ac-editable-tag-group .ant-tag {\n margin-bottom: 5px;\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: space-between;\n}\n.ac-editable-tag-group .ant-btn {\n position: relative;\n padding-left: 15px;\n}\n.ac-editable-tag-group__input {\n flex: 1;\n}\n.ac-editable-tag-group__input input {\n border-color: transparent;\n background: none;\n text-align: center;\n}\n.ac-editable-tag-group__create {\n font-size: 12px;\n line-height: 22px;\n}\n.ac-editable-tag-group__plus {\n width: 10px;\n height: 10px;\n opacity: 0.3;\n cursor: pointer;\n position: relative;\n display: inline-block;\n}\n.ac-editable-tag-group__plus:hover {\n opacity: 1;\n}\n.ac-editable-tag-group__plus:before, .ac-editable-tag-group__plus:after {\n position: absolute;\n left: 0;\n content: \"\";\n height: 10px;\n width: 1px;\n background-color: #333;\n}\n.ac-editable-tag-group__plus:before {\n transform: rotate(90deg);\n}\n.ac-editable-tag-group__plus:after {\n transform: rotate(180deg);\n}\n.ac-editable-tag-group__close {\n position: relative;\n margin-left: 3px;\n width: 10px;\n height: 10px;\n opacity: 0.3;\n cursor: pointer;\n}\n.ac-editable-tag-group__close:hover {\n opacity: 1;\n}\n.ac-editable-tag-group__close:before, .ac-editable-tag-group__close:after {\n position: absolute;\n left: 0;\n content: \"\";\n height: 10px;\n width: 1px;\n background-color: #333;\n}\n.ac-editable-tag-group__close:before {\n transform: rotate(45deg);\n}\n.ac-editable-tag-group__close:after {\n transform: rotate(-45deg);\n}\n\n.ac-upload-picture-card {\n /**\n 定义 css 变量,可以改变 image-item 的大小\n */\n}\n.ac-upload-picture-card .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container,\n.ac-upload-picture-card .ant-upload.ant-upload-select {\n --ac-upload-images-size: 102px;\n border-width: 3px !important;\n width: var(--ac-upload-images-size) !important;\n height: var(--ac-upload-images-size) !important;\n}\n.ac-upload-picture-card .ant-upload-list-item-container {\n user-select: none;\n}\n.ac-upload-picture-card .ant-upload-list-item-container:hover .ant-upload-list-item {\n border-width: 2px !important;\n border-style: dashed !important;\n border-color: orange !important;\n}\n.ac-upload-picture-card__modal {\n width: 800px;\n text-align: center;\n}\n.ac-upload-picture-card__modal .is-img {\n width: 100%;\n height: 100%;\n}\n\n.ac-checkable-dropdown__btn {\n display: inline-flex;\n align-items: center;\n justify-content: space-between;\n}\n.ac-checkable-dropdown__btn .is-label {\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.ac-upload-picture {\n --ac-upload-picture-height: 120px;\n}\n\n.ac-input-token__token {\n user-select: none;\n cursor: pointer;\n}"]}
|
package/package.json
CHANGED
|
@@ -1,77 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jswork/antd-components",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.80",
|
|
4
|
+
"main": "dist/main.cjs.js",
|
|
5
|
+
"module": "dist/main.esm.js",
|
|
6
|
+
"types": "dist/main.d.ts",
|
|
5
7
|
"description": "Antd wrapped components.",
|
|
8
|
+
"homepage": "https://js.work",
|
|
6
9
|
"license": "MIT",
|
|
7
|
-
"main": "dist/index.js",
|
|
8
|
-
"module": "dist/index.esm.js",
|
|
9
|
-
"typings": "dist/main.d.ts",
|
|
10
10
|
"files": [
|
|
11
|
-
"dist"
|
|
11
|
+
"dist",
|
|
12
|
+
"src"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"build": "npm run clean && rollup -c",
|
|
18
|
-
"docs": "tsc && vite build",
|
|
19
|
-
"docs:serve": "vite preview",
|
|
20
|
-
"test": "jest",
|
|
21
|
-
"test:watch": "jest --watch",
|
|
22
|
-
"pages": "github-cli -p"
|
|
15
|
+
"build": "tsup",
|
|
16
|
+
"postbuild": "postsass -s src/style.scss -d dist/style.css -c",
|
|
17
|
+
"release": "release-it --ci"
|
|
23
18
|
},
|
|
24
19
|
"devDependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"@
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"@rollup/plugin-replace": "^2.3.4",
|
|
34
|
-
"@testing-library/jest-dom": "^5.16.1",
|
|
35
|
-
"@testing-library/react": "^12.1.2",
|
|
36
|
-
"@types/jest": "^27.0.3",
|
|
37
|
-
"@types/react": "^18",
|
|
38
|
-
"@types/react-dom": "^18",
|
|
39
|
-
"@types/react-test-renderer": "^17.0.0",
|
|
40
|
-
"@types/styled-components": "^5.1.9",
|
|
41
|
-
"@vitejs/plugin-react-refresh": "^1.3.1",
|
|
42
|
-
"antd": "^5.9.0",
|
|
43
|
-
"babel-loader": "^8.2.2",
|
|
44
|
-
"core-js": "^3.8.2",
|
|
45
|
-
"css-loader": "^5.0.1",
|
|
46
|
-
"force-resolutions": "^1.0.10",
|
|
47
|
-
"indent-string": "^4.0.0",
|
|
48
|
-
"jest": "^27.4.5",
|
|
49
|
-
"lodash": "^4.17.21",
|
|
20
|
+
"@jswork/harmony-events": "^1.1.2",
|
|
21
|
+
"@swc/core": "^1.3.93",
|
|
22
|
+
"@types/react": "^18.2.28",
|
|
23
|
+
"@types/react-dom": "^18.2.13",
|
|
24
|
+
"antd": "^5.20.0",
|
|
25
|
+
"autoprefixer": "^10.4.16",
|
|
26
|
+
"classnames": "^2.5.1",
|
|
27
|
+
"cssnano": "^6.0.1",
|
|
50
28
|
"react": "^18.2.0",
|
|
51
29
|
"react-dom": "^18.2.0",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"rollup-plugin-commonjs": "^10.1.0",
|
|
59
|
-
"rollup-plugin-copy": "^3.3.0",
|
|
60
|
-
"rollup-plugin-external-globals": "^0.6.1",
|
|
61
|
-
"rollup-plugin-node-externals": "^2.2.0",
|
|
62
|
-
"rollup-plugin-node-resolve": "^5.2.0",
|
|
63
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
64
|
-
"rollup-plugin-scss": "^3.0.0",
|
|
65
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
66
|
-
"rollup-plugin-typescript2": "^0.29.0",
|
|
67
|
-
"sass": "^1.47.0",
|
|
68
|
-
"sass-loader": "^10.1.0",
|
|
69
|
-
"style-loader": "^2.0.0",
|
|
70
|
-
"styled-components": "^5.3.0",
|
|
71
|
-
"ts-jest": "^27.1.1",
|
|
72
|
-
"typescript": "^4.1.3",
|
|
73
|
-
"vite": "^2.3.4",
|
|
74
|
-
"vite-plugin-pwa": "^0.7.3"
|
|
30
|
+
"tsup": "^7.2.0",
|
|
31
|
+
"typescript": "^5.2.2"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"registry": "https://registry.npmjs.org"
|
|
75
36
|
},
|
|
76
37
|
"dependencies": {
|
|
77
38
|
"@jswork/antd-form-builder": "^1.1.27",
|
|
@@ -91,16 +52,10 @@
|
|
|
91
52
|
"react-input-autosize": "^3.0.0",
|
|
92
53
|
"sortablejs": "^1.15.0"
|
|
93
54
|
},
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
},
|
|
101
|
-
"repository": {
|
|
102
|
-
"type": "git",
|
|
103
|
-
"url": "https://github.com/afeiship/boilerplate-react-ts-component.git"
|
|
104
|
-
},
|
|
105
|
-
"gitHead": "eff0c5a376bae58f3e71943cd7a21d9e0bba2542"
|
|
55
|
+
"keywords": [
|
|
56
|
+
"ant",
|
|
57
|
+
"antd",
|
|
58
|
+
"components",
|
|
59
|
+
"react"
|
|
60
|
+
]
|
|
106
61
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import Sortable from 'sortablejs';
|
|
3
|
+
import { loadScript, loadStyle } from '@jswork/loadkit';
|
|
4
|
+
import { DraggerProps } from 'antd/es/upload';
|
|
5
|
+
import { UploadChangeParam } from 'antd/es/upload/interface';
|
|
6
|
+
import { UploadFile } from 'antd';
|
|
7
|
+
import { flushSync } from 'react-dom';
|
|
8
|
+
|
|
9
|
+
import nx from '@jswork/next';
|
|
10
|
+
import '@jswork/next-gpid';
|
|
11
|
+
|
|
12
|
+
const styleOpts = { id: 'viewer-style' };
|
|
13
|
+
const scriptOpts = { id: 'viewerjs' };
|
|
14
|
+
const styleURL = 'https://unpkg.com/viewerjs@1.11.1/dist/viewer.min.css';
|
|
15
|
+
const scriptURL = 'https://unpkg.com/viewerjs@1.11.1/dist/viewer.min.js';
|
|
16
|
+
|
|
17
|
+
type StdEventTarget = { target: { value: any } };
|
|
18
|
+
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
19
|
+
|
|
20
|
+
type Props = {
|
|
21
|
+
className?: string;
|
|
22
|
+
value?: any[] | [];
|
|
23
|
+
onChange?: StdCallback;
|
|
24
|
+
transformResponse?: (inResponse: any) => any;
|
|
25
|
+
transformURL?: (inPid) => string;
|
|
26
|
+
} & DraggerProps;
|
|
27
|
+
|
|
28
|
+
type State = {
|
|
29
|
+
fileList: any[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export class AcAbstractUpload extends React.Component<Props, State> {
|
|
33
|
+
protected rootRef = React.createRef<HTMLDivElement>();
|
|
34
|
+
protected sortable: any = null;
|
|
35
|
+
protected viewer: any = null;
|
|
36
|
+
|
|
37
|
+
toFileList = (inUrls: any[] | any) => {
|
|
38
|
+
const { transformURL } = this.props;
|
|
39
|
+
const urls = Array.isArray(inUrls) ? inUrls : [inUrls].filter(Boolean);
|
|
40
|
+
return urls.map((item) => {
|
|
41
|
+
if (typeof item !== 'string') return item;
|
|
42
|
+
return { uid: nx.gpid(item), url: transformURL!(item) };
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
constructor(inProps) {
|
|
47
|
+
super(inProps);
|
|
48
|
+
this.state = {
|
|
49
|
+
fileList: this.toFileList(inProps.value)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async componentDidMount() {
|
|
54
|
+
const { rootRef } = this;
|
|
55
|
+
const root = rootRef.current as HTMLDivElement;
|
|
56
|
+
const el = root.querySelector('.ant-upload-list');
|
|
57
|
+
this.mountSortable(el);
|
|
58
|
+
await this.mountViewer(el);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
shouldComponentUpdate(nextProps: Readonly<Props>): boolean {
|
|
62
|
+
const { value } = nextProps;
|
|
63
|
+
if (value !== this.props.value) {
|
|
64
|
+
this.setState({ fileList: this.toFileList(value as any[]) });
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
mountSortable(el) {
|
|
70
|
+
this.sortable = new Sortable(el, {
|
|
71
|
+
animation: 150,
|
|
72
|
+
draggable: '.ant-upload-list-item-container',
|
|
73
|
+
ghostClass: 'sortable-ghost',
|
|
74
|
+
chosenClass: 'sortable-chosen',
|
|
75
|
+
dragClass: 'sortable-drag',
|
|
76
|
+
onEnd: this.handleSortEnd
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async mountViewer(el) {
|
|
81
|
+
await Promise.all([loadStyle(styleURL, styleOpts), loadScript(scriptURL, scriptOpts)]);
|
|
82
|
+
this.viewer = new window['Viewer'](el);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
componentWillUnmount() {
|
|
86
|
+
this.sortable?.destroy();
|
|
87
|
+
this.viewer?.destroy();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
handlePreview = (file: UploadFile<any>) => {
|
|
91
|
+
const { fileList } = this.state;
|
|
92
|
+
const idx = fileList.indexOf(file);
|
|
93
|
+
this.viewer?.update();
|
|
94
|
+
this.viewer.view(idx);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
handleChange = (inEvent: UploadChangeParam<UploadFile<any>>) => {
|
|
98
|
+
const { fileList } = inEvent;
|
|
99
|
+
const isDone = (file) => !file.status || file.status === 'done';
|
|
100
|
+
const done = fileList.every(isDone);
|
|
101
|
+
flushSync(() => this.setState({ fileList }));
|
|
102
|
+
if (done) this.doChange(fileList);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
handleSortEnd = (inEvent) => {
|
|
106
|
+
const { oldIndex, newIndex } = inEvent;
|
|
107
|
+
const { fileList } = this.state;
|
|
108
|
+
const newFileList = fileList.slice();
|
|
109
|
+
newFileList.splice(newIndex, 0, newFileList.splice(oldIndex, 1)[0]);
|
|
110
|
+
this.doChange(newFileList);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
doChange = (inValue) => {
|
|
114
|
+
const { onChange, transformResponse } = this.props;
|
|
115
|
+
const value = inValue.map((item) => item.response ?? item);
|
|
116
|
+
onChange!({ target: { value: transformResponse!(value) } });
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
previewFile = (file): Promise<string> => {
|
|
120
|
+
const blobURL = window.URL.createObjectURL(file);
|
|
121
|
+
return new Promise((resolve) => {
|
|
122
|
+
resolve(blobURL);
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
render(): ReactNode {
|
|
127
|
+
// warning: if not implement, will throw error.
|
|
128
|
+
console.warn('Please implement render method.');
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import nx from '@jswork/next';
|
|
3
|
+
import { Input, InputProps, Modal } from 'antd';
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
interface NxStatic {
|
|
7
|
+
alert: typeof alert;
|
|
8
|
+
confirm: typeof confirm;
|
|
9
|
+
prompt: typeof prompt;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const alert = (inMessage: string, inTitle?: String) => {
|
|
14
|
+
return Modal.info({
|
|
15
|
+
title: inTitle || 'Tips',
|
|
16
|
+
content: inMessage
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const confirm = (inMessage: string, inTitle?: String) => {
|
|
21
|
+
return new Promise((resolve) => {
|
|
22
|
+
Modal.confirm({
|
|
23
|
+
title: inTitle || 'Confirm',
|
|
24
|
+
content: inMessage,
|
|
25
|
+
onOk: () => resolve(true),
|
|
26
|
+
onCancel: () => resolve(false)
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const prompt = (inMessage: string, inOptions?: InputProps) => {
|
|
32
|
+
let value = '';
|
|
33
|
+
return new Promise((resolve) => {
|
|
34
|
+
Modal.confirm({
|
|
35
|
+
title: inMessage || 'Prompt',
|
|
36
|
+
content: (
|
|
37
|
+
<Input
|
|
38
|
+
type="text"
|
|
39
|
+
placeholder={inMessage}
|
|
40
|
+
defaultValue={value}
|
|
41
|
+
onChange={(e) => (value = e.target.value)}
|
|
42
|
+
{...inOptions}
|
|
43
|
+
/>
|
|
44
|
+
),
|
|
45
|
+
onOk: () => resolve(value),
|
|
46
|
+
onCancel: () => resolve(null)
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
nx.alert = alert;
|
|
52
|
+
nx.confirm = confirm;
|
|
53
|
+
nx.prompt = prompt;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import noop from '@jswork/noop';
|
|
3
|
+
import { Breadcrumb, BreadcrumbProps } from 'antd';
|
|
4
|
+
import ReactList, { TemplateArgs } from '@jswork/react-list';
|
|
5
|
+
import { breadcrumbDefault } from '@jswork/antd-tpls';
|
|
6
|
+
import cx from 'classnames';
|
|
7
|
+
|
|
8
|
+
// hack for react-list
|
|
9
|
+
// Warning: [antd: Breadcrumb] Only accepts Breadcrumb.Item and Breadcrumb.Separator as it's children
|
|
10
|
+
// @see: https://juejin.cn/post/6844903505832968206
|
|
11
|
+
// ReactList['__ANT_BREADCRUMB_ITEM'] = true;
|
|
12
|
+
|
|
13
|
+
const CLASS_NAME = 'ac-breadcrumb';
|
|
14
|
+
type StdEventTarget = { target: { value: any } };
|
|
15
|
+
type StdCallback = (inEvent: StdEventTarget) => void;
|
|
16
|
+
|
|
17
|
+
type Props = {
|
|
18
|
+
className?: string;
|
|
19
|
+
items?: any[];
|
|
20
|
+
template?: (args: TemplateArgs) => React.ReactNode;
|
|
21
|
+
value?: number;
|
|
22
|
+
onChange?: StdCallback;
|
|
23
|
+
} & BreadcrumbProps;
|
|
24
|
+
|
|
25
|
+
export class AcBreadcrumb extends React.Component<Props> {
|
|
26
|
+
static displayName = CLASS_NAME;
|
|
27
|
+
static defaultProps = {
|
|
28
|
+
onChange: noop,
|
|
29
|
+
template: breadcrumbDefault
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
render() {
|
|
33
|
+
const { className, value, items, template, onChange, ...props } = this.props;
|
|
34
|
+
return (
|
|
35
|
+
<Breadcrumb className={cx(className, CLASS_NAME)} {...props}>
|
|
36
|
+
<ReactList items={items} template={template} />
|
|
37
|
+
</Breadcrumb>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|