@hybridly/vue 0.7.7 → 0.7.8
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 +15 -1
- package/dist/index.d.cts +178 -175
- package/dist/index.d.mts +178 -175
- package/dist/index.d.ts +178 -175
- package/dist/index.mjs +16 -2
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -412,6 +412,16 @@ function viewTransition() {
|
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
+
const formStore = {
|
|
416
|
+
defaultConfig: {},
|
|
417
|
+
setDefaultConfig: (config) => {
|
|
418
|
+
formStore.defaultConfig = config;
|
|
419
|
+
},
|
|
420
|
+
getDefaultConfig: () => {
|
|
421
|
+
return utils.clone(formStore.defaultConfig);
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
|
|
415
425
|
async function initializeHybridly(options = {}) {
|
|
416
426
|
const resolved = options;
|
|
417
427
|
const { element, payload, resolve } = prepare(resolved);
|
|
@@ -503,6 +513,9 @@ function prepare(options) {
|
|
|
503
513
|
if (options.viewTransition !== false) {
|
|
504
514
|
options.plugins.push(viewTransition());
|
|
505
515
|
}
|
|
516
|
+
if (options.defaultFormOptions) {
|
|
517
|
+
formStore.setDefaultConfig(options.defaultFormOptions);
|
|
518
|
+
}
|
|
506
519
|
return {
|
|
507
520
|
isServer,
|
|
508
521
|
element,
|
|
@@ -768,7 +781,8 @@ function useForm(options) {
|
|
|
768
781
|
}
|
|
769
782
|
function submit(optionsOverrides) {
|
|
770
783
|
const { fields: _f, key: _k, ...optionsWithoutFields } = options;
|
|
771
|
-
const
|
|
784
|
+
const resolvedOptions = optionsOverrides ? utils.merge(optionsWithoutFields, optionsOverrides, { mergePlainObjects: true }) : optionsWithoutFields;
|
|
785
|
+
const optionsWithOverrides = utils.merge(formStore.getDefaultConfig(), resolvedOptions, { mergePlainObjects: true });
|
|
772
786
|
const url = typeof optionsWithOverrides.url === "function" ? optionsWithOverrides.url() : optionsWithOverrides.url;
|
|
773
787
|
const data = typeof optionsWithOverrides.transform === "function" ? optionsWithOverrides.transform(fields) : fields;
|
|
774
788
|
const preserveState = optionsWithOverrides.preserveState ?? optionsWithOverrides.method !== "GET";
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { App, Plugin as Plugin$1, h, PropType
|
|
2
|
+
import { ComputedRef, DeepReadonly, Ref, MaybeRefOrGetter, App, Plugin as Plugin$1, h, PropType } from 'vue';
|
|
3
3
|
import * as _hybridly_core from '@hybridly/core';
|
|
4
|
-
import {
|
|
4
|
+
import { HybridRequestOptions, UrlResolvable, RouterContext, registerHook as registerHook$1, RouteParameters, RouterContextOptions, Plugin, Method } from '@hybridly/core';
|
|
5
5
|
export { can, route, router } from '@hybridly/core';
|
|
6
6
|
import { Axios } from 'axios';
|
|
7
|
-
import * as _vue_shared from '@vue/shared';
|
|
8
|
-
import { RequestData, FormDataConvertible } from '@hybridly/utils';
|
|
9
7
|
import { SearchableObject, Path, PathValue } from '@clickbar/dot-diver';
|
|
8
|
+
import { FormDataConvertible, RequestData } from '@hybridly/utils';
|
|
9
|
+
import * as _vue_shared from '@vue/shared';
|
|
10
10
|
|
|
11
11
|
interface ProgressOptions {
|
|
12
12
|
/**
|
|
@@ -36,176 +36,6 @@ interface ProgressOptions {
|
|
|
36
36
|
spinner: boolean;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* Initializes Hybridly's router and context.
|
|
41
|
-
*/
|
|
42
|
-
declare function initializeHybridly(options?: InitializeOptions): Promise<any>;
|
|
43
|
-
interface InitializeOptions {
|
|
44
|
-
/** Callback that gets executed before Vue is mounted. */
|
|
45
|
-
enhanceVue?: (vue: App<Element>) => any;
|
|
46
|
-
/** ID of the app element. */
|
|
47
|
-
id?: string;
|
|
48
|
-
/** Clean up the host element's payload dataset after loading. */
|
|
49
|
-
cleanup?: boolean;
|
|
50
|
-
/** Whether to set up the devtools plugin. */
|
|
51
|
-
devtools?: boolean;
|
|
52
|
-
/** Whether to display response error modals. */
|
|
53
|
-
responseErrorModals?: boolean;
|
|
54
|
-
/** Custom history state serialization functions. */
|
|
55
|
-
serializer?: RouterContextOptions['serializer'];
|
|
56
|
-
/** Progressbar options. */
|
|
57
|
-
progress?: false | Partial<ProgressOptions>;
|
|
58
|
-
/** Sets up the hybridly router. */
|
|
59
|
-
setup?: (options: SetupArguments) => any;
|
|
60
|
-
/** List of Hybridly plugins. */
|
|
61
|
-
plugins?: Plugin[];
|
|
62
|
-
/** Custom Axios instance. */
|
|
63
|
-
axios?: Axios;
|
|
64
|
-
/**
|
|
65
|
-
* Enables the View Transition API, if supported.
|
|
66
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition
|
|
67
|
-
*/
|
|
68
|
-
viewTransition?: boolean;
|
|
69
|
-
}
|
|
70
|
-
interface SetupArguments {
|
|
71
|
-
/** DOM element to mount Vue on. */
|
|
72
|
-
element: Element;
|
|
73
|
-
/** Hybridly wrapper component. */
|
|
74
|
-
wrapper: any;
|
|
75
|
-
/** Hybridly wrapper component properties. */
|
|
76
|
-
props: {
|
|
77
|
-
context: RouterContext;
|
|
78
|
-
};
|
|
79
|
-
/** Vue plugin that registers the devtools. */
|
|
80
|
-
hybridly: Plugin$1;
|
|
81
|
-
/** Renders the wrapper. */
|
|
82
|
-
render: () => ReturnType<typeof h>;
|
|
83
|
-
/** Initial payload. */
|
|
84
|
-
payload: Record<string, any>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare const RouterLink: vue.DefineComponent<{
|
|
88
|
-
href: {
|
|
89
|
-
type: StringConstructor;
|
|
90
|
-
required: false;
|
|
91
|
-
default: undefined;
|
|
92
|
-
};
|
|
93
|
-
as: {
|
|
94
|
-
type: (ObjectConstructor | StringConstructor)[];
|
|
95
|
-
default: string;
|
|
96
|
-
};
|
|
97
|
-
method: {
|
|
98
|
-
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
99
|
-
default: string;
|
|
100
|
-
};
|
|
101
|
-
data: {
|
|
102
|
-
type: PropType<RequestData>;
|
|
103
|
-
default: () => {};
|
|
104
|
-
};
|
|
105
|
-
external: {
|
|
106
|
-
type: BooleanConstructor;
|
|
107
|
-
default: boolean;
|
|
108
|
-
};
|
|
109
|
-
disabled: {
|
|
110
|
-
type: BooleanConstructor;
|
|
111
|
-
default: boolean;
|
|
112
|
-
};
|
|
113
|
-
options: {
|
|
114
|
-
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
115
|
-
default: () => {};
|
|
116
|
-
};
|
|
117
|
-
text: {
|
|
118
|
-
type: StringConstructor;
|
|
119
|
-
required: false;
|
|
120
|
-
default: undefined;
|
|
121
|
-
};
|
|
122
|
-
preload: {
|
|
123
|
-
type: PropType<boolean | "hover" | "mount">;
|
|
124
|
-
default: boolean;
|
|
125
|
-
};
|
|
126
|
-
preserveScroll: {
|
|
127
|
-
type: BooleanConstructor;
|
|
128
|
-
default: undefined;
|
|
129
|
-
};
|
|
130
|
-
preserveState: {
|
|
131
|
-
type: BooleanConstructor;
|
|
132
|
-
default: undefined;
|
|
133
|
-
};
|
|
134
|
-
}, (props: _vue_shared.LooseRequired<{
|
|
135
|
-
readonly data: RequestData;
|
|
136
|
-
readonly method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
137
|
-
readonly options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
138
|
-
readonly as: string | Record<string, any>;
|
|
139
|
-
readonly external: boolean;
|
|
140
|
-
readonly disabled: boolean;
|
|
141
|
-
readonly preload: boolean | "hover" | "mount";
|
|
142
|
-
readonly text?: string | undefined;
|
|
143
|
-
readonly preserveScroll?: boolean | undefined;
|
|
144
|
-
readonly preserveState?: boolean | undefined;
|
|
145
|
-
readonly href?: string | undefined;
|
|
146
|
-
} & {}>) => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
147
|
-
[key: string]: any;
|
|
148
|
-
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
149
|
-
href: {
|
|
150
|
-
type: StringConstructor;
|
|
151
|
-
required: false;
|
|
152
|
-
default: undefined;
|
|
153
|
-
};
|
|
154
|
-
as: {
|
|
155
|
-
type: (ObjectConstructor | StringConstructor)[];
|
|
156
|
-
default: string;
|
|
157
|
-
};
|
|
158
|
-
method: {
|
|
159
|
-
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
160
|
-
default: string;
|
|
161
|
-
};
|
|
162
|
-
data: {
|
|
163
|
-
type: PropType<RequestData>;
|
|
164
|
-
default: () => {};
|
|
165
|
-
};
|
|
166
|
-
external: {
|
|
167
|
-
type: BooleanConstructor;
|
|
168
|
-
default: boolean;
|
|
169
|
-
};
|
|
170
|
-
disabled: {
|
|
171
|
-
type: BooleanConstructor;
|
|
172
|
-
default: boolean;
|
|
173
|
-
};
|
|
174
|
-
options: {
|
|
175
|
-
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
176
|
-
default: () => {};
|
|
177
|
-
};
|
|
178
|
-
text: {
|
|
179
|
-
type: StringConstructor;
|
|
180
|
-
required: false;
|
|
181
|
-
default: undefined;
|
|
182
|
-
};
|
|
183
|
-
preload: {
|
|
184
|
-
type: PropType<boolean | "hover" | "mount">;
|
|
185
|
-
default: boolean;
|
|
186
|
-
};
|
|
187
|
-
preserveScroll: {
|
|
188
|
-
type: BooleanConstructor;
|
|
189
|
-
default: undefined;
|
|
190
|
-
};
|
|
191
|
-
preserveState: {
|
|
192
|
-
type: BooleanConstructor;
|
|
193
|
-
default: undefined;
|
|
194
|
-
};
|
|
195
|
-
}>>, {
|
|
196
|
-
data: RequestData;
|
|
197
|
-
text: string;
|
|
198
|
-
preserveScroll: boolean;
|
|
199
|
-
preserveState: boolean;
|
|
200
|
-
method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
201
|
-
href: string;
|
|
202
|
-
options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
203
|
-
as: string | Record<string, any>;
|
|
204
|
-
external: boolean;
|
|
205
|
-
disabled: boolean;
|
|
206
|
-
preload: boolean | "hover" | "mount";
|
|
207
|
-
}, {}>;
|
|
208
|
-
|
|
209
39
|
/** Accesses all current properties. */
|
|
210
40
|
declare function useProperties<T extends object, Global extends GlobalHybridlyProperties = GlobalHybridlyProperties>(): vue.DeepReadonly<vue.UnwrapNestedRefs<T & Global>>;
|
|
211
41
|
/** Accesses a property with a dot notation. */
|
|
@@ -219,6 +49,7 @@ declare function setProperty<Override = never, T extends SearchableObject = Glob
|
|
|
219
49
|
type Errors<T extends SearchableObject> = {
|
|
220
50
|
[K in keyof T]?: T[K] extends Record<string, any> ? Errors<T[K]> : string;
|
|
221
51
|
};
|
|
52
|
+
type DefaultFormOptions = Pick<FormOptions<object>, 'timeout' | 'reset' | 'updateInitials' | 'progress' | 'preserveScroll' | 'preserveState' | 'preserveUrl' | 'headers' | 'errorBag' | 'spoof' | 'transformUrl' | 'updateHistoryState' | 'useFormData'>;
|
|
222
53
|
interface FormOptions<T extends SearchableObject> extends Omit<HybridRequestOptions, 'data' | 'url'> {
|
|
223
54
|
fields: T;
|
|
224
55
|
url?: UrlResolvable | (() => UrlResolvable);
|
|
@@ -927,4 +758,176 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
|
|
|
927
758
|
*/
|
|
928
759
|
declare function useQueryParameters<T extends Record<string, any> = Record<string, any>>(): T;
|
|
929
760
|
|
|
930
|
-
|
|
761
|
+
/**
|
|
762
|
+
* Initializes Hybridly's router and context.
|
|
763
|
+
*/
|
|
764
|
+
declare function initializeHybridly(options?: InitializeOptions): Promise<any>;
|
|
765
|
+
interface InitializeOptions {
|
|
766
|
+
/** Callback that gets executed before Vue is mounted. */
|
|
767
|
+
enhanceVue?: (vue: App<Element>) => any;
|
|
768
|
+
/** ID of the app element. */
|
|
769
|
+
id?: string;
|
|
770
|
+
/** Clean up the host element's payload dataset after loading. */
|
|
771
|
+
cleanup?: boolean;
|
|
772
|
+
/** Whether to set up the devtools plugin. */
|
|
773
|
+
devtools?: boolean;
|
|
774
|
+
/** Whether to display response error modals. */
|
|
775
|
+
responseErrorModals?: boolean;
|
|
776
|
+
/** Custom history state serialization functions. */
|
|
777
|
+
serializer?: RouterContextOptions['serializer'];
|
|
778
|
+
/** Progressbar options. */
|
|
779
|
+
progress?: false | Partial<ProgressOptions>;
|
|
780
|
+
/** Sets up the hybridly router. */
|
|
781
|
+
setup?: (options: SetupArguments) => any;
|
|
782
|
+
/** List of Hybridly plugins. */
|
|
783
|
+
plugins?: Plugin[];
|
|
784
|
+
/** Custom Axios instance. */
|
|
785
|
+
axios?: Axios;
|
|
786
|
+
/**
|
|
787
|
+
* Enables the View Transition API, if supported.
|
|
788
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition
|
|
789
|
+
*/
|
|
790
|
+
viewTransition?: boolean;
|
|
791
|
+
/** Options that will apply to all forms by default. Specific forms' options will override them. */
|
|
792
|
+
defaultFormOptions?: DefaultFormOptions;
|
|
793
|
+
}
|
|
794
|
+
interface SetupArguments {
|
|
795
|
+
/** DOM element to mount Vue on. */
|
|
796
|
+
element: Element;
|
|
797
|
+
/** Hybridly wrapper component. */
|
|
798
|
+
wrapper: any;
|
|
799
|
+
/** Hybridly wrapper component properties. */
|
|
800
|
+
props: {
|
|
801
|
+
context: RouterContext;
|
|
802
|
+
};
|
|
803
|
+
/** Vue plugin that registers the devtools. */
|
|
804
|
+
hybridly: Plugin$1;
|
|
805
|
+
/** Renders the wrapper. */
|
|
806
|
+
render: () => ReturnType<typeof h>;
|
|
807
|
+
/** Initial payload. */
|
|
808
|
+
payload: Record<string, any>;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
declare const RouterLink: vue.DefineComponent<{
|
|
812
|
+
href: {
|
|
813
|
+
type: StringConstructor;
|
|
814
|
+
required: false;
|
|
815
|
+
default: undefined;
|
|
816
|
+
};
|
|
817
|
+
as: {
|
|
818
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
819
|
+
default: string;
|
|
820
|
+
};
|
|
821
|
+
method: {
|
|
822
|
+
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
823
|
+
default: string;
|
|
824
|
+
};
|
|
825
|
+
data: {
|
|
826
|
+
type: PropType<RequestData>;
|
|
827
|
+
default: () => {};
|
|
828
|
+
};
|
|
829
|
+
external: {
|
|
830
|
+
type: BooleanConstructor;
|
|
831
|
+
default: boolean;
|
|
832
|
+
};
|
|
833
|
+
disabled: {
|
|
834
|
+
type: BooleanConstructor;
|
|
835
|
+
default: boolean;
|
|
836
|
+
};
|
|
837
|
+
options: {
|
|
838
|
+
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
839
|
+
default: () => {};
|
|
840
|
+
};
|
|
841
|
+
text: {
|
|
842
|
+
type: StringConstructor;
|
|
843
|
+
required: false;
|
|
844
|
+
default: undefined;
|
|
845
|
+
};
|
|
846
|
+
preload: {
|
|
847
|
+
type: PropType<boolean | "hover" | "mount">;
|
|
848
|
+
default: boolean;
|
|
849
|
+
};
|
|
850
|
+
preserveScroll: {
|
|
851
|
+
type: BooleanConstructor;
|
|
852
|
+
default: undefined;
|
|
853
|
+
};
|
|
854
|
+
preserveState: {
|
|
855
|
+
type: BooleanConstructor;
|
|
856
|
+
default: undefined;
|
|
857
|
+
};
|
|
858
|
+
}, (props: _vue_shared.LooseRequired<{
|
|
859
|
+
readonly data: RequestData;
|
|
860
|
+
readonly method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
861
|
+
readonly options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
862
|
+
readonly as: string | Record<string, any>;
|
|
863
|
+
readonly external: boolean;
|
|
864
|
+
readonly disabled: boolean;
|
|
865
|
+
readonly preload: boolean | "hover" | "mount";
|
|
866
|
+
readonly text?: string | undefined;
|
|
867
|
+
readonly preserveScroll?: boolean | undefined;
|
|
868
|
+
readonly preserveState?: boolean | undefined;
|
|
869
|
+
readonly href?: string | undefined;
|
|
870
|
+
} & {}>) => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
871
|
+
[key: string]: any;
|
|
872
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
873
|
+
href: {
|
|
874
|
+
type: StringConstructor;
|
|
875
|
+
required: false;
|
|
876
|
+
default: undefined;
|
|
877
|
+
};
|
|
878
|
+
as: {
|
|
879
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
880
|
+
default: string;
|
|
881
|
+
};
|
|
882
|
+
method: {
|
|
883
|
+
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
884
|
+
default: string;
|
|
885
|
+
};
|
|
886
|
+
data: {
|
|
887
|
+
type: PropType<RequestData>;
|
|
888
|
+
default: () => {};
|
|
889
|
+
};
|
|
890
|
+
external: {
|
|
891
|
+
type: BooleanConstructor;
|
|
892
|
+
default: boolean;
|
|
893
|
+
};
|
|
894
|
+
disabled: {
|
|
895
|
+
type: BooleanConstructor;
|
|
896
|
+
default: boolean;
|
|
897
|
+
};
|
|
898
|
+
options: {
|
|
899
|
+
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
900
|
+
default: () => {};
|
|
901
|
+
};
|
|
902
|
+
text: {
|
|
903
|
+
type: StringConstructor;
|
|
904
|
+
required: false;
|
|
905
|
+
default: undefined;
|
|
906
|
+
};
|
|
907
|
+
preload: {
|
|
908
|
+
type: PropType<boolean | "hover" | "mount">;
|
|
909
|
+
default: boolean;
|
|
910
|
+
};
|
|
911
|
+
preserveScroll: {
|
|
912
|
+
type: BooleanConstructor;
|
|
913
|
+
default: undefined;
|
|
914
|
+
};
|
|
915
|
+
preserveState: {
|
|
916
|
+
type: BooleanConstructor;
|
|
917
|
+
default: undefined;
|
|
918
|
+
};
|
|
919
|
+
}>>, {
|
|
920
|
+
data: RequestData;
|
|
921
|
+
text: string;
|
|
922
|
+
preserveScroll: boolean;
|
|
923
|
+
preserveState: boolean;
|
|
924
|
+
method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
925
|
+
href: string;
|
|
926
|
+
options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
927
|
+
as: string | Record<string, any>;
|
|
928
|
+
external: boolean;
|
|
929
|
+
disabled: boolean;
|
|
930
|
+
preload: boolean | "hover" | "mount";
|
|
931
|
+
}, {}>;
|
|
932
|
+
|
|
933
|
+
export { type Action, type AvailableHybridRequestOptions, type BindFilterOptions, type BulkAction, type BulkSelection, type Column, type DefaultFormOptions, type InitializeOptions, type InlineAction, type RecordIdentifier, RouterLink, type SortDirection, type ToggleSortOptions, initializeHybridly, registerHook, setProperty, useBackForward, useBulkSelect, useDialog, useForm, useHistoryState, useProperties, useProperty, useQueryParameters, useRefinements, useRoute, useTable };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { App, Plugin as Plugin$1, h, PropType
|
|
2
|
+
import { ComputedRef, DeepReadonly, Ref, MaybeRefOrGetter, App, Plugin as Plugin$1, h, PropType } from 'vue';
|
|
3
3
|
import * as _hybridly_core from '@hybridly/core';
|
|
4
|
-
import {
|
|
4
|
+
import { HybridRequestOptions, UrlResolvable, RouterContext, registerHook as registerHook$1, RouteParameters, RouterContextOptions, Plugin, Method } from '@hybridly/core';
|
|
5
5
|
export { can, route, router } from '@hybridly/core';
|
|
6
6
|
import { Axios } from 'axios';
|
|
7
|
-
import * as _vue_shared from '@vue/shared';
|
|
8
|
-
import { RequestData, FormDataConvertible } from '@hybridly/utils';
|
|
9
7
|
import { SearchableObject, Path, PathValue } from '@clickbar/dot-diver';
|
|
8
|
+
import { FormDataConvertible, RequestData } from '@hybridly/utils';
|
|
9
|
+
import * as _vue_shared from '@vue/shared';
|
|
10
10
|
|
|
11
11
|
interface ProgressOptions {
|
|
12
12
|
/**
|
|
@@ -36,176 +36,6 @@ interface ProgressOptions {
|
|
|
36
36
|
spinner: boolean;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* Initializes Hybridly's router and context.
|
|
41
|
-
*/
|
|
42
|
-
declare function initializeHybridly(options?: InitializeOptions): Promise<any>;
|
|
43
|
-
interface InitializeOptions {
|
|
44
|
-
/** Callback that gets executed before Vue is mounted. */
|
|
45
|
-
enhanceVue?: (vue: App<Element>) => any;
|
|
46
|
-
/** ID of the app element. */
|
|
47
|
-
id?: string;
|
|
48
|
-
/** Clean up the host element's payload dataset after loading. */
|
|
49
|
-
cleanup?: boolean;
|
|
50
|
-
/** Whether to set up the devtools plugin. */
|
|
51
|
-
devtools?: boolean;
|
|
52
|
-
/** Whether to display response error modals. */
|
|
53
|
-
responseErrorModals?: boolean;
|
|
54
|
-
/** Custom history state serialization functions. */
|
|
55
|
-
serializer?: RouterContextOptions['serializer'];
|
|
56
|
-
/** Progressbar options. */
|
|
57
|
-
progress?: false | Partial<ProgressOptions>;
|
|
58
|
-
/** Sets up the hybridly router. */
|
|
59
|
-
setup?: (options: SetupArguments) => any;
|
|
60
|
-
/** List of Hybridly plugins. */
|
|
61
|
-
plugins?: Plugin[];
|
|
62
|
-
/** Custom Axios instance. */
|
|
63
|
-
axios?: Axios;
|
|
64
|
-
/**
|
|
65
|
-
* Enables the View Transition API, if supported.
|
|
66
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition
|
|
67
|
-
*/
|
|
68
|
-
viewTransition?: boolean;
|
|
69
|
-
}
|
|
70
|
-
interface SetupArguments {
|
|
71
|
-
/** DOM element to mount Vue on. */
|
|
72
|
-
element: Element;
|
|
73
|
-
/** Hybridly wrapper component. */
|
|
74
|
-
wrapper: any;
|
|
75
|
-
/** Hybridly wrapper component properties. */
|
|
76
|
-
props: {
|
|
77
|
-
context: RouterContext;
|
|
78
|
-
};
|
|
79
|
-
/** Vue plugin that registers the devtools. */
|
|
80
|
-
hybridly: Plugin$1;
|
|
81
|
-
/** Renders the wrapper. */
|
|
82
|
-
render: () => ReturnType<typeof h>;
|
|
83
|
-
/** Initial payload. */
|
|
84
|
-
payload: Record<string, any>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare const RouterLink: vue.DefineComponent<{
|
|
88
|
-
href: {
|
|
89
|
-
type: StringConstructor;
|
|
90
|
-
required: false;
|
|
91
|
-
default: undefined;
|
|
92
|
-
};
|
|
93
|
-
as: {
|
|
94
|
-
type: (ObjectConstructor | StringConstructor)[];
|
|
95
|
-
default: string;
|
|
96
|
-
};
|
|
97
|
-
method: {
|
|
98
|
-
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
99
|
-
default: string;
|
|
100
|
-
};
|
|
101
|
-
data: {
|
|
102
|
-
type: PropType<RequestData>;
|
|
103
|
-
default: () => {};
|
|
104
|
-
};
|
|
105
|
-
external: {
|
|
106
|
-
type: BooleanConstructor;
|
|
107
|
-
default: boolean;
|
|
108
|
-
};
|
|
109
|
-
disabled: {
|
|
110
|
-
type: BooleanConstructor;
|
|
111
|
-
default: boolean;
|
|
112
|
-
};
|
|
113
|
-
options: {
|
|
114
|
-
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
115
|
-
default: () => {};
|
|
116
|
-
};
|
|
117
|
-
text: {
|
|
118
|
-
type: StringConstructor;
|
|
119
|
-
required: false;
|
|
120
|
-
default: undefined;
|
|
121
|
-
};
|
|
122
|
-
preload: {
|
|
123
|
-
type: PropType<boolean | "hover" | "mount">;
|
|
124
|
-
default: boolean;
|
|
125
|
-
};
|
|
126
|
-
preserveScroll: {
|
|
127
|
-
type: BooleanConstructor;
|
|
128
|
-
default: undefined;
|
|
129
|
-
};
|
|
130
|
-
preserveState: {
|
|
131
|
-
type: BooleanConstructor;
|
|
132
|
-
default: undefined;
|
|
133
|
-
};
|
|
134
|
-
}, (props: _vue_shared.LooseRequired<{
|
|
135
|
-
readonly data: RequestData;
|
|
136
|
-
readonly method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
137
|
-
readonly options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
138
|
-
readonly as: string | Record<string, any>;
|
|
139
|
-
readonly external: boolean;
|
|
140
|
-
readonly disabled: boolean;
|
|
141
|
-
readonly preload: boolean | "hover" | "mount";
|
|
142
|
-
readonly text?: string | undefined;
|
|
143
|
-
readonly preserveScroll?: boolean | undefined;
|
|
144
|
-
readonly preserveState?: boolean | undefined;
|
|
145
|
-
readonly href?: string | undefined;
|
|
146
|
-
} & {}>) => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
147
|
-
[key: string]: any;
|
|
148
|
-
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
149
|
-
href: {
|
|
150
|
-
type: StringConstructor;
|
|
151
|
-
required: false;
|
|
152
|
-
default: undefined;
|
|
153
|
-
};
|
|
154
|
-
as: {
|
|
155
|
-
type: (ObjectConstructor | StringConstructor)[];
|
|
156
|
-
default: string;
|
|
157
|
-
};
|
|
158
|
-
method: {
|
|
159
|
-
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
160
|
-
default: string;
|
|
161
|
-
};
|
|
162
|
-
data: {
|
|
163
|
-
type: PropType<RequestData>;
|
|
164
|
-
default: () => {};
|
|
165
|
-
};
|
|
166
|
-
external: {
|
|
167
|
-
type: BooleanConstructor;
|
|
168
|
-
default: boolean;
|
|
169
|
-
};
|
|
170
|
-
disabled: {
|
|
171
|
-
type: BooleanConstructor;
|
|
172
|
-
default: boolean;
|
|
173
|
-
};
|
|
174
|
-
options: {
|
|
175
|
-
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
176
|
-
default: () => {};
|
|
177
|
-
};
|
|
178
|
-
text: {
|
|
179
|
-
type: StringConstructor;
|
|
180
|
-
required: false;
|
|
181
|
-
default: undefined;
|
|
182
|
-
};
|
|
183
|
-
preload: {
|
|
184
|
-
type: PropType<boolean | "hover" | "mount">;
|
|
185
|
-
default: boolean;
|
|
186
|
-
};
|
|
187
|
-
preserveScroll: {
|
|
188
|
-
type: BooleanConstructor;
|
|
189
|
-
default: undefined;
|
|
190
|
-
};
|
|
191
|
-
preserveState: {
|
|
192
|
-
type: BooleanConstructor;
|
|
193
|
-
default: undefined;
|
|
194
|
-
};
|
|
195
|
-
}>>, {
|
|
196
|
-
data: RequestData;
|
|
197
|
-
text: string;
|
|
198
|
-
preserveScroll: boolean;
|
|
199
|
-
preserveState: boolean;
|
|
200
|
-
method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
201
|
-
href: string;
|
|
202
|
-
options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
203
|
-
as: string | Record<string, any>;
|
|
204
|
-
external: boolean;
|
|
205
|
-
disabled: boolean;
|
|
206
|
-
preload: boolean | "hover" | "mount";
|
|
207
|
-
}, {}>;
|
|
208
|
-
|
|
209
39
|
/** Accesses all current properties. */
|
|
210
40
|
declare function useProperties<T extends object, Global extends GlobalHybridlyProperties = GlobalHybridlyProperties>(): vue.DeepReadonly<vue.UnwrapNestedRefs<T & Global>>;
|
|
211
41
|
/** Accesses a property with a dot notation. */
|
|
@@ -219,6 +49,7 @@ declare function setProperty<Override = never, T extends SearchableObject = Glob
|
|
|
219
49
|
type Errors<T extends SearchableObject> = {
|
|
220
50
|
[K in keyof T]?: T[K] extends Record<string, any> ? Errors<T[K]> : string;
|
|
221
51
|
};
|
|
52
|
+
type DefaultFormOptions = Pick<FormOptions<object>, 'timeout' | 'reset' | 'updateInitials' | 'progress' | 'preserveScroll' | 'preserveState' | 'preserveUrl' | 'headers' | 'errorBag' | 'spoof' | 'transformUrl' | 'updateHistoryState' | 'useFormData'>;
|
|
222
53
|
interface FormOptions<T extends SearchableObject> extends Omit<HybridRequestOptions, 'data' | 'url'> {
|
|
223
54
|
fields: T;
|
|
224
55
|
url?: UrlResolvable | (() => UrlResolvable);
|
|
@@ -927,4 +758,176 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
|
|
|
927
758
|
*/
|
|
928
759
|
declare function useQueryParameters<T extends Record<string, any> = Record<string, any>>(): T;
|
|
929
760
|
|
|
930
|
-
|
|
761
|
+
/**
|
|
762
|
+
* Initializes Hybridly's router and context.
|
|
763
|
+
*/
|
|
764
|
+
declare function initializeHybridly(options?: InitializeOptions): Promise<any>;
|
|
765
|
+
interface InitializeOptions {
|
|
766
|
+
/** Callback that gets executed before Vue is mounted. */
|
|
767
|
+
enhanceVue?: (vue: App<Element>) => any;
|
|
768
|
+
/** ID of the app element. */
|
|
769
|
+
id?: string;
|
|
770
|
+
/** Clean up the host element's payload dataset after loading. */
|
|
771
|
+
cleanup?: boolean;
|
|
772
|
+
/** Whether to set up the devtools plugin. */
|
|
773
|
+
devtools?: boolean;
|
|
774
|
+
/** Whether to display response error modals. */
|
|
775
|
+
responseErrorModals?: boolean;
|
|
776
|
+
/** Custom history state serialization functions. */
|
|
777
|
+
serializer?: RouterContextOptions['serializer'];
|
|
778
|
+
/** Progressbar options. */
|
|
779
|
+
progress?: false | Partial<ProgressOptions>;
|
|
780
|
+
/** Sets up the hybridly router. */
|
|
781
|
+
setup?: (options: SetupArguments) => any;
|
|
782
|
+
/** List of Hybridly plugins. */
|
|
783
|
+
plugins?: Plugin[];
|
|
784
|
+
/** Custom Axios instance. */
|
|
785
|
+
axios?: Axios;
|
|
786
|
+
/**
|
|
787
|
+
* Enables the View Transition API, if supported.
|
|
788
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition
|
|
789
|
+
*/
|
|
790
|
+
viewTransition?: boolean;
|
|
791
|
+
/** Options that will apply to all forms by default. Specific forms' options will override them. */
|
|
792
|
+
defaultFormOptions?: DefaultFormOptions;
|
|
793
|
+
}
|
|
794
|
+
interface SetupArguments {
|
|
795
|
+
/** DOM element to mount Vue on. */
|
|
796
|
+
element: Element;
|
|
797
|
+
/** Hybridly wrapper component. */
|
|
798
|
+
wrapper: any;
|
|
799
|
+
/** Hybridly wrapper component properties. */
|
|
800
|
+
props: {
|
|
801
|
+
context: RouterContext;
|
|
802
|
+
};
|
|
803
|
+
/** Vue plugin that registers the devtools. */
|
|
804
|
+
hybridly: Plugin$1;
|
|
805
|
+
/** Renders the wrapper. */
|
|
806
|
+
render: () => ReturnType<typeof h>;
|
|
807
|
+
/** Initial payload. */
|
|
808
|
+
payload: Record<string, any>;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
declare const RouterLink: vue.DefineComponent<{
|
|
812
|
+
href: {
|
|
813
|
+
type: StringConstructor;
|
|
814
|
+
required: false;
|
|
815
|
+
default: undefined;
|
|
816
|
+
};
|
|
817
|
+
as: {
|
|
818
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
819
|
+
default: string;
|
|
820
|
+
};
|
|
821
|
+
method: {
|
|
822
|
+
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
823
|
+
default: string;
|
|
824
|
+
};
|
|
825
|
+
data: {
|
|
826
|
+
type: PropType<RequestData>;
|
|
827
|
+
default: () => {};
|
|
828
|
+
};
|
|
829
|
+
external: {
|
|
830
|
+
type: BooleanConstructor;
|
|
831
|
+
default: boolean;
|
|
832
|
+
};
|
|
833
|
+
disabled: {
|
|
834
|
+
type: BooleanConstructor;
|
|
835
|
+
default: boolean;
|
|
836
|
+
};
|
|
837
|
+
options: {
|
|
838
|
+
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
839
|
+
default: () => {};
|
|
840
|
+
};
|
|
841
|
+
text: {
|
|
842
|
+
type: StringConstructor;
|
|
843
|
+
required: false;
|
|
844
|
+
default: undefined;
|
|
845
|
+
};
|
|
846
|
+
preload: {
|
|
847
|
+
type: PropType<boolean | "hover" | "mount">;
|
|
848
|
+
default: boolean;
|
|
849
|
+
};
|
|
850
|
+
preserveScroll: {
|
|
851
|
+
type: BooleanConstructor;
|
|
852
|
+
default: undefined;
|
|
853
|
+
};
|
|
854
|
+
preserveState: {
|
|
855
|
+
type: BooleanConstructor;
|
|
856
|
+
default: undefined;
|
|
857
|
+
};
|
|
858
|
+
}, (props: _vue_shared.LooseRequired<{
|
|
859
|
+
readonly data: RequestData;
|
|
860
|
+
readonly method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
861
|
+
readonly options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
862
|
+
readonly as: string | Record<string, any>;
|
|
863
|
+
readonly external: boolean;
|
|
864
|
+
readonly disabled: boolean;
|
|
865
|
+
readonly preload: boolean | "hover" | "mount";
|
|
866
|
+
readonly text?: string | undefined;
|
|
867
|
+
readonly preserveScroll?: boolean | undefined;
|
|
868
|
+
readonly preserveState?: boolean | undefined;
|
|
869
|
+
readonly href?: string | undefined;
|
|
870
|
+
} & {}>) => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
871
|
+
[key: string]: any;
|
|
872
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
873
|
+
href: {
|
|
874
|
+
type: StringConstructor;
|
|
875
|
+
required: false;
|
|
876
|
+
default: undefined;
|
|
877
|
+
};
|
|
878
|
+
as: {
|
|
879
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
880
|
+
default: string;
|
|
881
|
+
};
|
|
882
|
+
method: {
|
|
883
|
+
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
884
|
+
default: string;
|
|
885
|
+
};
|
|
886
|
+
data: {
|
|
887
|
+
type: PropType<RequestData>;
|
|
888
|
+
default: () => {};
|
|
889
|
+
};
|
|
890
|
+
external: {
|
|
891
|
+
type: BooleanConstructor;
|
|
892
|
+
default: boolean;
|
|
893
|
+
};
|
|
894
|
+
disabled: {
|
|
895
|
+
type: BooleanConstructor;
|
|
896
|
+
default: boolean;
|
|
897
|
+
};
|
|
898
|
+
options: {
|
|
899
|
+
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
900
|
+
default: () => {};
|
|
901
|
+
};
|
|
902
|
+
text: {
|
|
903
|
+
type: StringConstructor;
|
|
904
|
+
required: false;
|
|
905
|
+
default: undefined;
|
|
906
|
+
};
|
|
907
|
+
preload: {
|
|
908
|
+
type: PropType<boolean | "hover" | "mount">;
|
|
909
|
+
default: boolean;
|
|
910
|
+
};
|
|
911
|
+
preserveScroll: {
|
|
912
|
+
type: BooleanConstructor;
|
|
913
|
+
default: undefined;
|
|
914
|
+
};
|
|
915
|
+
preserveState: {
|
|
916
|
+
type: BooleanConstructor;
|
|
917
|
+
default: undefined;
|
|
918
|
+
};
|
|
919
|
+
}>>, {
|
|
920
|
+
data: RequestData;
|
|
921
|
+
text: string;
|
|
922
|
+
preserveScroll: boolean;
|
|
923
|
+
preserveState: boolean;
|
|
924
|
+
method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
925
|
+
href: string;
|
|
926
|
+
options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
927
|
+
as: string | Record<string, any>;
|
|
928
|
+
external: boolean;
|
|
929
|
+
disabled: boolean;
|
|
930
|
+
preload: boolean | "hover" | "mount";
|
|
931
|
+
}, {}>;
|
|
932
|
+
|
|
933
|
+
export { type Action, type AvailableHybridRequestOptions, type BindFilterOptions, type BulkAction, type BulkSelection, type Column, type DefaultFormOptions, type InitializeOptions, type InlineAction, type RecordIdentifier, RouterLink, type SortDirection, type ToggleSortOptions, initializeHybridly, registerHook, setProperty, useBackForward, useBulkSelect, useDialog, useForm, useHistoryState, useProperties, useProperty, useQueryParameters, useRefinements, useRoute, useTable };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
-
import { App, Plugin as Plugin$1, h, PropType
|
|
2
|
+
import { ComputedRef, DeepReadonly, Ref, MaybeRefOrGetter, App, Plugin as Plugin$1, h, PropType } from 'vue';
|
|
3
3
|
import * as _hybridly_core from '@hybridly/core';
|
|
4
|
-
import {
|
|
4
|
+
import { HybridRequestOptions, UrlResolvable, RouterContext, registerHook as registerHook$1, RouteParameters, RouterContextOptions, Plugin, Method } from '@hybridly/core';
|
|
5
5
|
export { can, route, router } from '@hybridly/core';
|
|
6
6
|
import { Axios } from 'axios';
|
|
7
|
-
import * as _vue_shared from '@vue/shared';
|
|
8
|
-
import { RequestData, FormDataConvertible } from '@hybridly/utils';
|
|
9
7
|
import { SearchableObject, Path, PathValue } from '@clickbar/dot-diver';
|
|
8
|
+
import { FormDataConvertible, RequestData } from '@hybridly/utils';
|
|
9
|
+
import * as _vue_shared from '@vue/shared';
|
|
10
10
|
|
|
11
11
|
interface ProgressOptions {
|
|
12
12
|
/**
|
|
@@ -36,176 +36,6 @@ interface ProgressOptions {
|
|
|
36
36
|
spinner: boolean;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* Initializes Hybridly's router and context.
|
|
41
|
-
*/
|
|
42
|
-
declare function initializeHybridly(options?: InitializeOptions): Promise<any>;
|
|
43
|
-
interface InitializeOptions {
|
|
44
|
-
/** Callback that gets executed before Vue is mounted. */
|
|
45
|
-
enhanceVue?: (vue: App<Element>) => any;
|
|
46
|
-
/** ID of the app element. */
|
|
47
|
-
id?: string;
|
|
48
|
-
/** Clean up the host element's payload dataset after loading. */
|
|
49
|
-
cleanup?: boolean;
|
|
50
|
-
/** Whether to set up the devtools plugin. */
|
|
51
|
-
devtools?: boolean;
|
|
52
|
-
/** Whether to display response error modals. */
|
|
53
|
-
responseErrorModals?: boolean;
|
|
54
|
-
/** Custom history state serialization functions. */
|
|
55
|
-
serializer?: RouterContextOptions['serializer'];
|
|
56
|
-
/** Progressbar options. */
|
|
57
|
-
progress?: false | Partial<ProgressOptions>;
|
|
58
|
-
/** Sets up the hybridly router. */
|
|
59
|
-
setup?: (options: SetupArguments) => any;
|
|
60
|
-
/** List of Hybridly plugins. */
|
|
61
|
-
plugins?: Plugin[];
|
|
62
|
-
/** Custom Axios instance. */
|
|
63
|
-
axios?: Axios;
|
|
64
|
-
/**
|
|
65
|
-
* Enables the View Transition API, if supported.
|
|
66
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition
|
|
67
|
-
*/
|
|
68
|
-
viewTransition?: boolean;
|
|
69
|
-
}
|
|
70
|
-
interface SetupArguments {
|
|
71
|
-
/** DOM element to mount Vue on. */
|
|
72
|
-
element: Element;
|
|
73
|
-
/** Hybridly wrapper component. */
|
|
74
|
-
wrapper: any;
|
|
75
|
-
/** Hybridly wrapper component properties. */
|
|
76
|
-
props: {
|
|
77
|
-
context: RouterContext;
|
|
78
|
-
};
|
|
79
|
-
/** Vue plugin that registers the devtools. */
|
|
80
|
-
hybridly: Plugin$1;
|
|
81
|
-
/** Renders the wrapper. */
|
|
82
|
-
render: () => ReturnType<typeof h>;
|
|
83
|
-
/** Initial payload. */
|
|
84
|
-
payload: Record<string, any>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare const RouterLink: vue.DefineComponent<{
|
|
88
|
-
href: {
|
|
89
|
-
type: StringConstructor;
|
|
90
|
-
required: false;
|
|
91
|
-
default: undefined;
|
|
92
|
-
};
|
|
93
|
-
as: {
|
|
94
|
-
type: (ObjectConstructor | StringConstructor)[];
|
|
95
|
-
default: string;
|
|
96
|
-
};
|
|
97
|
-
method: {
|
|
98
|
-
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
99
|
-
default: string;
|
|
100
|
-
};
|
|
101
|
-
data: {
|
|
102
|
-
type: PropType<RequestData>;
|
|
103
|
-
default: () => {};
|
|
104
|
-
};
|
|
105
|
-
external: {
|
|
106
|
-
type: BooleanConstructor;
|
|
107
|
-
default: boolean;
|
|
108
|
-
};
|
|
109
|
-
disabled: {
|
|
110
|
-
type: BooleanConstructor;
|
|
111
|
-
default: boolean;
|
|
112
|
-
};
|
|
113
|
-
options: {
|
|
114
|
-
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
115
|
-
default: () => {};
|
|
116
|
-
};
|
|
117
|
-
text: {
|
|
118
|
-
type: StringConstructor;
|
|
119
|
-
required: false;
|
|
120
|
-
default: undefined;
|
|
121
|
-
};
|
|
122
|
-
preload: {
|
|
123
|
-
type: PropType<boolean | "hover" | "mount">;
|
|
124
|
-
default: boolean;
|
|
125
|
-
};
|
|
126
|
-
preserveScroll: {
|
|
127
|
-
type: BooleanConstructor;
|
|
128
|
-
default: undefined;
|
|
129
|
-
};
|
|
130
|
-
preserveState: {
|
|
131
|
-
type: BooleanConstructor;
|
|
132
|
-
default: undefined;
|
|
133
|
-
};
|
|
134
|
-
}, (props: _vue_shared.LooseRequired<{
|
|
135
|
-
readonly data: RequestData;
|
|
136
|
-
readonly method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
137
|
-
readonly options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
138
|
-
readonly as: string | Record<string, any>;
|
|
139
|
-
readonly external: boolean;
|
|
140
|
-
readonly disabled: boolean;
|
|
141
|
-
readonly preload: boolean | "hover" | "mount";
|
|
142
|
-
readonly text?: string | undefined;
|
|
143
|
-
readonly preserveScroll?: boolean | undefined;
|
|
144
|
-
readonly preserveState?: boolean | undefined;
|
|
145
|
-
readonly href?: string | undefined;
|
|
146
|
-
} & {}>) => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
147
|
-
[key: string]: any;
|
|
148
|
-
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
149
|
-
href: {
|
|
150
|
-
type: StringConstructor;
|
|
151
|
-
required: false;
|
|
152
|
-
default: undefined;
|
|
153
|
-
};
|
|
154
|
-
as: {
|
|
155
|
-
type: (ObjectConstructor | StringConstructor)[];
|
|
156
|
-
default: string;
|
|
157
|
-
};
|
|
158
|
-
method: {
|
|
159
|
-
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
160
|
-
default: string;
|
|
161
|
-
};
|
|
162
|
-
data: {
|
|
163
|
-
type: PropType<RequestData>;
|
|
164
|
-
default: () => {};
|
|
165
|
-
};
|
|
166
|
-
external: {
|
|
167
|
-
type: BooleanConstructor;
|
|
168
|
-
default: boolean;
|
|
169
|
-
};
|
|
170
|
-
disabled: {
|
|
171
|
-
type: BooleanConstructor;
|
|
172
|
-
default: boolean;
|
|
173
|
-
};
|
|
174
|
-
options: {
|
|
175
|
-
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
176
|
-
default: () => {};
|
|
177
|
-
};
|
|
178
|
-
text: {
|
|
179
|
-
type: StringConstructor;
|
|
180
|
-
required: false;
|
|
181
|
-
default: undefined;
|
|
182
|
-
};
|
|
183
|
-
preload: {
|
|
184
|
-
type: PropType<boolean | "hover" | "mount">;
|
|
185
|
-
default: boolean;
|
|
186
|
-
};
|
|
187
|
-
preserveScroll: {
|
|
188
|
-
type: BooleanConstructor;
|
|
189
|
-
default: undefined;
|
|
190
|
-
};
|
|
191
|
-
preserveState: {
|
|
192
|
-
type: BooleanConstructor;
|
|
193
|
-
default: undefined;
|
|
194
|
-
};
|
|
195
|
-
}>>, {
|
|
196
|
-
data: RequestData;
|
|
197
|
-
text: string;
|
|
198
|
-
preserveScroll: boolean;
|
|
199
|
-
preserveState: boolean;
|
|
200
|
-
method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
201
|
-
href: string;
|
|
202
|
-
options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
203
|
-
as: string | Record<string, any>;
|
|
204
|
-
external: boolean;
|
|
205
|
-
disabled: boolean;
|
|
206
|
-
preload: boolean | "hover" | "mount";
|
|
207
|
-
}, {}>;
|
|
208
|
-
|
|
209
39
|
/** Accesses all current properties. */
|
|
210
40
|
declare function useProperties<T extends object, Global extends GlobalHybridlyProperties = GlobalHybridlyProperties>(): vue.DeepReadonly<vue.UnwrapNestedRefs<T & Global>>;
|
|
211
41
|
/** Accesses a property with a dot notation. */
|
|
@@ -219,6 +49,7 @@ declare function setProperty<Override = never, T extends SearchableObject = Glob
|
|
|
219
49
|
type Errors<T extends SearchableObject> = {
|
|
220
50
|
[K in keyof T]?: T[K] extends Record<string, any> ? Errors<T[K]> : string;
|
|
221
51
|
};
|
|
52
|
+
type DefaultFormOptions = Pick<FormOptions<object>, 'timeout' | 'reset' | 'updateInitials' | 'progress' | 'preserveScroll' | 'preserveState' | 'preserveUrl' | 'headers' | 'errorBag' | 'spoof' | 'transformUrl' | 'updateHistoryState' | 'useFormData'>;
|
|
222
53
|
interface FormOptions<T extends SearchableObject> extends Omit<HybridRequestOptions, 'data' | 'url'> {
|
|
223
54
|
fields: T;
|
|
224
55
|
url?: UrlResolvable | (() => UrlResolvable);
|
|
@@ -927,4 +758,176 @@ declare function useTable<RecordType extends (Props[PropsKey] extends Table<infe
|
|
|
927
758
|
*/
|
|
928
759
|
declare function useQueryParameters<T extends Record<string, any> = Record<string, any>>(): T;
|
|
929
760
|
|
|
930
|
-
|
|
761
|
+
/**
|
|
762
|
+
* Initializes Hybridly's router and context.
|
|
763
|
+
*/
|
|
764
|
+
declare function initializeHybridly(options?: InitializeOptions): Promise<any>;
|
|
765
|
+
interface InitializeOptions {
|
|
766
|
+
/** Callback that gets executed before Vue is mounted. */
|
|
767
|
+
enhanceVue?: (vue: App<Element>) => any;
|
|
768
|
+
/** ID of the app element. */
|
|
769
|
+
id?: string;
|
|
770
|
+
/** Clean up the host element's payload dataset after loading. */
|
|
771
|
+
cleanup?: boolean;
|
|
772
|
+
/** Whether to set up the devtools plugin. */
|
|
773
|
+
devtools?: boolean;
|
|
774
|
+
/** Whether to display response error modals. */
|
|
775
|
+
responseErrorModals?: boolean;
|
|
776
|
+
/** Custom history state serialization functions. */
|
|
777
|
+
serializer?: RouterContextOptions['serializer'];
|
|
778
|
+
/** Progressbar options. */
|
|
779
|
+
progress?: false | Partial<ProgressOptions>;
|
|
780
|
+
/** Sets up the hybridly router. */
|
|
781
|
+
setup?: (options: SetupArguments) => any;
|
|
782
|
+
/** List of Hybridly plugins. */
|
|
783
|
+
plugins?: Plugin[];
|
|
784
|
+
/** Custom Axios instance. */
|
|
785
|
+
axios?: Axios;
|
|
786
|
+
/**
|
|
787
|
+
* Enables the View Transition API, if supported.
|
|
788
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition
|
|
789
|
+
*/
|
|
790
|
+
viewTransition?: boolean;
|
|
791
|
+
/** Options that will apply to all forms by default. Specific forms' options will override them. */
|
|
792
|
+
defaultFormOptions?: DefaultFormOptions;
|
|
793
|
+
}
|
|
794
|
+
interface SetupArguments {
|
|
795
|
+
/** DOM element to mount Vue on. */
|
|
796
|
+
element: Element;
|
|
797
|
+
/** Hybridly wrapper component. */
|
|
798
|
+
wrapper: any;
|
|
799
|
+
/** Hybridly wrapper component properties. */
|
|
800
|
+
props: {
|
|
801
|
+
context: RouterContext;
|
|
802
|
+
};
|
|
803
|
+
/** Vue plugin that registers the devtools. */
|
|
804
|
+
hybridly: Plugin$1;
|
|
805
|
+
/** Renders the wrapper. */
|
|
806
|
+
render: () => ReturnType<typeof h>;
|
|
807
|
+
/** Initial payload. */
|
|
808
|
+
payload: Record<string, any>;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
declare const RouterLink: vue.DefineComponent<{
|
|
812
|
+
href: {
|
|
813
|
+
type: StringConstructor;
|
|
814
|
+
required: false;
|
|
815
|
+
default: undefined;
|
|
816
|
+
};
|
|
817
|
+
as: {
|
|
818
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
819
|
+
default: string;
|
|
820
|
+
};
|
|
821
|
+
method: {
|
|
822
|
+
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
823
|
+
default: string;
|
|
824
|
+
};
|
|
825
|
+
data: {
|
|
826
|
+
type: PropType<RequestData>;
|
|
827
|
+
default: () => {};
|
|
828
|
+
};
|
|
829
|
+
external: {
|
|
830
|
+
type: BooleanConstructor;
|
|
831
|
+
default: boolean;
|
|
832
|
+
};
|
|
833
|
+
disabled: {
|
|
834
|
+
type: BooleanConstructor;
|
|
835
|
+
default: boolean;
|
|
836
|
+
};
|
|
837
|
+
options: {
|
|
838
|
+
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
839
|
+
default: () => {};
|
|
840
|
+
};
|
|
841
|
+
text: {
|
|
842
|
+
type: StringConstructor;
|
|
843
|
+
required: false;
|
|
844
|
+
default: undefined;
|
|
845
|
+
};
|
|
846
|
+
preload: {
|
|
847
|
+
type: PropType<boolean | "hover" | "mount">;
|
|
848
|
+
default: boolean;
|
|
849
|
+
};
|
|
850
|
+
preserveScroll: {
|
|
851
|
+
type: BooleanConstructor;
|
|
852
|
+
default: undefined;
|
|
853
|
+
};
|
|
854
|
+
preserveState: {
|
|
855
|
+
type: BooleanConstructor;
|
|
856
|
+
default: undefined;
|
|
857
|
+
};
|
|
858
|
+
}, (props: _vue_shared.LooseRequired<{
|
|
859
|
+
readonly data: RequestData;
|
|
860
|
+
readonly method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
861
|
+
readonly options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
862
|
+
readonly as: string | Record<string, any>;
|
|
863
|
+
readonly external: boolean;
|
|
864
|
+
readonly disabled: boolean;
|
|
865
|
+
readonly preload: boolean | "hover" | "mount";
|
|
866
|
+
readonly text?: string | undefined;
|
|
867
|
+
readonly preserveScroll?: boolean | undefined;
|
|
868
|
+
readonly preserveState?: boolean | undefined;
|
|
869
|
+
readonly href?: string | undefined;
|
|
870
|
+
} & {}>) => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
871
|
+
[key: string]: any;
|
|
872
|
+
}>, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
873
|
+
href: {
|
|
874
|
+
type: StringConstructor;
|
|
875
|
+
required: false;
|
|
876
|
+
default: undefined;
|
|
877
|
+
};
|
|
878
|
+
as: {
|
|
879
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
880
|
+
default: string;
|
|
881
|
+
};
|
|
882
|
+
method: {
|
|
883
|
+
type: PropType<"delete" | Method | "get" | "post" | "put" | "patch">;
|
|
884
|
+
default: string;
|
|
885
|
+
};
|
|
886
|
+
data: {
|
|
887
|
+
type: PropType<RequestData>;
|
|
888
|
+
default: () => {};
|
|
889
|
+
};
|
|
890
|
+
external: {
|
|
891
|
+
type: BooleanConstructor;
|
|
892
|
+
default: boolean;
|
|
893
|
+
};
|
|
894
|
+
disabled: {
|
|
895
|
+
type: BooleanConstructor;
|
|
896
|
+
default: boolean;
|
|
897
|
+
};
|
|
898
|
+
options: {
|
|
899
|
+
type: PropType<Omit<HybridRequestOptions, "data" | "url" | "method">>;
|
|
900
|
+
default: () => {};
|
|
901
|
+
};
|
|
902
|
+
text: {
|
|
903
|
+
type: StringConstructor;
|
|
904
|
+
required: false;
|
|
905
|
+
default: undefined;
|
|
906
|
+
};
|
|
907
|
+
preload: {
|
|
908
|
+
type: PropType<boolean | "hover" | "mount">;
|
|
909
|
+
default: boolean;
|
|
910
|
+
};
|
|
911
|
+
preserveScroll: {
|
|
912
|
+
type: BooleanConstructor;
|
|
913
|
+
default: undefined;
|
|
914
|
+
};
|
|
915
|
+
preserveState: {
|
|
916
|
+
type: BooleanConstructor;
|
|
917
|
+
default: undefined;
|
|
918
|
+
};
|
|
919
|
+
}>>, {
|
|
920
|
+
data: RequestData;
|
|
921
|
+
text: string;
|
|
922
|
+
preserveScroll: boolean;
|
|
923
|
+
preserveState: boolean;
|
|
924
|
+
method: "delete" | Method | "get" | "post" | "put" | "patch";
|
|
925
|
+
href: string;
|
|
926
|
+
options: Omit<HybridRequestOptions, "data" | "url" | "method">;
|
|
927
|
+
as: string | Record<string, any>;
|
|
928
|
+
external: boolean;
|
|
929
|
+
disabled: boolean;
|
|
930
|
+
preload: boolean | "hover" | "mount";
|
|
931
|
+
}, {}>;
|
|
932
|
+
|
|
933
|
+
export { type Action, type AvailableHybridRequestOptions, type BindFilterOptions, type BulkAction, type BulkSelection, type Column, type DefaultFormOptions, type InitializeOptions, type InlineAction, type RecordIdentifier, RouterLink, type SortDirection, type ToggleSortOptions, initializeHybridly, registerHook, setProperty, useBackForward, useBulkSelect, useDialog, useForm, useHistoryState, useProperties, useProperty, useQueryParameters, useRefinements, useRoute, useTable };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { shallowRef, ref, unref, triggerRef, defineComponent, toRaw, h, nextTick, createApp, isRef, reactive, readonly, computed, toValue, watch, getCurrentInstance, onUnmounted } from 'vue';
|
|
2
2
|
import { definePlugin, registerHook as registerHook$1, createRouter, makeUrl, router, route } from '@hybridly/core';
|
|
3
3
|
export { can, route, router } from '@hybridly/core';
|
|
4
|
-
import { debug, random, showViewComponentErrorModal, merge,
|
|
4
|
+
import { debug, clone, random, showViewComponentErrorModal, merge, unsetPropertyAtPath, setValueAtPath } from '@hybridly/utils';
|
|
5
5
|
import nprogress from 'nprogress';
|
|
6
6
|
import { setupDevtoolsPlugin } from '@vue/devtools-api';
|
|
7
7
|
import qs from 'qs';
|
|
@@ -405,6 +405,16 @@ function viewTransition() {
|
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
const formStore = {
|
|
409
|
+
defaultConfig: {},
|
|
410
|
+
setDefaultConfig: (config) => {
|
|
411
|
+
formStore.defaultConfig = config;
|
|
412
|
+
},
|
|
413
|
+
getDefaultConfig: () => {
|
|
414
|
+
return clone(formStore.defaultConfig);
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
|
|
408
418
|
async function initializeHybridly(options = {}) {
|
|
409
419
|
const resolved = options;
|
|
410
420
|
const { element, payload, resolve } = prepare(resolved);
|
|
@@ -496,6 +506,9 @@ function prepare(options) {
|
|
|
496
506
|
if (options.viewTransition !== false) {
|
|
497
507
|
options.plugins.push(viewTransition());
|
|
498
508
|
}
|
|
509
|
+
if (options.defaultFormOptions) {
|
|
510
|
+
formStore.setDefaultConfig(options.defaultFormOptions);
|
|
511
|
+
}
|
|
499
512
|
return {
|
|
500
513
|
isServer,
|
|
501
514
|
element,
|
|
@@ -761,7 +774,8 @@ function useForm(options) {
|
|
|
761
774
|
}
|
|
762
775
|
function submit(optionsOverrides) {
|
|
763
776
|
const { fields: _f, key: _k, ...optionsWithoutFields } = options;
|
|
764
|
-
const
|
|
777
|
+
const resolvedOptions = optionsOverrides ? merge(optionsWithoutFields, optionsOverrides, { mergePlainObjects: true }) : optionsWithoutFields;
|
|
778
|
+
const optionsWithOverrides = merge(formStore.getDefaultConfig(), resolvedOptions, { mergePlainObjects: true });
|
|
765
779
|
const url = typeof optionsWithOverrides.url === "function" ? optionsWithOverrides.url() : optionsWithOverrides.url;
|
|
766
780
|
const data = typeof optionsWithOverrides.transform === "function" ? optionsWithOverrides.transform(fields) : fields;
|
|
767
781
|
const preserveState = optionsWithOverrides.preserveState ?? optionsWithOverrides.method !== "GET";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybridly/vue",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.8",
|
|
4
4
|
"description": "Vue adapter for Hybridly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hybridly",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"lodash.isequal": "^4.5.0",
|
|
50
50
|
"nprogress": "^0.2.0",
|
|
51
51
|
"qs": "^6.12.1",
|
|
52
|
-
"@hybridly/core": "0.7.
|
|
53
|
-
"@hybridly/utils": "0.7.
|
|
52
|
+
"@hybridly/core": "0.7.8",
|
|
53
|
+
"@hybridly/utils": "0.7.8"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/lodash": "^4.17.0",
|