@varlet/ui 2.11.2 → 2.11.3-alpha.1685462737961
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/field-decorator/FieldDecorator.mjs +31 -48
- package/es/field-decorator/fieldDecorator.css +1 -1
- package/es/field-decorator/props.mjs +0 -4
- package/es/image/Image.mjs +40 -33
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +11 -9
- package/es/pull-refresh/PullRefresh.mjs +2 -2
- package/es/select/Select.mjs +44 -9
- package/es/select/select.css +1 -1
- package/es/slider/Slider.mjs +2 -2
- package/es/snackbar/style/index.mjs +1 -1
- package/es/sticky/Sticky.mjs +3 -3
- package/es/style.css +1 -1
- package/es/time-picker/TimePicker.mjs +2 -1
- package/es/time-picker/clock.mjs +2 -1
- package/es/varlet.esm.js +7012 -6994
- package/highlight/web-types.en-US.json +7 -2
- package/highlight/web-types.zh-CN.json +7 -2
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +125 -105
- package/package.json +6 -6
- package/types/image.d.ts +5 -0
- package/umd/varlet.js +5 -5
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import VarIcon from '../icon/index.mjs';
|
|
2
|
-
import { defineComponent, ref, computed,
|
|
2
|
+
import { defineComponent, ref, computed, watch } from 'vue';
|
|
3
3
|
import { props } from './props.mjs';
|
|
4
4
|
import { isEmpty } from '@varlet/shared';
|
|
5
5
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
6
6
|
import { useEventListener, useMounted } from '@varlet/use';
|
|
7
|
-
import {
|
|
7
|
+
import { getStyle } from '../utils/elements.mjs';
|
|
8
8
|
var {
|
|
9
9
|
n,
|
|
10
10
|
classes
|
|
11
11
|
} = createNamespace('field-decorator');
|
|
12
|
-
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createBlock as _createBlock, Fragment as _Fragment, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
12
|
+
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createBlock as _createBlock, Teleport as _Teleport, Fragment as _Fragment, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
13
13
|
|
|
14
14
|
var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
|
|
15
15
|
|
|
@@ -25,7 +25,6 @@ function __render__(_ctx, _cache) {
|
|
|
25
25
|
})
|
|
26
26
|
}, [_createElementVNode("div", {
|
|
27
27
|
class: _normalizeClass(_ctx.classes(_ctx.n('controller'), [_ctx.isFocus, _ctx.n('--focus')], [_ctx.errorMessage, _ctx.n('--error')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')])),
|
|
28
|
-
ref: "controllerEl",
|
|
29
28
|
style: _normalizeStyle({
|
|
30
29
|
color: _ctx.color,
|
|
31
30
|
cursor: _ctx.cursor,
|
|
@@ -36,30 +35,21 @@ function __render__(_ctx, _cache) {
|
|
|
36
35
|
}, [_renderSlot(_ctx.$slots, "prepend-icon")], 2
|
|
37
36
|
/* CLASS */
|
|
38
37
|
), _createElementVNode("div", {
|
|
39
|
-
ref: "middleEl",
|
|
40
38
|
class: _normalizeClass(_ctx.classes(_ctx.n('middle'), [!_ctx.hint, _ctx.n('--middle-non-hint')]))
|
|
41
39
|
}, [_renderSlot(_ctx.$slots, "default")], 2
|
|
42
40
|
/* CLASS */
|
|
43
|
-
),
|
|
41
|
+
), _ctx.hint ? (_openBlock(), _createElementBlock("label", {
|
|
44
42
|
key: 0,
|
|
45
|
-
class: _normalizeClass(_ctx.classes(_ctx.n('placeholder'), _ctx.n('$--ellipsis'), [_ctx.isFocus, _ctx.n('--focus')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')], [_ctx.errorMessage, _ctx.n('--error')],
|
|
43
|
+
class: _normalizeClass(_ctx.classes(_ctx.n('placeholder'), _ctx.n('$--ellipsis'), [_ctx.isFocus, _ctx.n('--focus')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')], [_ctx.errorMessage, _ctx.n('--error')], _ctx.computePlaceholderState())),
|
|
46
44
|
style: _normalizeStyle({
|
|
47
|
-
color: _ctx.color
|
|
48
|
-
transform: _ctx.placeholderTransform,
|
|
49
|
-
maxWidth: _ctx.placeholderMaxWidth
|
|
45
|
+
color: _ctx.color
|
|
50
46
|
}),
|
|
51
47
|
for: _ctx.id
|
|
52
48
|
}, [_createElementVNode("span", null, _toDisplayString(_ctx.placeholder), 1
|
|
53
49
|
/* TEXT */
|
|
54
50
|
)], 14
|
|
55
51
|
/* CLASS, STYLE, PROPS */
|
|
56
|
-
, _hoisted_1)) : _createCommentVNode("v-if", true),
|
|
57
|
-
key: 1,
|
|
58
|
-
ref: "placeholderTextEl",
|
|
59
|
-
class: _normalizeClass([_ctx.n('placeholder-text'), _ctx.n('$--ellipsis')])
|
|
60
|
-
}, _toDisplayString(_ctx.placeholder), 3
|
|
61
|
-
/* TEXT, CLASS */
|
|
62
|
-
)) : _createCommentVNode("v-if", true), _createElementVNode("div", {
|
|
52
|
+
, _hoisted_1)) : _createCommentVNode("v-if", true), _createElementVNode("div", {
|
|
63
53
|
class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [!_ctx.hint, _ctx.n('--icon-non-hint')]))
|
|
64
54
|
}, [_ctx.clearable && !_ctx.isEmpty(_ctx.value) ? (_openBlock(), _createBlock(_component_var_icon, {
|
|
65
55
|
key: 0,
|
|
@@ -86,7 +76,15 @@ function __render__(_ctx, _cache) {
|
|
|
86
76
|
style: _normalizeStyle({
|
|
87
77
|
width: _ctx.legendWidth
|
|
88
78
|
})
|
|
89
|
-
},
|
|
79
|
+
}, [_ctx.hint ? (_openBlock(), _createBlock(_Teleport, {
|
|
80
|
+
key: 0,
|
|
81
|
+
to: "body"
|
|
82
|
+
}, [_createElementVNode("span", {
|
|
83
|
+
ref: "placeholderTextEl",
|
|
84
|
+
class: _normalizeClass(_ctx.classes(_ctx.n('placeholder-text'), _ctx.n('$--ellipsis'), [_ctx.size === 'small', _ctx.n('placeholder-text--small')]))
|
|
85
|
+
}, _toDisplayString(_ctx.placeholder), 3
|
|
86
|
+
/* TEXT, CLASS */
|
|
87
|
+
)])) : _createCommentVNode("v-if", true)], 6
|
|
90
88
|
/* CLASS, STYLE */
|
|
91
89
|
)], 6
|
|
92
90
|
/* CLASS, STYLE */
|
|
@@ -119,15 +117,14 @@ var __sfc__ = defineComponent({
|
|
|
119
117
|
},
|
|
120
118
|
props,
|
|
121
119
|
|
|
122
|
-
setup(props) {
|
|
123
|
-
var
|
|
124
|
-
|
|
120
|
+
setup(props, _ref) {
|
|
121
|
+
var {
|
|
122
|
+
slots
|
|
123
|
+
} = _ref;
|
|
125
124
|
var placeholderTextEl = ref(null);
|
|
126
125
|
var legendWidth = ref('');
|
|
127
|
-
var placeholderTransform = ref('');
|
|
128
|
-
var placeholderMaxWidth = ref('');
|
|
129
126
|
var color = computed(() => !props.errorMessage ? props.isFocus ? props.focusColor : props.blurColor : undefined);
|
|
130
|
-
var isFloating = computed(() => props.hint && (!isEmpty(props.value) || props.isFocus));
|
|
127
|
+
var isFloating = computed(() => props.hint && (!isEmpty(props.value) || props.isFocus || slots['prepend-icon']));
|
|
131
128
|
|
|
132
129
|
var computePlaceholderState = () => {
|
|
133
130
|
var {
|
|
@@ -139,37 +136,27 @@ var __sfc__ = defineComponent({
|
|
|
139
136
|
if (!hint && (!isEmpty(value) || composing)) {
|
|
140
137
|
return n('--placeholder-hidden');
|
|
141
138
|
}
|
|
139
|
+
|
|
140
|
+
if (isFloating.value) {
|
|
141
|
+
return n('--placeholder-hint');
|
|
142
|
+
}
|
|
142
143
|
};
|
|
143
144
|
|
|
144
145
|
var resize = () => {
|
|
145
146
|
var {
|
|
146
147
|
size,
|
|
147
148
|
hint,
|
|
148
|
-
placeholder,
|
|
149
149
|
variant
|
|
150
150
|
} = props;
|
|
151
151
|
|
|
152
|
-
if (!
|
|
153
|
-
|
|
154
|
-
var middleRect = getRect(middleEl.value);
|
|
155
|
-
var translateX = middleRect.left - controllerRect.left + "px";
|
|
156
|
-
placeholderTransform.value = hint ? "translate(" + translateX + ", calc(var(--field-decorator-" + variant + "-" + size + "-placeholder-translate-y) + var(--field-decorator-middle-offset-y))) scale(1)" : "translate(" + translateX + ", -50%)";
|
|
157
|
-
placeholderMaxWidth.value = middleRect.width + "px";
|
|
152
|
+
if (!hint || variant !== 'outlined') {
|
|
153
|
+
legendWidth.value = '';
|
|
158
154
|
return;
|
|
159
155
|
}
|
|
160
156
|
|
|
161
|
-
var
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if (variant === 'outlined') {
|
|
166
|
-
var placeholderTextStyle = getStyle(placeholderTextEl.value);
|
|
167
|
-
var placeholderSpace = "var(--field-decorator-outlined-" + size + "-placeholder-space)";
|
|
168
|
-
legendWidth.value = "calc(" + placeholderTextStyle.width + " * 0.75 + " + placeholderSpace + " * 2)";
|
|
169
|
-
placeholderMaxWidth.value = "calc((100% - var(--field-decorator-outlined-" + size + "-padding-left) - var(--field-decorator-outlined-" + size + "-padding-right)) * 1.33)";
|
|
170
|
-
} else {
|
|
171
|
-
placeholderMaxWidth.value = '133%';
|
|
172
|
-
}
|
|
157
|
+
var placeholderTextStyle = getStyle(placeholderTextEl.value);
|
|
158
|
+
var placeholderSpace = "var(--field-decorator-outlined-" + size + "-placeholder-space)";
|
|
159
|
+
legendWidth.value = "calc(" + placeholderTextStyle.width + " * 0.75 + " + placeholderSpace + " * 2)";
|
|
173
160
|
};
|
|
174
161
|
|
|
175
162
|
var handleClear = e => {
|
|
@@ -180,15 +167,11 @@ var __sfc__ = defineComponent({
|
|
|
180
167
|
call(props.onClick, e);
|
|
181
168
|
};
|
|
182
169
|
|
|
183
|
-
onUpdated(resize);
|
|
184
170
|
useMounted(resize);
|
|
171
|
+
watch(() => [props.size, props.hint, props.variant], resize);
|
|
185
172
|
useEventListener(() => window, 'resize', resize);
|
|
186
173
|
return {
|
|
187
|
-
controllerEl,
|
|
188
|
-
middleEl,
|
|
189
174
|
placeholderTextEl,
|
|
190
|
-
placeholderTransform,
|
|
191
|
-
placeholderMaxWidth,
|
|
192
175
|
color,
|
|
193
176
|
legendWidth,
|
|
194
177
|
isFloating,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --field-decorator-middle-offset-y: 0.01px; --field-decorator-text-color: #555; --field-decorator-error-color: var(--color-danger); --field-decorator-blur-color: #888; --field-decorator-focus-color: var(--color-primary); --field-decorator-placeholder-size: 16px; --field-decorator-icon-size: 20px; --field-decorator-line-size: 1px; --field-decorator-line-focus-size: 2px; --field-decorator-disabled-color: var(--color-text-disabled); --field-decorator-standard-normal-padding-top: 22px; --field-decorator-standard-normal-padding-bottom: 4px; --field-decorator-standard-normal-icon-padding: 22px 0 4px; --field-decorator-standard-normal-non-hint-padding-top: 4px; --field-decorator-standard-normal-placeholder-translate-y: var(--field-decorator-standard-normal-padding-top); --field-decorator-standard-small-padding-top: 18px; --field-decorator-standard-small-padding-bottom: 4px; --field-decorator-standard-small-icon-padding: 18px 0 4px; --field-decorator-standard-small-non-hint-padding-top: 2px; --field-decorator-standard-small-placeholder-translate-y: var(--field-decorator-standard-small-padding-top); --field-decorator-outlined-normal-padding-top: 16px; --field-decorator-outlined-normal-padding-bottom: 16px; --field-decorator-outlined-normal-padding-left: 16px; --field-decorator-outlined-normal-padding-right: 16px; --field-decorator-outlined-normal-placeholder-space: 4px; --field-decorator-outlined-normal-icon-padding: 16px 0 16px; --field-decorator-outlined-normal-placeholder-translate-y: var(--field-decorator-outlined-normal-padding-top); --field-decorator-outlined-small-padding-top: 8px; --field-decorator-outlined-small-padding-bottom: 8px; --field-decorator-outlined-small-padding-left: 12px; --field-decorator-outlined-small-padding-right: 12px; --field-decorator-outlined-small-placeholder-space: 2px; --field-decorator-outlined-small-icon-padding: 8px 0 8px; --field-decorator-outlined-small-placeholder-translate-y: var(--field-decorator-outlined-small-padding-top);}.var-field-decorator { position: relative; width: 100%; color: var(--field-decorator-text-color);}.var-field-decorator__controller { width: 100%; display: flex; align-items: stretch; position: relative;}.var-field-decorator__middle { position: relative; flex-grow: 1; display: flex;}.var-field-decorator__icon { display: flex; align-items: center; font-size: var(--field-decorator-icon-size);}.var-field-decorator__icon .var-icon { font-size: var(--field-decorator-icon-size);}.var-field-decorator__placeholder { position: absolute; top: 0; left: 0; font-size: var(--field-decorator-placeholder-size); line-height: 1.5em; color: var(--field-decorator-blur-color); pointer-events: none; cursor: inherit; transform: translate(0, 0) scale(1); transform-origin: left; transition: transform 0.28s var(--cubic-bezier), color 0.25s, max-width 0.2s;}.var-field-decorator--placeholder-non-hint { top: 50%;}.var-field-decorator__clear-icon[var-field-decorator-cover] { font-size: var(--field-decorator-icon-size); margin-left: 6px; cursor: pointer;}.var-field-decorator--placeholder-hidden { visibility: hidden;}.var-field-decorator--focus { color: var(--field-decorator-focus-color);}.var-field-decorator--disabled { color: var(--field-decorator-disabled-color); cursor: not-allowed;}.var-field-decorator--error { color: var(--field-decorator-error-color);}.var-field-decorator--standard .var-field-decorator__middle { padding: calc(var(--field-decorator-standard-normal-padding-top) + var(--field-decorator-middle-offset-y)) 0 var(--field-decorator-standard-normal-padding-bottom);}.var-field-decorator--standard .var-field-decorator__icon { padding: var(--field-decorator-standard-normal-icon-padding);}.var-field-decorator--standard .var-field-decorator__placeholder { transform: translate(0, calc(var(--field-decorator-standard-normal-placeholder-translate-y) + var(--field-decorator-middle-offset-y)));}.var-field-decorator--standard .var-field-decorator__line { width: 100%; height: var(--field-decorator-line-size); background: var(--field-decorator-blur-color); transition: background-color 0.25s;}.var-field-decorator--standard .var-field-decorator--line-disabled { background: var(--field-decorator-disabled-color);}.var-field-decorator--standard .var-field-decorator__dot { width: 100%; height: var(--field-decorator-line-focus-size); background: var(--field-decorator-focus-color); transform: scaleX(0); transform-origin: center; transition: transform 0.3s var(--cubic-bezier), background-color 0.25s;}.var-field-decorator--standard .var-field-decorator--middle-non-hint { padding-top: calc(var(--field-decorator-standard-normal-non-hint-padding-top) + var(--field-decorator-middle-offset-y));}.var-field-decorator--standard .var-field-decorator--icon-non-hint { padding-top: var(--field-decorator-standard-normal-non-hint-padding-top);}.var-field-decorator--standard .var-field-decorator--line-focus { transform: scaleX(1);}.var-field-decorator--standard .var-field-decorator--line-error { background: var(--field-decorator-error-color);}.var-field-decorator--outlined .var-field-decorator__controller { padding: 0 var(--field-decorator-outlined-normal-padding-right) 0 var(--field-decorator-outlined-normal-padding-left);}.var-field-decorator--outlined .var-field-decorator__middle { padding: calc(var(--field-decorator-outlined-normal-padding-top) + var(--field-decorator-middle-offset-y)) 0 var(--field-decorator-outlined-normal-padding-bottom) 0;}.var-field-decorator--outlined .var-field-decorator__icon { padding: var(--field-decorator-outlined-normal-icon-padding);}.var-field-decorator--outlined .var-field-decorator__placeholder { transform: translate(0, calc(var(--field-decorator-outlined-normal-placeholder-translate-y) + var(--field-decorator-middle-offset-y)));}.var-field-decorator--outlined .var-field-decorator__placeholder-text { max-width: calc(133% - var(--field-decorator-outlined-normal-padding-left) - var(--field-decorator-outlined-normal-padding-right)); position: absolute; left: 0; z-index: -1; display: inline-block; pointer-events: none; opacity: 0;}.var-field-decorator--outlined .var-field-decorator__line { min-width: 0; width: 100%; height: calc(100% + (var(--field-decorator-placeholder-size) * 0.75 / 2)); position: absolute; top: calc(var(--field-decorator-placeholder-size) * 0.75 / 2 * -1); left: 0; pointer-events: none; border-radius: 4px; border: var(--field-decorator-line-size) solid var(--field-decorator-blur-color); overflow: hidden; padding: 0 calc(var(--field-decorator-outlined-normal-padding-right) - var(--field-decorator-outlined-normal-placeholder-space) - var(--field-decorator-line-size)) 0 calc(var(--field-decorator-outlined-normal-padding-left) - var(--field-decorator-outlined-normal-placeholder-space) - var(--field-decorator-line-size)); margin: 0;}.var-field-decorator--outlined .var-field-decorator__line-legend { max-width: 0; height: calc(var(--field-decorator-placeholder-size) * 0.75); visibility: hidden; padding: 0; overflow: hidden; display: block; white-space: nowrap;}.var-field-decorator--outlined .var-field-decorator__line-legend--hint { max-width: 100%;}.var-field-decorator--outlined .var-field-decorator--line-focus { border-width: var(--field-decorator-line-focus-size); border-color: var(--field-decorator-focus-color); padding: 0 calc(var(--field-decorator-outlined-normal-padding-right) - var(--field-decorator-outlined-normal-placeholder-space) - var(--field-decorator-line-focus-size)) 0 calc(var(--field-decorator-outlined-normal-padding-left) - var(--field-decorator-outlined-normal-placeholder-space) - var(--field-decorator-line-focus-size));}.var-field-decorator--outlined .var-field-decorator--line-disabled { border-radius: 4px; border: var(--field-decorator-line-size) solid var(--field-decorator-disabled-color);}.var-field-decorator--outlined .var-field-decorator--line-error { border-color: var(--field-decorator-error-color) !important;}.var-field-decorator--standard.var-field-decorator--small .var-field-decorator__middle { padding: calc(var(--field-decorator-standard-small-padding-top) + var(--field-decorator-middle-offset-y)) 0 var(--field-decorator-standard-small-padding-bottom);}.var-field-decorator--standard.var-field-decorator--small .var-field-decorator__placeholder { transform: translate(0, calc(var(--field-decorator-standard-small-placeholder-translate-y) + var(--field-decorator-middle-offset-y)));}.var-field-decorator--standard.var-field-decorator--small .var-field-decorator--middle-non-hint { padding-top: calc(var(--field-decorator-standard-small-non-hint-padding-top) + var(--field-decorator-middle-offset-y));}.var-field-decorator--standard.var-field-decorator--small .var-field-decorator--icon-non-hint { padding-top: var(--field-decorator-standard-small-non-hint-padding-top);}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__controller { padding: 0 var(--field-decorator-outlined-small-padding-right) 0 var(--field-decorator-outlined-small-padding-left);}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__middle { padding: calc(var(--field-decorator-outlined-small-padding-top) + var(--field-decorator-middle-offset-y)) 0 var(--field-decorator-outlined-small-padding-bottom) 0;}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__icon { padding: var(--field-decorator-outlined-small-icon-padding);}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__placeholder { transform: translate(0, calc(var(--field-decorator-outlined-small-placeholder-translate-y) + var(--field-decorator-middle-offset-y)));}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__placeholder-text { max-width: calc(133% - var(--field-decorator-outlined-small-padding-left) - var(--field-decorator-outlined-small-padding-right));}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__line { padding: 0 calc(var(--field-decorator-outlined-small-padding-right) - var(--field-decorator-outlined-small-placeholder-space) - var(--field-decorator-line-size)) 0 calc(var(--field-decorator-outlined-small-padding-left) - var(--field-decorator-outlined-small-placeholder-space) - var(--field-decorator-line-size));}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator--line-focus { padding: 0 calc(var(--field-decorator-outlined-small-padding-right) - var(--field-decorator-outlined-small-placeholder-space) - var(--field-decorator-line-focus-size)) 0 calc(var(--field-decorator-outlined-small-padding-left) - var(--field-decorator-outlined-small-placeholder-space) - var(--field-decorator-line-focus-size));}
|
|
1
|
+
:root { --field-decorator-text-color: #555; --field-decorator-error-color: var(--color-danger); --field-decorator-blur-color: #888; --field-decorator-focus-color: var(--color-primary); --field-decorator-placeholder-size: 16px; --field-decorator-icon-size: 20px; --field-decorator-line-size: 1px; --field-decorator-line-focus-size: 2px; --field-decorator-disabled-color: var(--color-text-disabled); --field-decorator-standard-normal-padding-top: 22px; --field-decorator-standard-normal-padding-bottom: 4px; --field-decorator-standard-normal-icon-padding: 22px 0 4px; --field-decorator-standard-normal-non-hint-padding-top: 4px; --field-decorator-standard-normal-placeholder-translate-y: var(--field-decorator-standard-normal-padding-top); --field-decorator-standard-small-padding-top: 18px; --field-decorator-standard-small-padding-bottom: 4px; --field-decorator-standard-small-icon-padding: 18px 0 4px; --field-decorator-standard-small-non-hint-padding-top: 2px; --field-decorator-standard-small-placeholder-translate-y: var(--field-decorator-standard-small-padding-top); --field-decorator-outlined-normal-padding-top: 16px; --field-decorator-outlined-normal-padding-bottom: 16px; --field-decorator-outlined-normal-padding-left: 16px; --field-decorator-outlined-normal-padding-right: 16px; --field-decorator-outlined-normal-placeholder-space: 4px; --field-decorator-outlined-normal-icon-padding: 16px 0 16px; --field-decorator-outlined-normal-placeholder-translate-y: var(--field-decorator-outlined-normal-padding-top); --field-decorator-outlined-small-padding-top: 8px; --field-decorator-outlined-small-padding-bottom: 8px; --field-decorator-outlined-small-padding-left: 12px; --field-decorator-outlined-small-padding-right: 12px; --field-decorator-outlined-small-placeholder-space: 2px; --field-decorator-outlined-small-icon-padding: 8px 0 8px; --field-decorator-outlined-small-placeholder-translate-y: var(--field-decorator-outlined-small-padding-top);}.var-field-decorator { position: relative; width: 100%; color: var(--field-decorator-text-color);}.var-field-decorator__controller { width: 100%; display: flex; align-items: stretch; position: relative;}.var-field-decorator__middle { position: relative; flex-grow: 1; display: flex; justify-content: center; align-items: center;}.var-field-decorator__icon { display: flex; align-items: center; font-size: var(--field-decorator-icon-size);}.var-field-decorator__icon .var-icon { font-size: var(--field-decorator-icon-size);}.var-field-decorator__placeholder { position: absolute; top: 0; left: 0; font-size: var(--field-decorator-placeholder-size); line-height: 1.5em; color: var(--field-decorator-blur-color); pointer-events: none; cursor: inherit; transform-origin: left; transition: transform 0.28s var(--cubic-bezier), color 0.25s, max-width 0.2s;}.var-field-decorator__clear-icon[var-field-decorator-cover] { font-size: var(--field-decorator-icon-size); margin-left: 6px; cursor: pointer;}.var-field-decorator--placeholder-hidden { visibility: hidden;}.var-field-decorator--focus { color: var(--field-decorator-focus-color);}.var-field-decorator--disabled { color: var(--field-decorator-disabled-color); cursor: not-allowed;}.var-field-decorator--error { color: var(--field-decorator-error-color);}.var-field-decorator--standard .var-field-decorator__middle { padding: var(--field-decorator-standard-normal-padding-top) 0 var(--field-decorator-standard-normal-padding-bottom);}.var-field-decorator--standard .var-field-decorator__icon { padding: var(--field-decorator-standard-normal-icon-padding);}.var-field-decorator--standard .var-field-decorator__placeholder { max-width: 100%; transform: translate(0, var(--field-decorator-standard-normal-placeholder-translate-y));}.var-field-decorator--standard .var-field-decorator--placeholder-hint { max-width: 133%; transform: translate(0, 0) scale(0.75) !important;}.var-field-decorator--standard .var-field-decorator__line { width: 100%; height: var(--field-decorator-line-size); background: var(--field-decorator-blur-color); transition: background-color 0.25s;}.var-field-decorator--standard .var-field-decorator--line-disabled { background: var(--field-decorator-disabled-color);}.var-field-decorator--standard .var-field-decorator__dot { width: 100%; height: var(--field-decorator-line-focus-size); background: var(--field-decorator-focus-color); transform: scaleX(0); transform-origin: center; transition: transform 0.3s var(--cubic-bezier), background-color 0.25s;}.var-field-decorator--standard .var-field-decorator--middle-non-hint { padding-top: var(--field-decorator-standard-normal-non-hint-padding-top);}.var-field-decorator--standard .var-field-decorator--icon-non-hint { padding-top: var(--field-decorator-standard-normal-non-hint-padding-top);}.var-field-decorator--standard .var-field-decorator--line-focus { transform: scaleX(1);}.var-field-decorator--standard .var-field-decorator--line-error { background: var(--field-decorator-error-color);}.var-field-decorator--outlined .var-field-decorator__controller { padding: 0 var(--field-decorator-outlined-normal-padding-right) 0 var(--field-decorator-outlined-normal-padding-left);}.var-field-decorator--outlined .var-field-decorator__middle { padding: var(--field-decorator-outlined-normal-padding-top) 0 var(--field-decorator-outlined-normal-padding-bottom) 0;}.var-field-decorator--outlined .var-field-decorator__icon { padding: var(--field-decorator-outlined-normal-icon-padding);}.var-field-decorator--outlined .var-field-decorator__placeholder { max-width: calc(100% - var(--field-decorator-outlined-normal-padding-left) - var(--field-decorator-outlined-normal-padding-right)); transform: translate(var(--field-decorator-outlined-normal-padding-left), var(--field-decorator-outlined-normal-placeholder-translate-y)) scale(1);}.var-field-decorator--outlined .var-field-decorator--placeholder-hint { max-width: calc(133% - var(--field-decorator-outlined-normal-padding-left) - var(--field-decorator-outlined-normal-padding-right)); transform: translate(calc(var(--field-decorator-outlined-normal-padding-left)), -50%) scale(0.75);}.var-field-decorator--outlined .var-field-decorator__line { min-width: 0; width: 100%; height: calc(100% + (var(--field-decorator-placeholder-size) * 0.75 / 2)); position: absolute; top: calc(var(--field-decorator-placeholder-size) * 0.75 / 2 * -1); left: 0; pointer-events: none; border-radius: 4px; border: var(--field-decorator-line-size) solid var(--field-decorator-blur-color); overflow: hidden; padding: 0 calc(var(--field-decorator-outlined-normal-padding-right) - var(--field-decorator-outlined-normal-placeholder-space) - var(--field-decorator-line-size)) 0 calc(var(--field-decorator-outlined-normal-padding-left) - var(--field-decorator-outlined-normal-placeholder-space) - var(--field-decorator-line-size)); margin: 0;}.var-field-decorator--outlined .var-field-decorator__line-legend { max-width: 0; height: calc(var(--field-decorator-placeholder-size) * 0.75); visibility: hidden; padding: 0; overflow: hidden; display: block; white-space: nowrap;}.var-field-decorator--outlined .var-field-decorator__line-legend--hint { max-width: 100%;}.var-field-decorator--outlined .var-field-decorator--line-focus { border-width: var(--field-decorator-line-focus-size); border-color: var(--field-decorator-focus-color); padding: 0 calc(var(--field-decorator-outlined-normal-padding-right) - var(--field-decorator-outlined-normal-placeholder-space) - var(--field-decorator-line-focus-size)) 0 calc(var(--field-decorator-outlined-normal-padding-left) - var(--field-decorator-outlined-normal-placeholder-space) - var(--field-decorator-line-focus-size));}.var-field-decorator--outlined .var-field-decorator--line-disabled { border-radius: 4px; border: var(--field-decorator-line-size) solid var(--field-decorator-disabled-color);}.var-field-decorator--outlined .var-field-decorator--line-error { border-color: var(--field-decorator-error-color) !important;}.var-field-decorator--standard.var-field-decorator--small .var-field-decorator__middle { padding: var(--field-decorator-standard-small-padding-top) 0 var(--field-decorator-standard-small-padding-bottom);}.var-field-decorator--standard.var-field-decorator--small .var-field-decorator__placeholder { transform: translate(0, var(--field-decorator-standard-small-placeholder-translate-y));}.var-field-decorator--standard.var-field-decorator--small .var-field-decorator--middle-non-hint { max-width: calc(133% - var(--field-decorator-outlined-small-padding-left) - var(--field-decorator-outlined-small-padding-right)); padding-top: var(--field-decorator-standard-small-non-hint-padding-top);}.var-field-decorator--standard.var-field-decorator--small .var-field-decorator--icon-non-hint { padding-top: var(--field-decorator-standard-small-non-hint-padding-top);}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__controller { padding: 0 var(--field-decorator-outlined-small-padding-right) 0 var(--field-decorator-outlined-small-padding-left);}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__middle { padding: var(--field-decorator-outlined-small-padding-top) 0 var(--field-decorator-outlined-small-padding-bottom) 0;}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__icon { padding: var(--field-decorator-outlined-small-icon-padding);}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__placeholder { max-width: calc(100% - var(--field-decorator-outlined-small-padding-left) - var(--field-decorator-outlined-small-padding-right)); transform: translate(var(--field-decorator-outlined-small-padding-left), var(--field-decorator-outlined-small-placeholder-translate-y)) scale(1);}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator--placeholder-hint { transform: translate(calc(var(--field-decorator-outlined-small-padding-left)), -50%) scale(0.75);}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator__line { padding: 0 calc(var(--field-decorator-outlined-small-padding-right) - var(--field-decorator-outlined-small-placeholder-space) - var(--field-decorator-line-size)) 0 calc(var(--field-decorator-outlined-small-padding-left) - var(--field-decorator-outlined-small-placeholder-space) - var(--field-decorator-line-size));}.var-field-decorator--outlined.var-field-decorator--small .var-field-decorator--line-focus { padding: 0 calc(var(--field-decorator-outlined-small-padding-right) - var(--field-decorator-outlined-small-placeholder-space) - var(--field-decorator-line-focus-size)) 0 calc(var(--field-decorator-outlined-small-padding-left) - var(--field-decorator-outlined-small-placeholder-space) - var(--field-decorator-line-focus-size));}.var-field-decorator__placeholder-text { max-width: calc(133% - var(--field-decorator-outlined-normal-padding-left) - var(--field-decorator-outlined-normal-padding-right)); position: absolute; z-index: -1; display: inline-block; pointer-events: none; opacity: 0;}.var-field-decorator__placeholder-text--small { max-width: calc(133% - var(--field-decorator-outlined-small-padding-left) - var(--field-decorator-outlined-small-padding-right));}
|
package/es/image/Image.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Ripple from '../ripple/index.mjs';
|
|
2
2
|
import Lazy from '../lazy/index.mjs';
|
|
3
|
-
import { defineComponent } from 'vue';
|
|
3
|
+
import { watch, defineComponent, ref } from 'vue';
|
|
4
4
|
import { props } from './props.mjs';
|
|
5
5
|
import { toSizeUnit } from '../utils/elements.mjs';
|
|
6
6
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
@@ -8,11 +8,11 @@ var {
|
|
|
8
8
|
n,
|
|
9
9
|
classes
|
|
10
10
|
} = createNamespace('image');
|
|
11
|
-
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
11
|
+
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
12
12
|
|
|
13
13
|
var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
|
|
14
14
|
|
|
15
|
-
var _hoisted_1 = ["alt", "title", "lazy-
|
|
15
|
+
var _hoisted_1 = ["alt", "title", "lazy-loading", "lazy-error"];
|
|
16
16
|
var _hoisted_2 = ["alt", "title", "src"];
|
|
17
17
|
|
|
18
18
|
function __render__(_ctx, _cache) {
|
|
@@ -25,30 +25,27 @@ function __render__(_ctx, _cache) {
|
|
|
25
25
|
style: _normalizeStyle({
|
|
26
26
|
width: _ctx.toSizeUnit(_ctx.width),
|
|
27
27
|
height: _ctx.toSizeUnit(_ctx.height),
|
|
28
|
-
|
|
28
|
+
borderRadius: _ctx.toSizeUnit(_ctx.radius)
|
|
29
29
|
})
|
|
30
|
-
}, [_ctx.lazy ? _withDirectives((_openBlock(), _createElementBlock("img", {
|
|
30
|
+
}, [_ctx.lazy && !_ctx.showErrorSlot ? _withDirectives((_openBlock(), _createElementBlock("img", {
|
|
31
31
|
key: 0,
|
|
32
32
|
class: _normalizeClass(_ctx.n('image')),
|
|
33
33
|
alt: _ctx.alt,
|
|
34
34
|
title: _ctx.title,
|
|
35
|
-
"lazy-error": _ctx.error,
|
|
36
35
|
"lazy-loading": _ctx.loading,
|
|
36
|
+
"lazy-error": _ctx.error,
|
|
37
37
|
style: _normalizeStyle({
|
|
38
38
|
objectFit: _ctx.fit
|
|
39
39
|
}),
|
|
40
40
|
onLoad: _cache[0] || (_cache[0] = function () {
|
|
41
41
|
return _ctx.handleLoad && _ctx.handleLoad(...arguments);
|
|
42
42
|
}),
|
|
43
|
-
|
|
44
|
-
return _ctx.handleError && _ctx.handleError(...arguments);
|
|
45
|
-
}),
|
|
46
|
-
onClick: _cache[2] || (_cache[2] = function () {
|
|
43
|
+
onClick: _cache[1] || (_cache[1] = function () {
|
|
47
44
|
return _ctx.handleClick && _ctx.handleClick(...arguments);
|
|
48
45
|
})
|
|
49
46
|
}, null, 46
|
|
50
47
|
/* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
|
|
51
|
-
, _hoisted_1)), [[_directive_lazy, _ctx.src]]) : (_openBlock(), _createElementBlock("img", {
|
|
48
|
+
, _hoisted_1)), [[_directive_lazy, _ctx.src]]) : _createCommentVNode("v-if", true), !_ctx.lazy && !_ctx.showErrorSlot ? (_openBlock(), _createElementBlock("img", {
|
|
52
49
|
key: 1,
|
|
53
50
|
class: _normalizeClass(_ctx.n('image')),
|
|
54
51
|
alt: _ctx.alt,
|
|
@@ -57,18 +54,20 @@ function __render__(_ctx, _cache) {
|
|
|
57
54
|
objectFit: _ctx.fit
|
|
58
55
|
}),
|
|
59
56
|
src: _ctx.src,
|
|
60
|
-
onLoad: _cache[
|
|
57
|
+
onLoad: _cache[2] || (_cache[2] = function () {
|
|
61
58
|
return _ctx.handleLoad && _ctx.handleLoad(...arguments);
|
|
62
59
|
}),
|
|
63
|
-
onError: _cache[
|
|
60
|
+
onError: _cache[3] || (_cache[3] = function () {
|
|
64
61
|
return _ctx.handleError && _ctx.handleError(...arguments);
|
|
65
62
|
}),
|
|
66
|
-
onClick: _cache[
|
|
63
|
+
onClick: _cache[4] || (_cache[4] = function () {
|
|
67
64
|
return _ctx.handleClick && _ctx.handleClick(...arguments);
|
|
68
65
|
})
|
|
69
66
|
}, null, 46
|
|
70
67
|
/* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
|
|
71
|
-
, _hoisted_2))
|
|
68
|
+
, _hoisted_2)) : _createCommentVNode("v-if", true), _ctx.showErrorSlot ? _renderSlot(_ctx.$slots, "error", {
|
|
69
|
+
key: 2
|
|
70
|
+
}) : _createCommentVNode("v-if", true)], 6
|
|
72
71
|
/* CLASS, STYLE */
|
|
73
72
|
)), [[_directive_ripple, {
|
|
74
73
|
disabled: !_ctx.ripple
|
|
@@ -83,38 +82,46 @@ var __sfc__ = defineComponent({
|
|
|
83
82
|
},
|
|
84
83
|
props,
|
|
85
84
|
|
|
86
|
-
setup(props) {
|
|
85
|
+
setup(props, _ref) {
|
|
86
|
+
var {
|
|
87
|
+
slots
|
|
88
|
+
} = _ref;
|
|
89
|
+
var showErrorSlot = ref(false);
|
|
90
|
+
|
|
91
|
+
var handleError = e => {
|
|
92
|
+
// the value of showErrorSlot depends on whether there is an error slot
|
|
93
|
+
showErrorSlot.value = !!slots.error;
|
|
94
|
+
call(props.onError, e);
|
|
95
|
+
};
|
|
96
|
+
|
|
87
97
|
var handleLoad = e => {
|
|
88
98
|
var el = e.currentTarget;
|
|
89
|
-
var {
|
|
90
|
-
lazy,
|
|
91
|
-
onLoad,
|
|
92
|
-
onError
|
|
93
|
-
} = props;
|
|
94
99
|
|
|
95
|
-
if (lazy) {
|
|
96
|
-
el._lazy.state === 'success'
|
|
97
|
-
|
|
100
|
+
if (props.lazy) {
|
|
101
|
+
if (el._lazy.state === 'success') {
|
|
102
|
+
call(props.onLoad, e);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (el._lazy.state === 'error') {
|
|
107
|
+
handleError(e);
|
|
108
|
+
}
|
|
98
109
|
} else {
|
|
99
|
-
call(onLoad, e);
|
|
110
|
+
call(props.onLoad, e);
|
|
100
111
|
}
|
|
101
112
|
};
|
|
102
113
|
|
|
103
|
-
var handleError = e => {
|
|
104
|
-
var {
|
|
105
|
-
lazy,
|
|
106
|
-
onError
|
|
107
|
-
} = props;
|
|
108
|
-
!lazy && call(onError, e);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
114
|
var handleClick = e => {
|
|
112
115
|
call(props.onClick, e);
|
|
113
116
|
};
|
|
114
117
|
|
|
118
|
+
watch(() => props.src, () => {
|
|
119
|
+
showErrorSlot.value = false;
|
|
120
|
+
});
|
|
115
121
|
return {
|
|
116
122
|
n,
|
|
117
123
|
classes,
|
|
124
|
+
showErrorSlot,
|
|
118
125
|
toSizeUnit,
|
|
119
126
|
handleLoad,
|
|
120
127
|
handleError,
|
package/es/index.bundle.mjs
CHANGED
|
@@ -241,7 +241,7 @@ import './time-picker/style/index.mjs'
|
|
|
241
241
|
import './tooltip/style/index.mjs'
|
|
242
242
|
import './uploader/style/index.mjs'
|
|
243
243
|
|
|
244
|
-
const version = '2.11.
|
|
244
|
+
const version = '2.11.3-alpha.1685462737961'
|
|
245
245
|
|
|
246
246
|
function install(app) {
|
|
247
247
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -160,7 +160,7 @@ export * from './time-picker/index.mjs'
|
|
|
160
160
|
export * from './tooltip/index.mjs'
|
|
161
161
|
export * from './uploader/index.mjs'
|
|
162
162
|
|
|
163
|
-
const version = '2.11.
|
|
163
|
+
const version = '2.11.3-alpha.1685462737961'
|
|
164
164
|
|
|
165
165
|
function install(app) {
|
|
166
166
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/input/Input.mjs
CHANGED
|
@@ -10,7 +10,7 @@ var {
|
|
|
10
10
|
n,
|
|
11
11
|
classes
|
|
12
12
|
} = createNamespace('input');
|
|
13
|
-
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, createVNode as _createVNode, withModifiers as _withModifiers, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
13
|
+
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";
|
|
14
14
|
|
|
15
15
|
var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
|
|
16
16
|
|
|
@@ -46,11 +46,9 @@ function __render__(_ctx, _cache) {
|
|
|
46
46
|
clearable: _ctx.clearable,
|
|
47
47
|
cursor: _ctx.cursor,
|
|
48
48
|
composing: _ctx.isComposing,
|
|
49
|
-
alwaysCustomPlaceholder: false,
|
|
50
49
|
onClick: _ctx.handleClick,
|
|
51
50
|
onClear: _ctx.handleClear
|
|
52
|
-
})), {
|
|
53
|
-
"prepend-icon": _withCtx(() => [_renderSlot(_ctx.$slots, "prepend-icon")]),
|
|
51
|
+
})), _createSlots({
|
|
54
52
|
"append-icon": _withCtx(() => [_renderSlot(_ctx.$slots, "append-icon")]),
|
|
55
53
|
default: _withCtx(() => [_ctx.normalizedType === 'password' ? (_openBlock(), _createElementBlock("input", {
|
|
56
54
|
key: 0,
|
|
@@ -147,11 +145,15 @@ function __render__(_ctx, _cache) {
|
|
|
147
145
|
}, null, 46
|
|
148
146
|
/* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
|
|
149
147
|
, _hoisted_3))]),
|
|
150
|
-
_:
|
|
151
|
-
/*
|
|
152
|
-
|
|
153
|
-
},
|
|
154
|
-
|
|
148
|
+
_: 2
|
|
149
|
+
/* DYNAMIC */
|
|
150
|
+
|
|
151
|
+
}, [_ctx.$slots['prepend-icon'] ? {
|
|
152
|
+
name: "prepend-icon",
|
|
153
|
+
fn: _withCtx(() => [_renderSlot(_ctx.$slots, "prepend-icon")]),
|
|
154
|
+
key: "0"
|
|
155
|
+
} : undefined]), 1040
|
|
156
|
+
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
155
157
|
), _createVNode(_component_var_form_details, {
|
|
156
158
|
"error-message": _ctx.errorMessage,
|
|
157
159
|
"extra-message": _ctx.maxlengthText,
|
|
@@ -4,7 +4,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
4
4
|
|
|
5
5
|
import VarIcon from '../icon/index.mjs';
|
|
6
6
|
import { defineComponent, ref, computed, watch, nextTick } from 'vue';
|
|
7
|
-
import { getParentScroller, getScrollTop, getTarget } from '../utils/elements.mjs';
|
|
7
|
+
import { getParentScroller, getScrollTop, getTarget, getRect } from '../utils/elements.mjs';
|
|
8
8
|
import { props } from './props.mjs';
|
|
9
9
|
import { isString, toNumber } from '@varlet/shared';
|
|
10
10
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
@@ -106,7 +106,7 @@ var __sfc__ = defineComponent({
|
|
|
106
106
|
if (controlPosition.value === 0) {
|
|
107
107
|
var {
|
|
108
108
|
width
|
|
109
|
-
} = controlNode.value
|
|
109
|
+
} = getRect(controlNode.value);
|
|
110
110
|
controlPosition.value = -(width + width * 0.25);
|
|
111
111
|
}
|
|
112
112
|
|
package/es/select/Select.mjs
CHANGED
|
@@ -15,7 +15,7 @@ var {
|
|
|
15
15
|
n,
|
|
16
16
|
classes
|
|
17
17
|
} = createNamespace('select');
|
|
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,
|
|
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, normalizeStyle as _normalizeStyle, createVNode as _createVNode, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, createSlots as _createSlots, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
19
19
|
|
|
20
20
|
var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
|
|
21
21
|
|
|
@@ -75,8 +75,7 @@ function __render__(_ctx, _cache) {
|
|
|
75
75
|
cursor: _ctx.cursor,
|
|
76
76
|
onClick: _ctx.handleClick,
|
|
77
77
|
onClear: _ctx.handleClear
|
|
78
|
-
})), {
|
|
79
|
-
"prepend-icon": _withCtx(() => [_renderSlot(_ctx.$slots, "prepend-icon")]),
|
|
78
|
+
})), _createSlots({
|
|
80
79
|
"append-icon": _withCtx(() => [_renderSlot(_ctx.$slots, "append-icon")]),
|
|
81
80
|
default: _withCtx(() => [_createElementVNode("div", {
|
|
82
81
|
class: _normalizeClass(_ctx.classes(_ctx.n('select'), [_ctx.errorMessage, _ctx.n('--error')], [_ctx.formDisabled || _ctx.disabled, _ctx.n('--disabled')])),
|
|
@@ -128,7 +127,15 @@ function __render__(_ctx, _cache) {
|
|
|
128
127
|
/* TEXT */
|
|
129
128
|
))]) : _createCommentVNode("v-if", true)], 2
|
|
130
129
|
/* CLASS */
|
|
131
|
-
),
|
|
130
|
+
), _ctx.useCustomPlaceholder ? (_openBlock(), _createElementBlock("span", {
|
|
131
|
+
key: 0,
|
|
132
|
+
class: _normalizeClass(_ctx.classes(_ctx.n('placeholder'), _ctx.n('$--ellipsis'))),
|
|
133
|
+
style: _normalizeStyle({
|
|
134
|
+
color: _ctx.placeholderColor
|
|
135
|
+
})
|
|
136
|
+
}, _toDisplayString(_ctx.placeholder), 7
|
|
137
|
+
/* TEXT, CLASS, STYLE */
|
|
138
|
+
)) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "arrow-icon", {
|
|
132
139
|
focus: _ctx.isFocus
|
|
133
140
|
}, () => [_createVNode(_component_var_icon, {
|
|
134
141
|
class: _normalizeClass(_ctx.classes(_ctx.n('arrow'), [_ctx.isFocus, _ctx.n('--arrow-rotate')])),
|
|
@@ -140,11 +147,15 @@ function __render__(_ctx, _cache) {
|
|
|
140
147
|
, ["class"])])], 6
|
|
141
148
|
/* CLASS, STYLE */
|
|
142
149
|
)]),
|
|
143
|
-
_:
|
|
144
|
-
/*
|
|
145
|
-
|
|
146
|
-
},
|
|
147
|
-
|
|
150
|
+
_: 2
|
|
151
|
+
/* DYNAMIC */
|
|
152
|
+
|
|
153
|
+
}, [_ctx.$slots['prepend-icon'] ? {
|
|
154
|
+
name: "prepend-icon",
|
|
155
|
+
fn: _withCtx(() => [_renderSlot(_ctx.$slots, "prepend-icon")]),
|
|
156
|
+
key: "0"
|
|
157
|
+
} : undefined]), 1040
|
|
158
|
+
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
148
159
|
)]),
|
|
149
160
|
_: 3
|
|
150
161
|
/* FORWARDED */
|
|
@@ -199,6 +210,28 @@ var __sfc__ = defineComponent({
|
|
|
199
210
|
} = useValidation();
|
|
200
211
|
var menuEl = ref(null);
|
|
201
212
|
var placement = computed(() => props.variant === 'outlined' ? 'bottom-start' : 'cover-top-start');
|
|
213
|
+
var placeholderColor = computed(() => {
|
|
214
|
+
var {
|
|
215
|
+
hint,
|
|
216
|
+
blurColor,
|
|
217
|
+
focusColor
|
|
218
|
+
} = props;
|
|
219
|
+
|
|
220
|
+
if (hint) {
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (errorMessage.value) {
|
|
225
|
+
return 'var(--field-decorator-error-color)';
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (isFocus.value) {
|
|
229
|
+
return focusColor || 'var(--field-decorator-focus-color)';
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return blurColor || 'var(--field-decorator-blur-color)';
|
|
233
|
+
});
|
|
234
|
+
var useCustomPlaceholder = computed(() => !props.hint && isEmpty(props.modelValue) && !isFocus.value);
|
|
202
235
|
|
|
203
236
|
var computeLabel = () => {
|
|
204
237
|
var {
|
|
@@ -457,6 +490,8 @@ var __sfc__ = defineComponent({
|
|
|
457
490
|
menuEl,
|
|
458
491
|
placement,
|
|
459
492
|
cursor,
|
|
493
|
+
placeholderColor,
|
|
494
|
+
useCustomPlaceholder,
|
|
460
495
|
n,
|
|
461
496
|
classes,
|
|
462
497
|
handleFocus,
|
package/es/select/select.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --select-scroller-background: #fff; --select-scroller-padding: 6px 0; --select-scroller-max-height: 278px; --select-scroller-border-radius: 2px; --select-chip-margin: 5px 5px 0; --select-arrow-size: 20px; --select-standard-scroller-margin: calc(var(--field-decorator-placeholder-size) * 0.75 + 12px) 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; border-radius: var(--select-scroller-border-radius);}.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;
|
|
1
|
+
:root { --select-scroller-background: #fff; --select-scroller-padding: 6px 0; --select-scroller-max-height: 278px; --select-scroller-border-radius: 2px; --select-chip-margin: 5px 5px 0; --select-arrow-size: 20px; --select-standard-scroller-margin: calc(var(--field-decorator-placeholder-size) * 0.75 + 12px) 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; border-radius: var(--select-scroller-border-radius);}.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__placeholder { max-width: 100%; position: absolute; top: 0; left: 0; font-size: var(--field-decorator-placeholder-size); line-height: 1.5em; color: var(--field-decorator-blur-color); pointer-events: none; cursor: inherit;}.var-select__arrow[var-select-cover] { flex-shrink: 0; font-size: var(--select-arrow-size);}.var-select--scroller-standard { margin: var(--select-standard-scroller-margin);}.var-select--scroller-outlined { margin: 0;}.var-select--scroller-non-hint { margin: 0;}.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);}
|
package/es/slider/Slider.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { useValidation, createNamespace, call } from '../utils/components.mjs';
|
|
|
4
4
|
import { useForm } from '../form/provide.mjs';
|
|
5
5
|
import VarHoverOverlay, { useHoverOverlay } from '../hover-overlay/index.mjs';
|
|
6
6
|
import Hover from '../hover/index.mjs';
|
|
7
|
-
import { getLeft, multiplySizeUnit } from '../utils/elements.mjs';
|
|
7
|
+
import { getLeft, multiplySizeUnit, getRect } from '../utils/elements.mjs';
|
|
8
8
|
import { warn } from '../utils/logger.mjs';
|
|
9
9
|
import { isArray, isNumber, toNumber } from '@varlet/shared';
|
|
10
10
|
import { props, Thumbs } from './props.mjs';
|
|
@@ -225,7 +225,7 @@ var __sfc__ = defineComponent({
|
|
|
225
225
|
return e.clientX - getLeft(currentTarget);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
return maxDistance.value - (e.clientY - currentTarget
|
|
228
|
+
return maxDistance.value - (e.clientY - getRect(currentTarget).top);
|
|
229
229
|
};
|
|
230
230
|
|
|
231
231
|
var thumbStyle = thumb => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import '../../styles/common.css'
|
|
2
|
-
import '../SnackbarSfc.css'
|
|
3
2
|
import '../../styles/elevation.css'
|
|
4
3
|
import '../../loading/loading.css'
|
|
5
4
|
import '../../button/button.css'
|
|
6
5
|
import '../../icon/icon.css'
|
|
7
6
|
import '../snackbar.css'
|
|
8
7
|
import '../coreSfc.css'
|
|
8
|
+
import '../SnackbarSfc.css'
|
package/es/sticky/Sticky.mjs
CHANGED
|
@@ -4,7 +4,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
4
4
|
|
|
5
5
|
import { defineComponent, ref, onUnmounted, onDeactivated, computed, watch } from 'vue';
|
|
6
6
|
import { props } from './props.mjs';
|
|
7
|
-
import { doubleRaf, getParentScroller, raf, toPxNum } from '../utils/elements.mjs';
|
|
7
|
+
import { doubleRaf, getParentScroller, raf, toPxNum, getRect } from '../utils/elements.mjs';
|
|
8
8
|
import { toNumber } from '@varlet/shared';
|
|
9
9
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
10
10
|
import { useEventListener, useMounted } from '@varlet/use';
|
|
@@ -76,7 +76,7 @@ var __sfc__ = defineComponent({
|
|
|
76
76
|
if (scroller !== window) {
|
|
77
77
|
var {
|
|
78
78
|
top
|
|
79
|
-
} = scroller
|
|
79
|
+
} = getRect(scroller);
|
|
80
80
|
scrollerTop = top;
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -85,7 +85,7 @@ var __sfc__ = defineComponent({
|
|
|
85
85
|
var {
|
|
86
86
|
top: stickyTop,
|
|
87
87
|
left: stickyLeft
|
|
88
|
-
} = sticky
|
|
88
|
+
} = getRect(sticky);
|
|
89
89
|
var currentOffsetTop = stickyTop - scrollerTop;
|
|
90
90
|
|
|
91
91
|
if (currentOffsetTop <= offsetTop.value) {
|