@illinois-grad/grad-vue 1.0.1 → 2.0.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 University of Illinois Board of Trustees
3
+ Copyright (c) 2026 University of Illinois Board of Trustees
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Shared Vue.js components and composable functions for the Graduate College.
4
4
 
5
+ **Package has moved in npm** to `@illinois-grad/grad-vue`.
6
+
5
7
  Features:
6
8
 
7
9
  - **Vue 3**: Built with Vue.js version 3 and the Composition API.
@@ -7,6 +7,10 @@ interface Props {
7
7
  * Hide the visible text
8
8
  */
9
9
  hideText?: boolean;
10
+ /**
11
+ * Copy button label
12
+ */
13
+ copyLabel?: string;
10
14
  }
11
15
  declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
16
  declare const _default: typeof __VLS_export;
@@ -49,7 +49,7 @@ declare const __VLS_export: <T extends {
49
49
  option: T;
50
50
  }) => any;
51
51
  };
52
- emit: ((event: "select" | "submit", ...args: any[]) => void) & ((evt: "update:modelValue", value: string | null) => void);
52
+ emit: ((event: "select" | "submit", ...args: any[]) => void) & ((event: "update:modelValue", value: string | null) => void);
53
53
  }>) => import("vue").VNode & {
54
54
  __ctx?: Awaited<typeof __VLS_setup>;
55
55
  };
@@ -1,6 +1,20 @@
1
1
  import { TableColumn, TableRow } from "./table/TableColumn.ts";
2
2
  import { VNode } from "vue";
3
3
  import { UseFilteringReturn } from "../compose/useFiltering.ts";
4
+ export interface BulkAction {
5
+ /**
6
+ * Action identifier
7
+ */
8
+ id: string;
9
+ /**
10
+ * Action label
11
+ */
12
+ label: string;
13
+ /**
14
+ * Action theme/color
15
+ */
16
+ theme?: "primary" | "secondary" | "accent" | "danger";
17
+ }
4
18
  declare const __VLS_export: <T extends TableRow, C extends TableColumn<T>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
19
  props: import("vue").PublicProps & __VLS_PrettifyLocal<({
6
20
  /**
@@ -11,20 +25,28 @@ declare const __VLS_export: <T extends TableRow, C extends TableColumn<T>>(__VLS
11
25
  columns: C[];
12
26
  resultCount?: number;
13
27
  groupBy?: keyof T;
14
- filtering: UseFilteringReturn<T>;
28
+ filtering: UseFilteringReturn<any>;
15
29
  groupRender?: (groupValue: any, row: T) => VNode;
16
30
  rowClickable?: boolean;
17
31
  rowClass?: (row: T) => string | string[] | undefined;
18
32
  startIndex: number;
33
+ /**
34
+ * Enable bulk selection with checkboxes
35
+ */
36
+ bulkSelectionEnabled?: boolean;
37
+ bulkActions?: BulkAction[];
19
38
  } & {
20
39
  sortField?: keyof T;
21
40
  sortOrder?: 1 | -1;
22
- filter: Record<keyof T, any>;
41
+ filter: Partial<Record<keyof T, any>>;
42
+ selectedRows?: string[];
23
43
  }) & {
24
44
  "onRow-click"?: ((link: string) => any) | undefined;
25
45
  "onUpdate:sortField"?: ((value: keyof T | undefined) => any) | undefined;
26
46
  "onUpdate:sortOrder"?: ((value: 1 | -1 | undefined) => any) | undefined;
27
- "onUpdate:filter"?: ((value: Record<keyof T, any>) => any) | undefined;
47
+ "onUpdate:filter"?: ((value: Partial<Record<keyof T, any>>) => any) | undefined;
48
+ "onUpdate:selectedRows"?: ((value: string[]) => any) | undefined;
49
+ "onBulk-action"?: ((actionId: string, selectedKeys: string[]) => any) | undefined;
28
50
  }> & (typeof globalThis extends {
29
51
  __VLS_PROPS_FALLBACK: infer P;
30
52
  } ? P : {});
@@ -33,7 +55,10 @@ declare const __VLS_export: <T extends TableRow, C extends TableColumn<T>>(__VLS
33
55
  slots: {
34
56
  pagination?: (props: {}) => any;
35
57
  };
36
- emit: ((e: "row-click", link: string) => void) & (((evt: "update:sortField", value: keyof T | undefined) => void) & ((evt: "update:sortOrder", value: 1 | -1 | undefined) => void) & ((evt: "update:filter", value: Record<keyof T, any>) => void));
58
+ emit: {
59
+ (e: "row-click", link: string): void;
60
+ (e: "bulk-action", actionId: string, selectedKeys: string[]): void;
61
+ } & (((event: "update:sortField", value: keyof T | undefined) => void) & ((event: "update:sortOrder", value: 1 | -1 | undefined) => void) & ((event: "update:filter", value: Partial<Record<keyof T, any>>) => void) & ((event: "update:selectedRows", value: string[]) => void));
37
62
  }>) => import("vue").VNode & {
38
63
  __ctx?: Awaited<typeof __VLS_setup>;
39
64
  };
@@ -9,7 +9,10 @@ declare const __VLS_export: <T extends TableRow, C extends TableColumn<T>>(__VLS
9
9
  rowClickable?: boolean;
10
10
  rowClass?: (row: T) => string | string[] | undefined;
11
11
  startIndex: number;
12
+ bulkSelectionEnabled?: boolean;
13
+ selectedRows?: string[];
12
14
  } & {
15
+ "onToggle-row"?: ((rowKey: string, shiftKey: boolean) => any) | undefined;
13
16
  "onRow-click"?: ((link: string) => any) | undefined;
14
17
  }> & (typeof globalThis extends {
15
18
  __VLS_PROPS_FALLBACK: infer P;
@@ -17,7 +20,10 @@ declare const __VLS_export: <T extends TableRow, C extends TableColumn<T>>(__VLS
17
20
  expose: (exposed: {}) => void;
18
21
  attrs: any;
19
22
  slots: {};
20
- emit: (e: "row-click", link: string) => void;
23
+ emit: {
24
+ (e: "row-click", link: string): void;
25
+ (e: "toggle-row", rowKey: string, shiftKey: boolean): void;
26
+ };
21
27
  }>) => import("vue").VNode & {
22
28
  __ctx?: Awaited<typeof __VLS_setup>;
23
29
  };
@@ -19,10 +19,6 @@ export interface MultiSelectColumnFilter {
19
19
  export interface ToggleColumnFilter {
20
20
  type: 'toggle';
21
21
  label: string;
22
- trueLabel?: string;
23
- falseLabel?: string;
24
- trueValue: any;
25
- falseValue: any;
26
22
  description?: string;
27
23
  }
28
24
  export interface TableColumn<T extends TableRow, K = keyof T> {
@@ -1,9 +1,69 @@
1
- import { type Ref } from "vue";
2
- export interface UseFilteringReturn<T extends Record<string, any> = Record<string, any>> {
3
- filters: Ref<T>;
1
+ import { Reactive, type Ref } from "vue";
2
+ export type FilterLocationQueryValueRaw = string | number;
3
+ /**
4
+ * Query representation for filtering, compatible with vue-router
5
+ */
6
+ export type FilterLocationQuery = {
7
+ [p: string]: string | null | number | undefined | FilterLocationQueryValueRaw[];
8
+ };
9
+ export interface FilteringOptions {
10
+ syncWith?: Ref<{
11
+ [p: string]: string | null | (string | null)[] | undefined;
12
+ }>;
13
+ }
14
+ /**
15
+ * Represents a type that defines a set of filters for a given record type.
16
+ * The keys are based on the record, and the values are possible values
17
+ * for a filter.
18
+ */
19
+ export type FiltersForRecord<T extends object, F extends {
20
+ [K in keyof T]?: any;
21
+ }> = {
22
+ [K in keyof T]?: T[K] extends string | number | boolean | undefined | null ? T[K] | string | string[] : T[K] extends string[] | number[] ? T[K][] : never;
23
+ };
24
+ /**
25
+ * Represents the return type of a composition function used for handling
26
+ * filtering logic in a data structure.
27
+ */
28
+ export interface UseFilteringReturn<T extends Record<string, any> = Record<string, any>, F extends {
29
+ [K in keyof T]?: any;
30
+ } = Record<keyof T, any>> {
31
+ filters: Reactive<F>;
4
32
  isFiltered: Ref<boolean>;
5
33
  clearFilters: () => void;
6
- filteredColumns: Ref<Record<keyof T, boolean>>;
34
+ filteredColumns: Ref<Partial<Record<keyof T, boolean>>>;
7
35
  }
36
+ /**
37
+ * Returns the value if it's not empty, or undefined if it's empty.
38
+ */
39
+ export declare function emptyAsUndefined<T extends string | number | boolean | string[] | number[] | undefined | null>(value: T): (T & {}) | undefined;
40
+ export declare function filterOmitEmpty<T extends object>(value: T): Partial<T>;
41
+ /**
42
+ * Return a value as an array if it's not already one, or
43
+ * undefined if it's undefined.
44
+ */
45
+ export declare function asArray<T>(value: T | T[]): NonNullable<T>[] | undefined;
46
+ /**
47
+ * Converts filter criteria into a format suitable for use as a query object
48
+ * in vue-router.
49
+ */
50
+ export declare function filterAsQuery<T extends Record<string, any>, F extends {
51
+ [K in keyof T]?: any;
52
+ } = Record<keyof T, any>>(filters: FiltersForRecord<T, F>): FilterLocationQuery;
53
+ /**
54
+ * Converts an object of filters into a query parameters object for API calls.
55
+ *
56
+ * Transforms the values into strings or arrays of strings. Excludes fields with undefined,
57
+ * null, empty string, or false values. Supports single values and arrays.
58
+ */
8
59
  export declare function filtersToQueryParams<T extends Record<string, any>>(filters: T): Record<keyof T, string | string[]>;
9
- export declare function useFiltering<T extends Record<string, any>>(filters: T): UseFilteringReturn<T>;
60
+ /**
61
+ * Provides a mechanism to manage and synchronize filterable data with given filters and options.
62
+ *
63
+ * @param filters An object that defines the filters applicable to the data record.
64
+ * @param options Configuration options for filtering, such as synchronization.
65
+ * @return Returns an object that can be used with GTable.
66
+ */
67
+ export declare function useFiltering<T extends Record<string, any> = Record<string, any>, F extends {
68
+ [K in keyof T]?: any;
69
+ } = Record<keyof T, any>>(filters: F, options?: FilteringOptions): UseFilteringReturn<T, F>;
@@ -1,7 +1,4 @@
1
- import type { DirectiveBinding } from "vue";
2
- declare const VGtooltip: {
3
- mounted(el: HTMLElement, binding: DirectiveBinding): void;
4
- updated(el: HTMLElement, binding: DirectiveBinding): void;
5
- unmounted(el: HTMLElement): void;
6
- };
1
+ import type { Directive } from "vue";
2
+ export type VGtooltipDirective = Directive<HTMLElement, string>;
3
+ declare const VGtooltip: VGtooltipDirective;
7
4
  export default VGtooltip;