@varlet/ui 1.27.6 → 1.27.7
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/LICENCE +21 -0
- package/README.en-US.md +2 -1
- package/README.md +4 -2
- package/es/counter/counter.css +1 -1
- package/es/counter/counter.less +4 -0
- package/es/input/Input.js +5 -2
- package/es/input/props.js +4 -0
- package/es/loading/Loading.js +6 -1
- package/es/loading/loading.css +1 -1
- package/es/loading/loading.less +9 -1
- package/es/picker/picker.css +1 -1
- package/es/picker/picker.less +3 -0
- package/es/pull-refresh/PullRefresh.js +55 -22
- package/es/style.css +1 -1
- package/es/themes/dark/picker.js +2 -1
- package/es/utils/jest.js +5 -2
- package/es/varlet.esm.js +165 -102
- package/highlight/attributes.json +2 -2
- package/highlight/web-types.json +2 -2
- package/lib/counter/counter.css +1 -1
- package/lib/counter/counter.less +4 -0
- package/lib/input/Input.js +5 -2
- package/lib/input/props.js +4 -0
- package/lib/loading/Loading.js +6 -1
- package/lib/loading/loading.css +1 -1
- package/lib/loading/loading.less +9 -1
- package/lib/picker/picker.css +1 -1
- package/lib/picker/picker.less +3 -0
- package/lib/pull-refresh/PullRefresh.js +55 -22
- package/lib/snackbar/style/index.js +1 -1
- package/lib/snackbar/style/less.js +1 -1
- package/lib/style.css +1 -1
- package/lib/themes/dark/picker.js +2 -1
- package/lib/utils/jest.js +5 -2
- package/package.json +16 -15
- package/umd/varlet.js +4 -4
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
},
|
|
70
70
|
"var-back-top/bottom": {
|
|
71
71
|
"type": "string | number",
|
|
72
|
-
"description": "`BackTop`
|
|
72
|
+
"description": "`BackTop` 距离页面底部的距离 默认值:40"
|
|
73
73
|
},
|
|
74
74
|
"var-back-top/right": {
|
|
75
75
|
"type": "string | number",
|
|
76
|
-
"description": "`BackTop`
|
|
76
|
+
"description": "`BackTop` 距离页面右侧的距离 默认值:40"
|
|
77
77
|
},
|
|
78
78
|
"var-back-top/duration": {
|
|
79
79
|
"type": "number",
|
package/highlight/web-types.json
CHANGED
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
227
|
"name": "bottom",
|
|
228
|
-
"description": "`BackTop`
|
|
228
|
+
"description": "`BackTop` 距离页面底部的距离",
|
|
229
229
|
"default": "40",
|
|
230
230
|
"value": {
|
|
231
231
|
"type": "string | number",
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
},
|
|
235
235
|
{
|
|
236
236
|
"name": "right",
|
|
237
|
-
"description": "`BackTop`
|
|
237
|
+
"description": "`BackTop` 距离页面右侧的距离",
|
|
238
238
|
"default": "40",
|
|
239
239
|
"value": {
|
|
240
240
|
"type": "string | number",
|
package/lib/counter/counter.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --counter-padding: 0 4px; --counter-font-color: #fff; --counter-background: var(--color-primary); --counter-input-width: 28px; --counter-input-margin: 0 4px; --counter-input-font-size: 14px; --counter-button-size: 28px; --counter-button-icon-size: 100%; --counter-disabled-color: var(--color-text-disabled); --input-error-color: var(--color-danger);}.var-counter { display: inline-flex; flex-direction: column; align-items: flex-start;}.var-counter__controller { display: flex; align-items: center; color: var(--counter-font-color); border-radius: var(--counter-button-size); padding: var(--counter-padding); background: var(--counter-background); transition: background-color 0.25s;}.var-counter__decrement-button[var-counter-cover] { width: var(--counter-button-size); height: var(--counter-button-size); font-size: var(--counter-button-icon-size); border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-counter__input { width: var(--counter-input-width); font-size: var(--counter-input-font-size); outline: none; border: none; background: transparent; padding: 0; text-align: center; color: var(--counter-font-color); margin: var(--counter-input-margin);}.var-counter__input[disabled] { background: transparent;}.var-counter__increment-button[var-counter-cover] { width: var(--counter-button-size); height: var(--counter-button-size); font-size: var(--counter-button-icon-size); border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-counter--disabled { background: var(--counter-disabled-color);}.var-counter--hidden { opacity: 0;}.var-counter--error { background: var(--color-danger);}
|
|
1
|
+
:root { --counter-padding: 0 4px; --counter-font-color: #fff; --counter-background: var(--color-primary); --counter-input-width: 28px; --counter-input-margin: 0 4px; --counter-input-font-size: 14px; --counter-button-size: 28px; --counter-button-icon-size: 100%; --counter-disabled-color: var(--color-text-disabled); --input-error-color: var(--color-danger);}.var-counter { display: inline-flex; flex-direction: column; align-items: flex-start;}.var-counter__controller { display: flex; align-items: center; color: var(--counter-font-color); border-radius: var(--counter-button-size); padding: var(--counter-padding); background: var(--counter-background); transition: background-color 0.25s;}.var-counter__decrement-button[var-counter-cover] { width: var(--counter-button-size); height: var(--counter-button-size); font-size: var(--counter-button-icon-size); border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-user-select: none; user-select: none;}.var-counter__input { width: var(--counter-input-width); font-size: var(--counter-input-font-size); outline: none; border: none; background: transparent; padding: 0; text-align: center; color: var(--counter-font-color); margin: var(--counter-input-margin);}.var-counter__input[disabled] { background: transparent;}.var-counter__increment-button[var-counter-cover] { width: var(--counter-button-size); height: var(--counter-button-size); font-size: var(--counter-button-icon-size); border-radius: 50%; cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-user-select: none; user-select: none;}.var-counter--disabled { background: var(--counter-disabled-color);}.var-counter--hidden { opacity: 0;}.var-counter--error { background: var(--color-danger);}
|
package/lib/counter/counter.less
CHANGED
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
border-radius: 50%;
|
|
45
45
|
cursor: pointer;
|
|
46
46
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
47
|
+
-webkit-user-select: none; // for safari
|
|
48
|
+
user-select: none;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
&__input {
|
|
@@ -69,6 +71,8 @@
|
|
|
69
71
|
border-radius: 50%;
|
|
70
72
|
cursor: pointer;
|
|
71
73
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
74
|
+
-webkit-user-select: none; // for safari
|
|
75
|
+
user-select: none;
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
&--disabled {
|
package/lib/input/Input.js
CHANGED
|
@@ -248,6 +248,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
248
248
|
var {
|
|
249
249
|
value
|
|
250
250
|
} = e.target;
|
|
251
|
+
value = withTrim(value);
|
|
251
252
|
(0, _components.call)(props['onUpdate:modelValue'], value);
|
|
252
253
|
(0, _components.call)(props.onInput, value, e);
|
|
253
254
|
validateWithTrigger('onInput');
|
|
@@ -257,7 +258,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
257
258
|
var {
|
|
258
259
|
value
|
|
259
260
|
} = e.target;
|
|
260
|
-
(0, _components.call)(props.onChange, value, e);
|
|
261
|
+
(0, _components.call)(props.onChange, withTrim(value), e);
|
|
261
262
|
validateWithTrigger('onChange');
|
|
262
263
|
};
|
|
263
264
|
|
|
@@ -290,7 +291,9 @@ var _default = (0, _vue.defineComponent)({
|
|
|
290
291
|
|
|
291
292
|
(0, _components.call)(onClick, e);
|
|
292
293
|
validateWithTrigger('onClick');
|
|
293
|
-
};
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
var withTrim = value => props.modelModifiers.trim ? value.trim() : value; // expose
|
|
294
297
|
|
|
295
298
|
|
|
296
299
|
var reset = () => {
|
package/lib/input/props.js
CHANGED
package/lib/loading/Loading.js
CHANGED
|
@@ -38,7 +38,12 @@ function render(_ctx, _cache) {
|
|
|
38
38
|
}, [_ctx.$slots.default ? ((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
|
|
39
39
|
key: 0,
|
|
40
40
|
class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('content'), [_ctx.loading, _ctx.n('content--active')]))
|
|
41
|
-
}, [(0, _vue.renderSlot)(_ctx.$slots, "default")
|
|
41
|
+
}, [(0, _vue.renderSlot)(_ctx.$slots, "default"), _ctx.loading ? ((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: (0, _vue.normalizeClass)(_ctx.n('content-mask'))
|
|
44
|
+
}, null, 2
|
|
45
|
+
/* CLASS */
|
|
46
|
+
)) : (0, _vue.createCommentVNode)("v-if", true)], 2
|
|
42
47
|
/* CLASS */
|
|
43
48
|
)) : (0, _vue.createCommentVNode)("v-if", true), _ctx.isShow ? ((0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
|
|
44
49
|
key: 1,
|
package/lib/loading/loading.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --loading-opacity: 0.38; --loading-desc-margin: 8px 0 0;}.var-loading { position: relative;}.var-loading__content { transition: opacity 0.3s; opacity: 1;}.var-loading__content--active { opacity: var(--loading-opacity);
|
|
1
|
+
:root { --loading-opacity: 0.38; --loading-desc-margin: 8px 0 0;}.var-loading { position: relative;}.var-loading__content { position: relative; transition: opacity 0.3s; opacity: 1;}.var-loading__content--active { opacity: var(--loading-opacity);}.var-loading__content-mask { position: absolute; left: 0; right: 0; top: 0; bottom: 0;}.var-loading__body { display: flex; justify-content: center; align-items: center; height: 100%; flex-direction: column;}.var-loading__inside { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1;}.var-loading__description { color: currentColor; margin: var(--loading-desc-margin);}.var-loading__description--large { font-size: 16px;}.var-loading__description--normal { font-size: 14px;}.var-loading__description--small { font-size: 12px;}.var-loading__description--mini { font-size: 10px;}.var-loading__circle { display: flex;}.var-loading__circle-block { display: inline-block; animation: circle 1.8s linear infinite;}.var-loading__circle-block svg { display: block; width: 100%; height: 100%;}.var-loading__circle-block svg circle { animation: circular 1.5s ease-in-out infinite; stroke: currentColor; stroke-width: 3; stroke-linecap: round;}@keyframes circle { from { transform: rotate(0deg); } to { transform: rotate(360deg); }}@keyframes circular { 0% { stroke-dasharray: 1, 200; stroke-dashoffset: 0; } 50% { stroke-dasharray: 90, 150; stroke-dashoffset: -40; } 100% { stroke-dasharray: 90, 150; stroke-dashoffset: -120; }}.var-loading__wave { display: flex; align-items: center; justify-content: center;}.var-loading__wave--large { width: 64px; height: 18px;}.var-loading__wave--normal { width: 50px; height: 16px;}.var-loading__wave--small { width: 36px; height: 14px;}.var-loading__wave--mini { width: 22px; height: 12px;}.var-loading__wave-item { height: 100%; display: inline-block; animation: 1.2s ease-in-out infinite wave;}.var-loading__wave-item:nth-child(1) { animation-delay: -1.2s; margin-left: 0;}.var-loading__wave-item:nth-child(2) { animation-delay: -1.1s;}.var-loading__wave-item:nth-child(3) { animation-delay: -1s;}.var-loading__wave-item:nth-child(4) { animation-delay: -0.9s;}.var-loading__wave-item:nth-child(5) { animation-delay: -0.8s;}.var-loading__wave-item--large { width: 5px; margin-left: 5px;}.var-loading__wave-item--normal { width: 4px; margin-left: 4px;}.var-loading__wave-item--small { width: 3px; margin-left: 3px;}.var-loading__wave-item--mini { width: 2px; margin-left: 2px;}@keyframes wave { 0%, 40%, 100% { transform: scaleY(0.4); } 20% { transform: scaleY(1); }}.var-loading__cube { display: flex; align-items: center;}.var-loading__cube--large { width: 64px; height: 18px;}.var-loading__cube--normal { width: 50px; height: 16px;}.var-loading__cube--small { width: 36px; height: 14px;}.var-loading__cube--mini { width: 22px; height: 12px;}.var-loading__cube-item { display: inline-block; transform-origin: right bottom; animation: 1.5s ease infinite cube;}.var-loading__cube-item:nth-child(1) { animation-delay: 0.2s; margin-left: 0;}.var-loading__cube-item:nth-child(2) { animation-delay: 0.4s;}.var-loading__cube-item:nth-child(3) { animation-delay: 0.6s;}.var-loading__cube-item:nth-child(4) { animation-delay: 0.8s;}.var-loading__cube-item--large { height: 10px; width: 10px; margin-left: 5px;}.var-loading__cube-item--normal { height: 8px; width: 8px; margin-left: 4px;}.var-loading__cube-item--small { height: 6px; width: 6px; margin-left: 3px;}.var-loading__cube-item--mini { height: 4px; width: 4px; margin-left: 2px;}@keyframes cube { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: rotate(90deg) scale(0.3); }}.var-loading__rect { display: flex; flex-wrap: nowrap; justify-content: center; align-items: center;}.var-loading__rect--large { width: 64px; height: 18px;}.var-loading__rect--normal { width: 50px; height: 16px;}.var-loading__rect--small { width: 36px; height: 14px;}.var-loading__rect--mini { width: 22px; height: 12px;}.var-loading__rect-item { animation: 2s ease-in-out infinite rect;}.var-loading__rect-item:nth-child(1) { animation-delay: 1.75s;}.var-loading__rect-item:nth-child(2) { animation-delay: 1.5s;}.var-loading__rect-item:nth-child(3) { animation-delay: 1.25s;}.var-loading__rect-item:nth-child(4) { animation-delay: 1s;}.var-loading__rect-item:nth-child(5) { animation-delay: 0.75s;}.var-loading__rect-item:nth-child(6) { animation-delay: 0.5s;}.var-loading__rect-item:nth-child(7) { animation-delay: 0.25s;}.var-loading__rect-item:nth-child(8) { animation-delay: 0s;}.var-loading__rect-item--large { height: 100%; width: 8px;}.var-loading__rect-item--normal { height: 90%; width: 6.4px;}.var-loading__rect-item--small { height: 80%; width: 4.8px;}.var-loading__rect-item--mini { height: 70%; width: 3.2px;}@keyframes rect { 0% { opacity: 0.3; } 25% { opacity: 1; } 50% { opacity: 0.3; } 65% { opacity: 1; } 100% { opacity: 0.3; }}.var-loading__disappear { display: flex; justify-content: space-around; align-items: center; flex-flow: nowrap;}.var-loading__disappear--large { width: 64px; height: 18px;}.var-loading__disappear--normal { width: 50px; height: 16px;}.var-loading__disappear--small { width: 36px; height: 14px;}.var-loading__disappear--mini { width: 22px; height: 12px;}.var-loading__disappear-item { border-radius: 50%; animation: 0.5s ease-in-out infinite alternate disappear;}.var-loading__disappear-item:nth-child(1) { animation-delay: -0.4s;}.var-loading__disappear-item:nth-child(2) { animation-delay: -0.2s;}.var-loading__disappear-item:nth-child(3) { animation-delay: 0s;}.var-loading__disappear-item--large { height: 15px; width: 15px;}.var-loading__disappear-item--normal { height: 12px; width: 12px;}.var-loading__disappear-item--small { height: 9px; width: 9px;}.var-loading__disappear-item--mini { height: 6px; width: 6px;}@keyframes disappear { 0% { opacity: 1; } 100% { opacity: 0; }}
|
package/lib/loading/loading.less
CHANGED
|
@@ -23,12 +23,20 @@
|
|
|
23
23
|
position: relative;
|
|
24
24
|
|
|
25
25
|
&__content {
|
|
26
|
+
position: relative;
|
|
26
27
|
transition: opacity 0.3s;
|
|
27
28
|
opacity: 1;
|
|
28
29
|
|
|
29
30
|
&--active {
|
|
30
31
|
opacity: var(--loading-opacity);
|
|
31
|
-
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&-mask {
|
|
35
|
+
position: absolute;
|
|
36
|
+
left: 0;
|
|
37
|
+
right: 0;
|
|
38
|
+
top: 0;
|
|
39
|
+
bottom: 0;
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
42
|
|
package/lib/picker/picker.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --picker-background: #fff; --picker-toolbar-height: 44px; --picker-confirm-button-text-color: var(--color-primary); --picker-cancel-button-text-color: #888; --picker-picked-border: 1px solid rgba(0, 0, 0, 0.12); --picker-title-font-size: 16px; --picker-toolbar-padding: 0 4px; --picker-mask-background-image: linear-gradient(180deg, hsla(0, 0%, 100%, 0.9), hsla(0, 0%, 100%, 0.4)), linear-gradient(0deg, hsla(0, 0%, 100%, 0.9), hsla(0, 0%, 100%, 0.4));}.var-picker { width: 100%; background: var(--picker-background); user-select: none; transition: 0.25s background-color;}.var-picker__popup[var-picker-cover] { width: 100%;}.var-picker__columns { position: relative; display: flex; width: 100%; cursor: grab;}.var-picker__column { flex: 1; overflow: hidden;}.var-picker__text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}.var-picker__scroller { width: 100%; transition-timing-function: cubic-bezier(0.23, 1, 0.68, 1);}.var-picker__option { display: flex; justify-content: center; align-items: center; width: 100%; padding: 0 4px;}.var-picker__picked { position: absolute; z-index: 2; pointer-events: none; width: 100%; left: 0; border-top: var(--picker-picked-border); border-bottom: var(--picker-picked-border); transition: 0.25s border;}.var-picker__mask { position: absolute; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%;}.var-picker__toolbar { display: flex; justify-content: space-between; align-items: center; width: 100%; height: var(--picker-toolbar-height); padding: var(--picker-toolbar-padding);}.var-picker__confirm-button[var-picker-cover] { color: var(--picker-confirm-button-text-color);}.var-picker__cancel-button[var-picker-cover] { color: var(--picker-cancel-button-text-color);}.var-picker__title { font-size: var(--picker-title-font-size);}
|
|
1
|
+
:root { --picker-background: #fff; --picker-toolbar-height: 44px; --picker-confirm-button-text-color: var(--color-primary); --picker-cancel-button-text-color: #888; --picker-picked-border: 1px solid rgba(0, 0, 0, 0.12); --picker-title-font-size: 16px; --picker-toolbar-padding: 0 4px; --picker-mask-background-image: linear-gradient(180deg, hsla(0, 0%, 100%, 0.9), hsla(0, 0%, 100%, 0.4)), linear-gradient(0deg, hsla(0, 0%, 100%, 0.9), hsla(0, 0%, 100%, 0.4));}.var-picker { width: 100%; background: var(--picker-background); user-select: none; transition: 0.25s background-color;}.var-picker__popup[var-picker-cover] { width: 100%;}.var-picker__columns { position: relative; display: flex; width: 100%; cursor: grab;}.var-picker__column { flex: 1; overflow: hidden;}.var-picker__text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}.var-picker__scroller { width: 100%; transition-timing-function: cubic-bezier(0.23, 1, 0.68, 1);}.var-picker__option { display: flex; justify-content: center; align-items: center; width: 100%; padding: 0 4px;}.var-picker__picked { position: absolute; z-index: 2; pointer-events: none; width: 100%; left: 0; border-top: var(--picker-picked-border); border-bottom: var(--picker-picked-border); transition: 0.25s border;}.var-picker__mask { position: absolute; pointer-events: none; top: 0; left: 0; width: 100%; height: 100%; background-image: var(--picker-mask-background-image); background-repeat: no-repeat; background-position: top, bottom;}.var-picker__toolbar { display: flex; justify-content: space-between; align-items: center; width: 100%; height: var(--picker-toolbar-height); padding: var(--picker-toolbar-padding);}.var-picker__confirm-button[var-picker-cover] { color: var(--picker-confirm-button-text-color);}.var-picker__cancel-button[var-picker-cover] { color: var(--picker-cancel-button-text-color);}.var-picker__title { font-size: var(--picker-title-font-size);}
|
package/lib/picker/picker.less
CHANGED
|
@@ -18,13 +18,17 @@ var _components = require("../utils/components");
|
|
|
18
18
|
|
|
19
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
20
|
|
|
21
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
22
|
+
|
|
23
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
24
|
+
|
|
21
25
|
var {
|
|
22
26
|
n,
|
|
23
27
|
classes
|
|
24
28
|
} = (0, _components.createNamespace)('pull-refresh');
|
|
25
29
|
var MAX_DISTANCE = 100;
|
|
26
30
|
var CONTROL_POSITION = -50;
|
|
27
|
-
var
|
|
31
|
+
var ICON_TRANSITION = 150;
|
|
28
32
|
|
|
29
33
|
function render(_ctx, _cache) {
|
|
30
34
|
var _component_var_icon = (0, _vue.resolveComponent)("var-icon");
|
|
@@ -49,12 +53,12 @@ function render(_ctx, _cache) {
|
|
|
49
53
|
style: (0, _vue.normalizeStyle)(_ctx.controlStyle)
|
|
50
54
|
}, [(0, _vue.createVNode)(_component_var_icon, {
|
|
51
55
|
name: _ctx.iconName,
|
|
52
|
-
transition:
|
|
53
|
-
class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('icon'), [_ctx.refreshStatus === 'loading', _ctx.n('animation')])),
|
|
56
|
+
transition: _ctx.ICON_TRANSITION,
|
|
57
|
+
class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('icon'), [_ctx.refreshStatus === 'loading' && _ctx.iconHasChanged, _ctx.n('animation')])),
|
|
54
58
|
"var-pull-refresh-cover": ""
|
|
55
59
|
}, null, 8
|
|
56
60
|
/* PROPS */
|
|
57
|
-
, ["name", "class"])], 6
|
|
61
|
+
, ["name", "transition", "class"])], 6
|
|
58
62
|
/* CLASS, STYLE */
|
|
59
63
|
), (0, _vue.renderSlot)(_ctx.$slots, "default")], 34
|
|
60
64
|
/* CLASS, HYDRATE_EVENTS */
|
|
@@ -70,12 +74,16 @@ var _default = (0, _vue.defineComponent)({
|
|
|
70
74
|
props: _props.props,
|
|
71
75
|
|
|
72
76
|
setup(props) {
|
|
77
|
+
var scroller;
|
|
78
|
+
var changing;
|
|
73
79
|
var freshNode = (0, _vue.ref)(null);
|
|
74
80
|
var startPosition = (0, _vue.ref)(0);
|
|
75
81
|
var distance = (0, _vue.ref)(CONTROL_POSITION);
|
|
76
82
|
var iconName = (0, _vue.ref)('arrow-down');
|
|
77
83
|
var refreshStatus = (0, _vue.ref)('default');
|
|
78
|
-
var isEnd = (0, _vue.ref)(false);
|
|
84
|
+
var isEnd = (0, _vue.ref)(false); // https://github.com/varletjs/varlet/issues/509
|
|
85
|
+
|
|
86
|
+
var iconHasChanged = (0, _vue.ref)(true);
|
|
79
87
|
var isTouchable = (0, _vue.computed)(() => refreshStatus.value !== 'loading' && refreshStatus.value !== 'success' && !props.disabled);
|
|
80
88
|
var controlStyle = (0, _vue.computed)(() => ({
|
|
81
89
|
transform: "translate3d(0px, " + distance.value + "px, 0px) translate(-50%, 0)",
|
|
@@ -85,6 +93,15 @@ var _default = (0, _vue.defineComponent)({
|
|
|
85
93
|
}));
|
|
86
94
|
var isSuccess = (0, _vue.computed)(() => refreshStatus.value === 'success');
|
|
87
95
|
|
|
96
|
+
var changeIcon = () => {
|
|
97
|
+
return new Promise(resolve => {
|
|
98
|
+
window.setTimeout(() => {
|
|
99
|
+
iconHasChanged.value = true;
|
|
100
|
+
resolve();
|
|
101
|
+
}, ICON_TRANSITION);
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
88
105
|
var touchStart = event => {
|
|
89
106
|
if (!isTouchable.value) return;
|
|
90
107
|
refreshStatus.value = 'pulling';
|
|
@@ -97,30 +114,44 @@ var _default = (0, _vue.defineComponent)({
|
|
|
97
114
|
if (scrollTop === 0 && distance.value > CONTROL_POSITION) event.cancelable && event.preventDefault();
|
|
98
115
|
var moveDistance = (event.touches[0].clientY - startPosition.value) / 2 + CONTROL_POSITION;
|
|
99
116
|
distance.value = moveDistance >= MAX_DISTANCE ? MAX_DISTANCE : moveDistance;
|
|
100
|
-
iconName.value = distance.value >= MAX_DISTANCE * 0.2 ? 'refresh' : 'arrow-down';
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
var touchEnd = () => {
|
|
104
|
-
if (!isTouchable.value) return;
|
|
105
|
-
isEnd.value = true;
|
|
106
117
|
|
|
107
118
|
if (distance.value >= MAX_DISTANCE * 0.2) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
distance.value = MAX_DISTANCE * 0.3;
|
|
112
|
-
(_props$onUpdateModel = props['onUpdate:modelValue']) == null ? void 0 : _props$onUpdateModel.call(props, true);
|
|
113
|
-
props.onRefresh == null ? void 0 : props.onRefresh();
|
|
119
|
+
iconHasChanged.value = false;
|
|
120
|
+
iconName.value = 'refresh';
|
|
121
|
+
changing = changeIcon();
|
|
114
122
|
} else {
|
|
115
|
-
refreshStatus.value = 'loosing';
|
|
116
123
|
iconName.value = 'arrow-down';
|
|
117
|
-
distance.value = CONTROL_POSITION;
|
|
118
|
-
setTimeout(() => {
|
|
119
|
-
isEnd.value = false;
|
|
120
|
-
}, (0, _shared.toNumber)(props.animationDuration));
|
|
121
124
|
}
|
|
122
125
|
};
|
|
123
126
|
|
|
127
|
+
var touchEnd = /*#__PURE__*/function () {
|
|
128
|
+
var _ref = _asyncToGenerator(function* () {
|
|
129
|
+
if (!isTouchable.value) return;
|
|
130
|
+
isEnd.value = true;
|
|
131
|
+
|
|
132
|
+
if (distance.value >= MAX_DISTANCE * 0.2) {
|
|
133
|
+
var _props$onUpdateModel;
|
|
134
|
+
|
|
135
|
+
yield changing;
|
|
136
|
+
refreshStatus.value = 'loading';
|
|
137
|
+
distance.value = MAX_DISTANCE * 0.3;
|
|
138
|
+
(_props$onUpdateModel = props['onUpdate:modelValue']) == null ? void 0 : _props$onUpdateModel.call(props, true);
|
|
139
|
+
props.onRefresh == null ? void 0 : props.onRefresh();
|
|
140
|
+
} else {
|
|
141
|
+
refreshStatus.value = 'loosing';
|
|
142
|
+
iconName.value = 'arrow-down';
|
|
143
|
+
distance.value = CONTROL_POSITION;
|
|
144
|
+
setTimeout(() => {
|
|
145
|
+
isEnd.value = false;
|
|
146
|
+
}, (0, _shared.toNumber)(props.animationDuration));
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
return function touchEnd() {
|
|
151
|
+
return _ref.apply(this, arguments);
|
|
152
|
+
};
|
|
153
|
+
}();
|
|
154
|
+
|
|
124
155
|
var reset = () => {
|
|
125
156
|
setTimeout(() => {
|
|
126
157
|
refreshStatus.value = 'default';
|
|
@@ -146,6 +177,8 @@ var _default = (0, _vue.defineComponent)({
|
|
|
146
177
|
return {
|
|
147
178
|
n,
|
|
148
179
|
classes,
|
|
180
|
+
iconHasChanged,
|
|
181
|
+
ICON_TRANSITION,
|
|
149
182
|
refreshStatus,
|
|
150
183
|
freshNode,
|
|
151
184
|
touchStart,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require('../../styles/common.css')
|
|
2
|
-
require('../SnackbarSfc.css')
|
|
3
2
|
require('../../styles/elevation.css')
|
|
4
3
|
require('../../loading/loading.css')
|
|
5
4
|
require('../../button/button.css')
|
|
6
5
|
require('../../icon/icon.css')
|
|
7
6
|
require('../snackbar.css')
|
|
8
7
|
require('../coreSfc.css')
|
|
8
|
+
require('../SnackbarSfc.css')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require('../../styles/common.less')
|
|
2
|
-
require('../SnackbarSfc.less')
|
|
3
2
|
require('../../styles/elevation.less')
|
|
4
3
|
require('../../loading/loading.less')
|
|
5
4
|
require('../../button/button.less')
|
|
6
5
|
require('../../icon/icon.less')
|
|
7
6
|
require('../snackbar.less')
|
|
8
7
|
require('../coreSfc.less')
|
|
8
|
+
require('../SnackbarSfc.less')
|