sard-uniapp 1.19.4 → 1.20.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/CHANGELOG.md +31 -0
- package/README.md +1 -1
- package/components/calendar/README.md +20 -20
- package/components/calendar/calendar.vue +1 -1
- package/components/calendar-input/README.md +10 -10
- package/components/calendar-input/calendar-input.vue +2 -2
- package/components/calendar-month/calendar-month.vue +17 -21
- package/components/calendar-popout/calendar-popout.vue +1 -1
- package/components/card/README.md +16 -8
- package/components/card/card.vue +7 -1
- package/components/card/common.d.ts +2 -0
- package/components/card/index.scss +30 -2
- package/components/card/variables.scss +16 -1
- package/components/checkbox/common.d.ts +1 -0
- package/components/checkbox/common.js +1 -0
- package/components/checkbox-input/checkbox-input.vue +9 -0
- package/components/checkbox-popout/README.md +27 -6
- package/components/checkbox-popout/checkbox-popout.vue +113 -47
- package/components/checkbox-popout/common.d.ts +3 -0
- package/components/checkbox-popout/index.scss +16 -0
- package/components/config/index.d.ts +6 -0
- package/components/config/index.js +6 -0
- package/components/datetime-picker/README.md +1 -71
- package/components/datetime-picker/common.d.ts +1 -0
- package/components/datetime-picker/common.js +21 -8
- package/components/datetime-picker/datetime-picker.vue +3 -3
- package/components/datetime-picker-input/README.md +10 -10
- package/components/datetime-picker-input/datetime-picker-input.vue +2 -2
- package/components/datetime-picker-popout/datetime-picker-popout.vue +1 -1
- package/components/datetime-range-picker/datetime-range-picker.vue +12 -10
- package/components/datetime-range-picker-input/README.md +10 -10
- package/components/datetime-range-picker-input/datetime-range-picker-input.vue +2 -2
- package/components/datetime-range-picker-popout/README.md +0 -6
- package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +11 -8
- package/components/floating-bubble/floating-bubble.vue +3 -3
- package/components/form/README.md +19 -19
- package/components/form/form.vue +2 -4
- package/components/form-item/form-item.vue +12 -0
- package/components/icon/icon.d.ts +1 -1
- package/components/indexes/README.md +4 -0
- package/components/indexes-nav/indexes-nav.vue +2 -2
- package/components/keyboard/common.d.ts +1 -2
- package/components/keyboard/common.js +2 -11
- package/components/keyboard/keyboard.d.ts +2 -2
- package/components/list-item/index.scss +4 -0
- package/components/locale/index.d.ts +4 -0
- package/components/locale/index.js +14 -1
- package/components/locale/lang/en-US.d.ts +4 -0
- package/components/locale/lang/en-US.js +4 -0
- package/components/locale/lang/zh-CN.d.ts +4 -0
- package/components/locale/lang/zh-CN.js +4 -0
- package/components/marquee/README.md +8 -2
- package/components/marquee/marquee.vue +9 -1
- package/components/notice-bar/README.md +8 -2
- package/components/notice-bar/notice-bar.vue +14 -8
- package/components/notify/notify.d.ts +1 -1
- package/components/notify-agent/notify-agent.d.ts +1 -1
- package/components/pagination/pagination.vue +2 -2
- package/components/popover/utils.js +4 -4
- package/components/pull-down-refresh/common.d.ts +1 -1
- package/components/radio/common.d.ts +1 -0
- package/components/radio/common.js +1 -0
- package/components/radio-input/radio-input.vue +6 -0
- package/components/radio-popout/README.md +20 -6
- package/components/radio-popout/common.d.ts +2 -0
- package/components/radio-popout/index.scss +4 -0
- package/components/radio-popout/radio-popout.vue +91 -45
- package/components/read-more/README.md +82 -0
- package/components/read-more/common.d.ts +24 -0
- package/components/read-more/common.js +2 -0
- package/components/read-more/index.d.ts +1 -0
- package/components/read-more/index.js +1 -0
- package/components/read-more/index.scss +41 -0
- package/components/read-more/read-more.d.ts +20 -0
- package/components/read-more/read-more.vue +168 -0
- package/components/read-more/variables.scss +12 -0
- package/components/resize-sensor/README.md +55 -0
- package/components/resize-sensor/common.d.ts +19 -0
- package/components/resize-sensor/common.js +2 -0
- package/components/resize-sensor/index.d.ts +1 -0
- package/components/resize-sensor/index.js +1 -0
- package/components/resize-sensor/index.scss +33 -0
- package/components/resize-sensor/resize-sensor.d.ts +16 -0
- package/components/resize-sensor/resize-sensor.vue +152 -0
- package/components/scroll-list/README.md +79 -0
- package/components/scroll-list/common.d.ts +23 -0
- package/components/scroll-list/common.js +1 -0
- package/components/scroll-list/index.d.ts +1 -0
- package/components/scroll-list/index.js +1 -0
- package/components/scroll-list/index.scss +35 -0
- package/components/scroll-list/scroll-list.d.ts +20 -0
- package/components/scroll-list/scroll-list.vue +158 -0
- package/components/scroll-list/variables.scss +11 -0
- package/components/sidebar/README.md +8 -8
- package/components/sidebar/sidebar.vue +1 -1
- package/components/slider/slider.vue +4 -4
- package/components/stepper/stepper.vue +2 -2
- package/components/sticky/README.md +92 -0
- package/components/sticky/common.d.ts +15 -0
- package/components/sticky/common.js +1 -0
- package/components/sticky/index.d.ts +1 -0
- package/components/sticky/index.js +1 -0
- package/components/sticky/index.scss +18 -0
- package/components/sticky/sticky.d.ts +10 -0
- package/components/sticky/sticky.vue +190 -0
- package/components/sticky-box/common.d.ts +19 -0
- package/components/sticky-box/common.js +1 -0
- package/components/sticky-box/index.d.ts +1 -0
- package/components/sticky-box/index.js +1 -0
- package/components/sticky-box/index.scss +19 -0
- package/components/sticky-box/sticky-box.d.ts +10 -0
- package/components/sticky-box/sticky-box.vue +82 -0
- package/components/style/mixins/border.scss +101 -38
- package/components/style/variables-dark.scss +4 -0
- package/components/style/variables.scss +8 -0
- package/components/table/table.vue +2 -1
- package/components/table-fixation/table-fixation.vue +2 -1
- package/components/toast/toast.d.ts +1 -1
- package/components/toast-agent/toast-agent.d.ts +1 -1
- package/components/tree/tree.d.ts +1 -1
- package/components/tree-node/tree-node.vue +2 -2
- package/components/upload/README.md +23 -15
- package/components/upload/common.d.ts +6 -4
- package/components/upload/upload.d.ts +2 -0
- package/components/upload/upload.vue +51 -13
- package/components/upload/utils.d.ts +1 -0
- package/components/upload/utils.js +2 -0
- package/components/upload-preview/index.scss +1 -0
- package/components/upload-preview/upload-preview.d.ts +6 -4
- package/components/upload-preview/upload-preview.vue +17 -24
- package/global.d.ts +5 -0
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/index.scss +2 -0
- package/package.json +4 -2
- package/use/index.d.ts +4 -0
- package/use/index.js +4 -0
- package/use/useIndeterminate.d.ts +10 -0
- package/use/useIndeterminate.js +27 -0
- package/use/useIntersectionObserver.d.ts +16 -0
- package/use/useIntersectionObserver.js +52 -0
- package/use/useSimulatedClick.js +2 -2
- package/use/useSimulatedPress.js +2 -2
- package/use/useSingleTask.d.ts +6 -0
- package/use/useSingleTask.js +40 -0
- package/use/useWindowResize.d.ts +4 -0
- package/use/useWindowResize.js +15 -0
- package/utils/array.d.ts +28 -0
- package/utils/array.js +90 -0
- package/utils/common.d.ts +3 -0
- package/utils/common.js +1 -0
- package/utils/date.d.ts +84 -11
- package/utils/date.js +120 -63
- package/utils/dom.js +2 -0
- package/utils/geometry.d.ts +56 -38
- package/utils/geometry.js +56 -30
- package/utils/index.d.ts +8 -1
- package/utils/index.js +8 -1
- package/utils/is.d.ts +12 -0
- package/utils/is.js +16 -0
- package/utils/number.d.ts +24 -0
- package/utils/number.js +37 -0
- package/utils/object.d.ts +29 -0
- package/utils/object.js +139 -0
- package/utils/persist.d.ts +15 -0
- package/utils/persist.js +89 -0
- package/utils/physics.d.ts +34 -0
- package/utils/physics.js +66 -0
- package/utils/request.d.ts +227 -0
- package/utils/request.js +249 -0
- package/utils/router.d.ts +47 -0
- package/utils/router.js +115 -0
- package/utils/string.d.ts +46 -0
- package/utils/string.js +134 -0
- package/utils/url-query.d.ts +19 -0
- package/utils/url-query.js +95 -0
- package/utils/utils.d.ts +0 -166
- package/utils/utils.js +0 -441
- package/utils/case.d.ts +0 -4
- package/utils/case.js +0 -26
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
@content;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
@mixin border-vertical-base
|
|
11
|
+
@mixin border-vertical-base {
|
|
12
12
|
@include border-base {
|
|
13
13
|
left: 0;
|
|
14
14
|
right: 0;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
@mixin border-horizontal-base
|
|
20
|
+
@mixin border-horizontal-base {
|
|
21
21
|
@include border-base {
|
|
22
22
|
top: 0;
|
|
23
23
|
bottom: 0;
|
|
@@ -26,50 +26,69 @@
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
@mixin border-top(
|
|
30
|
-
|
|
29
|
+
@mixin border-top(
|
|
30
|
+
$color: var(--sar-border-color),
|
|
31
|
+
$style: var(--sar-border-style),
|
|
32
|
+
$width: var(--sar-border-width)
|
|
33
|
+
) {
|
|
34
|
+
@include border-vertical-base {
|
|
31
35
|
top: 0;
|
|
32
|
-
border-top:
|
|
36
|
+
border-top: $width $style $color;
|
|
33
37
|
transform-origin: top center;
|
|
34
38
|
@content;
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
@mixin border-bottom(
|
|
39
|
-
|
|
42
|
+
@mixin border-bottom(
|
|
43
|
+
$color: var(--sar-border-color),
|
|
44
|
+
$style: var(--sar-border-style),
|
|
45
|
+
$width: var(--sar-border-width)
|
|
46
|
+
) {
|
|
47
|
+
@include border-vertical-base {
|
|
40
48
|
bottom: 0;
|
|
41
|
-
border-bottom:
|
|
49
|
+
border-bottom: $width $style $color;
|
|
42
50
|
transform-origin: bottom center;
|
|
43
51
|
@content;
|
|
44
52
|
}
|
|
45
53
|
}
|
|
46
54
|
|
|
47
|
-
@mixin border-left(
|
|
48
|
-
|
|
55
|
+
@mixin border-left(
|
|
56
|
+
$color: var(--sar-border-color),
|
|
57
|
+
$style: var(--sar-border-style),
|
|
58
|
+
$width: var(--sar-border-width)
|
|
59
|
+
) {
|
|
60
|
+
@include border-horizontal-base {
|
|
49
61
|
left: 0;
|
|
50
|
-
border-left:
|
|
62
|
+
border-left: $width $style $color;
|
|
51
63
|
transform-origin: left center;
|
|
52
64
|
@content;
|
|
53
65
|
}
|
|
54
66
|
}
|
|
55
67
|
|
|
56
|
-
@mixin border-right(
|
|
57
|
-
|
|
68
|
+
@mixin border-right(
|
|
69
|
+
$color: var(--sar-border-color),
|
|
70
|
+
$style: var(--sar-border-style),
|
|
71
|
+
$width: var(--sar-border-width)
|
|
72
|
+
) {
|
|
73
|
+
@include border-horizontal-base {
|
|
58
74
|
right: 0;
|
|
59
|
-
border-right:
|
|
75
|
+
border-right: $width $style $color;
|
|
60
76
|
transform-origin: right center;
|
|
61
77
|
@content;
|
|
62
78
|
}
|
|
63
79
|
}
|
|
64
80
|
|
|
65
|
-
@mixin border-cover-base(
|
|
81
|
+
@mixin border-cover-base(
|
|
82
|
+
$width: var(--sar-border-width),
|
|
83
|
+
$style: var(--sar-border-style)
|
|
84
|
+
) {
|
|
66
85
|
position: absolute;
|
|
67
86
|
top: -50%;
|
|
68
87
|
right: -50%;
|
|
69
88
|
bottom: -50%;
|
|
70
89
|
left: -50%;
|
|
71
90
|
z-index: 1;
|
|
72
|
-
border:
|
|
91
|
+
border: $width $style transparent;
|
|
73
92
|
transform: scale(0.5);
|
|
74
93
|
transform-origin: center;
|
|
75
94
|
pointer-events: none;
|
|
@@ -78,82 +97,126 @@
|
|
|
78
97
|
@content;
|
|
79
98
|
}
|
|
80
99
|
|
|
81
|
-
@mixin border-top-right(
|
|
82
|
-
|
|
100
|
+
@mixin border-top-right(
|
|
101
|
+
$color: var(--sar-border-color),
|
|
102
|
+
$style: var(--sar-border-style),
|
|
103
|
+
$width: var(--sar-border-width)
|
|
104
|
+
) {
|
|
105
|
+
@include border-cover-base($width, $style);
|
|
83
106
|
border-top-color: $color;
|
|
84
107
|
border-right-color: $color;
|
|
85
108
|
@content;
|
|
86
109
|
}
|
|
87
110
|
|
|
88
|
-
@mixin border-bottom-right(
|
|
89
|
-
|
|
111
|
+
@mixin border-bottom-right(
|
|
112
|
+
$color: var(--sar-border-color),
|
|
113
|
+
$style: var(--sar-border-style),
|
|
114
|
+
$width: var(--sar-border-width)
|
|
115
|
+
) {
|
|
116
|
+
@include border-cover-base($width, $style);
|
|
90
117
|
border-bottom-color: $color;
|
|
91
118
|
border-right-color: $color;
|
|
92
119
|
@content;
|
|
93
120
|
}
|
|
94
121
|
|
|
95
|
-
@mixin border-top-left(
|
|
96
|
-
|
|
122
|
+
@mixin border-top-left(
|
|
123
|
+
$color: var(--sar-border-color),
|
|
124
|
+
$style: var(--sar-border-style),
|
|
125
|
+
$width: var(--sar-border-width)
|
|
126
|
+
) {
|
|
127
|
+
@include border-cover-base($width, $style);
|
|
97
128
|
border-top-color: $color;
|
|
98
129
|
border-left-color: $color;
|
|
99
130
|
@content;
|
|
100
131
|
}
|
|
101
132
|
|
|
102
|
-
@mixin border-bottom-left(
|
|
103
|
-
|
|
133
|
+
@mixin border-bottom-left(
|
|
134
|
+
$color: var(--sar-border-color),
|
|
135
|
+
$style: var(--sar-border-style),
|
|
136
|
+
$width: var(--sar-border-width)
|
|
137
|
+
) {
|
|
138
|
+
@include border-cover-base($width, $style);
|
|
104
139
|
border-bottom-color: $color;
|
|
105
140
|
border-left-color: $color;
|
|
106
141
|
@content;
|
|
107
142
|
}
|
|
108
143
|
|
|
109
|
-
@mixin border-horizontal(
|
|
110
|
-
|
|
144
|
+
@mixin border-horizontal(
|
|
145
|
+
$color: var(--sar-border-color),
|
|
146
|
+
$style: var(--sar-border-style),
|
|
147
|
+
$width: var(--sar-border-width)
|
|
148
|
+
) {
|
|
149
|
+
@include border-cover-base($width, $style);
|
|
111
150
|
border-left-color: $color;
|
|
112
151
|
border-right-color: $color;
|
|
113
152
|
@content;
|
|
114
153
|
}
|
|
115
154
|
|
|
116
|
-
@mixin border-vertical(
|
|
117
|
-
|
|
155
|
+
@mixin border-vertical(
|
|
156
|
+
$color: var(--sar-border-color),
|
|
157
|
+
$style: var(--sar-border-style),
|
|
158
|
+
$width: var(--sar-border-width)
|
|
159
|
+
) {
|
|
160
|
+
@include border-cover-base($width, $style);
|
|
118
161
|
border-top-color: $color;
|
|
119
162
|
border-bottom-color: $color;
|
|
120
163
|
@content;
|
|
121
164
|
}
|
|
122
165
|
|
|
123
|
-
@mixin border-lack-top(
|
|
124
|
-
|
|
166
|
+
@mixin border-lack-top(
|
|
167
|
+
$color: var(--sar-border-color),
|
|
168
|
+
$style: var(--sar-border-style),
|
|
169
|
+
$width: var(--sar-border-width)
|
|
170
|
+
) {
|
|
171
|
+
@include border-cover-base($width, $style);
|
|
125
172
|
border-left-color: $color;
|
|
126
173
|
border-right-color: $color;
|
|
127
174
|
border-bottom-color: $color;
|
|
128
175
|
@content;
|
|
129
176
|
}
|
|
130
177
|
|
|
131
|
-
@mixin border-lack-right(
|
|
132
|
-
|
|
178
|
+
@mixin border-lack-right(
|
|
179
|
+
$color: var(--sar-border-color),
|
|
180
|
+
$style: var(--sar-border-style),
|
|
181
|
+
$width: var(--sar-border-width)
|
|
182
|
+
) {
|
|
183
|
+
@include border-cover-base($width, $style);
|
|
133
184
|
border-top-color: $color;
|
|
134
185
|
border-bottom-color: $color;
|
|
135
186
|
border-left-color: $color;
|
|
136
187
|
@content;
|
|
137
188
|
}
|
|
138
189
|
|
|
139
|
-
@mixin border-lack-bottom(
|
|
140
|
-
|
|
190
|
+
@mixin border-lack-bottom(
|
|
191
|
+
$color: var(--sar-border-color),
|
|
192
|
+
$style: var(--sar-border-style),
|
|
193
|
+
$width: var(--sar-border-width)
|
|
194
|
+
) {
|
|
195
|
+
@include border-cover-base($width, $style);
|
|
141
196
|
border-top-color: $color;
|
|
142
197
|
border-right-color: $color;
|
|
143
198
|
border-left-color: $color;
|
|
144
199
|
@content;
|
|
145
200
|
}
|
|
146
201
|
|
|
147
|
-
@mixin border-lack-left(
|
|
148
|
-
|
|
202
|
+
@mixin border-lack-left(
|
|
203
|
+
$color: var(--sar-border-color),
|
|
204
|
+
$style: var(--sar-border-style),
|
|
205
|
+
$width: var(--sar-border-width)
|
|
206
|
+
) {
|
|
207
|
+
@include border-cover-base($width, $style);
|
|
149
208
|
border-top-color: $color;
|
|
150
209
|
border-right-color: $color;
|
|
151
210
|
border-bottom-color: $color;
|
|
152
211
|
@content;
|
|
153
212
|
}
|
|
154
213
|
|
|
155
|
-
@mixin border-surround(
|
|
156
|
-
|
|
214
|
+
@mixin border-surround(
|
|
215
|
+
$color: var(--sar-border-color),
|
|
216
|
+
$style: var(--sar-border-style),
|
|
217
|
+
$width: var(--sar-border-width)
|
|
218
|
+
) {
|
|
219
|
+
@include border-cover-base($width, $style);
|
|
157
220
|
border-color: $color;
|
|
158
221
|
@content;
|
|
159
222
|
}
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
--sar-tertiary-bg: var(--sar-gray-600);
|
|
14
14
|
--sar-fourth-color: var(--sar-gray-600);
|
|
15
15
|
--sar-fourth-bg: var(--sar-gray-500);
|
|
16
|
+
// deprecated 1.20+
|
|
16
17
|
--sar-quaternary-color: var(--sar-gray-600);
|
|
18
|
+
// deprecated 1.20+
|
|
17
19
|
--sar-quaternary-bg: var(--sar-gray-500);
|
|
18
20
|
--sar-emphasis-color: var(--sar-white);
|
|
19
21
|
--sar-emphasis-bg: var(--sar-gray-900);
|
|
@@ -30,7 +32,9 @@
|
|
|
30
32
|
--sar-tertiary-bg-rgb: var(--sar-gray-700-rgb);
|
|
31
33
|
--sar-fourth-color-rgb: var(--sar-gray-600-rgb);
|
|
32
34
|
--sar-fourth-bg-rgb: var(--sar-gray-700-rgb);
|
|
35
|
+
// deprecated 1.20+
|
|
33
36
|
--sar-quaternary-color-rgb: var(--sar-gray-600-rgb);
|
|
37
|
+
// deprecated 1.20+
|
|
34
38
|
--sar-quaternary-bg-rgb: var(--sar-gray-700-rgb);
|
|
35
39
|
--sar-emphasis-color-rgb: var(--sar-white-rgb);
|
|
36
40
|
--sar-emphasis-bg-rgb: var(--sar-gray-900-rgb);
|
|
@@ -88,7 +88,9 @@ page,
|
|
|
88
88
|
--sar-secondary-bg: var(--sar-gray-200);
|
|
89
89
|
--sar-tertiary-color: var(--sar-gray-600);
|
|
90
90
|
--sar-tertiary-bg: var(--sar-gray-300);
|
|
91
|
+
// deprecated 1.20+
|
|
91
92
|
--sar-quaternary-color: var(--sar-gray-500);
|
|
93
|
+
// deprecated 1.20+
|
|
92
94
|
--sar-quaternary-bg: var(--sar-gray-400);
|
|
93
95
|
--sar-fourth-color: var(--sar-gray-500);
|
|
94
96
|
--sar-fourth-bg: var(--sar-gray-400);
|
|
@@ -105,7 +107,9 @@ page,
|
|
|
105
107
|
--sar-secondary-bg-rgb: var(--sar-gray-200-rgb);
|
|
106
108
|
--sar-tertiary-color-rgb: var(--sar-gray-600-rgb);
|
|
107
109
|
--sar-tertiary-bg-rgb: var(--sar-gray-300-rgb);
|
|
110
|
+
// deprecated 1.20+
|
|
108
111
|
--sar-quaternary-color-rgb: var(--sar-gray-500-rgb);
|
|
112
|
+
// deprecated 1.20+
|
|
109
113
|
--sar-quaternary-bg-rgb: var(--sar-gray-400-rgb);
|
|
110
114
|
--sar-fourth-color-rgb: var(--sar-gray-500-rgb);
|
|
111
115
|
--sar-fourth-bg-rgb: var(--sar-gray-400-rgb);
|
|
@@ -114,6 +118,10 @@ page,
|
|
|
114
118
|
--sar-border-color-rgb: var(--sar-gray-300-rgb);
|
|
115
119
|
--sar-active-bg-rgb: var(--sar-gray-200-rgb);
|
|
116
120
|
|
|
121
|
+
// # 边框 1.20+
|
|
122
|
+
--sar-border-style: solid;
|
|
123
|
+
--sar-border-width: 1px;
|
|
124
|
+
|
|
117
125
|
// # 圆角
|
|
118
126
|
--sar-rounded-xs: 4rpx;
|
|
119
127
|
--sar-rounded-sm: 8rpx;
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
defaultTableProps
|
|
38
38
|
} from "./common";
|
|
39
39
|
import SarTableFixation from "../table-fixation/table-fixation.vue";
|
|
40
|
+
import { useWindowResize } from "../../use";
|
|
40
41
|
/**
|
|
41
42
|
* @property {string} rootClass 组件根元素类名,默认值:-。
|
|
42
43
|
* @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
|
|
@@ -76,7 +77,7 @@ export default _defineComponent({
|
|
|
76
77
|
onMounted(() => {
|
|
77
78
|
nextTick(setTableRect);
|
|
78
79
|
});
|
|
79
|
-
|
|
80
|
+
useWindowResize(setTableRect);
|
|
80
81
|
const fixedRow = computed(() => {
|
|
81
82
|
return !isNullish(props.height);
|
|
82
83
|
});
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
getBoundingClientRect,
|
|
33
33
|
uniqid
|
|
34
34
|
} from "../../utils";
|
|
35
|
+
import { useWindowResize } from "../../use";
|
|
35
36
|
export default _defineComponent({
|
|
36
37
|
...{
|
|
37
38
|
options: {
|
|
@@ -85,7 +86,7 @@ export default _defineComponent({
|
|
|
85
86
|
const setFixationRect = async () => {
|
|
86
87
|
fixationRect.value = await getBoundingClientRect(`.${fixationId}`, instance);
|
|
87
88
|
};
|
|
88
|
-
|
|
89
|
+
useWindowResize(setFixationRect);
|
|
89
90
|
watch(
|
|
90
91
|
scrollSide,
|
|
91
92
|
() => {
|
|
@@ -7,11 +7,11 @@ declare const _default: import("vue").DefineComponent<ToastProps, {
|
|
|
7
7
|
}, string, import("vue").PublicProps, Readonly<ToastProps> & Readonly<{
|
|
8
8
|
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
9
9
|
}>, {
|
|
10
|
+
timeout: number;
|
|
10
11
|
type: "text" | "loading" | "success" | "fail";
|
|
11
12
|
position: "top" | "center" | "bottom";
|
|
12
13
|
duration: number;
|
|
13
14
|
overlay: boolean;
|
|
14
|
-
timeout: number;
|
|
15
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
16
|
export default _default;
|
|
17
17
|
export declare const mapIdToast: Record<string, {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type ToastAgentProps } from './common';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<ToastAgentProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ToastAgentProps> & Readonly<{}>, {
|
|
3
|
+
timeout: number;
|
|
3
4
|
type: "text" | "loading" | "success" | "fail";
|
|
4
5
|
id: string;
|
|
5
6
|
position: "top" | "center" | "bottom";
|
|
6
7
|
duration: number;
|
|
7
8
|
overlay: boolean;
|
|
8
|
-
timeout: number;
|
|
9
9
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
10
|
export default _default;
|
|
@@ -18,8 +18,8 @@ declare const _default: import("vue").DefineComponent<TreeProps, {
|
|
|
18
18
|
onSelect?: ((key: string | number, node: TreeStateNode) => any) | undefined;
|
|
19
19
|
"onUpdate:current"?: ((key: string | number, node: TreeStateNode) => any) | undefined;
|
|
20
20
|
}>, {
|
|
21
|
-
accordion: boolean;
|
|
22
21
|
data: TreeNode[];
|
|
22
|
+
accordion: boolean;
|
|
23
23
|
filterMode: "lenient" | "strict";
|
|
24
24
|
defaultExpandAll: boolean;
|
|
25
25
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
classNames,
|
|
101
101
|
createBem,
|
|
102
102
|
getBoundingClientRect,
|
|
103
|
-
|
|
103
|
+
clamp,
|
|
104
104
|
stringifyStyle,
|
|
105
105
|
uniqid
|
|
106
106
|
} from "../../utils";
|
|
@@ -171,7 +171,7 @@ export default _defineComponent({
|
|
|
171
171
|
const nodeHeight = nodeRect.height;
|
|
172
172
|
const currentIndex = obviousNodes.findIndex((node) => node === props.node);
|
|
173
173
|
const offsetIndex = Math.floor(Math.abs(offset.y) / nodeHeight + 0.5) * (offset.y < 0 ? -1 : 1);
|
|
174
|
-
const targetIndex =
|
|
174
|
+
const targetIndex = clamp(
|
|
175
175
|
currentIndex + offsetIndex,
|
|
176
176
|
0,
|
|
177
177
|
obviousNodes.length - 1
|
|
@@ -65,6 +65,12 @@ import Upload from 'sard-uniapp/components/upload/upload.vue'
|
|
|
65
65
|
|
|
66
66
|
@code('${DEMO_PATH}/upload/demo/Status.vue')
|
|
67
67
|
|
|
68
|
+
### 重传与取消 <sup>1.20+</sup>
|
|
69
|
+
|
|
70
|
+
利用 `item-click` 事件可实现重传与取消。
|
|
71
|
+
|
|
72
|
+
@code('${DEMO_PATH}/upload/demo/ReuploadCancel.vue')
|
|
73
|
+
|
|
68
74
|
### 只读和禁用
|
|
69
75
|
|
|
70
76
|
只读会隐藏选择区域,禁用则不允许用户点击选择。
|
|
@@ -101,7 +107,7 @@ import Upload from 'sard-uniapp/components/upload/upload.vue'
|
|
|
101
107
|
| before-read | 文件读取前的回调,返回 false 可终止文件读取,支持返回 Promise | (file: File) => boolean \| Promise\<File> | - |
|
|
102
108
|
| after-read | 文件读取完成后的回调 | (fileItem: UploadFileItem \| UploadFileItem[]) => void | - |
|
|
103
109
|
| removable | 是否可删除 | boolean | true |
|
|
104
|
-
| before-remove | 文件删除前的回调,返回 false
|
|
110
|
+
| before-remove | 文件删除前的回调,返回 false 可终止文件删除,支持返回 Promise | (index: number, fileItem: UploadFileItem) => boolean \| Promise\<any> | - |
|
|
105
111
|
| validate-event | 是否触发表单验证 | boolean | true |
|
|
106
112
|
|
|
107
113
|
### UploadSlots
|
|
@@ -110,13 +116,14 @@ import Upload from 'sard-uniapp/components/upload/upload.vue'
|
|
|
110
116
|
| ------ | -------------- | ---- |
|
|
111
117
|
| select | 自定义选取内容 | - |
|
|
112
118
|
|
|
113
|
-
###
|
|
119
|
+
### UploadEmits
|
|
114
120
|
|
|
115
|
-
| 事件
|
|
116
|
-
|
|
|
117
|
-
| update:model-value
|
|
118
|
-
| change <sup>1.9.2+</sup>
|
|
119
|
-
| remove
|
|
121
|
+
| 事件 | 描述 | 类型 |
|
|
122
|
+
| --------------------------- | ------------------------ | --------------------------------------------- |
|
|
123
|
+
| update:model-value | 选择的文件列表改变时触发 | (value: UploadFileItem[]) => void |
|
|
124
|
+
| change <sup>1.9.2+</sup> | 选择的文件列表改变时触发 | (value: UploadFileItem[]) => void |
|
|
125
|
+
| remove | 删除文件时触发 | (index: number, item: UploadFileItem) => void |
|
|
126
|
+
| item-click <sup>1.20+</sup> | 点击文件项时触发 | (item: UploadFileItem, index: number) => void |
|
|
120
127
|
|
|
121
128
|
### UploadFileItem
|
|
122
129
|
|
|
@@ -138,14 +145,15 @@ type UploadStatus = 'pending' | 'uploading' | 'failed' | 'done'
|
|
|
138
145
|
|
|
139
146
|
### UploadFile
|
|
140
147
|
|
|
141
|
-
| 属性
|
|
142
|
-
|
|
|
143
|
-
| type
|
|
144
|
-
| size
|
|
145
|
-
|
|
|
146
|
-
|
|
|
147
|
-
|
|
|
148
|
-
|
|
|
148
|
+
| 属性 | 描述 | 类型 | 默认值 |
|
|
149
|
+
| --------------------- | ------------------ | ------------------ | ------ |
|
|
150
|
+
| type | 文件类型 | 'image' \| 'video' | - |
|
|
151
|
+
| size | 文件大小,单位字节 | number | - |
|
|
152
|
+
| name <sup>1.20+</sup> | 文件名 | string | - |
|
|
153
|
+
| path | 本地临时文件路径 | string | - |
|
|
154
|
+
| duration | 选定视频的时间长度 | number | 0 |
|
|
155
|
+
| width | 选定视频的宽度 | number | 0 |
|
|
156
|
+
| height | 选定视频的高度 | number | 0 |
|
|
149
157
|
|
|
150
158
|
## 主题定制
|
|
151
159
|
|
|
@@ -8,6 +8,7 @@ export interface UploadFile {
|
|
|
8
8
|
duration: number;
|
|
9
9
|
width: number;
|
|
10
10
|
height: number;
|
|
11
|
+
name: string;
|
|
11
12
|
}
|
|
12
13
|
export interface UploadFileItem {
|
|
13
14
|
file?: UploadFile;
|
|
@@ -37,7 +38,7 @@ export interface UploadProps {
|
|
|
37
38
|
beforeRead?: (file: UploadFile) => boolean | Promise<UploadFile>;
|
|
38
39
|
afterRead?: (fileItem: UploadFileItem) => void;
|
|
39
40
|
removable?: boolean;
|
|
40
|
-
beforeRemove?: (
|
|
41
|
+
beforeRemove?: (index: number, fileItem: UploadFileItem) => boolean | Promise<void>;
|
|
41
42
|
validateEvent?: boolean;
|
|
42
43
|
}
|
|
43
44
|
export declare const defaultUploadProps: Omit<typeof defaultConfig.upload, "sourceType" | "sizeType">;
|
|
@@ -48,6 +49,7 @@ export interface UploadEmits {
|
|
|
48
49
|
(e: 'update:model-value', value: UploadFileItem[]): void;
|
|
49
50
|
(e: 'change', value: UploadFileItem[]): void;
|
|
50
51
|
(e: 'remove', index: number, item: UploadFileItem): void;
|
|
52
|
+
(e: 'item-click', item: UploadFileItem, index: number): void;
|
|
51
53
|
}
|
|
52
54
|
export interface ChainNode {
|
|
53
55
|
(data: any, next: (...args: any[]) => void): void;
|
|
@@ -63,7 +65,6 @@ export interface UploadPreviewProps {
|
|
|
63
65
|
name?: string;
|
|
64
66
|
message?: string;
|
|
65
67
|
removable?: boolean;
|
|
66
|
-
beforeRemove?: (index: number) => boolean | Promise<void>;
|
|
67
68
|
index: number;
|
|
68
69
|
disabled?: boolean;
|
|
69
70
|
readonly?: boolean;
|
|
@@ -72,6 +73,7 @@ export declare const defaultUploadPreviewProps: {
|
|
|
72
73
|
status: UploadPreviewProps["status"];
|
|
73
74
|
};
|
|
74
75
|
export interface UploadPreviewEmits {
|
|
75
|
-
(e: 'image-click'
|
|
76
|
-
(e: 'remove'
|
|
76
|
+
(e: 'image-click'): void;
|
|
77
|
+
(e: 'remove'): void;
|
|
78
|
+
(e: 'click'): void;
|
|
77
79
|
}
|
|
@@ -4,10 +4,12 @@ declare const __VLS_component: import("vue").DefineComponent<UploadProps, {}, {}
|
|
|
4
4
|
"update:model-value": (value: UploadFileItem[]) => any;
|
|
5
5
|
change: (value: UploadFileItem[]) => any;
|
|
6
6
|
remove: (index: number, item: UploadFileItem) => any;
|
|
7
|
+
"item-click": (item: UploadFileItem, index: number) => any;
|
|
7
8
|
}, string, import("vue").PublicProps, Readonly<UploadProps> & Readonly<{
|
|
8
9
|
"onUpdate:model-value"?: ((value: UploadFileItem[]) => any) | undefined;
|
|
9
10
|
onChange?: ((value: UploadFileItem[]) => any) | undefined;
|
|
10
11
|
onRemove?: ((index: number, item: UploadFileItem) => any) | undefined;
|
|
12
|
+
"onItem-click"?: ((item: UploadFileItem, index: number) => any) | undefined;
|
|
11
13
|
}>, {
|
|
12
14
|
accept: "image" | "video";
|
|
13
15
|
validateEvent: boolean;
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
:name="item.name"
|
|
13
13
|
:message="item.message"
|
|
14
14
|
:removable="removable"
|
|
15
|
-
:before-remove="beforeRemove"
|
|
16
15
|
:index="index"
|
|
17
16
|
:disabled="isDisabled"
|
|
18
17
|
:readonly="isReadonly"
|
|
19
18
|
@remove="onRemove(index, item)"
|
|
20
|
-
@image-click="onImageClick"
|
|
19
|
+
@image-click="onImageClick(index)"
|
|
20
|
+
@click="onItemClick(index, item)"
|
|
21
21
|
/>
|
|
22
22
|
<view
|
|
23
23
|
v-if="innerValue.length < maxCount && !isReadonly"
|
|
@@ -73,8 +73,12 @@ import { useFormContext, useFormItemContext } from "../form/common";
|
|
|
73
73
|
* @property {(file: File) => boolean | Promise\<File>} beforeRead 文件读取前的回调,返回 false 可终止文件读取,支持返回 Promise,默认值:-。
|
|
74
74
|
* @property {(fileItem: UploadFileItem | UploadFileItem[]) => void} afterRead 文件读取完成后的回调,默认值:-。
|
|
75
75
|
* @property {boolean} removable 是否可删除,默认值:true。
|
|
76
|
-
* @property {(
|
|
76
|
+
* @property {(index: number, fileItem: UploadFileItem) => boolean | Promise\<any>} beforeRemove 文件删除前的回调,返回 false 可终止文件删除,支持返回 Promise,默认值:-。
|
|
77
77
|
* @property {boolean} validateEvent 是否触发表单验证,默认值:true。
|
|
78
|
+
* @event {(value: UploadFileItem[]) => void} update 选择的文件列表改变时触发
|
|
79
|
+
* @event {(value: UploadFileItem[]) => void} change 选择的文件列表改变时触发
|
|
80
|
+
* @event {(index: number, item: UploadFileItem) => void} remove 删除文件时触发
|
|
81
|
+
* @event {(item: UploadFileItem, index: number) => void} item-click 点击文件项时触发
|
|
78
82
|
*/
|
|
79
83
|
export default _defineComponent({
|
|
80
84
|
components: {
|
|
@@ -110,7 +114,7 @@ export default _defineComponent({
|
|
|
110
114
|
beforeRemove: { type: Function, required: false },
|
|
111
115
|
validateEvent: { type: Boolean, required: false }
|
|
112
116
|
}, defaultUploadProps),
|
|
113
|
-
emits: ["update:model-value", "change", "remove"],
|
|
117
|
+
emits: ["update:model-value", "change", "remove", "item-click"],
|
|
114
118
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
115
119
|
__expose();
|
|
116
120
|
const props = __props;
|
|
@@ -177,7 +181,7 @@ export default _defineComponent({
|
|
|
177
181
|
const fileList = files.map((file) => {
|
|
178
182
|
return {
|
|
179
183
|
file,
|
|
180
|
-
name: file.
|
|
184
|
+
name: file.name
|
|
181
185
|
};
|
|
182
186
|
});
|
|
183
187
|
next(fileList);
|
|
@@ -246,7 +250,8 @@ export default _defineComponent({
|
|
|
246
250
|
path: file.tempFilePath,
|
|
247
251
|
duration: file.duration,
|
|
248
252
|
width: file.width,
|
|
249
|
-
height: file.height
|
|
253
|
+
height: file.height,
|
|
254
|
+
name: file.name || file.tempFilePath && getFileName(file.tempFilePath)
|
|
250
255
|
};
|
|
251
256
|
})
|
|
252
257
|
);
|
|
@@ -266,14 +271,40 @@ export default _defineComponent({
|
|
|
266
271
|
next();
|
|
267
272
|
}
|
|
268
273
|
};
|
|
274
|
+
// # remove
|
|
275
|
+
const removingSet = new WeakSet();
|
|
269
276
|
const onRemove = (index, item) => {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
277
|
+
if (!props.removable || isDisabled.value || isReadonly.value) return;
|
|
278
|
+
if (removingSet.has(item)) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
function remove() {
|
|
282
|
+
const list = innerValue.value.filter((_, i) => i !== index);
|
|
283
|
+
innerValue.value = list;
|
|
284
|
+
emit("update:model-value", list);
|
|
285
|
+
emit("change", list);
|
|
286
|
+
emit("remove", index, item);
|
|
287
|
+
}
|
|
288
|
+
if (props.beforeRemove) {
|
|
289
|
+
const ret = props.beforeRemove(index, item);
|
|
290
|
+
if (ret === false) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (ret instanceof Promise) {
|
|
294
|
+
removingSet.add(item);
|
|
295
|
+
ret.then(() => {
|
|
296
|
+
remove();
|
|
297
|
+
}).catch(() => {
|
|
298
|
+
}).finally(() => {
|
|
299
|
+
removingSet.delete(item);
|
|
300
|
+
});
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
remove();
|
|
275
305
|
};
|
|
276
|
-
|
|
306
|
+
// # preview
|
|
307
|
+
const previewImage = (index) => {
|
|
277
308
|
const currentFileItem = innerValue.value[index];
|
|
278
309
|
const fileList = innerValue.value.filter(
|
|
279
310
|
(item) => item.url && isImageUrl(item.url) || item.file?.type === "image"
|
|
@@ -285,6 +316,13 @@ export default _defineComponent({
|
|
|
285
316
|
current: urls[currentIndex]
|
|
286
317
|
});
|
|
287
318
|
};
|
|
319
|
+
const onImageClick = (index) => {
|
|
320
|
+
previewImage(index);
|
|
321
|
+
};
|
|
322
|
+
const onItemClick = (index, fileItem) => {
|
|
323
|
+
emit("item-click", fileItem, index);
|
|
324
|
+
};
|
|
325
|
+
// # others
|
|
288
326
|
const uploadClass = computed(() => {
|
|
289
327
|
return classNames(
|
|
290
328
|
bem.b(),
|
|
@@ -300,7 +338,7 @@ export default _defineComponent({
|
|
|
300
338
|
return isSelectPending;
|
|
301
339
|
}, set isSelectPending(v) {
|
|
302
340
|
isSelectPending = v;
|
|
303
|
-
}, onSelect, onRemove, onImageClick, uploadClass, uploadStyle, SarUploadPreview, SarIcon };
|
|
341
|
+
}, onSelect, removingSet, onRemove, previewImage, onImageClick, onItemClick, uploadClass, uploadStyle, SarUploadPreview, SarIcon };
|
|
304
342
|
return __returned__;
|
|
305
343
|
}
|
|
306
344
|
});
|
|
@@ -16,6 +16,7 @@ export function chooseMedia(options) {
|
|
|
16
16
|
duration: 0,
|
|
17
17
|
height: 0,
|
|
18
18
|
width: 0,
|
|
19
|
+
name: file.name || '',
|
|
19
20
|
fileType: 'image',
|
|
20
21
|
};
|
|
21
22
|
}),
|
|
@@ -41,6 +42,7 @@ export function chooseMedia(options) {
|
|
|
41
42
|
duration: res.duration,
|
|
42
43
|
height: res.height,
|
|
43
44
|
width: res.width,
|
|
45
|
+
name: res.name || '',
|
|
44
46
|
fileType: 'video',
|
|
45
47
|
},
|
|
46
48
|
],
|