@varlet/ui 2.5.2 → 2.5.4
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/back-top/BackTop.js +3 -23
- package/es/menu/menu.css +1 -1
- package/es/pull-refresh/PullRefresh.js +2 -2
- package/es/pull-refresh/props.js +3 -0
- package/es/style.css +1 -1
- package/es/utils/elements.js +15 -1
- package/es/varlet.esm.js +1269 -1268
- package/highlight/attributes.json +4 -0
- package/highlight/tags.json +1 -0
- package/highlight/web-types.json +10 -1
- package/lib/back-top/BackTop.js +1 -21
- package/lib/menu/menu.css +1 -1
- package/lib/pull-refresh/PullRefresh.js +1 -1
- package/lib/pull-refresh/props.js +3 -0
- package/lib/style.css +1 -1
- package/lib/utils/elements.js +16 -0
- package/package.json +7 -7
- package/types/pullRefresh.d.ts +1 -0
- package/umd/varlet.js +7 -7
package/es/utils/elements.js
CHANGED
|
@@ -2,7 +2,7 @@ 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 { isNumber, isString, kebabCase, toNumber } from '@varlet/shared';
|
|
5
|
+
import { isNumber, isObject, isString, kebabCase, toNumber } from '@varlet/shared';
|
|
6
6
|
import { getGlobalThis } from './shared';
|
|
7
7
|
export function getLeft(element) {
|
|
8
8
|
var {
|
|
@@ -92,6 +92,20 @@ export function getAllParentScroller(el) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
return allParentScroller;
|
|
95
|
+
}
|
|
96
|
+
export function getTarget(target, componentName) {
|
|
97
|
+
if (isString(target)) {
|
|
98
|
+
var el = document.querySelector(target);
|
|
99
|
+
|
|
100
|
+
if (!el) {
|
|
101
|
+
throw Error("[Varlet] " + componentName + ": target element cannot found");
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return el;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (isObject(target)) return target;
|
|
108
|
+
throw Error("[Varlet] " + componentName + ": type of prop \"target\" should be a selector or an element object");
|
|
95
109
|
} // example 1rem
|
|
96
110
|
|
|
97
111
|
export var isRem = value => isString(value) && value.endsWith('rem'); // e.g. 1 || 1px
|