mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-22 14:39:16 +08:00
chore: expose utils in entry file
This commit is contained in:
parent
da0d5435de
commit
0072f4fe02
@ -1,9 +1,7 @@
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace, addUnit } from '../../utils';
|
||||
import { unitToPx } from '../../utils/format/unit';
|
||||
import { setScrollTop } from '../../utils/dom/scroll';
|
||||
import { addUnit, unitToPx, setScrollTop, createNamespace } from '../../utils';
|
||||
import { getMonthEndDay } from '../../datetime-picker/utils';
|
||||
import {
|
||||
t,
|
||||
|
@ -1,10 +1,8 @@
|
||||
import { ref, watch, reactive, computed, onMounted, onActivated } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { pick } from '../utils';
|
||||
import { raf } from '../utils/dom/raf';
|
||||
import { raf, pick, getScrollTop } from '../utils';
|
||||
import { isDate } from '../utils/validate/date';
|
||||
import { getScrollTop } from '../utils/dom/scroll';
|
||||
import {
|
||||
t,
|
||||
bem,
|
||||
|
@ -1,6 +1,11 @@
|
||||
import { watch, computed } from 'vue';
|
||||
import { createNamespace, isObject, getSizeStyle } from '../utils';
|
||||
import { raf, cancelRaf } from '../utils/dom/raf';
|
||||
import {
|
||||
raf,
|
||||
isObject,
|
||||
cancelRaf,
|
||||
getSizeStyle,
|
||||
createNamespace,
|
||||
} from '../utils';
|
||||
import { BLUE, WHITE } from '../utils/constant';
|
||||
|
||||
const [createComponent, bem] = createNamespace('circle');
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { ref, watch, computed, nextTick } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace } from '../utils';
|
||||
import { raf, doubleRaf } from '../utils/dom/raf';
|
||||
import { raf, doubleRaf, createNamespace } from '../utils';
|
||||
|
||||
// Composition
|
||||
import { useParent } from '../composition/use-relation';
|
||||
|
@ -8,8 +8,7 @@ import {
|
||||
} from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace } from '../utils';
|
||||
import { raf, cancelRaf } from '../utils/dom/raf';
|
||||
import { raf, cancelRaf, createNamespace } from '../utils';
|
||||
import { isSameSecond, parseTimeData, parseFormat } from './utils';
|
||||
|
||||
// Composition
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { padZero } from '../utils/format/string';
|
||||
import { padZero } from '../utils';
|
||||
|
||||
export type TimeData = {
|
||||
days: number;
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { computed } from 'vue';
|
||||
import { createNamespace } from '../utils';
|
||||
import { padZero, createNamespace } from '../utils';
|
||||
import { RED } from '../utils/constant';
|
||||
import { padZero } from '../utils/format/string';
|
||||
import Checkbox from '../checkbox';
|
||||
|
||||
const [createComponent, bem, t] = createNamespace('coupon');
|
||||
|
@ -1,11 +1,16 @@
|
||||
import { ref, watch, computed, nextTick, onMounted } from 'vue';
|
||||
import { createNamespace, pick } from '../utils';
|
||||
|
||||
// Utils
|
||||
import { isDate } from '../utils/validate/date';
|
||||
import { padZero } from '../utils/format/string';
|
||||
import { pick, padZero, createNamespace } from '../utils';
|
||||
import { times, sharedProps, getTrueValue, getMonthEndDay } from './utils';
|
||||
|
||||
// Composition
|
||||
import { useExpose } from '../composition/use-expose';
|
||||
|
||||
// Components
|
||||
import Picker from '../picker';
|
||||
import { pickerProps } from '../picker/shared';
|
||||
import { useExpose } from '../composition/use-expose';
|
||||
|
||||
const currentYear = new Date().getFullYear();
|
||||
const [createComponent] = createNamespace('date-picker');
|
||||
|
@ -1,11 +1,15 @@
|
||||
import { ref, watch, computed, nextTick, onMounted } from 'vue';
|
||||
import { createNamespace, pick } from '../utils';
|
||||
import { range } from '../utils/format/number';
|
||||
import { padZero } from '../utils/format/string';
|
||||
|
||||
// Utils
|
||||
import { pick, range, padZero, createNamespace } from '../utils';
|
||||
import { times, sharedProps } from './utils';
|
||||
|
||||
// Composition
|
||||
import { useExpose } from '../composition/use-expose';
|
||||
|
||||
// Components
|
||||
import Picker from '../picker';
|
||||
import { pickerProps } from '../picker/shared';
|
||||
import { useExpose } from '../composition/use-expose';
|
||||
|
||||
const [createComponent] = createNamespace('time-picker');
|
||||
|
||||
|
@ -9,15 +9,16 @@ import {
|
||||
} from 'vue';
|
||||
|
||||
// Utils
|
||||
import { resetScroll } from '../utils/dom/reset-scroll';
|
||||
import { formatNumber } from '../utils/format/number';
|
||||
import { trigger, preventDefault } from '../utils/dom/event';
|
||||
import {
|
||||
isDef,
|
||||
trigger,
|
||||
addUnit,
|
||||
isObject,
|
||||
isPromise,
|
||||
isFunction,
|
||||
resetScroll,
|
||||
formatNumber,
|
||||
preventDefault,
|
||||
createNamespace,
|
||||
} from '../utils';
|
||||
|
||||
|
@ -2,8 +2,7 @@ import { watch, computed, reactive } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { bem } from './shared';
|
||||
import { range } from '../utils/format/number';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import { range, preventDefault } from '../utils';
|
||||
|
||||
// Composition
|
||||
import { useTouch } from '../composition/use-touch';
|
||||
|
@ -1,15 +1,16 @@
|
||||
import { ref, computed, watch, nextTick } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace, isDef } from '../utils';
|
||||
import { isHidden } from '../utils/dom/style';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import {
|
||||
isDef,
|
||||
isHidden,
|
||||
getScrollTop,
|
||||
getElementTop,
|
||||
preventDefault,
|
||||
createNamespace,
|
||||
getRootScrollTop,
|
||||
setRootScrollTop,
|
||||
} from '../utils/dom/scroll';
|
||||
} from '../utils';
|
||||
|
||||
// Composition
|
||||
import { useScrollParent, useEventListener } from '@vant/use';
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { ref, watch, nextTick, onUpdated, onMounted } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace } from '../utils';
|
||||
import { isHidden } from '../utils/dom/style';
|
||||
import { isHidden, createNamespace } from '../utils';
|
||||
|
||||
// Composition
|
||||
import { useScrollParent, useEventListener } from '@vant/use';
|
||||
|
@ -1,8 +1,11 @@
|
||||
import { ref, reactive, nextTick, onActivated, watch } from 'vue';
|
||||
import { createNamespace, isDef } from '../utils';
|
||||
import { doubleRaf } from '../utils/dom/raf';
|
||||
import { ref, watch, reactive, nextTick, onActivated } from 'vue';
|
||||
import { isDef, doubleRaf, createNamespace } from '../utils';
|
||||
|
||||
// Composition
|
||||
import { useRect } from '../composition/use-rect';
|
||||
import { useEventListener } from '@vant/use';
|
||||
|
||||
// Components
|
||||
import Icon from '../icon';
|
||||
|
||||
const [createComponent, bem] = createNamespace('notice-bar');
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { ref, watch, computed, Teleport, Transition } from 'vue';
|
||||
import { createNamespace } from '../utils';
|
||||
import { stopPropagation } from '../utils/dom/event';
|
||||
import { createNamespace, stopPropagation } from '../utils';
|
||||
import { useClickAway } from '@vant/use';
|
||||
import Key from './Key';
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { Transition } from 'vue';
|
||||
import { createNamespace, isDef, noop } from '../utils';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import { noop, isDef, preventDefault, createNamespace } from '../utils';
|
||||
import { useLazyRender } from '../composition/use-lazy-render';
|
||||
|
||||
const [createComponent, bem] = createNamespace('overlay');
|
||||
|
@ -2,10 +2,8 @@ import { reactive, ref, watch } from 'vue';
|
||||
import { PICKER_KEY } from './shared';
|
||||
|
||||
// Utils
|
||||
import { range } from '../utils/format/number';
|
||||
import { deepClone } from '../utils/deep-clone';
|
||||
import { createNamespace, isObject } from '../utils';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import { range, isObject, createNamespace, preventDefault } from '../utils';
|
||||
|
||||
// Composition
|
||||
import { useTouch } from '../composition/use-touch';
|
||||
|
@ -2,10 +2,8 @@ import { ref, watch, computed } from 'vue';
|
||||
import { pickerProps, PICKER_KEY, DEFAULT_ITEM_HEIGHT } from './shared';
|
||||
|
||||
// Utils
|
||||
import { createNamespace } from '../utils';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import { unitToPx, preventDefault, createNamespace } from '../utils';
|
||||
import { BORDER_UNSET_TOP_BOTTOM } from '../utils/constant';
|
||||
import { unitToPx } from '../utils/format/unit';
|
||||
|
||||
// Composition
|
||||
import { useExpose } from '../composition/use-expose';
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { ref, watch, reactive, nextTick } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace } from '../utils';
|
||||
import { getScrollTop } from '../utils/dom/scroll';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import { preventDefault, getScrollTop, createNamespace } from '../utils';
|
||||
|
||||
// Composition
|
||||
import { useScrollParent } from '@vant/use';
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { computed } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace, addUnit } from '../utils';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import { addUnit, createNamespace, preventDefault } from '../utils';
|
||||
|
||||
// Composition
|
||||
import { useRefs } from '../composition/use-refs';
|
||||
|
@ -1,6 +1,5 @@
|
||||
// Utils
|
||||
import { createNamespace, pick } from '../utils';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import { pick, createNamespace, preventDefault } from '../utils';
|
||||
|
||||
// Components
|
||||
import Field from '../field';
|
||||
|
@ -1,9 +1,13 @@
|
||||
import { ref, computed } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace, addUnit, getSizeStyle } from '../utils';
|
||||
import {
|
||||
addUnit,
|
||||
getSizeStyle,
|
||||
preventDefault,
|
||||
createNamespace,
|
||||
} from '../utils';
|
||||
import { deepClone } from '../utils/deep-clone';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
|
||||
// Composition
|
||||
import { useRect } from '../composition/use-rect';
|
||||
|
@ -1,11 +1,16 @@
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ref, watch, computed } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { isNaN } from '../utils/validate/number';
|
||||
import { formatNumber } from '../utils/format/number';
|
||||
import { resetScroll } from '../utils/dom/reset-scroll';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import { createNamespace, isDef, addUnit, getSizeStyle } from '../utils';
|
||||
import {
|
||||
isDef,
|
||||
addUnit,
|
||||
resetScroll,
|
||||
formatNumber,
|
||||
getSizeStyle,
|
||||
preventDefault,
|
||||
createNamespace,
|
||||
} from '../utils';
|
||||
|
||||
// Composition
|
||||
import { useLinkField } from '../composition/use-link-field';
|
||||
|
@ -1,10 +1,13 @@
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { isHidden } from '../utils/dom/style';
|
||||
import { unitToPx } from '../utils/format/unit';
|
||||
import { createNamespace } from '../utils';
|
||||
import { getScrollTop, getElementTop } from '../utils/dom/scroll';
|
||||
import {
|
||||
isHidden,
|
||||
unitToPx,
|
||||
getScrollTop,
|
||||
getElementTop,
|
||||
createNamespace,
|
||||
} from '../utils';
|
||||
|
||||
// Composition
|
||||
import { useScrollParent, useEventListener } from '@vant/use';
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { ref, reactive, computed } from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace } from '../utils';
|
||||
import { range } from '../utils/format/number';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import { range, createNamespace, preventDefault } from '../utils';
|
||||
import { callInterceptor } from '../utils/interceptor';
|
||||
|
||||
// Composition
|
||||
|
@ -10,11 +10,13 @@ import {
|
||||
} from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace } from '../utils';
|
||||
import { range } from '../utils/format/number';
|
||||
import { isHidden } from '../utils/dom/style';
|
||||
import { doubleRaf } from '../utils/dom/raf';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
import {
|
||||
range,
|
||||
isHidden,
|
||||
doubleRaf,
|
||||
preventDefault,
|
||||
createNamespace,
|
||||
} from '../utils';
|
||||
|
||||
// Composition
|
||||
import { usePageVisibility, useWindowSize } from '@vant/use';
|
||||
|
@ -9,22 +9,24 @@ import {
|
||||
} from 'vue';
|
||||
|
||||
// Utils
|
||||
import { createNamespace, isDef, addUnit } from '../utils';
|
||||
import { scrollLeftTo, scrollTopTo } from './utils';
|
||||
import { route } from '../composition/use-route';
|
||||
import { isHidden } from '../utils/dom/style';
|
||||
import { unitToPx } from '../utils/format/unit';
|
||||
import { BORDER_TOP_BOTTOM } from '../utils/constant';
|
||||
import { callInterceptor } from '../utils/interceptor';
|
||||
import {
|
||||
isDef,
|
||||
addUnit,
|
||||
isHidden,
|
||||
unitToPx,
|
||||
getVisibleTop,
|
||||
getElementTop,
|
||||
createNamespace,
|
||||
getVisibleHeight,
|
||||
setRootScrollTop,
|
||||
} from '../utils/dom/scroll';
|
||||
} from '../utils';
|
||||
import { scrollLeftTo, scrollTopTo } from './utils';
|
||||
import { BORDER_TOP_BOTTOM } from '../utils/constant';
|
||||
import { callInterceptor } from '../utils/interceptor';
|
||||
|
||||
// Composition
|
||||
import { useWindowSize, useScrollParent, useEventListener } from '@vant/use';
|
||||
import { route } from '../composition/use-route';
|
||||
import { useRefs } from '../composition/use-refs';
|
||||
import { useExpose } from '../composition/use-expose';
|
||||
import { useChildren } from '../composition/use-relation';
|
||||
|
@ -1,14 +1,13 @@
|
||||
import { raf, cancelRaf } from '../utils/dom/raf';
|
||||
import { getScrollTop, setScrollTop } from '../utils/dom/scroll';
|
||||
import { raf, cancelRaf, getScrollTop, setScrollTop } from '../utils';
|
||||
|
||||
let scrollLeftRafId: number;
|
||||
let rafId: number;
|
||||
|
||||
export function scrollLeftTo(
|
||||
scroller: HTMLElement,
|
||||
to: number,
|
||||
duration: number
|
||||
) {
|
||||
cancelRaf(scrollLeftRafId);
|
||||
cancelRaf(rafId);
|
||||
|
||||
let count = 0;
|
||||
const from = scroller.scrollLeft;
|
||||
@ -18,7 +17,7 @@ export function scrollLeftTo(
|
||||
scroller.scrollLeft += (to - from) / frames;
|
||||
|
||||
if (++count < frames) {
|
||||
scrollLeftRafId = raf(animate);
|
||||
rafId = raf(animate);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Create a basic component with common options
|
||||
*/
|
||||
import { camelize } from '../format/string';
|
||||
import { App, defineComponent, ComponentOptionsWithObjectProps } from 'vue';
|
||||
import { camelize } from '..';
|
||||
|
||||
export function createComponent(name: string) {
|
||||
return function (sfc: ComponentOptionsWithObjectProps) {
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { get, isFunction } from '..';
|
||||
import { camelize } from '../format/string';
|
||||
import { get, camelize, isFunction } from '..';
|
||||
import locale from '../../locale';
|
||||
|
||||
export function createI18N(name: string) {
|
||||
|
@ -1,15 +0,0 @@
|
||||
/**
|
||||
* Hack for iOS12 page scroll
|
||||
* https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
|
||||
*/
|
||||
|
||||
import { isIOS as checkIsIOS } from '../validate/system';
|
||||
import { getRootScrollTop, setRootScrollTop } from './scroll';
|
||||
|
||||
const isIOS = checkIsIOS();
|
||||
|
||||
export function resetScroll() {
|
||||
if (isIOS) {
|
||||
setRootScrollTop(getRootScrollTop());
|
||||
}
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
import { isIOS as checkIsIOS } from '../validate/system';
|
||||
|
||||
type ScrollElement = HTMLElement | Window;
|
||||
|
||||
function isWindow(val: unknown): val is Window {
|
||||
@ -56,3 +58,13 @@ export function getVisibleTop(el: ScrollElement) {
|
||||
}
|
||||
return el.getBoundingClientRect().top;
|
||||
}
|
||||
|
||||
const isIOS = checkIsIOS();
|
||||
|
||||
// hack for iOS12 page scroll
|
||||
// see: https://developers.weixin.qq.com/community/develop/doc/00044ae90742f8c82fb78fcae56800
|
||||
export function resetScroll() {
|
||||
if (isIOS) {
|
||||
setRootScrollTop(getRootScrollTop());
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,11 @@
|
||||
export { addUnit, getSizeStyle } from './format/unit';
|
||||
export { createNamespace } from './create';
|
||||
export * from './create';
|
||||
export * from './format/unit';
|
||||
export * from './format/number';
|
||||
export * from './format/string';
|
||||
export * from './dom/raf';
|
||||
export * from './dom/style';
|
||||
export * from './dom/event';
|
||||
export * from './dom/scroll';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
export function noop() {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user