@varlet/ui 3.3.16 → 3.4.0

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.
@@ -7,11 +7,11 @@ import { useValidation, createNamespace } from "../utils/components.mjs";
7
7
  import { useForm } from "../form/provide.mjs";
8
8
  import { onSmartMounted, useClientId } from "@varlet/use";
9
9
  const { name, n, classes } = createNamespace("input");
10
- import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, withCtx as _withCtx, createSlots as _createSlots, createVNode as _createVNode, withModifiers as _withModifiers, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
10
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, withCtx as _withCtx, createSlots as _createSlots, createVNode as _createVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
11
11
  const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
12
12
  const _hoisted_1 = ["placeholder", "enterkeyhint"];
13
- const _hoisted_2 = ["id", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "rows", "enterkeyhint", "inputmode"];
14
- const _hoisted_3 = ["id", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "enterkeyhint", "inputmode"];
13
+ const _hoisted_2 = ["autocomplete", "id", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "rows", "enterkeyhint", "inputmode"];
14
+ const _hoisted_3 = ["autocomplete", "id", "disabled", "readonly", "type", "value", "placeholder", "maxlength", "enterkeyhint", "inputmode"];
15
15
  function __render__(_ctx, _cache) {
16
16
  const _component_var_field_decorator = _resolveComponent("var-field-decorator");
17
17
  const _component_var_form_details = _resolveComponent("var-form-details");
@@ -19,7 +19,7 @@ function __render__(_ctx, _cache) {
19
19
  "div",
20
20
  {
21
21
  class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n("$--box"))),
22
- onMousedown: _cache[13] || (_cache[13] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args))
22
+ onMousedown: _cache[12] || (_cache[12] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args))
23
23
  },
24
24
  [
25
25
  _createVNode(
@@ -35,8 +35,8 @@ function __render__(_ctx, _cache) {
35
35
  textColor: _ctx.textColor,
36
36
  focusColor: _ctx.focusColor,
37
37
  blurColor: _ctx.blurColor,
38
- isFocusing: _ctx.isFocusing,
39
- errorMessage: _ctx.errorMessage,
38
+ isFocusing: _ctx.isForceFocusingEffect != null ? _ctx.isForceFocusingEffect : _ctx.isFocusing,
39
+ isError: _ctx.isForceErrorEffect != null ? _ctx.isForceErrorEffect : !!_ctx.errorMessage,
40
40
  formDisabled: _ctx.formDisabled,
41
41
  disabled: _ctx.disabled,
42
42
  clearable: _ctx.clearable,
@@ -76,7 +76,7 @@ function __render__(_ctx, _cache) {
76
76
  )
77
77
  ),
78
78
  ref: "el",
79
- autocomplete: "new-password",
79
+ autocomplete: _ctx.autocomplete ? _ctx.autocomplete : "new-password",
80
80
  id: _ctx.id,
81
81
  disabled: _ctx.formDisabled || _ctx.disabled,
82
82
  readonly: _ctx.formReadonly || _ctx.readonly,
@@ -110,7 +110,7 @@ function __render__(_ctx, _cache) {
110
110
  )
111
111
  ),
112
112
  ref: "el",
113
- autocomplete: "new-password",
113
+ autocomplete: _ctx.autocomplete ? _ctx.autocomplete : "new-password",
114
114
  id: _ctx.id,
115
115
  disabled: _ctx.formDisabled || _ctx.disabled,
116
116
  readonly: _ctx.formReadonly || _ctx.readonly,
@@ -147,11 +147,10 @@ function __render__(_ctx, _cache) {
147
147
  1040
148
148
  /* FULL_PROPS, DYNAMIC_SLOTS */
149
149
  ),
150
- _createVNode(_component_var_form_details, {
150
+ _ctx.isShowFormDetails ? (_openBlock(), _createBlock(_component_var_form_details, {
151
+ key: 0,
151
152
  "error-message": _ctx.errorMessage,
152
- "extra-message": _ctx.maxlengthText,
153
- onMousedown: _cache[12] || (_cache[12] = _withModifiers(() => {
154
- }, ["stop"]))
153
+ "extra-message": _ctx.maxlengthText
155
154
  }, _createSlots({
156
155
  _: 2
157
156
  /* DYNAMIC */
@@ -163,7 +162,7 @@ function __render__(_ctx, _cache) {
163
162
  ]),
164
163
  key: "0"
165
164
  } : void 0
166
- ]), 1032, ["error-message", "extra-message"])
165
+ ]), 1032, ["error-message", "extra-message"])) : _createCommentVNode("v-if", true)
167
166
  ],
168
167
  34
169
168
  /* CLASS, NEED_HYDRATION */
@@ -1,4 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
4
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -14,9 +16,10 @@ var __spreadValues = (a, b) => {
14
16
  }
15
17
  return a;
16
18
  };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
17
20
  import { defineListenerProp, pickProps } from "../utils/components.mjs";
18
21
  import { fieldDecoratorProps } from "../field-decorator/index.mjs";
19
- const props = __spreadValues({
22
+ const props = __spreadProps(__spreadValues({
20
23
  modelValue: String,
21
24
  modelModifiers: {
22
25
  type: Object,
@@ -59,7 +62,23 @@ const props = __spreadValues({
59
62
  "disabled",
60
63
  "clearable",
61
64
  "onClick"
62
- ]));
65
+ ])), {
66
+ // internal start
67
+ autocomplete: String,
68
+ isForceFocusingEffect: {
69
+ type: Boolean,
70
+ default: void 0
71
+ },
72
+ isForceErrorEffect: {
73
+ type: Boolean,
74
+ default: void 0
75
+ },
76
+ isShowFormDetails: {
77
+ type: Boolean,
78
+ default: true
79
+ }
80
+ // internal end
81
+ });
63
82
  export {
64
83
  props
65
84
  };
@@ -51,10 +51,13 @@ function __render__(_ctx, _cache) {
51
51
  _createElementVNode(
52
52
  "div",
53
53
  {
54
- class: _normalizeClass(_ctx.classes(_ctx.n("text"), _ctx.n("$--ellipsis")))
54
+ class: _normalizeClass(_ctx.classes(_ctx.n("text")))
55
55
  },
56
56
  [
57
- _createVNode(_component_maybe_v_node, { is: _ctx.labelVNode }, null, 8, ["is"])
57
+ _createVNode(_component_maybe_v_node, {
58
+ class: _normalizeClass(_ctx.n("$--ellipsis")),
59
+ is: _ctx.labelVNode
60
+ }, null, 8, ["class", "is"])
58
61
  ],
59
62
  2
60
63
  /* CLASS */
@@ -1 +1 @@
1
- :root { --menu-option-normal-height: 38px; --menu-option-small-height: 30px; --menu-option-mini-height: 24px; --menu-option-large-height: 46px; --menu-option-padding: 0 12px; --menu-option-normal-font-size: var(--font-size-md); --menu-option-small-font-size: var(--font-size-sm); --menu-option-mini-font-size: var(--font-size-xs); --menu-option-large-font-size: var(--font-size-lg); --menu-option-selected-background: var(--color-primary); --menu-option-text-color: #555; --menu-option-disabled-color: var(--color-text-disabled);}.var-menu-option { position: relative; display: flex; align-items: center; padding: var(--menu-option-padding); cursor: pointer; -webkit-tap-highlight-color: transparent; color: var(--menu-option-text-color); outline: none;}.var-menu-option__cover { position: absolute; top: 0; left: 0; right: 0; bottom: 0; opacity: 0.2; background: transparent;}.var-menu-option__text { display: flex; align-items: center;}.var-menu-option--normal { height: var(--menu-option-normal-height); font-size: var(--menu-option-normal-font-size);}.var-menu-option--large { height: var(--menu-option-large-height); font-size: var(--menu-option-large-font-size);}.var-menu-option--small { height: var(--menu-option-small-height); font-size: var(--menu-option-small-font-size);}.var-menu-option--mini { height: var(--menu-option-mini-height); font-size: var(--menu-option-mini-font-size);}.var-menu-option--selected-background { background: var(--menu-option-selected-background);}.var-menu-option--selected-color { color: var(--menu-option-selected-background);}.var-menu-option--disabled { color: var(--menu-option-disabled-color); cursor: not-allowed;}
1
+ :root { --menu-option-normal-height: 38px; --menu-option-small-height: 30px; --menu-option-mini-height: 24px; --menu-option-large-height: 46px; --menu-option-padding: 0 12px; --menu-option-normal-font-size: var(--font-size-md); --menu-option-small-font-size: var(--font-size-sm); --menu-option-mini-font-size: var(--font-size-xs); --menu-option-large-font-size: var(--font-size-lg); --menu-option-selected-background: var(--color-primary); --menu-option-text-color: #555; --menu-option-disabled-color: var(--color-text-disabled);}.var-menu-option { position: relative; display: flex; align-items: center; padding: var(--menu-option-padding); cursor: pointer; -webkit-tap-highlight-color: transparent; color: var(--menu-option-text-color); outline: none;}.var-menu-option__cover { position: absolute; top: 0; left: 0; right: 0; bottom: 0; opacity: 0.2; background: transparent;}.var-menu-option__text { display: flex; align-items: center; overflow-x: hidden;}.var-menu-option--normal { height: var(--menu-option-normal-height); font-size: var(--menu-option-normal-font-size);}.var-menu-option--large { height: var(--menu-option-large-height); font-size: var(--menu-option-large-font-size);}.var-menu-option--small { height: var(--menu-option-small-height); font-size: var(--menu-option-small-font-size);}.var-menu-option--mini { height: var(--menu-option-mini-height); font-size: var(--menu-option-mini-font-size);}.var-menu-option--selected-background { background: var(--menu-option-selected-background);}.var-menu-option--selected-color { color: var(--menu-option-selected-background);}.var-menu-option--disabled { color: var(--menu-option-disabled-color); cursor: not-allowed;}
@@ -5,7 +5,7 @@ import { props } from "./props.mjs";
5
5
  import { createNamespace, formatElevation } from "../utils/components.mjs";
6
6
  import { useMenuOptions } from "./provide.mjs";
7
7
  import { useSelectController } from "../select/useSelectController.mjs";
8
- import { call, isArray, preventDefault } from "@varlet/shared";
8
+ import { call, preventDefault } from "@varlet/shared";
9
9
  import { useEventListener, useVModel } from "@varlet/use";
10
10
  import { focusChildElementByKey } from "../utils/elements.mjs";
11
11
  const { name, n, classes } = createNamespace("menu-select");
@@ -47,10 +47,10 @@ function __render__(_ctx, _cache) {
47
47
  class: _normalizeClass(_ctx.classes(_ctx.n("menu"), _ctx.formatElevation(_ctx.elevation, 3), [_ctx.scrollable, _ctx.n("--scrollable")]))
48
48
  },
49
49
  [
50
- _ctx.menuSelectOptions.length ? (_openBlock(true), _createElementBlock(
50
+ _ctx.options.length ? (_openBlock(true), _createElementBlock(
51
51
  _Fragment,
52
52
  { key: 0 },
53
- _renderList(_ctx.menuSelectOptions, (option) => {
53
+ _renderList(_ctx.options, (option) => {
54
54
  return _openBlock(), _createBlock(_component_var_menu_option, {
55
55
  key: option[_ctx.valueKey],
56
56
  label: option[_ctx.labelKey],
@@ -84,7 +84,6 @@ const __sfc__ = defineComponent({
84
84
  const menu = ref(null);
85
85
  const menuOptionsRef = ref(null);
86
86
  const show = useVModel(props2, "show");
87
- const menuSelectOptions = computed(() => isArray(props2.options) ? props2.options : []);
88
87
  const { menuOptions, length, bindMenuOptions } = useMenuOptions();
89
88
  const { computeLabel, getSelectedValue } = useSelectController({
90
89
  modelValue: () => props2.modelValue,
@@ -141,7 +140,6 @@ const __sfc__ = defineComponent({
141
140
  show,
142
141
  menu,
143
142
  menuOptionsRef,
144
- menuSelectOptions,
145
143
  n,
146
144
  classes,
147
145
  formatElevation,
@@ -21,7 +21,10 @@ const props = __spreadValues({
21
21
  type: [String, Number, Boolean, Array],
22
22
  default: void 0
23
23
  },
24
- options: Array,
24
+ options: {
25
+ type: Array,
26
+ default: () => []
27
+ },
25
28
  labelKey: {
26
29
  type: String,
27
30
  default: "label"
@@ -5,7 +5,7 @@ import { props } from "./props.mjs";
5
5
  import { useValidation, createNamespace, MaybeVNode } from "../utils/components.mjs";
6
6
  import { useRadios } from "./provide.mjs";
7
7
  import { useForm } from "../form/provide.mjs";
8
- import { call, preventDefault, isArray, isFunction } from "@varlet/shared";
8
+ import { call, preventDefault, isFunction } from "@varlet/shared";
9
9
  import { useEventListener } from "@varlet/use";
10
10
  const { name, n, classes } = createNamespace("radio-group");
11
11
  import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode } from "vue";
@@ -25,10 +25,10 @@ function __render__(_ctx, _cache) {
25
25
  class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n(`--${_ctx.direction}`)))
26
26
  },
27
27
  [
28
- _ctx.radioGroupOptions.length ? (_openBlock(true), _createElementBlock(
28
+ _ctx.options.length ? (_openBlock(true), _createElementBlock(
29
29
  _Fragment,
30
30
  { key: 0 },
31
- _renderList(_ctx.radioGroupOptions, (option) => {
31
+ _renderList(_ctx.options, (option) => {
32
32
  return _openBlock(), _createBlock(_component_var_radio, {
33
33
  key: option[_ctx.valueKey],
34
34
  "checked-value": option[_ctx.valueKey],
@@ -71,7 +71,6 @@ const __sfc__ = defineComponent({
71
71
  // expose
72
72
  resetValidation
73
73
  } = useValidation();
74
- const radioGroupOptions = computed(() => isArray(props2.options) ? props2.options : []);
75
74
  const radioGroupErrorMessage = computed(() => errorMessage.value);
76
75
  const radioGroupProvider = {
77
76
  onToggle,
@@ -153,8 +152,7 @@ const __sfc__ = defineComponent({
153
152
  reset,
154
153
  validate,
155
154
  resetValidation,
156
- isFunction,
157
- radioGroupOptions
155
+ isFunction
158
156
  };
159
157
  }
160
158
  });
@@ -8,7 +8,10 @@ const props = {
8
8
  type: String,
9
9
  default: "horizontal"
10
10
  },
11
- options: Array,
11
+ options: {
12
+ type: Array,
13
+ default: () => []
14
+ },
12
15
  labelKey: {
13
16
  type: String,
14
17
  default: "label"
@@ -56,10 +56,10 @@ function __render__(_ctx, _cache) {
56
56
  class: _normalizeClass(_ctx.classes(_ctx.n("scroller"), _ctx.n("$-elevation--3")))
57
57
  },
58
58
  [
59
- _ctx.selectOptions.length ? (_openBlock(true), _createElementBlock(
59
+ _ctx.options.length ? (_openBlock(true), _createElementBlock(
60
60
  _Fragment,
61
61
  { key: 0 },
62
- _renderList(_ctx.selectOptions, (option) => {
62
+ _renderList(_ctx.options, (option) => {
63
63
  return _openBlock(), _createBlock(_component_var_option, {
64
64
  key: option[_ctx.valueKey],
65
65
  label: option[_ctx.labelKey],
@@ -91,7 +91,7 @@ function __render__(_ctx, _cache) {
91
91
  focusColor: _ctx.focusColor,
92
92
  blurColor: _ctx.blurColor,
93
93
  isFocusing: _ctx.isFocusing,
94
- errorMessage: _ctx.errorMessage,
94
+ isError: !!_ctx.errorMessage,
95
95
  formDisabled: _ctx.formDisabled,
96
96
  disabled: _ctx.disabled,
97
97
  clearable: _ctx.clearable,
@@ -282,7 +282,6 @@ const __sfc__ = defineComponent({
282
282
  const focusColor = computed(() => props2.focusColor);
283
283
  const isEmptyModelValue = computed(() => isEmpty(props2.modelValue));
284
284
  const cursor = computed(() => props2.disabled || props2.readonly ? "" : "pointer");
285
- const selectOptions = computed(() => isArray(props2.options) ? props2.options : []);
286
285
  const offsetY = ref(0);
287
286
  const { bindForm, form } = useForm();
288
287
  const { length, options, bindOptions } = useOptions();
@@ -498,7 +497,6 @@ const __sfc__ = defineComponent({
498
497
  cursor,
499
498
  placeholderColor,
500
499
  enableCustomPlaceholder,
501
- selectOptions,
502
500
  isFunction,
503
501
  n,
504
502
  classes,
@@ -21,7 +21,10 @@ const props = __spreadValues({
21
21
  type: [String, Number, Boolean, Array],
22
22
  default: void 0
23
23
  },
24
- options: Array,
24
+ options: {
25
+ type: Array,
26
+ default: () => []
27
+ },
25
28
  labelKey: {
26
29
  type: String,
27
30
  default: "label"