@varlet/ui 1.25.0 → 1.25.1-alpha.1642669197501
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/collapse/Collapse.js +2 -2
- package/es/index-bar/IndexBar.js +13 -8
- package/es/snackbar/style/index.js +1 -1
- package/es/snackbar/style/less.js +1 -1
- package/es/sticky/Sticky.js +18 -7
- package/es/utils/shared.js +0 -1
- package/highlight/web-types.json +1 -1
- package/lib/collapse/Collapse.js +2 -2
- package/lib/index-bar/IndexBar.js +11 -6
- package/lib/snackbar/style/index.js +1 -1
- package/lib/snackbar/style/less.js +1 -1
- package/lib/sticky/Sticky.js +17 -6
- package/lib/utils/shared.js +1 -5
- package/package.json +4 -4
- package/types/collapse.d.ts +1 -1
- package/umd/varlet.js +3 -3
package/es/collapse/Collapse.js
CHANGED
|
@@ -41,9 +41,9 @@ export default defineComponent({
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
var getValue = (value, isExpand) => {
|
|
44
|
-
if (!checkValue()) return;
|
|
44
|
+
if (!checkValue()) return null;
|
|
45
45
|
if (isExpand) return props.accordion ? value : [...props.modelValue, value];
|
|
46
|
-
return props.accordion ?
|
|
46
|
+
return props.accordion ? null : props.modelValue.filter(name => name !== value);
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
var updateItem = (value, isExpand) => {
|
package/es/index-bar/IndexBar.js
CHANGED
|
@@ -2,9 +2,9 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
2
2
|
|
|
3
3
|
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); }); }; }
|
|
4
4
|
|
|
5
|
-
import { computed, defineComponent,
|
|
5
|
+
import { computed, defineComponent, ref, watch, onMounted, onBeforeUnmount } from 'vue';
|
|
6
6
|
import { easeInOutCubic, isPlainObject, toNumber } from '../utils/shared';
|
|
7
|
-
import { getParentScroller, getScrollLeft, nextTickFrame, requestAnimationFrame, scrollTo as varScrollTo } from '../utils/elements';
|
|
7
|
+
import { doubleRaf, getParentScroller, getScrollLeft, nextTickFrame, requestAnimationFrame, scrollTo as varScrollTo } from '../utils/elements';
|
|
8
8
|
import { useIndexAnchors } from './provide';
|
|
9
9
|
import { props } from './props';
|
|
10
10
|
import { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
@@ -107,6 +107,9 @@ export default defineComponent({
|
|
|
107
107
|
|
|
108
108
|
var anchorClick = /*#__PURE__*/function () {
|
|
109
109
|
var _ref = _asyncToGenerator(function* (anchorName, manualCall) {
|
|
110
|
+
var {
|
|
111
|
+
offsetTop
|
|
112
|
+
} = barEl.value;
|
|
110
113
|
if (manualCall) props.onClick == null ? void 0 : props.onClick(anchorName);
|
|
111
114
|
if (anchorName === active.value) return;
|
|
112
115
|
var indexAnchor = indexAnchors.find(_ref2 => {
|
|
@@ -116,7 +119,7 @@ export default defineComponent({
|
|
|
116
119
|
return anchorName === name.value;
|
|
117
120
|
});
|
|
118
121
|
if (!indexAnchor) return;
|
|
119
|
-
var top = indexAnchor.ownTop.value;
|
|
122
|
+
var top = indexAnchor.ownTop.value - stickyOffsetTop.value + offsetTop;
|
|
120
123
|
var left = getScrollLeft(scrollEl.value);
|
|
121
124
|
clickedName.value = anchorName;
|
|
122
125
|
emitEvent(anchorName);
|
|
@@ -141,23 +144,25 @@ export default defineComponent({
|
|
|
141
144
|
requestAnimationFrame(() => anchorClick(index, true));
|
|
142
145
|
};
|
|
143
146
|
|
|
144
|
-
watch(() => length.value, (
|
|
145
|
-
|
|
147
|
+
watch(() => length.value, /*#__PURE__*/_asyncToGenerator(function* () {
|
|
148
|
+
yield doubleRaf();
|
|
149
|
+
indexAnchors.forEach(_ref4 => {
|
|
146
150
|
var {
|
|
147
151
|
name,
|
|
148
152
|
setOwnTop
|
|
149
|
-
} =
|
|
153
|
+
} = _ref4;
|
|
150
154
|
if (name.value) anchorNameList.value.push(name.value);
|
|
151
155
|
setOwnTop();
|
|
152
156
|
});
|
|
153
157
|
}));
|
|
154
|
-
onMounted(()
|
|
158
|
+
onMounted( /*#__PURE__*/_asyncToGenerator(function* () {
|
|
155
159
|
var _scroller$value;
|
|
156
160
|
|
|
161
|
+
yield doubleRaf();
|
|
157
162
|
scroller.value = getParentScroller(barEl.value);
|
|
158
163
|
scrollEl.value = scroller.value === window ? scroller.value.document.documentElement : scroller.value;
|
|
159
164
|
(_scroller$value = scroller.value) == null ? void 0 : _scroller$value.addEventListener('scroll', handleScroll);
|
|
160
|
-
});
|
|
165
|
+
}));
|
|
161
166
|
onBeforeUnmount(() => {
|
|
162
167
|
var _scroller$value2;
|
|
163
168
|
|
|
@@ -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'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../../styles/common.less'
|
|
2
|
-
import '../SnackbarSfc.less'
|
|
3
2
|
import '../../styles/elevation.less'
|
|
4
3
|
import '../../loading/loading.less'
|
|
5
4
|
import '../../button/button.less'
|
|
6
5
|
import '../../icon/icon.less'
|
|
7
6
|
import '../snackbar.less'
|
|
8
7
|
import '../coreSfc.less'
|
|
8
|
+
import '../SnackbarSfc.less'
|
package/es/sticky/Sticky.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
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); } }
|
|
2
|
+
|
|
3
|
+
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); }); }; }
|
|
4
|
+
|
|
1
5
|
import { defineComponent, ref, onMounted, onUnmounted, onActivated, onDeactivated, computed, watch } from 'vue';
|
|
2
6
|
import { props } from './props';
|
|
3
|
-
import { getParentScroller, toPxNum } from '../utils/elements';
|
|
7
|
+
import { doubleRaf, getParentScroller, toPxNum } from '../utils/elements';
|
|
4
8
|
import { toNumber } from '../utils/shared';
|
|
5
9
|
import { renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
6
10
|
export function render(_ctx, _cache) {
|
|
@@ -96,12 +100,19 @@ export default defineComponent({
|
|
|
96
100
|
}
|
|
97
101
|
};
|
|
98
102
|
|
|
99
|
-
var addScrollListener = ()
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
var addScrollListener = /*#__PURE__*/function () {
|
|
104
|
+
var _ref = _asyncToGenerator(function* () {
|
|
105
|
+
yield doubleRaf();
|
|
106
|
+
scroller = getParentScroller(stickyEl.value);
|
|
107
|
+
scroller !== window && scroller.addEventListener('scroll', handleScroll);
|
|
108
|
+
window.addEventListener('scroll', handleScroll);
|
|
109
|
+
handleScroll();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
return function addScrollListener() {
|
|
113
|
+
return _ref.apply(this, arguments);
|
|
114
|
+
};
|
|
115
|
+
}();
|
|
105
116
|
|
|
106
117
|
var removeScrollListener = () => {
|
|
107
118
|
scroller !== window && scroller.removeEventListener('scroll', handleScroll);
|
package/es/utils/shared.js
CHANGED
|
@@ -29,7 +29,6 @@ export var isBool = val => typeof val === 'boolean';
|
|
|
29
29
|
export var isNumber = val => typeof val === 'number';
|
|
30
30
|
export var isPlainObject = val => Object.prototype.toString.call(val) === '[object Object]';
|
|
31
31
|
export var isArray = val => Array.isArray(val);
|
|
32
|
-
export var isPromise = val => val instanceof Promise;
|
|
33
32
|
export var isURL = val => {
|
|
34
33
|
if (!val) {
|
|
35
34
|
return false;
|
package/highlight/web-types.json
CHANGED
package/lib/collapse/Collapse.js
CHANGED
|
@@ -51,9 +51,9 @@ var _default = (0, _vue.defineComponent)({
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
var getValue = (value, isExpand) => {
|
|
54
|
-
if (!checkValue()) return;
|
|
54
|
+
if (!checkValue()) return null;
|
|
55
55
|
if (isExpand) return props.accordion ? value : [...props.modelValue, value];
|
|
56
|
-
return props.accordion ?
|
|
56
|
+
return props.accordion ? null : props.modelValue.filter(name => name !== value);
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
var updateItem = (value, isExpand) => {
|
|
@@ -118,6 +118,9 @@ var _default = (0, _vue.defineComponent)({
|
|
|
118
118
|
|
|
119
119
|
var anchorClick = /*#__PURE__*/function () {
|
|
120
120
|
var _ref = _asyncToGenerator(function* (anchorName, manualCall) {
|
|
121
|
+
var {
|
|
122
|
+
offsetTop
|
|
123
|
+
} = barEl.value;
|
|
121
124
|
if (manualCall) props.onClick == null ? void 0 : props.onClick(anchorName);
|
|
122
125
|
if (anchorName === active.value) return;
|
|
123
126
|
var indexAnchor = indexAnchors.find(_ref2 => {
|
|
@@ -127,7 +130,7 @@ var _default = (0, _vue.defineComponent)({
|
|
|
127
130
|
return anchorName === name.value;
|
|
128
131
|
});
|
|
129
132
|
if (!indexAnchor) return;
|
|
130
|
-
var top = indexAnchor.ownTop.value;
|
|
133
|
+
var top = indexAnchor.ownTop.value - stickyOffsetTop.value + offsetTop;
|
|
131
134
|
var left = (0, _elements.getScrollLeft)(scrollEl.value);
|
|
132
135
|
clickedName.value = anchorName;
|
|
133
136
|
emitEvent(anchorName);
|
|
@@ -152,23 +155,25 @@ var _default = (0, _vue.defineComponent)({
|
|
|
152
155
|
(0, _elements.requestAnimationFrame)(() => anchorClick(index, true));
|
|
153
156
|
};
|
|
154
157
|
|
|
155
|
-
(0, _vue.watch)(() => length.value, (
|
|
156
|
-
|
|
158
|
+
(0, _vue.watch)(() => length.value, /*#__PURE__*/_asyncToGenerator(function* () {
|
|
159
|
+
yield (0, _elements.doubleRaf)();
|
|
160
|
+
indexAnchors.forEach(_ref4 => {
|
|
157
161
|
var {
|
|
158
162
|
name,
|
|
159
163
|
setOwnTop
|
|
160
|
-
} =
|
|
164
|
+
} = _ref4;
|
|
161
165
|
if (name.value) anchorNameList.value.push(name.value);
|
|
162
166
|
setOwnTop();
|
|
163
167
|
});
|
|
164
168
|
}));
|
|
165
|
-
(0, _vue.onMounted)(()
|
|
169
|
+
(0, _vue.onMounted)( /*#__PURE__*/_asyncToGenerator(function* () {
|
|
166
170
|
var _scroller$value;
|
|
167
171
|
|
|
172
|
+
yield (0, _elements.doubleRaf)();
|
|
168
173
|
scroller.value = (0, _elements.getParentScroller)(barEl.value);
|
|
169
174
|
scrollEl.value = scroller.value === window ? scroller.value.document.documentElement : scroller.value;
|
|
170
175
|
(_scroller$value = scroller.value) == null ? void 0 : _scroller$value.addEventListener('scroll', handleScroll);
|
|
171
|
-
});
|
|
176
|
+
}));
|
|
172
177
|
(0, _vue.onBeforeUnmount)(() => {
|
|
173
178
|
var _scroller$value2;
|
|
174
179
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require('../../styles/common.css')
|
|
2
|
+
require('../SnackbarSfc.css')
|
|
2
3
|
require('../../styles/elevation.css')
|
|
3
4
|
require('../../loading/loading.css')
|
|
4
5
|
require('../../button/button.css')
|
|
5
6
|
require('../../icon/icon.css')
|
|
6
7
|
require('../snackbar.css')
|
|
7
8
|
require('../coreSfc.css')
|
|
8
|
-
require('../SnackbarSfc.css')
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require('../../styles/common.less')
|
|
2
|
+
require('../SnackbarSfc.less')
|
|
2
3
|
require('../../styles/elevation.less')
|
|
3
4
|
require('../../loading/loading.less')
|
|
4
5
|
require('../../button/button.less')
|
|
5
6
|
require('../../icon/icon.less')
|
|
6
7
|
require('../snackbar.less')
|
|
7
8
|
require('../coreSfc.less')
|
|
8
|
-
require('../SnackbarSfc.less')
|
package/lib/sticky/Sticky.js
CHANGED
|
@@ -12,6 +12,10 @@ var _elements = require("../utils/elements");
|
|
|
12
12
|
|
|
13
13
|
var _shared = require("../utils/shared");
|
|
14
14
|
|
|
15
|
+
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); } }
|
|
16
|
+
|
|
17
|
+
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); }); }; }
|
|
18
|
+
|
|
15
19
|
function render(_ctx, _cache) {
|
|
16
20
|
return (0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
|
|
17
21
|
class: (0, _vue.normalizeClass)(["var-sticky", [_ctx.enableCSSMode ? 'var-sticky--css-mode' : null]]),
|
|
@@ -106,12 +110,19 @@ var _default = (0, _vue.defineComponent)({
|
|
|
106
110
|
}
|
|
107
111
|
};
|
|
108
112
|
|
|
109
|
-
var addScrollListener = ()
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
var addScrollListener = /*#__PURE__*/function () {
|
|
114
|
+
var _ref = _asyncToGenerator(function* () {
|
|
115
|
+
yield (0, _elements.doubleRaf)();
|
|
116
|
+
scroller = (0, _elements.getParentScroller)(stickyEl.value);
|
|
117
|
+
scroller !== window && scroller.addEventListener('scroll', handleScroll);
|
|
118
|
+
window.addEventListener('scroll', handleScroll);
|
|
119
|
+
handleScroll();
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
return function addScrollListener() {
|
|
123
|
+
return _ref.apply(this, arguments);
|
|
124
|
+
};
|
|
125
|
+
}();
|
|
115
126
|
|
|
116
127
|
var removeScrollListener = () => {
|
|
117
128
|
scroller !== window && scroller.removeEventListener('scroll', handleScroll);
|
package/lib/utils/shared.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.isURL = exports.isString = exports.
|
|
4
|
+
exports.isURL = exports.isString = exports.isPlainObject = exports.isNumber = exports.isHTMLSupportVideo = exports.isHTMLSupportImage = exports.isEmpty = exports.isBool = exports.isArray = exports.inBrowser = exports.easeInOutCubic = exports.dt = exports.cubic = exports.createCache = void 0;
|
|
5
5
|
exports.kebabCase = kebabCase;
|
|
6
6
|
exports.linear = void 0;
|
|
7
7
|
exports.parseFormat = parseFormat;
|
|
@@ -62,10 +62,6 @@ var isArray = val => Array.isArray(val);
|
|
|
62
62
|
|
|
63
63
|
exports.isArray = isArray;
|
|
64
64
|
|
|
65
|
-
var isPromise = val => val instanceof Promise;
|
|
66
|
-
|
|
67
|
-
exports.isPromise = isPromise;
|
|
68
|
-
|
|
69
65
|
var isURL = val => {
|
|
70
66
|
if (!val) {
|
|
71
67
|
return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/ui",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.1-alpha.1642669197501",
|
|
4
4
|
"description": "A material like components library",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
},
|
|
40
40
|
"gitHead": "ee9c3866bedad96c86365b0f9888a3a6bb781b1f",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@varlet/icons": "1.25.
|
|
42
|
+
"@varlet/icons": "1.25.1-alpha.1642669197501",
|
|
43
43
|
"dayjs": "^1.10.4",
|
|
44
44
|
"decimal.js": "^10.2.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@varlet/cli": "1.25.
|
|
48
|
-
"@varlet/touch-emulator": "1.25.
|
|
47
|
+
"@varlet/cli": "1.25.1-alpha.1642669197501",
|
|
48
|
+
"@varlet/touch-emulator": "1.25.1-alpha.1642669197501",
|
|
49
49
|
"@vue/test-utils": "2.0.0-rc.6",
|
|
50
50
|
"@vue/runtime-core": "^3.2.16",
|
|
51
51
|
"typescript": "^4.4.4",
|
package/types/collapse.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VarComponent } from './varComponent'
|
|
2
2
|
|
|
3
|
-
export type CollapseModelValue =
|
|
3
|
+
export type CollapseModelValue = null | string | number | Array<string | number>
|
|
4
4
|
|
|
5
5
|
export interface CollapseProps {
|
|
6
6
|
modelValue?: CollapseModelValue
|