@ianicdev/datatables2 0.11.2 → 0.11.3

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.
Files changed (2) hide show
  1. package/lib/index.d.ts +39 -18
  2. package/package.json +1 -1
package/lib/index.d.ts CHANGED
@@ -1,31 +1,52 @@
1
1
  // lib/index.d.ts
2
2
  import type { DataTableHeader } from "vuetify/lib/types.mjs";
3
3
  import type { Component } from "vue";
4
+ import { VSelect, VTextField, VNumberInput, VDateInput } from "vuetify/components";
4
5
 
5
- type BuiltInAdvancedFiltersComponent = "select" | "datepicker" | "comparison" | "number";
6
+ type BuiltInAdvancedFiltersComponent = "textfield" | "select" | "number" | "datepicker" | "comparison";
7
+
8
+ type BaseAdvancedFilter = {
9
+ key?: string;
10
+ valueFormatter?: (context: { value: any }) => any;
11
+ filterReturnValue?: (context: { value: any }) => any;
12
+ customFilterFn?: (context: { value: any; filterValue: any }) => boolean;
13
+ };
14
+
15
+ type AdvancedFilterConfig =
16
+ | false
17
+ | (BaseAdvancedFilter & {
18
+ component: "textfield";
19
+ options?: InstanceType<typeof VTextField>["$props"];
20
+ })
21
+ | (BaseAdvancedFilter & {
22
+ component: "select";
23
+ options?: InstanceType<typeof VSelect>["$props"];
24
+ })
25
+ | (BaseAdvancedFilter & {
26
+ component: "number";
27
+ options?: InstanceType<typeof VNumberInput>["$props"];
28
+ })
29
+ | (BaseAdvancedFilter & {
30
+ component: "datepicker";
31
+ options?: InstanceType<typeof VDateInput>["$props"] & {
32
+ returnFormat?: string;
33
+ };
34
+ })
35
+ | (BaseAdvancedFilter & {
36
+ component: "comparison";
37
+ options?: InstanceType<typeof VNumberInput>["$props"] & InstanceType<typeof VSelect>["$props"];
38
+ })
39
+ | (BaseAdvancedFilter & {
40
+ component?: Component;
41
+ options?: Record<string, any>;
42
+ });
6
43
 
7
44
  export interface ColumnDef<T> extends Omit<DataTableHeader, "value"> {
8
45
  hidden?: boolean;
9
46
  printable?: boolean;
10
-
11
47
  value?: (item: T) => any;
12
48
  cell?: (context: { value: any; item: T }) => any;
13
-
14
- advancedFilter?:
15
- | false
16
- | {
17
- key?: string;
18
- component?: BuiltInAdvancedFiltersComponent | Component;
19
- valueFormatter?: (context: { value: any }) => any;
20
- filterReturnValue?: (context: { value: any }) => any;
21
- customFilterFn?: (context: { value: any; filterValue: any }) => boolean;
22
- options?: {
23
- multiple?: boolean | "range";
24
- items?: Array<{ title: string; value: any }>;
25
- returnFormat?: string;
26
- controlVariant?: "stacked" | string;
27
- };
28
- };
49
+ advancedFilter?: AdvancedFilterConfig;
29
50
  }
30
51
 
31
52
  export function useCellRendererFrameworks(): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ianicdev/datatables2",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "type": "module",
5
5
  "types": "./lib/index.d.ts",
6
6
  "publishConfig": {