@varlet/ui 2.11.6 → 2.11.8

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.11.6'
244
+ const version = '2.11.8'
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.11.6'
163
+ const version = '2.11.8'
164
164
 
165
165
  function install(app) {
166
166
  ActionSheet.install && app.use(ActionSheet)
@@ -1,12 +1,14 @@
1
- import { isVNode as _isVNode, withDirectives as _withDirectives, vShow as _vShow, mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
1
+ import { isVNode as _isVNode, withDirectives as _withDirectives, mergeProps as _mergeProps, vShow as _vShow, createVNode as _createVNode } from "vue";
2
2
 
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
4
4
 
5
- import { defineComponent, watch, Transition, Teleport } from 'vue';
5
+ import { defineComponent, watch, Transition, Teleport, computed } from 'vue';
6
6
  import { props } from './props.mjs';
7
7
  import { useLock } from '../context/lock.mjs';
8
8
  import { useZIndex } from '../context/zIndex.mjs';
9
9
  import { useRouteListener, useTeleport, createNamespace, call } from '../utils/components.mjs';
10
+ import { usePopupItems } from './provide.mjs';
11
+ import { useInitialized } from '@varlet/use';
10
12
 
11
13
 
12
14
 
@@ -28,12 +30,16 @@ export default defineComponent({
28
30
  slots,
29
31
  attrs
30
32
  } = _ref;
33
+ var rendered = useInitialized(() => props.show, true);
31
34
  var {
32
35
  zIndex
33
36
  } = useZIndex(() => props.show, 3);
34
37
  var {
35
38
  disabled
36
39
  } = useTeleport();
40
+ var {
41
+ bindPopupItems
42
+ } = usePopupItems();
37
43
 
38
44
  var hidePopup = () => {
39
45
  var {
@@ -49,13 +55,6 @@ export default defineComponent({
49
55
  call(props['onUpdate:show'], false);
50
56
  };
51
57
 
52
- useLock(() => props.show, () => props.lockScroll);
53
- watch(() => props.show, newValue => {
54
- newValue ? call(props.onOpen) : call(props.onClose);
55
- }); // internal for Dialog
56
-
57
- useRouteListener(() => call(props.onRouteChange));
58
-
59
58
  var renderOverlay = () => {
60
59
  var {
61
60
  overlayClass = '',
@@ -71,54 +70,57 @@ export default defineComponent({
71
70
  };
72
71
 
73
72
  var renderContent = () => {
74
- return _createVNode("div", _mergeProps({
73
+ return _withDirectives(_createVNode("div", _mergeProps({
75
74
  "class": classes(n('content'), n("--" + props.position), [props.defaultStyle, n('--content-background-color')], [props.defaultStyle, n('$-elevation--3')], [props.safeArea, n('--safe-area')], [props.safeAreaTop, n('--safe-area-top')]),
76
75
  "style": {
77
76
  zIndex: zIndex.value
78
77
  }
79
- }, attrs), [call(slots.default)]);
78
+ }, attrs), [rendered.value && call(slots.default)]), [[_vShow, props.show]]);
80
79
  };
81
80
 
82
81
  var renderPopup = () => {
83
- var {
84
- onOpened,
85
- onClosed,
86
- show,
87
- overlay,
88
- transition,
89
- position
90
- } = props;
82
+ var _slot;
83
+
91
84
  return _createVNode(Transition, {
92
85
  "name": n('$-fade'),
93
- "onAfterEnter": onOpened,
94
- "onAfterLeave": onClosed
86
+ "onAfterEnter": props.onOpened,
87
+ "onAfterLeave": props.onClosed
95
88
  }, {
96
89
  default: () => [_withDirectives(_createVNode("div", {
97
90
  "class": classes(n('$--box'), n()),
98
91
  "style": {
99
92
  zIndex: zIndex.value - 2
100
93
  }
101
- }, [overlay && renderOverlay(), _createVNode(Transition, {
102
- "name": transition || n("$-pop-" + position)
103
- }, {
104
- default: () => [show && renderContent()]
105
- })]), [[_vShow, show]])]
94
+ }, [props.overlay && renderOverlay(), _createVNode(Transition, {
95
+ "name": props.transition || n("$-pop-" + props.position)
96
+ }, _isSlot(_slot = renderContent()) ? _slot : {
97
+ default: () => [_slot]
98
+ })]), [[_vShow, props.show]])]
106
99
  });
107
100
  };
108
101
 
102
+ useLock(() => props.show, () => props.lockScroll);
103
+ watch(() => props.show, newValue => {
104
+ newValue ? call(props.onOpen) : call(props.onClose);
105
+ });
106
+ bindPopupItems({
107
+ show: computed(() => props.show)
108
+ }); // internal for Dialog
109
+
110
+ useRouteListener(() => call(props.onRouteChange));
109
111
  return () => {
110
112
  var {
111
113
  teleport
112
114
  } = props;
113
115
 
114
116
  if (teleport) {
115
- var _slot;
117
+ var _slot2;
116
118
 
117
119
  return _createVNode(Teleport, {
118
120
  "to": teleport,
119
121
  "disabled": disabled.value
120
- }, _isSlot(_slot = renderPopup()) ? _slot : {
121
- default: () => [_slot]
122
+ }, _isSlot(_slot2 = renderPopup()) ? _slot2 : {
123
+ default: () => [_slot2]
122
124
  });
123
125
  }
124
126
 
@@ -0,0 +1,26 @@
1
+ import { useChildren, useParent } from '@varlet/use';
2
+ export var POPUP_BIND_POPUP_ITEM_KEY = Symbol('POPUP_BIND_POPUP_ITEM_KEY');
3
+ export function usePopup() {
4
+ var {
5
+ bindParent,
6
+ parentProvider,
7
+ index
8
+ } = useParent(POPUP_BIND_POPUP_ITEM_KEY);
9
+ return {
10
+ index,
11
+ popup: parentProvider,
12
+ bindPopup: bindParent
13
+ };
14
+ }
15
+ export function usePopupItems() {
16
+ var {
17
+ bindChildren,
18
+ childProviders,
19
+ length
20
+ } = useChildren(POPUP_BIND_POPUP_ITEM_KEY);
21
+ return {
22
+ length,
23
+ popupItems: childProviders,
24
+ bindPopupItems: bindChildren
25
+ };
26
+ }
@@ -1 +1 @@
1
- :root { --progress-font-size: var(--font-size-sm); --progress-ripple-color: #fff; --progress-track-color: #d8d8d8; --progress-background: var(--color-primary);}.var-progress { position: relative; font-size: var(--progress-font-size);}.var-progress__linear { display: flex; align-items: center;}.var-progress__linear-block { flex: 1; position: relative; overflow: hidden; height: 4px;}.var-progress__linear-background,.var-progress__linear-certain { width: 100%; height: 100%;}.var-progress__linear-ripple::after { position: absolute; width: 0; background-color: var(--progress-ripple-color); height: 100%; opacity: 0; animation: ripple 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite; content: '';}.var-progress__linear-background { background-color: var(--progress-track-color);}.var-progress__linear-certain { position: absolute; background-color: var(--progress-background); top: 0; left: 0; transition: all 0.2s, background-color 0.8s;}.var-progress__linear-label { margin-left: 8px; flex: 0;}@keyframes ripple { 0% { width: 0; opacity: 0.1; } 20% { width: 0; opacity: 0.5; } 80% { width: 100%; opacity: 0; }}.var-progress__circle { position: relative; width: 40px; height: 40px;}.var-progress__circle-background { stroke: var(--progress-track-color);}.var-progress__circle-certain { transition: all 0.2s; stroke: var(--progress-background); position: absolute;}.var-progress__circle-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);}
1
+ :root { --progress-font-size: var(--font-size-sm); --progress-ripple-color: #fff; --progress-track-color: #d8d8d8; --progress-label-color: #555; --progress-background: var(--color-primary);}.var-progress { position: relative; font-size: var(--progress-font-size);}.var-progress__linear { display: flex; align-items: center;}.var-progress__linear-block { flex: 1; position: relative; overflow: hidden; height: 4px;}.var-progress__linear-background,.var-progress__linear-certain { width: 100%; height: 100%;}.var-progress__linear-ripple::after { position: absolute; width: 0; background-color: var(--progress-ripple-color); height: 100%; opacity: 0; animation: ripple 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite; content: '';}.var-progress__linear-background { background-color: var(--progress-track-color);}.var-progress__linear-certain { position: absolute; background-color: var(--progress-background); top: 0; left: 0; transition: all 0.2s, background-color 0.8s;}.var-progress__linear-label { margin-left: 8px; flex: 0; color: var(--progress-label-color);}@keyframes ripple { 0% { width: 0; opacity: 0.1; } 20% { width: 0; opacity: 0.5; } 80% { width: 100%; opacity: 0; }}.var-progress__circle { position: relative; width: 40px; height: 40px;}.var-progress__circle-background { stroke: var(--progress-track-color);}.var-progress__circle-certain { transition: all 0.2s; stroke: var(--progress-background); position: absolute;}.var-progress__circle-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--progress-label-color);}