@hoci/components 0.5.9 → 0.6.0

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/dist/index.cjs CHANGED
@@ -73,7 +73,7 @@ function getTargetRect(target) {
73
73
  shared.defineHookComponent({
74
74
  props: affixProps,
75
75
  setup(props, { emit }) {
76
- const wrapperRef = vue.ref(null);
76
+ const wrapperRef = vue.ref();
77
77
  const wrapperRect = shared.toReactive(core$1.useElementBounding(wrapperRef));
78
78
  const parentRef = vue.inject(AFFIX_TARGET_KEY, void 0);
79
79
  const targetRef = shared.useElement(props.target, parentRef);
@@ -154,7 +154,7 @@ function provideAffixTarget(target) {
154
154
  const HiAffixTarget = vue.defineComponent({
155
155
  name: "HiAffixTarget",
156
156
  setup(_, context) {
157
- const targetRef = vue.ref(null);
157
+ const targetRef = vue.ref();
158
158
  provideAffixTarget(targetRef);
159
159
  return () => vue.h("div", {
160
160
  ref: targetRef,
@@ -306,7 +306,7 @@ const selectionProps = shared.defineHookProps({
306
306
  * 多选模式
307
307
  */
308
308
  multiple: {
309
- type: [Boolean, Number],
309
+ type: [Boolean, Number, Array],
310
310
  default: () => false
311
311
  },
312
312
  /**
@@ -347,7 +347,8 @@ function useSelectionContext() {
347
347
  itemClass: "",
348
348
  activateEvent: sharedConfig.activateEvent,
349
349
  label: null,
350
- multiple: false
350
+ multiple: false,
351
+ limit: [0, Number.POSITIVE_INFINITY]
351
352
  });
352
353
  }
353
354
  const useSelectionList = shared.defineHookComponent({
@@ -388,16 +389,26 @@ const useSelectionList = shared.defineHookComponent({
388
389
  function isActive(value) {
389
390
  return actives.includes(value);
390
391
  }
392
+ const multipleActive = vue.computed(() => !!props.multiple);
393
+ const multipleLimit = vue.computed(() => {
394
+ if (Array.isArray(props.multiple)) {
395
+ if (props.multiple[1] === void 0) {
396
+ return [props.multiple[0], Number.POSITIVE_INFINITY];
397
+ }
398
+ return props.multiple;
399
+ }
400
+ return [0, Number.POSITIVE_INFINITY];
401
+ });
391
402
  function activate(value) {
403
+ const [min, max] = multipleLimit.value;
392
404
  if (isActive(value)) {
393
- if (props.multiple || props.clearable) {
405
+ if (multipleActive.value && actives.length > min || props.clearable) {
394
406
  actives.splice(actives.indexOf(value), 1);
395
407
  emitChange();
396
408
  }
397
409
  } else {
398
410
  if (props.multiple) {
399
- const limit = typeof props.multiple === "number" ? props.multiple : Number.POSITIVE_INFINITY;
400
- if (actives.length < limit) {
411
+ if (actives.length < max) {
401
412
  actives.push(value);
402
413
  emitChange();
403
414
  }
@@ -435,7 +446,8 @@ const useSelectionList = shared.defineHookComponent({
435
446
  disabledClass: vue.computed(() => tslx.cls(props.disabledClass)),
436
447
  itemClass: vue.computed(() => tslx.cls(props.itemClass)),
437
448
  label: vue.computed(() => props.label),
438
- multiple: vue.computed(() => props.multiple),
449
+ multiple: multipleActive,
450
+ limit: multipleLimit,
439
451
  clearable: vue.computed(() => props.clearable),
440
452
  defaultValue: vue.computed(() => props.defaultValue),
441
453
  activateEvent: vue.computed(() => props.activateEvent ?? sharedConfig.activateEvent),
package/dist/index.d.cts CHANGED
@@ -2,7 +2,6 @@ import * as vue from 'vue';
2
2
  import { PropType, KeepAliveProps, App } from 'vue';
3
3
  import * as _hoci_core from '@hoci/core';
4
4
  import * as _hoci_shared from '@hoci/shared';
5
- import { ElementLike, ActivateEvent } from '@hoci/shared';
6
5
 
7
6
  declare const HiAffix: vue.DefineComponent<{
8
7
  as: {
@@ -22,7 +21,7 @@ declare const HiAffix: vue.DefineComponent<{
22
21
  default: string;
23
22
  };
24
23
  target: {
25
- type: vue.PropType<string | HTMLElement>;
24
+ type: vue.PropType<string | Element | (() => Element | null | undefined)>;
26
25
  };
27
26
  zIndex: {
28
27
  type: NumberConstructor;
@@ -48,7 +47,7 @@ declare const HiAffix: vue.DefineComponent<{
48
47
  default: string;
49
48
  };
50
49
  target: {
51
- type: vue.PropType<string | HTMLElement>;
50
+ type: vue.PropType<string | Element | (() => Element | null | undefined)>;
52
51
  };
53
52
  zIndex: {
54
53
  type: NumberConstructor;
@@ -95,7 +94,7 @@ declare const HiSelection: vue.DefineComponent<{
95
94
  type: vue.PropType<string | ((val?: any) => string) | null>;
96
95
  };
97
96
  multiple: {
98
- type: (NumberConstructor | BooleanConstructor)[];
97
+ type: vue.PropType<boolean | number | [number, number?]>;
99
98
  default: () => false;
100
99
  };
101
100
  clearable: {
@@ -139,7 +138,7 @@ declare const HiSelection: vue.DefineComponent<{
139
138
  type: vue.PropType<string | ((val?: any) => string) | null>;
140
139
  };
141
140
  multiple: {
142
- type: (NumberConstructor | BooleanConstructor)[];
141
+ type: vue.PropType<boolean | number | [number, number?]>;
143
142
  default: () => false;
144
143
  };
145
144
  clearable: {
@@ -159,7 +158,7 @@ declare const HiSelection: vue.DefineComponent<{
159
158
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
160
159
  onReject?: ((...args: any[]) => any) | undefined;
161
160
  }, {
162
- multiple: number | boolean;
161
+ multiple: number | boolean | [number, (number | undefined)?];
163
162
  modelValue: any;
164
163
  activeClass: string | string[] | Record<string, boolean>;
165
164
  itemClass: string | string[] | Record<string, boolean>;
@@ -180,7 +179,7 @@ declare const HiItem: vue.DefineComponent<{
180
179
  default(): string;
181
180
  };
182
181
  label: {
183
- type: vue.PropType<_hoci_core.ElementLike | ((val: any) => string) | null>;
182
+ type: vue.PropType<string | ((val: any) => string) | _hoci_core.ElementLike | null>;
184
183
  };
185
184
  keepAlive: {
186
185
  type: BooleanConstructor;
@@ -205,7 +204,7 @@ declare const HiItem: vue.DefineComponent<{
205
204
  default(): string;
206
205
  };
207
206
  label: {
208
- type: vue.PropType<_hoci_core.ElementLike | ((val: any) => string) | null>;
207
+ type: vue.PropType<string | ((val: any) => string) | _hoci_core.ElementLike | null>;
209
208
  };
210
209
  keepAlive: {
211
210
  type: BooleanConstructor;
@@ -360,13 +359,10 @@ declare const HiConfigProvider: vue.DefineComponent<{
360
359
  type: StringConstructor;
361
360
  };
362
361
  icon: {
363
- type: vue.PropType<Partial<{
364
- size: number | undefined;
365
- sizeUnit: string | undefined;
366
- }>>;
362
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["icon"]>>;
367
363
  };
368
364
  activateEvent: {
369
- type: vue.PropType<Partial<_hoci_core.ActivateEvent>>;
365
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["activateEvent"]>>;
370
366
  };
371
367
  }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
372
368
  [key: string]: any;
@@ -375,13 +371,10 @@ declare const HiConfigProvider: vue.DefineComponent<{
375
371
  type: StringConstructor;
376
372
  };
377
373
  icon: {
378
- type: vue.PropType<Partial<{
379
- size: number | undefined;
380
- sizeUnit: string | undefined;
381
- }>>;
374
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["icon"]>>;
382
375
  };
383
376
  activateEvent: {
384
- type: vue.PropType<Partial<_hoci_core.ActivateEvent>>;
377
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["activateEvent"]>>;
385
378
  };
386
379
  }>>, {}, {}>;
387
380
 
@@ -432,7 +425,7 @@ declare const HiTabs: vue.DefineComponent<{
432
425
  type: PropType<string | ((val?: any) => string) | null>;
433
426
  };
434
427
  multiple: {
435
- type: (NumberConstructor | BooleanConstructor)[];
428
+ type: PropType<boolean | number | [number, number?]>;
436
429
  default: () => false;
437
430
  };
438
431
  clearable: {
@@ -494,7 +487,7 @@ declare const HiTabs: vue.DefineComponent<{
494
487
  type: PropType<string | ((val?: any) => string) | null>;
495
488
  };
496
489
  multiple: {
497
- type: (NumberConstructor | BooleanConstructor)[];
490
+ type: PropType<boolean | number | [number, number?]>;
498
491
  default: () => false;
499
492
  };
500
493
  clearable: {
@@ -508,7 +501,7 @@ declare const HiTabs: vue.DefineComponent<{
508
501
  type: PropType<_hoci_shared.ActivateEvent>;
509
502
  };
510
503
  }>>, {
511
- multiple: number | boolean;
504
+ multiple: number | boolean | [number, (number | undefined)?];
512
505
  modelValue: any;
513
506
  activeClass: string | string[] | Record<string, boolean>;
514
507
  itemClass: string | string[] | Record<string, boolean>;
@@ -528,14 +521,14 @@ declare const HiTabPane: vue.DefineComponent<{
528
521
  default(): string;
529
522
  };
530
523
  label: {
531
- type: vue.PropType<ElementLike | ((val: any) => string) | null>;
524
+ type: vue.PropType<string | ((val: any) => string) | _hoci_shared.ElementLike | null>;
532
525
  };
533
526
  keepAlive: {
534
527
  type: BooleanConstructor;
535
528
  default: () => true;
536
529
  };
537
530
  activateEvent: {
538
- type: vue.PropType<ActivateEvent>;
531
+ type: vue.PropType<_hoci_shared.ActivateEvent>;
539
532
  };
540
533
  disabled: {
541
534
  type: BooleanConstructor;
@@ -549,14 +542,14 @@ declare const HiTabPane: vue.DefineComponent<{
549
542
  default(): string;
550
543
  };
551
544
  label: {
552
- type: vue.PropType<ElementLike | ((val: any) => string) | null>;
545
+ type: vue.PropType<string | ((val: any) => string) | _hoci_shared.ElementLike | null>;
553
546
  };
554
547
  keepAlive: {
555
548
  type: BooleanConstructor;
556
549
  default: () => true;
557
550
  };
558
551
  activateEvent: {
559
- type: vue.PropType<ActivateEvent>;
552
+ type: vue.PropType<_hoci_shared.ActivateEvent>;
560
553
  };
561
554
  disabled: {
562
555
  type: BooleanConstructor;
@@ -603,7 +596,7 @@ declare const HiPopover: vue.DefineComponent<{
603
596
  default: () => false;
604
597
  };
605
598
  teleport: {
606
- type: vue.PropType<string | boolean | HTMLElement>;
599
+ type: vue.PropType<string | HTMLElement | boolean>;
607
600
  default: () => true;
608
601
  };
609
602
  }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
@@ -641,7 +634,7 @@ declare const HiPopover: vue.DefineComponent<{
641
634
  default: () => false;
642
635
  };
643
636
  teleport: {
644
- type: vue.PropType<string | boolean | HTMLElement>;
637
+ type: vue.PropType<string | HTMLElement | boolean>;
645
638
  default: () => true;
646
639
  };
647
640
  }>> & {
package/dist/index.d.mts CHANGED
@@ -2,7 +2,6 @@ import * as vue from 'vue';
2
2
  import { PropType, KeepAliveProps, App } from 'vue';
3
3
  import * as _hoci_core from '@hoci/core';
4
4
  import * as _hoci_shared from '@hoci/shared';
5
- import { ElementLike, ActivateEvent } from '@hoci/shared';
6
5
 
7
6
  declare const HiAffix: vue.DefineComponent<{
8
7
  as: {
@@ -22,7 +21,7 @@ declare const HiAffix: vue.DefineComponent<{
22
21
  default: string;
23
22
  };
24
23
  target: {
25
- type: vue.PropType<string | HTMLElement>;
24
+ type: vue.PropType<string | Element | (() => Element | null | undefined)>;
26
25
  };
27
26
  zIndex: {
28
27
  type: NumberConstructor;
@@ -48,7 +47,7 @@ declare const HiAffix: vue.DefineComponent<{
48
47
  default: string;
49
48
  };
50
49
  target: {
51
- type: vue.PropType<string | HTMLElement>;
50
+ type: vue.PropType<string | Element | (() => Element | null | undefined)>;
52
51
  };
53
52
  zIndex: {
54
53
  type: NumberConstructor;
@@ -95,7 +94,7 @@ declare const HiSelection: vue.DefineComponent<{
95
94
  type: vue.PropType<string | ((val?: any) => string) | null>;
96
95
  };
97
96
  multiple: {
98
- type: (NumberConstructor | BooleanConstructor)[];
97
+ type: vue.PropType<boolean | number | [number, number?]>;
99
98
  default: () => false;
100
99
  };
101
100
  clearable: {
@@ -139,7 +138,7 @@ declare const HiSelection: vue.DefineComponent<{
139
138
  type: vue.PropType<string | ((val?: any) => string) | null>;
140
139
  };
141
140
  multiple: {
142
- type: (NumberConstructor | BooleanConstructor)[];
141
+ type: vue.PropType<boolean | number | [number, number?]>;
143
142
  default: () => false;
144
143
  };
145
144
  clearable: {
@@ -159,7 +158,7 @@ declare const HiSelection: vue.DefineComponent<{
159
158
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
160
159
  onReject?: ((...args: any[]) => any) | undefined;
161
160
  }, {
162
- multiple: number | boolean;
161
+ multiple: number | boolean | [number, (number | undefined)?];
163
162
  modelValue: any;
164
163
  activeClass: string | string[] | Record<string, boolean>;
165
164
  itemClass: string | string[] | Record<string, boolean>;
@@ -180,7 +179,7 @@ declare const HiItem: vue.DefineComponent<{
180
179
  default(): string;
181
180
  };
182
181
  label: {
183
- type: vue.PropType<_hoci_core.ElementLike | ((val: any) => string) | null>;
182
+ type: vue.PropType<string | ((val: any) => string) | _hoci_core.ElementLike | null>;
184
183
  };
185
184
  keepAlive: {
186
185
  type: BooleanConstructor;
@@ -205,7 +204,7 @@ declare const HiItem: vue.DefineComponent<{
205
204
  default(): string;
206
205
  };
207
206
  label: {
208
- type: vue.PropType<_hoci_core.ElementLike | ((val: any) => string) | null>;
207
+ type: vue.PropType<string | ((val: any) => string) | _hoci_core.ElementLike | null>;
209
208
  };
210
209
  keepAlive: {
211
210
  type: BooleanConstructor;
@@ -360,13 +359,10 @@ declare const HiConfigProvider: vue.DefineComponent<{
360
359
  type: StringConstructor;
361
360
  };
362
361
  icon: {
363
- type: vue.PropType<Partial<{
364
- size: number | undefined;
365
- sizeUnit: string | undefined;
366
- }>>;
362
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["icon"]>>;
367
363
  };
368
364
  activateEvent: {
369
- type: vue.PropType<Partial<_hoci_core.ActivateEvent>>;
365
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["activateEvent"]>>;
370
366
  };
371
367
  }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
372
368
  [key: string]: any;
@@ -375,13 +371,10 @@ declare const HiConfigProvider: vue.DefineComponent<{
375
371
  type: StringConstructor;
376
372
  };
377
373
  icon: {
378
- type: vue.PropType<Partial<{
379
- size: number | undefined;
380
- sizeUnit: string | undefined;
381
- }>>;
374
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["icon"]>>;
382
375
  };
383
376
  activateEvent: {
384
- type: vue.PropType<Partial<_hoci_core.ActivateEvent>>;
377
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["activateEvent"]>>;
385
378
  };
386
379
  }>>, {}, {}>;
387
380
 
@@ -432,7 +425,7 @@ declare const HiTabs: vue.DefineComponent<{
432
425
  type: PropType<string | ((val?: any) => string) | null>;
433
426
  };
434
427
  multiple: {
435
- type: (NumberConstructor | BooleanConstructor)[];
428
+ type: PropType<boolean | number | [number, number?]>;
436
429
  default: () => false;
437
430
  };
438
431
  clearable: {
@@ -494,7 +487,7 @@ declare const HiTabs: vue.DefineComponent<{
494
487
  type: PropType<string | ((val?: any) => string) | null>;
495
488
  };
496
489
  multiple: {
497
- type: (NumberConstructor | BooleanConstructor)[];
490
+ type: PropType<boolean | number | [number, number?]>;
498
491
  default: () => false;
499
492
  };
500
493
  clearable: {
@@ -508,7 +501,7 @@ declare const HiTabs: vue.DefineComponent<{
508
501
  type: PropType<_hoci_shared.ActivateEvent>;
509
502
  };
510
503
  }>>, {
511
- multiple: number | boolean;
504
+ multiple: number | boolean | [number, (number | undefined)?];
512
505
  modelValue: any;
513
506
  activeClass: string | string[] | Record<string, boolean>;
514
507
  itemClass: string | string[] | Record<string, boolean>;
@@ -528,14 +521,14 @@ declare const HiTabPane: vue.DefineComponent<{
528
521
  default(): string;
529
522
  };
530
523
  label: {
531
- type: vue.PropType<ElementLike | ((val: any) => string) | null>;
524
+ type: vue.PropType<string | ((val: any) => string) | _hoci_shared.ElementLike | null>;
532
525
  };
533
526
  keepAlive: {
534
527
  type: BooleanConstructor;
535
528
  default: () => true;
536
529
  };
537
530
  activateEvent: {
538
- type: vue.PropType<ActivateEvent>;
531
+ type: vue.PropType<_hoci_shared.ActivateEvent>;
539
532
  };
540
533
  disabled: {
541
534
  type: BooleanConstructor;
@@ -549,14 +542,14 @@ declare const HiTabPane: vue.DefineComponent<{
549
542
  default(): string;
550
543
  };
551
544
  label: {
552
- type: vue.PropType<ElementLike | ((val: any) => string) | null>;
545
+ type: vue.PropType<string | ((val: any) => string) | _hoci_shared.ElementLike | null>;
553
546
  };
554
547
  keepAlive: {
555
548
  type: BooleanConstructor;
556
549
  default: () => true;
557
550
  };
558
551
  activateEvent: {
559
- type: vue.PropType<ActivateEvent>;
552
+ type: vue.PropType<_hoci_shared.ActivateEvent>;
560
553
  };
561
554
  disabled: {
562
555
  type: BooleanConstructor;
@@ -603,7 +596,7 @@ declare const HiPopover: vue.DefineComponent<{
603
596
  default: () => false;
604
597
  };
605
598
  teleport: {
606
- type: vue.PropType<string | boolean | HTMLElement>;
599
+ type: vue.PropType<string | HTMLElement | boolean>;
607
600
  default: () => true;
608
601
  };
609
602
  }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
@@ -641,7 +634,7 @@ declare const HiPopover: vue.DefineComponent<{
641
634
  default: () => false;
642
635
  };
643
636
  teleport: {
644
- type: vue.PropType<string | boolean | HTMLElement>;
637
+ type: vue.PropType<string | HTMLElement | boolean>;
645
638
  default: () => true;
646
639
  };
647
640
  }>> & {
package/dist/index.d.ts CHANGED
@@ -2,7 +2,6 @@ import * as vue from 'vue';
2
2
  import { PropType, KeepAliveProps, App } from 'vue';
3
3
  import * as _hoci_core from '@hoci/core';
4
4
  import * as _hoci_shared from '@hoci/shared';
5
- import { ElementLike, ActivateEvent } from '@hoci/shared';
6
5
 
7
6
  declare const HiAffix: vue.DefineComponent<{
8
7
  as: {
@@ -22,7 +21,7 @@ declare const HiAffix: vue.DefineComponent<{
22
21
  default: string;
23
22
  };
24
23
  target: {
25
- type: vue.PropType<string | HTMLElement>;
24
+ type: vue.PropType<string | Element | (() => Element | null | undefined)>;
26
25
  };
27
26
  zIndex: {
28
27
  type: NumberConstructor;
@@ -48,7 +47,7 @@ declare const HiAffix: vue.DefineComponent<{
48
47
  default: string;
49
48
  };
50
49
  target: {
51
- type: vue.PropType<string | HTMLElement>;
50
+ type: vue.PropType<string | Element | (() => Element | null | undefined)>;
52
51
  };
53
52
  zIndex: {
54
53
  type: NumberConstructor;
@@ -95,7 +94,7 @@ declare const HiSelection: vue.DefineComponent<{
95
94
  type: vue.PropType<string | ((val?: any) => string) | null>;
96
95
  };
97
96
  multiple: {
98
- type: (NumberConstructor | BooleanConstructor)[];
97
+ type: vue.PropType<boolean | number | [number, number?]>;
99
98
  default: () => false;
100
99
  };
101
100
  clearable: {
@@ -139,7 +138,7 @@ declare const HiSelection: vue.DefineComponent<{
139
138
  type: vue.PropType<string | ((val?: any) => string) | null>;
140
139
  };
141
140
  multiple: {
142
- type: (NumberConstructor | BooleanConstructor)[];
141
+ type: vue.PropType<boolean | number | [number, number?]>;
143
142
  default: () => false;
144
143
  };
145
144
  clearable: {
@@ -159,7 +158,7 @@ declare const HiSelection: vue.DefineComponent<{
159
158
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
160
159
  onReject?: ((...args: any[]) => any) | undefined;
161
160
  }, {
162
- multiple: number | boolean;
161
+ multiple: number | boolean | [number, (number | undefined)?];
163
162
  modelValue: any;
164
163
  activeClass: string | string[] | Record<string, boolean>;
165
164
  itemClass: string | string[] | Record<string, boolean>;
@@ -180,7 +179,7 @@ declare const HiItem: vue.DefineComponent<{
180
179
  default(): string;
181
180
  };
182
181
  label: {
183
- type: vue.PropType<_hoci_core.ElementLike | ((val: any) => string) | null>;
182
+ type: vue.PropType<string | ((val: any) => string) | _hoci_core.ElementLike | null>;
184
183
  };
185
184
  keepAlive: {
186
185
  type: BooleanConstructor;
@@ -205,7 +204,7 @@ declare const HiItem: vue.DefineComponent<{
205
204
  default(): string;
206
205
  };
207
206
  label: {
208
- type: vue.PropType<_hoci_core.ElementLike | ((val: any) => string) | null>;
207
+ type: vue.PropType<string | ((val: any) => string) | _hoci_core.ElementLike | null>;
209
208
  };
210
209
  keepAlive: {
211
210
  type: BooleanConstructor;
@@ -360,13 +359,10 @@ declare const HiConfigProvider: vue.DefineComponent<{
360
359
  type: StringConstructor;
361
360
  };
362
361
  icon: {
363
- type: vue.PropType<Partial<{
364
- size: number | undefined;
365
- sizeUnit: string | undefined;
366
- }>>;
362
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["icon"]>>;
367
363
  };
368
364
  activateEvent: {
369
- type: vue.PropType<Partial<_hoci_core.ActivateEvent>>;
365
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["activateEvent"]>>;
370
366
  };
371
367
  }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
372
368
  [key: string]: any;
@@ -375,13 +371,10 @@ declare const HiConfigProvider: vue.DefineComponent<{
375
371
  type: StringConstructor;
376
372
  };
377
373
  icon: {
378
- type: vue.PropType<Partial<{
379
- size: number | undefined;
380
- sizeUnit: string | undefined;
381
- }>>;
374
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["icon"]>>;
382
375
  };
383
376
  activateEvent: {
384
- type: vue.PropType<Partial<_hoci_core.ActivateEvent>>;
377
+ type: vue.PropType<Partial<_hoci_core.SharedConfig["activateEvent"]>>;
385
378
  };
386
379
  }>>, {}, {}>;
387
380
 
@@ -432,7 +425,7 @@ declare const HiTabs: vue.DefineComponent<{
432
425
  type: PropType<string | ((val?: any) => string) | null>;
433
426
  };
434
427
  multiple: {
435
- type: (NumberConstructor | BooleanConstructor)[];
428
+ type: PropType<boolean | number | [number, number?]>;
436
429
  default: () => false;
437
430
  };
438
431
  clearable: {
@@ -494,7 +487,7 @@ declare const HiTabs: vue.DefineComponent<{
494
487
  type: PropType<string | ((val?: any) => string) | null>;
495
488
  };
496
489
  multiple: {
497
- type: (NumberConstructor | BooleanConstructor)[];
490
+ type: PropType<boolean | number | [number, number?]>;
498
491
  default: () => false;
499
492
  };
500
493
  clearable: {
@@ -508,7 +501,7 @@ declare const HiTabs: vue.DefineComponent<{
508
501
  type: PropType<_hoci_shared.ActivateEvent>;
509
502
  };
510
503
  }>>, {
511
- multiple: number | boolean;
504
+ multiple: number | boolean | [number, (number | undefined)?];
512
505
  modelValue: any;
513
506
  activeClass: string | string[] | Record<string, boolean>;
514
507
  itemClass: string | string[] | Record<string, boolean>;
@@ -528,14 +521,14 @@ declare const HiTabPane: vue.DefineComponent<{
528
521
  default(): string;
529
522
  };
530
523
  label: {
531
- type: vue.PropType<ElementLike | ((val: any) => string) | null>;
524
+ type: vue.PropType<string | ((val: any) => string) | _hoci_shared.ElementLike | null>;
532
525
  };
533
526
  keepAlive: {
534
527
  type: BooleanConstructor;
535
528
  default: () => true;
536
529
  };
537
530
  activateEvent: {
538
- type: vue.PropType<ActivateEvent>;
531
+ type: vue.PropType<_hoci_shared.ActivateEvent>;
539
532
  };
540
533
  disabled: {
541
534
  type: BooleanConstructor;
@@ -549,14 +542,14 @@ declare const HiTabPane: vue.DefineComponent<{
549
542
  default(): string;
550
543
  };
551
544
  label: {
552
- type: vue.PropType<ElementLike | ((val: any) => string) | null>;
545
+ type: vue.PropType<string | ((val: any) => string) | _hoci_shared.ElementLike | null>;
553
546
  };
554
547
  keepAlive: {
555
548
  type: BooleanConstructor;
556
549
  default: () => true;
557
550
  };
558
551
  activateEvent: {
559
- type: vue.PropType<ActivateEvent>;
552
+ type: vue.PropType<_hoci_shared.ActivateEvent>;
560
553
  };
561
554
  disabled: {
562
555
  type: BooleanConstructor;
@@ -603,7 +596,7 @@ declare const HiPopover: vue.DefineComponent<{
603
596
  default: () => false;
604
597
  };
605
598
  teleport: {
606
- type: vue.PropType<string | boolean | HTMLElement>;
599
+ type: vue.PropType<string | HTMLElement | boolean>;
607
600
  default: () => true;
608
601
  };
609
602
  }, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
@@ -641,7 +634,7 @@ declare const HiPopover: vue.DefineComponent<{
641
634
  default: () => false;
642
635
  };
643
636
  teleport: {
644
- type: vue.PropType<string | boolean | HTMLElement>;
637
+ type: vue.PropType<string | HTMLElement | boolean>;
645
638
  default: () => true;
646
639
  };
647
640
  }>> & {
package/dist/index.mjs CHANGED
@@ -71,7 +71,7 @@ function getTargetRect(target) {
71
71
  defineHookComponent({
72
72
  props: affixProps,
73
73
  setup(props, { emit }) {
74
- const wrapperRef = ref(null);
74
+ const wrapperRef = ref();
75
75
  const wrapperRect = toReactive(useElementBounding(wrapperRef));
76
76
  const parentRef = inject(AFFIX_TARGET_KEY, void 0);
77
77
  const targetRef = useElement(props.target, parentRef);
@@ -152,7 +152,7 @@ function provideAffixTarget(target) {
152
152
  const HiAffixTarget = defineComponent({
153
153
  name: "HiAffixTarget",
154
154
  setup(_, context) {
155
- const targetRef = ref(null);
155
+ const targetRef = ref();
156
156
  provideAffixTarget(targetRef);
157
157
  return () => h("div", {
158
158
  ref: targetRef,
@@ -304,7 +304,7 @@ const selectionProps = defineHookProps({
304
304
  * 多选模式
305
305
  */
306
306
  multiple: {
307
- type: [Boolean, Number],
307
+ type: [Boolean, Number, Array],
308
308
  default: () => false
309
309
  },
310
310
  /**
@@ -345,7 +345,8 @@ function useSelectionContext() {
345
345
  itemClass: "",
346
346
  activateEvent: sharedConfig.activateEvent,
347
347
  label: null,
348
- multiple: false
348
+ multiple: false,
349
+ limit: [0, Number.POSITIVE_INFINITY]
349
350
  });
350
351
  }
351
352
  const useSelectionList = defineHookComponent({
@@ -386,16 +387,26 @@ const useSelectionList = defineHookComponent({
386
387
  function isActive(value) {
387
388
  return actives.includes(value);
388
389
  }
390
+ const multipleActive = computed(() => !!props.multiple);
391
+ const multipleLimit = computed(() => {
392
+ if (Array.isArray(props.multiple)) {
393
+ if (props.multiple[1] === void 0) {
394
+ return [props.multiple[0], Number.POSITIVE_INFINITY];
395
+ }
396
+ return props.multiple;
397
+ }
398
+ return [0, Number.POSITIVE_INFINITY];
399
+ });
389
400
  function activate(value) {
401
+ const [min, max] = multipleLimit.value;
390
402
  if (isActive(value)) {
391
- if (props.multiple || props.clearable) {
403
+ if (multipleActive.value && actives.length > min || props.clearable) {
392
404
  actives.splice(actives.indexOf(value), 1);
393
405
  emitChange();
394
406
  }
395
407
  } else {
396
408
  if (props.multiple) {
397
- const limit = typeof props.multiple === "number" ? props.multiple : Number.POSITIVE_INFINITY;
398
- if (actives.length < limit) {
409
+ if (actives.length < max) {
399
410
  actives.push(value);
400
411
  emitChange();
401
412
  }
@@ -433,7 +444,8 @@ const useSelectionList = defineHookComponent({
433
444
  disabledClass: computed(() => cls(props.disabledClass)),
434
445
  itemClass: computed(() => cls(props.itemClass)),
435
446
  label: computed(() => props.label),
436
- multiple: computed(() => props.multiple),
447
+ multiple: multipleActive,
448
+ limit: multipleLimit,
437
449
  clearable: computed(() => props.clearable),
438
450
  defaultValue: computed(() => props.defaultValue),
439
451
  activateEvent: computed(() => props.activateEvent ?? sharedConfig.activateEvent),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hoci/components",
3
- "version": "0.5.9",
3
+ "version": "0.6.0",
4
4
  "description": "",
5
5
  "author": "Chizuki <chizukicn@outlook.com>",
6
6
  "license": "MIT",
@@ -31,8 +31,8 @@
31
31
  "dependencies": {
32
32
  "maybe-types": "^0.2.0",
33
33
  "tslx": "^0.1.1",
34
- "@hoci/core": "0.5.9",
35
- "@hoci/shared": "0.5.9"
34
+ "@hoci/core": "0.6.0",
35
+ "@hoci/shared": "0.6.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "unbuild",