@hybridly/vue 0.10.0-beta.1 → 0.10.0-beta.2

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,25 @@
1
+ import "node:module";
2
+
3
+ //#region rolldown:runtime
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
23
+
24
+ //#endregion
25
+ export { __reExport as t };
package/dist/index.d.mts CHANGED
@@ -1,12 +1,14 @@
1
- import * as vue10 from "vue";
2
- import { App, ComputedRef, DeepReadonly, MaybeRefOrGetter, Plugin, PropType, Ref, h } from "vue";
3
- import * as _hybridly_core0 from "@hybridly/core";
4
- import { GlobalHybridlyProperties, HybridRequestOptions, Method, Plugin as Plugin$1, RouteName, RouteParameters, RouterContext, RouterContextOptions, UrlResolvable, can, registerHook as registerHook$1, route, router } from "@hybridly/core";
1
+ import * as vue0 from "vue";
2
+ import { App, ComputedRef, DeepReadonly, DefineComponent, MaybeRefOrGetter, Plugin, Ref, h } from "vue";
3
+ import { GlobalHybridlyProperties, HybridRequestOptions, Method, Plugin as Plugin$1, Progress, RouteName, RouteParameters, RouterContext, RouterContextOptions, UrlResolvable, can, registerHook as registerHook$1, route, router } from "@hybridly/core";
5
4
  import { FormDataConvertible, RequestData } from "@hybridly/utils";
6
5
  import { Path, PathValue, SearchableObject } from "@clickbar/dot-diver";
7
6
  import { Axios } from "axios";
8
- import * as _vue_shared0 from "@vue/shared";
9
7
 
8
+ //#region ../hybridly/src/index.d.ts
9
+
10
+ import * as import__hybridly_core from "@hybridly/core";
11
+ //#endregion
10
12
  //#region src/plugins/progress.d.ts
11
13
  interface ProgressOptions {
12
14
  /**
@@ -44,7 +46,7 @@ type InternalProperties = GlobalHybridlyProperties & {
44
46
  [key: string]: Property$1;
45
47
  };
46
48
  /** Accesses all current properties. */
47
- declare function useProperties<T extends object, Global extends InternalProperties = InternalProperties>(): vue10.DeepReadonly<vue10.UnwrapNestedRefs<T & Global>>;
49
+ declare function useProperties<T extends object, Global extends InternalProperties = InternalProperties>(): vue0.DeepReadonly<vue0.UnwrapNestedRefs<T & Global>>;
48
50
  /** Accesses a property with a dot notation. */
49
51
  declare function useProperty<Override = never, T extends SearchableObject = GlobalHybridlyProperties, P extends Path<T> & string = Path<T> & string, ReturnType$1 = ([Override] extends [never] ? PathValue<T, P> : Override)>(path: [Override] extends [never] ? P : string): ComputedRef<ReturnType$1>;
50
52
  /**
@@ -79,54 +81,41 @@ interface FormOptions<T extends SearchableObject> extends Omit<HybridRequestOpti
79
81
  */
80
82
  transform?: (fields: T) => any;
81
83
  }
82
- declare function useForm<T extends SearchableObject, P extends Path<T> & string = Path<T> & string>(options: FormOptions<T>): {
84
+ interface FormReturn<T extends SearchableObject, P extends Path<T> & string = Path<T> & string> {
83
85
  resetFields: (...keys: P[]) => void;
84
86
  reset: () => void;
85
87
  resetSubmissionState: () => void;
86
88
  clear: (...keys: P[]) => void;
87
- fields: vue10.UnwrapRef<T>;
89
+ fields: T;
88
90
  abort: () => void;
89
91
  setErrors: (incoming: Errors<T>) => void;
90
92
  clearErrors: (...keys: P[]) => void;
91
93
  clearError: (key: P) => void;
92
94
  setInitial: (newInitial: Partial<T>) => void;
93
95
  hasDirty: (...keys: P[]) => boolean;
94
- submitWith: (optionsOverrides?: Omit<FormOptions<T>, "fields" | "key">) => Promise<_hybridly_core0.NavigationResponse>;
95
- submitWithOptions: (optionsOverrides?: Omit<FormOptions<T>, "fields" | "key">) => Promise<_hybridly_core0.NavigationResponse>;
96
- submit: () => Promise<_hybridly_core0.NavigationResponse>;
96
+ submitWith: (optionsOverrides?: Omit<FormOptions<T>, 'fields' | 'key'>) => Promise<any>;
97
+ submitWithOptions: (optionsOverrides?: Omit<FormOptions<T>, 'fields' | 'key'>) => Promise<any>;
98
+ submit: () => Promise<any>;
97
99
  hasErrors: boolean;
98
- initial: vue10.UnwrapRef<DeepReadonly<T>>;
99
- loaded: DeepReadonly<any>;
100
- progress: {
101
- readonly event: {
102
- readonly loaded: number;
103
- readonly total?: number | undefined;
104
- readonly progress?: number | undefined;
105
- readonly bytes: number;
106
- readonly rate?: number | undefined;
107
- readonly estimated?: number | undefined;
108
- readonly upload?: boolean | undefined;
109
- readonly download?: boolean | undefined;
110
- readonly event?: any;
111
- readonly lengthComputable: boolean;
112
- };
113
- readonly percentage: Readonly<number>;
114
- } | undefined;
100
+ initial: DeepReadonly<T>;
101
+ loaded: DeepReadonly<T>;
102
+ progress: Progress | undefined;
115
103
  isDirty: boolean;
116
- errors: vue10.UnwrapRef<DeepReadonly<[Errors<T>] extends [vue10.Ref<any, any>] ? _vue_shared0.IfAny<vue10.Ref<any, any> & Errors<T>, vue10.Ref<vue10.Ref<any, any> & Errors<T>, vue10.Ref<any, any> & Errors<T>>, vue10.Ref<any, any> & Errors<T>> : vue10.Ref<vue10.UnwrapRef<Errors<T>>, Errors<T> | vue10.UnwrapRef<Errors<T>>>>>;
104
+ errors: Errors<T>;
117
105
  processing: boolean;
118
106
  successful: boolean;
119
107
  failed: boolean;
120
108
  recentlySuccessful: boolean;
121
109
  recentlyFailed: boolean;
122
- };
110
+ }
111
+ declare function useForm<T extends SearchableObject, P extends Path<T> & string = Path<T> & string>(options: FormOptions<T>): FormReturn<T, P>;
123
112
  //#endregion
124
113
  //#region src/composables/history.d.ts
125
114
  /**
126
115
  * Returns a ref with a value saved in the history state through Hybridly.
127
116
  * The state is linked to a specific browser history entry.
128
117
  */
129
- declare function useHistoryState<T = any>(key: string, initial: T): [T] extends [vue10.Ref<any, any>] ? _vue_shared0.IfAny<T, vue10.Ref<T, T>, T> : vue10.Ref<vue10.UnwrapRef<T>, T | vue10.UnwrapRef<T>>;
118
+ declare function useHistoryState<T = any>(key: string, initial: T): Ref<T>;
130
119
  //#endregion
131
120
  //#region src/composables/back-forward.d.ts
132
121
  type BackForwardCallback = (context: RouterContext) => void;
@@ -177,6 +166,7 @@ interface PaginatorLink {
177
166
  url?: string;
178
167
  label: string;
179
168
  active: boolean;
169
+ page?: number;
180
170
  }
181
171
  interface CursorPaginatorMeta {
182
172
  path: string;
@@ -210,6 +200,11 @@ interface PaginatorMeta {
210
200
  next_page_url?: string;
211
201
  prev_page_url?: string;
212
202
  }
203
+ type MaybeWithData<T> = T | Omit<T, 'data'>;
204
+ type PaginatorResult<T, P> = P extends MaybeWithData<Paginator<T>> ? P & {
205
+ to: (page: number) => Promise<index_d_exports.NavigationResponse> | undefined;
206
+ } : P;
207
+ declare function createPaginator<T, P extends MaybeWithData<Paginator<T> | SimplePaginator<T> | CursorPaginator<T>>>(paginator: P, options?: Omit<index_d_exports.HybridRequestOptions, 'method' | 'url'>): PaginatorResult<T, P>;
213
208
  //#endregion
214
209
  //#region src/composables/register-hook.d.ts
215
210
  /**
@@ -236,9 +231,9 @@ declare function useDialog(): {
236
231
  /** Unmounts the dialog. Should be called after its closing animations. */
237
232
  unmount: () => void;
238
233
  /** Whether the dialog is shown. */
239
- show: vue10.WritableComputedRef<boolean | undefined, boolean | undefined>;
234
+ show: vue0.WritableComputedRef<boolean | undefined, boolean | undefined>;
240
235
  /** Properties of the dialog. */
241
- properties: vue10.ComputedRef<Properties | undefined>;
236
+ properties: vue0.ComputedRef<Properties | undefined>;
242
237
  };
243
238
  //#endregion
244
239
  //#region src/composables/refinements.d.ts
@@ -375,7 +370,7 @@ declare function useRefinements<Properties$1 extends object, RefinementsKey exte
375
370
  /**
376
371
  * Binds a named filter to a ref, applying filters when it changes and updating the ref accordingly.
377
372
  */
378
- bindFilter: <T = any>(name: string, options?: BindFilterOptions<T>) => Ref<T>;
373
+ bindFilter: <T = string | number>(name: string, options?: BindFilterOptions<T>) => Ref<T>;
379
374
  /**
380
375
  * Available filters.
381
376
  */
@@ -383,11 +378,11 @@ declare function useRefinements<Properties$1 extends object, RefinementsKey exte
383
378
  /**
384
379
  * Applies this filter.
385
380
  */
386
- apply: (value: any, options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse | undefined>;
381
+ apply: (value: any, options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
387
382
  /**
388
383
  * Clears this filter.
389
384
  */
390
- clear: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
385
+ clear: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
391
386
  /**
392
387
  * Whether this filter is currently active.
393
388
  */
@@ -428,7 +423,7 @@ declare function useRefinements<Properties$1 extends object, RefinementsKey exte
428
423
  /**
429
424
  * Toggles this sort.
430
425
  */
431
- toggle: (options?: ToggleSortOptions) => Promise<_hybridly_core0.NavigationResponse | undefined>;
426
+ toggle: (options?: ToggleSortOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
432
427
  /**
433
428
  * Checks if this sort is active.
434
429
  */
@@ -436,7 +431,7 @@ declare function useRefinements<Properties$1 extends object, RefinementsKey exte
436
431
  /**
437
432
  * Clears this sort.
438
433
  */
439
- clear: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
434
+ clear: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
440
435
  /**
441
436
  * Whether this sort is currently active.
442
437
  */
@@ -481,7 +476,7 @@ declare function useRefinements<Properties$1 extends object, RefinementsKey exte
481
476
  /**
482
477
  * The key for the filters.
483
478
  */
484
- filtersKey: vue10.ComputedRef<string>;
479
+ filtersKey: vue0.ComputedRef<string>;
485
480
  /**
486
481
  * Gets a filter by name.
487
482
  */
@@ -493,11 +488,11 @@ declare function useRefinements<Properties$1 extends object, RefinementsKey exte
493
488
  /**
494
489
  * Resets all filters and sorts.
495
490
  */
496
- reset: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
491
+ reset: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
497
492
  /**
498
493
  * Toggles the specified sort.
499
494
  */
500
- toggleSort: (name: string, options?: ToggleSortOptions) => Promise<_hybridly_core0.NavigationResponse | undefined>;
495
+ toggleSort: (name: string, options?: ToggleSortOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
501
496
  /**
502
497
  * Whether a sort is active.
503
498
  */
@@ -517,25 +512,25 @@ declare function useRefinements<Properties$1 extends object, RefinementsKey exte
517
512
  /**
518
513
  * Clears the given filter.
519
514
  */
520
- clearFilter: (filter: string, options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
515
+ clearFilter: (filter: string, options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
521
516
  /**
522
517
  * Resets all sorts.
523
518
  */
524
- clearSorts: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
519
+ clearSorts: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
525
520
  /**
526
521
  * Resets all filters.
527
522
  */
528
- clearFilters: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
523
+ clearFilters: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
529
524
  /**
530
525
  * Applies the given filter.
531
526
  */
532
- applyFilter: (name: string, value: any, options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse | undefined>;
527
+ applyFilter: (name: string, value: any, options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
533
528
  };
534
529
  //#endregion
535
530
  //#region src/composables/current-route.d.ts
536
531
  declare function useRoute(): {
537
- isNavigating: Readonly<vue10.Ref<boolean, boolean>>;
538
- current: Readonly<vue10.Ref<string | undefined, string | undefined>>;
532
+ isNavigating: Readonly<vue0.Ref<boolean, boolean>>;
533
+ current: Readonly<vue0.Ref<string | undefined, string | undefined>>;
539
534
  matches: <T extends RouteName>(name: MaybeRefOrGetter<T>, parameters?: RouteParameters<T>) => boolean;
540
535
  };
541
536
  //#endregion
@@ -549,7 +544,7 @@ interface BulkSelection<T = any> {
549
544
  except: Set<T>;
550
545
  }
551
546
  declare function useBulkSelect<T = any>(): {
552
- allSelected: vue10.ComputedRef<boolean>;
547
+ allSelected: vue0.ComputedRef<boolean>;
553
548
  selectAll: () => void;
554
549
  deselectAll: () => void;
555
550
  select: (...records: T[]) => void;
@@ -574,7 +569,7 @@ declare global {
574
569
  inlineActions: InlineAction[];
575
570
  bulkActions: BulkAction[];
576
571
  records: Array<T>;
577
- paginator: Exclude<PaginatorKind extends 'cursor' ? CursorPaginator<T> : (PaginatorKind extends 'simple' ? SimplePaginator<T> : Paginator<T>), 'data'>;
572
+ paginator: Omit<PaginatorKind extends 'cursor' ? CursorPaginator<T> : (PaginatorKind extends 'simple' ? SimplePaginator<T> : Paginator<T>), 'data'>;
578
573
  refinements: Refinements;
579
574
  endpoint: string;
580
575
  }
@@ -628,10 +623,10 @@ interface TableDefaultOptions extends AvailableHybridRequestOptions {
628
623
  * Provides utilities for working with tables.
629
624
  */
630
625
  declare function useTable<RecordType extends (Props[PropsKey] extends Table<infer T, any> ? T : never), RecordTypeWithExtra extends AsRecordTypeWithExtra<RecordType>, PaginatorKindName extends (Props[PropsKey] extends Table<any, infer PaginatorKind> ? PaginatorKind : never), TableType extends (Props[PropsKey] extends Table<any, PaginatorKindName> ? Table<RecordTypeWithExtra, PaginatorKindName> : never), Props extends Record<string, unknown>, PropsKey extends keyof Props>(props: Props, key: PropsKey, defaultOptions?: TableDefaultOptions): {
631
- bindFilter: <T = any>(name: string, options?: BindFilterOptions<T>) => vue10.Ref<T, T>;
626
+ bindFilter: <T = string | number>(name: string, options?: BindFilterOptions<T>) => vue0.Ref<T, T>;
632
627
  filters: {
633
- apply: (value: any, options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse | undefined>;
634
- clear: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
628
+ apply: (value: any, options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
629
+ clear: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
635
630
  is_active: boolean;
636
631
  type: "trashed" | "callback" | "exact" | "similar:loose" | "similar:begins_with_strict" | "similar:ends_with_strict" | string;
637
632
  label: string;
@@ -642,9 +637,9 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
642
637
  default: any;
643
638
  }[];
644
639
  sorts: {
645
- toggle: (options?: ToggleSortOptions) => Promise<_hybridly_core0.NavigationResponse | undefined>;
640
+ toggle: (options?: ToggleSortOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
646
641
  isSorting: (direction?: SortDirection) => boolean;
647
- clear: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
642
+ clear: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
648
643
  is_active: boolean;
649
644
  direction?: SortDirection | undefined;
650
645
  default?: SortDirection | undefined;
@@ -659,16 +654,16 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
659
654
  filtersKey: string;
660
655
  getFilter: (name: string) => FilterRefinement | undefined;
661
656
  getSort: (name: string) => SortRefinement | undefined;
662
- reset: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
663
- toggleSort: (name: string, options?: ToggleSortOptions) => Promise<_hybridly_core0.NavigationResponse | undefined>;
657
+ reset: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
658
+ toggleSort: (name: string, options?: ToggleSortOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
664
659
  isSorting: (name?: string, direction?: SortDirection) => boolean;
665
660
  isFiltering: (name?: string) => boolean;
666
661
  currentSorts: () => Array<SortRefinement>;
667
662
  currentFilters: () => Array<FilterRefinement>;
668
- clearFilter: (filter: string, options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
669
- clearSorts: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
670
- clearFilters: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
671
- applyFilter: (name: string, value: any, options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse | undefined>;
663
+ clearFilter: (filter: string, options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
664
+ clearSorts: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
665
+ clearFilters: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
666
+ applyFilter: (name: string, value: any, options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
672
667
  selectAll: () => void;
673
668
  deselectAll: () => void;
674
669
  selectPage: () => void;
@@ -695,7 +690,7 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
695
690
  /** Custom metadata for this action. */
696
691
  metadata: any;
697
692
  /** Executes the action. */
698
- execute: (record: RecordTypeWithExtra | RecordIdentifier) => Promise<_hybridly_core0.NavigationResponse>;
693
+ execute: (record: RecordTypeWithExtra | RecordIdentifier) => Promise<index_d_exports.NavigationResponse>;
699
694
  }[];
700
695
  bulkActions: {
701
696
  /** Should deselect all records after action. */
@@ -709,19 +704,19 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
709
704
  /** Custom metadata for this action. */
710
705
  metadata: any;
711
706
  /** Executes the action. */
712
- execute: (options?: BulkActionOptions) => Promise<_hybridly_core0.NavigationResponse>;
707
+ execute: (options?: BulkActionOptions) => Promise<index_d_exports.NavigationResponse>;
713
708
  }[];
714
- executeInlineAction: (action: Action | string, record: RecordTypeWithExtra | RecordIdentifier) => Promise<_hybridly_core0.NavigationResponse>;
715
- executeBulkAction: (action: Action | string, options?: BulkActionOptions) => Promise<_hybridly_core0.NavigationResponse>;
709
+ executeInlineAction: (action: Action | string, record: RecordTypeWithExtra | RecordIdentifier) => Promise<index_d_exports.NavigationResponse>;
710
+ executeBulkAction: (action: Action | string, options?: BulkActionOptions) => Promise<index_d_exports.NavigationResponse>;
716
711
  columns: {
717
712
  /** Toggles sorting for this column. */
718
- toggleSort: (options?: ToggleSortOptions) => Promise<_hybridly_core0.NavigationResponse | undefined>;
713
+ toggleSort: (options?: ToggleSortOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
719
714
  /** Checks whether the column is being sorted. */
720
715
  isSorting: (direction?: SortDirection) => boolean;
721
716
  /** Applies the filer for this column. */
722
- applyFilter: (value: any, options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse | undefined>;
717
+ applyFilter: (value: any, options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
723
718
  /** Clears the filter for this column. */
724
- clearFilter: (options?: AvailableHybridRequestOptions) => Promise<_hybridly_core0.NavigationResponse>;
719
+ clearFilter: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>;
725
720
  /** Checks whether the column is sortable. */
726
721
  isSortable: boolean;
727
722
  /** Checks whether the column is filterable. */
@@ -742,11 +737,11 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
742
737
  /** The key of the record. Use this instead of `id`. */
743
738
  key: RecordIdentifier;
744
739
  /** Executes the given inline action. */
745
- execute: (action: string | InlineAction) => Promise<_hybridly_core0.NavigationResponse>;
740
+ execute: (action: string | InlineAction) => Promise<index_d_exports.NavigationResponse>;
746
741
  /** Gets the available inline actions. */
747
742
  actions: {
748
743
  /** Executes the action. */
749
- execute: () => Promise<_hybridly_core0.NavigationResponse>;
744
+ execute: () => Promise<index_d_exports.NavigationResponse>;
750
745
  /** The name of this action. */
751
746
  name: string;
752
747
  /** The label of this action. */
@@ -769,7 +764,7 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
769
764
  /** Gets the extra object of the record for the specified column. */
770
765
  extra: (column: string | Column<RecordTypeWithExtra>, path: string) => any;
771
766
  }[];
772
- paginator: Exclude<PaginatorKindName extends "cursor" ? CursorPaginator<RecordTypeWithExtra> : PaginatorKindName extends "simple" ? SimplePaginator<RecordTypeWithExtra> : Paginator<RecordTypeWithExtra>, "data">;
767
+ paginator: PaginatorResult<unknown, Omit<PaginatorKindName extends "cursor" ? CursorPaginator<RecordTypeWithExtra> : PaginatorKindName extends "simple" ? SimplePaginator<RecordTypeWithExtra> : Paginator<RecordTypeWithExtra>, "data">>;
773
768
  };
774
769
  //#endregion
775
770
  //#region src/composables/query-parameters.d.ts
@@ -863,161 +858,19 @@ interface SetupArguments {
863
858
  }
864
859
  //#endregion
865
860
  //#region src/components/link.d.ts
866
- declare const RouterLink: vue10.DefineComponent<vue10.ExtractPropTypes<{
867
- href: {
868
- type: StringConstructor;
869
- required: false;
870
- default: undefined;
871
- };
872
- as: {
873
- type: (StringConstructor | ObjectConstructor)[];
874
- default: string;
875
- };
876
- method: {
877
- type: PropType<Method | Lowercase<Method>>;
878
- default: string;
879
- };
880
- data: {
881
- type: PropType<RequestData>;
882
- default: () => {};
883
- };
884
- external: {
885
- type: BooleanConstructor;
886
- default: boolean;
887
- };
888
- disabled: {
889
- type: BooleanConstructor;
890
- default: boolean;
891
- };
892
- options: {
893
- type: PropType<Omit<HybridRequestOptions, "url" | "data" | "method">>;
894
- default: () => {};
895
- };
896
- text: {
897
- type: StringConstructor;
898
- required: false;
899
- default: undefined;
900
- };
901
- preload: {
902
- type: PropType<boolean | "hover" | "mount">;
903
- default: boolean;
904
- };
905
- preserveScroll: {
906
- type: BooleanConstructor;
907
- default: undefined;
908
- };
909
- preserveState: {
910
- type: BooleanConstructor;
911
- default: undefined;
912
- };
913
- }>, (props: _vue_shared0.LooseRequired<Readonly<vue10.ExtractPropTypes<{
914
- href: {
915
- type: StringConstructor;
916
- required: false;
917
- default: undefined;
918
- };
919
- as: {
920
- type: (StringConstructor | ObjectConstructor)[];
921
- default: string;
922
- };
923
- method: {
924
- type: PropType<Method | Lowercase<Method>>;
925
- default: string;
926
- };
927
- data: {
928
- type: PropType<RequestData>;
929
- default: () => {};
930
- };
931
- external: {
932
- type: BooleanConstructor;
933
- default: boolean;
934
- };
935
- disabled: {
936
- type: BooleanConstructor;
937
- default: boolean;
938
- };
939
- options: {
940
- type: PropType<Omit<HybridRequestOptions, "url" | "data" | "method">>;
941
- default: () => {};
942
- };
943
- text: {
944
- type: StringConstructor;
945
- required: false;
946
- default: undefined;
947
- };
948
- preload: {
949
- type: PropType<boolean | "hover" | "mount">;
950
- default: boolean;
951
- };
952
- preserveScroll: {
953
- type: BooleanConstructor;
954
- default: undefined;
955
- };
956
- preserveState: {
957
- type: BooleanConstructor;
958
- default: undefined;
959
- };
960
- }>> & Readonly<{}> & {}>) => vue10.VNode<vue10.RendererNode, vue10.RendererElement, {
961
- [key: string]: any;
962
- }>, {}, {}, {}, vue10.ComponentOptionsMixin, vue10.ComponentOptionsMixin, {}, string, vue10.PublicProps, Readonly<vue10.ExtractPropTypes<{
963
- href: {
964
- type: StringConstructor;
965
- required: false;
966
- default: undefined;
967
- };
968
- as: {
969
- type: (StringConstructor | ObjectConstructor)[];
970
- default: string;
971
- };
972
- method: {
973
- type: PropType<Method | Lowercase<Method>>;
974
- default: string;
975
- };
976
- data: {
977
- type: PropType<RequestData>;
978
- default: () => {};
979
- };
980
- external: {
981
- type: BooleanConstructor;
982
- default: boolean;
983
- };
984
- disabled: {
985
- type: BooleanConstructor;
986
- default: boolean;
987
- };
988
- options: {
989
- type: PropType<Omit<HybridRequestOptions, "url" | "data" | "method">>;
990
- default: () => {};
991
- };
992
- text: {
993
- type: StringConstructor;
994
- required: false;
995
- default: undefined;
996
- };
997
- preload: {
998
- type: PropType<boolean | "hover" | "mount">;
999
- default: boolean;
1000
- };
1001
- preserveScroll: {
1002
- type: BooleanConstructor;
1003
- default: undefined;
1004
- };
1005
- preserveState: {
1006
- type: BooleanConstructor;
1007
- default: undefined;
1008
- };
1009
- }>> & Readonly<{}>, {
1010
- data: RequestData;
1011
- method: "delete" | "get" | Method | "post" | "put" | "patch";
1012
- preserveScroll: boolean;
1013
- preserveState: boolean;
1014
- href: string;
1015
- as: string | Record<string, any>;
1016
- external: boolean;
1017
- disabled: boolean;
1018
- options: Omit<HybridRequestOptions, "data" | "url" | "method">;
1019
- text: string;
1020
- preload: boolean | "hover" | "mount";
1021
- }, {}, {}, {}, string, vue10.ComponentProvideOptions, true, {}, any>;
861
+ interface RouterLinkProps {
862
+ href?: string;
863
+ as?: string | object;
864
+ method?: Method | Lowercase<Method>;
865
+ data?: RequestData;
866
+ external?: boolean;
867
+ disabled?: boolean;
868
+ options?: Omit<HybridRequestOptions, 'url' | 'data' | 'method'>;
869
+ text?: string;
870
+ preload?: boolean | 'hover' | 'mount';
871
+ preserveScroll?: boolean;
872
+ preserveState?: boolean;
873
+ }
874
+ declare const RouterLink: DefineComponent<RouterLinkProps>;
1022
875
  //#endregion
1023
- export { Action, AvailableHybridRequestOptions, BindFilterOptions, BulkAction, BulkSelection, Column, DefaultFormOptions, type InitializeOptions, InlineAction, InternalProperties, RecordIdentifier, RouterLink, SortDirection, TableDefaultOptions, ToggleSortOptions, can, initializeHybridly, registerHook, route, router, setProperty, useBackForward, useBulkSelect, useDialog, useForm, useHistoryState, useProperties, useProperty, useQueryParameter, useQueryParameters, useRefinements, useRoute, useTable };
876
+ export { Action, AvailableHybridRequestOptions, BindFilterOptions, BulkAction, BulkSelection, Column, DefaultFormOptions, FormReturn, type InitializeOptions, InlineAction, InternalProperties, MaybeWithData, PaginatorResult, RecordIdentifier, RouterLink, SortDirection, TableDefaultOptions, ToggleSortOptions, can, createPaginator, initializeHybridly, registerHook, route, router, setProperty, useBackForward, useBulkSelect, useDialog, useForm, useHistoryState, useProperties, useProperty, useQueryParameter, useQueryParameters, useRefinements, useRoute, useTable };
package/dist/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { t as __reExport } from "./_chunks/chunk.mjs";
1
2
  import { computed, createApp, defineComponent, getCurrentInstance, h, isRef, nextTick, onUnmounted, reactive, readonly, ref, shallowRef, toRaw, toValue, triggerRef, unref, watch } from "vue";
2
3
  import { can, createRouter, definePlugin, makeUrl, registerHook as registerHook$1, route, route as route$1, router, router as router$1 } from "@hybridly/core";
3
4
  import { clone, debounce, debug, merge, random, setValueAtPath, showViewComponentErrorModal, unsetPropertyAtPath } from "@hybridly/utils";
@@ -943,6 +944,28 @@ function useBackForward(options) {
943
944
  };
944
945
  }
945
946
 
947
+ //#endregion
948
+ //#region ../hybridly/dist/index.mjs
949
+ var dist_exports = {};
950
+ import * as import__hybridly_core from "@hybridly/core";
951
+ __reExport(dist_exports, import__hybridly_core);
952
+
953
+ //#endregion
954
+ //#region src/composables/paginator.ts
955
+ function createPaginator(paginator, options) {
956
+ const isPaginator = (p) => {
957
+ return "links" in p && "meta" in p && "last_page" in p.meta;
958
+ };
959
+ if (isPaginator(paginator)) return {
960
+ ...paginator,
961
+ to: (page) => {
962
+ const link = paginator.links.find((l) => l.page === page);
963
+ if (link?.url) return dist_exports.router.get(link.url, options);
964
+ }
965
+ };
966
+ return paginator;
967
+ }
968
+
946
969
  //#endregion
947
970
  //#region src/composables/register-hook.ts
948
971
  /**
@@ -1383,7 +1406,7 @@ function useTable(props, key, defaultOptions = {}) {
1383
1406
  isFilterable: !!refinements.filters.find((filters) => filters.name === column.name)
1384
1407
  }))),
1385
1408
  data: computed(() => table.value.records.map((record) => {
1386
- return Object.fromEntries(Object.entries(record).map(([key$1, value]) => [key$1, value.value]));
1409
+ return Object.fromEntries(Object.entries(record).map(([key$1, value]) => [key$1, value.value]).filter(([key$1]) => key$1 === "__hybridId"));
1387
1410
  })),
1388
1411
  records: computed(() => table.value.records.map((record) => ({
1389
1412
  record: Object.values(record).map((record$1) => record$1.value),
@@ -1400,10 +1423,10 @@ function useTable(props, key, defaultOptions = {}) {
1400
1423
  value: (column) => record[typeof column === "string" ? column : column.name].value,
1401
1424
  extra: (column, path) => getByPath(record[typeof column === "string" ? column : column.name].extra, path)
1402
1425
  }))),
1403
- paginator: computed(() => table.value.paginator),
1426
+ paginator: computed(() => createPaginator(table.value.paginator)),
1404
1427
  ...refinements
1405
1428
  });
1406
1429
  }
1407
1430
 
1408
1431
  //#endregion
1409
- export { RouterLink, can, initializeHybridly, registerHook, route, router, setProperty, useBackForward, useBulkSelect, useDialog, useForm, useHistoryState, useProperties, useProperty, useQueryParameter, useQueryParameters, useRefinements, useRoute, useTable };
1432
+ export { RouterLink, can, createPaginator, initializeHybridly, registerHook, route, router, setProperty, useBackForward, useBulkSelect, useDialog, useForm, useHistoryState, useProperties, useProperty, useQueryParameter, useQueryParameters, useRefinements, useRoute, useTable };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridly/vue",
3
3
  "type": "module",
4
- "version": "0.10.0-beta.1",
4
+ "version": "0.10.0-beta.2",
5
5
  "description": "Vue adapter for Hybridly",
6
6
  "author": "Enzo Innocenzi <enzo@innocenzi.dev>",
7
7
  "license": "MIT",