@varlet/ui 3.3.10 → 3.3.12-alpha.1722841613989

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "3.3.10",
4
+ "version": "3.3.12-alpha.1722841613989",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -4352,7 +4352,7 @@
4352
4352
  },
4353
4353
  {
4354
4354
  "name": "trigger",
4355
- "description": "Menu trigger method, optional value is `click` `hover`, `click` is triggered when clicked, `hover` is triggered when hovered",
4355
+ "description": "Menu trigger method, optional value is `click` `hover` `manual`",
4356
4356
  "default": "click",
4357
4357
  "value": {
4358
4358
  "type": "string",
@@ -4617,7 +4617,7 @@
4617
4617
  },
4618
4618
  {
4619
4619
  "name": "trigger",
4620
- "description": "Menu trigger method, optional value is `click` `hover`, `click` is triggered when clicked, `hover` is triggered when hovered",
4620
+ "description": "Menu trigger method, optional value is `click` `hover` `manual`",
4621
4621
  "default": "click",
4622
4622
  "value": {
4623
4623
  "type": "string",
@@ -5112,13 +5112,22 @@
5112
5112
  },
5113
5113
  {
5114
5114
  "name": "option-count",
5115
- "description": "Number of visible options",
5115
+ "description": "Number of visible columns",
5116
5116
  "default": "6",
5117
5117
  "value": {
5118
5118
  "type": "string | number",
5119
5119
  "kind": "expression"
5120
5120
  }
5121
5121
  },
5122
+ {
5123
+ "name": "columns-count",
5124
+ "description": "Number of visible columns",
5125
+ "default": "-",
5126
+ "value": {
5127
+ "type": "string | number",
5128
+ "kind": "expression"
5129
+ }
5130
+ },
5122
5131
  {
5123
5132
  "name": "confirm-button-text",
5124
5133
  "description": "Confirm button text",
@@ -7703,7 +7712,7 @@
7703
7712
  },
7704
7713
  {
7705
7714
  "name": "trigger",
7706
- "description": "Tooltip trigger method, optional value is `click` `hover`, `click` is triggered when clicked, `hover` is triggered when hovered",
7715
+ "description": "Tooltip trigger method, optional value is `click` `hover` `manual`",
7707
7716
  "default": "hover",
7708
7717
  "value": {
7709
7718
  "type": "string",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "3.3.10",
4
+ "version": "3.3.12-alpha.1722841613989",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -4511,7 +4511,7 @@
4511
4511
  },
4512
4512
  {
4513
4513
  "name": "trigger",
4514
- "description": "菜单触发方式,可选值为 `click` `hover`, `click` 为点击时触发, `hover` 为悬停时触发",
4514
+ "description": "菜单触发方式,可选值为 `click` `hover` `manual`",
4515
4515
  "default": "click",
4516
4516
  "value": {
4517
4517
  "type": "string",
@@ -4776,7 +4776,7 @@
4776
4776
  },
4777
4777
  {
4778
4778
  "name": "trigger",
4779
- "description": "菜单触发方式,可选值为 `click` `hover`, `click` 为点击时触发, `hover` 为悬停时触发",
4779
+ "description": "菜单触发方式,可选值为 `click` `hover` `manual`",
4780
4780
  "default": "click",
4781
4781
  "value": {
4782
4782
  "type": "string",
@@ -5278,6 +5278,15 @@
5278
5278
  "kind": "expression"
5279
5279
  }
5280
5280
  },
5281
+ {
5282
+ "name": "columns-count",
5283
+ "description": "最大显示列数",
5284
+ "default": "-",
5285
+ "value": {
5286
+ "type": "string | number",
5287
+ "kind": "expression"
5288
+ }
5289
+ },
5281
5290
  {
5282
5291
  "name": "confirm-button-text",
5283
5292
  "description": "确认按钮文字",
@@ -8039,7 +8048,7 @@
8039
8048
  },
8040
8049
  {
8041
8050
  "name": "trigger",
8042
- "description": "触发方式,可选值为 `click` `hover`, `click` 为点击时触发, `hover` 为悬停时触发",
8051
+ "description": "触发方式,可选值为 `click` `hover` `manual`",
8043
8052
  "default": "hover",
8044
8053
  "value": {
8045
8054
  "type": "string",
package/lib/varlet.cjs.js CHANGED
@@ -13675,7 +13675,27 @@ function usePopover(options) {
13675
13675
  let popoverInstance = null;
13676
13676
  let enterPopover = false;
13677
13677
  let enterHost = false;
13678
- const computeHostSize = () => {
13678
+ useEventListener(() => window, "keydown", handleKeydown);
13679
+ useClickOutside(getReference, "click", handleClickOutside);
13680
+ onWindowResize(resize);
13681
+ vue.watch(() => [options.offsetX, options.offsetY, options.placement, options.strategy], resize);
13682
+ vue.watch(() => options.disabled, close);
13683
+ vue.watch(
13684
+ () => show.value,
13685
+ (newValue) => {
13686
+ if (newValue) {
13687
+ resize();
13688
+ }
13689
+ }
13690
+ );
13691
+ vue.onMounted(() => {
13692
+ var _a;
13693
+ popoverInstance = createPopper((_a = getReference()) != null ? _a : host.value, popover.value, getPopperOptions());
13694
+ });
13695
+ vue.onUnmounted(() => {
13696
+ popoverInstance.destroy();
13697
+ });
13698
+ function computeHostSize() {
13679
13699
  if (!host.value) {
13680
13700
  return;
13681
13701
  }
@@ -13684,8 +13704,8 @@ function usePopover(options) {
13684
13704
  width: toPxNum(width),
13685
13705
  height: toPxNum(height)
13686
13706
  };
13687
- };
13688
- const getTransformOrigin = () => {
13707
+ }
13708
+ function getTransformOrigin() {
13689
13709
  switch (options.placement) {
13690
13710
  case "top":
13691
13711
  case "cover-bottom":
@@ -13716,64 +13736,71 @@ function usePopover(options) {
13716
13736
  case "cover-left":
13717
13737
  return "left";
13718
13738
  }
13719
- };
13720
- const handleHostMouseenter = () => {
13739
+ }
13740
+ function handleHostMouseenter() {
13721
13741
  if (options.trigger !== "hover") {
13722
13742
  return;
13723
13743
  }
13724
13744
  enterHost = true;
13725
13745
  open();
13726
- };
13727
- const handleHostMouseleave = () => __async$a(this, null, function* () {
13728
- if (options.trigger !== "hover") {
13729
- return;
13730
- }
13731
- enterHost = false;
13732
- yield doubleRaf();
13733
- if (enterPopover) {
13734
- return;
13735
- }
13736
- close();
13737
- });
13738
- const handlePopoverMouseenter = () => {
13746
+ }
13747
+ function handleHostMouseleave() {
13748
+ return __async$a(this, null, function* () {
13749
+ if (options.trigger !== "hover") {
13750
+ return;
13751
+ }
13752
+ enterHost = false;
13753
+ yield doubleRaf();
13754
+ if (enterPopover) {
13755
+ return;
13756
+ }
13757
+ close();
13758
+ });
13759
+ }
13760
+ function handlePopoverMouseenter() {
13739
13761
  if (options.trigger !== "hover") {
13740
13762
  return;
13741
13763
  }
13742
13764
  enterPopover = true;
13743
- };
13744
- const handlePopoverMouseleave = () => __async$a(this, null, function* () {
13745
- if (options.trigger !== "hover") {
13746
- return;
13747
- }
13748
- enterPopover = false;
13749
- yield doubleRaf();
13750
- if (enterHost) {
13765
+ }
13766
+ function handlePopoverMouseleave() {
13767
+ return __async$a(this, null, function* () {
13768
+ if (options.trigger !== "hover") {
13769
+ return;
13770
+ }
13771
+ enterPopover = false;
13772
+ yield doubleRaf();
13773
+ if (enterHost) {
13774
+ return;
13775
+ }
13776
+ close();
13777
+ });
13778
+ }
13779
+ function handleHostClick() {
13780
+ if (options.trigger !== "click") {
13751
13781
  return;
13752
13782
  }
13753
- close();
13754
- });
13755
- const handleHostClick = () => {
13756
13783
  if (options.closeOnClickReference && show.value) {
13757
13784
  close();
13758
- } else {
13759
- open();
13785
+ return;
13760
13786
  }
13761
- };
13762
- const handlePopoverClose = () => {
13787
+ open();
13788
+ }
13789
+ function handlePopoverClose() {
13763
13790
  close();
13764
- };
13765
- const handleClickOutside = (e) => {
13791
+ }
13792
+ function handleClickOutside(e) {
13766
13793
  if (options.trigger !== "click") {
13767
13794
  return;
13768
13795
  }
13769
13796
  handlePopoverClose();
13770
13797
  call(options.onClickOutside, e);
13771
- };
13772
- const handleClosed = () => {
13798
+ }
13799
+ function handleClosed() {
13773
13800
  resize();
13774
13801
  call(options.onClosed);
13775
- };
13776
- const getPosition = () => {
13802
+ }
13803
+ function getPosition() {
13777
13804
  const { offsetX, offsetY, placement } = options;
13778
13805
  computeHostSize();
13779
13806
  const offset2 = {
@@ -13862,8 +13889,8 @@ function usePopover(options) {
13862
13889
  distance: offset2.x
13863
13890
  };
13864
13891
  }
13865
- };
13866
- const getPopperOptions = () => {
13892
+ }
13893
+ function getPopperOptions() {
13867
13894
  const { placement, skidding, distance } = getPosition();
13868
13895
  const modifiers = [
13869
13896
  __spreadProps$4(__spreadValues$e({}, flip$1), {
@@ -13895,49 +13922,31 @@ function usePopover(options) {
13895
13922
  modifiers,
13896
13923
  strategy: options.strategy
13897
13924
  };
13898
- };
13899
- const getReference = () => options.reference ? host.value.querySelector(options.reference) : host.value;
13900
- const handleKeydown = (event) => {
13925
+ }
13926
+ function getReference() {
13927
+ return options.reference ? host.value.querySelector(options.reference) : host.value;
13928
+ }
13929
+ function handleKeydown(event) {
13901
13930
  const { closeOnKeyEscape = false } = options;
13902
13931
  if (event.key === "Escape" && closeOnKeyEscape && show.value) {
13903
13932
  preventDefault(event);
13904
13933
  close();
13905
13934
  }
13906
- };
13907
- const resize = () => {
13935
+ }
13936
+ function resize() {
13908
13937
  popoverInstance.setOptions(getPopperOptions());
13909
- };
13910
- const open = () => {
13938
+ }
13939
+ function open() {
13911
13940
  if (options.disabled) {
13912
13941
  return;
13913
13942
  }
13914
13943
  show.value = true;
13915
13944
  call(options["onUpdate:show"], true);
13916
- };
13917
- const close = () => {
13945
+ }
13946
+ function close() {
13918
13947
  show.value = false;
13919
13948
  call(options["onUpdate:show"], false);
13920
- };
13921
- useEventListener(() => window, "keydown", handleKeydown);
13922
- useClickOutside(getReference, "click", handleClickOutside);
13923
- onWindowResize(resize);
13924
- vue.watch(() => [options.offsetX, options.offsetY, options.placement, options.strategy], resize);
13925
- vue.watch(() => options.disabled, close);
13926
- vue.watch(
13927
- () => show.value,
13928
- (newValue) => {
13929
- if (newValue) {
13930
- resize();
13931
- }
13932
- }
13933
- );
13934
- vue.onMounted(() => {
13935
- var _a;
13936
- popoverInstance = createPopper((_a = getReference()) != null ? _a : host.value, popover.value, getPopperOptions());
13937
- });
13938
- vue.onUnmounted(() => {
13939
- popoverInstance.destroy();
13940
- });
13949
+ }
13941
13950
  return {
13942
13951
  show,
13943
13952
  popover,
@@ -19092,6 +19101,7 @@ const props$o = __spreadValues$7({
19092
19101
  type: [Number, String],
19093
19102
  default: 6
19094
19103
  },
19104
+ columnsCount: [String, Number],
19095
19105
  confirmButtonText: String,
19096
19106
  cancelButtonText: String,
19097
19107
  confirmButtonTextColor: String,
@@ -19336,6 +19346,7 @@ const __sfc__$v = vue.defineComponent({
19336
19346
  setup(props2) {
19337
19347
  const modelValue = useVModel(props2, "modelValue");
19338
19348
  const scrollColumns = vue.ref([]);
19349
+ const visibleColumnsCount = vue.computed(() => toNumber(props2.columnsCount));
19339
19350
  const optionHeight = vue.computed(() => toPxNum(props2.optionHeight));
19340
19351
  const optionCount = vue.computed(() => toPxNum(props2.optionCount));
19341
19352
  const center = vue.computed(() => optionCount.value * optionHeight.value / 2 - optionHeight.value / 2);
@@ -19362,7 +19373,8 @@ const __sfc__$v = vue.defineComponent({
19362
19373
  prevIndexes = [...indexes];
19363
19374
  }
19364
19375
  function normalizeNormalMode(columns) {
19365
- return columns.map((column, idx) => {
19376
+ const visibleColumns = props2.columnsCount != null ? columns.slice(0, visibleColumnsCount.value) : columns;
19377
+ return visibleColumns.map((column, idx) => {
19366
19378
  const scrollColumn = {
19367
19379
  id: sid$1++,
19368
19380
  prevY: 0,
@@ -19388,9 +19400,9 @@ const __sfc__$v = vue.defineComponent({
19388
19400
  createChildren(scrollColumns2, column);
19389
19401
  return scrollColumns2;
19390
19402
  }
19391
- function createChildren(scrollColumns2, children, syncModelValue = true) {
19403
+ function createChildren(scrollColumns2, children, syncModelValue = true, depth = 1) {
19392
19404
  var _a;
19393
- if (children.length) {
19405
+ if (children.length && (props2.columnsCount == null || depth <= visibleColumnsCount.value)) {
19394
19406
  const scrollColumn = {
19395
19407
  id: sid$1++,
19396
19408
  prevY: 0,
@@ -19414,7 +19426,8 @@ const __sfc__$v = vue.defineComponent({
19414
19426
  createChildren(
19415
19427
  scrollColumns2,
19416
19428
  (_a = scrollColumn.column[scrollColumn.index][getOptionKey("children")]) != null ? _a : [],
19417
- syncModelValue
19429
+ syncModelValue,
19430
+ depth + 1
19418
19431
  );
19419
19432
  }
19420
19433
  }
@@ -19424,7 +19437,8 @@ const __sfc__$v = vue.defineComponent({
19424
19437
  createChildren(
19425
19438
  scrollColumns.value,
19426
19439
  (_a = scrollColumn.column[scrollColumn.index][getOptionKey("children")]) != null ? _a : [],
19427
- false
19440
+ false,
19441
+ scrollColumns.value.length + 1
19428
19442
  );
19429
19443
  }
19430
19444
  function initScrollColumns() {
@@ -29114,7 +29128,7 @@ withInstall(stdin_default$1);
29114
29128
  withPropsDefaultsSetter(stdin_default$1, props);
29115
29129
  const _WatermarkComponent = stdin_default$1;
29116
29130
  var stdin_default = stdin_default$1;
29117
- const version = "3.3.10";
29131
+ const version = "3.3.12-alpha.1722841613989";
29118
29132
  function install(app) {
29119
29133
  stdin_default$5G.install && app.use(stdin_default$5G);
29120
29134
  stdin_default$5E.install && app.use(stdin_default$5E);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "3.3.10",
3
+ "version": "3.3.12-alpha.1722841613989",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -48,9 +48,9 @@
48
48
  "@popperjs/core": "^2.11.6",
49
49
  "dayjs": "^1.10.4",
50
50
  "decimal.js": "^10.2.1",
51
- "@varlet/icons": "3.3.10",
52
- "@varlet/shared": "3.3.10",
53
- "@varlet/use": "3.3.10"
51
+ "@varlet/icons": "3.3.12-alpha.1722841613989",
52
+ "@varlet/shared": "3.3.12-alpha.1722841613989",
53
+ "@varlet/use": "3.3.12-alpha.1722841613989"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@vue/runtime-core": "3.4.21",
@@ -64,9 +64,9 @@
64
64
  "typescript": "^5.1.5",
65
65
  "vue": "3.4.21",
66
66
  "vue-router": "4.2.0",
67
- "@varlet/cli": "3.3.10",
68
- "@varlet/ui": "3.3.10",
69
- "@varlet/touch-emulator": "3.3.10"
67
+ "@varlet/ui": "3.3.12-alpha.1722841613989",
68
+ "@varlet/touch-emulator": "3.3.12-alpha.1722841613989",
69
+ "@varlet/cli": "3.3.12-alpha.1722841613989"
70
70
  },
71
71
  "scripts": {
72
72
  "dev": "varlet-cli dev",
package/types/menu.d.ts CHANGED
@@ -18,7 +18,7 @@ export type MenuPlacement =
18
18
  | 'cover-left'
19
19
  | 'cover-right'
20
20
 
21
- export type MenuTrigger = 'click' | 'hover'
21
+ export type MenuTrigger = 'click' | 'hover' | 'manual'
22
22
 
23
23
  export type MenuStrategy = PositioningStrategy
24
24
 
@@ -18,7 +18,7 @@ export type MenuSelectPlacement =
18
18
  | 'cover-left'
19
19
  | 'cover-right'
20
20
 
21
- export type MenuSelectTrigger = 'click' | 'hover'
21
+ export type MenuSelectTrigger = 'click' | 'hover' | 'manual'
22
22
 
23
23
  export type MenuSelectStrategy = PositioningStrategy
24
24
 
package/types/picker.d.ts CHANGED
@@ -24,6 +24,7 @@ export interface PickerProps {
24
24
  cascade?: boolean
25
25
  optionHeight?: string | number
26
26
  optionCount?: string | number
27
+ columnsCount?: string | number
27
28
  confirmButtonText?: string
28
29
  cancelButtonText?: string
29
30
  confirmButtonTextColor?: string
@@ -70,6 +71,7 @@ export interface PickerOptions {
70
71
  cascade?: boolean
71
72
  optionHeight?: number | string
72
73
  optionCount?: number | string
74
+ columnsCount?: number | string
73
75
  confirmButtonText?: string
74
76
  cancelButtonText?: string
75
77
  confirmButtonTextColor?: string
@@ -9,7 +9,7 @@ type TooltipNeededPopperPlacement = Exclude<PopperPlacement, 'auto' | 'auto-star
9
9
 
10
10
  export type TooltipPlacement = TooltipNeededPopperPlacement
11
11
 
12
- export type TooltipTrigger = 'click' | 'hover'
12
+ export type TooltipTrigger = 'click' | 'hover' | 'manual'
13
13
 
14
14
  export type TooltipType = 'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger'
15
15