@varlet/ui 2.9.6-alpha.1680971883189 → 2.9.6

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.
@@ -53,15 +53,15 @@ function ActionSheet(options) {
53
53
  });
54
54
  }
55
55
 
56
- function setDefaultOptions(options) {
56
+ ActionSheet.setDefaultOptions = function (options) {
57
57
  defaultOptions = options;
58
- }
58
+ };
59
59
 
60
- function resetDefaultOptions() {
60
+ ActionSheet.resetDefaultOptions = function () {
61
61
  defaultOptions = {};
62
- }
62
+ };
63
63
 
64
- function close() {
64
+ ActionSheet.close = function () {
65
65
  if (singletonOptions != null) {
66
66
  var prevSingletonOptions = singletonOptions;
67
67
  singletonOptions = null;
@@ -69,7 +69,7 @@ function close() {
69
69
  prevSingletonOptions.show = false;
70
70
  });
71
71
  }
72
- }
72
+ };
73
73
 
74
74
  ActionSheet.Component = VarActionSheet;
75
75
 
@@ -81,11 +81,6 @@ ActionSheet.install = function (app) {
81
81
  app.component(VarActionSheet.name, VarActionSheet);
82
82
  };
83
83
 
84
- Object.assign(ActionSheet, {
85
- setDefaultOptions,
86
- resetDefaultOptions,
87
- close
88
- });
89
84
  export { props as actionSheetProps } from './props.mjs';
90
85
  export var _ActionSheetComponent = VarActionSheet;
91
86
  export default ActionSheet;
@@ -69,7 +69,7 @@ function __render__(_ctx, _cache) {
69
69
  ripple: false,
70
70
  elevation: _ctx.componentProps.buttonElevation
71
71
  }, _extends({}, _ctx.buttonProps(day)), {
72
- onClick: event => _ctx.chooseDay(day, event)
72
+ onClick: _cache[0] || (_cache[0] = event => chooseDay(day, event))
73
73
  }), {
74
74
  default: _withCtx(() => [_createTextVNode(_toDisplayString(_ctx.filterDay(day)), 1
75
75
  /* TEXT */
@@ -79,7 +79,7 @@ function __render__(_ctx, _cache) {
79
79
 
80
80
  }, 1040
81
81
  /* FULL_PROPS, DYNAMIC_SLOTS */
82
- , ["elevation", "onClick"])]);
82
+ , ["elevation"])]);
83
83
  }), 128
84
84
  /* KEYED_FRAGMENT */
85
85
  ))], 2
@@ -243,7 +243,8 @@ var __sfc__ = defineComponent({
243
243
  text: true,
244
244
  outline: false,
245
245
  textColor: '',
246
- class: n('button')
246
+ class: n('button'),
247
+ disabled: true
247
248
  };
248
249
  }
249
250
 
@@ -308,7 +309,8 @@ var __sfc__ = defineComponent({
308
309
  outline: computeOutline(),
309
310
  textColor: isCover ? '' : textColorOrCover(),
310
311
  [nDate() + "-color-cover"]: isCover,
311
- class: classes(n('button'), n('button--usable'), [disabled, n('button--disabled')])
312
+ class: classes(n('button'), n('button--usable'), [disabled, n('button--disabled')]),
313
+ disabled
312
314
  };
313
315
  };
314
316
 
@@ -53,7 +53,7 @@ function __render__(_ctx, _cache) {
53
53
  ripple: false,
54
54
  elevation: _ctx.componentProps.buttonElevation
55
55
  }, _extends({}, _ctx.buttonProps(month.index)), {
56
- onClick: event => _ctx.chooseMonth(month, event)
56
+ onClick: _cache[0] || (_cache[0] = event => chooseMonth(month, event))
57
57
  }), {
58
58
  default: _withCtx(() => [_createTextVNode(_toDisplayString(_ctx.getMonthAbbr(month.index)), 1
59
59
  /* TEXT */
@@ -63,7 +63,7 @@ function __render__(_ctx, _cache) {
63
63
 
64
64
  }, 1040
65
65
  /* FULL_PROPS, DYNAMIC_SLOTS */
66
- , ["elevation", "onClick"])]);
66
+ , ["elevation"])]);
67
67
  }), 128
68
68
  /* KEYED_FRAGMENT */
69
69
  ))]))]),
@@ -234,7 +234,8 @@ var __sfc__ = defineComponent({
234
234
  color: !computeText() ? color : '',
235
235
  textColor: isCover ? '' : textColorOrCover(),
236
236
  [nDate() + "-color-cover"]: isCover,
237
- class: classes(n('button'), [disabled, n('button--disabled')])
237
+ class: classes(n('button'), [disabled, n('button--disabled')]),
238
+ disabled
238
239
  };
239
240
  };
240
241
 
@@ -133,7 +133,7 @@ var __sfc__ = defineComponent({
133
133
  }
134
134
 
135
135
  if (onBeforeClose != null) {
136
- onBeforeClose('close', done);
136
+ call(onBeforeClose, 'close', done);
137
137
  return;
138
138
  }
139
139
 
@@ -148,7 +148,7 @@ var __sfc__ = defineComponent({
148
148
  call(onConfirm);
149
149
 
150
150
  if (onBeforeClose != null) {
151
- onBeforeClose('confirm', done);
151
+ call(onBeforeClose, 'confirm', done);
152
152
  return;
153
153
  }
154
154
 
@@ -163,7 +163,7 @@ var __sfc__ = defineComponent({
163
163
  call(onCancel);
164
164
 
165
165
  if (onBeforeClose != null) {
166
- onBeforeClose('cancel', done);
166
+ call(onBeforeClose, 'cancel', done);
167
167
  return;
168
168
  }
169
169
 
@@ -64,15 +64,15 @@ function Dialog(options) {
64
64
  });
65
65
  }
66
66
 
67
- function setDefaultOptions(options) {
67
+ Dialog.setDefaultOptions = function (options) {
68
68
  defaultOptions = options;
69
- }
69
+ };
70
70
 
71
- function resetDefaultOptions() {
71
+ Dialog.resetDefaultOptions = function () {
72
72
  defaultOptions = {};
73
- }
73
+ };
74
74
 
75
- function close() {
75
+ Dialog.close = function () {
76
76
  if (singletonOptions != null) {
77
77
  var prevSingletonOptions = singletonOptions;
78
78
  singletonOptions = null;
@@ -80,13 +80,7 @@ function close() {
80
80
  prevSingletonOptions.show = false;
81
81
  });
82
82
  }
83
- }
84
-
85
- Object.assign(Dialog, {
86
- setDefaultOptions,
87
- resetDefaultOptions,
88
- close
89
- });
83
+ };
90
84
 
91
85
  VarDialog.install = function (app) {
92
86
  app.component(VarDialog.name, VarDialog);
@@ -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.6-alpha.1680971883189'
244
+ const version = '2.9.6'
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.6-alpha.1680971883189'
163
+ const version = '2.9.6'
164
164
 
165
165
  function install(app) {
166
166
  ActionSheet.install && app.use(ActionSheet)
@@ -71,7 +71,7 @@ Picker.install = function (app) {
71
71
  app.component(VarPicker.name, VarPicker);
72
72
  };
73
73
 
74
- Picker.close = () => {
74
+ Picker.close = function () {
75
75
  if (singletonOptions != null) {
76
76
  var prevSingletonOptions = singletonOptions;
77
77
  singletonOptions = null;
@@ -38,7 +38,7 @@ function __render__(_ctx, _cache) {
38
38
  }, [_createVNode(_component_var_icon, {
39
39
  name: _ctx.iconName,
40
40
  transition: _ctx.ICON_TRANSITION,
41
- class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [_ctx.refreshStatus === 'loading' && _ctx.iconHasChanged, _ctx.n('animation')])),
41
+ class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [_ctx.refreshStatus === 'loading', _ctx.n('animation')])),
42
42
  "var-pull-refresh-cover": ""
43
43
  }, null, 8
44
44
  /* PROPS */
@@ -67,11 +67,26 @@ var __sfc__ = defineComponent({
67
67
  var isEnd = ref(false);
68
68
  var scroller;
69
69
  var eventTargetScroller;
70
- var changing;
71
70
  var startY = 0;
72
- var deltaY = 0; // https://github.com/varletjs/varlet/issues/509
71
+ var deltaY = 0;
72
+
73
+ var startIconTransition = /*#__PURE__*/function () {
74
+ var _ref = _asyncToGenerator(function* (name) {
75
+ if (iconName.value === name) {
76
+ return;
77
+ }
78
+
79
+ iconName.value = name;
80
+ return new Promise(resolve => {
81
+ window.setTimeout(resolve, ICON_TRANSITION);
82
+ });
83
+ });
84
+
85
+ return function startIconTransition(_x) {
86
+ return _ref.apply(this, arguments);
87
+ };
88
+ }();
73
89
 
74
- var iconHasChanged = ref(true);
75
90
  var isTouchable = computed(() => refreshStatus.value !== 'loading' && refreshStatus.value !== 'success' && !props.disabled);
76
91
  var controlStyle = computed(() => ({
77
92
  transform: "translate3d(0px, " + (isString(distance.value) ? distance.value : distance.value + "px") + ", 0px) translate(-50%, 0)",
@@ -82,15 +97,6 @@ var __sfc__ = defineComponent({
82
97
  var maxDistance = computed(() => Math.abs(2 * controlPosition.value));
83
98
  var isSuccess = computed(() => refreshStatus.value === 'success');
84
99
 
85
- var changeIcon = () => {
86
- return new Promise(resolve => {
87
- window.setTimeout(() => {
88
- iconHasChanged.value = true;
89
- resolve();
90
- }, ICON_TRANSITION);
91
- });
92
- };
93
-
94
100
  var lockEvent = action => {
95
101
  var el = 'classList' in scroller ? scroller : document.body;
96
102
  el.classList[action](n() + "--lock");
@@ -143,23 +149,19 @@ var __sfc__ = defineComponent({
143
149
 
144
150
  var moveDistance = (event.touches[0].clientY - startPosition.value) / 2 + controlPosition.value;
145
151
  distance.value = moveDistance >= maxDistance.value ? maxDistance.value : moveDistance;
146
-
147
- if (distance.value >= maxDistance.value * 0.2) {
148
- iconHasChanged.value = false;
149
- iconName.value = 'refresh';
150
- changing = changeIcon();
151
- } else {
152
- iconName.value = 'arrow-down';
153
- }
152
+ startIconTransition(distance.value >= maxDistance.value * 0.2 ? 'refresh' : 'arrow-down');
154
153
  };
155
154
 
156
155
  var touchEnd = /*#__PURE__*/function () {
157
- var _ref = _asyncToGenerator(function* () {
158
- if (!isTouchable.value) return;
156
+ var _ref2 = _asyncToGenerator(function* () {
157
+ if (!isTouchable.value) {
158
+ return;
159
+ }
160
+
159
161
  isEnd.value = true;
160
162
 
161
163
  if (distance.value >= maxDistance.value * 0.2) {
162
- yield changing;
164
+ yield startIconTransition('refresh');
163
165
  refreshStatus.value = 'loading';
164
166
  distance.value = maxDistance.value * 0.3;
165
167
  call(props['onUpdate:modelValue'], true);
@@ -181,7 +183,7 @@ var __sfc__ = defineComponent({
181
183
  });
182
184
 
183
185
  return function touchEnd() {
184
- return _ref.apply(this, arguments);
186
+ return _ref2.apply(this, arguments);
185
187
  };
186
188
  }();
187
189
 
@@ -213,7 +215,6 @@ var __sfc__ = defineComponent({
213
215
  return {
214
216
  n,
215
217
  classes,
216
- iconHasChanged,
217
218
  ICON_TRANSITION,
218
219
  refreshStatus,
219
220
  freshNode,
@@ -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'