@varlet/ui 2.11.3-alpha.1685455534947 → 2.11.3
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/field-decorator/FieldDecorator.mjs +7 -6
- package/es/image/Image.mjs +40 -33
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/pagination/pagination.css +1 -1
- package/es/picker/Picker.mjs +7 -23
- package/es/picker/picker.css +1 -1
- package/es/snackbar/core.mjs +5 -5
- package/es/snackbar/snackbar.css +1 -1
- package/es/style.css +1 -1
- package/es/swipe/Swipe.mjs +14 -14
- package/es/tabs/Tabs.mjs +2 -2
- package/es/themes/dark/picker.mjs +2 -0
- package/es/varlet.esm.js +5224 -5228
- package/highlight/web-types.en-US.json +7 -2
- package/highlight/web-types.zh-CN.json +7 -2
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +74 -78
- package/package.json +6 -6
- package/types/image.d.ts +5 -0
- package/umd/varlet.js +5 -5
package/es/swipe/Swipe.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { defineComponent, ref, computed, watch, onUnmounted, onDeactivated, onAc
|
|
|
6
6
|
import { useSwipeItems } from './provide.mjs';
|
|
7
7
|
import { doubleRaf, nextTickFrame } from '../utils/elements.mjs';
|
|
8
8
|
import { props } from './props.mjs';
|
|
9
|
-
import { isNumber, toNumber } from '@varlet/shared';
|
|
9
|
+
import { clamp, isNumber, toNumber } from '@varlet/shared';
|
|
10
10
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
11
11
|
import { useEventListener } from '@varlet/use';
|
|
12
12
|
var SWIPE_DELAY = 250;
|
|
@@ -158,20 +158,20 @@ var __sfc__ = defineComponent({
|
|
|
158
158
|
return swipeIndex;
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
var
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
var clampIndex = index => {
|
|
162
|
+
if (props.loop) {
|
|
163
|
+
if (index < 0) {
|
|
164
|
+
return length.value + index;
|
|
165
|
+
}
|
|
165
166
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
if (index >= length.value) {
|
|
168
|
+
return index - length.value;
|
|
169
|
+
}
|
|
169
170
|
|
|
170
|
-
|
|
171
|
-
return loop ? 0 : length.value - 1;
|
|
171
|
+
return index;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
return index;
|
|
174
|
+
return clamp(index, 0, length.value - 1);
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
var fixPosition = fn => {
|
|
@@ -199,7 +199,7 @@ var __sfc__ = defineComponent({
|
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
index.value =
|
|
202
|
+
index.value = clampIndex(toNumber(props.initialIndex));
|
|
203
203
|
initializedIndex = true;
|
|
204
204
|
};
|
|
205
205
|
|
|
@@ -337,7 +337,7 @@ var __sfc__ = defineComponent({
|
|
|
337
337
|
onChange
|
|
338
338
|
} = props;
|
|
339
339
|
var currentIndex = index.value;
|
|
340
|
-
index.value =
|
|
340
|
+
index.value = clampIndex(currentIndex + 1);
|
|
341
341
|
|
|
342
342
|
if ((options == null ? void 0 : options.event) !== false) {
|
|
343
343
|
call(onChange, index.value);
|
|
@@ -368,7 +368,7 @@ var __sfc__ = defineComponent({
|
|
|
368
368
|
onChange
|
|
369
369
|
} = props;
|
|
370
370
|
var currentIndex = index.value;
|
|
371
|
-
index.value =
|
|
371
|
+
index.value = clampIndex(currentIndex - 1);
|
|
372
372
|
|
|
373
373
|
if ((options == null ? void 0 : options.event) !== false) {
|
|
374
374
|
call(onChange, index.value);
|
package/es/tabs/Tabs.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import VarSticky from '../sticky/index.mjs';
|
|
|
6
6
|
import { defineComponent, watch, ref, computed, Transition, onActivated } from 'vue';
|
|
7
7
|
import { props } from './props.mjs';
|
|
8
8
|
import { useTabList } from './provide.mjs';
|
|
9
|
-
import { isNumber } from '@varlet/shared';
|
|
9
|
+
import { clamp, isNumber } from '@varlet/shared';
|
|
10
10
|
import { linear } from '../utils/shared.mjs';
|
|
11
11
|
import { toSizeUnit, scrollTo, doubleRaf } from '../utils/elements.mjs';
|
|
12
12
|
import { createNamespace, call, formatElevation } from '../utils/components.mjs';
|
|
@@ -131,7 +131,7 @@ var __sfc__ = defineComponent({
|
|
|
131
131
|
} = props;
|
|
132
132
|
|
|
133
133
|
if (isNumber(active)) {
|
|
134
|
-
var activeIndex = active
|
|
134
|
+
var activeIndex = clamp(active, 0, length.value - 1);
|
|
135
135
|
call(props['onUpdate:active'], activeIndex);
|
|
136
136
|
return matchIndex(activeIndex);
|
|
137
137
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
'--picker-background': '#1e1e1e',
|
|
3
3
|
'--picker-cancel-button-text-color': '#aaa',
|
|
4
|
+
'--picker-title-text-color': '#fff',
|
|
5
|
+
'--picker-option-text-color': '#fff',
|
|
4
6
|
'--picker-picked-border': '1px solid rgba(255, 255, 255, 0.12)',
|
|
5
7
|
'--picker-mask-background-image': 'linear-gradient(180deg, hsla(0, 0%, 12%, 0.9), hsla(0, 0%, 12%, 0.4)), linear-gradient(0deg, hsla(0, 0%, 12%, 0.9), hsla(0, 0%, 12%, 0.4))'
|
|
6
8
|
};
|