@varlet/ui 2.17.1 → 2.18.0-alpha.1697511280107
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/actionSheet.css +1 -1
- package/es/drag/Drag.mjs +2 -2
- package/es/form/Form.mjs +3 -3
- package/es/image-preview/ImagePreview.mjs +2 -2
- package/es/index-bar/indexBar.css +1 -1
- package/es/index.bundle.mjs +13 -1
- package/es/index.mjs +11 -1
- package/es/input/Input.mjs +2 -2
- package/es/menu/style/index.mjs +1 -1
- package/es/menu-option/MenuOption.mjs +122 -0
- package/es/menu-option/MenuOptionSfc.css +0 -0
- package/es/menu-option/index.mjs +11 -0
- package/es/menu-option/menuOption.css +1 -0
- package/es/menu-option/props.mjs +8 -0
- package/es/menu-option/provide.mjs +19 -0
- package/es/menu-option/style/index.mjs +5 -0
- package/es/menu-select/MenuSelect.mjs +111 -0
- package/es/menu-select/MenuSelectSfc.css +0 -0
- package/es/menu-select/index.mjs +9 -0
- package/es/menu-select/menuSelect.css +1 -0
- package/es/menu-select/props.mjs +57 -0
- package/es/menu-select/provide.mjs +16 -0
- package/es/menu-select/style/index.mjs +5 -0
- package/es/pull-refresh/PullRefresh.mjs +2 -2
- package/es/ripple/index.mjs +2 -0
- package/es/select/Select.mjs +14 -47
- package/es/select/useSelectController.mjs +67 -0
- package/es/slider/Slider.mjs +2 -2
- package/es/style.css +1 -1
- package/es/style.mjs +2 -0
- package/es/swipe/Swipe.mjs +13 -13
- package/es/themes/dark/index.mjs +4 -2
- package/es/themes/dark/menuOption.mjs +6 -0
- package/es/themes/dark/menuSelect.mjs +6 -0
- package/es/time-picker/TimePicker.mjs +2 -2
- package/es/varlet.esm.js +5571 -5279
- package/highlight/web-types.en-US.json +327 -89
- package/highlight/web-types.zh-CN.json +240 -2
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +1998 -1645
- package/package.json +7 -7
- package/types/index.d.ts +4 -0
- package/types/menuOption.d.ts +20 -0
- package/types/menuSelect.d.ts +69 -0
- package/umd/varlet.js +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --action-sheet-border-radius: 2px; --action-sheet-title-color: #888; --action-sheet-title-padding: 10px 16px; --action-sheet-title-font-size: 14px; --action-sheet-action-item-height: 48px; --action-sheet-action-item-padding: 0 18px; --action-sheet-action-item-color: #333; --action-sheet-action-item-disabled-color: var(--color-text-disabled); --action-sheet-icon-margin: 0 20px 0 0; --action-sheet-icon-size: 24px; --action-sheet-background: #fff;}.var-action-sheet { padding: 10px 0; background: var(--action-sheet-background); transition: background-color 0.25s;}.var-action-sheet__popup-radius { border-radius: var(--action-sheet-border-radius);}.var-action-sheet__title { padding: var(--action-sheet-title-padding); color: var(--action-sheet-title-color); font-size: var(--action-sheet-title-font-size);}.var-action-sheet__action-item { display: flex; align-items: center; height: var(--action-sheet-action-item-height); padding: var(--action-sheet-action-item-padding); color: var(--action-sheet-action-item-color); cursor: pointer;}.var-action-sheet__action-name { overflow: auto; max-height: var(--action-sheet-action-item-height);}.var-action-sheet__action-icon[var-action-sheet-cover] { margin: var(--action-sheet-icon-margin); width: var(--action-sheet-icon-size); height: var(--action-sheet-icon-size); font-size: var(--action-sheet-icon-size);}.var-action-sheet--disabled { color: var(--action-sheet-action-item-disabled-color) !important; cursor: not-allowed;}
|
|
1
|
+
:root { --action-sheet-border-radius: 2px; --action-sheet-border-top: none; --action-sheet-title-color: #888; --action-sheet-title-padding: 10px 16px; --action-sheet-title-font-size: 14px; --action-sheet-action-item-height: 48px; --action-sheet-action-item-padding: 0 18px; --action-sheet-action-item-color: #333; --action-sheet-action-item-disabled-color: var(--color-text-disabled); --action-sheet-icon-margin: 0 20px 0 0; --action-sheet-icon-size: 24px; --action-sheet-background: #fff;}.var-action-sheet { padding: 10px 0; background: var(--action-sheet-background); transition: background-color 0.25s;}.var-action-sheet__popup-radius { border-radius: var(--action-sheet-border-radius); border-top: var(--action-sheet-border-top);}.var-action-sheet__title { padding: var(--action-sheet-title-padding); color: var(--action-sheet-title-color); font-size: var(--action-sheet-title-font-size);}.var-action-sheet__action-item { display: flex; align-items: center; height: var(--action-sheet-action-item-height); padding: var(--action-sheet-action-item-padding); color: var(--action-sheet-action-item-color); cursor: pointer;}.var-action-sheet__action-name { overflow: auto; max-height: var(--action-sheet-action-item-height);}.var-action-sheet__action-icon[var-action-sheet-cover] { margin: var(--action-sheet-icon-margin); width: var(--action-sheet-icon-size); height: var(--action-sheet-icon-size); font-size: var(--action-sheet-icon-size);}.var-action-sheet--disabled { color: var(--action-sheet-action-item-disabled-color) !important; cursor: not-allowed;}
|
package/es/drag/Drag.mjs
CHANGED
|
@@ -42,7 +42,7 @@ import { props } from "./props.mjs";
|
|
|
42
42
|
import { createNamespace, useTeleport, call } from "../utils/components.mjs";
|
|
43
43
|
import { toPxNum } from "../utils/elements.mjs";
|
|
44
44
|
import { onSmartMounted, onWindowResize, useTouch } from "@varlet/use";
|
|
45
|
-
import { clamp, getRect } from "@varlet/shared";
|
|
45
|
+
import { clamp, getRect, preventDefault } from "@varlet/shared";
|
|
46
46
|
const { name, n, classes } = createNamespace("drag");
|
|
47
47
|
import { renderSlot as _renderSlot, mergeProps as _mergeProps, createElementVNode as _createElementVNode, Teleport as _Teleport, openBlock as _openBlock, createBlock as _createBlock } from "vue";
|
|
48
48
|
function __render__(_ctx, _cache) {
|
|
@@ -109,7 +109,7 @@ const __sfc__ = defineComponent({
|
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
moveTouch(event);
|
|
112
|
-
|
|
112
|
+
preventDefault(event);
|
|
113
113
|
enableTransition.value = false;
|
|
114
114
|
dragged.value = true;
|
|
115
115
|
if (props2.direction.includes("x")) {
|
package/es/form/Form.mjs
CHANGED
|
@@ -22,7 +22,7 @@ import { defineComponent, computed } from "vue";
|
|
|
22
22
|
import { props } from "./props.mjs";
|
|
23
23
|
import { useFormItems } from "./provide.mjs";
|
|
24
24
|
import { call, createNamespace } from "../utils/components.mjs";
|
|
25
|
-
import { find } from "@varlet/shared";
|
|
25
|
+
import { find, preventDefault } from "@varlet/shared";
|
|
26
26
|
import { getParentScroller, getTop, scrollTo, toPxNum } from "../utils/elements.mjs";
|
|
27
27
|
import { linear } from "../utils/shared.mjs";
|
|
28
28
|
const { name, n } = createNamespace("form");
|
|
@@ -67,13 +67,13 @@ const __sfc__ = defineComponent({
|
|
|
67
67
|
}
|
|
68
68
|
function handleSubmit(event) {
|
|
69
69
|
return __async(this, null, function* () {
|
|
70
|
-
|
|
70
|
+
preventDefault(event);
|
|
71
71
|
const valid = yield validate();
|
|
72
72
|
call(props2.onSubmit, valid);
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
function handleReset(event) {
|
|
76
|
-
|
|
76
|
+
preventDefault(event);
|
|
77
77
|
reset();
|
|
78
78
|
call(props2.onReset);
|
|
79
79
|
}
|
|
@@ -3,7 +3,7 @@ import VarSwipeItem from "../swipe-item/index.mjs";
|
|
|
3
3
|
import VarIcon from "../icon/index.mjs";
|
|
4
4
|
import VarPopup from "../popup/index.mjs";
|
|
5
5
|
import { defineComponent, ref, computed, watch } from "vue";
|
|
6
|
-
import { toNumber, clamp } from "@varlet/shared";
|
|
6
|
+
import { toNumber, clamp, preventDefault } from "@varlet/shared";
|
|
7
7
|
import { useEventListener, useTouch } from "@varlet/use";
|
|
8
8
|
import { props } from "./props.mjs";
|
|
9
9
|
import { call, createNamespace } from "../utils/components.mjs";
|
|
@@ -308,7 +308,7 @@ const __sfc__ = defineComponent({
|
|
|
308
308
|
(_a = swipeRef.value) == null ? void 0 : _a.to(idx, options);
|
|
309
309
|
}
|
|
310
310
|
function preventImageDefault(event) {
|
|
311
|
-
props2.imagePreventDefault && props2.show &&
|
|
311
|
+
props2.imagePreventDefault && props2.show && preventDefault(event);
|
|
312
312
|
}
|
|
313
313
|
return {
|
|
314
314
|
swipeRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --index-bar-list-item-font-size: var(--font-size-xs); --index-bar-list-item-color: var(--color-primary); --index-bar-list-item-active-color: var(--color-danger); --index-bar-list-item-height: 14px; --index-bar-list-item-padding: 0 10px;}.var-index-bar { position: relative;}.var-index-bar__anchor-list { position: fixed; right:
|
|
1
|
+
:root { --index-bar-list-right: 0; --index-bar-list-top: 50%; --index-bar-list-left: auto; --index-bar-list-bottom: auto; --index-bar-list-transform: translate(0, -50%); --index-bar-list-item-font-size: var(--font-size-xs); --index-bar-list-item-color: var(--color-primary); --index-bar-list-item-active-color: var(--color-danger); --index-bar-list-item-height: 14px; --index-bar-list-item-padding: 0 10px;}.var-index-bar { position: relative;}.var-index-bar__anchor-list { position: fixed; right: var(--index-bar-list-right); top: var(--index-bar-list-top); left: var(--index-bar-list-left); bottom: var(--index-bar-list-bottom); transform: var(--index-bar-list-transform); list-style: none; padding: 0; margin: 0;}.var-index-bar__anchor-item { font-size: var(--index-bar-list-item-font-size); display: flex; align-items: center; height: var(--index-bar-list-item-height); justify-content: center; padding: var(--index-bar-list-item-padding); color: var(--index-bar-list-item-color); cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-index-bar__anchor-item--active { color: var(--index-bar-list-item-active-color);}
|
package/es/index.bundle.mjs
CHANGED
|
@@ -45,6 +45,8 @@ import Loading from './loading/index.mjs'
|
|
|
45
45
|
import LoadingBar from './loading-bar/index.mjs'
|
|
46
46
|
import Locale from './locale/index.mjs'
|
|
47
47
|
import Menu from './menu/index.mjs'
|
|
48
|
+
import MenuOption from './menu-option/index.mjs'
|
|
49
|
+
import MenuSelect from './menu-select/index.mjs'
|
|
48
50
|
import Option from './option/index.mjs'
|
|
49
51
|
import Overlay from './overlay/index.mjs'
|
|
50
52
|
import Pagination from './pagination/index.mjs'
|
|
@@ -129,6 +131,8 @@ export * from './loading/index.mjs'
|
|
|
129
131
|
export * from './loading-bar/index.mjs'
|
|
130
132
|
export * from './locale/index.mjs'
|
|
131
133
|
export * from './menu/index.mjs'
|
|
134
|
+
export * from './menu-option/index.mjs'
|
|
135
|
+
export * from './menu-select/index.mjs'
|
|
132
136
|
export * from './option/index.mjs'
|
|
133
137
|
export * from './overlay/index.mjs'
|
|
134
138
|
export * from './pagination/index.mjs'
|
|
@@ -213,6 +217,8 @@ import './loading/style/index.mjs'
|
|
|
213
217
|
import './loading-bar/style/index.mjs'
|
|
214
218
|
import './locale/style/index.mjs'
|
|
215
219
|
import './menu/style/index.mjs'
|
|
220
|
+
import './menu-option/style/index.mjs'
|
|
221
|
+
import './menu-select/style/index.mjs'
|
|
216
222
|
import './option/style/index.mjs'
|
|
217
223
|
import './overlay/style/index.mjs'
|
|
218
224
|
import './pagination/style/index.mjs'
|
|
@@ -250,7 +256,7 @@ import './tooltip/style/index.mjs'
|
|
|
250
256
|
import './uploader/style/index.mjs'
|
|
251
257
|
import './watermark/style/index.mjs'
|
|
252
258
|
|
|
253
|
-
const version = '2.
|
|
259
|
+
const version = '2.18.0-alpha.1697511280107'
|
|
254
260
|
|
|
255
261
|
function install(app) {
|
|
256
262
|
ActionSheet.install && app.use(ActionSheet)
|
|
@@ -300,6 +306,8 @@ function install(app) {
|
|
|
300
306
|
LoadingBar.install && app.use(LoadingBar)
|
|
301
307
|
Locale.install && app.use(Locale)
|
|
302
308
|
Menu.install && app.use(Menu)
|
|
309
|
+
MenuOption.install && app.use(MenuOption)
|
|
310
|
+
MenuSelect.install && app.use(MenuSelect)
|
|
303
311
|
Option.install && app.use(Option)
|
|
304
312
|
Overlay.install && app.use(Overlay)
|
|
305
313
|
Pagination.install && app.use(Pagination)
|
|
@@ -388,6 +396,8 @@ export {
|
|
|
388
396
|
LoadingBar,
|
|
389
397
|
Locale,
|
|
390
398
|
Menu,
|
|
399
|
+
MenuOption,
|
|
400
|
+
MenuSelect,
|
|
391
401
|
Option,
|
|
392
402
|
Overlay,
|
|
393
403
|
Pagination,
|
|
@@ -476,6 +486,8 @@ export default {
|
|
|
476
486
|
LoadingBar,
|
|
477
487
|
Locale,
|
|
478
488
|
Menu,
|
|
489
|
+
MenuOption,
|
|
490
|
+
MenuSelect,
|
|
479
491
|
Option,
|
|
480
492
|
Overlay,
|
|
481
493
|
Pagination,
|
package/es/index.mjs
CHANGED
|
@@ -45,6 +45,8 @@ import Loading from './loading/index.mjs'
|
|
|
45
45
|
import LoadingBar from './loading-bar/index.mjs'
|
|
46
46
|
import Locale from './locale/index.mjs'
|
|
47
47
|
import Menu from './menu/index.mjs'
|
|
48
|
+
import MenuOption from './menu-option/index.mjs'
|
|
49
|
+
import MenuSelect from './menu-select/index.mjs'
|
|
48
50
|
import Option from './option/index.mjs'
|
|
49
51
|
import Overlay from './overlay/index.mjs'
|
|
50
52
|
import Pagination from './pagination/index.mjs'
|
|
@@ -129,6 +131,8 @@ export * from './loading/index.mjs'
|
|
|
129
131
|
export * from './loading-bar/index.mjs'
|
|
130
132
|
export * from './locale/index.mjs'
|
|
131
133
|
export * from './menu/index.mjs'
|
|
134
|
+
export * from './menu-option/index.mjs'
|
|
135
|
+
export * from './menu-select/index.mjs'
|
|
132
136
|
export * from './option/index.mjs'
|
|
133
137
|
export * from './overlay/index.mjs'
|
|
134
138
|
export * from './pagination/index.mjs'
|
|
@@ -166,7 +170,7 @@ export * from './tooltip/index.mjs'
|
|
|
166
170
|
export * from './uploader/index.mjs'
|
|
167
171
|
export * from './watermark/index.mjs'
|
|
168
172
|
|
|
169
|
-
const version = '2.
|
|
173
|
+
const version = '2.18.0-alpha.1697511280107'
|
|
170
174
|
|
|
171
175
|
function install(app) {
|
|
172
176
|
ActionSheet.install && app.use(ActionSheet)
|
|
@@ -216,6 +220,8 @@ function install(app) {
|
|
|
216
220
|
LoadingBar.install && app.use(LoadingBar)
|
|
217
221
|
Locale.install && app.use(Locale)
|
|
218
222
|
Menu.install && app.use(Menu)
|
|
223
|
+
MenuOption.install && app.use(MenuOption)
|
|
224
|
+
MenuSelect.install && app.use(MenuSelect)
|
|
219
225
|
Option.install && app.use(Option)
|
|
220
226
|
Overlay.install && app.use(Overlay)
|
|
221
227
|
Pagination.install && app.use(Pagination)
|
|
@@ -304,6 +310,8 @@ export {
|
|
|
304
310
|
LoadingBar,
|
|
305
311
|
Locale,
|
|
306
312
|
Menu,
|
|
313
|
+
MenuOption,
|
|
314
|
+
MenuSelect,
|
|
307
315
|
Option,
|
|
308
316
|
Overlay,
|
|
309
317
|
Pagination,
|
|
@@ -392,6 +400,8 @@ export default {
|
|
|
392
400
|
LoadingBar,
|
|
393
401
|
Locale,
|
|
394
402
|
Menu,
|
|
403
|
+
MenuOption,
|
|
404
|
+
MenuSelect,
|
|
395
405
|
Option,
|
|
396
406
|
Overlay,
|
|
397
407
|
Pagination,
|
package/es/input/Input.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import VarFormDetails from "../form-details/index.mjs";
|
|
|
2
2
|
import VarFieldDecorator from "../field-decorator/index.mjs";
|
|
3
3
|
import { defineComponent, ref, computed, nextTick } from "vue";
|
|
4
4
|
import { props } from "./props.mjs";
|
|
5
|
-
import { isEmpty, toNumber } from "@varlet/shared";
|
|
5
|
+
import { isEmpty, preventDefault, toNumber } from "@varlet/shared";
|
|
6
6
|
import { useValidation, createNamespace, call } from "../utils/components.mjs";
|
|
7
7
|
import { useForm } from "../form/provide.mjs";
|
|
8
8
|
import { onSmartMounted, useId } from "@varlet/use";
|
|
@@ -314,7 +314,7 @@ const __sfc__ = defineComponent({
|
|
|
314
314
|
return;
|
|
315
315
|
}
|
|
316
316
|
focus();
|
|
317
|
-
|
|
317
|
+
preventDefault(e);
|
|
318
318
|
}
|
|
319
319
|
function reset() {
|
|
320
320
|
call(props2["onUpdate:modelValue"], "");
|
package/es/menu/style/index.mjs
CHANGED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import VarCheckbox from "../checkbox/index.mjs";
|
|
2
|
+
import Ripple from "../ripple/index.mjs";
|
|
3
|
+
import Hover from "../hover/index.mjs";
|
|
4
|
+
import VarHoverOverlay, { useHoverOverlay } from "../hover-overlay/index.mjs";
|
|
5
|
+
import { defineComponent, computed, ref, watch } from "vue";
|
|
6
|
+
import { useMenuSelect } from "./provide.mjs";
|
|
7
|
+
import { createNamespace } from "../utils/components.mjs";
|
|
8
|
+
import { props } from "./props.mjs";
|
|
9
|
+
const { name, n, classes } = createNamespace("menu-option");
|
|
10
|
+
import { normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withModifiers as _withModifiers, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createVNode as _createVNode, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives } from "vue";
|
|
11
|
+
function __render__(_ctx, _cache) {
|
|
12
|
+
const _component_var_checkbox = _resolveComponent("var-checkbox");
|
|
13
|
+
const _component_var_hover_overlay = _resolveComponent("var-hover-overlay");
|
|
14
|
+
const _directive_ripple = _resolveDirective("ripple");
|
|
15
|
+
const _directive_hover = _resolveDirective("hover");
|
|
16
|
+
return _withDirectives((_openBlock(), _createElementBlock(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
class: _normalizeClass(
|
|
20
|
+
_ctx.classes(_ctx.n(), _ctx.n("$--box"), _ctx.n(`--${_ctx.size}`), [_ctx.optionSelected, _ctx.n("--selected-color")], [_ctx.disabled, _ctx.n("--disabled")])
|
|
21
|
+
),
|
|
22
|
+
onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
|
|
23
|
+
},
|
|
24
|
+
[
|
|
25
|
+
_createElementVNode(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("cover"), [_ctx.optionSelected, _ctx.n("--selected-background")]))
|
|
29
|
+
},
|
|
30
|
+
null,
|
|
31
|
+
2
|
|
32
|
+
/* CLASS */
|
|
33
|
+
),
|
|
34
|
+
_ctx.multiple ? (_openBlock(), _createBlock(_component_var_checkbox, {
|
|
35
|
+
key: 0,
|
|
36
|
+
ref: "checkbox",
|
|
37
|
+
modelValue: _ctx.optionSelected,
|
|
38
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.optionSelected = $event),
|
|
39
|
+
disabled: _ctx.disabled,
|
|
40
|
+
onClick: _cache[1] || (_cache[1] = _withModifiers(() => {
|
|
41
|
+
}, ["stop"])),
|
|
42
|
+
onChange: _ctx.handleSelect
|
|
43
|
+
}, null, 8, ["modelValue", "disabled", "onChange"])) : _createCommentVNode("v-if", true),
|
|
44
|
+
_renderSlot(_ctx.$slots, "default", {}, () => [
|
|
45
|
+
_createElementVNode(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("text"), _ctx.n("$--ellipsis")))
|
|
49
|
+
},
|
|
50
|
+
_toDisplayString(_ctx.label),
|
|
51
|
+
3
|
|
52
|
+
/* TEXT, CLASS */
|
|
53
|
+
)
|
|
54
|
+
]),
|
|
55
|
+
_createVNode(_component_var_hover_overlay, {
|
|
56
|
+
hovering: _ctx.hovering && !_ctx.disabled
|
|
57
|
+
}, null, 8, ["hovering"])
|
|
58
|
+
],
|
|
59
|
+
2
|
|
60
|
+
/* CLASS */
|
|
61
|
+
)), [
|
|
62
|
+
[_directive_ripple, { disabled: _ctx.disabled }],
|
|
63
|
+
[_directive_hover, _ctx.handleHovering, "desktop"]
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
const __sfc__ = defineComponent({
|
|
67
|
+
name,
|
|
68
|
+
directives: { Ripple, Hover },
|
|
69
|
+
components: {
|
|
70
|
+
VarCheckbox,
|
|
71
|
+
VarHoverOverlay
|
|
72
|
+
},
|
|
73
|
+
props,
|
|
74
|
+
setup(props2) {
|
|
75
|
+
const optionSelected = ref(false);
|
|
76
|
+
const selected = computed(() => optionSelected.value);
|
|
77
|
+
const label = computed(() => props2.label);
|
|
78
|
+
const value = computed(() => props2.value);
|
|
79
|
+
const { menuSelect, bindMenuSelect } = useMenuSelect();
|
|
80
|
+
const { size, multiple, onSelect, computeLabel } = menuSelect;
|
|
81
|
+
const { hovering, handleHovering } = useHoverOverlay();
|
|
82
|
+
const menuOptionProvider = {
|
|
83
|
+
label,
|
|
84
|
+
value,
|
|
85
|
+
selected,
|
|
86
|
+
sync
|
|
87
|
+
};
|
|
88
|
+
watch([() => props2.label, () => props2.value], computeLabel);
|
|
89
|
+
bindMenuSelect(menuOptionProvider);
|
|
90
|
+
function handleClick() {
|
|
91
|
+
if (props2.disabled) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
handleSelect();
|
|
95
|
+
}
|
|
96
|
+
function handleSelect() {
|
|
97
|
+
if (multiple.value) {
|
|
98
|
+
optionSelected.value = !optionSelected.value;
|
|
99
|
+
}
|
|
100
|
+
onSelect(menuOptionProvider);
|
|
101
|
+
}
|
|
102
|
+
function sync(checked) {
|
|
103
|
+
optionSelected.value = checked;
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
optionSelected,
|
|
107
|
+
size,
|
|
108
|
+
multiple,
|
|
109
|
+
hovering,
|
|
110
|
+
n,
|
|
111
|
+
classes,
|
|
112
|
+
handleHovering,
|
|
113
|
+
handleClick,
|
|
114
|
+
handleSelect
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
__sfc__.render = __render__;
|
|
119
|
+
var stdin_default = __sfc__;
|
|
120
|
+
export {
|
|
121
|
+
stdin_default as default
|
|
122
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import MenuOption from "./MenuOption.mjs";
|
|
2
|
+
import { withInstall } from "../utils/components.mjs";
|
|
3
|
+
withInstall(MenuOption);
|
|
4
|
+
import { props } from "./props.mjs";
|
|
5
|
+
const _MenuOptionComponent = MenuOption;
|
|
6
|
+
var stdin_default = MenuOption;
|
|
7
|
+
export {
|
|
8
|
+
_MenuOptionComponent,
|
|
9
|
+
stdin_default as default,
|
|
10
|
+
props as menuOptionProps
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root { --menu-option-normal-height: 38px; --menu-option-small-height: 30px; --menu-option-mini-height: 24px; --menu-option-large-height: 46px; --menu-option-padding: 0 12px; --menu-option-normal-font-size: var(--font-size-md); --menu-option-small-font-size: var(--font-size-sm); --menu-option-mini-font-size: var(--font-size-xs); --menu-option-large-font-size: var(--font-size-lg); --menu-option-selected-background: var(--color-primary); --menu-option-text-color: #555; --menu-option-disabled-color: var(--color-text-disabled);}.var-menu-option { position: relative; display: flex; align-items: center; padding: var(--menu-option-padding); cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); color: var(--menu-option-text-color);}.var-menu-option__cover { position: absolute; top: 0; left: 0; right: 0; bottom: 0; opacity: 0.2; background: transparent;}.var-menu-option__text { display: flex; align-items: center;}.var-menu-option--normal { height: var(--menu-option-normal-height); font-size: var(--menu-option-normal-font-size);}.var-menu-option--large { height: var(--menu-option-large-height); font-size: var(--menu-option-large-font-size);}.var-menu-option--small { height: var(--menu-option-small-height); font-size: var(--menu-option-small-font-size);}.var-menu-option--mini { height: var(--menu-option-mini-height); font-size: var(--menu-option-mini-font-size);}.var-menu-option--selected-background { background: var(--menu-option-selected-background);}.var-menu-option--selected-color { color: var(--menu-option-selected-background);}.var-menu-option--disabled { color: var(--menu-option-disabled-color); cursor: not-allowed;}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useParent } from "@varlet/use";
|
|
2
|
+
import { error } from "../utils/logger.mjs";
|
|
3
|
+
import { MENU_SELECT_BIND_MENU_OPTION_KEY } from "../menu-select/provide.mjs";
|
|
4
|
+
function useMenuSelect() {
|
|
5
|
+
const { index, parentProvider, bindParent } = useParent(
|
|
6
|
+
MENU_SELECT_BIND_MENU_OPTION_KEY
|
|
7
|
+
);
|
|
8
|
+
if (!bindParent) {
|
|
9
|
+
error("MenuOption", "<var-menu-option/> must in <var-menu-select/>");
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
index,
|
|
13
|
+
menuSelect: parentProvider,
|
|
14
|
+
bindMenuSelect: bindParent
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
useMenuSelect
|
|
19
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import VarMenu from "../menu/index.mjs";
|
|
2
|
+
import { defineComponent, computed, ref } from "vue";
|
|
3
|
+
import { props } from "./props.mjs";
|
|
4
|
+
import { createNamespace, call, useVModel, formatElevation } from "../utils/components.mjs";
|
|
5
|
+
import { useMenuOptions } from "./provide.mjs";
|
|
6
|
+
import { useSelectController } from "../select/useSelectController.mjs";
|
|
7
|
+
const { name, n, classes } = createNamespace("menu-select");
|
|
8
|
+
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue";
|
|
9
|
+
function __render__(_ctx, _cache) {
|
|
10
|
+
const _component_var_menu = _resolveComponent("var-menu");
|
|
11
|
+
return _openBlock(), _createBlock(_component_var_menu, {
|
|
12
|
+
ref: "menu",
|
|
13
|
+
class: _normalizeClass(_ctx.n()),
|
|
14
|
+
disabled: _ctx.disabled,
|
|
15
|
+
trigger: _ctx.trigger,
|
|
16
|
+
reference: _ctx.reference,
|
|
17
|
+
placement: _ctx.placement,
|
|
18
|
+
strategy: _ctx.strategy,
|
|
19
|
+
"offset-x": _ctx.offsetX,
|
|
20
|
+
"offset-y": _ctx.offsetY,
|
|
21
|
+
teleport: _ctx.teleport,
|
|
22
|
+
"same-width": _ctx.sameWidth,
|
|
23
|
+
elevation: _ctx.elevation,
|
|
24
|
+
"default-style": false,
|
|
25
|
+
"popover-class": _ctx.popoverClass,
|
|
26
|
+
"close-on-click-reference": _ctx.closeOnClickReference,
|
|
27
|
+
show: _ctx.show,
|
|
28
|
+
"onUpdate:show": _cache[0] || (_cache[0] = ($event) => _ctx.show = $event),
|
|
29
|
+
onOpen: _ctx.onOpen,
|
|
30
|
+
onOpened: _ctx.onOpened,
|
|
31
|
+
onClose: _ctx.onClose,
|
|
32
|
+
onClosed: _ctx.onClosed,
|
|
33
|
+
onClickOutside: _ctx.onClickOutside
|
|
34
|
+
}, {
|
|
35
|
+
menu: _withCtx(() => [
|
|
36
|
+
_createElementVNode(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("menu"), _ctx.formatElevation(_ctx.elevation, 3), [_ctx.scrollable, _ctx.n("--scrollable")]))
|
|
40
|
+
},
|
|
41
|
+
[
|
|
42
|
+
_renderSlot(_ctx.$slots, "options")
|
|
43
|
+
],
|
|
44
|
+
2
|
|
45
|
+
/* CLASS */
|
|
46
|
+
)
|
|
47
|
+
]),
|
|
48
|
+
default: _withCtx(() => [
|
|
49
|
+
_renderSlot(_ctx.$slots, "default")
|
|
50
|
+
]),
|
|
51
|
+
_: 3
|
|
52
|
+
/* FORWARDED */
|
|
53
|
+
}, 8, ["class", "disabled", "trigger", "reference", "placement", "strategy", "offset-x", "offset-y", "teleport", "same-width", "elevation", "popover-class", "close-on-click-reference", "show", "onOpen", "onOpened", "onClose", "onClosed", "onClickOutside"]);
|
|
54
|
+
}
|
|
55
|
+
const __sfc__ = defineComponent({
|
|
56
|
+
name,
|
|
57
|
+
components: { VarMenu },
|
|
58
|
+
props,
|
|
59
|
+
setup(props2) {
|
|
60
|
+
const menu = ref(null);
|
|
61
|
+
const show = useVModel(props2, "show");
|
|
62
|
+
const { menuOptions, length, bindMenuOptions } = useMenuOptions();
|
|
63
|
+
const { computeLabel, getSelectedValue } = useSelectController({
|
|
64
|
+
modelValue: () => props2.modelValue,
|
|
65
|
+
multiple: () => props2.multiple,
|
|
66
|
+
optionProviders: () => menuOptions,
|
|
67
|
+
optionProvidersLength: () => length.value
|
|
68
|
+
});
|
|
69
|
+
const menuSelectProvider = {
|
|
70
|
+
size: computed(() => props2.size),
|
|
71
|
+
multiple: computed(() => props2.multiple),
|
|
72
|
+
computeLabel,
|
|
73
|
+
onSelect
|
|
74
|
+
};
|
|
75
|
+
bindMenuOptions(menuSelectProvider);
|
|
76
|
+
function onSelect(option) {
|
|
77
|
+
const { multiple, closeOnSelect } = props2;
|
|
78
|
+
call(props2["onUpdate:modelValue"], getSelectedValue(option));
|
|
79
|
+
if (!multiple && closeOnSelect) {
|
|
80
|
+
show.value = false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function open() {
|
|
84
|
+
var _a;
|
|
85
|
+
(_a = menu.value) == null ? void 0 : _a.open();
|
|
86
|
+
}
|
|
87
|
+
function close() {
|
|
88
|
+
var _a;
|
|
89
|
+
(_a = menu.value) == null ? void 0 : _a.close();
|
|
90
|
+
}
|
|
91
|
+
function resize() {
|
|
92
|
+
var _a;
|
|
93
|
+
(_a = menu.value) == null ? void 0 : _a.resize();
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
show,
|
|
97
|
+
menu,
|
|
98
|
+
n,
|
|
99
|
+
classes,
|
|
100
|
+
formatElevation,
|
|
101
|
+
open,
|
|
102
|
+
close,
|
|
103
|
+
resize
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
__sfc__.render = __render__;
|
|
108
|
+
var stdin_default = __sfc__;
|
|
109
|
+
export {
|
|
110
|
+
stdin_default as default
|
|
111
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import MenuSelect from "./MenuSelect.mjs";
|
|
2
|
+
import { withInstall } from "../utils/components.mjs";
|
|
3
|
+
withInstall(MenuSelect);
|
|
4
|
+
const _MenuSelectComponent = MenuSelect;
|
|
5
|
+
var stdin_default = MenuSelect;
|
|
6
|
+
export {
|
|
7
|
+
_MenuSelectComponent,
|
|
8
|
+
stdin_default as default
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root { --menu-select-menu-max-height: 278px; --menu-select-menu-padding: 0; --menu-select-menu-border-radius: 2px; --menu-select-menu-background-color: #fff;}.var-menu-select__menu { padding: var(--menu-select-menu-padding); border-radius: var(--menu-select-menu-border-radius); background-color: var(--menu-select-menu-background-color);}.var-menu-select--scrollable { overflow-y: auto; max-height: var(--menu-select-menu-max-height);}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import { menuProps } from "../menu/index.mjs";
|
|
18
|
+
import { defineListenerProp, pickProps } from "../utils/components.mjs";
|
|
19
|
+
const props = __spreadValues({
|
|
20
|
+
modelValue: {
|
|
21
|
+
default: void 0
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "normal"
|
|
26
|
+
},
|
|
27
|
+
multiple: Boolean,
|
|
28
|
+
scrollable: Boolean,
|
|
29
|
+
closeOnSelect: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: true
|
|
32
|
+
},
|
|
33
|
+
"onUpdate:modelValue": defineListenerProp()
|
|
34
|
+
}, pickProps(menuProps, [
|
|
35
|
+
"show",
|
|
36
|
+
"disabled",
|
|
37
|
+
"trigger",
|
|
38
|
+
"reference",
|
|
39
|
+
"placement",
|
|
40
|
+
"strategy",
|
|
41
|
+
"offsetX",
|
|
42
|
+
"offsetY",
|
|
43
|
+
"teleport",
|
|
44
|
+
"sameWidth",
|
|
45
|
+
"elevation",
|
|
46
|
+
"popoverClass",
|
|
47
|
+
"closeOnClickReference",
|
|
48
|
+
"onOpen",
|
|
49
|
+
"onOpened",
|
|
50
|
+
"onClose",
|
|
51
|
+
"onClosed",
|
|
52
|
+
"onClickOutside",
|
|
53
|
+
"onUpdate:show"
|
|
54
|
+
]));
|
|
55
|
+
export {
|
|
56
|
+
props
|
|
57
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useChildren } from "@varlet/use";
|
|
2
|
+
const MENU_SELECT_BIND_MENU_OPTION_KEY = Symbol("MENU_SELECT_BIND_MENU_OPTION_KEY");
|
|
3
|
+
function useMenuOptions() {
|
|
4
|
+
const { length, childProviders, bindChildren } = useChildren(
|
|
5
|
+
MENU_SELECT_BIND_MENU_OPTION_KEY
|
|
6
|
+
);
|
|
7
|
+
return {
|
|
8
|
+
length,
|
|
9
|
+
menuOptions: childProviders,
|
|
10
|
+
bindMenuOptions: bindChildren
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
MENU_SELECT_BIND_MENU_OPTION_KEY,
|
|
15
|
+
useMenuOptions
|
|
16
|
+
};
|
|
@@ -22,7 +22,7 @@ import VarIcon from "../icon/index.mjs";
|
|
|
22
22
|
import { defineComponent, ref, computed, watch, nextTick } from "vue";
|
|
23
23
|
import { getParentScroller, getScrollTop, getTarget } from "../utils/elements.mjs";
|
|
24
24
|
import { props } from "./props.mjs";
|
|
25
|
-
import { isNumber, isString, toNumber, getRect } from "@varlet/shared";
|
|
25
|
+
import { isNumber, isString, toNumber, getRect, preventDefault } from "@varlet/shared";
|
|
26
26
|
import { call, createNamespace } from "../utils/components.mjs";
|
|
27
27
|
import { useEventListener, onSmartMounted } from "@varlet/use";
|
|
28
28
|
const { name, n, classes } = createNamespace("pull-refresh");
|
|
@@ -147,7 +147,7 @@ const __sfc__ = defineComponent({
|
|
|
147
147
|
const touch = event.touches[0];
|
|
148
148
|
deltaY = touch.clientY - startY;
|
|
149
149
|
if (isReachTop && deltaY >= 0) {
|
|
150
|
-
|
|
150
|
+
preventDefault(event);
|
|
151
151
|
}
|
|
152
152
|
if (refreshStatus.value !== "pulling") {
|
|
153
153
|
refreshStatus.value = "pulling";
|
package/es/ripple/index.mjs
CHANGED
|
@@ -110,6 +110,7 @@ function mounted(el, binding) {
|
|
|
110
110
|
el.addEventListener("dragstart", removeRipple, { passive: true });
|
|
111
111
|
document.addEventListener("touchend", el._ripple.removeRipple, { passive: true });
|
|
112
112
|
document.addEventListener("touchcancel", el._ripple.removeRipple, { passive: true });
|
|
113
|
+
document.addEventListener("dragend", el._ripple.removeRipple, { passive: true });
|
|
113
114
|
}
|
|
114
115
|
function unmounted(el) {
|
|
115
116
|
el.removeEventListener("touchstart", createRipple);
|
|
@@ -117,6 +118,7 @@ function unmounted(el) {
|
|
|
117
118
|
el.removeEventListener("dragstart", removeRipple);
|
|
118
119
|
document.removeEventListener("touchend", el._ripple.removeRipple);
|
|
119
120
|
document.removeEventListener("touchcancel", el._ripple.removeRipple);
|
|
121
|
+
document.removeEventListener("dragend", el._ripple.removeRipple);
|
|
120
122
|
}
|
|
121
123
|
function updated(el, binding) {
|
|
122
124
|
var _a, _b, _c, _d, _e, _f;
|