@varlet/ui 2.9.6 → 2.10.0-alpha.1682067841655

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.
Files changed (45) hide show
  1. package/es/fab/Fab.mjs +3 -5
  2. package/es/field-decorator/FieldDecorator.mjs +196 -0
  3. package/es/field-decorator/FieldDecoratorSfc.css +0 -0
  4. package/es/field-decorator/fieldDecorator.css +1 -0
  5. package/es/field-decorator/props.mjs +81 -0
  6. package/es/field-decorator/style/index.mjs +4 -0
  7. package/es/icon/icon.css +1 -1
  8. package/es/index.bundle.mjs +1 -1
  9. package/es/index.mjs +1 -1
  10. package/es/input/Input.mjs +173 -161
  11. package/es/input/input.css +1 -1
  12. package/es/input/props.mjs +7 -33
  13. package/es/input/style/index.mjs +2 -1
  14. package/es/menu/usePopover.mjs +2 -2
  15. package/es/option/Option.mjs +0 -3
  16. package/es/option/option.css +1 -1
  17. package/es/select/Select.mjs +104 -145
  18. package/es/select/props.mjs +7 -33
  19. package/es/select/select.css +1 -1
  20. package/es/select/style/index.mjs +1 -0
  21. package/es/snackbar/Snackbar.mjs +1 -0
  22. package/es/snackbar/core.mjs +4 -0
  23. package/es/snackbar/index.mjs +18 -3
  24. package/es/snackbar/props.mjs +1 -1
  25. package/es/snackbar/style/index.mjs +1 -1
  26. package/es/sticky/Sticky.mjs +2 -2
  27. package/es/style.css +1 -1
  28. package/es/swipe/Swipe.mjs +1 -1
  29. package/es/tabs/Tabs.mjs +1 -1
  30. package/es/themes/dark/fieldDecorator.mjs +4 -0
  31. package/es/themes/dark/index.mjs +2 -2
  32. package/es/themes/dark/select.mjs +0 -2
  33. package/es/utils/components.mjs +42 -9
  34. package/es/varlet.esm.js +6876 -6683
  35. package/highlight/web-types.en-US.json +23 -1
  36. package/highlight/web-types.zh-CN.json +41 -1
  37. package/lib/style.css +1 -1
  38. package/lib/varlet.cjs.js +1200 -979
  39. package/package.json +6 -6
  40. package/types/input.d.ts +5 -1
  41. package/types/select.d.ts +5 -1
  42. package/types/snackbar.d.ts +6 -1
  43. package/types/varComponent.d.ts +2 -0
  44. package/umd/varlet.js +5 -5
  45. package/es/themes/dark/input.mjs +0 -4
@@ -1,6 +1,7 @@
1
1
  import VarIcon from '../icon/index.mjs';
2
2
  import VarMenu from '../menu/index.mjs';
3
3
  import VarChip from '../chip/index.mjs';
4
+ import VarFieldDecorator from '../field-decorator/FieldDecorator.mjs';
4
5
  import VarFormDetails from '../form-details/index.mjs';
5
6
  import { computed, defineComponent, ref, watch, nextTick } from 'vue';
6
7
  import { isArray, isEmpty } from '@varlet/shared';
@@ -14,7 +15,7 @@ var {
14
15
  n,
15
16
  classes
16
17
  } = createNamespace('select');
17
- import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, withModifiers as _withModifiers, withCtx as _withCtx, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createVNode as _createVNode, normalizeStyle as _normalizeStyle, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
18
+ import { renderSlot as _renderSlot, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, resolveComponent as _resolveComponent, withModifiers as _withModifiers, normalizeClass as _normalizeClass, withCtx as _withCtx, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, createVNode as _createVNode, normalizeStyle as _normalizeStyle, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
18
19
 
19
20
  var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
20
21
 
@@ -27,35 +28,24 @@ function __render__(_ctx, _cache) {
27
28
 
28
29
  var _component_var_icon = _resolveComponent("var-icon");
29
30
 
31
+ var _component_var_field_decorator = _resolveComponent("var-field-decorator");
32
+
30
33
  var _component_var_menu = _resolveComponent("var-menu");
31
34
 
32
35
  var _component_var_form_details = _resolveComponent("var-form-details");
33
36
 
34
37
  return _openBlock(), _createElementBlock("div", {
35
- class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')])),
38
+ class: _normalizeClass(_ctx.n()),
36
39
  onClick: _cache[3] || (_cache[3] = function () {
37
- return _ctx.handleClick && _ctx.handleClick(...arguments);
38
- })
39
- }, [_createElementVNode("div", {
40
- class: _normalizeClass(_ctx.classes(_ctx.n('controller'), [_ctx.isFocus, _ctx.n('--focus')], [_ctx.errorMessage, _ctx.n('--error')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')])),
41
- style: _normalizeStyle({
42
- color: !_ctx.errorMessage ? _ctx.isFocus ? _ctx.focusColor : _ctx.blurColor : undefined
43
- })
44
- }, [_createElementVNode("div", {
45
- class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [!_ctx.hint, _ctx.n('--non-hint')]))
46
- }, [_renderSlot(_ctx.$slots, "prepend-icon")], 2
47
- /* CLASS */
48
- ), _createElementVNode("div", {
49
- class: _normalizeClass(_ctx.classes(_ctx.n('wrap'), [!_ctx.hint, _ctx.n('--non-hint')])),
50
- ref: "wrapEl",
51
- onClick: _cache[2] || (_cache[2] = function () {
52
40
  return _ctx.handleFocus && _ctx.handleFocus(...arguments);
53
41
  })
54
42
  }, [_createVNode(_component_var_menu, {
43
+ class: _normalizeClass(_ctx.n('menu')),
55
44
  "var-select-cover": "",
56
- class: _normalizeClass(_ctx.classes(_ctx.n('menu'))),
45
+ "same-width": "",
57
46
  "offset-y": _ctx.offsetY,
58
47
  disabled: _ctx.formReadonly || _ctx.readonly || _ctx.formDisabled || _ctx.disabled,
48
+ placement: _ctx.placement,
59
49
  "default-style": false,
60
50
  show: _ctx.isFocus,
61
51
  "onUpdate:show": _cache[1] || (_cache[1] = $event => _ctx.isFocus = $event),
@@ -63,117 +53,107 @@ function __render__(_ctx, _cache) {
63
53
  }, {
64
54
  menu: _withCtx(() => [_createElementVNode("div", {
65
55
  ref: "menuEl",
66
- class: _normalizeClass(_ctx.classes(_ctx.n('scroller'), _ctx.n('$-elevation--3')))
56
+ class: _normalizeClass(_ctx.classes(_ctx.n('scroller'), _ctx.n("scroller-" + _ctx.variant), [!_ctx.hint, _ctx.n('scroller-non-hint')], _ctx.n('$-elevation--3')))
67
57
  }, [_renderSlot(_ctx.$slots, "default")], 2
68
58
  /* CLASS */
69
59
  )]),
70
- default: _withCtx(() => [_createElementVNode("div", {
71
- class: _normalizeClass(_ctx.classes(_ctx.n('select'), [_ctx.errorMessage, _ctx.n('--error')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')])),
72
- style: _normalizeStyle({
73
- textAlign: _ctx.textAlign,
74
- color: _ctx.textColor
75
- })
76
- }, [_createElementVNode("div", {
77
- class: _normalizeClass(_ctx.n('label'))
78
- }, [!_ctx.isEmptyModelValue ? _renderSlot(_ctx.$slots, "selected", {
79
- key: 0
80
- }, () => [_ctx.multiple ? (_openBlock(), _createElementBlock(_Fragment, {
81
- key: 0
82
- }, [_ctx.chip ? (_openBlock(), _createElementBlock("div", {
83
- key: 0,
84
- class: _normalizeClass(_ctx.n('chips'))
85
- }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.labels, l => {
86
- return _openBlock(), _createBlock(_component_var_chip, {
87
- class: _normalizeClass(_ctx.n('chip')),
60
+ default: _withCtx(() => [_createVNode(_component_var_field_decorator, _normalizeProps(_guardReactiveProps({
61
+ value: _ctx.modelValue,
62
+ size: _ctx.size,
63
+ variant: _ctx.variant,
64
+ placeholder: _ctx.placeholder,
65
+ line: _ctx.line,
66
+ hint: _ctx.hint,
67
+ textColor: _ctx.textColor,
68
+ focusColor: _ctx.focusColor,
69
+ blurColor: _ctx.blurColor,
70
+ isFocus: _ctx.isFocus,
71
+ errorMessage: _ctx.errorMessage,
72
+ formDisabled: _ctx.formDisabled,
73
+ disabled: _ctx.disabled,
74
+ clearable: _ctx.clearable,
75
+ cursor: _ctx.cursor,
76
+ onClick: _ctx.handleClick,
77
+ onClear: _ctx.handleClear
78
+ })), {
79
+ "prepend-icon": _withCtx(() => [_renderSlot(_ctx.$slots, "prepend-icon")]),
80
+ "append-icon": _withCtx(() => [_renderSlot(_ctx.$slots, "append-icon")]),
81
+ default: _withCtx(() => [_createElementVNode("div", {
82
+ class: _normalizeClass(_ctx.classes(_ctx.n('select'), [_ctx.errorMessage, _ctx.n('--error')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')])),
83
+ style: _normalizeStyle({
84
+ textAlign: _ctx.textAlign,
85
+ color: _ctx.textColor
86
+ })
87
+ }, [_createElementVNode("div", {
88
+ class: _normalizeClass(_ctx.n('label'))
89
+ }, [!_ctx.isEmptyModelValue ? _renderSlot(_ctx.$slots, "selected", {
90
+ key: 0
91
+ }, () => [_ctx.multiple ? (_openBlock(), _createElementBlock(_Fragment, {
92
+ key: 0
93
+ }, [_ctx.chip ? (_openBlock(), _createElementBlock("div", {
94
+ key: 0,
95
+ class: _normalizeClass(_ctx.n('chips'))
96
+ }, [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.labels, l => {
97
+ return _openBlock(), _createBlock(_component_var_chip, {
98
+ class: _normalizeClass(_ctx.n('chip')),
99
+ "var-select-cover": "",
100
+ closable: "",
101
+ size: "small",
102
+ type: _ctx.errorMessage ? 'danger' : undefined,
103
+ key: l,
104
+ onClick: _cache[0] || (_cache[0] = _withModifiers(() => {}, ["stop"])),
105
+ onClose: () => _ctx.handleClose(l)
106
+ }, {
107
+ default: _withCtx(() => [_createTextVNode(_toDisplayString(l), 1
108
+ /* TEXT */
109
+ )]),
110
+ _: 2
111
+ /* DYNAMIC */
112
+
113
+ }, 1032
114
+ /* PROPS, DYNAMIC_SLOTS */
115
+ , ["class", "type", "onClose"]);
116
+ }), 128
117
+ /* KEYED_FRAGMENT */
118
+ ))], 2
119
+ /* CLASS */
120
+ )) : (_openBlock(), _createElementBlock("div", {
121
+ key: 1,
122
+ class: _normalizeClass(_ctx.n('values'))
123
+ }, _toDisplayString(_ctx.labels.join(_ctx.separator)), 3
124
+ /* TEXT, CLASS */
125
+ ))], 2112
126
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
127
+ )) : (_openBlock(), _createElementBlock("span", _hoisted_1, _toDisplayString(_ctx.label), 1
128
+ /* TEXT */
129
+ ))]) : _createCommentVNode("v-if", true)], 2
130
+ /* CLASS */
131
+ ), _renderSlot(_ctx.$slots, "arrow-icon", {
132
+ focus: _ctx.isFocus
133
+ }, () => [_createVNode(_component_var_icon, {
134
+ class: _normalizeClass(_ctx.classes(_ctx.n('arrow'), [_ctx.isFocus, _ctx.n('--arrow-rotate')])),
88
135
  "var-select-cover": "",
89
- closable: "",
90
- size: "small",
91
- type: _ctx.errorMessage ? 'danger' : undefined,
92
- key: l,
93
- onClick: _cache[0] || (_cache[0] = _withModifiers(() => {}, ["stop"])),
94
- onClose: () => _ctx.handleClose(l)
95
- }, {
96
- default: _withCtx(() => [_createTextVNode(_toDisplayString(l), 1
97
- /* TEXT */
98
- )]),
99
- _: 2
100
- /* DYNAMIC */
101
-
102
- }, 1032
103
- /* PROPS, DYNAMIC_SLOTS */
104
- , ["class", "type", "onClose"]);
105
- }), 128
106
- /* KEYED_FRAGMENT */
107
- ))], 2
108
- /* CLASS */
109
- )) : (_openBlock(), _createElementBlock("div", {
110
- key: 1,
111
- class: _normalizeClass(_ctx.n('values'))
112
- }, _toDisplayString(_ctx.labels.join(_ctx.separator)), 3
113
- /* TEXT, CLASS */
114
- ))], 2112
115
- /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
116
- )) : (_openBlock(), _createElementBlock("span", _hoisted_1, _toDisplayString(_ctx.label), 1
117
- /* TEXT */
118
- ))]) : _createCommentVNode("v-if", true)], 2
119
- /* CLASS */
120
- ), _renderSlot(_ctx.$slots, "arrow-icon", {
121
- focus: _ctx.isFocus
122
- }, () => [_createVNode(_component_var_icon, {
123
- class: _normalizeClass(_ctx.classes(_ctx.n('arrow'), [_ctx.isFocus, _ctx.n('--arrow-rotate')])),
124
- "var-select-cover": "",
125
- name: "menu-down",
126
- transition: 300
127
- }, null, 8
128
- /* PROPS */
129
- , ["class"])])], 6
130
- /* CLASS, STYLE */
131
- ), _createElementVNode("label", {
132
- class: _normalizeClass(_ctx.classes(_ctx.n('placeholder'), _ctx.n('$--ellipsis'), [_ctx.isFocus, _ctx.n('--focus')], [_ctx.errorMessage, _ctx.n('--error')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')], _ctx.computePlaceholderState(), [!_ctx.hint, _ctx.n('--placeholder-non-hint')])),
133
- style: _normalizeStyle({
134
- color: !_ctx.errorMessage ? _ctx.isFocus ? _ctx.focusColor : _ctx.blurColor : undefined
135
- })
136
- }, _toDisplayString(_ctx.placeholder), 7
137
- /* TEXT, CLASS, STYLE */
136
+ name: "menu-down",
137
+ transition: 300
138
+ }, null, 8
139
+ /* PROPS */
140
+ , ["class"])])], 6
141
+ /* CLASS, STYLE */
142
+ )]),
143
+ _: 3
144
+ /* FORWARDED */
145
+
146
+ }, 16
147
+ /* FULL_PROPS */
138
148
  )]),
139
149
  _: 3
140
150
  /* FORWARDED */
141
151
 
142
152
  }, 8
143
153
  /* PROPS */
144
- , ["class", "offset-y", "disabled", "show", "onClose"])], 2
145
- /* CLASS */
146
- ), _createElementVNode("div", {
147
- class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [!_ctx.hint, _ctx.n('--non-hint')]))
148
- }, [_renderSlot(_ctx.$slots, "append-icon", {}, () => [_ctx.clearable ? (_openBlock(), _createBlock(_component_var_icon, {
149
- key: 0,
150
- class: _normalizeClass(_ctx.n('clear-icon')),
151
- name: "close-circle",
152
- size: "14px",
153
- onClick: _ctx.handleClear
154
- }, null, 8
155
- /* PROPS */
156
- , ["class", "onClick"])) : _createCommentVNode("v-if", true)])], 2
157
- /* CLASS */
158
- )], 6
159
- /* CLASS, STYLE */
160
- ), _ctx.line ? (_openBlock(), _createElementBlock("div", {
161
- key: 0,
162
- class: _normalizeClass(_ctx.classes(_ctx.n('line'), [_ctx.formDisabled || _ctx.disabled, _ctx.n('--line-disabled')], [_ctx.errorMessage, _ctx.n('--line-error')])),
163
- style: _normalizeStyle({
164
- background: !_ctx.errorMessage ? _ctx.blurColor : undefined
165
- })
166
- }, [_createElementVNode("div", {
167
- class: _normalizeClass(_ctx.classes(_ctx.n('dot'), [_ctx.isFocus, _ctx.n('--spread')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--line-disabled')], [_ctx.errorMessage, _ctx.n('--line-error')])),
168
- style: _normalizeStyle({
169
- background: !_ctx.errorMessage ? _ctx.focusColor : undefined
170
- })
171
- }, null, 6
172
- /* CLASS, STYLE */
173
- )], 6
174
- /* CLASS, STYLE */
175
- )) : _createCommentVNode("v-if", true), _createVNode(_component_var_form_details, {
176
- "error-message": _ctx.errorMessage
154
+ , ["class", "offset-y", "disabled", "placement", "show", "onClose"]), _createVNode(_component_var_form_details, {
155
+ "error-message": _ctx.errorMessage,
156
+ onClick: _cache[2] || (_cache[2] = _withModifiers(() => {}, ["stop"]))
177
157
  }, null, 8
178
158
  /* PROPS */
179
159
  , ["error-message"])], 2
@@ -187,19 +167,19 @@ var __sfc__ = defineComponent({
187
167
  VarIcon,
188
168
  VarMenu,
189
169
  VarChip,
170
+ VarFieldDecorator,
190
171
  VarFormDetails
191
172
  },
192
173
  props,
193
174
 
194
175
  setup(props) {
195
- var wrapEl = ref(null);
196
176
  var isFocus = ref(false);
197
177
  var multiple = computed(() => props.multiple);
198
178
  var focusColor = computed(() => props.focusColor);
199
179
  var label = ref('');
200
180
  var labels = ref([]);
201
181
  var isEmptyModelValue = computed(() => isEmpty(props.modelValue));
202
- var wrapWidth = ref('0px');
182
+ var cursor = computed(() => props.disabled || props.readonly ? '' : 'pointer');
203
183
  var offsetY = ref(0);
204
184
  var {
205
185
  bindForm,
@@ -218,6 +198,7 @@ var __sfc__ = defineComponent({
218
198
  resetValidation
219
199
  } = useValidation();
220
200
  var menuEl = ref(null);
201
+ var placement = computed(() => props.variant === 'outlined' ? 'bottom-start' : 'cover-top-start');
221
202
 
222
203
  var computeLabel = () => {
223
204
  var {
@@ -285,25 +266,6 @@ var __sfc__ = defineComponent({
285
266
  return (_option$label$value = (_option = option) == null ? void 0 : _option.label.value) != null ? _option$label$value : '';
286
267
  };
287
268
 
288
- var computePlaceholderState = () => {
289
- var {
290
- hint,
291
- modelValue
292
- } = props;
293
-
294
- if (!hint && !isEmpty(modelValue)) {
295
- return n('--placeholder-hidden');
296
- }
297
-
298
- if (hint && (!isEmpty(modelValue) || isFocus.value)) {
299
- return n('--placeholder-hint');
300
- }
301
- };
302
-
303
- var getWrapWidth = () => {
304
- return wrapEl.value && window.getComputedStyle(wrapEl.value).width || '0px';
305
- };
306
-
307
269
  var handleFocus = () => {
308
270
  var {
309
271
  disabled,
@@ -315,7 +277,6 @@ var __sfc__ = defineComponent({
315
277
  return;
316
278
  }
317
279
 
318
- wrapWidth.value = getWrapWidth();
319
280
  offsetY.value = toPxNum(props.offsetY);
320
281
  isFocus.value = true;
321
282
  call(onFocus);
@@ -441,7 +402,6 @@ var __sfc__ = defineComponent({
441
402
 
442
403
 
443
404
  var focus = () => {
444
- wrapWidth.value = getWrapWidth();
445
405
  offsetY.value = toPxNum(props.offsetY);
446
406
  isFocus.value = true;
447
407
  }; // expose
@@ -475,7 +435,6 @@ var __sfc__ = defineComponent({
475
435
  });
476
436
  watch(() => length.value, syncOptions);
477
437
  var selectProvider = {
478
- wrapWidth: computed(() => wrapWidth.value),
479
438
  multiple,
480
439
  focusColor,
481
440
  computeLabel,
@@ -487,7 +446,6 @@ var __sfc__ = defineComponent({
487
446
  bindOptions(selectProvider);
488
447
  call(bindForm, selectProvider);
489
448
  return {
490
- wrapEl,
491
449
  offsetY,
492
450
  isFocus,
493
451
  errorMessage,
@@ -497,9 +455,10 @@ var __sfc__ = defineComponent({
497
455
  labels,
498
456
  isEmptyModelValue,
499
457
  menuEl,
458
+ placement,
459
+ cursor,
500
460
  n,
501
461
  classes,
502
- computePlaceholderState,
503
462
  handleFocus,
504
463
  handleBlur,
505
464
  handleClear,
@@ -1,14 +1,14 @@
1
- import { defineListenerProp } from '../utils/components.mjs';
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import { defineListenerProp, pickProps } from '../utils/components.mjs';
4
+ import { props as fieldDecoratorProps } from '../field-decorator/props.mjs';
2
5
  export function textAlignValidator(textAlign) {
3
6
  return ['left', 'right', 'center'].includes(textAlign);
4
7
  }
5
- export var props = {
8
+ export var props = _extends({
6
9
  modelValue: {
7
10
  default: undefined
8
11
  },
9
- placeholder: {
10
- type: String
11
- },
12
12
  multiple: {
13
13
  type: Boolean,
14
14
  default: false
@@ -21,35 +21,10 @@ export var props = {
21
21
  type: Boolean,
22
22
  default: false
23
23
  },
24
- line: {
25
- type: Boolean,
26
- default: true
27
- },
28
- hint: {
29
- type: Boolean,
30
- default: true
31
- },
32
- textColor: {
33
- type: String
34
- },
35
- focusColor: {
36
- type: String
37
- },
38
- blurColor: {
39
- type: String
40
- },
41
- disabled: {
42
- type: Boolean,
43
- default: false
44
- },
45
24
  readonly: {
46
25
  type: Boolean,
47
26
  default: false
48
27
  },
49
- clearable: {
50
- type: Boolean,
51
- default: false
52
- },
53
28
  separator: {
54
29
  type: String,
55
30
  default: ','
@@ -68,9 +43,8 @@ export var props = {
68
43
  },
69
44
  onFocus: defineListenerProp(),
70
45
  onBlur: defineListenerProp(),
71
- onClick: defineListenerProp(),
72
- onClear: defineListenerProp(),
73
46
  onClose: defineListenerProp(),
74
47
  onChange: defineListenerProp(),
48
+ onClear: defineListenerProp(),
75
49
  'onUpdate:modelValue': defineListenerProp()
76
- };
50
+ }, pickProps(fieldDecoratorProps, ['size', 'variant', 'placeholder', 'line', 'hint', 'textColor', 'focusColor', 'blurColor', 'disabled', 'clearable', 'onClick']));
@@ -1 +1 @@
1
- :root { --select-select-text-color: #555; --select-select-padding: 5px 0; --select-error-color: var(--color-danger); --select-blur-color: #888; --select-focus-color: var(--color-primary); --select-scroller-background: #fff; --select-scroller-padding: 6px 0; --select-scroller-margin: 8px 0 0 0; --select-scroller-max-height: 278px; --select-placeholder-size: 16px; --select-icon-padding: 16px 0 0; --select-icon-size: 20px; --select-chip-margin: 5px 5px 0; --select-line-size: 1px; --select-line-spread-size: 2px; --select-arrow-size: 20px; --select-disabled-color: var(--color-text-disabled);}.var-select-footer-margin-enter-from,.var-select-footer-margin-leave-to { opacity: 0; margin-top: 2px !important;}.var-select-footer-margin-enter-active,.var-select-footer-margin-leave-active { transition: 0.2s all var(--cubic-bezier);}.var-select { width: 100%; color: var(--select-select-text-color); overflow: hidden;}.var-select__controller { width: 100%; display: flex; position: relative;}.var-select__menu[var-select-cover] { flex-grow: 1; background: transparent;}.var-select__chip[var-select-cover] { margin: var(--select-chip-margin);}.var-select__scroller { max-height: var(--select-scroller-max-height); background: var(--select-scroller-background); padding: var(--select-scroller-padding); overflow-y: auto; margin: var(--select-scroller-margin); transition: background-color 0.25s;}.var-select__wrap { position: relative; display: flex; flex-direction: column; width: 100%; padding-top: var(--select-placeholder-size);}.var-select__icon { display: flex; align-items: center; padding: var(--select-icon-padding); font-size: 20px;}.var-select__placeholder { position: absolute; top: 50%; left: 0; width: 100%; transform-origin: left; transition: top 0.3s, transform 0.3s, width 0.3s, color 0.25s; transform: translate(0, calc(-50% + var(--select-placeholder-size) / 2)) scale(1); font-size: var(--select-placeholder-size); color: var(--select-blur-color);}.var-select__select { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 32px; padding: var(--select-select-padding); outline: none; border: none; font-size: inherit; color: var(--select-select-text-color); word-break: break-all; overflow-x: hidden; transition: color 0.25s;}.var-select__label { display: flex; align-items: center;}.var-select__arrow[var-select-cover] { flex-shrink: 0; font-size: var(--select-arrow-size);}.var-select__line { width: 100%; height: var(--select-line-size); background: var(--select-blur-color); transition: background-color 0.25s;}.var-select__dot { width: 100%; height: var(--select-line-spread-size); background: var(--select-focus-color); transform: scaleX(0); transform-origin: center; transition: transform 0.3s var(--cubic-bezier), background-color 0.25s;}.var-select--placeholder-hint { top: 0; width: 133.33%; transform: translate(0, 0) scale(0.75);}.var-select--placeholder-non-hint { top: 50%; transform: translate(0, -50%) scale(1);}.var-select--non-hint { padding-top: 0;}.var-select--placeholder-hidden { visibility: hidden;}.var-select--focus { color: var(--select-focus-color);}.var-select--spread { transform: scaleX(1);}.var-select--disabled { color: var(--select-disabled-color); cursor: not-allowed;}.var-select--error { color: var(--select-error-color);}.var-select--line-disabled { background: var(--select-disabled-color);}.var-select--line-error { background: var(--select-error-color);}.var-select--arrow-rotate { transform: rotate(180deg);}
1
+ :root { --select-scroller-background: #fff; --select-scroller-padding: 6px 0; --select-scroller-max-height: 278px; --select-chip-margin: 5px 5px 0; --select-arrow-size: 20px; --select-standard-scroller-margin: calc(var(--field-decorator-placeholder-size) * 0.75 + 8px) 0 0 0; --select-outlined-scroller-margin: 0;}.var-select__menu[var-select-cover] { width: 100%; background: transparent;}.var-select__chip[var-select-cover] { margin: var(--select-chip-margin);}.var-select__scroller { max-height: var(--select-scroller-max-height); background: var(--select-scroller-background); padding: var(--select-scroller-padding); overflow-y: auto; transition: background-color 0.25s;}.var-select__scroller.var-select__scroller-standard { margin: var(--select-standard-scroller-margin);}.var-select__scroller.var-select__scroller-outline { margin: var(--select-outline-scroller-margin);}.var-select__scroller-non-hint { --select-standard-scroller-margin: 8px 0 0 0;}.var-select__wrap { position: relative; display: flex; flex-direction: column; width: 100%;}.var-select__select { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 24px; outline: none; border: none; font-size: inherit; color: var(--field-decorator-text-color); word-break: break-all; overflow-x: hidden; transition: color 0.25s;}.var-select__label { display: flex; align-items: center;}.var-select__arrow[var-select-cover] { flex-shrink: 0; font-size: var(--select-arrow-size);}.var-select--disabled { color: var(--field-decorator-disabled-color); cursor: not-allowed;}.var-select--error { color: var(--field-decorator-error-color);}.var-select--arrow-rotate { transform: rotate(180deg);}
@@ -4,5 +4,6 @@ import '../../icon/icon.css'
4
4
  import '../../menu/menu.css'
5
5
  import '../../form-details/formDetails.css'
6
6
  import '../../chip/chip.css'
7
+ import '../../field-decorator/fieldDecorator.css'
7
8
  import '../select.css'
8
9
  import '../SelectSfc.css'
@@ -21,6 +21,7 @@ function __render__(_ctx, _cache) {
21
21
  default: _withCtx(() => [_createVNode(_component_var_snackbar_core, _mergeProps(_ctx.$props, {
22
22
  class: _ctx.n('transition')
23
23
  }), {
24
+ icon: _withCtx(() => [_renderSlot(_ctx.$slots, "icon")]),
24
25
  action: _withCtx(() => [_renderSlot(_ctx.$slots, "action")]),
25
26
  default: _withCtx(() => [_renderSlot(_ctx.$slots, "default", {}, () => [_createTextVNode(_toDisplayString(_ctx.content), 1
26
27
  /* TEXT */
@@ -42,6 +42,10 @@ function __render__(_ctx, _cache) {
42
42
  /* TEXT */
43
43
  )])], 2
44
44
  /* CLASS */
45
+ ), _createElementVNode("div", {
46
+ class: _normalizeClass([_ctx.n('icon')])
47
+ }, [_renderSlot(_ctx.$slots, "icon")], 2
48
+ /* CLASS */
45
49
  ), _createElementVNode("div", {
46
50
  class: _normalizeClass(_ctx.n('action'))
47
51
  }, [_ctx.iconName ? (_openBlock(), _createBlock(_component_var_icon, {
@@ -1,4 +1,4 @@
1
- import { isVNode as _isVNode, createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
1
+ import { isVNode as _isVNode, createVNode as _createVNode, mergeProps as _mergeProps, resolveDirective as _resolveDirective } from "vue";
2
2
 
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
@@ -7,7 +7,7 @@ import VarSnackbar from './Snackbar.mjs';
7
7
  import context from '../context/index.mjs';
8
8
  import { reactive, TransitionGroup } from 'vue';
9
9
  import { call, mountInstance } from '../utils/components.mjs';
10
- import { isPlainObject, isString, toNumber } from '@varlet/shared';
10
+ import { isFunction, isPlainObject, isString, toNumber } from '@varlet/shared';
11
11
 
12
12
  function _isSlot(s) {
13
13
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
@@ -21,6 +21,8 @@ var isAllowMultiple = false;
21
21
  var defaultOptionsValue = {
22
22
  type: undefined,
23
23
  content: '',
24
+ icon: '',
25
+ action: '',
24
26
  position: 'top',
25
27
  duration: 3000,
26
28
  vertical: false,
@@ -42,6 +44,9 @@ var transitionGroupProps = {
42
44
  tag: 'div',
43
45
  class: 'var-transition-group'
44
46
  };
47
+
48
+ var getSlotValue = value => () => isFunction(value) ? value() : value;
49
+
45
50
  var TransitionGroupHost = {
46
51
  setup() {
47
52
  return () => {
@@ -68,6 +73,16 @@ var TransitionGroupHost = {
68
73
  position
69
74
  }, getTop(reactiveSnackOptions.position));
70
75
 
76
+ var {
77
+ content,
78
+ icon,
79
+ action
80
+ } = reactiveSnackOptions;
81
+ var slots = {
82
+ default: getSlotValue(content),
83
+ icon: getSlotValue(icon),
84
+ action: getSlotValue(action)
85
+ };
71
86
  return _createVNode(VarSnackbarCore, _mergeProps(reactiveSnackOptions, {
72
87
  "key": id,
73
88
  "style": style,
@@ -75,7 +90,7 @@ var TransitionGroupHost = {
75
90
  "_update": _update,
76
91
  'show': reactiveSnackOptions.show,
77
92
  "onUpdate:show": $event => reactiveSnackOptions.show = $event
78
- }), null);
93
+ }), slots);
79
94
  });
80
95
  return _createVNode(TransitionGroup, _mergeProps(transitionGroupProps, {
81
96
  "style": {
@@ -23,7 +23,7 @@ export var props = {
23
23
  },
24
24
  // content内容
25
25
  content: {
26
- type: String
26
+ type: [String, Function, Object]
27
27
  },
28
28
  // 为snackbar content添加自定义类名
29
29
  contentClass: {
@@ -1,8 +1,8 @@
1
1
  import '../../styles/common.css'
2
+ import '../SnackbarSfc.css'
2
3
  import '../../styles/elevation.css'
3
4
  import '../../loading/loading.css'
4
5
  import '../../button/button.css'
5
6
  import '../../icon/icon.css'
6
7
  import '../snackbar.css'
7
8
  import '../coreSfc.css'
8
- import '../SnackbarSfc.css'
@@ -159,8 +159,8 @@ var __sfc__ = defineComponent({
159
159
  useMounted(addScrollListener);
160
160
  onUnmounted(removeScrollListener);
161
161
  onDeactivated(removeScrollListener);
162
- useEventListener(window, 'scroll', handleScroll);
163
- useEventListener(window, 'resize', resize);
162
+ useEventListener(() => window, 'scroll', handleScroll);
163
+ useEventListener(() => window, 'resize', resize);
164
164
  return {
165
165
  n,
166
166
  classes,