@varlet/ui 2.17.0 → 2.18.0-alpha.1697472019506

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/es/action-sheet/actionSheet.css +1 -1
  2. package/es/dialog/dialog.css +1 -1
  3. package/es/drag/Drag.mjs +2 -2
  4. package/es/form/Form.mjs +3 -3
  5. package/es/image-preview/ImagePreview.mjs +2 -2
  6. package/es/index-bar/indexBar.css +1 -1
  7. package/es/index.bundle.mjs +13 -1
  8. package/es/index.mjs +11 -1
  9. package/es/input/Input.mjs +2 -2
  10. package/es/menu/style/index.mjs +1 -1
  11. package/es/menu-option/MenuOption.mjs +122 -0
  12. package/es/menu-option/MenuOptionSfc.css +0 -0
  13. package/es/menu-option/index.mjs +11 -0
  14. package/es/menu-option/menuOption.css +1 -0
  15. package/es/menu-option/props.mjs +8 -0
  16. package/es/menu-option/provide.mjs +19 -0
  17. package/es/menu-option/style/index.mjs +5 -0
  18. package/es/menu-select/MenuSelect.mjs +110 -0
  19. package/es/menu-select/MenuSelectSfc.css +0 -0
  20. package/es/menu-select/index.mjs +9 -0
  21. package/es/menu-select/menuSelect.css +1 -0
  22. package/es/menu-select/props.mjs +58 -0
  23. package/es/menu-select/provide.mjs +16 -0
  24. package/es/menu-select/style/index.mjs +5 -0
  25. package/es/option/Option.mjs +28 -28
  26. package/es/option/option.css +1 -1
  27. package/es/option/props.mjs +2 -1
  28. package/es/popup/popup.css +1 -1
  29. package/es/pull-refresh/PullRefresh.mjs +2 -2
  30. package/es/ripple/index.mjs +2 -0
  31. package/es/select/Select.mjs +14 -47
  32. package/es/select/useSelectController.mjs +67 -0
  33. package/es/slider/Slider.mjs +2 -2
  34. package/es/style.css +1 -1
  35. package/es/style.mjs +2 -0
  36. package/es/swipe/Swipe.mjs +13 -13
  37. package/es/themes/dark/index.mjs +3 -2
  38. package/es/themes/dark/menuOption.mjs +6 -0
  39. package/es/themes/dark/option.mjs +1 -1
  40. package/es/time-picker/TimePicker.mjs +2 -2
  41. package/es/uploader/Uploader.mjs +8 -4
  42. package/es/uploader/props.mjs +2 -0
  43. package/es/utils/shared.mjs +4 -4
  44. package/es/varlet.esm.js +5429 -5139
  45. package/highlight/web-types.en-US.json +359 -90
  46. package/highlight/web-types.zh-CN.json +271 -2
  47. package/lib/style.css +1 -1
  48. package/lib/varlet.cjs.js +2101 -1744
  49. package/package.json +7 -7
  50. package/types/index.d.ts +4 -0
  51. package/types/menuOption.d.ts +20 -0
  52. package/types/menuSelect.d.ts +70 -0
  53. package/types/option.d.ts +1 -0
  54. package/types/uploader.d.ts +2 -0
  55. 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;}
@@ -1 +1 @@
1
- :root { --dialog-width: 280px; --dialog-border-radius: 3px; --dialog-title-padding: 20px 20px 0; --dialog-message-color: #888; --dialog-message-padding: 12px 20px; --dialog-message-line-height: 24px; --dialog-message-font-size: var(--font-size-md); --dialog-title-font-size: var(--font-size-lg); --dialog-actions-padding: 0 12px 12px; --dialog-button-margin-left: 6px; --dialog-title-color: #555; --dialog-confirm-button-color: var(--color-primary); --dialog-cancel-button-color: var(--color-primary); --dialog-background: #fff;}.var-dialog { width: var(--dialog-width); border-radius: var(--dialog-border-radius); background: var(--dialog-background); transition: 0.25s background-color;}.var-dialog__popup[var-dialog-cover] { background: transparent;}.var-dialog__title { font-size: var(--dialog-title-font-size); font-weight: 400; padding: var(--dialog-title-padding); color: var(--dialog-title-color);}.var-dialog__message { padding: var(--dialog-message-padding); color: var(--dialog-message-color); line-height: var(--dialog-message-line-height); font-size: var(--dialog-message-font-size);}.var-dialog__actions { display: flex; justify-content: flex-end; padding: var(--dialog-actions-padding);}.var-dialog__button[var-dialog-cover] { margin-left: var(--dialog-button-margin-left); background-color: transparent; box-shadow: none;}.var-dialog__button[var-dialog-cover]:active { box-shadow: none;}.var-dialog__confirm-button[var-dialog-cover] { color: var(--dialog-confirm-button-color);}.var-dialog__cancel-button[var-dialog-cover] { color: var(--dialog-cancel-button-color);}
1
+ :root { --dialog-width: 280px; --dialog-border-radius: 3px; --dialog-title-padding: 20px 20px 0; --dialog-message-color: #888; --dialog-message-padding: 12px 20px; --dialog-message-line-height: 24px; --dialog-message-font-size: var(--font-size-md); --dialog-title-font-size: var(--font-size-lg); --dialog-actions-padding: 0 12px 12px; --dialog-button-margin-left: 6px; --dialog-title-color: #555; --dialog-confirm-button-color: var(--color-primary); --dialog-cancel-button-color: var(--color-primary); --dialog-background: #fff;}.var-dialog { width: var(--dialog-width); border-radius: var(--dialog-border-radius); background: var(--dialog-background); transition: 0.25s background-color;}.var-dialog__popup[var-dialog-cover] { background: transparent;}.var-dialog__title { font-size: var(--dialog-title-font-size); font-weight: 400; padding: var(--dialog-title-padding); color: var(--dialog-title-color);}.var-dialog__message { padding: var(--dialog-message-padding); color: var(--dialog-message-color); line-height: var(--dialog-message-line-height); font-size: var(--dialog-message-font-size); word-wrap: break-word;}.var-dialog__actions { display: flex; justify-content: flex-end; padding: var(--dialog-actions-padding);}.var-dialog__button[var-dialog-cover] { margin-left: var(--dialog-button-margin-left); background-color: transparent; box-shadow: none;}.var-dialog__button[var-dialog-cover]:active { box-shadow: none;}.var-dialog__confirm-button[var-dialog-cover] { color: var(--dialog-confirm-button-color);}.var-dialog__cancel-button[var-dialog-cover] { color: var(--dialog-cancel-button-color);}
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
- event.preventDefault();
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
- event.preventDefault();
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
- event.preventDefault();
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 && event.preventDefault();
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: 0; top: 50%; transform: translate(0, -50%); 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);}
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);}
@@ -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.17.0'
259
+ const version = '2.18.0-alpha.1697472019506'
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.17.0'
173
+ const version = '2.18.0-alpha.1697472019506'
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,
@@ -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
- e.preventDefault();
317
+ preventDefault(e);
318
318
  }
319
319
  function reset() {
320
320
  call(props2["onUpdate:modelValue"], "");
@@ -1,4 +1,4 @@
1
- import '../menu.css'
2
1
  import '../../styles/elevation.css'
3
2
  import '../../styles/common.css'
3
+ import '../menu.css'
4
4
  import '../MenuSfc.css'
@@ -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,8 @@
1
+ const props = {
2
+ label: {},
3
+ value: {},
4
+ disabled: Boolean
5
+ };
6
+ export {
7
+ props
8
+ };
@@ -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,5 @@
1
+ import '../../styles/common.css'
2
+ import '../../ripple/ripple.css'
3
+ import '../../checkbox/checkbox.css'
4
+ import '../menuOption.css'
5
+ import '../MenuOptionSfc.css'
@@ -0,0 +1,110 @@
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 } 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": _ctx.defaultStyle,
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("scroller"), [_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", "default-style", "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
+ open,
101
+ close,
102
+ resize
103
+ };
104
+ }
105
+ });
106
+ __sfc__.render = __render__;
107
+ var stdin_default = __sfc__;
108
+ export {
109
+ stdin_default as default
110
+ };
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-scroller-max-height: 278px; --menu-select-scroller-padding: 4px 0; --menu-select-scroller-border-radius: 2px;}.var-menu-select__scroller { padding: var(--menu-select-scroller-padding); border-radius: var(--menu-select-scroller-border-radius);}.var-menu-select--scrollable { overflow-y: auto; max-height: var(--menu-select-scroller-max-height);}
@@ -0,0 +1,58 @@
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
+ "defaultStyle",
47
+ "popoverClass",
48
+ "closeOnClickReference",
49
+ "onOpen",
50
+ "onOpened",
51
+ "onClose",
52
+ "onClosed",
53
+ "onClickOutside",
54
+ "onUpdate:show"
55
+ ]));
56
+ export {
57
+ props
58
+ };
@@ -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
+ };
@@ -0,0 +1,5 @@
1
+ import '../../styles/elevation.css'
2
+ import '../../styles/common.css'
3
+ import '../../menu/menu.css'
4
+ import '../menuSelect.css'
5
+ import '../MenuSelectSfc.css'