@hybridly/vue 0.10.0-beta.25 → 0.10.0-beta.26
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.d.mts +111 -91
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormDataConvertible, Path, PathValue, RequestData, SearchableObject } from "@hybridly/utils";
|
|
2
2
|
import * as vue from "vue";
|
|
3
3
|
import { App, Component, ComputedRef, DeepReadonly, DefineComponent, MaybeRefOrGetter, Plugin, PropType, Ref, SlotsType, h } from "vue";
|
|
4
|
+
import * as _hybridly_core0 from "@hybridly/core";
|
|
4
5
|
import { Errors, GlobalHybridlyProperties, HttpClient, HybridRequestOptions, Method, NavigationResponse, Plugin as Plugin$1, Progress, RequestMode, RouteName, RouteParameters, RouterContext, RouterContextOptions, UrlResolvable, Validation, registerHook as registerHook$1, route, router } from "@hybridly/core";
|
|
5
6
|
import { Path as Path$1, SearchableObject as SearchableObject$1 } from "@clickbar/dot-diver";
|
|
6
7
|
|
|
@@ -291,7 +292,7 @@ declare const WhenVisible: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
291
292
|
}>> & Readonly<{
|
|
292
293
|
onLoading?: ((_state: LoadStateSlotProps) => any) | undefined;
|
|
293
294
|
}>, {
|
|
294
|
-
options: Omit<HybridRequestOptions, "
|
|
295
|
+
options: Omit<HybridRequestOptions, "method" | "url" | "data">;
|
|
295
296
|
as: string;
|
|
296
297
|
buffer: number;
|
|
297
298
|
root: string | Element | null;
|
|
@@ -1049,19 +1050,17 @@ declare function useRefinements<T extends Refinements>(input: MaybeRefOrGetter<T
|
|
|
1049
1050
|
declare const registerHook: typeof registerHook$1;
|
|
1050
1051
|
//#endregion
|
|
1051
1052
|
//#region src/composables/table.d.ts
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
endpoint: string;
|
|
1064
|
-
}
|
|
1053
|
+
interface Table<T extends Record<string, any> = any, PaginatorKind extends 'cursor' | 'length-aware' | 'simple' = 'length-aware'> {
|
|
1054
|
+
id: string;
|
|
1055
|
+
keyName: string;
|
|
1056
|
+
scope?: string;
|
|
1057
|
+
columns: Column<T>[];
|
|
1058
|
+
inlineActions: InlineAction[];
|
|
1059
|
+
bulkActions: BulkAction[];
|
|
1060
|
+
records: Array<T>;
|
|
1061
|
+
paginator: Omit<PaginatorKind extends 'cursor' ? CursorPaginator<T> : (PaginatorKind extends 'simple' ? SimplePaginator<T> : Paginator<T>), 'data'>;
|
|
1062
|
+
refinements: Refinements;
|
|
1063
|
+
endpoint: string;
|
|
1065
1064
|
}
|
|
1066
1065
|
interface Column<T extends object = never> {
|
|
1067
1066
|
/** The name of this column. */
|
|
@@ -1093,9 +1092,6 @@ interface BulkActionOptions extends Omit<HybridRequestOptions, 'url'> {
|
|
|
1093
1092
|
/** Force deselecting all records after action. */
|
|
1094
1093
|
deselect?: boolean;
|
|
1095
1094
|
}
|
|
1096
|
-
interface InlineActionOptions<T> extends Omit<HybridRequestOptions, 'url'> {
|
|
1097
|
-
record: T;
|
|
1098
|
-
}
|
|
1099
1095
|
interface InlineAction extends Action {}
|
|
1100
1096
|
type RecordIdentifier = string | number;
|
|
1101
1097
|
type AsRecordTypeWithExtra<T extends Record<string, any>> = { [K in keyof T]: {
|
|
@@ -1113,98 +1109,122 @@ interface TableDefaultOptions extends AvailableHybridRequestOptions {
|
|
|
1113
1109
|
*/
|
|
1114
1110
|
data?: Record<string, FormDataConvertible> | FormDataConvertible;
|
|
1115
1111
|
}
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1112
|
+
type UseTableNavigationResponse = Promise<_hybridly_core0.NavigationResponse | undefined>;
|
|
1113
|
+
type ExtractRefValue<T> = T extends {
|
|
1114
|
+
value: infer Value;
|
|
1115
|
+
} ? Value : T;
|
|
1116
|
+
interface UseTableInlineActionItem<RecordType extends Record<string, any>, RecordTypeWithExtra extends Record<string, any>> extends InlineAction {
|
|
1117
|
+
/** Executes the action. */
|
|
1118
|
+
execute: (record: RecordTypeWithExtra | RecordIdentifier | RecordType) => UseTableNavigationResponse;
|
|
1119
|
+
}
|
|
1120
|
+
interface UseTableBulkActionItem extends BulkAction {
|
|
1121
|
+
/** Executes the action. */
|
|
1122
|
+
execute: (options?: BulkActionOptions) => UseTableNavigationResponse;
|
|
1123
|
+
}
|
|
1124
|
+
interface UseTableColumn<RecordTypeWithExtra extends Record<string, any>> extends Column<RecordTypeWithExtra> {
|
|
1125
|
+
/** Toggles sorting for this column. */
|
|
1126
|
+
toggleSort: (options?: ToggleSortOptions) => UseTableNavigationResponse;
|
|
1127
|
+
/** Checks whether the column is being sorted. */
|
|
1128
|
+
isSorting: (direction?: SortDirection) => boolean;
|
|
1129
|
+
/** Applies the filter for this column. */
|
|
1130
|
+
applyFilter: (value: any, options?: AvailableHybridRequestOptions) => UseTableNavigationResponse;
|
|
1131
|
+
/** Clears the filter for this column. */
|
|
1132
|
+
clearFilter: (options?: AvailableHybridRequestOptions) => UseTableNavigationResponse;
|
|
1133
|
+
/** Checks whether the column is sortable. */
|
|
1134
|
+
isSortable: boolean;
|
|
1135
|
+
/** Checks whether the column is filterable. */
|
|
1136
|
+
isFilterable: boolean;
|
|
1137
|
+
}
|
|
1138
|
+
interface UseTableRecordItem<RecordType extends Record<string, any>, RecordTypeWithExtra extends Record<string, any>> {
|
|
1139
|
+
/** The actual record. */
|
|
1140
|
+
record: RecordType;
|
|
1141
|
+
/** The key of the record. Use this instead of `id`. */
|
|
1142
|
+
key: RecordIdentifier;
|
|
1143
|
+
/** Executes the given inline action. */
|
|
1144
|
+
execute: (action: string | InlineAction) => UseTableNavigationResponse;
|
|
1145
|
+
/** Gets the available inline actions. */
|
|
1146
|
+
actions: Array<InlineAction & {
|
|
1147
|
+
execute: () => UseTableNavigationResponse;
|
|
1148
|
+
}>;
|
|
1149
|
+
/** Selects this record. */
|
|
1150
|
+
select: () => void;
|
|
1151
|
+
/** Deselects this record. */
|
|
1152
|
+
deselect: () => void;
|
|
1153
|
+
/** Toggles the selection for this record. */
|
|
1154
|
+
toggle: (force?: boolean) => void;
|
|
1155
|
+
/** Checks whether this record is selected. */
|
|
1156
|
+
selected: boolean;
|
|
1157
|
+
/** Gets the value of the record for the specified column. */
|
|
1158
|
+
value: (column: string | Column<RecordTypeWithExtra>) => any;
|
|
1159
|
+
/** Gets the extra object of the record for the specified column. */
|
|
1160
|
+
extra: (column: string | Column<RecordTypeWithExtra>, path: string) => any;
|
|
1161
|
+
}
|
|
1162
|
+
interface UseTableReturn<T extends Table<any, any>, RecordType extends Record<string, any> = (T extends Table<infer R, any> ? R : any), PaginatorKind extends 'cursor' | 'length-aware' | 'simple' = (T extends Table<any, infer P> ? P : 'length-aware'), RecordTypeWithExtra extends Record<string, any> = AsRecordTypeWithExtra<RecordType>> extends Omit<UseRefinements, 'filters' | 'sorts' | 'filtersKey' | 'sortsKey'> {
|
|
1163
|
+
/** Selects all records. */
|
|
1137
1164
|
selectAll: () => void;
|
|
1165
|
+
/** Deselects all records. */
|
|
1138
1166
|
deselectAll: () => void;
|
|
1167
|
+
/** Selects records on the current page. */
|
|
1139
1168
|
selectPage: () => void;
|
|
1169
|
+
/** Deselects records on the current page. */
|
|
1140
1170
|
deselectPage: () => void;
|
|
1171
|
+
/** Whether all records on the current page are selected. */
|
|
1141
1172
|
isPageSelected: boolean;
|
|
1173
|
+
/** Checks if the given record is selected. */
|
|
1142
1174
|
isSelected: (record: RecordTypeWithExtra | RecordType) => boolean;
|
|
1175
|
+
/** Whether all records are selected. */
|
|
1143
1176
|
allSelected: boolean;
|
|
1177
|
+
/** Whether any records are selected. */
|
|
1144
1178
|
anySelected: boolean;
|
|
1179
|
+
/** The current record selection. */
|
|
1145
1180
|
selection: BulkSelection<RecordIdentifier>;
|
|
1181
|
+
/** Binds a checkbox to its selection state. */
|
|
1146
1182
|
bindCheckbox: (key: RecordIdentifier) => {
|
|
1147
1183
|
onChange: (event: Event) => void;
|
|
1148
1184
|
checked: boolean;
|
|
1149
1185
|
value: RecordIdentifier;
|
|
1150
1186
|
};
|
|
1187
|
+
/** Toggles selection for the given record. */
|
|
1151
1188
|
toggle: (record: RecordTypeWithExtra | RecordType, force?: boolean) => void;
|
|
1189
|
+
/** Toggles selection for all records. */
|
|
1152
1190
|
toggleAll: (force?: boolean) => void;
|
|
1191
|
+
/** Selects selection for the given record. */
|
|
1153
1192
|
select: (record: RecordTypeWithExtra | RecordType) => void;
|
|
1193
|
+
/** Deselects selection for the given record. */
|
|
1154
1194
|
deselect: (record: RecordTypeWithExtra | RecordType) => void;
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
execute: (options?: BulkActionOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
|
|
1171
|
-
}[];
|
|
1172
|
-
executeInlineAction: (action: InlineAction | string, options: InlineActionOptions<RecordTypeWithExtra | RecordIdentifier | RecordType>) => Promise<index_d_exports.NavigationResponse | undefined>;
|
|
1173
|
-
executeBulkAction: (action: BulkAction | string, options?: BulkActionOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
|
|
1174
|
-
columns: {
|
|
1175
|
-
/** Toggles sorting for this column. */toggleSort: (options?: ToggleSortOptions) => Promise<index_d_exports.NavigationResponse | undefined>; /** Checks whether the column is being sorted. */
|
|
1176
|
-
isSorting: (direction?: SortDirection) => boolean; /** Applies the filer for this column. */
|
|
1177
|
-
applyFilter: (value: any, options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse | undefined>; /** Clears the filter for this column. */
|
|
1178
|
-
clearFilter: (options?: AvailableHybridRequestOptions) => Promise<index_d_exports.NavigationResponse>; /** Checks whether the column is sortable. */
|
|
1179
|
-
isSortable: boolean; /** Checks whether the column is filterable. */
|
|
1180
|
-
isFilterable: boolean; /** The name of this column. */
|
|
1181
|
-
name: keyof RecordTypeWithExtra; /** The label of this column. */
|
|
1182
|
-
label: string; /** The type of this column. */
|
|
1183
|
-
type: string; /** Metadata of this column. */
|
|
1184
|
-
metadata: Record<string, any>;
|
|
1185
|
-
}[];
|
|
1195
|
+
/** List of inline actions for this table. */
|
|
1196
|
+
inlineActions: Array<UseTableInlineActionItem<RecordType, RecordTypeWithExtra>>;
|
|
1197
|
+
/** List of bulk actions for this table. */
|
|
1198
|
+
bulkActions: Array<UseTableBulkActionItem>;
|
|
1199
|
+
/** Executes the given inline action for the given record. */
|
|
1200
|
+
executeInlineAction: (action: InlineAction | string, options: {
|
|
1201
|
+
record: RecordTypeWithExtra | RecordIdentifier | RecordType;
|
|
1202
|
+
} & Omit<HybridRequestOptions, 'url'>) => UseTableNavigationResponse;
|
|
1203
|
+
/** Executes the given bulk action. */
|
|
1204
|
+
executeBulkAction: (action: BulkAction | string, options?: Omit<HybridRequestOptions, 'url'> & {
|
|
1205
|
+
deselect?: boolean;
|
|
1206
|
+
}) => UseTableNavigationResponse;
|
|
1207
|
+
/** List of columns for this table. */
|
|
1208
|
+
columns: Array<UseTableColumn<RecordTypeWithExtra>>;
|
|
1209
|
+
/** List of records for this table. */
|
|
1186
1210
|
data: RecordType[];
|
|
1187
|
-
records
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
extra: (column: string | Column<RecordTypeWithExtra>, path: string) => any;
|
|
1205
|
-
}[];
|
|
1206
|
-
paginator: PaginatorResult<unknown, Omit<PaginatorKind extends "cursor" ? CursorPaginator<RecordTypeWithExtra> : PaginatorKind extends "simple" ? SimplePaginator<RecordTypeWithExtra> : Paginator<RecordTypeWithExtra>, "data">>;
|
|
1207
|
-
};
|
|
1211
|
+
/** List of records for this table. */
|
|
1212
|
+
records: Array<UseTableRecordItem<RecordType, RecordTypeWithExtra>>;
|
|
1213
|
+
/** Paginated meta and links. */
|
|
1214
|
+
paginator: PaginatorResult<RecordTypeWithExtra, Table<RecordTypeWithExtra, PaginatorKind>['paginator']>;
|
|
1215
|
+
/** Available filters. */
|
|
1216
|
+
filters: ExtractRefValue<UseRefinements['filters']>;
|
|
1217
|
+
/** Available sorts. */
|
|
1218
|
+
sorts: ExtractRefValue<UseRefinements['sorts']>;
|
|
1219
|
+
/** The key for the filters. */
|
|
1220
|
+
filtersKey: ExtractRefValue<UseRefinements['filtersKey']>;
|
|
1221
|
+
/** The key for the sorts. */
|
|
1222
|
+
sortsKey: ExtractRefValue<UseRefinements['sortsKey']>;
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Provides utilities for working with tables.
|
|
1226
|
+
*/
|
|
1227
|
+
declare function useTable<T extends Table<any, any>, RecordType extends Record<string, any> = (T extends Table<infer R, any> ? R : any), PaginatorKind extends 'cursor' | 'length-aware' | 'simple' = (T extends Table<any, infer P> ? P : 'length-aware'), RecordTypeWithExtra extends Record<string, any> = AsRecordTypeWithExtra<RecordType>>(input: MaybeRefOrGetter<T>, defaultOptions?: TableDefaultOptions): UseTableReturn<T, RecordType, PaginatorKind, RecordTypeWithExtra>;
|
|
1208
1228
|
//#endregion
|
|
1209
1229
|
//#region src/composables/validation.d.ts
|
|
1210
1230
|
/** Accesses all validation errors grouped by bag name. */
|
|
@@ -1302,4 +1322,4 @@ interface SetupArguments {
|
|
|
1302
1322
|
payload: Record<string, any>;
|
|
1303
1323
|
}
|
|
1304
1324
|
//#endregion
|
|
1305
|
-
export { Action, AvailableHybridRequestOptions, AvailableHybridRequestOptionsForFilters, BaseFilterRefinement, BindFilterOptions, BooleanFilterRefinement, BoundBooleanFilterRefinement, BoundCallbackFilterRefinement, BoundDateFilterRefinement, BoundFilterRefinement, BoundSelectFilterRefinement, BoundSortRefinement, BoundTernaryFilterRefinement, BoundTextFilterRefinement, BoundTrashedFilterRefinement, BulkAction, BulkSelection, CallbackFilterRefinement, Column, DateFilterRefinement, DefaultFormOptions, Deferred, FilterOperator, FilterRefinement, Form, type FormProps, FormReturn, type FormSlotProps, type FormSubmitOptions, type InitializeOptions, InlineAction, InternalProperties, MaybeWithData, NumericFilterRefinement, PaginatorResult, RecordIdentifier, Refinements, RouterLink, SelectFilterRefinement, SortDirection, SortRefinement, TableDefaultOptions, TernaryFilterRefinement, TextFilterRefinement, TimeSuggestion, TimeframeSuggestion, ToggleSortOptions, TrashedFilterRefinement, UseRefinements, WhenVisible, createPaginator, initializeHybridly, isBooleanFilter, isCallbackFilter, isDateFilter, isSelectFilter, isTernaryFilter, isTextFilter, isTrashedFilter, registerHook, route, router, setProperty, useBackForward, useBulkSelect, useDialog, useForm, useHistoryState, useProperties, useProperty, useQueryParameter, useQueryParameters, useRefinements, useRoute, useTable, useValidation, useValidationBag };
|
|
1325
|
+
export { Action, AvailableHybridRequestOptions, AvailableHybridRequestOptionsForFilters, BaseFilterRefinement, BindFilterOptions, BooleanFilterRefinement, BoundBooleanFilterRefinement, BoundCallbackFilterRefinement, BoundDateFilterRefinement, BoundFilterRefinement, BoundSelectFilterRefinement, BoundSortRefinement, BoundTernaryFilterRefinement, BoundTextFilterRefinement, BoundTrashedFilterRefinement, BulkAction, BulkSelection, CallbackFilterRefinement, Column, DateFilterRefinement, DefaultFormOptions, Deferred, FilterOperator, FilterRefinement, Form, type FormProps, FormReturn, type FormSlotProps, type FormSubmitOptions, type InitializeOptions, InlineAction, InternalProperties, MaybeWithData, NumericFilterRefinement, PaginatorResult, RecordIdentifier, Refinements, RouterLink, SelectFilterRefinement, SortDirection, SortRefinement, Table, TableDefaultOptions, TernaryFilterRefinement, TextFilterRefinement, TimeSuggestion, TimeframeSuggestion, ToggleSortOptions, TrashedFilterRefinement, UseRefinements, UseTableBulkActionItem, UseTableColumn, UseTableInlineActionItem, UseTableRecordItem, UseTableReturn, WhenVisible, createPaginator, initializeHybridly, isBooleanFilter, isCallbackFilter, isDateFilter, isSelectFilter, isTernaryFilter, isTextFilter, isTrashedFilter, registerHook, route, router, setProperty, useBackForward, useBulkSelect, useDialog, useForm, useHistoryState, useProperties, useProperty, useQueryParameter, useQueryParameters, useRefinements, useRoute, useTable, useValidation, useValidationBag };
|
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.
|
|
4
|
+
"version": "0.10.0-beta.26",
|
|
5
5
|
"description": "Vue adapter for Hybridly",
|
|
6
6
|
"author": "Enzo Innocenzi <enzo@innocenzi.dev>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@clickbar/dot-diver": "^1.0.7",
|
|
49
49
|
"es-toolkit": "^1.45.1",
|
|
50
|
-
"@hybridly/core": "0.10.0-beta.
|
|
51
|
-
"@hybridly/utils": "0.10.0-beta.
|
|
50
|
+
"@hybridly/core": "0.10.0-beta.26",
|
|
51
|
+
"@hybridly/utils": "0.10.0-beta.26",
|
|
52
52
|
"@vue/devtools-api": "^8.1.0",
|
|
53
53
|
"defu": "^6.1.4",
|
|
54
54
|
"nprogress": "^0.2.0"
|