nuxt-ui-tools 1.27.1 → 1.27.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json
CHANGED
|
@@ -61,6 +61,41 @@ export function createTableFilterBuilder() {
|
|
|
61
61
|
kind: "text",
|
|
62
62
|
...options
|
|
63
63
|
};
|
|
64
|
+
},
|
|
65
|
+
query: createTableQueryFilterBuilder()
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function createTableQueryFilterBuilder() {
|
|
69
|
+
return {
|
|
70
|
+
boolean(key, options) {
|
|
71
|
+
return {
|
|
72
|
+
key,
|
|
73
|
+
kind: "boolean",
|
|
74
|
+
...options,
|
|
75
|
+
behavior: { ...options.behavior, applyTo: "query" }
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
date(key, options) {
|
|
79
|
+
return { key, kind: "date", ...options, behavior: { ...options.behavior, applyTo: "query" } };
|
|
80
|
+
},
|
|
81
|
+
number(key, options) {
|
|
82
|
+
return {
|
|
83
|
+
key,
|
|
84
|
+
kind: "number",
|
|
85
|
+
...options,
|
|
86
|
+
behavior: { ...options.behavior, applyTo: "query" }
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
option(key, options) {
|
|
90
|
+
return {
|
|
91
|
+
key,
|
|
92
|
+
kind: "option",
|
|
93
|
+
...options,
|
|
94
|
+
behavior: { ...options.behavior, applyTo: "query" }
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
text(key, options) {
|
|
98
|
+
return { key, kind: "text", ...options, behavior: { ...options.behavior, applyTo: "query" } };
|
|
64
99
|
}
|
|
65
100
|
};
|
|
66
101
|
}
|
|
@@ -708,33 +708,37 @@ export type TableOptionFilterOptions<TRow extends GenericObject = GenericObject,
|
|
|
708
708
|
export type TableBooleanFilterOptions<TRow extends GenericObject = GenericObject, TContext extends GenericObject = GenericObject, TKey extends string = TableKnownFieldPath<TRow>> = Omit<TableBooleanFilterDefinition<TRow, TContext, TKey>, 'key' | 'kind'>;
|
|
709
709
|
export type TableNumberFilterOptions<TRow extends GenericObject = GenericObject, TContext extends GenericObject = GenericObject, TKey extends string = TableKnownFieldPath<TRow>> = Omit<TableNumberFilterDefinition<TRow, TContext, TKey>, 'key' | 'kind'>;
|
|
710
710
|
export type TableDateFilterOptions<TRow extends GenericObject = GenericObject, TContext extends GenericObject = GenericObject, TKey extends string = TableKnownFieldPath<TRow>> = Omit<TableDateFilterDefinition<TRow, TContext, TKey>, 'key' | 'kind'>;
|
|
711
|
-
/**
|
|
712
|
-
|
|
713
|
-
* the source and requires `behavior.applyTo: 'query'`.
|
|
714
|
-
*/
|
|
715
|
-
export type TableFilterKey<TRow extends GenericObject = GenericObject> = TableKnownFieldPath<TRow> | (string & {});
|
|
716
|
-
/** What a filter key adds to its options: nothing for a row field, `applyTo: 'query'` otherwise. */
|
|
717
|
-
export type TableFilterKeyScope<TRow extends GenericObject, TKey extends string> = TKey extends TableKnownFieldPath<TRow> ? unknown : {
|
|
711
|
+
/** What marks a filter as a scope of the source query rather than of the rows. */
|
|
712
|
+
export type TableQueryFilterScope = {
|
|
718
713
|
behavior: {
|
|
719
714
|
applyTo: 'query';
|
|
720
715
|
};
|
|
721
716
|
};
|
|
717
|
+
/**
|
|
718
|
+
* Builds filters that scope the source query (`behavior.applyTo: 'query'`). Their key names a query
|
|
719
|
+
* parameter, so it does not have to be a row field.
|
|
720
|
+
*/
|
|
721
|
+
export interface TableQueryFilterBuilder<TRow extends GenericObject = GenericObject, TContext extends GenericObject = GenericObject> {
|
|
722
|
+
text<TKey extends string>(key: TKey, options: TableTextFilterOptions<TRow, TContext, TKey>): TableTextFilterDefinition<TRow, TContext, TKey> & TableQueryFilterScope;
|
|
723
|
+
option<TKey extends string, TValue extends TableFilterPrimitiveValue, TPresentation extends TableOptionFilterPresentation = TableOptionFilterPresentation>(key: TKey, options: TableOptionFilterOptions<TRow, TContext, TKey, TValue, TPresentation>): TableOptionFilterDefinition<TRow, TContext, TKey, TValue, TPresentation> & TableQueryFilterScope;
|
|
724
|
+
boolean<TKey extends string>(key: TKey, options: TableBooleanFilterOptions<TRow, TContext, TKey>): TableBooleanFilterDefinition<TRow, TContext, TKey> & TableQueryFilterScope;
|
|
725
|
+
number<TKey extends string>(key: TKey, options: TableNumberFilterOptions<TRow, TContext, TKey>): TableNumberFilterDefinition<TRow, TContext, TKey> & TableQueryFilterScope;
|
|
726
|
+
date<TKey extends string>(key: TKey, options: TableDateFilterOptions<TRow, TContext, TKey>): TableDateFilterDefinition<TRow, TContext, TKey> & TableQueryFilterScope;
|
|
727
|
+
}
|
|
722
728
|
export interface TableFilterBuilder<TRow extends GenericObject = GenericObject, TContext extends GenericObject = GenericObject> {
|
|
723
|
-
text<TKey extends
|
|
724
|
-
option<TKey extends
|
|
725
|
-
boolean<TKey extends
|
|
726
|
-
number<TKey extends
|
|
727
|
-
date<TKey extends
|
|
729
|
+
text<TKey extends TableKnownFieldPath<TRow>>(key: TKey, options: TableTextFilterOptions<TRow, TContext, TKey>): TableTextFilterDefinition<TRow, TContext, TKey>;
|
|
730
|
+
option<TKey extends TableKnownFieldPath<TRow>, TValue extends TableFilterPrimitiveValue, TPresentation extends TableOptionFilterPresentation = TableOptionFilterPresentation>(key: TKey, options: TableOptionFilterOptions<TRow, TContext, TKey, TValue, TPresentation>): TableOptionFilterDefinition<TRow, TContext, TKey, TValue, TPresentation>;
|
|
731
|
+
boolean<TKey extends TableKnownFieldPath<TRow>>(key: TKey, options: TableBooleanFilterOptions<TRow, TContext, TKey>): TableBooleanFilterDefinition<TRow, TContext, TKey>;
|
|
732
|
+
number<TKey extends TableKnownFieldPath<TRow>>(key: TKey, options: TableNumberFilterOptions<TRow, TContext, TKey>): TableNumberFilterDefinition<TRow, TContext, TKey>;
|
|
733
|
+
date<TKey extends TableKnownFieldPath<TRow>>(key: TKey, options: TableDateFilterOptions<TRow, TContext, TKey>): TableDateFilterDefinition<TRow, TContext, TKey>;
|
|
734
|
+
/** Filters that scope the source query instead of the rows. See `TableQueryFilterBuilder`. */
|
|
735
|
+
query: TableQueryFilterBuilder<TRow, TContext>;
|
|
728
736
|
}
|
|
729
737
|
/**
|
|
730
|
-
* One filter of a table: a row filter keyed by a row field, or a query filter
|
|
731
|
-
*
|
|
738
|
+
* One filter of a table: a row filter keyed by a row field, or a query filter built with
|
|
739
|
+
* `filter.query` and keyed by any query parameter.
|
|
732
740
|
*/
|
|
733
|
-
export type TableUiFilterCollectionItem<TRow extends GenericObject = GenericObject, TContext extends GenericObject = GenericObject, TKey extends string = TableKnownFieldPath<TRow>> = TableUiFilterDefinition<TRow, TContext, TKey> | (TableUiFilterDefinition<TRow, TContext, string> &
|
|
734
|
-
behavior: {
|
|
735
|
-
applyTo: 'query';
|
|
736
|
-
};
|
|
737
|
-
});
|
|
741
|
+
export type TableUiFilterCollectionItem<TRow extends GenericObject = GenericObject, TContext extends GenericObject = GenericObject, TKey extends string = TableKnownFieldPath<TRow>> = TableUiFilterDefinition<TRow, TContext, TKey> | (TableUiFilterDefinition<TRow, TContext, string> & TableQueryFilterScope);
|
|
738
742
|
export type TableUiFilterCollection<TRow extends GenericObject = GenericObject, TContext extends GenericObject = GenericObject, TKey extends string = TableKnownFieldPath<TRow>> = TableUiFilterCollectionItem<TRow, TContext, TKey>[] | ((filter: TableFilterBuilder<TRow, TContext>) => TableUiFilterCollectionItem<TRow, TContext, TKey>[]);
|
|
739
743
|
export interface TableFiltersSchema<TRow extends GenericObject = GenericObject, TContext extends GenericObject = GenericObject, TKey extends string = TableKnownFieldPath<TRow>> {
|
|
740
744
|
search?: TableSearchFilter<TRow>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-ui-tools",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.2",
|
|
4
4
|
"description": "Nuxt module and runtime toolkit for UI-heavy Nuxt applications",
|
|
5
5
|
"homepage": "https://github.com/ChronicStone/nuxt-ui-tools#readme",
|
|
6
6
|
"bugs": "https://github.com/ChronicStone/nuxt-ui-tools/issues",
|