@varlet/ui 2.16.2 → 2.16.3-alpha.1694361535255
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/es/action-sheet/ActionSheet.mjs +20 -16
- package/es/app-bar/AppBar.mjs +10 -9
- package/es/avatar/Avatar.mjs +16 -15
- package/es/avatar-group/AvatarGroup.mjs +4 -3
- package/es/back-top/BackTop.mjs +20 -19
- package/es/badge/Badge.mjs +4 -3
- package/es/bottom-navigation/BottomNavigation.mjs +70 -63
- package/es/bottom-navigation-item/BottomNavigationItem.mjs +13 -10
- package/es/breadcrumb/Breadcrumb.mjs +5 -4
- package/es/breadcrumbs/Breadcrumbs.mjs +2 -1
- package/es/button/Button.mjs +10 -9
- package/es/button-group/ButtonGroup.mjs +2 -1
- package/es/card/Card.mjs +28 -26
- package/es/cell/Cell.mjs +5 -4
- package/es/checkbox/Checkbox.mjs +32 -29
- package/es/checkbox-group/CheckboxGroup.mjs +45 -40
- package/es/chip/Chip.mjs +6 -5
- package/es/col/Col.mjs +15 -14
- package/es/collapse/Collapse.mjs +30 -29
- package/es/collapse-item/CollapseItem.mjs +52 -47
- package/es/countdown/Countdown.mjs +36 -35
- package/es/counter/Counter.mjs +63 -60
- package/es/date-picker/DatePicker.mjs +67 -63
- package/es/dialog/Dialog.mjs +39 -29
- package/es/divider/Divider.mjs +6 -9
- package/es/drag/Drag.mjs +47 -45
- package/es/ellipsis/Ellipsis.mjs +6 -5
- package/es/fab/Fab.mjs +21 -20
- package/es/field-decorator/FieldDecorator.mjs +14 -13
- package/es/form/Form.mjs +41 -36
- package/es/form-details/FormDetails.mjs +2 -1
- package/es/hover-overlay/HoverOverlay.mjs +6 -7
- package/es/icon/Icon.mjs +14 -12
- package/es/image/Image.mjs +14 -12
- package/es/image-preview/ImagePreview.mjs +51 -50
- package/es/index-anchor/IndexAnchor.mjs +15 -12
- package/es/index-bar/IndexBar.mjs +68 -65
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +63 -56
- package/es/link/Link.mjs +6 -5
- package/es/list/List.mjs +55 -46
- package/es/loading/Loading.mjs +11 -8
- package/es/loading-bar/LoadingBar.mjs +2 -1
- package/es/menu/Menu.mjs +2 -1
- package/es/option/Option.mjs +14 -11
- package/es/overlay/Overlay.mjs +18 -18
- package/es/pagination/Pagination.mjs +67 -64
- package/es/paper/Paper.mjs +4 -3
- package/es/picker/Picker.mjs +95 -85
- package/es/popup/Popup.mjs +26 -23
- package/es/progress/Progress.mjs +9 -8
- package/es/pull-refresh/PullRefresh.mjs +54 -51
- package/es/radio/Radio.mjs +25 -22
- package/es/radio-group/RadioGroup.mjs +30 -25
- package/es/rate/Rate.mjs +35 -28
- package/es/result/Result.mjs +6 -5
- package/es/row/Row.mjs +14 -13
- package/es/select/Select.mjs +57 -54
- package/es/skeleton/Skeleton.mjs +8 -9
- package/es/slider/Slider.mjs +86 -79
- package/es/snackbar/Snackbar.mjs +4 -3
- package/es/snackbar/style/index.mjs +1 -1
- package/es/space/Space.mjs +5 -2
- package/es/step/Step.mjs +7 -4
- package/es/steps/Steps.mjs +5 -4
- package/es/sticky/Sticky.mjs +30 -27
- package/es/style-provider/StyleProvider.mjs +2 -1
- package/es/swipe/Swipe.mjs +95 -89
- package/es/swipe-item/SwipeItem.mjs +5 -4
- package/es/switch/Switch.mjs +22 -17
- package/es/tab/Tab.mjs +16 -12
- package/es/tab-item/TabItem.mjs +7 -6
- package/es/table/Table.mjs +8 -9
- package/es/tabs/Tabs.mjs +57 -52
- package/es/tabs-items/TabsItems.mjs +38 -29
- package/es/time-picker/TimePicker.mjs +63 -60
- package/es/tooltip/Tooltip.mjs +3 -2
- package/es/uploader/Uploader.mjs +100 -85
- package/es/utils/components.mjs +2 -1
- package/es/utils/shared.mjs +0 -1
- package/es/varlet.esm.js +9589 -8914
- package/es/watermark/Watermark.mjs +29 -26
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/varlet.cjs.js +2365 -2102
- package/package.json +12 -14
- package/umd/varlet.js +4 -4
package/es/slider/Slider.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { isArray, isNumber, toNumber, getRect } from '@varlet/shared';
|
|
|
10
10
|
import { props, Thumbs } from './props.mjs';
|
|
11
11
|
import { onSmartMounted } from '@varlet/use';
|
|
12
12
|
var {
|
|
13
|
+
name,
|
|
13
14
|
n,
|
|
14
15
|
classes
|
|
15
16
|
} = createNamespace('slider');
|
|
@@ -77,7 +78,7 @@ function __render__(_ctx, _cache) {
|
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
var __sfc__ = defineComponent({
|
|
80
|
-
name
|
|
81
|
+
name,
|
|
81
82
|
components: {
|
|
82
83
|
VarFormDetails,
|
|
83
84
|
VarHoverOverlay
|
|
@@ -87,6 +88,14 @@ var __sfc__ = defineComponent({
|
|
|
87
88
|
},
|
|
88
89
|
props,
|
|
89
90
|
setup(props) {
|
|
91
|
+
var maxDistance = ref(0);
|
|
92
|
+
var sliderEl = ref(null);
|
|
93
|
+
var isScroll = ref(false);
|
|
94
|
+
var scope = computed(() => toNumber(props.max) - toNumber(props.min));
|
|
95
|
+
var unitWidth = computed(() => maxDistance.value / scope.value * toNumber(props.step));
|
|
96
|
+
var isDisabled = computed(() => props.disabled || (form == null ? void 0 : form.disabled.value));
|
|
97
|
+
var isReadonly = computed(() => props.readonly || (form == null ? void 0 : form.readonly.value));
|
|
98
|
+
var isVertical = computed(() => props.direction === 'vertical');
|
|
90
99
|
var {
|
|
91
100
|
bindForm,
|
|
92
101
|
form
|
|
@@ -105,23 +114,6 @@ var __sfc__ = defineComponent({
|
|
|
105
114
|
hovering: hoveringSecond,
|
|
106
115
|
handleHovering: handleHoveringSecond
|
|
107
116
|
} = useHoverOverlay();
|
|
108
|
-
var validate = () => v(props.rules, props.modelValue);
|
|
109
|
-
var getThumbProps = () => ({
|
|
110
|
-
startPosition: 0,
|
|
111
|
-
currentOffset: 0,
|
|
112
|
-
active: false,
|
|
113
|
-
percentValue: 0
|
|
114
|
-
});
|
|
115
|
-
var validateWithTrigger = () => nextTick(() => vt(['onChange'], 'onChange', props.rules, props.modelValue));
|
|
116
|
-
var sliderEl = ref(null);
|
|
117
|
-
var maxDistance = ref(0);
|
|
118
|
-
var isScroll = ref(false);
|
|
119
|
-
var thumbsProps = reactive({
|
|
120
|
-
[Thumbs.First]: getThumbProps(),
|
|
121
|
-
[Thumbs.Second]: getThumbProps()
|
|
122
|
-
});
|
|
123
|
-
var scope = computed(() => toNumber(props.max) - toNumber(props.min));
|
|
124
|
-
var unitWidth = computed(() => maxDistance.value / scope.value * toNumber(props.step));
|
|
125
117
|
var thumbList = computed(() => {
|
|
126
118
|
var {
|
|
127
119
|
modelValue,
|
|
@@ -173,31 +165,65 @@ var __sfc__ = defineComponent({
|
|
|
173
165
|
background: activeColor
|
|
174
166
|
};
|
|
175
167
|
});
|
|
176
|
-
var
|
|
177
|
-
|
|
178
|
-
|
|
168
|
+
var thumbsProps = reactive({
|
|
169
|
+
[Thumbs.First]: getThumbProps(),
|
|
170
|
+
[Thumbs.Second]: getThumbProps()
|
|
171
|
+
});
|
|
179
172
|
var activeThumb;
|
|
180
|
-
var
|
|
173
|
+
var sliderProvider = {
|
|
174
|
+
reset,
|
|
175
|
+
validate,
|
|
176
|
+
resetValidation
|
|
177
|
+
};
|
|
178
|
+
call(bindForm, sliderProvider);
|
|
179
|
+
watch([() => props.modelValue, () => props.step], _ref => {
|
|
180
|
+
var [modelValue, step] = _ref;
|
|
181
|
+
if (!stepValidator() || !valueValidator() || isScroll.value) return;
|
|
182
|
+
setProps(modelValue, toNumber(step));
|
|
183
|
+
});
|
|
184
|
+
watch(maxDistance, () => setProps());
|
|
185
|
+
onSmartMounted(() => {
|
|
186
|
+
if (!stepValidator() || !valueValidator()) return;
|
|
187
|
+
maxDistance.value = sliderEl.value[isVertical.value ? 'offsetHeight' : 'offsetWidth'];
|
|
188
|
+
});
|
|
189
|
+
onBeforeUnmount(() => {
|
|
190
|
+
removeDocumentEvents();
|
|
191
|
+
});
|
|
192
|
+
function validate() {
|
|
193
|
+
return v(props.rules, props.modelValue);
|
|
194
|
+
}
|
|
195
|
+
function getThumbProps() {
|
|
196
|
+
return {
|
|
197
|
+
startPosition: 0,
|
|
198
|
+
currentOffset: 0,
|
|
199
|
+
active: false,
|
|
200
|
+
percentValue: 0
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function validateWithTrigger() {
|
|
204
|
+
return nextTick(() => vt(['onChange'], 'onChange', props.rules, props.modelValue));
|
|
205
|
+
}
|
|
206
|
+
function getOffset(e) {
|
|
181
207
|
var currentTarget = e.currentTarget;
|
|
182
208
|
if (!currentTarget) return 0;
|
|
183
209
|
if (!isVertical.value) {
|
|
184
210
|
return e.clientX - getLeft(currentTarget);
|
|
185
211
|
}
|
|
186
212
|
return maxDistance.value - (e.clientY - getRect(currentTarget).top);
|
|
187
|
-
}
|
|
188
|
-
|
|
213
|
+
}
|
|
214
|
+
function thumbStyle(thumb) {
|
|
189
215
|
var key = isVertical.value ? 'bottom' : 'left';
|
|
190
216
|
return {
|
|
191
217
|
[key]: thumb.value + "%",
|
|
192
218
|
zIndex: thumbsProps[thumb.enumValue].active ? 1 : undefined
|
|
193
219
|
};
|
|
194
|
-
}
|
|
195
|
-
|
|
220
|
+
}
|
|
221
|
+
function showLabel(type) {
|
|
196
222
|
if (props.labelVisible === 'always') return true;
|
|
197
223
|
if (props.labelVisible === 'never') return false;
|
|
198
224
|
return thumbsProps[type].active;
|
|
199
|
-
}
|
|
200
|
-
|
|
225
|
+
}
|
|
226
|
+
function getValue(value) {
|
|
201
227
|
var {
|
|
202
228
|
min,
|
|
203
229
|
max
|
|
@@ -205,20 +231,20 @@ var __sfc__ = defineComponent({
|
|
|
205
231
|
if (value < toNumber(min)) return 0;
|
|
206
232
|
if (value > toNumber(max)) return 100;
|
|
207
233
|
return (value - toNumber(min)) / scope.value * 100;
|
|
208
|
-
}
|
|
209
|
-
|
|
234
|
+
}
|
|
235
|
+
function toPrecision(value) {
|
|
210
236
|
if (!isNumber(value)) return 0;
|
|
211
237
|
var num = value;
|
|
212
238
|
if (num < Number(props.min)) num = Number(props.min);
|
|
213
239
|
if (num > Number(props.max)) num = Number(props.max);
|
|
214
240
|
var isInteger = parseInt("" + num, 10) === num;
|
|
215
241
|
return isInteger ? num : toNumber(num.toPrecision(5));
|
|
216
|
-
}
|
|
217
|
-
|
|
242
|
+
}
|
|
243
|
+
function hover(value, item) {
|
|
218
244
|
if (isDisabled.value) return;
|
|
219
245
|
item.handleHovering(value);
|
|
220
|
-
}
|
|
221
|
-
|
|
246
|
+
}
|
|
247
|
+
function setPercent(moveDistance, type) {
|
|
222
248
|
var rangeValue = [];
|
|
223
249
|
var {
|
|
224
250
|
step,
|
|
@@ -241,28 +267,28 @@ var __sfc__ = defineComponent({
|
|
|
241
267
|
call(props['onUpdate:modelValue'], value);
|
|
242
268
|
validateWithTrigger();
|
|
243
269
|
}
|
|
244
|
-
}
|
|
245
|
-
|
|
270
|
+
}
|
|
271
|
+
function getType(offset) {
|
|
246
272
|
if (!props.range) return Thumbs.First;
|
|
247
273
|
var thumb1Distance = thumbsProps[Thumbs.First].percentValue * unitWidth.value;
|
|
248
274
|
var thumb2Distance = thumbsProps[Thumbs.Second].percentValue * unitWidth.value;
|
|
249
275
|
var offsetToThumb1 = Math.abs(offset - thumb1Distance);
|
|
250
276
|
var offsetToThumb2 = Math.abs(offset - thumb2Distance);
|
|
251
277
|
return offsetToThumb1 <= offsetToThumb2 ? Thumbs.First : Thumbs.Second;
|
|
252
|
-
}
|
|
253
|
-
|
|
278
|
+
}
|
|
279
|
+
function addDocumentEvents() {
|
|
254
280
|
document.addEventListener('touchmove', move, {
|
|
255
281
|
passive: false
|
|
256
282
|
});
|
|
257
283
|
document.addEventListener('touchend', end);
|
|
258
284
|
document.addEventListener('touchcancel', end);
|
|
259
|
-
}
|
|
260
|
-
|
|
285
|
+
}
|
|
286
|
+
function removeDocumentEvents() {
|
|
261
287
|
document.removeEventListener('touchmove', move);
|
|
262
288
|
document.removeEventListener('touchend', end);
|
|
263
289
|
document.removeEventListener('touchcancel', end);
|
|
264
|
-
}
|
|
265
|
-
|
|
290
|
+
}
|
|
291
|
+
function start(event, type) {
|
|
266
292
|
if (!maxDistance.value) maxDistance.value = sliderEl.value.offsetWidth;
|
|
267
293
|
if (!isDisabled.value) {
|
|
268
294
|
thumbsProps[type].active = true;
|
|
@@ -277,8 +303,8 @@ var __sfc__ = defineComponent({
|
|
|
277
303
|
clientY
|
|
278
304
|
} = event.touches[0];
|
|
279
305
|
thumbsProps[type].startPosition = isVertical.value ? clientY : clientX;
|
|
280
|
-
}
|
|
281
|
-
|
|
306
|
+
}
|
|
307
|
+
function move(event) {
|
|
282
308
|
event.preventDefault();
|
|
283
309
|
if (isDisabled.value || isReadonly.value || !isScroll.value) return;
|
|
284
310
|
var {
|
|
@@ -292,8 +318,8 @@ var __sfc__ = defineComponent({
|
|
|
292
318
|
var moveDistance = (isVertical.value ? startPosition - clientY : clientX - startPosition) + currentOffset;
|
|
293
319
|
if (moveDistance <= 0) moveDistance = 0;else if (moveDistance >= maxDistance.value) moveDistance = maxDistance.value;
|
|
294
320
|
setPercent(moveDistance, activeThumb);
|
|
295
|
-
}
|
|
296
|
-
|
|
321
|
+
}
|
|
322
|
+
function end() {
|
|
297
323
|
removeDocumentEvents();
|
|
298
324
|
var {
|
|
299
325
|
range,
|
|
@@ -314,8 +340,8 @@ var __sfc__ = defineComponent({
|
|
|
314
340
|
}
|
|
315
341
|
call(onEnd, range ? rangeValue : curValue);
|
|
316
342
|
isScroll.value = false;
|
|
317
|
-
}
|
|
318
|
-
|
|
343
|
+
}
|
|
344
|
+
function click(event) {
|
|
319
345
|
if (isDisabled.value || isReadonly.value) return;
|
|
320
346
|
if (event.target.closest("." + n('thumb'))) return;
|
|
321
347
|
var offset = getOffset(event);
|
|
@@ -323,8 +349,8 @@ var __sfc__ = defineComponent({
|
|
|
323
349
|
activeThumb = type;
|
|
324
350
|
setPercent(offset, type);
|
|
325
351
|
end();
|
|
326
|
-
}
|
|
327
|
-
|
|
352
|
+
}
|
|
353
|
+
function stepValidator() {
|
|
328
354
|
var stepNumber = toNumber(props.step);
|
|
329
355
|
if (isNaN(stepNumber)) {
|
|
330
356
|
warn('Slider', 'type of prop "step" should be Number');
|
|
@@ -335,8 +361,8 @@ var __sfc__ = defineComponent({
|
|
|
335
361
|
return false;
|
|
336
362
|
}
|
|
337
363
|
return true;
|
|
338
|
-
}
|
|
339
|
-
|
|
364
|
+
}
|
|
365
|
+
function valueValidator() {
|
|
340
366
|
var {
|
|
341
367
|
range,
|
|
342
368
|
modelValue
|
|
@@ -354,8 +380,8 @@ var __sfc__ = defineComponent({
|
|
|
354
380
|
return false;
|
|
355
381
|
}
|
|
356
382
|
return true;
|
|
357
|
-
}
|
|
358
|
-
|
|
383
|
+
}
|
|
384
|
+
function setProps(modelValue, step) {
|
|
359
385
|
if (modelValue === void 0) {
|
|
360
386
|
modelValue = props.modelValue;
|
|
361
387
|
}
|
|
@@ -379,43 +405,24 @@ var __sfc__ = defineComponent({
|
|
|
379
405
|
} else if (isNumber(modelValue)) {
|
|
380
406
|
thumbsProps[Thumbs.First].currentOffset = getPercent(modelValue) * unitWidth.value;
|
|
381
407
|
}
|
|
382
|
-
}
|
|
383
|
-
|
|
408
|
+
}
|
|
409
|
+
function reset() {
|
|
384
410
|
var resetValue = props.range ? [0, 0] : 0;
|
|
385
411
|
call(props['onUpdate:modelValue'], resetValue);
|
|
386
412
|
resetValidation();
|
|
387
|
-
}
|
|
388
|
-
var sliderProvider = {
|
|
389
|
-
reset,
|
|
390
|
-
validate,
|
|
391
|
-
resetValidation
|
|
392
|
-
};
|
|
393
|
-
call(bindForm, sliderProvider);
|
|
394
|
-
watch([() => props.modelValue, () => props.step], _ref => {
|
|
395
|
-
var [modelValue, step] = _ref;
|
|
396
|
-
if (!stepValidator() || !valueValidator() || isScroll.value) return;
|
|
397
|
-
setProps(modelValue, toNumber(step));
|
|
398
|
-
});
|
|
399
|
-
watch(maxDistance, () => setProps());
|
|
400
|
-
onSmartMounted(() => {
|
|
401
|
-
if (!stepValidator() || !valueValidator()) return;
|
|
402
|
-
maxDistance.value = sliderEl.value[isVertical.value ? 'offsetHeight' : 'offsetWidth'];
|
|
403
|
-
});
|
|
404
|
-
onBeforeUnmount(() => {
|
|
405
|
-
removeDocumentEvents();
|
|
406
|
-
});
|
|
413
|
+
}
|
|
407
414
|
return {
|
|
408
|
-
n,
|
|
409
|
-
classes,
|
|
410
415
|
Thumbs,
|
|
411
416
|
sliderEl,
|
|
412
417
|
getFillStyle,
|
|
413
418
|
isDisabled,
|
|
414
419
|
isVertical,
|
|
415
|
-
thumbStyle,
|
|
416
420
|
errorMessage,
|
|
417
421
|
thumbsProps,
|
|
418
422
|
thumbList,
|
|
423
|
+
n,
|
|
424
|
+
classes,
|
|
425
|
+
thumbStyle,
|
|
419
426
|
hover,
|
|
420
427
|
multiplySizeUnit,
|
|
421
428
|
toNumber,
|
package/es/snackbar/Snackbar.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { defineComponent } from 'vue';
|
|
|
3
3
|
import { createNamespace, useTeleport } from '../utils/components.mjs';
|
|
4
4
|
import { props } from './props.mjs';
|
|
5
5
|
var {
|
|
6
|
+
name,
|
|
6
7
|
n
|
|
7
8
|
} = createNamespace('snackbar');
|
|
8
9
|
import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, mergeProps as _mergeProps, withCtx as _withCtx, createVNode as _createVNode, Transition as _Transition, Teleport as _Teleport, openBlock as _openBlock, createBlock as _createBlock } from "vue";
|
|
@@ -29,7 +30,7 @@ function __render__(_ctx, _cache) {
|
|
|
29
30
|
}, 8 /* PROPS */, ["name", "onAfterEnter", "onAfterLeave"])], 8 /* PROPS */, ["to", "disabled"]);
|
|
30
31
|
}
|
|
31
32
|
var __sfc__ = defineComponent({
|
|
32
|
-
name
|
|
33
|
+
name,
|
|
33
34
|
components: {
|
|
34
35
|
VarSnackbarCore
|
|
35
36
|
},
|
|
@@ -39,8 +40,8 @@ var __sfc__ = defineComponent({
|
|
|
39
40
|
disabled
|
|
40
41
|
} = useTeleport();
|
|
41
42
|
return {
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
disabled,
|
|
44
|
+
n
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../../styles/common.css'
|
|
2
|
-
import '../SnackbarSfc.css'
|
|
3
2
|
import '../../styles/elevation.css'
|
|
4
3
|
import '../../loading/loading.css'
|
|
5
4
|
import '../../button/button.css'
|
|
6
5
|
import '../../icon/icon.css'
|
|
7
6
|
import '../snackbar.css'
|
|
8
7
|
import '../coreSfc.css'
|
|
8
|
+
import '../SnackbarSfc.css'
|
package/es/space/Space.mjs
CHANGED
|
@@ -9,17 +9,20 @@ import { computeMargin } from './margin.mjs';
|
|
|
9
9
|
|
|
10
10
|
var isInternalSize = size => ['mini', 'small', 'normal', 'large'].includes(size);
|
|
11
11
|
var {
|
|
12
|
+
name,
|
|
12
13
|
n,
|
|
13
14
|
classes
|
|
14
15
|
} = createNamespace('space');
|
|
16
|
+
function getSize(size, isInternalSize) {
|
|
17
|
+
return isInternalSize ? ["var(--space-size-" + size + "-y)", "var(--space-size-" + size + "-x)"] : isArray(size) ? size.map(toSizeUnit) : [toSizeUnit(size), toSizeUnit(size)];
|
|
18
|
+
}
|
|
15
19
|
export default defineComponent({
|
|
16
|
-
name
|
|
20
|
+
name,
|
|
17
21
|
props,
|
|
18
22
|
setup(props, _ref) {
|
|
19
23
|
var {
|
|
20
24
|
slots
|
|
21
25
|
} = _ref;
|
|
22
|
-
var getSize = (size, isInternalSize) => isInternalSize ? ["var(--space-size-" + size + "-y)", "var(--space-size-" + size + "-x)"] : isArray(size) ? size.map(toSizeUnit) : [toSizeUnit(size), toSizeUnit(size)];
|
|
23
26
|
return () => {
|
|
24
27
|
var _call;
|
|
25
28
|
var {
|
package/es/step/Step.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { useSteps } from './provide.mjs';
|
|
|
5
5
|
import { toNumber } from '@varlet/shared';
|
|
6
6
|
import { createNamespace } from '../utils/components.mjs';
|
|
7
7
|
var {
|
|
8
|
+
name,
|
|
8
9
|
n,
|
|
9
10
|
classes
|
|
10
11
|
} = createNamespace('step');
|
|
@@ -53,7 +54,7 @@ function __render__(_ctx, _cache) {
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
var __sfc__ = defineComponent({
|
|
56
|
-
name
|
|
57
|
+
name,
|
|
57
58
|
components: {
|
|
58
59
|
VarIcon
|
|
59
60
|
},
|
|
@@ -76,17 +77,19 @@ var __sfc__ = defineComponent({
|
|
|
76
77
|
var stepProvider = {
|
|
77
78
|
index
|
|
78
79
|
};
|
|
79
|
-
var click = () => clickStep(index.value);
|
|
80
80
|
bindSteps(stepProvider);
|
|
81
|
+
function click() {
|
|
82
|
+
return clickStep(index.value);
|
|
83
|
+
}
|
|
81
84
|
return {
|
|
82
|
-
n,
|
|
83
|
-
classes,
|
|
84
85
|
index,
|
|
85
86
|
isActive,
|
|
86
87
|
isCurrent,
|
|
87
88
|
direction,
|
|
88
89
|
activeColor,
|
|
89
90
|
inactiveColor,
|
|
91
|
+
n,
|
|
92
|
+
classes,
|
|
90
93
|
click
|
|
91
94
|
};
|
|
92
95
|
}
|
package/es/steps/Steps.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { useStep } from './provide.mjs';
|
|
|
3
3
|
import { props } from './props.mjs';
|
|
4
4
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
5
5
|
var {
|
|
6
|
+
name,
|
|
6
7
|
n
|
|
7
8
|
} = createNamespace('steps');
|
|
8
9
|
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
@@ -16,7 +17,7 @@ function __render__(_ctx, _cache) {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
var __sfc__ = defineComponent({
|
|
19
|
-
name
|
|
20
|
+
name,
|
|
20
21
|
props,
|
|
21
22
|
setup(props) {
|
|
22
23
|
var active = computed(() => props.active);
|
|
@@ -26,9 +27,6 @@ var __sfc__ = defineComponent({
|
|
|
26
27
|
var {
|
|
27
28
|
bindStep
|
|
28
29
|
} = useStep();
|
|
29
|
-
var clickStep = index => {
|
|
30
|
-
call(props.onClickStep, index);
|
|
31
|
-
};
|
|
32
30
|
var stepsProvider = {
|
|
33
31
|
active,
|
|
34
32
|
direction,
|
|
@@ -37,6 +35,9 @@ var __sfc__ = defineComponent({
|
|
|
37
35
|
clickStep
|
|
38
36
|
};
|
|
39
37
|
bindStep(stepsProvider);
|
|
38
|
+
function clickStep(index) {
|
|
39
|
+
call(props.onClickStep, index);
|
|
40
|
+
}
|
|
40
41
|
return {
|
|
41
42
|
n
|
|
42
43
|
};
|
package/es/sticky/Sticky.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { toNumber, raf, doubleRaf, getRect } from '@varlet/shared';
|
|
|
7
7
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
8
8
|
import { useEventListener, onSmartMounted, onWindowResize, onSmartUnmounted } from '@varlet/use';
|
|
9
9
|
var {
|
|
10
|
+
name,
|
|
10
11
|
n,
|
|
11
12
|
classes
|
|
12
13
|
} = createNamespace('sticky');
|
|
@@ -36,7 +37,7 @@ function __render__(_ctx, _cache) {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
var __sfc__ = defineComponent({
|
|
39
|
-
name
|
|
40
|
+
name,
|
|
40
41
|
props,
|
|
41
42
|
setup(props) {
|
|
42
43
|
var stickyEl = ref(null);
|
|
@@ -52,7 +53,12 @@ var __sfc__ = defineComponent({
|
|
|
52
53
|
var enableFixedMode = computed(() => !props.disabled && !props.cssMode && isFixed.value);
|
|
53
54
|
var offsetTop = computed(() => toPxNum(props.offsetTop));
|
|
54
55
|
var scroller;
|
|
55
|
-
|
|
56
|
+
watch(() => props.disabled, resize);
|
|
57
|
+
onSmartMounted(addScrollListener);
|
|
58
|
+
onSmartUnmounted(removeScrollListener);
|
|
59
|
+
onWindowResize(resize);
|
|
60
|
+
useEventListener(() => window, 'scroll', handleScroll);
|
|
61
|
+
function computeFixedParams() {
|
|
56
62
|
var {
|
|
57
63
|
cssMode,
|
|
58
64
|
disabled
|
|
@@ -94,8 +100,8 @@ var __sfc__ = defineComponent({
|
|
|
94
100
|
offsetTop: currentOffsetTop,
|
|
95
101
|
isFixed: false
|
|
96
102
|
};
|
|
97
|
-
}
|
|
98
|
-
|
|
103
|
+
}
|
|
104
|
+
function handleScroll() {
|
|
99
105
|
if (!scroller) {
|
|
100
106
|
return;
|
|
101
107
|
}
|
|
@@ -105,42 +111,36 @@ var __sfc__ = defineComponent({
|
|
|
105
111
|
if (fixedParams) {
|
|
106
112
|
call(props.onScroll, fixedParams.offsetTop, fixedParams.isFixed);
|
|
107
113
|
}
|
|
108
|
-
}
|
|
114
|
+
}
|
|
109
115
|
|
|
110
116
|
// expose
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
function resize() {
|
|
118
|
+
return _resize.apply(this, arguments);
|
|
119
|
+
}
|
|
120
|
+
function _resize() {
|
|
121
|
+
_resize = _asyncToGenerator(function* () {
|
|
113
122
|
isFixed.value = false;
|
|
114
123
|
yield raf();
|
|
115
124
|
computeFixedParams();
|
|
116
125
|
});
|
|
117
|
-
return
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
return _resize.apply(this, arguments);
|
|
127
|
+
}
|
|
128
|
+
function addScrollListener() {
|
|
129
|
+
return _addScrollListener.apply(this, arguments);
|
|
130
|
+
}
|
|
131
|
+
function _addScrollListener() {
|
|
132
|
+
_addScrollListener = _asyncToGenerator(function* () {
|
|
123
133
|
yield doubleRaf();
|
|
124
134
|
scroller = getParentScroller(stickyEl.value);
|
|
125
135
|
scroller !== window && scroller.addEventListener('scroll', handleScroll);
|
|
126
136
|
handleScroll();
|
|
127
137
|
});
|
|
128
|
-
return
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}();
|
|
132
|
-
var removeScrollListener = () => {
|
|
138
|
+
return _addScrollListener.apply(this, arguments);
|
|
139
|
+
}
|
|
140
|
+
function removeScrollListener() {
|
|
133
141
|
scroller !== window && scroller.removeEventListener('scroll', handleScroll);
|
|
134
|
-
}
|
|
135
|
-
watch(() => props.disabled, resize);
|
|
136
|
-
onSmartMounted(addScrollListener);
|
|
137
|
-
onSmartUnmounted(removeScrollListener);
|
|
138
|
-
onWindowResize(resize);
|
|
139
|
-
useEventListener(() => window, 'scroll', handleScroll);
|
|
142
|
+
}
|
|
140
143
|
return {
|
|
141
|
-
n,
|
|
142
|
-
classes,
|
|
143
|
-
resize,
|
|
144
144
|
stickyEl,
|
|
145
145
|
wrapperEl,
|
|
146
146
|
isFixed,
|
|
@@ -153,6 +153,9 @@ var __sfc__ = defineComponent({
|
|
|
153
153
|
fixedWrapperHeight,
|
|
154
154
|
enableCSSMode,
|
|
155
155
|
enableFixedMode,
|
|
156
|
+
n,
|
|
157
|
+
classes,
|
|
158
|
+
resize,
|
|
156
159
|
toNumber
|
|
157
160
|
};
|
|
158
161
|
}
|
|
@@ -3,10 +3,11 @@ import { formatStyleVars } from '../utils/elements.mjs';
|
|
|
3
3
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
4
4
|
import { props } from './props.mjs';
|
|
5
5
|
var {
|
|
6
|
+
name,
|
|
6
7
|
n
|
|
7
8
|
} = createNamespace('style-provider');
|
|
8
9
|
var __sfc__ = defineComponent({
|
|
9
|
-
name
|
|
10
|
+
name,
|
|
10
11
|
props,
|
|
11
12
|
setup(props, _ref) {
|
|
12
13
|
var {
|