@varlet/ui 3.3.3 → 3.3.4

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
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "3.3.3",
4
+ "version": "3.3.4",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -5997,6 +5997,33 @@
5997
5997
  "kind": "expression"
5998
5998
  }
5999
5999
  },
6000
+ {
6001
+ "name": "options _**3.3.4**_",
6002
+ "description": "Specifies options",
6003
+ "default": "-",
6004
+ "value": {
6005
+ "type": "SelectOption[]",
6006
+ "kind": "expression"
6007
+ }
6008
+ },
6009
+ {
6010
+ "name": "label-key _**3.3.4**_",
6011
+ "description": "As the key that uniquely identifies label",
6012
+ "default": "label",
6013
+ "value": {
6014
+ "type": "string",
6015
+ "kind": "expression"
6016
+ }
6017
+ },
6018
+ {
6019
+ "name": "value-key _**3.3.4**_",
6020
+ "description": "As the key that uniquely identifies value",
6021
+ "default": "value",
6022
+ "value": {
6023
+ "type": "string",
6024
+ "kind": "expression"
6025
+ }
6026
+ },
6000
6027
  {
6001
6028
  "name": "validate-trigger",
6002
6029
  "description": "Timing to trigger validation, optional value is `onFocus` `onBlur` `onChange` `onClick` `onClear` `onClose`",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "3.3.3",
4
+ "version": "3.3.4",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -6328,6 +6328,33 @@
6328
6328
  "kind": "expression"
6329
6329
  }
6330
6330
  },
6331
+ {
6332
+ "name": "options _**3.3.4**_",
6333
+ "description": "指定可选项",
6334
+ "default": "-",
6335
+ "value": {
6336
+ "type": "SelectOption[]",
6337
+ "kind": "expression"
6338
+ }
6339
+ },
6340
+ {
6341
+ "name": "label-key _**3.3.4**_",
6342
+ "description": "作为 label 唯一标识的键名",
6343
+ "default": "label",
6344
+ "value": {
6345
+ "type": "string",
6346
+ "kind": "expression"
6347
+ }
6348
+ },
6349
+ {
6350
+ "name": "value-key _**3.3.4**_",
6351
+ "description": "作为 value 唯一标识的键名",
6352
+ "default": "value",
6353
+ "value": {
6354
+ "type": "string",
6355
+ "kind": "expression"
6356
+ }
6357
+ },
6331
6358
  {
6332
6359
  "name": "validate-trigger",
6333
6360
  "description": "触发验证的时机,可选值为 `onFocus` `onBlur` `onChange` `onClick` `onClear` `onClose`",
package/lib/varlet.cjs.js CHANGED
@@ -41,7 +41,7 @@ var isURL = (val) => {
41
41
  }
42
42
  return /^(http)|(\.*\/)/.test(val);
43
43
  };
44
- var isEmpty = (val) => val === void 0 || val === null || val === "" || Array.isArray(val) && !val.length;
44
+ var isEmpty = (val) => val === void 0 || val === null || val === "" || isArray(val) && !val.length;
45
45
  var isWindow = (val) => val === window;
46
46
  var supportTouch = () => inBrowser() && "ontouchstart" in window;
47
47
  var inBrowser = () => typeof window !== "undefined";
@@ -388,7 +388,7 @@ function flatVNodes(subTree) {
388
388
  flat(subTree2 == null ? void 0 : subTree2.component.subTree);
389
389
  return;
390
390
  }
391
- if (Array.isArray(subTree2 == null ? void 0 : subTree2.children)) {
391
+ if (isArray(subTree2 == null ? void 0 : subTree2.children)) {
392
392
  subTree2.children.forEach((child) => {
393
393
  if (vue.isVNode(child)) {
394
394
  vNodes.push(child);
@@ -668,7 +668,7 @@ var __async$i = (__this, __arguments, generator) => {
668
668
  });
669
669
  };
670
670
  function pickProps(props2, propsKey) {
671
- return Array.isArray(propsKey) ? propsKey.reduce((pickedProps, key) => {
671
+ return isArray(propsKey) ? propsKey.reduce((pickedProps, key) => {
672
672
  pickedProps[key] = props2[key];
673
673
  return pickedProps;
674
674
  }, {}) : props2[propsKey];
@@ -3048,7 +3048,7 @@ const props$1c = {
3048
3048
  const isInternalSize$1 = (size) => ["mini", "small", "normal", "large"].includes(size);
3049
3049
  const { name: name$1c, n: n$1j, classes: classes$14 } = createNamespace("avatar");
3050
3050
  const _hoisted_1$y = ["src", "alt", "lazy-loading", "lazy-error"];
3051
- const _hoisted_2$g = ["src", "alt"];
3051
+ const _hoisted_2$f = ["src", "alt"];
3052
3052
  function __render__$1i(_ctx, _cache) {
3053
3053
  const _directive_lazy = vue.resolveDirective("lazy");
3054
3054
  return vue.openBlock(), vue.createElementBlock(
@@ -3099,7 +3099,7 @@ function __render__$1i(_ctx, _cache) {
3099
3099
  style: vue.normalizeStyle({ objectFit: _ctx.fit }),
3100
3100
  onLoad: _cache[1] || (_cache[1] = (...args) => _ctx.handleLoad && _ctx.handleLoad(...args)),
3101
3101
  onError: _cache[2] || (_cache[2] = (...args) => _ctx.handleError && _ctx.handleError(...args))
3102
- }, null, 46, _hoisted_2$g))
3102
+ }, null, 46, _hoisted_2$f))
3103
3103
  ],
3104
3104
  64
3105
3105
  /* STABLE_FRAGMENT */
@@ -3255,7 +3255,7 @@ const _hoisted_1$x = /* @__PURE__ */ _withScopeId$6(() => /* @__PURE__ */ vue.cr
3255
3255
  -1
3256
3256
  /* HOISTED */
3257
3257
  ));
3258
- const _hoisted_2$f = [
3258
+ const _hoisted_2$e = [
3259
3259
  _hoisted_1$x
3260
3260
  ];
3261
3261
  function __render__$1g(_ctx, _cache) {
@@ -3311,7 +3311,7 @@ function __render__$1g(_ctx, _cache) {
3311
3311
  color: _ctx.color
3312
3312
  })
3313
3313
  },
3314
- [..._hoisted_2$f],
3314
+ [..._hoisted_2$e],
3315
3315
  6
3316
3316
  /* CLASS, STYLE */
3317
3317
  )
@@ -5035,7 +5035,7 @@ const props$$ = {
5035
5035
  };
5036
5036
  const { name: name$$, n: n$16 } = createNamespace("form-details");
5037
5037
  const _hoisted_1$t = { key: 0 };
5038
- const _hoisted_2$e = { key: 0 };
5038
+ const _hoisted_2$d = { key: 0 };
5039
5039
  function __render__$15(_ctx, _cache) {
5040
5040
  return vue.openBlock(), vue.createBlock(vue.Transition, {
5041
5041
  name: _ctx.n()
@@ -5086,7 +5086,7 @@ function __render__$15(_ctx, _cache) {
5086
5086
  vue.renderSlot(_ctx.$slots, "extra-message", {}, () => [
5087
5087
  _ctx.extraMessage ? (vue.openBlock(), vue.createElementBlock(
5088
5088
  "div",
5089
- _hoisted_2$e,
5089
+ _hoisted_2$d,
5090
5090
  vue.toDisplayString(_ctx.extraMessage),
5091
5091
  1
5092
5092
  /* TEXT */
@@ -15125,7 +15125,7 @@ const props$G = {
15125
15125
  };
15126
15126
  const { name: name$G, n: n$J, classes: classes$B } = createNamespace("image");
15127
15127
  const _hoisted_1$n = ["alt", "title", "referrerpolicy", "lazy-loading", "lazy-error"];
15128
- const _hoisted_2$d = ["alt", "title", "referrerpolicy", "src"];
15128
+ const _hoisted_2$c = ["alt", "title", "referrerpolicy", "src"];
15129
15129
  function __render__$J(_ctx, _cache) {
15130
15130
  var _a;
15131
15131
  const _directive_lazy = vue.resolveDirective("lazy");
@@ -15168,7 +15168,7 @@ function __render__$J(_ctx, _cache) {
15168
15168
  onLoad: _cache[2] || (_cache[2] = (...args) => _ctx.handleLoad && _ctx.handleLoad(...args)),
15169
15169
  onError: _cache[3] || (_cache[3] = (...args) => _ctx.handleError && _ctx.handleError(...args)),
15170
15170
  onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
15171
- }, null, 46, _hoisted_2$d)) : vue.createCommentVNode("v-if", true),
15171
+ }, null, 46, _hoisted_2$c)) : vue.createCommentVNode("v-if", true),
15172
15172
  _ctx.showErrorSlot ? vue.renderSlot(_ctx.$slots, "error", { key: 2 }) : vue.createCommentVNode("v-if", true)
15173
15173
  ],
15174
15174
  6
@@ -15905,7 +15905,7 @@ const ANIMATION_DURATION = 200;
15905
15905
  const LONG_PRESS_DELAY = 500;
15906
15906
  const BASE_RATIO = 1;
15907
15907
  const _hoisted_1$k = ["onTouchstart"];
15908
- const _hoisted_2$c = ["src", "alt"];
15908
+ const _hoisted_2$b = ["src", "alt"];
15909
15909
  function __render__$G(_ctx, _cache) {
15910
15910
  const _component_var_swipe_item = vue.resolveComponent("var-swipe-item");
15911
15911
  const _component_var_swipe = vue.resolveComponent("var-swipe");
@@ -15968,7 +15968,7 @@ function __render__$G(_ctx, _cache) {
15968
15968
  class: vue.normalizeClass(_ctx.classes(_ctx.n("image"), [_ctx.isPreventDefault, _ctx.n("--prevent")])),
15969
15969
  src: image,
15970
15970
  alt: image
15971
- }, null, 10, _hoisted_2$c)
15971
+ }, null, 10, _hoisted_2$b)
15972
15972
  ], 46, _hoisted_1$k)
15973
15973
  ]),
15974
15974
  _: 2
@@ -16694,7 +16694,7 @@ const props$B = __spreadValues$a({
16694
16694
  ]));
16695
16695
  const { name: name$A, n: n$D, classes: classes$w } = createNamespace("input");
16696
16696
  const _hoisted_1$i = ["placeholder", "enterkeyhint"];
16697
- const _hoisted_2$b = ["id", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "rows", "enterkeyhint", "inputmode"];
16697
+ const _hoisted_2$a = ["id", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "rows", "enterkeyhint", "inputmode"];
16698
16698
  const _hoisted_3$a = ["id", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "enterkeyhint", "inputmode"];
16699
16699
  function __render__$D(_ctx, _cache) {
16700
16700
  const _component_var_field_decorator = vue.resolveComponent("var-field-decorator");
@@ -16783,7 +16783,7 @@ function __render__$D(_ctx, _cache) {
16783
16783
  onChange: _cache[3] || (_cache[3] = (...args) => _ctx.handleChange && _ctx.handleChange(...args)),
16784
16784
  onCompositionstart: _cache[4] || (_cache[4] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
16785
16785
  onCompositionend: _cache[5] || (_cache[5] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args))
16786
- }, null, 46, _hoisted_2$b)) : (vue.openBlock(), vue.createElementBlock("input", {
16786
+ }, null, 46, _hoisted_2$a)) : (vue.openBlock(), vue.createElementBlock("input", {
16787
16787
  key: 2,
16788
16788
  class: vue.normalizeClass(
16789
16789
  _ctx.classes(
@@ -18203,12 +18203,15 @@ function useSelect() {
18203
18203
  const props$s = {
18204
18204
  label: {},
18205
18205
  value: {},
18206
- disabled: Boolean
18206
+ disabled: Boolean,
18207
+ // internal
18208
+ option: Object
18207
18209
  };
18208
18210
  const { name: name$s, n: n$v, classes: classes$p } = createNamespace("option");
18209
18211
  const _hoisted_1$g = ["tabindex"];
18210
18212
  function __render__$x(_ctx, _cache) {
18211
18213
  const _component_var_checkbox = vue.resolveComponent("var-checkbox");
18214
+ const _component_maybe_v_node = vue.resolveComponent("maybe-v-node");
18212
18215
  const _component_var_hover_overlay = vue.resolveComponent("var-hover-overlay");
18213
18216
  const _directive_ripple = vue.resolveDirective("ripple");
18214
18217
  const _directive_hover = vue.resolveDirective("hover");
@@ -18252,9 +18255,11 @@ function __render__$x(_ctx, _cache) {
18252
18255
  {
18253
18256
  class: vue.normalizeClass(_ctx.classes(_ctx.n("text"), _ctx.n("$--ellipsis")))
18254
18257
  },
18255
- vue.toDisplayString(_ctx.label),
18256
- 3
18257
- /* TEXT, CLASS */
18258
+ [
18259
+ vue.createVNode(_component_maybe_v_node, { is: _ctx.labelVNode }, null, 8, ["is"])
18260
+ ],
18261
+ 2
18262
+ /* CLASS */
18258
18263
  )
18259
18264
  ]),
18260
18265
  vue.createVNode(_component_var_hover_overlay, {
@@ -18271,7 +18276,8 @@ const __sfc__$y = vue.defineComponent({
18271
18276
  directives: { Ripple: stdin_default$5W, Hover: stdin_default$5P },
18272
18277
  components: {
18273
18278
  VarCheckbox: stdin_default$59,
18274
- VarHoverOverlay: stdin_default$5Q
18279
+ VarHoverOverlay: stdin_default$5Q,
18280
+ MaybeVNode
18275
18281
  },
18276
18282
  props: props$s,
18277
18283
  setup(props2) {
@@ -18279,13 +18285,25 @@ const __sfc__$y = vue.defineComponent({
18279
18285
  const isFocusing = vue.ref(false);
18280
18286
  const optionSelected = vue.ref(false);
18281
18287
  const selected = vue.computed(() => optionSelected.value);
18282
- const label = vue.computed(() => props2.label);
18288
+ const labelVNode = vue.computed(
18289
+ () => {
18290
+ var _a;
18291
+ return isFunction(props2.label) ? props2.label(
18292
+ (_a = props2.option) != null ? _a : {
18293
+ label: props2.label,
18294
+ value: props2.value,
18295
+ disabled: props2.disabled
18296
+ },
18297
+ optionSelected.value
18298
+ ) : props2.label;
18299
+ }
18300
+ );
18283
18301
  const value = vue.computed(() => props2.value);
18284
18302
  const { select, bindSelect } = useSelect();
18285
18303
  const { multiple, focusColor, onSelect, computeLabel } = select;
18286
18304
  const { hovering, handleHovering } = useHoverOverlay();
18287
18305
  const optionProvider = {
18288
- label,
18306
+ label: labelVNode,
18289
18307
  value,
18290
18308
  selected,
18291
18309
  sync
@@ -18336,6 +18354,7 @@ const __sfc__$y = vue.defineComponent({
18336
18354
  focusColor,
18337
18355
  hovering,
18338
18356
  isFocusing,
18357
+ labelVNode,
18339
18358
  n: n$v,
18340
18359
  classes: classes$p,
18341
18360
  handleHovering,
@@ -19033,7 +19052,7 @@ const TRANSITION_DURATION = 200;
19033
19052
  const MOMENTUM_TRANSITION_DURATION = 1e3;
19034
19053
  let sid$1 = 0;
19035
19054
  const _hoisted_1$e = ["onTouchstartPassive", "onTouchmove", "onTouchend"];
19036
- const _hoisted_2$a = ["onTransitionend"];
19055
+ const _hoisted_2$9 = ["onTransitionend"];
19037
19056
  const _hoisted_3$9 = ["onClick"];
19038
19057
  function __render__$u(_ctx, _cache) {
19039
19058
  const _component_var_button = vue.resolveComponent("var-button");
@@ -19189,7 +19208,7 @@ function __render__$u(_ctx, _cache) {
19189
19208
  128
19190
19209
  /* KEYED_FRAGMENT */
19191
19210
  ))
19192
- ], 46, _hoisted_2$a)
19211
+ ], 46, _hoisted_2$9)
19193
19212
  ], 42, _hoisted_1$e);
19194
19213
  }),
19195
19214
  128
@@ -19625,7 +19644,7 @@ const RADIUS = 20;
19625
19644
  const CIRCUMFERENCE = 2 * Math.PI * RADIUS;
19626
19645
  const { name: name$n, n: n$q, classes: classes$l } = createNamespace("progress");
19627
19646
  const _hoisted_1$d = ["aria-valuenow"];
19628
- const _hoisted_2$9 = ["viewBox"];
19647
+ const _hoisted_2$8 = ["viewBox"];
19629
19648
  const _hoisted_3$8 = { key: 0 };
19630
19649
  const _hoisted_4$3 = ["id"];
19631
19650
  const _hoisted_5$1 = ["offset", "stop-color"];
@@ -19779,7 +19798,7 @@ function __render__$t(_ctx, _cache) {
19779
19798
  transformOrigin: "50% 50%"
19780
19799
  })
19781
19800
  }, null, 14, _hoisted_7)
19782
- ], 10, _hoisted_2$9)),
19801
+ ], 10, _hoisted_2$8)),
19783
19802
  _ctx.label ? (vue.openBlock(), vue.createElementBlock(
19784
19803
  "div",
19785
19804
  {
@@ -20802,7 +20821,7 @@ const _hoisted_1$a = {
20802
20821
  xmlns: "http://www.w3.org/2000/svg",
20803
20822
  viewBox: "2 3.6 20 20"
20804
20823
  };
20805
- const _hoisted_2$8 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode(
20824
+ const _hoisted_2$7 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode(
20806
20825
  "path",
20807
20826
  { d: "M11,9H13V7H11M11,20H13V11H11V20Z" },
20808
20827
  null,
@@ -20810,7 +20829,7 @@ const _hoisted_2$8 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.cr
20810
20829
  /* HOISTED */
20811
20830
  ));
20812
20831
  const _hoisted_3$7 = [
20813
- _hoisted_2$8
20832
+ _hoisted_2$7
20814
20833
  ];
20815
20834
  function __render__$o(_ctx, _cache) {
20816
20835
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$a, [..._hoisted_3$7]);
@@ -20823,7 +20842,7 @@ const _hoisted_1$9 = {
20823
20842
  xmlns: "http://www.w3.org/2000/svg",
20824
20843
  viewBox: "2 2 20 20"
20825
20844
  };
20826
- const _hoisted_2$7 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode(
20845
+ const _hoisted_2$6 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode(
20827
20846
  "path",
20828
20847
  { d: "M19,3V5H19V19M17,8.4L13.4,12L17,15.6L15.6,17L12,13.4L8.4,17L7,15.6L10.6,12L7,8.4L8.4,7L12,10.6L15.6,7L17,8.4Z" },
20829
20848
  null,
@@ -20831,7 +20850,7 @@ const _hoisted_2$7 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.cr
20831
20850
  /* HOISTED */
20832
20851
  ));
20833
20852
  const _hoisted_3$6 = [
20834
- _hoisted_2$7
20853
+ _hoisted_2$6
20835
20854
  ];
20836
20855
  function __render__$n(_ctx, _cache) {
20837
20856
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$9, [..._hoisted_3$6]);
@@ -20844,7 +20863,7 @@ const _hoisted_1$8 = {
20844
20863
  xmlns: "http://www.w3.org/2000/svg",
20845
20864
  viewBox: "-6 -4 35 35"
20846
20865
  };
20847
- const _hoisted_2$6 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode(
20866
+ const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode(
20848
20867
  "path",
20849
20868
  { d: "M10,21H14A2,2 0 0,1 12,23A2,2 0 0,1 10,21M21,19V20H3V19L5,17V11C5,7.9 7.03,5.17 10,4.29C10,4.19 10,4.1 10,4A2,2 0 0,1 12,2A2,2 0 0,1 14,4C14,4.1 14,4.19 14,4.29C16.97,5.17 19,7.9 19,11V17L21,19M17,11A5,5 0 0,0 12,6A5,5 0 0,0 7,11V18H17V11M19.75,3.19L18.33,4.61M1,11" },
20850
20869
  null,
@@ -20852,7 +20871,7 @@ const _hoisted_2$6 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.cr
20852
20871
  /* HOISTED */
20853
20872
  ));
20854
20873
  const _hoisted_3$5 = [
20855
- _hoisted_2$6
20874
+ _hoisted_2$5
20856
20875
  ];
20857
20876
  function __render__$m(_ctx, _cache) {
20858
20877
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$8, [..._hoisted_3$5]);
@@ -20961,7 +20980,7 @@ const _hoisted_1$7 = {
20961
20980
  xmlns: "http://www.w3.org/2000/svg",
20962
20981
  viewBox: "-3 -3 30 30"
20963
20982
  };
20964
- const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode(
20983
+ const _hoisted_2$4 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode(
20965
20984
  "path",
20966
20985
  { d: "M10,19H13V22H10V19M12,2C17.35,2.22 19.68,7.62 16.5,11.67C15.67,12.67 14.33,13.33 13.67,14.17C13,15 13,16 13,17H10C10,15.33 10,13.92 10.67,12.92C11.33,11.92 12.67,11.33 13.5,10.67C15.92,8.43 15.32,5.26 12,5A3,3 0 0,0 9,8H6A6,6 0 0,1 12,2Z" },
20967
20986
  null,
@@ -20969,7 +20988,7 @@ const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.cr
20969
20988
  /* HOISTED */
20970
20989
  ));
20971
20990
  const _hoisted_3$4 = [
20972
- _hoisted_2$5
20991
+ _hoisted_2$4
20973
20992
  ];
20974
20993
  function __render__$k(_ctx, _cache) {
20975
20994
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$7, [..._hoisted_3$4]);
@@ -20979,7 +20998,7 @@ __sfc__$l.render = __render__$k;
20979
20998
  var stdin_default$3G = __sfc__$l;
20980
20999
  const _withScopeId$1 = (n2) => (vue.pushScopeId(""), n2 = n2(), vue.popScopeId(), n2);
20981
21000
  const _hoisted_1$6 = { viewBox: "-4 -4 32 32" };
20982
- const _hoisted_2$4 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode(
21001
+ const _hoisted_2$3 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode(
20983
21002
  "path",
20984
21003
  {
20985
21004
  fill: "currentColor",
@@ -20990,7 +21009,7 @@ const _hoisted_2$4 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.cr
20990
21009
  /* HOISTED */
20991
21010
  ));
20992
21011
  const _hoisted_3$3 = [
20993
- _hoisted_2$4
21012
+ _hoisted_2$3
20994
21013
  ];
20995
21014
  function __render__$j(_ctx, _cache) {
20996
21015
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, [..._hoisted_3$3]);
@@ -21216,6 +21235,15 @@ const props$g = __spreadValues$6({
21216
21235
  type: [String, Number, Boolean, Array],
21217
21236
  default: void 0
21218
21237
  },
21238
+ options: Array,
21239
+ labelKey: {
21240
+ type: String,
21241
+ default: "label"
21242
+ },
21243
+ valueKey: {
21244
+ type: String,
21245
+ default: "value"
21246
+ },
21219
21247
  multiple: Boolean,
21220
21248
  offsetY: {
21221
21249
  type: [String, Number],
@@ -21257,11 +21285,12 @@ const props$g = __spreadValues$6({
21257
21285
  ]));
21258
21286
  const { name: name$g, n: n$i, classes: classes$e } = createNamespace("select");
21259
21287
  const _hoisted_1$5 = ["tabindex"];
21260
- const _hoisted_2$3 = { key: 1 };
21261
21288
  function __render__$g(_ctx, _cache) {
21289
+ const _component_maybe_v_node = vue.resolveComponent("maybe-v-node");
21262
21290
  const _component_var_chip = vue.resolveComponent("var-chip");
21263
21291
  const _component_var_icon = vue.resolveComponent("var-icon");
21264
21292
  const _component_var_field_decorator = vue.resolveComponent("var-field-decorator");
21293
+ const _component_var_option = vue.resolveComponent("var-option");
21265
21294
  const _component_var_menu = vue.resolveComponent("var-menu");
21266
21295
  const _component_var_form_details = vue.resolveComponent("var-form-details");
21267
21296
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -21294,6 +21323,21 @@ function __render__$g(_ctx, _cache) {
21294
21323
  class: vue.normalizeClass(_ctx.classes(_ctx.n("scroller"), _ctx.n("$-elevation--3")))
21295
21324
  },
21296
21325
  [
21326
+ _ctx.selectOptions.length ? (vue.openBlock(true), vue.createElementBlock(
21327
+ vue.Fragment,
21328
+ { key: 0 },
21329
+ vue.renderList(_ctx.selectOptions, (option) => {
21330
+ return vue.openBlock(), vue.createBlock(_component_var_option, {
21331
+ key: option[_ctx.valueKey],
21332
+ label: option[_ctx.labelKey],
21333
+ value: option[_ctx.valueKey],
21334
+ option,
21335
+ disabled: option.disabled
21336
+ }, null, 8, ["label", "value", "option", "disabled"]);
21337
+ }),
21338
+ 128
21339
+ /* KEYED_FRAGMENT */
21340
+ )) : vue.createCommentVNode("v-if", true),
21297
21341
  vue.renderSlot(_ctx.$slots, "default")
21298
21342
  ],
21299
21343
  2
@@ -21374,11 +21418,7 @@ function __render__$g(_ctx, _cache) {
21374
21418
  onClose: () => _ctx.handleClose(l)
21375
21419
  }, {
21376
21420
  default: vue.withCtx(() => [
21377
- vue.createTextVNode(
21378
- vue.toDisplayString(l),
21379
- 1
21380
- /* TEXT */
21381
- )
21421
+ vue.createVNode(_component_maybe_v_node, { is: l }, null, 8, ["is"])
21382
21422
  ]),
21383
21423
  _: 2
21384
21424
  /* DYNAMIC */
@@ -21396,20 +21436,40 @@ function __render__$g(_ctx, _cache) {
21396
21436
  key: 1,
21397
21437
  class: vue.normalizeClass(_ctx.n("values"))
21398
21438
  },
21399
- vue.toDisplayString(_ctx.labels.join(_ctx.separator)),
21400
- 3
21401
- /* TEXT, CLASS */
21439
+ [
21440
+ (vue.openBlock(true), vue.createElementBlock(
21441
+ vue.Fragment,
21442
+ null,
21443
+ vue.renderList(_ctx.labels, (l, labelIndex) => {
21444
+ return vue.openBlock(), vue.createElementBlock(
21445
+ vue.Fragment,
21446
+ { key: l },
21447
+ [
21448
+ vue.createVNode(_component_maybe_v_node, { is: l }, null, 8, ["is"]),
21449
+ vue.createTextVNode(
21450
+ vue.toDisplayString(labelIndex !== _ctx.labels.length - 1 ? _ctx.separator : ""),
21451
+ 1
21452
+ /* TEXT */
21453
+ )
21454
+ ],
21455
+ 64
21456
+ /* STABLE_FRAGMENT */
21457
+ );
21458
+ }),
21459
+ 128
21460
+ /* KEYED_FRAGMENT */
21461
+ ))
21462
+ ],
21463
+ 2
21464
+ /* CLASS */
21402
21465
  ))
21403
21466
  ],
21404
21467
  64
21405
21468
  /* STABLE_FRAGMENT */
21406
- )) : (vue.openBlock(), vue.createElementBlock(
21407
- "span",
21408
- _hoisted_2$3,
21409
- vue.toDisplayString(_ctx.label),
21410
- 1
21411
- /* TEXT */
21412
- ))
21469
+ )) : (vue.openBlock(), vue.createBlock(_component_maybe_v_node, {
21470
+ key: 1,
21471
+ is: _ctx.label
21472
+ }, null, 8, ["is"]))
21413
21473
  ]) : vue.createCommentVNode("v-if", true)
21414
21474
  ],
21415
21475
  2
@@ -21475,8 +21535,10 @@ const __sfc__$h = vue.defineComponent({
21475
21535
  VarIcon: stdin_default$5S,
21476
21536
  VarMenu: stdin_default$47,
21477
21537
  VarChip: stdin_default$55,
21538
+ VarOption: stdin_default$41,
21478
21539
  VarFieldDecorator: stdin_default$4z,
21479
- VarFormDetails: stdin_default$5b
21540
+ VarFormDetails: stdin_default$5b,
21541
+ MaybeVNode
21480
21542
  },
21481
21543
  props: props$g,
21482
21544
  setup(props2) {
@@ -21487,6 +21549,7 @@ const __sfc__$h = vue.defineComponent({
21487
21549
  const focusColor = vue.computed(() => props2.focusColor);
21488
21550
  const isEmptyModelValue = vue.computed(() => isEmpty(props2.modelValue));
21489
21551
  const cursor = vue.computed(() => props2.disabled || props2.readonly ? "" : "pointer");
21552
+ const selectOptions = vue.computed(() => isArray(props2.options) ? props2.options : []);
21490
21553
  const offsetY = vue.ref(0);
21491
21554
  const { bindForm, form } = useForm();
21492
21555
  const { length, options, bindOptions } = useOptions();
@@ -21702,6 +21765,8 @@ const __sfc__$h = vue.defineComponent({
21702
21765
  cursor,
21703
21766
  placeholderColor,
21704
21767
  enableCustomPlaceholder,
21768
+ selectOptions,
21769
+ isFunction,
21705
21770
  n: n$i,
21706
21771
  classes: classes$e,
21707
21772
  handleFocus,
@@ -28869,7 +28934,7 @@ withInstall(stdin_default$1);
28869
28934
  withPropsDefaultsSetter(stdin_default$1, props);
28870
28935
  const _WatermarkComponent = stdin_default$1;
28871
28936
  var stdin_default = stdin_default$1;
28872
- const version = "3.3.3";
28937
+ const version = "3.3.4";
28873
28938
  function install(app) {
28874
28939
  stdin_default$5G.install && app.use(stdin_default$5G);
28875
28940
  stdin_default$5E.install && app.use(stdin_default$5E);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -48,9 +48,9 @@
48
48
  "@popperjs/core": "^2.11.6",
49
49
  "dayjs": "^1.10.4",
50
50
  "decimal.js": "^10.2.1",
51
- "@varlet/icons": "3.3.3",
52
- "@varlet/shared": "3.3.3",
53
- "@varlet/use": "3.3.3"
51
+ "@varlet/icons": "3.3.4",
52
+ "@varlet/shared": "3.3.4",
53
+ "@varlet/use": "3.3.4"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@vue/runtime-core": "3.4.21",
@@ -64,9 +64,9 @@
64
64
  "typescript": "^5.1.5",
65
65
  "vue": "3.4.21",
66
66
  "vue-router": "4.2.0",
67
- "@varlet/cli": "3.3.3",
68
- "@varlet/ui": "3.3.3",
69
- "@varlet/touch-emulator": "3.3.3"
67
+ "@varlet/ui": "3.3.4",
68
+ "@varlet/cli": "3.3.4",
69
+ "@varlet/touch-emulator": "3.3.4"
70
70
  },
71
71
  "scripts": {
72
72
  "dev": "varlet-cli dev",
package/types/select.d.ts CHANGED
@@ -9,8 +9,23 @@ export type SelectTextAlign = 'left' | 'right' | 'center'
9
9
 
10
10
  export type SelectSize = 'small' | 'normal'
11
11
 
12
+ export type SelectOptionLabelRender = (option: SelectOption, checked: boolean) => VNodeChild
13
+
14
+ export type SelectOptionLabel = string | VNode | SelectOptionLabelRender
15
+
16
+ export interface SelectOption {
17
+ label?: SelectOptionLabel
18
+ value?: any
19
+ disabled?: boolean
20
+
21
+ [key: PropertyKey]: any
22
+ }
23
+
12
24
  export interface SelectProps extends BasicAttributes {
13
25
  modelValue?: any
26
+ options?: Array<SelectOption>
27
+ labelKey?: string
28
+ valueKey?: string
14
29
  variant?: SelectVariant
15
30
  size?: SelectSize
16
31
  placeholder?: string