@hybridly/vue 0.10.0-beta.8 → 0.10.0-beta.9
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 +36 -24
- package/dist/index.mjs +81 -38
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -214,10 +214,10 @@ interface PaginatorMeta {
|
|
|
214
214
|
prev_page_url?: string;
|
|
215
215
|
}
|
|
216
216
|
type MaybeWithData<T> = T | Omit<T, 'data'>;
|
|
217
|
-
type PaginatorResult<T, P
|
|
218
|
-
to: (page: number) => Promise<index_d_exports.NavigationResponse> | undefined;
|
|
217
|
+
type PaginatorResult<T, P = MaybeWithData<Paginator<T>>> = P extends MaybeWithData<Paginator<T>> ? P & {
|
|
218
|
+
to: (page: number, options?: Omit<index_d_exports.HybridRequestOptions, 'method' | 'url'>) => Promise<index_d_exports.NavigationResponse> | undefined;
|
|
219
219
|
} : P;
|
|
220
|
-
declare function createPaginator<T, P extends MaybeWithData<Paginator<T> | SimplePaginator<T> | CursorPaginator<T>>>(paginator: P,
|
|
220
|
+
declare function createPaginator<T, P extends MaybeWithData<Paginator<T> | SimplePaginator<T> | CursorPaginator<T>>>(paginator: P, defaultOptions?: Omit<index_d_exports.HybridRequestOptions, 'method' | 'url'>): PaginatorResult<T, P>;
|
|
221
221
|
//#endregion
|
|
222
222
|
//#region src/composables/register-hook.d.ts
|
|
223
223
|
/**
|
|
@@ -562,7 +562,7 @@ interface SortRefinement {
|
|
|
562
562
|
*/
|
|
563
563
|
hidden: boolean;
|
|
564
564
|
}
|
|
565
|
-
interface Refinements
|
|
565
|
+
interface Refinements {
|
|
566
566
|
/**
|
|
567
567
|
* The list of available filters.
|
|
568
568
|
*/
|
|
@@ -778,7 +778,7 @@ interface UseRefinements {
|
|
|
778
778
|
*/
|
|
779
779
|
applyFilter: (name: string, value: any, options?: AvailableHybridRequestOptionsForFilters) => Promise<NavigationResponse | undefined>;
|
|
780
780
|
}
|
|
781
|
-
declare function useRefinements<T extends Refinements
|
|
781
|
+
declare function useRefinements<T extends Refinements>(input: MaybeRefOrGetter<T>, defaultOptions?: AvailableHybridRequestOptions): UseRefinements;
|
|
782
782
|
//#endregion
|
|
783
783
|
//#region src/composables/current-route.d.ts
|
|
784
784
|
declare function useRoute(): {
|
|
@@ -798,6 +798,8 @@ interface BulkSelection<T = any> {
|
|
|
798
798
|
}
|
|
799
799
|
declare function useBulkSelect<T = any>(): {
|
|
800
800
|
allSelected: vue.ComputedRef<boolean>;
|
|
801
|
+
anySelected: vue.ComputedRef<boolean>;
|
|
802
|
+
toggleAll: (force?: boolean) => void;
|
|
801
803
|
selectAll: () => void;
|
|
802
804
|
deselectAll: () => void;
|
|
803
805
|
select: (...records: T[]) => void;
|
|
@@ -846,15 +848,20 @@ interface Action {
|
|
|
846
848
|
type: string;
|
|
847
849
|
/** Custom metadata for this action. */
|
|
848
850
|
metadata: any;
|
|
851
|
+
/** A user-defined URL to which to post the action. */
|
|
852
|
+
url?: string;
|
|
849
853
|
}
|
|
850
854
|
interface BulkAction extends Action {
|
|
851
855
|
/** Should deselect all records after action. */
|
|
852
856
|
deselect: boolean;
|
|
853
857
|
}
|
|
854
|
-
interface BulkActionOptions {
|
|
858
|
+
interface BulkActionOptions extends Omit<HybridRequestOptions, 'url'> {
|
|
855
859
|
/** Force deselecting all records after action. */
|
|
856
860
|
deselect?: boolean;
|
|
857
861
|
}
|
|
862
|
+
interface InlineActionOptions<T> extends Omit<HybridRequestOptions, 'url'> {
|
|
863
|
+
record: T;
|
|
864
|
+
}
|
|
858
865
|
interface InlineAction extends Action {}
|
|
859
866
|
type RecordIdentifier = string | number;
|
|
860
867
|
type AsRecordTypeWithExtra<T extends Record<string, any>> = { [K in keyof T]: {
|
|
@@ -875,7 +882,7 @@ interface TableDefaultOptions extends AvailableHybridRequestOptions {
|
|
|
875
882
|
/**
|
|
876
883
|
* Provides utilities for working with tables.
|
|
877
884
|
*/
|
|
878
|
-
declare function useTable<T extends Table, RecordType extends (T extends Table<infer R> ? R :
|
|
885
|
+
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): {
|
|
879
886
|
bindFilter: <T_1 = string | number>(name: string, options?: BindFilterOptions<T_1>) => vue.Ref<T_1>;
|
|
880
887
|
filters: BoundFilterRefinement[];
|
|
881
888
|
sorts: BoundSortRefinement[];
|
|
@@ -898,34 +905,38 @@ declare function useTable<T extends Table, RecordType extends (T extends Table<i
|
|
|
898
905
|
selectPage: () => void;
|
|
899
906
|
deselectPage: () => void;
|
|
900
907
|
isPageSelected: boolean;
|
|
901
|
-
isSelected: (record: RecordTypeWithExtra) => boolean;
|
|
908
|
+
isSelected: (record: RecordTypeWithExtra | RecordType) => boolean;
|
|
902
909
|
allSelected: boolean;
|
|
910
|
+
anySelected: boolean;
|
|
903
911
|
selection: BulkSelection<RecordIdentifier>;
|
|
904
912
|
bindCheckbox: (key: RecordIdentifier) => {
|
|
905
913
|
onChange: (event: Event) => void;
|
|
906
914
|
checked: boolean;
|
|
907
915
|
value: RecordIdentifier;
|
|
908
916
|
};
|
|
909
|
-
toggle: (record: RecordTypeWithExtra) => void;
|
|
910
|
-
|
|
911
|
-
|
|
917
|
+
toggle: (record: RecordTypeWithExtra | RecordType, force?: boolean) => void;
|
|
918
|
+
toggleAll: (force?: boolean) => void;
|
|
919
|
+
select: (record: RecordTypeWithExtra | RecordType) => void;
|
|
920
|
+
deselect: (record: RecordTypeWithExtra | RecordType) => void;
|
|
912
921
|
inlineActions: {
|
|
913
922
|
/** The name of this action. */name: string; /** The label of this action. */
|
|
914
923
|
label: string; /** The type of this action. */
|
|
915
924
|
type: string; /** Custom metadata for this action. */
|
|
916
|
-
metadata: any; /**
|
|
917
|
-
|
|
925
|
+
metadata: any; /** A user-defined URL to which to post the action. */
|
|
926
|
+
url?: string; /** Executes the action. */
|
|
927
|
+
execute: (record: RecordTypeWithExtra | RecordIdentifier | RecordType) => Promise<index_d_exports.NavigationResponse | undefined>;
|
|
918
928
|
}[];
|
|
919
929
|
bulkActions: {
|
|
920
930
|
/** Should deselect all records after action. */deselect: boolean; /** The name of this action. */
|
|
921
931
|
name: string; /** The label of this action. */
|
|
922
932
|
label: string; /** The type of this action. */
|
|
923
933
|
type: string; /** Custom metadata for this action. */
|
|
924
|
-
metadata: any; /**
|
|
925
|
-
|
|
934
|
+
metadata: any; /** A user-defined URL to which to post the action. */
|
|
935
|
+
url?: string; /** Executes the action. */
|
|
936
|
+
execute: (options?: BulkActionOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
|
|
926
937
|
}[];
|
|
927
|
-
executeInlineAction: (action:
|
|
928
|
-
executeBulkAction: (action:
|
|
938
|
+
executeInlineAction: (action: InlineAction | string, options: InlineActionOptions<RecordTypeWithExtra | RecordIdentifier | RecordType>) => Promise<index_d_exports.NavigationResponse | undefined>;
|
|
939
|
+
executeBulkAction: (action: BulkAction | string, options?: BulkActionOptions) => Promise<index_d_exports.NavigationResponse | undefined>;
|
|
929
940
|
columns: {
|
|
930
941
|
/** Toggles sorting for this column. */toggleSort: (options?: ToggleSortOptions) => Promise<index_d_exports.NavigationResponse | undefined>; /** Checks whether the column is being sorted. */
|
|
931
942
|
isSorting: (direction?: SortDirection) => boolean; /** Applies the filer for this column. */
|
|
@@ -940,24 +951,25 @@ declare function useTable<T extends Table, RecordType extends (T extends Table<i
|
|
|
940
951
|
}[];
|
|
941
952
|
data: RecordType[];
|
|
942
953
|
records: {
|
|
943
|
-
/** The actual record. */record:
|
|
954
|
+
/** The actual record. */record: RecordType; /** The key of the record. Use this instead of `id`. */
|
|
944
955
|
key: RecordIdentifier; /** Executes the given inline action. */
|
|
945
|
-
execute: (action: string | InlineAction) => Promise<index_d_exports.NavigationResponse>; /** Gets the available inline actions. */
|
|
956
|
+
execute: (action: string | InlineAction) => Promise<index_d_exports.NavigationResponse | undefined>; /** Gets the available inline actions. */
|
|
946
957
|
actions: {
|
|
947
|
-
/** Executes the action. */execute: () => Promise<index_d_exports.NavigationResponse>; /** The name of this action. */
|
|
958
|
+
/** Executes the action. */execute: () => Promise<index_d_exports.NavigationResponse | undefined>; /** The name of this action. */
|
|
948
959
|
name: string; /** The label of this action. */
|
|
949
960
|
label: string; /** The type of this action. */
|
|
950
961
|
type: string; /** Custom metadata for this action. */
|
|
951
|
-
metadata: any;
|
|
962
|
+
metadata: any; /** A user-defined URL to which to post the action. */
|
|
963
|
+
url?: string;
|
|
952
964
|
}[]; /** Selects this record. */
|
|
953
965
|
select: () => void; /** Deselects this record. */
|
|
954
966
|
deselect: () => void; /** Toggles the selection for this record. */
|
|
955
967
|
toggle: (force?: boolean) => void; /** Checks whether this record is selected. */
|
|
956
968
|
selected: boolean; /** Gets the value of the record for the specified column. */
|
|
957
|
-
value: (column: string | Column<RecordTypeWithExtra>) =>
|
|
969
|
+
value: (column: string | Column<RecordTypeWithExtra>) => any; /** Gets the extra object of the record for the specified column. */
|
|
958
970
|
extra: (column: string | Column<RecordTypeWithExtra>, path: string) => any;
|
|
959
971
|
}[];
|
|
960
|
-
paginator: PaginatorResult<unknown, Omit<
|
|
972
|
+
paginator: PaginatorResult<unknown, Omit<PaginatorKind extends "cursor" ? CursorPaginator<RecordTypeWithExtra> : PaginatorKind extends "simple" ? SimplePaginator<RecordTypeWithExtra> : Paginator<RecordTypeWithExtra>, "data">>;
|
|
961
973
|
};
|
|
962
974
|
//#endregion
|
|
963
975
|
//#region src/composables/query-parameters.d.ts
|
|
@@ -1052,4 +1064,4 @@ interface SetupArguments {
|
|
|
1052
1064
|
payload: Record<string, any>;
|
|
1053
1065
|
}
|
|
1054
1066
|
//#endregion
|
|
1055
|
-
export { Action, AvailableHybridRequestOptions, AvailableHybridRequestOptionsForFilters, BaseFilterRefinement, BindFilterOptions, BooleanFilterRefinement, BoundBooleanFilterRefinement, BoundCallbackFilterRefinement, BoundDateFilterRefinement, BoundFilterRefinement, BoundSelectFilterRefinement, BoundSortRefinement, BoundTernaryFilterRefinement, BoundTextFilterRefinement, BoundTrashedFilterRefinement, BulkAction, BulkSelection, CallbackFilterRefinement, Column, DateFilterRefinement, DefaultFormOptions, FilterOperator, FilterRefinement, FormReturn, type InitializeOptions, InlineAction, InternalProperties, MaybeWithData, NumericFilterRefinement, PaginatorResult, RecordIdentifier, Refinements
|
|
1067
|
+
export { Action, AvailableHybridRequestOptions, AvailableHybridRequestOptionsForFilters, BaseFilterRefinement, BindFilterOptions, BooleanFilterRefinement, BoundBooleanFilterRefinement, BoundCallbackFilterRefinement, BoundDateFilterRefinement, BoundFilterRefinement, BoundSelectFilterRefinement, BoundSortRefinement, BoundTernaryFilterRefinement, BoundTextFilterRefinement, BoundTrashedFilterRefinement, BulkAction, BulkSelection, CallbackFilterRefinement, Column, DateFilterRefinement, DefaultFormOptions, FilterOperator, FilterRefinement, FormReturn, type InitializeOptions, InlineAction, InternalProperties, MaybeWithData, NumericFilterRefinement, PaginatorResult, RecordIdentifier, Refinements, RouterLink, SelectFilterRefinement, SortDirection, SortRefinement, TableDefaultOptions, TernaryFilterRefinement, TextFilterRefinement, TimeSuggestion, TimeframeSuggestion, ToggleSortOptions, TrashedFilterRefinement, UseRefinements, can, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -824,15 +824,19 @@ function useBackForward(options) {
|
|
|
824
824
|
var src_exports = /* @__PURE__ */ __exportAll({});
|
|
825
825
|
import * as import__hybridly_core from "@hybridly/core";
|
|
826
826
|
__reExport(src_exports, import__hybridly_core);
|
|
827
|
-
function createPaginator(paginator,
|
|
827
|
+
function createPaginator(paginator, defaultOptions) {
|
|
828
828
|
const isPaginator = (p) => {
|
|
829
829
|
return "links" in p && "meta" in p && "last_page" in p.meta;
|
|
830
830
|
};
|
|
831
831
|
if (isPaginator(paginator)) return {
|
|
832
832
|
...paginator,
|
|
833
|
-
to: (page) => {
|
|
833
|
+
to: (page, options) => {
|
|
834
834
|
const link = paginator.links.find((l) => l.page === page);
|
|
835
|
-
if (link?.url) return src_exports.router.get(link.url,
|
|
835
|
+
if (link?.url) return src_exports.router.get(link.url, {
|
|
836
|
+
preserveState: true,
|
|
837
|
+
...defaultOptions,
|
|
838
|
+
...options
|
|
839
|
+
});
|
|
836
840
|
}
|
|
837
841
|
};
|
|
838
842
|
return paginator;
|
|
@@ -1086,6 +1090,10 @@ function useBulkSelect() {
|
|
|
1086
1090
|
only: /* @__PURE__ */ new Set(),
|
|
1087
1091
|
except: /* @__PURE__ */ new Set()
|
|
1088
1092
|
});
|
|
1093
|
+
function toggleAll(force) {
|
|
1094
|
+
if (!selection.value.all || force === true) selectAll();
|
|
1095
|
+
else deselectAll();
|
|
1096
|
+
}
|
|
1089
1097
|
function selectAll() {
|
|
1090
1098
|
selection.value.all = true;
|
|
1091
1099
|
selection.value.only.clear();
|
|
@@ -1115,6 +1123,9 @@ function useBulkSelect() {
|
|
|
1115
1123
|
const allSelected = computed(() => {
|
|
1116
1124
|
return selection.value.all && selection.value.except.size === 0;
|
|
1117
1125
|
});
|
|
1126
|
+
const anySelected = computed(() => {
|
|
1127
|
+
return selection.value.all || selection.value.only.size > 0;
|
|
1128
|
+
});
|
|
1118
1129
|
function bindCheckbox(key) {
|
|
1119
1130
|
return {
|
|
1120
1131
|
onChange: (event) => {
|
|
@@ -1128,6 +1139,8 @@ function useBulkSelect() {
|
|
|
1128
1139
|
}
|
|
1129
1140
|
return {
|
|
1130
1141
|
allSelected,
|
|
1142
|
+
anySelected,
|
|
1143
|
+
toggleAll,
|
|
1131
1144
|
selectAll,
|
|
1132
1145
|
deselectAll,
|
|
1133
1146
|
select,
|
|
@@ -1177,36 +1190,61 @@ function useTable(input, defaultOptions = {}) {
|
|
|
1177
1190
|
const table = computed(() => toValue(input));
|
|
1178
1191
|
const bulk = useBulkSelect();
|
|
1179
1192
|
const refinements = useRefinements(() => toValue(input).refinements, defaultOptions);
|
|
1180
|
-
function getAdditionnalData() {
|
|
1193
|
+
function getAdditionnalData(options) {
|
|
1181
1194
|
const data = {};
|
|
1195
|
+
options = {
|
|
1196
|
+
...defaultOptions,
|
|
1197
|
+
...options
|
|
1198
|
+
};
|
|
1182
1199
|
if (defaultOptions?.includeQueryParameters !== false) Object.assign(data, structuredClone(toRaw(useQueryParameters())));
|
|
1183
|
-
if (
|
|
1200
|
+
if (options?.data) Object.assign(data, options.data);
|
|
1184
1201
|
return data;
|
|
1185
1202
|
}
|
|
1186
1203
|
function getRecordKey(record) {
|
|
1187
1204
|
if (typeof record !== "object") return record;
|
|
1188
1205
|
if (Reflect.has(record, "__hybridId")) return Reflect.get(record, "__hybridId");
|
|
1189
|
-
|
|
1206
|
+
if (!table.value.keyName) throw new Error("Record key cannot be fetched because the table has no defined key.");
|
|
1207
|
+
const value = Reflect.get(record, table.value.keyName);
|
|
1208
|
+
if (typeof value === "object" && Reflect.has(value, "value")) return value.value;
|
|
1209
|
+
return value;
|
|
1210
|
+
}
|
|
1211
|
+
function resolveInlineAction(action) {
|
|
1212
|
+
if (typeof action !== "string") return action;
|
|
1213
|
+
return table.value.inlineActions.find(({ name }) => name === action);
|
|
1214
|
+
}
|
|
1215
|
+
function resolveBulkAction(action) {
|
|
1216
|
+
if (typeof action !== "string") return action;
|
|
1217
|
+
return table.value.bulkActions.find(({ name }) => name === action);
|
|
1190
1218
|
}
|
|
1191
|
-
function
|
|
1192
|
-
|
|
1219
|
+
function getActionUrl(action, table) {
|
|
1220
|
+
if (action.url) return action.url;
|
|
1221
|
+
return route$1(table.endpoint);
|
|
1193
1222
|
}
|
|
1194
|
-
async function executeInlineAction(action,
|
|
1223
|
+
async function executeInlineAction(action, options) {
|
|
1224
|
+
const resolvedAction = resolveInlineAction(action);
|
|
1225
|
+
if (!resolvedAction) {
|
|
1226
|
+
console.warn(`Action [${action}] is not defined`);
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1195
1229
|
return await router$1.navigate({
|
|
1196
1230
|
method: "post",
|
|
1197
|
-
url:
|
|
1231
|
+
url: getActionUrl(resolvedAction, table.value),
|
|
1198
1232
|
preserveState: true,
|
|
1199
1233
|
data: {
|
|
1200
|
-
...getAdditionnalData(),
|
|
1234
|
+
...getAdditionnalData(options),
|
|
1201
1235
|
type: "action:inline",
|
|
1202
|
-
action:
|
|
1236
|
+
action: resolvedAction.name,
|
|
1203
1237
|
tableId: table.value.id,
|
|
1204
|
-
recordId: getRecordKey(record)
|
|
1238
|
+
recordId: getRecordKey(options.record)
|
|
1205
1239
|
}
|
|
1206
1240
|
});
|
|
1207
1241
|
}
|
|
1208
|
-
async function executeBulkAction(action, options) {
|
|
1209
|
-
const
|
|
1242
|
+
async function executeBulkAction(action, options = {}) {
|
|
1243
|
+
const resolvedAction = resolveBulkAction(action);
|
|
1244
|
+
if (!resolvedAction) {
|
|
1245
|
+
console.warn(`Action [${action}] is not defined`);
|
|
1246
|
+
return;
|
|
1247
|
+
}
|
|
1210
1248
|
const filterParameters = refinements.currentFilters().reduce((carry, filter) => {
|
|
1211
1249
|
return {
|
|
1212
1250
|
...carry,
|
|
@@ -1215,12 +1253,12 @@ function useTable(input, defaultOptions = {}) {
|
|
|
1215
1253
|
}, {});
|
|
1216
1254
|
return await router$1.navigate({
|
|
1217
1255
|
method: "post",
|
|
1218
|
-
url:
|
|
1256
|
+
url: getActionUrl(resolvedAction, table.value),
|
|
1219
1257
|
preserveState: true,
|
|
1220
1258
|
data: {
|
|
1221
|
-
...getAdditionnalData(),
|
|
1259
|
+
...getAdditionnalData(options),
|
|
1222
1260
|
type: "action:bulk",
|
|
1223
|
-
action:
|
|
1261
|
+
action: resolvedAction.name,
|
|
1224
1262
|
tableId: table.value.id,
|
|
1225
1263
|
all: bulk.selection.value.all,
|
|
1226
1264
|
only: [...bulk.selection.value.only],
|
|
@@ -1228,7 +1266,7 @@ function useTable(input, defaultOptions = {}) {
|
|
|
1228
1266
|
[refinements.filtersKey.value]: filterParameters
|
|
1229
1267
|
},
|
|
1230
1268
|
hooks: { after: () => {
|
|
1231
|
-
if (options?.deselect === true ||
|
|
1269
|
+
if (options?.deselect === true || resolvedAction.deselect !== false) bulk.deselectAll();
|
|
1232
1270
|
} }
|
|
1233
1271
|
});
|
|
1234
1272
|
}
|
|
@@ -1240,17 +1278,19 @@ function useTable(input, defaultOptions = {}) {
|
|
|
1240
1278
|
isPageSelected: computed(() => table.value.records.length > 0 && table.value.records.every((record) => bulk.selected(getRecordKey(record)))),
|
|
1241
1279
|
isSelected: (record) => bulk.selected(getRecordKey(record)),
|
|
1242
1280
|
allSelected: bulk.allSelected,
|
|
1281
|
+
anySelected: bulk.anySelected,
|
|
1243
1282
|
selection: bulk.selection,
|
|
1244
1283
|
bindCheckbox: (key) => bulk.bindCheckbox(key),
|
|
1245
|
-
toggle: (record) => bulk.toggle(getRecordKey(record)),
|
|
1284
|
+
toggle: (record, force) => bulk.toggle(getRecordKey(record), force),
|
|
1285
|
+
toggleAll: (force) => bulk.toggleAll(force),
|
|
1246
1286
|
select: (record) => bulk.select(getRecordKey(record)),
|
|
1247
1287
|
deselect: (record) => bulk.deselect(getRecordKey(record)),
|
|
1248
1288
|
inlineActions: computed(() => table.value.inlineActions.map((action) => ({
|
|
1249
|
-
execute: (record) => executeInlineAction(action
|
|
1289
|
+
execute: (record) => executeInlineAction(action, { record }),
|
|
1250
1290
|
...action
|
|
1251
1291
|
}))),
|
|
1252
1292
|
bulkActions: computed(() => table.value.bulkActions.map((action) => ({
|
|
1253
|
-
execute: (options) => executeBulkAction(action
|
|
1293
|
+
execute: (options) => executeBulkAction(action, options),
|
|
1254
1294
|
...action
|
|
1255
1295
|
}))),
|
|
1256
1296
|
executeInlineAction,
|
|
@@ -1271,22 +1311,25 @@ function useTable(input, defaultOptions = {}) {
|
|
|
1271
1311
|
return Object.fromEntries(entries);
|
|
1272
1312
|
}).filter(Boolean);
|
|
1273
1313
|
}),
|
|
1274
|
-
records: computed(() => table.value.records.map((record) =>
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1314
|
+
records: computed(() => table.value.records.map((record) => {
|
|
1315
|
+
const entries = Object.entries(record).map(([key, value]) => [key, value.value]).filter(([key]) => key !== "__hybridId");
|
|
1316
|
+
return {
|
|
1317
|
+
record: entries.length > 0 ? Object.fromEntries(entries) : {},
|
|
1318
|
+
key: getRecordKey(record),
|
|
1319
|
+
execute: (action) => executeInlineAction(action, { record: getRecordKey(record) }),
|
|
1320
|
+
actions: table.value.inlineActions.map((action) => ({
|
|
1321
|
+
...action,
|
|
1322
|
+
execute: () => executeInlineAction(action.name, { record: getRecordKey(record) })
|
|
1323
|
+
})),
|
|
1324
|
+
select: () => bulk.select(getRecordKey(record)),
|
|
1325
|
+
deselect: () => bulk.deselect(getRecordKey(record)),
|
|
1326
|
+
toggle: (force) => bulk.toggle(getRecordKey(record), force),
|
|
1327
|
+
selected: bulk.selected(getRecordKey(record)),
|
|
1328
|
+
value: (column) => record[typeof column === "string" ? column : column.name].value,
|
|
1329
|
+
extra: (column, path) => getByPath(record[typeof column === "string" ? column : column.name].extra, path)
|
|
1330
|
+
};
|
|
1331
|
+
})),
|
|
1332
|
+
paginator: computed(() => createPaginator(table.value.paginator, defaultOptions)),
|
|
1290
1333
|
...refinements
|
|
1291
1334
|
});
|
|
1292
1335
|
}
|
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.9",
|
|
5
5
|
"description": "Vue adapter for Hybridly",
|
|
6
6
|
"author": "Enzo Innocenzi <enzo@innocenzi.dev>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@clickbar/dot-diver": "^1.0.7",
|
|
49
|
-
"@hybridly/core": "0.10.0-beta.
|
|
50
|
-
"@hybridly/utils": "0.10.0-beta.
|
|
49
|
+
"@hybridly/core": "0.10.0-beta.9",
|
|
50
|
+
"@hybridly/utils": "0.10.0-beta.9",
|
|
51
51
|
"@vue/devtools-api": "^7.7.6",
|
|
52
52
|
"defu": "^6.1.4",
|
|
53
53
|
"lodash.isequal": "^4.5.0",
|