@varlet/ui 2.7.3 → 2.7.4-alpha.1675865250542
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/action-sheet/index.mjs +30 -6
- package/es/countdown/Countdown.mjs +1 -1
- package/es/dialog/index.mjs +40 -11
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/input.css +1 -1
- package/es/loading-bar/index.mjs +22 -3
- package/es/select/select.css +1 -1
- package/es/snackbar/index.mjs +25 -10
- package/es/style.css +1 -1
- package/es/uploader/Uploader.mjs +18 -9
- package/es/varlet.esm.js +4077 -4008
- package/highlight/web-types.en-US.json +5931 -0
- package/highlight/{web-types.json → web-types.zh-CN.json} +10 -1
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +206 -105
- package/package.json +6 -10
- package/types/actionSheet.d.ts +7 -3
- package/types/dialog.d.ts +7 -2
- package/types/loadingBar.d.ts +5 -0
- package/types/snackbar.d.ts +5 -1
- package/types/uploader.d.ts +4 -0
- package/umd/style.css +1 -1
- package/umd/varlet.js +6 -6
- package/highlight/attributes.json +0 -2074
- package/highlight/tags.json +0 -800
|
@@ -1,8 +1,19 @@
|
|
|
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
|
+
|
|
1
3
|
import VarActionSheet from './ActionSheet.mjs';
|
|
2
4
|
import { nextTick, reactive } from 'vue';
|
|
3
5
|
import { inBrowser } from '@varlet/shared';
|
|
4
6
|
import { call, mountInstance } from '../utils/components.mjs';
|
|
5
7
|
var singletonOptions;
|
|
8
|
+
var defaultOptions = {};
|
|
9
|
+
|
|
10
|
+
function normalizeOptions(options) {
|
|
11
|
+
if (options === void 0) {
|
|
12
|
+
options = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return _extends({}, defaultOptions, options);
|
|
16
|
+
}
|
|
6
17
|
|
|
7
18
|
function ActionSheet(options) {
|
|
8
19
|
if (!inBrowser()) {
|
|
@@ -11,7 +22,7 @@ function ActionSheet(options) {
|
|
|
11
22
|
|
|
12
23
|
return new Promise(resolve => {
|
|
13
24
|
ActionSheet.close();
|
|
14
|
-
var reactiveActionSheetOptions = reactive(options);
|
|
25
|
+
var reactiveActionSheetOptions = reactive(normalizeOptions(options));
|
|
15
26
|
reactiveActionSheetOptions.teleport = 'body';
|
|
16
27
|
singletonOptions = reactiveActionSheetOptions;
|
|
17
28
|
var {
|
|
@@ -42,13 +53,15 @@ function ActionSheet(options) {
|
|
|
42
53
|
});
|
|
43
54
|
}
|
|
44
55
|
|
|
45
|
-
|
|
56
|
+
function setDefaultOptions(options) {
|
|
57
|
+
defaultOptions = options;
|
|
58
|
+
}
|
|
46
59
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
60
|
+
function resetDefaultOptions() {
|
|
61
|
+
defaultOptions = {};
|
|
62
|
+
}
|
|
50
63
|
|
|
51
|
-
|
|
64
|
+
function close() {
|
|
52
65
|
if (singletonOptions != null) {
|
|
53
66
|
var prevSingletonOptions = singletonOptions;
|
|
54
67
|
singletonOptions = null;
|
|
@@ -56,12 +69,23 @@ ActionSheet.close = () => {
|
|
|
56
69
|
prevSingletonOptions.show = false;
|
|
57
70
|
});
|
|
58
71
|
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
ActionSheet.Component = VarActionSheet;
|
|
75
|
+
|
|
76
|
+
VarActionSheet.install = function (app) {
|
|
77
|
+
app.component(VarActionSheet.name, VarActionSheet);
|
|
59
78
|
};
|
|
60
79
|
|
|
61
80
|
ActionSheet.install = function (app) {
|
|
62
81
|
app.component(VarActionSheet.name, VarActionSheet);
|
|
63
82
|
};
|
|
64
83
|
|
|
84
|
+
Object.assign(ActionSheet, {
|
|
85
|
+
setDefaultOptions,
|
|
86
|
+
resetDefaultOptions,
|
|
87
|
+
close
|
|
88
|
+
});
|
|
65
89
|
export { props as actionSheetProps } from './props.mjs';
|
|
66
90
|
export var _ActionSheetComponent = VarActionSheet;
|
|
67
91
|
export default ActionSheet;
|
|
@@ -92,7 +92,7 @@ var __sfc__ = defineComponent({
|
|
|
92
92
|
onEnd,
|
|
93
93
|
autoStart
|
|
94
94
|
} = props;
|
|
95
|
-
var now =
|
|
95
|
+
var now = performance.now();
|
|
96
96
|
if (!endTime.value) endTime.value = now + toNumber(time);
|
|
97
97
|
var durationTime = endTime.value - now;
|
|
98
98
|
if (durationTime < 0) durationTime = 0;
|
package/es/dialog/index.mjs
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
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
|
+
|
|
1
3
|
import VarDialog from './Dialog.mjs';
|
|
2
4
|
import { reactive, nextTick } from 'vue';
|
|
3
|
-
import { inBrowser,
|
|
5
|
+
import { inBrowser, isString } from '@varlet/shared';
|
|
4
6
|
import { call, mountInstance } from '../utils/components.mjs';
|
|
5
7
|
var singletonOptions;
|
|
8
|
+
var defaultOptions = {};
|
|
9
|
+
|
|
10
|
+
function normalizeOptions(options) {
|
|
11
|
+
if (options === void 0) {
|
|
12
|
+
options = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (isString(options)) {
|
|
16
|
+
return _extends({}, defaultOptions, {
|
|
17
|
+
message: options
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return _extends({}, defaultOptions, options);
|
|
22
|
+
}
|
|
6
23
|
|
|
7
24
|
function Dialog(options) {
|
|
8
25
|
if (!inBrowser()) {
|
|
@@ -11,9 +28,7 @@ function Dialog(options) {
|
|
|
11
28
|
|
|
12
29
|
return new Promise(resolve => {
|
|
13
30
|
Dialog.close();
|
|
14
|
-
var dialogOptions =
|
|
15
|
-
message: String(options)
|
|
16
|
-
} : options;
|
|
31
|
+
var dialogOptions = normalizeOptions(options);
|
|
17
32
|
var reactiveDialogOptions = reactive(dialogOptions);
|
|
18
33
|
reactiveDialogOptions.teleport = 'body';
|
|
19
34
|
singletonOptions = reactiveDialogOptions;
|
|
@@ -49,15 +64,15 @@ function Dialog(options) {
|
|
|
49
64
|
});
|
|
50
65
|
}
|
|
51
66
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
67
|
+
function setDefaultOptions(options) {
|
|
68
|
+
defaultOptions = options;
|
|
69
|
+
}
|
|
55
70
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
71
|
+
function resetDefaultOptions() {
|
|
72
|
+
defaultOptions = {};
|
|
73
|
+
}
|
|
59
74
|
|
|
60
|
-
|
|
75
|
+
function close() {
|
|
61
76
|
if (singletonOptions != null) {
|
|
62
77
|
var prevSingletonOptions = singletonOptions;
|
|
63
78
|
singletonOptions = null;
|
|
@@ -65,6 +80,20 @@ Dialog.close = () => {
|
|
|
65
80
|
prevSingletonOptions.show = false;
|
|
66
81
|
});
|
|
67
82
|
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
Object.assign(Dialog, {
|
|
86
|
+
setDefaultOptions,
|
|
87
|
+
resetDefaultOptions,
|
|
88
|
+
close
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
VarDialog.install = function (app) {
|
|
92
|
+
app.component(VarDialog.name, VarDialog);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
Dialog.install = function (app) {
|
|
96
|
+
app.component(VarDialog.name, VarDialog);
|
|
68
97
|
};
|
|
69
98
|
|
|
70
99
|
Dialog.Component = VarDialog;
|
package/es/index.bundle.mjs
CHANGED
|
@@ -217,7 +217,7 @@ import './time-picker/style/index.mjs'
|
|
|
217
217
|
import './tooltip/style/index.mjs'
|
|
218
218
|
import './uploader/style/index.mjs'
|
|
219
219
|
|
|
220
|
-
const version = '2.7.
|
|
220
|
+
const version = '2.7.4-alpha.1675865250542'
|
|
221
221
|
|
|
222
222
|
function install(app) {
|
|
223
223
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/index.mjs
CHANGED
|
@@ -144,7 +144,7 @@ export * from './time-picker/index.mjs'
|
|
|
144
144
|
export * from './tooltip/index.mjs'
|
|
145
145
|
export * from './uploader/index.mjs'
|
|
146
146
|
|
|
147
|
-
const version = '2.7.
|
|
147
|
+
const version = '2.7.4-alpha.1675865250542'
|
|
148
148
|
|
|
149
149
|
function install(app) {
|
|
150
150
|
ActionSheet.install && app.use(ActionSheet)
|
package/es/input/input.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --input-input-text-color: #555; --input-error-color: var(--color-danger); --input-blur-color: #888; --input-focus-color: var(--color-primary); --input-placeholder-size: 16px; --input-textarea-height: auto; --input-textarea-padding-top: 8px; --input-icon-padding: 16px 0 0; --input-icon-size: 20px; --input-line-size: 1px; --input-line-spread-size: 2px; --input-disabled-color: var(--color-text-disabled);}.var-input-footer-margin-enter-from,.var-input-footer-margin-leave-to { opacity: 0; margin-top: 2px !important;}.var-input-footer-margin-enter-active,.var-input-footer-margin-leave-active { transition: 0.2s all var(--cubic-bezier);}.var-input { width: 100%; color: var(--input-input-text-color);}.var-input__controller { width: 100%; display: flex; position: relative;}.var-input__wrap { position: relative; flex-grow: 1; display: flex; flex-direction: column; padding-top: var(--input-placeholder-size);}.var-input__icon { display: flex; align-items: center; padding: var(--input-icon-padding); font-size: 20px;}.var-input__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(--input-placeholder-size) / 2)) scale(1); font-size: var(--input-placeholder-size); color: var(--input-blur-color); cursor: inherit;}.var-input__textarea-placeholder { position: absolute; top: 0; left: 0; width: 100%; transform-origin: left; transition: transform 0.3s, width 0.3s, color 0.25s; transform: translate(0, calc(var(--input-textarea-padding-top) + var(--input-placeholder-size))) scale(1); font-size: var(--input-placeholder-size); color: var(--input-blur-color); cursor: inherit;}.var-input__autocomplete { width: 0; height: 0; padding: 0; border: none; outline: none; font-size: 0;}.var-input__input { width: 100%; height: 32px; padding: 0; outline: none; border: none; background: transparent; color: var(--input-input-text-color); caret-color: var(--input-focus-color); transition: color 0.25s; font: inherit;}.var-input__line { width: 100%; height: var(--input-line-size); background: var(--input-blur-color); transition: background-color 0.25s;}.var-input__dot { width: 100%; height: var(--input-line-spread-size); background: var(--input-focus-color); transform: scaleX(0); transform-origin: center; transition: transform 0.3s var(--cubic-bezier), background-color 0.25s;}.var-input__clear-icon[var-input-cover] { display: flex; margin-left: 4px;}.var-input--textarea { padding-top: var(--input-textarea-padding-top); height: var(--input-textarea-height);}.var-input--placeholder-hint { top: 0; width: 133.33%; transform: translate(0, 0) scale(0.75);}.var-input--placeholder-non-hint { top: 50%; transform: translate(0, -50%) scale(1);}.var-input--non-hint { padding-top: 0;}.var-input--placeholder-hidden { visibility: hidden;}.var-input--focus { color: var(--input-focus-color);}.var-input--spread { transform: scaleX(1);}.var-input--disabled { color: var(--input-disabled-color); cursor: not-allowed;}.var-input--error { color: var(--input-error-color);}.var-input--line-disabled { background: var(--input-disabled-color);}.var-input--line-error { background: var(--input-error-color);}.var-input--caret-error { caret-color: var(--input-error-color);}
|
|
1
|
+
:root { --input-input-text-color: #555; --input-error-color: var(--color-danger); --input-blur-color: #888; --input-focus-color: var(--color-primary); --input-placeholder-size: 16px; --input-textarea-height: auto; --input-textarea-padding-top: 8px; --input-icon-padding: 16px 0 0; --input-icon-size: 20px; --input-line-size: 1px; --input-line-spread-size: 2px; --input-disabled-color: var(--color-text-disabled);}.var-input-footer-margin-enter-from,.var-input-footer-margin-leave-to { opacity: 0; margin-top: 2px !important;}.var-input-footer-margin-enter-active,.var-input-footer-margin-leave-active { transition: 0.2s all var(--cubic-bezier);}.var-input { width: 100%; color: var(--input-input-text-color); overflow: hidden;}.var-input__controller { width: 100%; display: flex; position: relative;}.var-input__wrap { position: relative; flex-grow: 1; display: flex; flex-direction: column; padding-top: var(--input-placeholder-size);}.var-input__icon { display: flex; align-items: center; padding: var(--input-icon-padding); font-size: 20px;}.var-input__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(--input-placeholder-size) / 2)) scale(1); font-size: var(--input-placeholder-size); color: var(--input-blur-color); cursor: inherit;}.var-input__textarea-placeholder { position: absolute; top: 0; left: 0; width: 100%; transform-origin: left; transition: transform 0.3s, width 0.3s, color 0.25s; transform: translate(0, calc(var(--input-textarea-padding-top) + var(--input-placeholder-size))) scale(1); font-size: var(--input-placeholder-size); color: var(--input-blur-color); cursor: inherit;}.var-input__autocomplete { width: 0; height: 0; padding: 0; border: none; outline: none; font-size: 0;}.var-input__input { width: 100%; height: 32px; padding: 0; outline: none; border: none; background: transparent; color: var(--input-input-text-color); caret-color: var(--input-focus-color); transition: color 0.25s; font: inherit;}.var-input__line { width: 100%; height: var(--input-line-size); background: var(--input-blur-color); transition: background-color 0.25s;}.var-input__dot { width: 100%; height: var(--input-line-spread-size); background: var(--input-focus-color); transform: scaleX(0); transform-origin: center; transition: transform 0.3s var(--cubic-bezier), background-color 0.25s;}.var-input__clear-icon[var-input-cover] { display: flex; margin-left: 4px;}.var-input--textarea { padding-top: var(--input-textarea-padding-top); height: var(--input-textarea-height);}.var-input--placeholder-hint { top: 0; width: 133.33%; transform: translate(0, 0) scale(0.75);}.var-input--placeholder-non-hint { top: 50%; transform: translate(0, -50%) scale(1);}.var-input--non-hint { padding-top: 0;}.var-input--placeholder-hidden { visibility: hidden;}.var-input--focus { color: var(--input-focus-color);}.var-input--spread { transform: scaleX(1);}.var-input--disabled { color: var(--input-disabled-color); cursor: not-allowed;}.var-input--error { color: var(--input-error-color);}.var-input--line-disabled { background: var(--input-disabled-color);}.var-input--line-error { background: var(--input-error-color);}.var-input--caret-error { caret-color: var(--input-error-color);}
|
package/es/loading-bar/index.mjs
CHANGED
|
@@ -3,16 +3,31 @@ import { reactive } from 'vue';
|
|
|
3
3
|
import { mountInstance } from '../utils/components.mjs';
|
|
4
4
|
var timer;
|
|
5
5
|
var isMount;
|
|
6
|
-
var
|
|
6
|
+
var setOptions = {};
|
|
7
|
+
var internalProps = {
|
|
7
8
|
value: 0,
|
|
8
9
|
opacity: 0,
|
|
9
10
|
error: false
|
|
10
|
-
}
|
|
11
|
+
};
|
|
12
|
+
var props = reactive(internalProps);
|
|
11
13
|
|
|
12
14
|
var mergeConfig = options => {
|
|
13
15
|
Object.assign(props, options);
|
|
14
16
|
};
|
|
15
17
|
|
|
18
|
+
var setDefaultOptions = options => {
|
|
19
|
+
Object.assign(props, options);
|
|
20
|
+
setOptions = options;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var resetDefaultOptions = () => {
|
|
24
|
+
Object.keys(setOptions).forEach(key => {
|
|
25
|
+
if (props[key] !== undefined) {
|
|
26
|
+
props[key] = undefined;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
16
31
|
var changeValue = () => {
|
|
17
32
|
timer = window.setTimeout(() => {
|
|
18
33
|
if (props.value >= 95) return;
|
|
@@ -60,7 +75,11 @@ var LoadingBar = {
|
|
|
60
75
|
start,
|
|
61
76
|
finish,
|
|
62
77
|
error,
|
|
63
|
-
|
|
78
|
+
|
|
79
|
+
/** @deprecated Use setDefaultOptions to instead. */
|
|
80
|
+
mergeConfig,
|
|
81
|
+
setDefaultOptions,
|
|
82
|
+
resetDefaultOptions
|
|
64
83
|
};
|
|
65
84
|
export { props as loadingBarProps } from './props.mjs';
|
|
66
85
|
export var _LoadingBarComponent = LoadingBar;
|
package/es/select/select.css
CHANGED
|
@@ -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);}.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-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);}
|
package/es/snackbar/index.mjs
CHANGED
|
@@ -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 {
|
|
10
|
+
import { 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);
|
|
@@ -18,8 +18,7 @@ var sid = 0;
|
|
|
18
18
|
var isMount = false;
|
|
19
19
|
var unmount;
|
|
20
20
|
var isAllowMultiple = false;
|
|
21
|
-
var
|
|
22
|
-
var defaultOption = {
|
|
21
|
+
var defaultOptionsValue = {
|
|
23
22
|
type: undefined,
|
|
24
23
|
content: '',
|
|
25
24
|
position: 'top',
|
|
@@ -36,6 +35,8 @@ var defaultOption = {
|
|
|
36
35
|
onClose: () => {},
|
|
37
36
|
onClosed: () => {}
|
|
38
37
|
};
|
|
38
|
+
var uniqSnackbarOptions = reactive([]);
|
|
39
|
+
var defaultOptions = defaultOptionsValue;
|
|
39
40
|
var transitionGroupProps = {
|
|
40
41
|
name: 'var-snackbar-fade',
|
|
41
42
|
tag: 'div',
|
|
@@ -76,11 +77,9 @@ var TransitionGroupHost = {
|
|
|
76
77
|
"onUpdate:show": $event => reactiveSnackOptions.show = $event
|
|
77
78
|
}), null);
|
|
78
79
|
});
|
|
79
|
-
var zindex = context.zIndex; // avoid stylelint value-keyword-case error
|
|
80
|
-
|
|
81
80
|
return _createVNode(TransitionGroup, _mergeProps(transitionGroupProps, {
|
|
82
81
|
"style": {
|
|
83
|
-
zIndex:
|
|
82
|
+
zIndex: context.zIndex
|
|
84
83
|
},
|
|
85
84
|
"onAfterEnter": opened,
|
|
86
85
|
"onAfterLeave": removeUniqOption
|
|
@@ -93,10 +92,8 @@ var TransitionGroupHost = {
|
|
|
93
92
|
};
|
|
94
93
|
|
|
95
94
|
var Snackbar = function (options) {
|
|
96
|
-
var snackOptions =
|
|
97
|
-
|
|
98
|
-
} : options;
|
|
99
|
-
var reactiveSnackOptions = reactive(_extends({}, defaultOption, snackOptions));
|
|
95
|
+
var snackOptions = normalizeOptions(options);
|
|
96
|
+
var reactiveSnackOptions = reactive(_extends({}, defaultOptions, snackOptions));
|
|
100
97
|
reactiveSnackOptions.show = true;
|
|
101
98
|
|
|
102
99
|
if (!isMount) {
|
|
@@ -170,6 +167,14 @@ Snackbar.clear = function () {
|
|
|
170
167
|
});
|
|
171
168
|
};
|
|
172
169
|
|
|
170
|
+
Snackbar.setDefaultOptions = function (options) {
|
|
171
|
+
defaultOptions = options;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
Snackbar.resetDefaultOptions = function () {
|
|
175
|
+
defaultOptions = defaultOptionsValue;
|
|
176
|
+
};
|
|
177
|
+
|
|
173
178
|
Snackbar.Component = VarSnackbar;
|
|
174
179
|
|
|
175
180
|
function opened(element) {
|
|
@@ -204,6 +209,16 @@ function addUniqOption(uniqSnackbarOptionItem) {
|
|
|
204
209
|
uniqSnackbarOptions.push(uniqSnackbarOptionItem);
|
|
205
210
|
}
|
|
206
211
|
|
|
212
|
+
function normalizeOptions(options) {
|
|
213
|
+
if (options === void 0) {
|
|
214
|
+
options = {};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return isString(options) ? {
|
|
218
|
+
content: options
|
|
219
|
+
} : options;
|
|
220
|
+
}
|
|
221
|
+
|
|
207
222
|
function updateUniqOption(reactiveSnackOptions, _update) {
|
|
208
223
|
var [firstOption] = uniqSnackbarOptions;
|
|
209
224
|
firstOption.reactiveSnackOptions = _extends({}, firstOption.reactiveSnackOptions, reactiveSnackOptions);
|