@varlet/ui 2.22.0 → 2.22.1-alpha.1706370837642

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.
@@ -1,7 +1,7 @@
1
1
  import Ripple from "../ripple/index.mjs";
2
2
  import VarBadge from "../badge/index.mjs";
3
3
  import VarIcon from "../icon/index.mjs";
4
- import { defineComponent, computed, ref, watch } from "vue";
4
+ import { defineComponent, computed } from "vue";
5
5
  import { props } from "./props.mjs";
6
6
  import { useBottomNavigation } from "./provide.mjs";
7
7
  import { createNamespace } from "../utils/components.mjs";
@@ -11,7 +11,7 @@ const defaultBadgeProps = {
11
11
  type: "danger",
12
12
  dot: true
13
13
  };
14
- import { resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, mergeProps as _mergeProps, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, Fragment as _Fragment, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives } from "vue";
14
+ import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, mergeProps as _mergeProps, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives } from "vue";
15
15
  function __render__(_ctx, _cache) {
16
16
  const _component_var_icon = _resolveComponent("var-icon");
17
17
  const _component_var_badge = _resolveComponent("var-badge");
@@ -19,24 +19,23 @@ function __render__(_ctx, _cache) {
19
19
  return _withDirectives((_openBlock(), _createElementBlock(
20
20
  "button",
21
21
  {
22
- class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n("$--box"), [_ctx.active === _ctx.index || _ctx.active === _ctx.name, _ctx.n("--active")])),
22
+ class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n("$--box"), [_ctx.isActive, _ctx.n("--active")])),
23
23
  style: _normalizeStyle({
24
- color: _ctx.computeColorStyle()
24
+ color: _ctx.isActive ? _ctx.activeColor : _ctx.inactiveColor
25
25
  }),
26
26
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
27
27
  },
28
28
  [
29
- _ctx.icon && !_ctx.$slots.icon ? (_openBlock(), _createBlock(_component_var_icon, {
30
- key: 0,
31
- name: _ctx.icon,
32
- namespace: _ctx.namespace,
33
- class: _normalizeClass(_ctx.n("icon")),
34
- "var-bottom-navigation-item-cover": ""
35
- }, null, 8, ["name", "namespace", "class"])) : _createCommentVNode("v-if", true),
36
- _renderSlot(_ctx.$slots, "icon", {
37
- active: _ctx.active === _ctx.index || _ctx.active === _ctx.name
38
- }),
39
- _ctx.badge ? (_openBlock(), _createBlock(_component_var_badge, _mergeProps({ key: 1 }, _ctx.badgeProps, {
29
+ _renderSlot(_ctx.$slots, "icon", { active: _ctx.isActive }, () => [
30
+ _ctx.icon ? (_openBlock(), _createBlock(_component_var_icon, {
31
+ key: 0,
32
+ name: _ctx.icon,
33
+ namespace: _ctx.namespace,
34
+ class: _normalizeClass(_ctx.n("icon")),
35
+ "var-bottom-navigation-item-cover": ""
36
+ }, null, 8, ["name", "namespace", "class"])) : _createCommentVNode("v-if", true)
37
+ ]),
38
+ _ctx.badge ? (_openBlock(), _createBlock(_component_var_badge, _mergeProps({ key: 0 }, _ctx.badgeProps, {
40
39
  class: _ctx.n("badge"),
41
40
  "var-bottom-navigation-item-cover": ""
42
41
  }), null, 16, ["class"])) : _createCommentVNode("v-if", true),
@@ -46,20 +45,13 @@ function __render__(_ctx, _cache) {
46
45
  class: _normalizeClass(_ctx.n("label"))
47
46
  },
48
47
  [
49
- !_ctx.$slots.default ? (_openBlock(), _createElementBlock(
50
- _Fragment,
51
- { key: 0 },
52
- [
53
- _createTextVNode(
54
- _toDisplayString(_ctx.label),
55
- 1
56
- /* TEXT */
57
- )
58
- ],
59
- 64
60
- /* STABLE_FRAGMENT */
61
- )) : _createCommentVNode("v-if", true),
62
- _renderSlot(_ctx.$slots, "default")
48
+ _renderSlot(_ctx.$slots, "default", {}, () => [
49
+ _createTextVNode(
50
+ _toDisplayString(_ctx.label),
51
+ 1
52
+ /* TEXT */
53
+ )
54
+ ])
63
55
  ],
64
56
  2
65
57
  /* CLASS */
@@ -81,8 +73,8 @@ const __sfc__ = defineComponent({
81
73
  props,
82
74
  setup(props2) {
83
75
  const name2 = computed(() => props2.name);
84
- const badge = computed(() => props2.badge);
85
- const badgeProps = ref({});
76
+ const isActive = computed(() => [name2.value, index.value].includes(active.value));
77
+ const badgeProps = computed(() => props2.badge === true ? defaultBadgeProps : props2.badge);
86
78
  const { index, bottomNavigation, bindBottomNavigation } = useBottomNavigation();
87
79
  const { active, activeColor, inactiveColor } = bottomNavigation;
88
80
  const bottomNavigationItemProvider = {
@@ -90,16 +82,6 @@ const __sfc__ = defineComponent({
90
82
  index
91
83
  };
92
84
  bindBottomNavigation(bottomNavigationItemProvider);
93
- watch(
94
- () => badge.value,
95
- (newValue) => {
96
- badgeProps.value = newValue === true ? defaultBadgeProps : badge.value;
97
- },
98
- { immediate: true }
99
- );
100
- function computeColorStyle() {
101
- return active.value === name2.value || active.value === index.value ? activeColor.value : inactiveColor.value;
102
- }
103
85
  function handleClick() {
104
86
  var _a;
105
87
  const active2 = (_a = name2.value) != null ? _a : index.value;
@@ -107,13 +89,12 @@ const __sfc__ = defineComponent({
107
89
  call(bottomNavigation.onToggle, active2);
108
90
  }
109
91
  return {
110
- index,
111
- active,
112
- badge,
92
+ activeColor,
93
+ inactiveColor,
113
94
  badgeProps,
95
+ isActive,
114
96
  n,
115
97
  classes,
116
- computeColorStyle,
117
98
  handleClick
118
99
  };
119
100
  }
@@ -262,7 +262,7 @@ import './tooltip/style/index.mjs'
262
262
  import './uploader/style/index.mjs'
263
263
  import './watermark/style/index.mjs'
264
264
 
265
- const version = '2.22.0'
265
+ const version = '2.22.1-alpha.1706370837642'
266
266
 
267
267
  function install(app) {
268
268
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -174,7 +174,7 @@ export * from './tooltip/index.mjs'
174
174
  export * from './uploader/index.mjs'
175
175
  export * from './watermark/index.mjs'
176
176
 
177
- const version = '2.22.0'
177
+ const version = '2.22.1-alpha.1706370837642'
178
178
 
179
179
  function install(app) {
180
180
  ActionSheet.install && app.use(ActionSheet)