@simoncomputing/mui-bueno-v2 0.25.13 → 0.25.15

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/CHANGELOG.md CHANGED
@@ -11,6 +11,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
  - Minor increment --> singlular/minor changes. Minimal breaking changes.
12
12
  - Patch increment --> singlular/minor changes. Zero breaking changes.
13
13
 
14
+ ## [0.25.15] - 2026-02-23
15
+
16
+ ### Added
17
+
18
+ - `SelectableCitationManager`
19
+ - Added `getSelectedCitationsPaginated` prop which, when implemented, only shows selected citations when `readOnly` is true. This is to improve the user experience by hiding superfluous data from the user, such as uninteractable checkboxes & unselected citations.
20
+
21
+ - `SelectableCitationManager`/`CitationManager`
22
+ - Added `tableTitle` prop which, when defined, will override the table's title (default "Attachments & Citations")
23
+
24
+ ### Removed
25
+
26
+ - `DiffCitationTable`
27
+ - Use `DiffTable` with `baseCitationTableColumns` for column definition
28
+
29
+ ## [0.25.14] - 2026-02-23
30
+
31
+ ### Added
32
+
33
+ - `DiffTableView`
34
+ - used to display array of `DiffObj<T>`
35
+ - Utility functions
36
+ - `baseCitationTableColumns` - builds column definition for Citation table
37
+ - `buildTableDiff` - calculates diff definitions for table
38
+
14
39
  ## [0.25.13] - 2026-02-20
15
40
 
16
41
  ### Fixed
@@ -74,10 +74,19 @@ export type BaseCitationManagerProps = BaseCitationManagerApiProps & {
74
74
  */
75
75
  onError?: (err: any) => void;
76
76
  /**
77
- * When true, the table will be rendered for pop-ups with the ability to select citations from the table.
78
- * When false, teh table will be rendered as a basic paginated table with all columns displayed.
77
+ * When true, the table will be rendered for pop-ups (limited columns displayed, close button at top, etc).
78
+ * When false, the table will be rendered as a basic paginated table with all columns displayed.
79
79
  */
80
- renderAsSelectablePopup?: boolean;
80
+ renderAsPopup?: boolean;
81
+ /**
82
+ * When true, the table will show the checkbox column and allow user to choose citations.
83
+ * When false, the table will not show the checkbox column.
84
+ */
85
+ canSelect?: boolean;
86
+ /**
87
+ * If provided, overrides the default title of the table
88
+ */
89
+ tableTitle?: string;
81
90
  /**
82
91
  * Additional actions to be displayed for each row. Will be inserted in between Download (if applicable) and Edit button.
83
92
  */
@@ -108,5 +117,5 @@ export declare enum CitationManagerState {
108
117
  *
109
118
  * For in-line citations, see CitationField instead.
110
119
  */
111
- export declare function BaseCitationManager({ getCitationsPaginated, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, onDownloadAttachment, onViewAttachment, onSelectCitations, onCancel, initialSelectedIds, onContentChange, onError, renderAsSelectablePopup, addlActions, canLaunchUrl, readOnly, }: BaseCitationManagerProps): import("react/jsx-runtime").JSX.Element;
120
+ export declare function BaseCitationManager({ getCitationsPaginated, onCreateCitation, onUpdateCitation, onDeleteCitation, getCitationById, onDownloadAttachment, onViewAttachment, onSelectCitations, onCancel, initialSelectedIds, onContentChange, onError, renderAsPopup, canSelect, tableTitle, addlActions, canLaunchUrl, readOnly, }: BaseCitationManagerProps): import("react/jsx-runtime").JSX.Element;
112
121
  export default BaseCitationManager;
@@ -1,5 +1,5 @@
1
1
  import { BaseCitationManagerProps } from './BaseCitationManager';
2
- export type CitationManagerProps = Omit<BaseCitationManagerProps, 'initialSelectedIds' | 'onSelectCitations' | 'onCancel' | 'onContentChange' | 'renderAsSelectablePopup'>;
2
+ export type CitationManagerProps = Omit<BaseCitationManagerProps, 'initialSelectedIds' | 'onSelectCitations' | 'onCancel' | 'onContentChange' | 'renderAsPopup' | 'canSelect'>;
3
3
  /**
4
4
  * CitationManager is a basic table that handles creating, updating, and deleting citations.
5
5
  */
@@ -73,6 +73,11 @@ export type CitationTableProps = Omit<BaseCitationManagerApiProps, 'onCreateCita
73
73
  };
74
74
  declare const CitationTable: (props: CitationTableProps) => import("react/jsx-runtime").JSX.Element;
75
75
  export default CitationTable;
76
+ /**
77
+ * Column definition for the Citation table.
78
+ *
79
+ * Used by `CitationManager`, `SelectableCitationManager`, `CitationField`, `DiffCitationTable`.
80
+ */
76
81
  export declare const baseCitationTableColumns: (palette: Palette, condenseTable?: boolean) => ({
77
82
  fieldName: string;
78
83
  key: string;
@@ -1,9 +1,15 @@
1
+ import { Citation, PageResponse, PageState } from '../../../../../@types';
1
2
  import { BaseCitationManagerProps } from './BaseCitationManager';
2
- export type SelectableCitationManagerProps = Omit<BaseCitationManagerProps, 'renderAsSelectablePopup'>;
3
+ export type SelectableCitationManagerProps = Omit<BaseCitationManagerProps, 'renderAsSelectablePopup'> & {
4
+ /**
5
+ *
6
+ */
7
+ getSelectedCitationsPaginated?: (req: PageState) => Promise<PageResponse<Citation>>;
8
+ };
3
9
  /**
4
10
  * SelectableCitationManager is a condensed table that handles creating, updating, deleting and selecting citations.
5
11
  *
6
12
  * It's intended to be used in a pop-up/modal.
7
13
  */
8
- export declare function SelectableCitationManager({ ...rest }: SelectableCitationManagerProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare function SelectableCitationManager({ getSelectedCitationsPaginated, getCitationsPaginated, readOnly, tableTitle, ...rest }: SelectableCitationManagerProps): import("react/jsx-runtime").JSX.Element;
9
15
  export default SelectableCitationManager;
@@ -1,51 +1,17 @@
1
- import { ReactNode } from 'react';
2
- import { TableProps } from '../Table';
3
- import { DiffTableConfig } from '../../../@types';
4
- export type ChangeType = 'added' | 'deleted' | 'modified';
5
- export type DiffObj<T> = T & {
6
- changeType: ChangeType;
7
- modifiedDiff?: Record<string, ReactNode>;
8
- };
9
- export type TableDiff<T> = {
10
- changeType: ChangeType;
11
- obj: T;
12
- };
13
- export type DiffTableProps<T> = {
14
- beforeData: T[];
15
- afterData: T[];
16
- /**
17
- * See Table.columns
18
- */
19
- columns: DiffTableConfig<T>;
20
- /**
21
- * Used to override the internal check for whether a row has been modified or not.
22
- *
23
- * It's highly recommended to implement this when `renderExpand` is implemented, especially
24
- * if ignoreDiff is enabled on all columns.
25
- */
26
- isEqual?: (obj1: T, obj2: T) => boolean;
27
- } & Pick<TableProps<T>, 'renderExpand' | 'emptyTableMsg' | 'size'>;
1
+ import { BaseDiffTableProps, DiffTableInput } from './utils';
2
+ export type DiffTableProps<T> = BaseDiffTableProps<T> & Omit<DiffTableInput<T>, 'isMobileScreen'>;
28
3
  /**
29
- * Used to display changes (additions, modifications, removals) for a set of data.
4
+ * Convenience wrapper for DiffTableView. Computes changes (additions, modifications, removals) between 2 sets of
5
+ * data and displays the difference in a table. Data sets MUST be objects with an id property.
30
6
  *
31
- * Adds a new column (left) that denotes whether a row was added, changed or removed. Any unchanged
32
- * rows will be counted and displayed at the bottom, under the table.
7
+ * NOTE: If you already have computed the diff in your parent component and/or need access to the diff output, use `DiffTableView` instead.
8
+ *
9
+ * - A new column (left) that denotes whether a row was added, changed or removed.
10
+ * - Any unchanged rows will be counted and displayed at the bottom, under the table.
11
+ * - Updates cell render function to show diff notation for modified rows.
12
+ * - Updates renderExpand, if provided, to show diff notation for modified rows.
33
13
  *
34
- * Data sets MUST be objects with an id property.
35
14
  */
36
15
  export declare const DiffTable: <T extends {
37
16
  id: number;
38
17
  }>(props: DiffTableProps<T>) => import("react/jsx-runtime").JSX.Element;
39
- /**
40
- * Returns an array of only the Added/Modified/Deleted objects between dataA & dataB (with each
41
- * object marked as Added/Modified/Deleted), AND a count of the number of unchanged objects in both
42
- * dataA & dataB.
43
- *
44
- * IMPORTANT: Data arrays (dataA & dataB) must contain objects with a valid id.
45
- */
46
- export declare const buildDiffData: <T extends {
47
- id: number;
48
- }>(columns: DiffTableConfig<T>, dataA: T[], dataB: T[], isMobileScreen?: boolean, isEqual?: (obj1: T, obj2: T) => boolean) => {
49
- dataDiff: DiffObj<T>[];
50
- unmodifiedCount: number;
51
- };
@@ -0,0 +1,16 @@
1
+ import { BaseDiffTableProps, DiffTableOutput } from '../utils';
2
+ export type DiffTableViewProps<T> = BaseDiffTableProps<T> & DiffTableOutput<T>;
3
+ /**
4
+ * Used to display an array of DiffObj<T> (additions, modifications, removals).
5
+ * NOTE: If possible, use the convenience wrapper `DiffTable` instead. Only use this
6
+ * component if you need to compute the diff yourself, or you need to access the data, unmodifiedCount, etc.
7
+ *
8
+ * Once the diff is computed, the following table will be displayed:
9
+ * - A new column (left) that denotes whether a row was added, changed or removed.
10
+ * - Any unchanged rows will be counted and displayed at the bottom, under the table.
11
+ * - Updates cell render function to show diff notation for modified rows.
12
+ * - Updates renderExpand, if provided, to show diff notation for modified rows.
13
+ */
14
+ export declare const DiffTableView: <T extends {
15
+ id: number;
16
+ }>({ columns, data, emptyTableMsg, renderExpand, size, unmodifiedCount, }: DiffTableViewProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,64 @@
1
+ import { DiffTableConfig } from '../../../@types';
2
+ import { SvgIcon } from '@mui/material';
3
+ import { ReactNode } from 'react';
4
+ import { TableProps } from '../Table';
5
+ export type ChangeType = 'added' | 'deleted' | 'modified';
6
+ export type DiffObj<T> = T & {
7
+ changeType: ChangeType;
8
+ modifiedDiff?: Record<string, ReactNode>;
9
+ };
10
+ export type TableDiff<T> = {
11
+ changeType: ChangeType;
12
+ obj: T;
13
+ };
14
+ export declare const ChangeMap: {
15
+ [key: string]: {
16
+ icon: typeof SvgIcon;
17
+ label: string;
18
+ color: 'success' | 'error' | 'info';
19
+ };
20
+ };
21
+ /**
22
+ * Returns an array of only the Added/Modified/Deleted objects between dataA & dataB (with each
23
+ * object marked as Added/Modified/Deleted), AND a count of the number of unchanged objects in both
24
+ * dataA & dataB.
25
+ *
26
+ * IMPORTANT: Data arrays (dataA & dataB) must contain objects with a valid id.
27
+ */
28
+ export declare const buildDiffData: <T extends {
29
+ id: number;
30
+ }>(columns: DiffTableConfig<T>, dataA: T[], dataB: T[], isMobileScreen?: boolean, isEqual?: (obj1: T, obj2: T) => boolean) => {
31
+ dataDiff: DiffObj<T>[];
32
+ unmodifiedCount: number;
33
+ };
34
+ export type DiffTableInput<T> = {
35
+ beforeData: T[];
36
+ afterData: T[];
37
+ /**
38
+ * See Table.columns
39
+ */
40
+ columns: DiffTableConfig<T>;
41
+ /**
42
+ * Used to override the internal check for whether a row has been modified or not.
43
+ *
44
+ * It's highly recommended to implement this when `renderExpand` is implemented, especially
45
+ * if ignoreDiff is enabled on all columns.
46
+ */
47
+ isEqual?: (obj1: T, obj2: T) => boolean;
48
+ isMobileScreen?: boolean;
49
+ } & Pick<TableProps<T>, 'renderExpand' | 'size'>;
50
+ export type DiffTableOutput<T> = {
51
+ unmodifiedCount: number;
52
+ columns: DiffTableConfig<T>;
53
+ data: DiffObj<T>[];
54
+ renderExpand?: (item: DiffObj<T>) => React.ReactNode;
55
+ };
56
+ /**
57
+ * Converts regular table props into diff version (adds Change Type column, updates render and renderExpand to use diff notation)
58
+ *
59
+ * Used by `DiffTable`, `DiffCitationTable`.
60
+ */
61
+ export declare const buildTableDiff: <T extends {
62
+ id: number;
63
+ }>(props: DiffTableInput<T>) => DiffTableOutput<T>;
64
+ export type BaseDiffTableProps<T> = Pick<TableProps<T>, 'emptyTableMsg' | 'size'>;