@simoncomputing/mui-bueno-v2 0.25.12 → 0.25.14
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 +17 -0
- package/dist/components/Form/Inputs/CitationField/CitationManager/CitationTable.d.ts +5 -0
- package/dist/components/Table/DiffTable/DiffTable.d.ts +10 -44
- package/dist/components/Table/DiffTable/DiffTableView/DiffTableView.d.ts +16 -0
- package/dist/components/Table/DiffTable/utils.d.ts +64 -0
- package/dist/index.cjs.js +97 -97
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +2713 -2695
- package/dist/index.umd.js +98 -98
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,23 @@ 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.14] - 2026-02-23
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- `DiffTableView`
|
|
19
|
+
- used to display array of `DiffObj<T>`
|
|
20
|
+
- Utility functions
|
|
21
|
+
- `baseCitationTableColumns` - builds column definition for Citation table
|
|
22
|
+
- `buildTableDiff` - calculates diff definitions for table
|
|
23
|
+
|
|
24
|
+
## [0.25.13] - 2026-02-20
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- `DiffTable`, `DiffCitationTable`
|
|
29
|
+
- Fixed deletions being labeled as additions
|
|
30
|
+
|
|
14
31
|
## [0.25.12] - 2026-02-19
|
|
15
32
|
|
|
16
33
|
### Added
|
|
@@ -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,51 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
32
|
-
*
|
|
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'>;
|