@varlet/ui 1.27.12 → 1.27.14-alpha.1655710081377

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.
Files changed (102) hide show
  1. package/es/action-sheet/index.js +1 -1
  2. package/es/back-top/BackTop.js +12 -9
  3. package/es/badge/Badge.js +1 -1
  4. package/es/bottom-navigation/BottomNavigation.js +1 -1
  5. package/es/checkbox-group/CheckboxGroup.js +1 -1
  6. package/es/col/Col.js +1 -1
  7. package/es/collapse/Collapse.js +1 -1
  8. package/es/collapse-item/CollapseItem.js +1 -1
  9. package/es/countdown/Countdown.js +28 -1
  10. package/es/counter/Counter.js +1 -1
  11. package/es/date-picker/DatePicker.js +1 -1
  12. package/es/date-picker/src/day-picker-panel.js +1 -1
  13. package/es/date-picker/src/month-picker-panel.js +1 -1
  14. package/es/date-picker/src/panel-header.js +1 -1
  15. package/es/date-picker/src/year-picker-panel.js +1 -1
  16. package/es/dialog/index.js +1 -1
  17. package/es/divider/Divider.js +3 -3
  18. package/es/icon/Icon.js +1 -1
  19. package/es/image-preview/ImagePreview.js +1 -1
  20. package/es/image-preview/index.js +1 -1
  21. package/es/index-bar/IndexBar.js +2 -1
  22. package/es/input/Input.js +1 -1
  23. package/es/lazy/index.js +2 -1
  24. package/es/list/List.js +2 -1
  25. package/es/pagination/Pagination.js +1 -1
  26. package/es/picker/Picker.js +2 -1
  27. package/es/picker/index.js +1 -1
  28. package/es/progress/Progress.js +1 -1
  29. package/es/pull-refresh/PullRefresh.js +1 -1
  30. package/es/rate/Rate.js +1 -1
  31. package/es/ripple/index.js +15 -8
  32. package/es/select/Select.js +23 -1
  33. package/es/skeleton/Skeleton.js +1 -1
  34. package/es/slider/Slider.js +1 -1
  35. package/es/snackbar/index.js +1 -1
  36. package/es/space/Space.js +1 -1
  37. package/es/space/props.js +1 -1
  38. package/es/sticky/Sticky.js +1 -1
  39. package/es/swipe/Swipe.js +1 -1
  40. package/es/tabs/Tabs.js +2 -1
  41. package/es/time-picker/TimePicker.js +1 -1
  42. package/es/time-picker/clock.js +1 -1
  43. package/es/time-picker/utils.js +1 -1
  44. package/es/uploader/Uploader.js +2 -1
  45. package/es/utils/components.js +1 -1
  46. package/es/utils/elements.js +1 -1
  47. package/es/utils/jest.js +1 -1
  48. package/es/utils/shared.js +1 -92
  49. package/es/varlet.esm.js +145 -113
  50. package/highlight/attributes.json +1 -1
  51. package/highlight/web-types.json +2 -2
  52. package/lib/action-sheet/index.js +1 -1
  53. package/lib/back-top/BackTop.js +13 -9
  54. package/lib/badge/Badge.js +2 -2
  55. package/lib/bottom-navigation/BottomNavigation.js +1 -1
  56. package/lib/checkbox-group/CheckboxGroup.js +1 -1
  57. package/lib/col/Col.js +1 -1
  58. package/lib/collapse/Collapse.js +1 -1
  59. package/lib/collapse-item/CollapseItem.js +1 -1
  60. package/lib/countdown/Countdown.js +29 -2
  61. package/lib/counter/Counter.js +1 -1
  62. package/lib/date-picker/DatePicker.js +1 -1
  63. package/lib/date-picker/src/day-picker-panel.js +1 -1
  64. package/lib/date-picker/src/month-picker-panel.js +1 -1
  65. package/lib/date-picker/src/panel-header.js +1 -1
  66. package/lib/date-picker/src/year-picker-panel.js +1 -1
  67. package/lib/dialog/index.js +1 -1
  68. package/lib/divider/Divider.js +3 -3
  69. package/lib/icon/Icon.js +1 -1
  70. package/lib/image-preview/ImagePreview.js +1 -1
  71. package/lib/image-preview/index.js +1 -1
  72. package/lib/index-bar/IndexBar.js +4 -2
  73. package/lib/input/Input.js +1 -1
  74. package/lib/lazy/index.js +4 -2
  75. package/lib/list/List.js +4 -2
  76. package/lib/pagination/Pagination.js +1 -1
  77. package/lib/picker/Picker.js +4 -2
  78. package/lib/picker/index.js +1 -1
  79. package/lib/progress/Progress.js +1 -1
  80. package/lib/pull-refresh/PullRefresh.js +1 -1
  81. package/lib/rate/Rate.js +1 -1
  82. package/lib/ripple/index.js +15 -8
  83. package/lib/select/Select.js +23 -1
  84. package/lib/skeleton/Skeleton.js +1 -1
  85. package/lib/slider/Slider.js +1 -1
  86. package/lib/snackbar/index.js +1 -1
  87. package/lib/space/Space.js +1 -1
  88. package/lib/space/props.js +1 -1
  89. package/lib/sticky/Sticky.js +1 -1
  90. package/lib/swipe/Swipe.js +1 -1
  91. package/lib/tabs/Tabs.js +5 -3
  92. package/lib/time-picker/TimePicker.js +1 -1
  93. package/lib/time-picker/clock.js +1 -1
  94. package/lib/time-picker/utils.js +1 -1
  95. package/lib/uploader/Uploader.js +7 -5
  96. package/lib/utils/components.js +1 -1
  97. package/lib/utils/elements.js +1 -1
  98. package/lib/utils/jest.js +1 -1
  99. package/lib/utils/shared.js +2 -135
  100. package/package.json +13 -6
  101. package/types/icon.d.ts +1 -1
  102. package/umd/varlet.js +3 -3
@@ -1,6 +1,6 @@
1
1
  import VarActionSheet from './ActionSheet.js'
2
2
  import { nextTick, reactive } from 'vue';
3
- import { inBrowser } from '../utils/shared';
3
+ import { inBrowser } from '@varlet/shared';
4
4
  import { mountInstance } from '../utils/components';
5
5
  var singletonOptions;
6
6
 
@@ -2,14 +2,15 @@ import { defineComponent, ref, onMounted, onBeforeUnmount } from 'vue';
2
2
  import VarButton from '../button';
3
3
  import VarIcon from '../icon';
4
4
  import { props } from './props';
5
- import { isString, easeInOutCubic, throttle, isObject } from '../utils/shared';
5
+ import { isString, throttle, isObject } from '@varlet/shared';
6
+ import { easeInOutCubic } from '../utils/shared';
6
7
  import { getScrollTop, getScrollLeft, scrollTo, getParentScroller, toPxNum, toSizeUnit } from '../utils/elements';
7
8
  import { call, createNamespace } from '../utils/components';
8
9
  var {
9
10
  n,
10
11
  classes
11
12
  } = createNamespace('back-top');
12
- import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, withModifiers as _withModifiers, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, Teleport as _Teleport, openBlock as _openBlock, createBlock as _createBlock } from "vue";
13
+ import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, withModifiers as _withModifiers, mergeProps as _mergeProps, createElementVNode as _createElementVNode, Teleport as _Teleport, openBlock as _openBlock, createBlock as _createBlock } from "vue";
13
14
  export function render(_ctx, _cache) {
14
15
  var _component_var_icon = _resolveComponent("var-icon");
15
16
 
@@ -18,17 +19,18 @@ export function render(_ctx, _cache) {
18
19
  return _openBlock(), _createBlock(_Teleport, {
19
20
  to: "body",
20
21
  disabled: _ctx.disabled
21
- }, [_createElementVNode("div", {
22
- class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.show, _ctx.n('--active')])),
22
+ }, [_createElementVNode("div", _mergeProps({
23
+ class: _ctx.classes(_ctx.n(), [_ctx.show, _ctx.n('--active')]),
23
24
  ref: "backTopEl",
24
- style: _normalizeStyle({
25
+ style: {
25
26
  right: _ctx.toSizeUnit(_ctx.right),
26
27
  bottom: _ctx.toSizeUnit(_ctx.bottom)
27
- }),
28
+ }
29
+ }, _ctx.$attrs, {
28
30
  onClick: _cache[0] || (_cache[0] = _withModifiers(function () {
29
31
  return _ctx.click && _ctx.click(...arguments);
30
32
  }, ["stop"]))
31
- }, [_renderSlot(_ctx.$slots, "default", {}, () => [_createVNode(_component_var_button, {
33
+ }), [_renderSlot(_ctx.$slots, "default", {}, () => [_createVNode(_component_var_button, {
32
34
  type: "primary",
33
35
  round: "",
34
36
  "var-back-top-cover": ""
@@ -39,8 +41,8 @@ export function render(_ctx, _cache) {
39
41
  _: 1
40
42
  /* STABLE */
41
43
 
42
- })])], 6
43
- /* CLASS, STYLE */
44
+ })])], 16
45
+ /* FULL_PROPS */
44
46
  )], 8
45
47
  /* PROPS */
46
48
  , ["disabled"]);
@@ -52,6 +54,7 @@ export default defineComponent({
52
54
  VarButton,
53
55
  VarIcon
54
56
  },
57
+ inheritAttrs: false,
55
58
  props,
56
59
 
57
60
  setup(props) {
package/es/badge/Badge.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import VarIcon from '../icon';
2
+ import { toNumber } from '@varlet/shared';
2
3
  import { computed, defineComponent } from 'vue';
3
4
  import { props } from './props';
4
- import { toNumber } from '../utils/shared';
5
5
  import { createNamespace } from '../utils/components';
6
6
  var {
7
7
  n,
@@ -5,7 +5,7 @@ import { defineComponent, ref, computed, onMounted, onUpdated, watch } from 'vue
5
5
  import { props } from './props';
6
6
  import { useBottomNavigationItems } from './provide';
7
7
  import { createNamespace, call } from '../utils/components';
8
- import { isNumber } from '../utils/shared';
8
+ import { isNumber } from '@varlet/shared';
9
9
  var {
10
10
  n,
11
11
  classes
@@ -4,7 +4,7 @@ import { props } from './props';
4
4
  import { useValidation, createNamespace, call } from '../utils/components';
5
5
  import { useCheckboxes } from './provide';
6
6
  import { useForm } from '../form/provide';
7
- import { uniq } from '../utils/shared';
7
+ import { uniq } from '@varlet/shared';
8
8
  var {
9
9
  n,
10
10
  classes
package/es/col/Col.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, ref, computed, watch } from 'vue';
2
- import { isPlainObject, toNumber } from '../utils/shared';
2
+ import { isPlainObject, toNumber } from '@varlet/shared';
3
3
  import { props } from './props';
4
4
  import { useRow } from './provide';
5
5
  import { toSizeUnit } from '../utils/elements';
@@ -2,7 +2,7 @@ import { computed, defineComponent, nextTick, watch } from 'vue';
2
2
  import { useCollapseItem } from './provide';
3
3
  import { props } from './props';
4
4
  import { call, createNamespace } from '../utils/components';
5
- import { isArray } from '../utils/shared';
5
+ import { isArray } from '@varlet/shared';
6
6
  var {
7
7
  n
8
8
  } = createNamespace('collapse');
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, ref, nextTick, watch, computed } from 'vue';
2
2
  import { requestAnimationFrame } from '../utils/elements';
3
- import { isArray } from '../utils/shared';
3
+ import { isArray } from '@varlet/shared';
4
4
  import { createNamespace } from '../utils/components';
5
5
  import { useCollapse } from './provide';
6
6
  import { props } from './props';
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, watch } from 'vue';
2
2
  import { props } from './props';
3
3
  import { requestAnimationFrame, cancelAnimationFrame } from '../utils/elements';
4
- import { toNumber, parseFormat } from '../utils/shared';
4
+ import { toNumber } from '@varlet/shared';
5
5
  import { call, createNamespace } from '../utils/components';
6
6
  var {
7
7
  n
@@ -39,6 +39,33 @@ export default defineComponent({
39
39
  milliseconds: 0
40
40
  });
41
41
 
42
+ var parseFormat = (format, time) => {
43
+ var scannedTimes = Object.values(time);
44
+ var scannedFormats = ['DD', 'HH', 'mm', 'ss'];
45
+ var padValues = [24, 60, 60, 1000];
46
+ scannedFormats.forEach((scannedFormat, index) => {
47
+ if (!format.includes(scannedFormat)) {
48
+ scannedTimes[index + 1] += scannedTimes[index] * padValues[index];
49
+ } else {
50
+ format = format.replace(scannedFormat, String(scannedTimes[index]).padStart(2, '0'));
51
+ }
52
+ });
53
+
54
+ if (format.includes('S')) {
55
+ var ms = String(scannedTimes[scannedTimes.length - 1]).padStart(3, '0');
56
+
57
+ if (format.includes('SSS')) {
58
+ format = format.replace('SSS', ms);
59
+ } else if (format.includes('SS')) {
60
+ format = format.replace('SS', ms.slice(0, 2));
61
+ } else {
62
+ format = format.replace('S', ms.slice(0, 1));
63
+ }
64
+ }
65
+
66
+ return format;
67
+ };
68
+
42
69
  var formatTime = durationTime => {
43
70
  var days = Math.floor(durationTime / DAY);
44
71
  var hours = Math.floor(durationTime % DAY / HOUR);
@@ -4,7 +4,7 @@ import Ripple from '../ripple';
4
4
  import { defineComponent, ref, watch, computed, nextTick } from 'vue';
5
5
  import { Decimal } from 'decimal.js';
6
6
  import { props } from './props';
7
- import { toNumber } from '../utils/shared';
7
+ import { toNumber } from '@varlet/shared';
8
8
  import { toSizeUnit } from '../utils/elements';
9
9
  import { useForm } from '../form/provide';
10
10
  import { useValidation, createNamespace, call } from '../utils/components';
@@ -4,7 +4,7 @@ import MonthPickerPanel from './src/month-picker-panel.js'
4
4
  import YearPickerPanel from './src/year-picker-panel.js'
5
5
  import DayPickerPanel from './src/day-picker-panel.js'
6
6
  import { props, MONTH_LIST, WEEK_HEADER } from './props';
7
- import { isArray, toNumber } from '../utils/shared';
7
+ import { isArray, toNumber } from '@varlet/shared';
8
8
  import { nextTickFrame } from '../utils/elements';
9
9
  import { createNamespace, call } from '../utils/components';
10
10
  import { pack } from '../locale';
@@ -7,7 +7,7 @@ import PanelHeader from './panel-header.js'
7
7
  import VarButton from '../../button';
8
8
  import { defineComponent, ref, computed, watch, onMounted, reactive } from 'vue';
9
9
  import { WEEK_HEADER } from '../props';
10
- import { toNumber } from '../../utils/shared';
10
+ import { toNumber } from '@varlet/shared';
11
11
  import { createNamespace } from '../../utils/components';
12
12
  import { pack } from '../../locale';
13
13
  dayjs.extend(isSameOrBefore);
@@ -7,7 +7,7 @@ import isSameOrAfter from 'dayjs/esm/plugin/isSameOrAfter';
7
7
  import { MONTH_LIST } from '../props';
8
8
  import PanelHeader from './panel-header.js'
9
9
  import VarButton from '../../button';
10
- import { toNumber } from '../../utils/shared';
10
+ import { toNumber } from '@varlet/shared';
11
11
  import { createNamespace } from '../../utils/components';
12
12
  import { pack } from '../../locale';
13
13
  dayjs.extend(isSameOrBefore);
@@ -1,7 +1,7 @@
1
1
  import VarButton from '../../button';
2
2
  import VarIcon from '../../icon';
3
3
  import { defineComponent, ref, computed, watch } from 'vue';
4
- import { toNumber } from '../../utils/shared';
4
+ import { toNumber } from '@varlet/shared';
5
5
  import { createNamespace } from '../../utils/components';
6
6
  import { pack } from '../../locale';
7
7
  var {
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, onMounted } from 'vue';
2
2
  import dayjs from 'dayjs/esm';
3
- import { toNumber } from '../../utils/shared';
3
+ import { toNumber } from '@varlet/shared';
4
4
  import { createNamespace } from '../../utils/components';
5
5
  var {
6
6
  n,
@@ -1,6 +1,6 @@
1
1
  import VarDialog from './Dialog.js'
2
2
  import { reactive, nextTick } from 'vue';
3
- import { inBrowser, isNumber, isString } from '../utils/shared';
3
+ import { inBrowser, isNumber, isString } from '@varlet/shared';
4
4
  import { mountInstance } from '../utils/components';
5
5
  var singletonOptions;
6
6
 
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
2
2
 
3
3
  import { defineComponent, computed, reactive, onMounted, onUpdated, toRefs } from 'vue';
4
4
  import { toSizeUnit } from '../utils/elements';
5
- import { isBool, toNumber } from '../utils/shared';
5
+ import { isBoolean, toNumber } from '@varlet/shared';
6
6
  import { props } from './props';
7
7
  import { createNamespace } from '../utils/components';
8
8
  var {
@@ -35,7 +35,7 @@ export default defineComponent({
35
35
  var state = reactive({
36
36
  withText: false
37
37
  });
38
- var isInset = computed(() => isBool(props.inset) ? props.inset : true);
38
+ var isInset = computed(() => isBoolean(props.inset) ? props.inset : true);
39
39
  var style = computed(() => {
40
40
  var {
41
41
  inset,
@@ -45,7 +45,7 @@ export default defineComponent({
45
45
  var baseStyle = {
46
46
  margin
47
47
  };
48
- if (isBool(inset) || inset === 0) return _extends({}, baseStyle); // -18px -> -18
48
+ if (isBoolean(inset) || inset === 0) return _extends({}, baseStyle); // -18px -> -18
49
49
 
50
50
  var _inset = toNumber(inset); // -18px -> 18px
51
51
 
package/es/icon/Icon.js CHANGED
@@ -3,7 +3,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
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
5
  import { defineComponent, watch, ref, nextTick } from 'vue';
6
- import { isURL, toNumber } from '../utils/shared';
6
+ import { isURL, toNumber } from '@varlet/shared';
7
7
  import { props } from './props';
8
8
  import { toSizeUnit } from '../utils/elements';
9
9
  import { createNamespace } from '../utils/components';
@@ -4,7 +4,7 @@ import VarIcon from '../icon';
4
4
  import VarPopup from '../popup';
5
5
  import { defineComponent, ref, computed, watch } from 'vue';
6
6
  import { props } from './props';
7
- import { toNumber } from '../utils/shared';
7
+ import { toNumber } from '@varlet/shared';
8
8
  import { call, createNamespace } from '../utils/components';
9
9
  var {
10
10
  n,
@@ -1,6 +1,6 @@
1
1
  import VarImagePreview from './ImagePreview.js'
2
2
  import { nextTick, reactive } from 'vue';
3
- import { inBrowser, isArray, isString } from '../utils/shared';
3
+ import { inBrowser, isArray, isString } from '@varlet/shared';
4
4
  import { mountInstance } from '../utils/components';
5
5
  var singletonOptions;
6
6
 
@@ -3,7 +3,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
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
5
  import { computed, defineComponent, ref, watch, onMounted, onBeforeUnmount } from 'vue';
6
- import { easeInOutCubic, isPlainObject, toNumber } from '../utils/shared';
6
+ import { isPlainObject, toNumber } from '@varlet/shared';
7
+ import { easeInOutCubic } from '../utils/shared';
7
8
  import { doubleRaf, getParentScroller, getScrollLeft, getScrollTop, nextTickFrame, requestAnimationFrame, scrollTo as varScrollTo, toPxNum } from '../utils/elements';
8
9
  import { useIndexAnchors } from './provide';
9
10
  import { props } from './props';
package/es/input/Input.js CHANGED
@@ -2,7 +2,7 @@ import VarFormDetails from '../form-details';
2
2
  import VarIcon from '../icon';
3
3
  import { defineComponent, getCurrentInstance, ref, computed, nextTick, onMounted } from 'vue';
4
4
  import { props } from './props';
5
- import { isEmpty } from '../utils/shared';
5
+ import { isEmpty } from '@varlet/shared';
6
6
  import { useValidation, createNamespace, call } from '../utils/components';
7
7
  import { useForm } from '../form/provide';
8
8
  var {
package/es/lazy/index.js CHANGED
@@ -5,7 +5,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
5
5
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
6
6
 
7
7
  import { getAllParentScroller, inViewport } from '../utils/elements';
8
- import { createCache, removeItem, throttle } from '../utils/shared';
8
+ import { removeItem, throttle } from '@varlet/shared';
9
+ import { createCache } from '../utils/shared';
9
10
  import { call } from '../utils/components';
10
11
  var BACKGROUND_IMAGE_ARG_NAME = 'background-image';
11
12
  var LAZY_LOADING = 'lazy-loading';
package/es/list/List.js CHANGED
@@ -7,7 +7,8 @@ import Ripple from '../ripple';
7
7
  import { defineComponent, onMounted, onUnmounted, ref, nextTick } from 'vue';
8
8
  import { getParentScroller, toPxNum } from '../utils/elements';
9
9
  import { props } from './props';
10
- import { isNumber, dt } from '../utils/shared';
10
+ import { isNumber } from '@varlet/shared';
11
+ import { dt } from '../utils/shared';
11
12
  import { createNamespace, call } from '../utils/components';
12
13
  import { pack } from '../locale';
13
14
  var {
@@ -5,7 +5,7 @@ import VarCell from '../cell';
5
5
  import VarInput from '../input';
6
6
  import { defineComponent, ref, computed, watch } from 'vue';
7
7
  import { props } from './porps';
8
- import { isNumber, toNumber } from '../utils/shared';
8
+ import { isNumber, toNumber } from '@varlet/shared';
9
9
  import { pack } from '../locale';
10
10
  import { createNamespace } from '../utils/components';
11
11
  var {
@@ -2,7 +2,8 @@ import VarButton from '../button';
2
2
  import VarPopup from '../popup';
3
3
  import { defineComponent, watch, ref, computed, Transition, toRaw } from 'vue';
4
4
  import { props } from './props';
5
- import { isArray, dt } from '../utils/shared';
5
+ import { isArray } from '@varlet/shared';
6
+ import { dt } from '../utils/shared';
6
7
  import { toPxNum, getTranslate } from '../utils/elements';
7
8
  import { pack } from '../locale';
8
9
  import { createNamespace, call } from '../utils/components';
@@ -1,6 +1,6 @@
1
1
  import VarPicker from './Picker.js'
2
2
  import { nextTick, reactive } from 'vue';
3
- import { isArray } from '../utils/shared';
3
+ import { isArray } from '@varlet/shared';
4
4
  import { mountInstance } from '../utils/components';
5
5
  var singletonOptions;
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed } from 'vue';
2
2
  import { props } from './props';
3
- import { toNumber } from '../utils/shared';
3
+ import { toNumber } from '@varlet/shared';
4
4
  import { toSizeUnit, multiplySizeUnit, toPxNum } from '../utils/elements';
5
5
  import { createNamespace } from '../utils/components';
6
6
  var {
@@ -6,7 +6,7 @@ import VarIcon from '../icon';
6
6
  import { defineComponent, ref, computed, watch, onMounted } from 'vue';
7
7
  import { getParentScroller, getScrollTop } from '../utils/elements';
8
8
  import { props } from './props';
9
- import { toNumber } from '../utils/shared';
9
+ import { toNumber } from '@varlet/shared';
10
10
  import { createNamespace } from '../utils/components';
11
11
  var {
12
12
  n,
package/es/rate/Rate.js CHANGED
@@ -5,7 +5,7 @@ import { defineComponent, nextTick } from 'vue';
5
5
  import { useForm } from '../form/provide';
6
6
  import { useValidation, call, createNamespace } from '../utils/components';
7
7
  import { toSizeUnit } from '../utils/elements';
8
- import { toNumber } from '../utils/shared';
8
+ import { toNumber } from '@varlet/shared';
9
9
  import { props } from './props';
10
10
  var {
11
11
  n
@@ -160,16 +160,23 @@ function unmounted(el) {
160
160
  }
161
161
 
162
162
  function updated(el, binding) {
163
- var _binding$value3, _binding$value$touchm2, _binding$value4;
163
+ var _binding$value$touchm2, _binding$value3, _binding$value4, _binding$value5, _el$_ripple, _el$_ripple2, _el$_ripple3;
164
164
 
165
- if (el._ripple.tasker) {
166
- el._ripple.removeRipple();
167
- }
165
+ var newBinding = {
166
+ touchmoveForbid: (_binding$value$touchm2 = (_binding$value3 = binding.value) == null ? void 0 : _binding$value3.touchmoveForbid) != null ? _binding$value$touchm2 : context.touchmoveForbid,
167
+ color: (_binding$value4 = binding.value) == null ? void 0 : _binding$value4.color,
168
+ disabled: (_binding$value5 = binding.value) == null ? void 0 : _binding$value5.disabled
169
+ };
170
+ var diff = newBinding.touchmoveForbid !== ((_el$_ripple = el._ripple) == null ? void 0 : _el$_ripple.touchmoveForbid) || newBinding.color !== ((_el$_ripple2 = el._ripple) == null ? void 0 : _el$_ripple2.color) || newBinding.disabled !== ((_el$_ripple3 = el._ripple) == null ? void 0 : _el$_ripple3.disabled);
168
171
 
169
- el._ripple = _extends({}, el._ripple, (_binding$value3 = binding.value) != null ? _binding$value3 : {}, {
170
- touchmoveForbid: (_binding$value$touchm2 = (_binding$value4 = binding.value) == null ? void 0 : _binding$value4.touchmoveForbid) != null ? _binding$value$touchm2 : context.touchmoveForbid,
171
- tasker: null
172
- });
172
+ if (diff) {
173
+ var _el$_ripple4, _el$_ripple5;
174
+
175
+ el._ripple = _extends({
176
+ tasker: (_el$_ripple4 = el._ripple) == null ? void 0 : _el$_ripple4.tasker,
177
+ removeRipple: (_el$_ripple5 = el._ripple) == null ? void 0 : _el$_ripple5.removeRipple
178
+ }, newBinding);
179
+ }
173
180
  }
174
181
 
175
182
  var Ripple = {
@@ -3,7 +3,7 @@ import VarMenu from '../menu';
3
3
  import VarChip from '../chip';
4
4
  import VarFormDetails from '../form-details';
5
5
  import { computed, defineComponent, ref, watch, nextTick } from 'vue';
6
- import { isArray, isEmpty } from '../utils/shared';
6
+ import { isArray, isEmpty } from '@varlet/shared';
7
7
  import { props } from './props';
8
8
  import { useValidation, createNamespace, call } from '../utils/components';
9
9
  import { useOptions } from './provide';
@@ -55,6 +55,7 @@ export function render(_ctx, _cache) {
55
55
  onClose: _ctx.handleBlur
56
56
  }, {
57
57
  menu: _withCtx(() => [_createElementVNode("div", {
58
+ ref: "menuEl",
58
59
  class: _normalizeClass(_ctx.n('scroller'))
59
60
  }, [_renderSlot(_ctx.$slots, "default")], 2
60
61
  /* CLASS */
@@ -202,6 +203,7 @@ export default defineComponent({
202
203
  // expose
203
204
  resetValidation
204
205
  } = useValidation();
206
+ var menuEl = ref(null);
205
207
 
206
208
  var computeLabel = () => {
207
209
  var {
@@ -309,6 +311,7 @@ export default defineComponent({
309
311
  isFocus.value = true;
310
312
  call(onFocus);
311
313
  validateWithTrigger('onFocus');
314
+ detectBoundary();
312
315
  };
313
316
 
314
317
  var handleBlur = () => {
@@ -433,6 +436,7 @@ export default defineComponent({
433
436
  wrapWidth.value = getWrapWidth();
434
437
  offsetY.value = getOffsetY() + toPxNum(props.offsetY);
435
438
  isFocus.value = true;
439
+ detectBoundary();
436
440
  }; // expose
437
441
 
438
442
 
@@ -449,6 +453,23 @@ export default defineComponent({
449
453
  resetValidation();
450
454
  };
451
455
 
456
+ var detectBoundary = () => {
457
+ var {
458
+ body
459
+ } = document;
460
+ nextTick(() => {
461
+ var _menuEl$value, _menuEl$value2;
462
+
463
+ var {
464
+ offsetTop: menuOffsetTop,
465
+ offsetHeight: menuOffsetHeight
466
+ } = (_menuEl$value = menuEl.value) == null ? void 0 : _menuEl$value.parentElement;
467
+ var menuOffsetBottom = body.scrollHeight - menuOffsetHeight - menuOffsetTop;
468
+ if (menuOffsetTop < 0) offsetY.value = getOffsetY();
469
+ if (menuOffsetBottom < 0) offsetY.value -= ((_menuEl$value2 = menuEl.value) == null ? void 0 : _menuEl$value2.parentElement).offsetHeight - getOffsetY();
470
+ });
471
+ };
472
+
452
473
  watch(() => props.multiple, () => {
453
474
  var {
454
475
  multiple,
@@ -482,6 +503,7 @@ export default defineComponent({
482
503
  formDisabled: form == null ? void 0 : form.disabled,
483
504
  label,
484
505
  labels,
506
+ menuEl,
485
507
  n,
486
508
  classes,
487
509
  computePlaceholderState,
@@ -1,7 +1,7 @@
1
1
  import { defineComponent } from 'vue';
2
2
  import { props } from './props';
3
3
  import { toSizeUnit } from '../utils/elements';
4
- import { toNumber } from '../utils/shared';
4
+ import { toNumber } from '@varlet/shared';
5
5
  import { createNamespace } from '../utils/components';
6
6
  var {
7
7
  n,
@@ -4,7 +4,7 @@ import { defineComponent, ref, onMounted, computed, reactive, nextTick, watch }
4
4
  import { useValidation, createNamespace, call } from '../utils/components';
5
5
  import { useForm } from '../form/provide';
6
6
  import { getLeft, multiplySizeUnit } from '../utils/elements';
7
- import { isArray, isNumber, toNumber } from '../utils/shared';
7
+ import { isArray, isNumber, toNumber } from '@varlet/shared';
8
8
  import { props } from './props';
9
9
  import VarFormDetails from '../form-details';
10
10
  var {
@@ -7,7 +7,7 @@ import VarSnackbar from './Snackbar.js'
7
7
  import context from '../context';
8
8
  import { reactive, TransitionGroup } from 'vue';
9
9
  import { mountInstance } from '../utils/components';
10
- import { isNumber, isPlainObject, isString, toNumber } from '../utils/shared';
10
+ import { isNumber, isPlainObject, isString, toNumber } from '@varlet/shared';
11
11
 
12
12
  function _isSlot(s) {
13
13
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
package/es/space/Space.js CHANGED
@@ -2,7 +2,7 @@ import { createVNode as _createVNode } from "vue";
2
2
  import { defineComponent, Fragment, Comment } from 'vue';
3
3
  import { internalSizeValidator, props } from './props';
4
4
  import { toPxNum } from '../utils/elements';
5
- import { isArray } from '../utils/shared';
5
+ import { isArray } from '@varlet/shared';
6
6
 
7
7
 
8
8
  import { call, createNamespace } from '../utils/components';
package/es/space/props.js CHANGED
@@ -1,4 +1,4 @@
1
- import { isArray, isNumber, isString } from '../utils/shared';
1
+ import { isArray, isNumber, isString } from '@varlet/shared';
2
2
  export var internalSizeValidator = size => ['mini', 'small', 'normal', 'large'].includes(size);
3
3
  export var sizeValidator = size => {
4
4
  return internalSizeValidator(size) || isArray(size) || isNumber(size) || isString(size);
@@ -5,7 +5,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
5
5
  import { defineComponent, ref, onMounted, onUnmounted, onActivated, onDeactivated, computed, watch } from 'vue';
6
6
  import { props } from './props';
7
7
  import { doubleRaf, getParentScroller, toPxNum } from '../utils/elements';
8
- import { toNumber } from '../utils/shared';
8
+ import { toNumber } from '@varlet/shared';
9
9
  import { call, createNamespace } from '../utils/components';
10
10
  var {
11
11
  n,
package/es/swipe/Swipe.js CHANGED
@@ -6,7 +6,7 @@ import { defineComponent, ref, computed, watch, onMounted, onUnmounted } from 'v
6
6
  import { useSwipeItems } from './provide';
7
7
  import { doubleRaf, nextTickFrame } from '../utils/elements';
8
8
  import { props } from './props';
9
- import { isNumber, toNumber } from '../utils/shared';
9
+ import { isNumber, toNumber } from '@varlet/shared';
10
10
  import { call, createNamespace } from '../utils/components';
11
11
  var SWIPE_DELAY = 250;
12
12
  var SWIPE_DISTANCE = 20;
package/es/tabs/Tabs.js CHANGED
@@ -6,7 +6,8 @@ import VarSticky from '../sticky';
6
6
  import { defineComponent, watch, ref, computed, Transition, onMounted, onUnmounted } from 'vue';
7
7
  import { props } from './props';
8
8
  import { useTabList } from './provide';
9
- import { isNumber, linear } from '../utils/shared';
9
+ import { isNumber } from '@varlet/shared';
10
+ import { linear } from '../utils/shared';
10
11
  import { toSizeUnit, scrollTo, doubleRaf } from '../utils/elements';
11
12
  import { createNamespace, call } from '../utils/components';
12
13
  var {
@@ -2,7 +2,7 @@ import { computed, defineComponent, reactive, ref, watch } from 'vue';
2
2
  import dayjs from 'dayjs/esm';
3
3
  import Clock from './clock.js'
4
4
  import { props, hoursAmpm, hours24 } from './props';
5
- import { toNumber } from '../utils/shared';
5
+ import { toNumber } from '@varlet/shared';
6
6
  import { createNamespace, call } from '../utils/components';
7
7
  import { getNumberTime, getIsDisableMinute, getIsDisableSecond } from './utils';
8
8
  var {
@@ -2,7 +2,7 @@ import { computed, defineComponent, ref, watch } from 'vue';
2
2
  import dayjs from 'dayjs/esm';
3
3
  import { hoursAmpm, hours24, minSec } from './props';
4
4
  import { notConvert, convertHour, getIsDisableMinute, getIsDisableSecond, getNumberTime } from './utils';
5
- import { toNumber } from '../utils/shared';
5
+ import { toNumber } from '@varlet/shared';
6
6
  import { createNamespace } from '../utils/components';
7
7
  var {
8
8
  n,
@@ -1,5 +1,5 @@
1
1
  import { hours24, hoursAmpm } from './props';
2
- import { toNumber } from '../utils/shared';
2
+ import { toNumber } from '@varlet/shared';
3
3
  export var notConvert = (format, ampm) => format === '24hr' || ampm === 'am';
4
4
  export var convertHour = (format, ampm, hour) => {
5
5
  var index = hoursAmpm.findIndex(hourAmpm => toNumber(hourAmpm) === toNumber(hour));
@@ -9,7 +9,8 @@ import ImagePreview from '../image-preview';
9
9
  import Ripple from '../ripple';
10
10
  import { defineComponent, nextTick, reactive, computed, watch, ref } from 'vue';
11
11
  import { props } from './props';
12
- import { isNumber, isHTMLSupportImage, isHTMLSupportVideo, toNumber, isString } from '../utils/shared';
12
+ import { isNumber, toNumber, isString } from '@varlet/shared';
13
+ import { isHTMLSupportImage, isHTMLSupportVideo } from '../utils/shared';
13
14
  import { call, useValidation, createNamespace } from '../utils/components';
14
15
  import { useForm } from '../form/provide';
15
16
  var {