@hoci/core 0.2.1

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.
@@ -0,0 +1,592 @@
1
+ import * as _hoci_shared from '@hoci/shared';
2
+ import { ElementLike, ActivateEvent } from '@hoci/shared';
3
+ export * from '@hoci/shared';
4
+ import * as vue from 'vue';
5
+ import { PropType, InjectionKey, MaybeRefOrGetter, Ref, CSSProperties as CSSProperties$1 } from 'vue';
6
+ import { CSSProperties } from 'tslx';
7
+
8
+ declare const affixProps: {
9
+ fixedClass: {
10
+ type: StringConstructor;
11
+ default: string;
12
+ };
13
+ /**
14
+ * @zh 距离窗口顶部达到指定偏移量后触发
15
+ * @en Triggered when the specified offset is reached from the top of the window
16
+ */
17
+ offset: {
18
+ type: NumberConstructor;
19
+ default: number;
20
+ };
21
+ offsetType: {
22
+ type: PropType<"top" | "bottom">;
23
+ default: string;
24
+ };
25
+ /**
26
+ * @zh 滚动容器,默认是 `window`
27
+ * @en Scroll container, default is `window`
28
+ */
29
+ target: {
30
+ type: PropType<string | Window | HTMLElement>;
31
+ };
32
+ /**
33
+ * @zh z-index 值
34
+ * @en Z index value
35
+ */
36
+ zIndex: {
37
+ type: NumberConstructor;
38
+ default: number;
39
+ };
40
+ };
41
+ type AffixProps = typeof affixProps;
42
+ declare const affixEmits: ("scroll" | "change")[];
43
+ declare const AFFIX_TARGET_KEY: InjectionKey<MaybeRefOrGetter<HTMLElement | Window | Element | null | undefined>>;
44
+ declare const useAffix: _hoci_shared.HookComponent<{
45
+ classNames: vue.ComputedRef<string>;
46
+ wrapperRef: Ref<HTMLElement | null>;
47
+ isFixed: Ref<boolean>;
48
+ placeholderStyle: Ref<CSSProperties>;
49
+ fixedStyle: Ref<CSSProperties>;
50
+ updatePosition: _hoci_shared.ThrottledCancelableFn<[]>;
51
+ }, vue.EmitsOptions, {
52
+ fixedClass: {
53
+ type: StringConstructor;
54
+ default: string;
55
+ };
56
+ /**
57
+ * @zh 距离窗口顶部达到指定偏移量后触发
58
+ * @en Triggered when the specified offset is reached from the top of the window
59
+ */
60
+ offset: {
61
+ type: NumberConstructor;
62
+ default: number;
63
+ };
64
+ offsetType: {
65
+ type: PropType<"top" | "bottom">;
66
+ default: string;
67
+ };
68
+ /**
69
+ * @zh 滚动容器,默认是 `window`
70
+ * @en Scroll container, default is `window`
71
+ */
72
+ target: {
73
+ type: PropType<string | Window | HTMLElement>;
74
+ };
75
+ /**
76
+ * @zh z-index 值
77
+ * @en Z index value
78
+ */
79
+ zIndex: {
80
+ type: NumberConstructor;
81
+ default: number;
82
+ };
83
+ }, vue.ExtractPropTypes<{
84
+ fixedClass: {
85
+ type: StringConstructor;
86
+ default: string;
87
+ };
88
+ /**
89
+ * @zh 距离窗口顶部达到指定偏移量后触发
90
+ * @en Triggered when the specified offset is reached from the top of the window
91
+ */
92
+ offset: {
93
+ type: NumberConstructor;
94
+ default: number;
95
+ };
96
+ offsetType: {
97
+ type: PropType<"top" | "bottom">;
98
+ default: string;
99
+ };
100
+ /**
101
+ * @zh 滚动容器,默认是 `window`
102
+ * @en Scroll container, default is `window`
103
+ */
104
+ target: {
105
+ type: PropType<string | Window | HTMLElement>;
106
+ };
107
+ /**
108
+ * @zh z-index 值
109
+ * @en Z index value
110
+ */
111
+ zIndex: {
112
+ type: NumberConstructor;
113
+ default: number;
114
+ };
115
+ }>, {
116
+ fixedClass: string;
117
+ offset: number;
118
+ offsetType: "top" | "bottom";
119
+ zIndex: number;
120
+ }>;
121
+ declare function provideAffixTarget(target: MaybeRefOrGetter<HTMLElement | Element | null | undefined>): void;
122
+
123
+ type InitFunction = (option: Option) => () => void;
124
+ interface Option {
125
+ id?: string;
126
+ label?: string;
127
+ value: any | null;
128
+ render(): ElementLike;
129
+ }
130
+ interface HiSelectionContext {
131
+ changeActive: (_: any) => void;
132
+ isActive: (_: any) => boolean;
133
+ init?: InitFunction;
134
+ activateEvent: ActivateEvent;
135
+ activeClass: string;
136
+ itemClass: string;
137
+ unactiveClass: string;
138
+ disabledClass: string;
139
+ label: string | ((_: any) => ElementLike | null | undefined) | null | undefined;
140
+ multiple: boolean | number;
141
+ }
142
+ declare const selectionProps: {
143
+ modelValue: {
144
+ type: PropType<any>;
145
+ default: () => null;
146
+ };
147
+ /**
148
+ * 选中时的 class
149
+ */
150
+ activeClass: {
151
+ type: PropType<string | string[] | Record<string, boolean>>;
152
+ default: string;
153
+ };
154
+ /**
155
+ * 每个选项的 class
156
+ */
157
+ itemClass: {
158
+ type: PropType<string | string[] | Record<string, boolean>>;
159
+ default: string;
160
+ };
161
+ disabledClass: {
162
+ type: PropType<string | string[] | Record<string, boolean>>;
163
+ default: string;
164
+ };
165
+ unactiveClass: {
166
+ type: PropType<string | string[] | Record<string, boolean>>;
167
+ default: string;
168
+ };
169
+ label: {
170
+ type: PropType<string | ((val?: any) => string) | null>;
171
+ };
172
+ /**
173
+ * 多选模式
174
+ */
175
+ multiple: {
176
+ type: (NumberConstructor | BooleanConstructor)[];
177
+ default: () => false;
178
+ };
179
+ /**
180
+ * 可清除
181
+ */
182
+ clearable: {
183
+ type: BooleanConstructor;
184
+ };
185
+ defaultValue: {
186
+ type: PropType<any>;
187
+ default: () => null;
188
+ };
189
+ activateEvent: {
190
+ type: PropType<ActivateEvent>;
191
+ default: () => "click";
192
+ };
193
+ };
194
+ type SelectionProps = typeof selectionProps;
195
+ declare const selectionEmits: ("change" | "load" | "unload" | "update:modelValue")[];
196
+ declare function useSelectionContext(): HiSelectionContext;
197
+ declare const useSelectionList: _hoci_shared.HookComponent<{
198
+ options: {
199
+ id?: string | undefined;
200
+ label?: string | undefined;
201
+ value: any | null;
202
+ render: () => ElementLike;
203
+ }[];
204
+ actives: any[];
205
+ isActive: (value: any) => boolean;
206
+ changeActive: (value: any) => void;
207
+ renderItem: () => ElementLike;
208
+ }, ("change" | "load" | "unload" | "update:modelValue")[], {
209
+ modelValue: {
210
+ type: PropType<any>;
211
+ default: () => null;
212
+ };
213
+ /**
214
+ * 选中时的 class
215
+ */
216
+ activeClass: {
217
+ type: PropType<string | string[] | Record<string, boolean>>;
218
+ default: string;
219
+ };
220
+ /**
221
+ * 每个选项的 class
222
+ */
223
+ itemClass: {
224
+ type: PropType<string | string[] | Record<string, boolean>>;
225
+ default: string;
226
+ };
227
+ disabledClass: {
228
+ type: PropType<string | string[] | Record<string, boolean>>;
229
+ default: string;
230
+ };
231
+ unactiveClass: {
232
+ type: PropType<string | string[] | Record<string, boolean>>;
233
+ default: string;
234
+ };
235
+ label: {
236
+ type: PropType<string | ((val?: any) => string) | null>;
237
+ };
238
+ /**
239
+ * 多选模式
240
+ */
241
+ multiple: {
242
+ type: (NumberConstructor | BooleanConstructor)[];
243
+ default: () => false;
244
+ };
245
+ /**
246
+ * 可清除
247
+ */
248
+ clearable: {
249
+ type: BooleanConstructor;
250
+ };
251
+ defaultValue: {
252
+ type: PropType<any>;
253
+ default: () => null;
254
+ };
255
+ activateEvent: {
256
+ type: PropType<ActivateEvent>;
257
+ default: () => "click";
258
+ };
259
+ }, vue.ExtractPropTypes<{
260
+ modelValue: {
261
+ type: PropType<any>;
262
+ default: () => null;
263
+ };
264
+ /**
265
+ * 选中时的 class
266
+ */
267
+ activeClass: {
268
+ type: PropType<string | string[] | Record<string, boolean>>;
269
+ default: string;
270
+ };
271
+ /**
272
+ * 每个选项的 class
273
+ */
274
+ itemClass: {
275
+ type: PropType<string | string[] | Record<string, boolean>>;
276
+ default: string;
277
+ };
278
+ disabledClass: {
279
+ type: PropType<string | string[] | Record<string, boolean>>;
280
+ default: string;
281
+ };
282
+ unactiveClass: {
283
+ type: PropType<string | string[] | Record<string, boolean>>;
284
+ default: string;
285
+ };
286
+ label: {
287
+ type: PropType<string | ((val?: any) => string) | null>;
288
+ };
289
+ /**
290
+ * 多选模式
291
+ */
292
+ multiple: {
293
+ type: (NumberConstructor | BooleanConstructor)[];
294
+ default: () => false;
295
+ };
296
+ /**
297
+ * 可清除
298
+ */
299
+ clearable: {
300
+ type: BooleanConstructor;
301
+ };
302
+ defaultValue: {
303
+ type: PropType<any>;
304
+ default: () => null;
305
+ };
306
+ activateEvent: {
307
+ type: PropType<ActivateEvent>;
308
+ default: () => "click";
309
+ };
310
+ }>, {
311
+ multiple: number | boolean;
312
+ modelValue: any;
313
+ activeClass: string | string[] | Record<string, boolean>;
314
+ itemClass: string | string[] | Record<string, boolean>;
315
+ disabledClass: string | string[] | Record<string, boolean>;
316
+ unactiveClass: string | string[] | Record<string, boolean>;
317
+ clearable: boolean;
318
+ defaultValue: any;
319
+ activateEvent: ActivateEvent;
320
+ }>;
321
+ interface HiSelectionSlotData extends Record<string, unknown> {
322
+ isActive: (value: any) => boolean;
323
+ changeActive: (value: any) => void;
324
+ renderItem: () => ElementLike;
325
+ }
326
+
327
+ declare const itemProps: {
328
+ value: {
329
+ type: PropType<any>;
330
+ default(): string;
331
+ };
332
+ label: {
333
+ type: PropType<ElementLike | ((val: any) => string) | null>;
334
+ };
335
+ keepAlive: {
336
+ type: BooleanConstructor;
337
+ default: () => true;
338
+ };
339
+ key: {
340
+ type: PropType<string | number | symbol>;
341
+ };
342
+ activateEvent: {
343
+ type: PropType<ActivateEvent>;
344
+ };
345
+ disabled: {
346
+ type: BooleanConstructor;
347
+ default: boolean;
348
+ };
349
+ };
350
+ declare const useSelectionItem: _hoci_shared.HookComponent<{
351
+ activate: () => void;
352
+ render: () => vue.VNode<vue.RendererNode, vue.RendererElement, {
353
+ [key: string]: any;
354
+ }>;
355
+ isActive: vue.ComputedRef<boolean>;
356
+ isDisabled: vue.ComputedRef<boolean>;
357
+ className: vue.ComputedRef<string>;
358
+ activateEvent: vue.ComputedRef<ActivateEvent>;
359
+ }, vue.EmitsOptions, {
360
+ value: {
361
+ type: PropType<any>;
362
+ default(): string;
363
+ };
364
+ label: {
365
+ type: PropType<ElementLike | ((val: any) => string) | null>;
366
+ };
367
+ keepAlive: {
368
+ type: BooleanConstructor;
369
+ default: () => true;
370
+ };
371
+ key: {
372
+ type: PropType<string | number | symbol>;
373
+ };
374
+ activateEvent: {
375
+ type: PropType<ActivateEvent>;
376
+ };
377
+ disabled: {
378
+ type: BooleanConstructor;
379
+ default: boolean;
380
+ };
381
+ }, vue.ExtractPropTypes<{
382
+ value: {
383
+ type: PropType<any>;
384
+ default(): string;
385
+ };
386
+ label: {
387
+ type: PropType<ElementLike | ((val: any) => string) | null>;
388
+ };
389
+ keepAlive: {
390
+ type: BooleanConstructor;
391
+ default: () => true;
392
+ };
393
+ key: {
394
+ type: PropType<string | number | symbol>;
395
+ };
396
+ activateEvent: {
397
+ type: PropType<ActivateEvent>;
398
+ };
399
+ disabled: {
400
+ type: BooleanConstructor;
401
+ default: boolean;
402
+ };
403
+ }>, {
404
+ value: any;
405
+ disabled: boolean;
406
+ keepAlive: boolean;
407
+ }>;
408
+ interface HiItemSlotsData {
409
+ active: boolean;
410
+ activate(): void;
411
+ }
412
+
413
+ declare const switchProps: {
414
+ modelValue: {
415
+ type: BooleanConstructor;
416
+ default: boolean;
417
+ };
418
+ class: {
419
+ type: PropType<string | string[] | Record<string, boolean>>;
420
+ required: true;
421
+ };
422
+ activeClass: {
423
+ type: PropType<string | string[] | Record<string, boolean>>;
424
+ default: string;
425
+ };
426
+ unactiveClass: {
427
+ type: PropType<string | string[] | Record<string, boolean>>;
428
+ default: string;
429
+ };
430
+ activateEvent: {
431
+ type: PropType<ActivateEvent>;
432
+ default: string;
433
+ };
434
+ disabled: {
435
+ type: BooleanConstructor;
436
+ default: boolean;
437
+ };
438
+ disabledClass: {
439
+ type: PropType<string | string[] | Record<string, boolean>>;
440
+ default: string;
441
+ };
442
+ };
443
+ type HiSwitchProps = typeof switchProps;
444
+ declare const switchEmits: ("change" | "update:modelValue")[];
445
+ declare const useSwitch: _hoci_shared.HookComponent<{
446
+ toggle: (value?: any) => void;
447
+ modelValue: vue.Ref<boolean>;
448
+ className: vue.ComputedRef<string>;
449
+ isDisabled: vue.ComputedRef<boolean>;
450
+ }, ("change" | "update:modelValue")[], {
451
+ modelValue: {
452
+ type: BooleanConstructor;
453
+ default: boolean;
454
+ };
455
+ class: {
456
+ type: PropType<string | string[] | Record<string, boolean>>;
457
+ required: true;
458
+ };
459
+ activeClass: {
460
+ type: PropType<string | string[] | Record<string, boolean>>;
461
+ default: string;
462
+ };
463
+ unactiveClass: {
464
+ type: PropType<string | string[] | Record<string, boolean>>;
465
+ default: string;
466
+ };
467
+ activateEvent: {
468
+ type: PropType<ActivateEvent>;
469
+ default: string;
470
+ };
471
+ disabled: {
472
+ type: BooleanConstructor;
473
+ default: boolean;
474
+ };
475
+ disabledClass: {
476
+ type: PropType<string | string[] | Record<string, boolean>>;
477
+ default: string;
478
+ };
479
+ }, vue.ExtractPropTypes<{
480
+ modelValue: {
481
+ type: BooleanConstructor;
482
+ default: boolean;
483
+ };
484
+ class: {
485
+ type: PropType<string | string[] | Record<string, boolean>>;
486
+ required: true;
487
+ };
488
+ activeClass: {
489
+ type: PropType<string | string[] | Record<string, boolean>>;
490
+ default: string;
491
+ };
492
+ unactiveClass: {
493
+ type: PropType<string | string[] | Record<string, boolean>>;
494
+ default: string;
495
+ };
496
+ activateEvent: {
497
+ type: PropType<ActivateEvent>;
498
+ default: string;
499
+ };
500
+ disabled: {
501
+ type: BooleanConstructor;
502
+ default: boolean;
503
+ };
504
+ disabledClass: {
505
+ type: PropType<string | string[] | Record<string, boolean>>;
506
+ default: string;
507
+ };
508
+ }>, {
509
+ disabled: boolean;
510
+ modelValue: boolean;
511
+ activeClass: string | string[] | Record<string, boolean>;
512
+ disabledClass: string | string[] | Record<string, boolean>;
513
+ unactiveClass: string | string[] | Record<string, boolean>;
514
+ activateEvent: ActivateEvent;
515
+ }>;
516
+
517
+ declare const iconProps: {
518
+ src: {
519
+ type: StringConstructor;
520
+ required: true;
521
+ };
522
+ size: {
523
+ type: (StringConstructor | NumberConstructor)[];
524
+ default: string;
525
+ };
526
+ width: {
527
+ type: (StringConstructor | NumberConstructor)[];
528
+ };
529
+ height: {
530
+ type: (StringConstructor | NumberConstructor)[];
531
+ };
532
+ color: {
533
+ type: StringConstructor;
534
+ };
535
+ mask: {
536
+ type: PropType<boolean | "auto">;
537
+ default: () => "auto";
538
+ };
539
+ };
540
+ type HiIconProps = typeof iconProps;
541
+ declare const useIcon: _hoci_shared.HookComponent<{
542
+ style: vue.ComputedRef<CSSProperties$1>;
543
+ }, vue.EmitsOptions, {
544
+ src: {
545
+ type: StringConstructor;
546
+ required: true;
547
+ };
548
+ size: {
549
+ type: (StringConstructor | NumberConstructor)[];
550
+ default: string;
551
+ };
552
+ width: {
553
+ type: (StringConstructor | NumberConstructor)[];
554
+ };
555
+ height: {
556
+ type: (StringConstructor | NumberConstructor)[];
557
+ };
558
+ color: {
559
+ type: StringConstructor;
560
+ };
561
+ mask: {
562
+ type: PropType<boolean | "auto">;
563
+ default: () => "auto";
564
+ };
565
+ }, vue.ExtractPropTypes<{
566
+ src: {
567
+ type: StringConstructor;
568
+ required: true;
569
+ };
570
+ size: {
571
+ type: (StringConstructor | NumberConstructor)[];
572
+ default: string;
573
+ };
574
+ width: {
575
+ type: (StringConstructor | NumberConstructor)[];
576
+ };
577
+ height: {
578
+ type: (StringConstructor | NumberConstructor)[];
579
+ };
580
+ color: {
581
+ type: StringConstructor;
582
+ };
583
+ mask: {
584
+ type: PropType<boolean | "auto">;
585
+ default: () => "auto";
586
+ };
587
+ }>, {
588
+ mask: boolean | "auto";
589
+ size: string | number;
590
+ }>;
591
+
592
+ export { AFFIX_TARGET_KEY, type AffixProps, type HiIconProps, type HiItemSlotsData, type HiSelectionContext, type HiSelectionSlotData, type HiSwitchProps, type InitFunction, type Option, type SelectionProps, affixEmits, affixProps, iconProps, itemProps, provideAffixTarget, selectionEmits, selectionProps, switchEmits, switchProps, useAffix, useIcon, useSelectionContext, useSelectionItem, useSelectionList, useSwitch };