@varlet/ui 3.3.6 → 3.3.7-alpha.1721326819975

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.
package/README.md CHANGED
@@ -148,14 +148,6 @@ We recommend that [issue](https://github.com/varletjs/varlet/issues) be used for
148
148
  <img src="https://cdn.jsdelivr.net/gh/varletjs/varlet-static/sponsorkit/sponsors.svg">
149
149
  </a>
150
150
 
151
- ### Sponsor this project
152
-
153
- Sponsor this project to support our better creation. It is recommended to use afdian to subscribe, and your avatar will appear in this project.
154
-
155
- #### Afdian
156
-
157
- <a href="https://afdian.net/a/haoziqaq">https://afdian.net/a/haoziqaq</a>
158
-
159
151
  #### Wechat / Alipay
160
152
 
161
153
  <img style="width: 25%" src="https://cdn.jsdelivr.net/gh/varletjs/varlet-static/wechat.jpg" />
package/README.zh-CN.md CHANGED
@@ -150,11 +150,7 @@ createApp(App).use(Varlet).mount('#app')
150
150
 
151
151
  ### 赞助本项目
152
152
 
153
- 赞助本项目,支持我们更好的创作。推荐使用爱发电进行订阅,您的头像将出现在本项目中。
154
-
155
- #### 爱发电
156
-
157
- <a href="https://afdian.net/a/haoziqaq">https://afdian.net/a/haoziqaq</a>
153
+ 赞助本项目,支持我们更好的创作。
158
154
 
159
155
  #### 微信 / 支付宝
160
156
 
package/es/card/Card.mjs CHANGED
@@ -99,6 +99,18 @@ function __render__(_ctx, _cache) {
99
99
  /* TEXT, CLASS */
100
100
  )) : _createCommentVNode("v-if", true)
101
101
  ]),
102
+ _ctx.$slots.default ? (_openBlock(), _createElementBlock(
103
+ "div",
104
+ {
105
+ key: 0,
106
+ class: _normalizeClass(_ctx.n("content"))
107
+ },
108
+ [
109
+ _renderSlot(_ctx.$slots, "default")
110
+ ],
111
+ 2
112
+ /* CLASS */
113
+ )) : _createCommentVNode("v-if", true),
102
114
  _renderSlot(_ctx.$slots, "subtitle", {
103
115
  slotClass: _ctx.n("subtitle")
104
116
  }, () => [
@@ -130,7 +142,7 @@ function __render__(_ctx, _cache) {
130
142
  _ctx.$slots.extra ? (_openBlock(), _createElementBlock(
131
143
  "div",
132
144
  {
133
- key: 0,
145
+ key: 1,
134
146
  class: _normalizeClass(_ctx.n("footer"))
135
147
  },
136
148
  [
@@ -142,7 +154,7 @@ function __render__(_ctx, _cache) {
142
154
  _ctx.$slots["floating-content"] && !_ctx.isRow ? (_openBlock(), _createElementBlock(
143
155
  "div",
144
156
  {
145
- key: 1,
157
+ key: 2,
146
158
  class: _normalizeClass(_ctx.n("floating-content")),
147
159
  style: _normalizeStyle({
148
160
  height: _ctx.contentHeight,
package/es/card/card.css CHANGED
@@ -1 +1 @@
1
- :root { --card-padding: 0 0 15px 0; --card-background: var(--color-surface-container-highest); --card-outline-color: var(--color-outline); --card-border-radius: 4px; --card-image-width: 100%; --card-row-image-width: 140px; --card-image-height: 200px; --card-row-height: 140px; --card-title-color: #333; --card-title-font-size: 20px; --card-title-padding: 0 12px; --card-title-margin: 15px 0 0 0; --card-title-row-margin: 12px 0; --card-subtitle-color: rgba(0, 0, 0, 0.6); --card-subtitle-font-size: 14px; --card-subtitle-padding: 0 12px; --card-subtitle-margin: 10px 0 0 0; --card-subtitle-row-margin: -8px 0 0 0; --card-description-color: rgba(0, 0, 0, 0.6); --card-description-font-size: 14px; --card-description-margin: 20px 0 0 0; --card-description-padding: 0 13px; --card-footer-padding: 0 12px; --card-footer-right: 13px; --card-footer-bottom: 9px; --card-footer-margin: 30px 0 0 0; --card-line-height: 22px; --card-row-line-height: 1.5; --card-floating-buttons-bottom: 16px; --card-floating-buttons-right: 16px; --card-floating-buttons-color: #fff; --card-close-button-icon-size: 24px; --card-close-button-size: 56px; --card-close-button-primary-color: #212121; --card-close-button-text-color: #fff; --card-close-button-border-radius: 50%;}.var-card { border-radius: var(--card-border-radius); overflow: hidden; width: 100%;}.var-card__floater { display: flex; flex-direction: column; position: static; line-height: var(--card-line-height); background: var(--card-background); transition: background-color 0.25s, color 0.25s; transition-timing-function: cubic-bezier(0.45, 0.19, 0.06, 0.89);}.var-card__container { padding: var(--card-padding); flex-grow: 1; min-width: 0;}.var-card--layout-row .var-card__floater { min-height: var(--card-row-height); height: 100%; flex-direction: row; position: relative; line-height: var(--card-row-line-height);}.var-card__image { width: var(--card-image-width); height: var(--card-image-height); display: block; transition: all 0.25s;}.var-card--layout-row .var-card__image { width: var(--card-row-image-width); height: auto; display: block; flex-shrink: 0;}.var-card__title { font-size: var(--card-title-font-size); padding: var(--card-title-padding); margin: var(--card-title-margin); color: var(--card-title-color); word-break: break-word; transition: padding 0.25s, margin 0.25s, font-size 0.25s;}.var-card--layout-row .var-card__title { max-width: 100%; overflow: hidden; margin: var(--card-title-row-margin); text-overflow: ellipsis; white-space: nowrap;}.var-card__subtitle { font-size: var(--card-subtitle-font-size); color: var(--card-subtitle-color); padding: var(--card-subtitle-padding); margin: var(--card-subtitle-margin); word-break: break-word; transition: padding 0.25s, margin 0.25s, font-size 0.25s;}.var-card--layout-row .var-card__subtitle { margin: var(--card-subtitle-row-margin); text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;}.var-card__description { font-size: var(--card-description-font-size); color: var(--card-description-color); margin: var(--card-description-margin); padding: var(--card-description-padding); word-break: break-all; transition: padding 0.25s, margin 0.25s, font-size 0.25s;}.var-card__footer { display: flex; justify-content: flex-end; padding: var(--card-footer-padding); margin: var(--card-footer-margin); transition: all 0.25s;}.var-card--layout-row .var-card__footer { position: absolute; padding: 0; right: var(--card-footer-right); bottom: var(--card-footer-bottom);}.var-card__floating-content { overflow: hidden; transition-timing-function: cubic-bezier(0.45, 0.19, 0.06, 0.89);}.var-card__floating-buttons { position: fixed; bottom: var(--card-floating-buttons-bottom); right: var(--card-floating-buttons-right); color: var(--card-floating-buttons-color);}.var-card__close-button[var-card-cover] { width: var(--card-close-button-size); height: var(--card-close-button-size); background-color: var(--card-close-button-primary-color); color: var(--card-close-button-text-color); border-radius: var(--card-close-button-border-radius);}.var-card__close-button-icon[var-card-cover] { font-size: var(--card-close-button-icon-size);}.var-card--outline { border: thin solid var(--card-outline-color);}
1
+ :root { --card-padding: 0 0 15px 0; --card-background: var(--color-surface-container-highest); --card-outline-color: var(--color-outline); --card-border-radius: 4px; --card-image-width: 100%; --card-row-image-width: 140px; --card-image-height: 200px; --card-row-height: 140px; --card-title-color: #333; --card-title-font-size: 20px; --card-title-padding: 0 12px; --card-title-margin: 15px 0 0 0; --card-title-row-margin: 12px 0; --card-content-padding: 0 16px; --card-content-margin: 16px 0 0 0; --card-content-color: var(--color-on-surface-variant); --card-content-font-size: 14px; --card-content-row-margin: 16px 0 0 0; --card-subtitle-color: rgba(0, 0, 0, 0.6); --card-subtitle-font-size: 14px; --card-subtitle-padding: 0 12px; --card-subtitle-margin: 10px 0 0 0; --card-subtitle-row-margin: -8px 0 0 0; --card-description-color: rgba(0, 0, 0, 0.6); --card-description-font-size: 14px; --card-description-margin: 20px 0 0 0; --card-description-padding: 0 13px; --card-footer-padding: 0 12px; --card-footer-right: 13px; --card-footer-bottom: 9px; --card-footer-margin: 30px 0 0 0; --card-line-height: 22px; --card-row-line-height: 1.5; --card-floating-buttons-bottom: 16px; --card-floating-buttons-right: 16px; --card-floating-buttons-color: #fff; --card-close-button-icon-size: 24px; --card-close-button-size: 56px; --card-close-button-primary-color: #212121; --card-close-button-text-color: #fff; --card-close-button-border-radius: 50%;}.var-card { border-radius: var(--card-border-radius); overflow: hidden; width: 100%;}.var-card__floater { display: flex; flex-direction: column; position: static; line-height: var(--card-line-height); background: var(--card-background); transition: background-color 0.25s, color 0.25s; transition-timing-function: cubic-bezier(0.45, 0.19, 0.06, 0.89);}.var-card__container { padding: var(--card-padding); flex-grow: 1; min-width: 0;}.var-card--layout-row .var-card__floater { min-height: var(--card-row-height); height: 100%; flex-direction: row; position: relative; line-height: var(--card-row-line-height);}.var-card__content { padding: var(--card-content-padding); margin: var(--card-content-margin); font-size: var(--card-content-font-size); color: var(--card-content-color); transition: padding 0.25s, margin 0.25s, font-size 0.25s;}.var-card--layout-row .var-card__content { max-width: 100%; margin: var(--card-title-row-margin);}.var-card__image { width: var(--card-image-width); height: var(--card-image-height); display: block; transition: all 0.25s;}.var-card--layout-row .var-card__image { width: var(--card-row-image-width); height: auto; display: block; flex-shrink: 0;}.var-card__title { font-size: var(--card-title-font-size); padding: var(--card-title-padding); margin: var(--card-title-margin); color: var(--card-title-color); word-break: break-word; transition: padding 0.25s, margin 0.25s, font-size 0.25s;}.var-card--layout-row .var-card__title { max-width: 100%; overflow: hidden; margin: var(--card-title-row-margin); text-overflow: ellipsis; white-space: nowrap;}.var-card__subtitle { font-size: var(--card-subtitle-font-size); color: var(--card-subtitle-color); padding: var(--card-subtitle-padding); margin: var(--card-subtitle-margin); word-break: break-word; transition: padding 0.25s, margin 0.25s, font-size 0.25s;}.var-card--layout-row .var-card__subtitle { margin: var(--card-subtitle-row-margin); text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;}.var-card__description { font-size: var(--card-description-font-size); color: var(--card-description-color); margin: var(--card-description-margin); padding: var(--card-description-padding); word-break: break-all; transition: padding 0.25s, margin 0.25s, font-size 0.25s;}.var-card__footer { display: flex; justify-content: flex-end; padding: var(--card-footer-padding); margin: var(--card-footer-margin); transition: all 0.25s;}.var-card--layout-row .var-card__footer { position: absolute; padding: 0; right: var(--card-footer-right); bottom: var(--card-footer-bottom);}.var-card__floating-content { overflow: hidden; transition-timing-function: cubic-bezier(0.45, 0.19, 0.06, 0.89);}.var-card__floating-buttons { position: fixed; bottom: var(--card-floating-buttons-bottom); right: var(--card-floating-buttons-right); color: var(--card-floating-buttons-color);}.var-card__close-button[var-card-cover] { width: var(--card-close-button-size); height: var(--card-close-button-size); background-color: var(--card-close-button-primary-color); color: var(--card-close-button-text-color); border-radius: var(--card-close-button-border-radius);}.var-card__close-button-icon[var-card-cover] { font-size: var(--card-close-button-icon-size);}.var-card--outline { border: thin solid var(--card-outline-color);}
@@ -1,8 +1,10 @@
1
1
  import context from "./index.mjs";
2
2
  import { watch, onBeforeMount, onUnmounted, onDeactivated, onActivated, getCurrentInstance } from "vue";
3
+ import { createNamespace } from "../utils/components.mjs";
4
+ const { n } = createNamespace("");
3
5
  function resolveLock() {
4
6
  const lockCounts = Object.keys(context.locks).length;
5
- lockCounts <= 0 ? document.body.classList.remove("var--lock") : document.body.classList.add("var--lock");
7
+ lockCounts <= 0 ? document.body.classList.remove(n("$--lock")) : document.body.classList.add(n("$--lock"));
6
8
  }
7
9
  function addLock(uid) {
8
10
  context.locks[uid] = 1;
@@ -265,7 +265,7 @@ import './tooltip/style/index.mjs'
265
265
  import './uploader/style/index.mjs'
266
266
  import './watermark/style/index.mjs'
267
267
 
268
- const version = '3.3.6'
268
+ const version = '3.3.7-alpha.1721326819975'
269
269
 
270
270
  function install(app) {
271
271
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -176,7 +176,7 @@ export * from './tooltip/index.mjs'
176
176
  export * from './uploader/index.mjs'
177
177
  export * from './watermark/index.mjs'
178
178
 
179
- const version = '3.3.6'
179
+ const version = '3.3.7-alpha.1721326819975'
180
180
 
181
181
  function install(app) {
182
182
  ActionSheet.install && app.use(ActionSheet)
@@ -4,16 +4,17 @@ import Hover from "../hover/index.mjs";
4
4
  import VarHoverOverlay, { useHoverOverlay } from "../hover-overlay/index.mjs";
5
5
  import { defineComponent, computed, ref, watch } from "vue";
6
6
  import { useMenuSelect } from "./provide.mjs";
7
- import { createNamespace } from "../utils/components.mjs";
7
+ import { createNamespace, MaybeVNode } from "../utils/components.mjs";
8
8
  import { props } from "./props.mjs";
9
- import { preventDefault } from "@varlet/shared";
9
+ import { preventDefault, isFunction } from "@varlet/shared";
10
10
  import { useEventListener } from "@varlet/use";
11
11
  const { name, n, classes } = createNamespace("menu-option");
12
- import { normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withModifiers as _withModifiers, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createVNode as _createVNode, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
12
+ import { normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withModifiers as _withModifiers, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, createVNode as _createVNode, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
13
13
  const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
14
14
  const _hoisted_1 = ["tabindex"];
15
15
  function __render__(_ctx, _cache) {
16
16
  const _component_var_checkbox = _resolveComponent("var-checkbox");
17
+ const _component_maybe_v_node = _resolveComponent("maybe-v-node");
17
18
  const _component_var_hover_overlay = _resolveComponent("var-hover-overlay");
18
19
  const _directive_ripple = _resolveDirective("ripple");
19
20
  const _directive_hover = _resolveDirective("hover");
@@ -52,9 +53,11 @@ function __render__(_ctx, _cache) {
52
53
  {
53
54
  class: _normalizeClass(_ctx.classes(_ctx.n("text"), _ctx.n("$--ellipsis")))
54
55
  },
55
- _toDisplayString(_ctx.label),
56
- 3
57
- /* TEXT, CLASS */
56
+ [
57
+ _createVNode(_component_maybe_v_node, { is: _ctx.labelVNode }, null, 8, ["is"])
58
+ ],
59
+ 2
60
+ /* CLASS */
58
61
  )
59
62
  ]),
60
63
  _createVNode(_component_var_hover_overlay, {
@@ -71,7 +74,8 @@ const __sfc__ = defineComponent({
71
74
  directives: { Ripple, Hover },
72
75
  components: {
73
76
  VarCheckbox,
74
- VarHoverOverlay
77
+ VarHoverOverlay,
78
+ MaybeVNode
75
79
  },
76
80
  props,
77
81
  setup(props2) {
@@ -79,13 +83,26 @@ const __sfc__ = defineComponent({
79
83
  const isFocusing = ref(false);
80
84
  const optionSelected = ref(false);
81
85
  const selected = computed(() => optionSelected.value);
82
- const label = computed(() => props2.label);
86
+ const labelVNode = computed(
87
+ () => {
88
+ var _a;
89
+ return isFunction(props2.label) ? props2.label(
90
+ (_a = props2.option) != null ? _a : {
91
+ label: props2.label,
92
+ value: props2.value,
93
+ disabled: props2.disabled,
94
+ ripple: props2.ripple
95
+ },
96
+ optionSelected.value
97
+ ) : props2.label;
98
+ }
99
+ );
83
100
  const value = computed(() => props2.value);
84
101
  const { menuSelect, bindMenuSelect } = useMenuSelect();
85
102
  const { size, multiple, onSelect, computeLabel } = menuSelect;
86
103
  const { hovering, handleHovering } = useHoverOverlay();
87
104
  const menuOptionProvider = {
88
- label,
105
+ label: labelVNode,
89
106
  value,
90
107
  selected,
91
108
  sync
@@ -136,6 +153,7 @@ const __sfc__ = defineComponent({
136
153
  multiple,
137
154
  hovering,
138
155
  isFocusing,
156
+ labelVNode,
139
157
  n,
140
158
  classes,
141
159
  handleHovering,
@@ -5,7 +5,9 @@ const props = {
5
5
  ripple: {
6
6
  type: Boolean,
7
7
  default: true
8
- }
8
+ },
9
+ // internal
10
+ option: Object
9
11
  };
10
12
  export {
11
13
  props
@@ -1,15 +1,17 @@
1
1
  import VarMenu from "../menu/index.mjs";
2
+ import VarMenuOption from "../menu-option/index.mjs";
2
3
  import { defineComponent, computed, ref } from "vue";
3
4
  import { props } from "./props.mjs";
4
5
  import { createNamespace, formatElevation } from "../utils/components.mjs";
5
6
  import { useMenuOptions } from "./provide.mjs";
6
7
  import { useSelectController } from "../select/useSelectController.mjs";
7
- import { call, preventDefault } from "@varlet/shared";
8
+ import { call, isArray, preventDefault } from "@varlet/shared";
8
9
  import { useEventListener, useVModel } from "@varlet/use";
9
10
  import { focusChildElementByKey } from "../utils/elements.mjs";
10
11
  const { name, n, classes } = createNamespace("menu-select");
11
- import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue";
12
+ import { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createBlock as _createBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, withCtx as _withCtx } from "vue";
12
13
  function __render__(_ctx, _cache) {
14
+ const _component_var_menu_option = _resolveComponent("var-menu-option");
13
15
  const _component_var_menu = _resolveComponent("var-menu");
14
16
  return _openBlock(), _createBlock(_component_var_menu, {
15
17
  ref: "menu",
@@ -45,6 +47,22 @@ function __render__(_ctx, _cache) {
45
47
  class: _normalizeClass(_ctx.classes(_ctx.n("menu"), _ctx.formatElevation(_ctx.elevation, 3), [_ctx.scrollable, _ctx.n("--scrollable")]))
46
48
  },
47
49
  [
50
+ _ctx.menuSelectOptions.length ? (_openBlock(true), _createElementBlock(
51
+ _Fragment,
52
+ { key: 0 },
53
+ _renderList(_ctx.menuSelectOptions, (option) => {
54
+ return _openBlock(), _createBlock(_component_var_menu_option, {
55
+ key: option[_ctx.valueKey],
56
+ label: option[_ctx.labelKey],
57
+ value: option[_ctx.valueKey],
58
+ option,
59
+ ripple: option.ripple,
60
+ disabled: option.disabled
61
+ }, null, 8, ["label", "value", "option", "ripple", "disabled"]);
62
+ }),
63
+ 128
64
+ /* KEYED_FRAGMENT */
65
+ )) : _createCommentVNode("v-if", true),
48
66
  _renderSlot(_ctx.$slots, "options")
49
67
  ],
50
68
  2
@@ -60,12 +78,13 @@ function __render__(_ctx, _cache) {
60
78
  }
61
79
  const __sfc__ = defineComponent({
62
80
  name,
63
- components: { VarMenu },
81
+ components: { VarMenu, VarMenuOption },
64
82
  props,
65
83
  setup(props2) {
66
84
  const menu = ref(null);
67
85
  const menuOptionsRef = ref(null);
68
86
  const show = useVModel(props2, "show");
87
+ const menuSelectOptions = computed(() => isArray(props2.options) ? props2.options : []);
69
88
  const { menuOptions, length, bindMenuOptions } = useMenuOptions();
70
89
  const { computeLabel, getSelectedValue } = useSelectController({
71
90
  modelValue: () => props2.modelValue,
@@ -122,6 +141,7 @@ const __sfc__ = defineComponent({
122
141
  show,
123
142
  menu,
124
143
  menuOptionsRef,
144
+ menuSelectOptions,
125
145
  n,
126
146
  classes,
127
147
  formatElevation,
@@ -21,6 +21,15 @@ const props = __spreadValues({
21
21
  type: [String, Number, Boolean, Array],
22
22
  default: void 0
23
23
  },
24
+ options: Array,
25
+ labelKey: {
26
+ type: String,
27
+ default: "label"
28
+ },
29
+ valueKey: {
30
+ type: String,
31
+ default: "value"
32
+ },
24
33
  size: {
25
34
  type: String,
26
35
  default: "normal"
@@ -1,5 +1,6 @@
1
1
  import '../../styles/elevation.css'
2
2
  import '../../styles/common.css'
3
3
  import '../../menu/menu.css'
4
+ import '../../menu-option/menuOption.css'
4
5
  import '../menuSelect.css'
5
6
  import '../MenuSelectSfc.css'