@etsoo/materialui 1.0.68 → 1.0.69
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/lib/AuditDisplay.d.ts
CHANGED
|
@@ -10,6 +10,14 @@ export interface AuditDisplayProps extends Omit<ListMoreDisplayProps<AuditLineDt
|
|
|
10
10
|
* Get list item style callback
|
|
11
11
|
*/
|
|
12
12
|
getItemStyle?: (index: number, theme: Theme) => CSSProperties;
|
|
13
|
+
/**
|
|
14
|
+
* Get column label
|
|
15
|
+
*/
|
|
16
|
+
getColumnLabel?: (field: string) => string;
|
|
17
|
+
/**
|
|
18
|
+
* Equal check
|
|
19
|
+
*/
|
|
20
|
+
equalCheck?: boolean;
|
|
13
21
|
/**
|
|
14
22
|
* Item/line renderer
|
|
15
23
|
*/
|
package/lib/AuditDisplay.js
CHANGED
|
@@ -31,10 +31,10 @@ export function AuditDisplay(props) {
|
|
|
31
31
|
background: index % 2 === 0
|
|
32
32
|
? theme.palette.grey[100]
|
|
33
33
|
: theme.palette.grey[50]
|
|
34
|
-
}), itemRenderer = (data) => {
|
|
34
|
+
}), getColumnLabel, equalCheck, itemRenderer = (data) => {
|
|
35
35
|
const { newData, oldData, changes = { newData: newData !== null && newData !== void 0 ? newData : {}, oldData: oldData !== null && oldData !== void 0 ? oldData : {} } } = data;
|
|
36
36
|
return (React.createElement(React.Fragment, null,
|
|
37
|
-
changes != null && (React.createElement(Button, { variant: "outlined", size: "small", onClick: () => ShowDataComparison(changes, title), sx: {
|
|
37
|
+
changes != null && (React.createElement(Button, { variant: "outlined", size: "small", onClick: () => ShowDataComparison(changes, title, getColumnLabel, equalCheck), sx: {
|
|
38
38
|
marginLeft: theme.spacing(1),
|
|
39
39
|
marginTop: theme.spacing(-0.5),
|
|
40
40
|
float: 'right'
|
|
@@ -10,5 +10,6 @@ export declare function IsAuditLineUpdateData(obj: any): obj is AuditLineChanges
|
|
|
10
10
|
* @param data Data
|
|
11
11
|
* @param modelTitle Model window title
|
|
12
12
|
* @param getLabel Get label callback
|
|
13
|
+
* @param equalCheck Equal check for properties
|
|
13
14
|
*/
|
|
14
|
-
export declare const ShowDataComparison: (data: AuditLineChangesDto, modelTitle?: string, getLabel?: ((field: string) => string) | undefined) => void;
|
|
15
|
+
export declare const ShowDataComparison: (data: AuditLineChangesDto, modelTitle?: string, getLabel?: ((field: string) => string) | undefined, equalCheck?: boolean) => void;
|
|
@@ -28,8 +28,9 @@ const formatValue = (value, app) => {
|
|
|
28
28
|
* @param data Data
|
|
29
29
|
* @param modelTitle Model window title
|
|
30
30
|
* @param getLabel Get label callback
|
|
31
|
+
* @param equalCheck Equal check for properties
|
|
31
32
|
*/
|
|
32
|
-
export const ShowDataComparison = (data, modelTitle, getLabel) => {
|
|
33
|
+
export const ShowDataComparison = (data, modelTitle, getLabel, equalCheck = true) => {
|
|
33
34
|
modelTitle !== null && modelTitle !== void 0 ? modelTitle : (modelTitle = globalApp.get('dataComparison'));
|
|
34
35
|
getLabel !== null && getLabel !== void 0 ? getLabel : (getLabel = (key) => {
|
|
35
36
|
var _a;
|
|
@@ -39,11 +40,13 @@ export const ShowDataComparison = (data, modelTitle, getLabel) => {
|
|
|
39
40
|
...Object.keys(data.oldData),
|
|
40
41
|
...Object.keys(data.newData)
|
|
41
42
|
]);
|
|
42
|
-
|
|
43
|
+
let rows = Array.from(keys).map((field) => ({
|
|
43
44
|
field,
|
|
44
45
|
oldValue: data.oldData[field],
|
|
45
46
|
newValue: data.newData[field]
|
|
46
47
|
}));
|
|
48
|
+
if (equalCheck)
|
|
49
|
+
rows = rows.filter((item) => !Utils.equals(item.oldValue, item.newValue));
|
|
47
50
|
const inputs = (React.createElement(Table, null,
|
|
48
51
|
React.createElement(TableHead, null,
|
|
49
52
|
React.createElement(TableRow, null,
|
package/package.json
CHANGED
package/src/AuditDisplay.tsx
CHANGED
|
@@ -16,6 +16,16 @@ export interface AuditDisplayProps
|
|
|
16
16
|
*/
|
|
17
17
|
getItemStyle?: (index: number, theme: Theme) => CSSProperties;
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Get column label
|
|
21
|
+
*/
|
|
22
|
+
getColumnLabel?: (field: string) => string;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Equal check
|
|
26
|
+
*/
|
|
27
|
+
equalCheck?: boolean;
|
|
28
|
+
|
|
19
29
|
/**
|
|
20
30
|
* Item/line renderer
|
|
21
31
|
*/
|
|
@@ -54,6 +64,8 @@ export function AuditDisplay(props: AuditDisplayProps) {
|
|
|
54
64
|
? theme.palette.grey[100]
|
|
55
65
|
: theme.palette.grey[50]
|
|
56
66
|
}),
|
|
67
|
+
getColumnLabel,
|
|
68
|
+
equalCheck,
|
|
57
69
|
itemRenderer = (data) => {
|
|
58
70
|
const {
|
|
59
71
|
newData,
|
|
@@ -66,7 +78,14 @@ export function AuditDisplay(props: AuditDisplayProps) {
|
|
|
66
78
|
<Button
|
|
67
79
|
variant="outlined"
|
|
68
80
|
size="small"
|
|
69
|
-
onClick={() =>
|
|
81
|
+
onClick={() =>
|
|
82
|
+
ShowDataComparison(
|
|
83
|
+
changes,
|
|
84
|
+
title,
|
|
85
|
+
getColumnLabel,
|
|
86
|
+
equalCheck
|
|
87
|
+
)
|
|
88
|
+
}
|
|
70
89
|
sx={{
|
|
71
90
|
marginLeft: theme.spacing(1),
|
|
72
91
|
marginTop: theme.spacing(-0.5),
|
|
@@ -38,11 +38,13 @@ const formatValue = (value: unknown, app: IApp) => {
|
|
|
38
38
|
* @param data Data
|
|
39
39
|
* @param modelTitle Model window title
|
|
40
40
|
* @param getLabel Get label callback
|
|
41
|
+
* @param equalCheck Equal check for properties
|
|
41
42
|
*/
|
|
42
43
|
export const ShowDataComparison = (
|
|
43
44
|
data: AuditLineChangesDto,
|
|
44
45
|
modelTitle?: string,
|
|
45
|
-
getLabel?: (field: string) => string
|
|
46
|
+
getLabel?: (field: string) => string,
|
|
47
|
+
equalCheck: boolean = true
|
|
46
48
|
) => {
|
|
47
49
|
modelTitle ??= globalApp.get<string>('dataComparison');
|
|
48
50
|
getLabel ??= (key) => {
|
|
@@ -54,12 +56,17 @@ export const ShowDataComparison = (
|
|
|
54
56
|
...Object.keys(data.newData)
|
|
55
57
|
]);
|
|
56
58
|
|
|
57
|
-
|
|
59
|
+
let rows = Array.from(keys).map((field) => ({
|
|
58
60
|
field,
|
|
59
61
|
oldValue: data.oldData[field],
|
|
60
62
|
newValue: data.newData[field]
|
|
61
63
|
}));
|
|
62
64
|
|
|
65
|
+
if (equalCheck)
|
|
66
|
+
rows = rows.filter(
|
|
67
|
+
(item) => !Utils.equals(item.oldValue, item.newValue)
|
|
68
|
+
);
|
|
69
|
+
|
|
63
70
|
const inputs = (
|
|
64
71
|
<Table>
|
|
65
72
|
<TableHead>
|