@varlet/ui 2.9.4-alpha.1679850560801 → 2.9.4-alpha.1679927847009

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.
@@ -241,7 +241,7 @@ import './time-picker/style/index.mjs'
241
241
  import './tooltip/style/index.mjs'
242
242
  import './uploader/style/index.mjs'
243
243
 
244
- const version = '2.9.4-alpha.1679850560801'
244
+ const version = '2.9.4-alpha.1679927847009'
245
245
 
246
246
  function install(app) {
247
247
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -160,7 +160,7 @@ export * from './time-picker/index.mjs'
160
160
  export * from './tooltip/index.mjs'
161
161
  export * from './uploader/index.mjs'
162
162
 
163
- const version = '2.9.4-alpha.1679850560801'
163
+ const version = '2.9.4-alpha.1679927847009'
164
164
 
165
165
  function install(app) {
166
166
  ActionSheet.install && app.use(ActionSheet)
@@ -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 VarIcon from '../icon/index.mjs';
6
- import { defineComponent, ref, computed, watch } from 'vue';
6
+ import { defineComponent, ref, computed, watch, nextTick } from 'vue';
7
7
  import { getParentScroller, getScrollTop, getTarget } from '../utils/elements.mjs';
8
8
  import { props } from './props.mjs';
9
9
  import { isString, toNumber } from '@varlet/shared';
@@ -150,7 +150,9 @@ var __sfc__ = defineComponent({
150
150
  refreshStatus.value = 'loading';
151
151
  distance.value = maxDistance.value * 0.3;
152
152
  call(props['onUpdate:modelValue'], true);
153
- call(props.onRefresh);
153
+ nextTick(() => {
154
+ call(props.onRefresh);
155
+ });
154
156
  lockEvent('remove');
155
157
  } else {
156
158
  refreshStatus.value = 'loosing';
@@ -107,6 +107,19 @@ export function getTarget(target, componentName) {
107
107
 
108
108
  if (isObject(target)) return target;
109
109
  error(componentName, 'type of prop "target" should be a selector or an element object');
110
+ }
111
+ export function getViewportSize() {
112
+ var {
113
+ innerWidth,
114
+ innerHeight
115
+ } = window;
116
+ return innerWidth > innerHeight ? {
117
+ vMin: innerHeight,
118
+ vMax: innerWidth
119
+ } : {
120
+ vMin: innerWidth,
121
+ vMax: innerHeight
122
+ };
110
123
  } // example 1rem
111
124
 
112
125
  export var isRem = value => isString(value) && value.endsWith('rem'); // e.g. 1 || 1px
@@ -117,7 +130,11 @@ export var isPercent = value => isString(value) && value.endsWith('%'); // e.g.
117
130
 
118
131
  export var isVw = value => isString(value) && value.endsWith('vw'); // e.g. 1vh
119
132
 
120
- export var isVh = value => isString(value) && value.endsWith('vh'); // e.g. calc(1px + 1px)
133
+ export var isVh = value => isString(value) && value.endsWith('vh'); // e.g. 1vmin
134
+
135
+ export var isVMin = value => isString(value) && value.endsWith('vmin'); // e.g. 1vmax
136
+
137
+ export var isVMax = value => isString(value) && value.endsWith('vmax'); // e.g. calc(1px + 1px)
121
138
 
122
139
  export var isCalc = value => isString(value) && value.startsWith('calc('); // e.g. var(--color-primary)
123
140
 
@@ -146,6 +163,14 @@ export var toPxNum = value => {
146
163
  return num * parseFloat(rootFontSize);
147
164
  }
148
165
 
166
+ if (isVMin(value)) {
167
+ return getViewportSize().vMin;
168
+ }
169
+
170
+ if (isVMax(value)) {
171
+ return getViewportSize().vMax;
172
+ }
173
+
149
174
  if (isString(value)) {
150
175
  return toNumber(value);
151
176
  } // % and other
@@ -159,7 +184,7 @@ export var toSizeUnit = value => {
159
184
  return undefined;
160
185
  }
161
186
 
162
- if (isPercent(value) || isVw(value) || isVh(value) || isRem(value) || isCalc(value) || isVar(value)) {
187
+ if (isPercent(value) || isVw(value) || isVh(value) || isRem(value) || isCalc(value) || isVar(value) || isVMin(value) || isVMax(value)) {
163
188
  return value;
164
189
  }
165
190