@varlet/ui 3.3.3 → 3.3.5-alpha.1720530125141

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.5-alpha.1720530125141",
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",
6002
+ "description": "Specifies options",
6003
+ "default": "-",
6004
+ "value": {
6005
+ "type": "SelectOption[]",
6006
+ "kind": "expression"
6007
+ }
6008
+ },
6009
+ {
6010
+ "name": "label-key",
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",
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.5-alpha.1720530125141",
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",
6333
+ "description": "指定可选项",
6334
+ "default": "-",
6335
+ "value": {
6336
+ "type": "SelectOption[]",
6337
+ "kind": "expression"
6338
+ }
6339
+ },
6340
+ {
6341
+ "name": "label-key",
6342
+ "description": "作为 label 唯一标识的键名",
6343
+ "default": "label",
6344
+ "value": {
6345
+ "type": "string",
6346
+ "kind": "expression"
6347
+ }
6348
+ },
6349
+ {
6350
+ "name": "value-key",
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(
@@ -16936,7 +16936,7 @@ const __sfc__$F = vue.defineComponent({
16936
16936
  if (props2.type === "number") {
16937
16937
  value = formatNumber(value);
16938
16938
  }
16939
- const targetValue = withMaxlength(withTrim(value));
16939
+ const targetValue = withMaxlength(value);
16940
16940
  if (targetValue === props2.modelValue) {
16941
16941
  target.value = targetValue;
16942
16942
  }
@@ -16962,7 +16962,10 @@ const __sfc__$F = vue.defineComponent({
16962
16962
  validateWithTrigger("onInput");
16963
16963
  }
16964
16964
  function handleChange(e) {
16965
- const value = updateValue(e);
16965
+ const value = withTrim(updateValue(e));
16966
+ if (props2.modelModifiers.trim) {
16967
+ call(props2["onUpdate:modelValue"], value);
16968
+ }
16966
16969
  call(props2.onChange, value, e);
16967
16970
  validateWithTrigger("onChange");
16968
16971
  }
@@ -18203,12 +18206,15 @@ function useSelect() {
18203
18206
  const props$s = {
18204
18207
  label: {},
18205
18208
  value: {},
18206
- disabled: Boolean
18209
+ disabled: Boolean,
18210
+ // internal
18211
+ option: Object
18207
18212
  };
18208
18213
  const { name: name$s, n: n$v, classes: classes$p } = createNamespace("option");
18209
18214
  const _hoisted_1$g = ["tabindex"];
18210
18215
  function __render__$x(_ctx, _cache) {
18211
18216
  const _component_var_checkbox = vue.resolveComponent("var-checkbox");
18217
+ const _component_maybe_v_node = vue.resolveComponent("maybe-v-node");
18212
18218
  const _component_var_hover_overlay = vue.resolveComponent("var-hover-overlay");
18213
18219
  const _directive_ripple = vue.resolveDirective("ripple");
18214
18220
  const _directive_hover = vue.resolveDirective("hover");
@@ -18252,9 +18258,11 @@ function __render__$x(_ctx, _cache) {
18252
18258
  {
18253
18259
  class: vue.normalizeClass(_ctx.classes(_ctx.n("text"), _ctx.n("$--ellipsis")))
18254
18260
  },
18255
- vue.toDisplayString(_ctx.label),
18256
- 3
18257
- /* TEXT, CLASS */
18261
+ [
18262
+ vue.createVNode(_component_maybe_v_node, { is: _ctx.labelVNode }, null, 8, ["is"])
18263
+ ],
18264
+ 2
18265
+ /* CLASS */
18258
18266
  )
18259
18267
  ]),
18260
18268
  vue.createVNode(_component_var_hover_overlay, {
@@ -18271,7 +18279,8 @@ const __sfc__$y = vue.defineComponent({
18271
18279
  directives: { Ripple: stdin_default$5W, Hover: stdin_default$5P },
18272
18280
  components: {
18273
18281
  VarCheckbox: stdin_default$59,
18274
- VarHoverOverlay: stdin_default$5Q
18282
+ VarHoverOverlay: stdin_default$5Q,
18283
+ MaybeVNode
18275
18284
  },
18276
18285
  props: props$s,
18277
18286
  setup(props2) {
@@ -18279,13 +18288,25 @@ const __sfc__$y = vue.defineComponent({
18279
18288
  const isFocusing = vue.ref(false);
18280
18289
  const optionSelected = vue.ref(false);
18281
18290
  const selected = vue.computed(() => optionSelected.value);
18282
- const label = vue.computed(() => props2.label);
18291
+ const labelVNode = vue.computed(
18292
+ () => {
18293
+ var _a;
18294
+ return isFunction(props2.label) ? props2.label(
18295
+ (_a = props2.option) != null ? _a : {
18296
+ label: props2.label,
18297
+ value: props2.value,
18298
+ disabled: props2.disabled
18299
+ },
18300
+ optionSelected.value
18301
+ ) : props2.label;
18302
+ }
18303
+ );
18283
18304
  const value = vue.computed(() => props2.value);
18284
18305
  const { select, bindSelect } = useSelect();
18285
18306
  const { multiple, focusColor, onSelect, computeLabel } = select;
18286
18307
  const { hovering, handleHovering } = useHoverOverlay();
18287
18308
  const optionProvider = {
18288
- label,
18309
+ label: labelVNode,
18289
18310
  value,
18290
18311
  selected,
18291
18312
  sync
@@ -18336,6 +18357,7 @@ const __sfc__$y = vue.defineComponent({
18336
18357
  focusColor,
18337
18358
  hovering,
18338
18359
  isFocusing,
18360
+ labelVNode,
18339
18361
  n: n$v,
18340
18362
  classes: classes$p,
18341
18363
  handleHovering,
@@ -19033,7 +19055,7 @@ const TRANSITION_DURATION = 200;
19033
19055
  const MOMENTUM_TRANSITION_DURATION = 1e3;
19034
19056
  let sid$1 = 0;
19035
19057
  const _hoisted_1$e = ["onTouchstartPassive", "onTouchmove", "onTouchend"];
19036
- const _hoisted_2$a = ["onTransitionend"];
19058
+ const _hoisted_2$9 = ["onTransitionend"];
19037
19059
  const _hoisted_3$9 = ["onClick"];
19038
19060
  function __render__$u(_ctx, _cache) {
19039
19061
  const _component_var_button = vue.resolveComponent("var-button");
@@ -19189,7 +19211,7 @@ function __render__$u(_ctx, _cache) {
19189
19211
  128
19190
19212
  /* KEYED_FRAGMENT */
19191
19213
  ))
19192
- ], 46, _hoisted_2$a)
19214
+ ], 46, _hoisted_2$9)
19193
19215
  ], 42, _hoisted_1$e);
19194
19216
  }),
19195
19217
  128
@@ -19625,7 +19647,7 @@ const RADIUS = 20;
19625
19647
  const CIRCUMFERENCE = 2 * Math.PI * RADIUS;
19626
19648
  const { name: name$n, n: n$q, classes: classes$l } = createNamespace("progress");
19627
19649
  const _hoisted_1$d = ["aria-valuenow"];
19628
- const _hoisted_2$9 = ["viewBox"];
19650
+ const _hoisted_2$8 = ["viewBox"];
19629
19651
  const _hoisted_3$8 = { key: 0 };
19630
19652
  const _hoisted_4$3 = ["id"];
19631
19653
  const _hoisted_5$1 = ["offset", "stop-color"];
@@ -19779,7 +19801,7 @@ function __render__$t(_ctx, _cache) {
19779
19801
  transformOrigin: "50% 50%"
19780
19802
  })
19781
19803
  }, null, 14, _hoisted_7)
19782
- ], 10, _hoisted_2$9)),
19804
+ ], 10, _hoisted_2$8)),
19783
19805
  _ctx.label ? (vue.openBlock(), vue.createElementBlock(
19784
19806
  "div",
19785
19807
  {
@@ -20802,7 +20824,7 @@ const _hoisted_1$a = {
20802
20824
  xmlns: "http://www.w3.org/2000/svg",
20803
20825
  viewBox: "2 3.6 20 20"
20804
20826
  };
20805
- const _hoisted_2$8 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode(
20827
+ const _hoisted_2$7 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.createElementVNode(
20806
20828
  "path",
20807
20829
  { d: "M11,9H13V7H11M11,20H13V11H11V20Z" },
20808
20830
  null,
@@ -20810,7 +20832,7 @@ const _hoisted_2$8 = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ vue.cr
20810
20832
  /* HOISTED */
20811
20833
  ));
20812
20834
  const _hoisted_3$7 = [
20813
- _hoisted_2$8
20835
+ _hoisted_2$7
20814
20836
  ];
20815
20837
  function __render__$o(_ctx, _cache) {
20816
20838
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$a, [..._hoisted_3$7]);
@@ -20823,7 +20845,7 @@ const _hoisted_1$9 = {
20823
20845
  xmlns: "http://www.w3.org/2000/svg",
20824
20846
  viewBox: "2 2 20 20"
20825
20847
  };
20826
- const _hoisted_2$7 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode(
20848
+ const _hoisted_2$6 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode(
20827
20849
  "path",
20828
20850
  { 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
20851
  null,
@@ -20831,7 +20853,7 @@ const _hoisted_2$7 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.cr
20831
20853
  /* HOISTED */
20832
20854
  ));
20833
20855
  const _hoisted_3$6 = [
20834
- _hoisted_2$7
20856
+ _hoisted_2$6
20835
20857
  ];
20836
20858
  function __render__$n(_ctx, _cache) {
20837
20859
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$9, [..._hoisted_3$6]);
@@ -20844,7 +20866,7 @@ const _hoisted_1$8 = {
20844
20866
  xmlns: "http://www.w3.org/2000/svg",
20845
20867
  viewBox: "-6 -4 35 35"
20846
20868
  };
20847
- const _hoisted_2$6 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode(
20869
+ const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode(
20848
20870
  "path",
20849
20871
  { 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
20872
  null,
@@ -20852,7 +20874,7 @@ const _hoisted_2$6 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.cr
20852
20874
  /* HOISTED */
20853
20875
  ));
20854
20876
  const _hoisted_3$5 = [
20855
- _hoisted_2$6
20877
+ _hoisted_2$5
20856
20878
  ];
20857
20879
  function __render__$m(_ctx, _cache) {
20858
20880
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$8, [..._hoisted_3$5]);
@@ -20961,7 +20983,7 @@ const _hoisted_1$7 = {
20961
20983
  xmlns: "http://www.w3.org/2000/svg",
20962
20984
  viewBox: "-3 -3 30 30"
20963
20985
  };
20964
- const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode(
20986
+ const _hoisted_2$4 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode(
20965
20987
  "path",
20966
20988
  { 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
20989
  null,
@@ -20969,7 +20991,7 @@ const _hoisted_2$5 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.cr
20969
20991
  /* HOISTED */
20970
20992
  ));
20971
20993
  const _hoisted_3$4 = [
20972
- _hoisted_2$5
20994
+ _hoisted_2$4
20973
20995
  ];
20974
20996
  function __render__$k(_ctx, _cache) {
20975
20997
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$7, [..._hoisted_3$4]);
@@ -20979,7 +21001,7 @@ __sfc__$l.render = __render__$k;
20979
21001
  var stdin_default$3G = __sfc__$l;
20980
21002
  const _withScopeId$1 = (n2) => (vue.pushScopeId(""), n2 = n2(), vue.popScopeId(), n2);
20981
21003
  const _hoisted_1$6 = { viewBox: "-4 -4 32 32" };
20982
- const _hoisted_2$4 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode(
21004
+ const _hoisted_2$3 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode(
20983
21005
  "path",
20984
21006
  {
20985
21007
  fill: "currentColor",
@@ -20990,7 +21012,7 @@ const _hoisted_2$4 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.cr
20990
21012
  /* HOISTED */
20991
21013
  ));
20992
21014
  const _hoisted_3$3 = [
20993
- _hoisted_2$4
21015
+ _hoisted_2$3
20994
21016
  ];
20995
21017
  function __render__$j(_ctx, _cache) {
20996
21018
  return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$6, [..._hoisted_3$3]);
@@ -21216,6 +21238,15 @@ const props$g = __spreadValues$6({
21216
21238
  type: [String, Number, Boolean, Array],
21217
21239
  default: void 0
21218
21240
  },
21241
+ options: Array,
21242
+ labelKey: {
21243
+ type: String,
21244
+ default: "label"
21245
+ },
21246
+ valueKey: {
21247
+ type: String,
21248
+ default: "value"
21249
+ },
21219
21250
  multiple: Boolean,
21220
21251
  offsetY: {
21221
21252
  type: [String, Number],
@@ -21257,11 +21288,12 @@ const props$g = __spreadValues$6({
21257
21288
  ]));
21258
21289
  const { name: name$g, n: n$i, classes: classes$e } = createNamespace("select");
21259
21290
  const _hoisted_1$5 = ["tabindex"];
21260
- const _hoisted_2$3 = { key: 1 };
21261
21291
  function __render__$g(_ctx, _cache) {
21292
+ const _component_maybe_v_node = vue.resolveComponent("maybe-v-node");
21262
21293
  const _component_var_chip = vue.resolveComponent("var-chip");
21263
21294
  const _component_var_icon = vue.resolveComponent("var-icon");
21264
21295
  const _component_var_field_decorator = vue.resolveComponent("var-field-decorator");
21296
+ const _component_var_option = vue.resolveComponent("var-option");
21265
21297
  const _component_var_menu = vue.resolveComponent("var-menu");
21266
21298
  const _component_var_form_details = vue.resolveComponent("var-form-details");
21267
21299
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -21294,6 +21326,21 @@ function __render__$g(_ctx, _cache) {
21294
21326
  class: vue.normalizeClass(_ctx.classes(_ctx.n("scroller"), _ctx.n("$-elevation--3")))
21295
21327
  },
21296
21328
  [
21329
+ _ctx.selectOptions.length ? (vue.openBlock(true), vue.createElementBlock(
21330
+ vue.Fragment,
21331
+ { key: 0 },
21332
+ vue.renderList(_ctx.selectOptions, (option) => {
21333
+ return vue.openBlock(), vue.createBlock(_component_var_option, {
21334
+ key: option[_ctx.valueKey],
21335
+ label: option[_ctx.labelKey],
21336
+ value: option[_ctx.valueKey],
21337
+ option,
21338
+ disabled: option.disabled
21339
+ }, null, 8, ["label", "value", "option", "disabled"]);
21340
+ }),
21341
+ 128
21342
+ /* KEYED_FRAGMENT */
21343
+ )) : vue.createCommentVNode("v-if", true),
21297
21344
  vue.renderSlot(_ctx.$slots, "default")
21298
21345
  ],
21299
21346
  2
@@ -21374,11 +21421,7 @@ function __render__$g(_ctx, _cache) {
21374
21421
  onClose: () => _ctx.handleClose(l)
21375
21422
  }, {
21376
21423
  default: vue.withCtx(() => [
21377
- vue.createTextVNode(
21378
- vue.toDisplayString(l),
21379
- 1
21380
- /* TEXT */
21381
- )
21424
+ vue.createVNode(_component_maybe_v_node, { is: l }, null, 8, ["is"])
21382
21425
  ]),
21383
21426
  _: 2
21384
21427
  /* DYNAMIC */
@@ -21396,20 +21439,40 @@ function __render__$g(_ctx, _cache) {
21396
21439
  key: 1,
21397
21440
  class: vue.normalizeClass(_ctx.n("values"))
21398
21441
  },
21399
- vue.toDisplayString(_ctx.labels.join(_ctx.separator)),
21400
- 3
21401
- /* TEXT, CLASS */
21442
+ [
21443
+ (vue.openBlock(true), vue.createElementBlock(
21444
+ vue.Fragment,
21445
+ null,
21446
+ vue.renderList(_ctx.labels, (l, labelIndex) => {
21447
+ return vue.openBlock(), vue.createElementBlock(
21448
+ vue.Fragment,
21449
+ { key: l },
21450
+ [
21451
+ vue.createVNode(_component_maybe_v_node, { is: l }, null, 8, ["is"]),
21452
+ vue.createTextVNode(
21453
+ vue.toDisplayString(labelIndex !== _ctx.labels.length - 1 ? _ctx.separator : ""),
21454
+ 1
21455
+ /* TEXT */
21456
+ )
21457
+ ],
21458
+ 64
21459
+ /* STABLE_FRAGMENT */
21460
+ );
21461
+ }),
21462
+ 128
21463
+ /* KEYED_FRAGMENT */
21464
+ ))
21465
+ ],
21466
+ 2
21467
+ /* CLASS */
21402
21468
  ))
21403
21469
  ],
21404
21470
  64
21405
21471
  /* STABLE_FRAGMENT */
21406
- )) : (vue.openBlock(), vue.createElementBlock(
21407
- "span",
21408
- _hoisted_2$3,
21409
- vue.toDisplayString(_ctx.label),
21410
- 1
21411
- /* TEXT */
21412
- ))
21472
+ )) : (vue.openBlock(), vue.createBlock(_component_maybe_v_node, {
21473
+ key: 1,
21474
+ is: _ctx.label
21475
+ }, null, 8, ["is"]))
21413
21476
  ]) : vue.createCommentVNode("v-if", true)
21414
21477
  ],
21415
21478
  2
@@ -21475,8 +21538,10 @@ const __sfc__$h = vue.defineComponent({
21475
21538
  VarIcon: stdin_default$5S,
21476
21539
  VarMenu: stdin_default$47,
21477
21540
  VarChip: stdin_default$55,
21541
+ VarOption: stdin_default$41,
21478
21542
  VarFieldDecorator: stdin_default$4z,
21479
- VarFormDetails: stdin_default$5b
21543
+ VarFormDetails: stdin_default$5b,
21544
+ MaybeVNode
21480
21545
  },
21481
21546
  props: props$g,
21482
21547
  setup(props2) {
@@ -21487,6 +21552,7 @@ const __sfc__$h = vue.defineComponent({
21487
21552
  const focusColor = vue.computed(() => props2.focusColor);
21488
21553
  const isEmptyModelValue = vue.computed(() => isEmpty(props2.modelValue));
21489
21554
  const cursor = vue.computed(() => props2.disabled || props2.readonly ? "" : "pointer");
21555
+ const selectOptions = vue.computed(() => isArray(props2.options) ? props2.options : []);
21490
21556
  const offsetY = vue.ref(0);
21491
21557
  const { bindForm, form } = useForm();
21492
21558
  const { length, options, bindOptions } = useOptions();
@@ -21702,6 +21768,8 @@ const __sfc__$h = vue.defineComponent({
21702
21768
  cursor,
21703
21769
  placeholderColor,
21704
21770
  enableCustomPlaceholder,
21771
+ selectOptions,
21772
+ isFunction,
21705
21773
  n: n$i,
21706
21774
  classes: classes$e,
21707
21775
  handleFocus,
@@ -28869,7 +28937,7 @@ withInstall(stdin_default$1);
28869
28937
  withPropsDefaultsSetter(stdin_default$1, props);
28870
28938
  const _WatermarkComponent = stdin_default$1;
28871
28939
  var stdin_default = stdin_default$1;
28872
- const version = "3.3.3";
28940
+ const version = "3.3.5-alpha.1720530125141";
28873
28941
  function install(app) {
28874
28942
  stdin_default$5G.install && app.use(stdin_default$5G);
28875
28943
  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.5-alpha.1720530125141",
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.5-alpha.1720530125141",
52
+ "@varlet/shared": "3.3.5-alpha.1720530125141",
53
+ "@varlet/use": "3.3.5-alpha.1720530125141"
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.5-alpha.1720530125141",
68
+ "@varlet/cli": "3.3.5-alpha.1720530125141",
69
+ "@varlet/touch-emulator": "3.3.5-alpha.1720530125141"
70
70
  },
71
71
  "scripts": {
72
72
  "dev": "varlet-cli dev",
@@ -51,9 +51,9 @@ export class CheckboxGroup extends VarComponent {
51
51
 
52
52
  reset(): void
53
53
 
54
- checkAll(): any
54
+ checkAll(): any[]
55
55
 
56
- inverseAll(): any
56
+ inverseAll(): any[]
57
57
  }
58
58
 
59
59
  export class _CheckboxGroupComponent extends CheckboxGroup {}
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