@talxis/base-controls 1.2410.5 → 1.2411.1
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/dist/components/DatasetControl/DatasetControl.js +5 -3
- package/dist/components/DatasetControl/DatasetControl.js.map +1 -1
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/Grid/core/components/AgGrid/AgGrid.d.ts +2 -0
- package/dist/components/Grid/core/components/AgGrid/AgGrid.js +141 -27
- package/dist/components/Grid/core/components/AgGrid/AgGrid.js.map +1 -1
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.js +3 -4
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/LoadingOverlay.js.map +1 -1
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.js +19 -7
- package/dist/components/Grid/core/components/AgGrid/model/AgGrid.js.map +1 -1
- package/dist/components/Grid/core/components/Cell/EditableCell/EditableCell.d.ts +3 -3
- package/dist/components/Grid/core/components/Cell/EditableCell/EditableCell.js +32 -96
- package/dist/components/Grid/core/components/Cell/EditableCell/EditableCell.js.map +1 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/Notifications/Notifications.js +23 -22
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/Notifications/Notifications.js.map +1 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.js +41 -36
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.js.map +1 -1
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/styles.d.ts +5 -0
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/styles.js +21 -3
- package/dist/components/Grid/core/components/Cell/ReadOnlyCell/styles.js.map +1 -1
- package/dist/components/Grid/core/components/ColumnHeader/styles.d.ts +2 -0
- package/dist/components/Grid/core/components/ColumnHeader/styles.js +2 -0
- package/dist/components/Grid/core/components/ColumnHeader/styles.js.map +1 -1
- package/dist/components/Grid/core/components/Component/Component.d.ts +2 -2
- package/dist/components/Grid/core/components/Component/Component.js.map +1 -1
- package/dist/components/Grid/core/components/Component/model/Component.d.ts +1 -0
- package/dist/components/Grid/core/components/Component/model/Component.js +57 -20
- package/dist/components/Grid/core/components/Component/model/Component.js.map +1 -1
- package/dist/components/Grid/core/components/Save/Save.js +33 -20
- package/dist/components/Grid/core/components/Save/Save.js.map +1 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.d.ts +5 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.js +46 -15
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/ChangeEditor.js.map +1 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/ChangeGrid.d.ts +10 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/ChangeGrid.js +187 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/ChangeGrid.js.map +1 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/styles.d.ts +39 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/styles.js +45 -0
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/ChangeGrid/styles.js.map +1 -0
- package/dist/components/Grid/core/components/Save/styles.d.ts +2 -4
- package/dist/components/Grid/core/components/Save/styles.js +2 -4
- package/dist/components/Grid/core/components/Save/styles.js.map +1 -1
- package/dist/components/Grid/core/controllers/useGridController.js +2 -2
- package/dist/components/Grid/core/controllers/useGridController.js.map +1 -1
- package/dist/components/Grid/core/model/Grid.d.ts +1 -2
- package/dist/components/Grid/core/model/Grid.js +11 -9
- package/dist/components/Grid/core/model/Grid.js.map +1 -1
- package/dist/components/Grid/core/services/KeyListener.d.ts +2 -0
- package/dist/components/Grid/core/services/KeyListener.js +6 -0
- package/dist/components/Grid/core/services/KeyListener.js.map +1 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.js +0 -2
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionOperator/ConditionOperator.js.map +1 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.js +45 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/ConditionValue.js.map +1 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.js +4 -1
- package/dist/components/Grid/filtering/components/FilterCallout/components/ConditionValue/model/ConditionComponentValue.js.map +1 -1
- package/dist/components/Grid/filtering/model/Condition.js +19 -4
- package/dist/components/Grid/filtering/model/Condition.js.map +1 -1
- package/dist/components/Grid/interfaces.d.ts +4 -1
- package/dist/components/Grid/paging/components/Paging/Paging.js +6 -5
- package/dist/components/Grid/paging/components/Paging/Paging.js.map +1 -1
- package/dist/components/Grid/translations.d.ts +36 -0
- package/dist/components/Grid/translations.js +11 -2
- package/dist/components/Grid/translations.js.map +1 -1
- package/dist/components/TextField/TextField.js +14 -5
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/hooks/useControl.js +2 -2
- package/dist/hooks/useControl.js.map +1 -1
- package/dist/hooks/useRerender.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/package.json +4 -4
- package/dist/components/DatasetControl/hooks/useRerender.js.map +0 -1
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/styles.d.ts +0 -44
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/styles.js +0 -82
- package/dist/components/Grid/core/components/AgGrid/components/LoadingOverlay/styles.js.map +0 -1
- package/dist/components/Grid/core/components/AgGrid/controllers/useAgGridController.d.ts +0 -20
- package/dist/components/Grid/core/components/AgGrid/controllers/useAgGridController.js +0 -173
- package/dist/components/Grid/core/components/AgGrid/controllers/useAgGridController.js.map +0 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.d.ts +0 -7
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.js +0 -144
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/RecordGrids.js.map +0 -1
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.d.ts +0 -48
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.js +0 -54
- package/dist/components/Grid/core/components/Save/components/ChangeEditor/components/RecordGrids/styles.js.map +0 -1
- package/dist/components/Grid/core/components/Save/hooks/useSave.d.ts +0 -12
- package/dist/components/Grid/core/components/Save/hooks/useSave.js +0 -45
- package/dist/components/Grid/core/components/Save/hooks/useSave.js.map +0 -1
- package/dist/components/Grid/core/constants.d.ts +0 -1
- package/dist/components/Grid/core/constants.js +0 -4
- package/dist/components/Grid/core/constants.js.map +0 -1
- package/dist/components/Grid/core/hooks/useRerender.d.ts +0 -1
- package/dist/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.d.ts +0 -14
- package/dist/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.js +0 -25
- package/dist/components/Grid/core/services/RecordUpdateService/controllers/useRecordUpdateServiceController.js.map +0 -1
- package/dist/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.d.ts +0 -30
- package/dist/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.js +0 -186
- package/dist/components/Grid/core/services/RecordUpdateService/model/RecordUpdateService.js.map +0 -1
- package/dist/components/Grid/validation/controllers/useRecordValidationController.d.ts +0 -8
- package/dist/components/Grid/validation/controllers/useRecordValidationController.js +0 -25
- package/dist/components/Grid/validation/controllers/useRecordValidationController.js.map +0 -1
- package/dist/components/Grid/validation/model/ColumnValidation.d.ts +0 -11
- package/dist/components/Grid/validation/model/ColumnValidation.js +0 -90
- package/dist/components/Grid/validation/model/ColumnValidation.js.map +0 -1
- /package/dist/{components/DatasetControl/hooks → hooks}/useRerender.d.ts +0 -0
- /package/dist/{components/DatasetControl/hooks → hooks}/useRerender.js +0 -0
|
@@ -1,122 +1,55 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
2
|
import { DataType } from '../../../enums/DataType.js';
|
|
4
|
-
import { useGridInstance } from '../../../hooks/useGridInstance.js';
|
|
5
|
-
import { useRecordUpdateServiceController } from '../../../services/RecordUpdateService/controllers/useRecordUpdateServiceController.js';
|
|
6
3
|
import { Component } from '../../Component/Component.js';
|
|
4
|
+
import { useGridInstance } from '../../../hooks/useGridInstance.js';
|
|
5
|
+
import { useRerender } from '../../../../../../hooks/useRerender.js';
|
|
7
6
|
|
|
8
|
-
const EditableCell = (
|
|
7
|
+
const EditableCell = (editableCellProps) => {
|
|
9
8
|
const grid = useGridInstance();
|
|
10
|
-
const column =
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const hasBeenUpdatedRef = React.useRef(false);
|
|
14
|
-
const record = (() => {
|
|
15
|
-
//this is so we can load the updated record values from state
|
|
16
|
-
const updatedRecord = grid.recordUpdateService.record(props.data.getRecordId()).get();
|
|
17
|
-
return updatedRecord ?? props.data;
|
|
18
|
-
})();
|
|
19
|
-
const valueRef = React.useRef(record.getValue(column.name));
|
|
20
|
-
const [value, setValue] = React.useState(valueRef.current);
|
|
21
|
-
React.useEffect(() => {
|
|
22
|
-
return () => {
|
|
23
|
-
mountedRef.current = false;
|
|
24
|
-
if (!hasBeenUpdatedRef.current) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
recordUpdateService.record(record.getRecordId()).setValue(column.name, getRecordValue(valueRef.current));
|
|
28
|
-
};
|
|
29
|
-
}, []);
|
|
30
|
-
const getComponentValue = (value) => {
|
|
31
|
-
//already is component value;
|
|
32
|
-
if (hasBeenUpdatedRef.current) {
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
switch (column.dataType) {
|
|
36
|
-
case DataType.TWO_OPTIONS: {
|
|
37
|
-
value = value === '1' ? true : false;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
case DataType.OPTIONSET: {
|
|
41
|
-
value = value ? parseInt(value) : null;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
case DataType.MULTI_SELECT_OPTIONSET: {
|
|
45
|
-
value = value ? value.split(',').map((value) => parseInt(value)) : null;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
case DataType.LOOKUP_SIMPLE:
|
|
49
|
-
case DataType.LOOKUP_CUSTOMER:
|
|
50
|
-
case DataType.LOOKUP_OWNER: {
|
|
51
|
-
if (value && !Array.isArray(value)) {
|
|
52
|
-
value = [value];
|
|
53
|
-
}
|
|
54
|
-
value = value?.map((x) => {
|
|
55
|
-
return {
|
|
56
|
-
entityType: x.etn,
|
|
57
|
-
id: x.id.guid,
|
|
58
|
-
name: x.name
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
return value;
|
|
65
|
-
};
|
|
66
|
-
//this is just so the setValue API in Power Apps accepts the values that come from the components
|
|
67
|
-
const getRecordValue = (value) => {
|
|
68
|
-
switch (column.dataType) {
|
|
69
|
-
case DataType.TWO_OPTIONS: {
|
|
70
|
-
value = value === true ? '1' : '0';
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
case DataType.LOOKUP_SIMPLE:
|
|
74
|
-
case DataType.LOOKUP_CUSTOMER:
|
|
75
|
-
case DataType.LOOKUP_OWNER: {
|
|
76
|
-
value = value?.map((x) => {
|
|
77
|
-
return {
|
|
78
|
-
entityName: x.entityType,
|
|
79
|
-
name: x.name,
|
|
80
|
-
id: x.id
|
|
81
|
-
};
|
|
82
|
-
})?.[0];
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return value;
|
|
87
|
-
};
|
|
9
|
+
const column = editableCellProps.baseColumn;
|
|
10
|
+
const record = editableCellProps.data;
|
|
11
|
+
const rerender = useRerender();
|
|
88
12
|
const onNotifyOutputChanged = (value) => {
|
|
89
|
-
valueRef.current = value;
|
|
90
|
-
hasBeenUpdatedRef.current = true;
|
|
91
|
-
if (!mountedRef.current) {
|
|
92
|
-
recordUpdateService.record(record.getRecordId()).setValue(column.name, getRecordValue(valueRef.current));
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
13
|
switch (column.dataType) {
|
|
96
14
|
case DataType.OPTIONSET:
|
|
97
|
-
case DataType.DATE_AND_TIME_DATE_ONLY:
|
|
98
|
-
|
|
99
|
-
|
|
15
|
+
case DataType.DATE_AND_TIME_DATE_ONLY:
|
|
16
|
+
case DataType.WHOLE_DURATION: {
|
|
17
|
+
editableCellProps.stopEditing();
|
|
18
|
+
break;
|
|
100
19
|
}
|
|
101
20
|
case DataType.LOOKUP_OWNER:
|
|
102
21
|
case DataType.LOOKUP_SIMPLE:
|
|
103
22
|
case DataType.LOOKUP_CUSTOMER: {
|
|
104
23
|
if (value?.length > 0) {
|
|
105
|
-
|
|
106
|
-
return;
|
|
24
|
+
editableCellProps.stopEditing();
|
|
107
25
|
}
|
|
26
|
+
break;
|
|
108
27
|
}
|
|
109
28
|
}
|
|
110
|
-
|
|
29
|
+
if (grid.parameters.EnableMultiEdit?.raw && grid.dataset.getSelectedRecordIds().includes(record.getRecordId())) {
|
|
30
|
+
const records = grid.records.filter(record => grid.dataset.getSelectedRecordIds().includes(record.getRecordId()));
|
|
31
|
+
records.map(record => setValue(record, value));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
setValue(record, value);
|
|
35
|
+
}
|
|
36
|
+
grid.pcfContext.factory.requestRender();
|
|
37
|
+
rerender();
|
|
38
|
+
};
|
|
39
|
+
const setValue = (record, value) => {
|
|
40
|
+
record.setValue(column.name, value);
|
|
41
|
+
editableCellProps.api.resetRowHeights();
|
|
111
42
|
};
|
|
112
|
-
return jsx(Component, { column: column,
|
|
43
|
+
return jsx(Component, { column: column, record: record, onNotifyOutputChanged: onNotifyOutputChanged, onOverrideControlProps: (props) => {
|
|
113
44
|
return {
|
|
114
45
|
...props,
|
|
115
46
|
context: {
|
|
116
47
|
...props.context,
|
|
117
48
|
mode: {
|
|
118
49
|
...props.context.mode,
|
|
119
|
-
allocatedHeight:
|
|
50
|
+
allocatedHeight: (() => {
|
|
51
|
+
return editableCellProps.node.rowHeight;
|
|
52
|
+
})()
|
|
120
53
|
},
|
|
121
54
|
fluentDesignLanguage: props.context.fluentDesignLanguage ? {
|
|
122
55
|
...props.context.fluentDesignLanguage,
|
|
@@ -136,6 +69,9 @@ const EditableCell = (props) => {
|
|
|
136
69
|
},
|
|
137
70
|
IsInlineNewEnabled: {
|
|
138
71
|
raw: false
|
|
72
|
+
},
|
|
73
|
+
EnableTypeSuffix: {
|
|
74
|
+
raw: false
|
|
139
75
|
}
|
|
140
76
|
}
|
|
141
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditableCell.js","sources":["../../../../../../../src/components/Grid/core/components/Cell/EditableCell/EditableCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { DataType } from '../../../enums/DataType';\nimport { useGridInstance } from '../../../hooks/useGridInstance';\nimport { IGridColumn } from '../../../interfaces/IGridColumn';\nimport { useRecordUpdateServiceController } from '../../../services/RecordUpdateService/controllers/useRecordUpdateServiceController';\nimport { Component } from '../../Component/Component';\nimport { ICellEditorParams } from '@ag-grid-community/core';\nimport { IRecord } from '@talxis/client-libraries';\n\ninterface ICell extends ICellEditorParams {\n baseColumn: IGridColumn;\n data: ComponentFramework.PropertyHelper.DataSetApi.EntityRecord;\n}\n\nexport const EditableCell = (props: ICell) => {\n const grid = useGridInstance();\n const column = props.baseColumn;\n const recordUpdateService = useRecordUpdateServiceController();\n const mountedRef = React.useRef(true);\n const hasBeenUpdatedRef = React.useRef<boolean>(false);\n const record: IRecord = (() => {\n //this is so we can load the updated record values from state\n const updatedRecord = grid.recordUpdateService.record(props.data.getRecordId()).get() as any;\n return updatedRecord ?? props.data;\n })();\n const valueRef = React.useRef(record.getValue(column.name));\n const [value, setValue] = React.useState(valueRef.current);\n\n React.useEffect(() => {\n return () => {\n mountedRef.current = false;\n if (!hasBeenUpdatedRef.current) {\n return;\n }\n recordUpdateService.record(record.getRecordId()).setValue(column.name, getRecordValue(valueRef.current))\n }\n }, []);\n\n const getComponentValue = (value: any) => {\n //already is component value;\n if(hasBeenUpdatedRef.current) {\n return value;\n }\n switch(column.dataType) {\n case DataType.TWO_OPTIONS: {\n value = value === '1' ? true : false\n break;\n }\n case DataType.OPTIONSET: {\n value = value ? parseInt(value) : null;\n break;\n\n }\n case DataType.MULTI_SELECT_OPTIONSET: {\n value = value ? value.split(',').map((value: string) => parseInt(value)) : null;\n break;\n }\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_CUSTOMER:\n case DataType.LOOKUP_OWNER: {\n if(value && !Array.isArray(value)) {\n value = [value];\n }\n value = value?.map((x: any) => {\n return {\n entityType: x.etn,\n id: x.id.guid,\n name: x.name\n }\n })\n break;\n }\n }\n return value;\n }\n //this is just so the setValue API in Power Apps accepts the values that come from the components\n const getRecordValue = (value: any) => {\n switch (column.dataType) {\n case DataType.TWO_OPTIONS: {\n value = value === true ? '1' : '0';\n break;\n }\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_CUSTOMER:\n case DataType.LOOKUP_OWNER: {\n value = value?.map((x: any) => {\n return {\n entityName: x.entityType,\n name: x.name,\n id: x.id\n }\n })?.[0];\n break;\n }\n }\n return value;\n }\n\n const onNotifyOutputChanged = (value: any) => {\n valueRef.current = value;\n hasBeenUpdatedRef.current = true;\n if(!mountedRef.current) {\n recordUpdateService.record(record.getRecordId()).setValue(column.name, getRecordValue(valueRef.current))\n return;\n }\n switch(column.dataType) {\n case DataType.OPTIONSET:\n case DataType.DATE_AND_TIME_DATE_ONLY: {\n props.stopEditing();\n return;\n }\n case DataType.LOOKUP_OWNER:\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_CUSTOMER: {\n if(value?.length > 0) {\n props.stopEditing();\n return;\n }\n }\n }\n setValue(valueRef.current);\n }\n\n return <Component\n column={column}\n value={getComponentValue(value)}\n formattedValue={record.getFormattedValue(column.name) ?? undefined}\n onNotifyOutputChanged={onNotifyOutputChanged}\n onOverrideControlProps={(props) => {\n return {\n ...props,\n context: {\n ...props.context,\n mode: {\n ...props.context.mode,\n allocatedHeight: 41\n },\n fluentDesignLanguage: props.context.fluentDesignLanguage ? {\n ...props.context.fluentDesignLanguage,\n tokenTheme: {\n ...props.context.fluentDesignLanguage.tokenTheme,\n underlined: false,\n }\n } : undefined\n },\n parameters: {\n ...props.parameters,\n AutoFocus: {\n raw: true\n },\n EnableNavigation: {\n raw: false\n },\n IsInlineNewEnabled: {\n raw: false\n }\n }\n }\n }}\n />\n}"],"names":["_jsx"],"mappings":";;;;;;;AAca,MAAA,YAAY,GAAG,CAAC,KAAY,KAAI;AACzC,IAAA,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;AAC/B,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC;AAChC,IAAA,MAAM,mBAAmB,GAAG,gCAAgC,EAAE,CAAC;IAC/D,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAU,KAAK,CAAC,CAAC;AACvD,IAAA,MAAM,MAAM,GAAY,CAAC,MAAK;;AAE1B,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,EAAS,CAAC;AAC7F,QAAA,OAAO,aAAa,IAAI,KAAK,CAAC,IAAI,CAAC;KACtC,GAAG,CAAC;AACL,IAAA,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5D,IAAA,MAAM,CAAC,KAAK,EA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AACrB,wBAAA,eAAe,EAAE,EAAE;AACtB,qBAAA;oBACD,oBAAoB,EAAE,KAAK,CAAC,OAAO,CAAC,oBAAoB,GAAG;AACvD,wBAAA,GAAG,KAAK,CAAC,OAAO,CAAC,oBAAoB;AACrC,wBAAA,UAAU,EAAE;AACR,4BAAA,GAAG,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,UAAU;AAChD,4BAAA,UAAU,EAAE,KAAK;AACpB,yBAAA;qBACJ,GAAG,SAAS;AAChB,iBAAA;AACD,gBAAA,UAAU,EAAE;oBACR,GAAG,KAAK,CAAC,UAAU;AACnB,oBAAA,SAAS,EAAE;AACP,wBAAA,GAAG,EAAE,IAAI;AACZ,qBAAA;AACD,oBAAA,gBAAgB,EAAE;AACd,wBAAA,GAAG,EAAE,KAAK;AACb,qBAAA;AACD,oBAAA,kBAAkB,EAAE;AAChB,wBAAA,GAAG,EAAE,KAAK;AACb,qBAAA;AACJ,iBAAA;aACJ,CAAA;AACL,SAAC,GACH,CAAA;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"EditableCell.js","sources":["../../../../../../../src/components/Grid/core/components/Cell/EditableCell/EditableCell.tsx"],"sourcesContent":["import { DataType } from '../../../enums/DataType';\nimport { IGridColumn } from '../../../interfaces/IGridColumn';\nimport { Component } from '../../Component/Component';\nimport { ICellEditorParams } from '@ag-grid-community/core';\nimport { IRecord } from '@talxis/client-libraries';\nimport { useGridInstance } from '../../../hooks/useGridInstance';\nimport { useRerender } from '../../../../../../hooks/useRerender';\n\ninterface ICell extends ICellEditorParams {\n baseColumn: IGridColumn;\n data: IRecord\n}\n\nexport const EditableCell = (editableCellProps: ICell) => {\n const grid = useGridInstance();\n const column = editableCellProps.baseColumn;\n const record = editableCellProps.data;\n const rerender = useRerender();\n\n const onNotifyOutputChanged = (value: any) => {\n switch(column.dataType) {\n case DataType.OPTIONSET:\n case DataType.DATE_AND_TIME_DATE_ONLY:\n case DataType.WHOLE_DURATION: {\n editableCellProps.stopEditing();\n break;\n }\n case DataType.LOOKUP_OWNER:\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_CUSTOMER: {\n if(value?.length > 0) {\n editableCellProps.stopEditing();\n }\n break;\n }\n }\n if(grid.parameters.EnableMultiEdit?.raw && grid.dataset.getSelectedRecordIds().includes(record.getRecordId())) {\n const records = grid.records.filter(record => grid.dataset.getSelectedRecordIds().includes(record.getRecordId()))\n records.map(record => setValue(record, value))\n }\n else {\n setValue(record, value)\n }\n grid.pcfContext.factory.requestRender();\n rerender();\n }\n\n const setValue = (record: IRecord, value: any) => {\n record.setValue(column.name, value);\n editableCellProps.api.resetRowHeights();\n }\n\n return <Component\n column={column}\n record={record}\n onNotifyOutputChanged={onNotifyOutputChanged}\n onOverrideControlProps={(props) => {\n return {\n ...props,\n context: {\n ...props.context,\n mode: {\n ...props.context.mode,\n allocatedHeight: (() => {\n return editableCellProps.node.rowHeight!\n })()\n },\n fluentDesignLanguage: props.context.fluentDesignLanguage ? {\n ...props.context.fluentDesignLanguage,\n tokenTheme: {\n ...props.context.fluentDesignLanguage.tokenTheme,\n underlined: false,\n }\n } : undefined\n },\n parameters: {\n ...props.parameters,\n AutoFocus: {\n raw: true\n },\n EnableNavigation: {\n raw: false\n },\n IsInlineNewEnabled: {\n raw: false\n },\n EnableTypeSuffix: {\n raw: false\n }\n }\n }\n }}\n />\n}"],"names":["_jsx"],"mappings":";;;;;;AAaa,MAAA,YAAY,GAAG,CAAC,iBAAwB,KAAI;AACrD,IAAA,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;AAC/B,IAAA,MAAM,MAAM,GAAG,iBAAiB,CAAC,UAAU,CAAC;AAC5C,IAAA,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC;AACtC,IAAA,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;AAE/B,IAAA,MAAM,qBAAqB,GAAG,CAAC,KAAU,KAAI;QACzC,QAAO,MAAM,CAAC,QAAQ;YAClB,KAAK,QAAQ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eAAe,EAAE,CAAC;AAC5C,KAAC,CAAA;IAED,OAAOA,GAAA,CAAC,SAAS,EACb,EAAA,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,qBAAqB,EAAE,qBAAqB,EAC5C,sBAAsB,EAAE,CAAC,KAAK,KAAI;YAC9B,OAAO;AACH,gBAAA,GAAG,KAAK;AACR,gBAAA,OAAO,EAAE;oBACL,GAAG,KAAK,CAAC,OAAO;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI;wBACrB,eAAe,EAAE,CAAC,MAAK;AACnB,4BAAA,OAAO,iBAAiB,CAAC,IAAI,CAAC,SAAU,CAAA;AAC5C,yBAAC,GAAG;AACP,qBAAA;oBACD,oBAAoB,EAAE,KAAK,CAAC,OAAO,CAAC,oBAAoB,GAAG;AACvD,wBAAA,GAAG,KAAK,CAAC,OAAO,CAAC,oBAAoB;AACrC,wBAAA,UAAU,EAAE;AACR,4BAAA,GAAG,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,UAAU;AAChD,4BAAA,UAAU,EAAE,KAAK;AACpB,yBAAA;qBACJ,GAAG,SAAS;AAChB,iBAAA;AACD,gBAAA,UAAU,EAAE;oBACR,GAAG,KAAK,CAAC,UAAU;AACnB,oBAAA,SAAS,EAAE;AACP,wBAAA,GAAG,EAAE,IAAI;AACZ,qBAAA;AACD,oBAAA,gBAAgB,EAAE;AACd,wBAAA,GAAG,EAAE,KAAK;AACb,qBAAA;AACD,oBAAA,kBAAkB,EAAE;AAChB,wBAAA,GAAG,EAAE,KAAK;AACb,qBAAA;AACD,oBAAA,gBAAgB,EAAE;AACd,wBAAA,GAAG,EAAE,KAAK;AACb,qBAAA;AACJ,iBAAA;aACJ,CAAA;AACL,SAAC,GACH,CAAA;AACN;;;;"}
|
package/dist/components/Grid/core/components/Cell/ReadOnlyCell/Notifications/Notifications.js
CHANGED
|
@@ -62,28 +62,29 @@ const Notifications = forwardRef((props, ref) => {
|
|
|
62
62
|
}
|
|
63
63
|
setSelectedNotification(notification);
|
|
64
64
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
65
|
+
const getCommandBarItem = (notification) => {
|
|
66
|
+
const icon = getIconName(notification);
|
|
67
|
+
return {
|
|
68
|
+
key: notification.uniqueId,
|
|
69
|
+
text: notification.title,
|
|
70
|
+
title: notification.title,
|
|
71
|
+
onClick: () => onNotificationClick(notification),
|
|
72
|
+
buttonStyles: {
|
|
73
|
+
textContainer: {
|
|
74
|
+
display: notification.compact ? 'none' : undefined
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
iconProps: notification ? {
|
|
78
|
+
iconName: icon,
|
|
79
|
+
styles: {
|
|
80
|
+
root: {
|
|
81
|
+
color: notification.notificationLevel === 'ERROR' ? `${theme.semanticColors.errorIcon} !important` : undefined
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
} : undefined
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
return jsxs("div", { className: `${styles.root}${props.className ? ` ${props.className}` : ''}`, children: [jsx(ThemeProvider, { theme: overridenTheme, applyTo: "none", children: jsx(CommandBar, { overflowItems: notifications.filter(x => x.renderedInOverflow).map(y => getCommandBarItem(y)), theme: overridenTheme, id: iconId, componentRef: commandBarRef, items: notifications.filter(x => !x.renderedInOverflow).map(y => getCommandBarItem(y)) }) }), selectedNotification &&
|
|
87
88
|
jsxs(Callout, { hidden: !selectedNotification, className: styles.callout, onDismiss: () => setSelectedNotification(null), target: `#${iconId}`, children: [selectedNotification.title &&
|
|
88
89
|
jsx(Text, { title: selectedNotification.title, className: styles.calloutTitle, variant: selectedNotification.messages.length > 0 ? 'xLarge' : undefined, children: selectedNotification.title }), jsx(Text, { children: selectedNotification.messages[0] }), selectedNotification.actions &&
|
|
89
90
|
renderActions(selectedNotification.actions)] })] });
|
package/dist/components/Grid/core/components/Cell/ReadOnlyCell/Notifications/Notifications.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notifications.js","sources":["../../../../../../../../src/components/Grid/core/components/Cell/ReadOnlyCell/Notifications/Notifications.tsx"],"sourcesContent":["import { Icon, useTheme, Text, Callout, PrimaryButton, DefaultButton, Link, ICommandBar, ThemeProvider } from \"@fluentui/react\"\nimport { getNotificationIconStyles } from \"./styles\";\nimport { forwardRef, useImperativeHandle, useMemo, useRef, useState } from \"react\";\nimport { IAddControlNotificationOptions, IControlNotificationAction } from \"@talxis/client-libraries\";\nimport { CommandBar } from \"@talxis/react-components\";\nimport { useThemeOverride } from \"../../../../../../../hooks/useThemeOverride\";\n\ninterface INotifications {\n notifications: IAddControlNotificationOptions[],\n className?: string;\n}\n\nexport interface INotificationsRef {\n remeasureCommandBar: () => void;\n}\n\n\nexport const Notifications = forwardRef<INotificationsRef, INotifications>((props, ref) => {\n const { notifications } = { ...props };\n const theme = useTheme();\n const styles = getNotificationIconStyles(theme);\n const iconId = useMemo(() => `icon${crypto.randomUUID()}`, []);\n const [selectedNotification, setSelectedNotification] = useState<IAddControlNotificationOptions | null>(null);\n const commandBarRef = useRef<ICommandBar>(null);\n const overridenTheme = useThemeOverride(theme.palette.themePrimary, 'transparent', theme.semanticColors.bodyText)\n\n useImperativeHandle(ref, () => {\n return {\n remeasureCommandBar: () => {\n commandBarRef.current?.remeasure();\n }\n }\n })\n\n const getIconName = (notification: IAddControlNotificationOptions): string | undefined => {\n if (notification.iconName) {\n return notification.iconName;\n }\n return notification.notificationLevel === 'ERROR' ? 'Error' : undefined;\n }\n\n const renderActionButton = (action: IControlNotificationAction, buttonType: 'primary' | 'default') => {\n const Button = buttonType === 'primary' ? PrimaryButton : DefaultButton;\n return <Button\n text={action.message}\n iconProps={action?.iconName ? {\n iconName: action.iconName\n } : undefined}\n onClick={() => action.actions.map(callback => callback())} />\n }\n\n const renderActions = (actions: IControlNotificationAction[]): JSX.Element => {\n if (actions.length === 0) {\n return <></>\n }\n //render actions as buttons\n if (actions.length < 3) {\n return <div className={styles.buttons}>\n {actions.map((action, i) => renderActionButton(action, i === 0 ? 'primary' : 'default'))}\n </div>\n }\n return <CommandBar items={actions.map((action, i) => {\n return {\n key: i.toString(),\n text: action.message,\n commandBarButtonAs: () => <Link onClick={() => action.actions.map(callback => callback())} className={styles.link}>\n {action.iconName &&\n <Icon iconName={action.iconName} />\n }\n {action.message}\n </Link>,\n iconProps: {\n iconName: action.iconName\n },\n onClick: () => {\n action.actions.map(callback => callback())\n }\n }\n })} />\n }\n\n const onNotificationClick = (notification: IAddControlNotificationOptions) => {\n if (notification.actions?.length === 1) {\n notification.actions[0].actions.map(callback => callback());\n return;\n }\n setSelectedNotification(notification);\n }\n\n return <div className={`${styles.root}${props.className ? ` ${props.className}` : ''}`}>\n <ThemeProvider theme={overridenTheme} applyTo=\"none\">\n <CommandBar theme={overridenTheme} id={iconId} componentRef={commandBarRef} items={notifications.map(x => {\n const icon = getIconName(x);\n return {\n key: x.uniqueId,\n text: x.title,\n title: x.title,\n onClick: () => onNotificationClick(x),\n buttonStyles: {\n textContainer: {\n display: x.compact ? 'none' : undefined\n }\n },\n iconProps: icon ? {\n iconName: icon,\n styles: {\n root: {\n color: x.notificationLevel === 'ERROR' ? `${theme.semanticColors.errorIcon} !important` : undefined\n }\n }\n } : undefined\n }\n })} />\n </ThemeProvider>\n {selectedNotification &&\n <Callout\n hidden={!selectedNotification}\n className={styles.callout}\n onDismiss={() => setSelectedNotification(null)}\n target={`#${iconId}`}>\n {selectedNotification.title &&\n <Text title={selectedNotification.title} className={styles.calloutTitle} variant={selectedNotification.messages.length > 0 ? 'xLarge' : undefined}>{selectedNotification.title}</Text>\n }\n <Text>{selectedNotification.messages[0]}</Text>\n {selectedNotification.actions &&\n renderActions(selectedNotification.actions)\n }\n </Callout>\n }\n </div>\n});"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;AAiBa,MAAA,aAAa,GAAG,UAAU,CAAoC,CAAC,KAAK,EAAE,GAAG,KAAI;IACtF,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;AACvC,IAAA,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AACzB,IAAA,MAAM,MAAM,GAAG,yBAAyB,CAAM,CAAC,CAAC;AAChD,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA,IAAA,EAAO,MAAM,CAAC,UAAU,EAAE,CAAA,CAAE,EAAE,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAAwC,IAAI,CAAC,CAAC;AAC9G,IAAA,MAAM,aAAa,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;AAChD,IAAA,MAAM,cAAc,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAA;AAEjH,IAAA,mBAAmB,CAAC,GAAG,EAAE,MAAK;QAC1B,OAAO;YACH,mBAAmB,EAAE,MAAK;AACtB,gBAAA,aAAa,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;aACtC;SACJ,CAAA;AACL,KAAC,CAAC,CAAA;AAEF,IAAA,MAAM,WAAW,GAAG,CAAC,YAA4C,KAAwB;QACrF,IAAI,YAAY,CAAC,QAAQ,EAAE;YACvB,OAAO,YAAY,CAAC,QAAQ,CAAC;AAChC,SAAA;AACD,QAAA,OAAO,YAAY,CAAC,iBAAiB,KAAK,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;AAC5E,KAAC,CAAA;AAED,IAAA,MAAM,kB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AAE,EAAA,QAAA,EAAA,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAQ,CAAA,EAC9C,oBAAoB,CAAC,OAAO;AACzB,4BAAA,aAAa,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA,EAAA,CAEzC,IAEZ,CAAA;AACV,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Notifications.js","sources":["../../../../../../../../src/components/Grid/core/components/Cell/ReadOnlyCell/Notifications/Notifications.tsx"],"sourcesContent":["import { Icon, useTheme, Text, Callout, PrimaryButton, DefaultButton, Link, ICommandBar, ThemeProvider } from \"@fluentui/react\"\nimport { getNotificationIconStyles } from \"./styles\";\nimport { forwardRef, useImperativeHandle, useMemo, useRef, useState } from \"react\";\nimport { IAddControlNotificationOptions, IControlNotificationAction } from \"@talxis/client-libraries\";\nimport { CommandBar } from \"@talxis/react-components\";\nimport { useThemeOverride } from \"../../../../../../../hooks/useThemeOverride\";\n\ninterface INotifications {\n notifications: IAddControlNotificationOptions[],\n className?: string;\n}\n\nexport interface INotificationsRef {\n remeasureCommandBar: () => void;\n}\n\n\nexport const Notifications = forwardRef<INotificationsRef, INotifications>((props, ref) => {\n const { notifications } = { ...props };\n const theme = useTheme();\n const styles = getNotificationIconStyles(theme);\n const iconId = useMemo(() => `icon${crypto.randomUUID()}`, []);\n const [selectedNotification, setSelectedNotification] = useState<IAddControlNotificationOptions | null>(null);\n const commandBarRef = useRef<ICommandBar>(null);\n const overridenTheme = useThemeOverride(theme.palette.themePrimary, 'transparent', theme.semanticColors.bodyText)\n\n useImperativeHandle(ref, () => {\n return {\n remeasureCommandBar: () => {\n commandBarRef.current?.remeasure();\n }\n }\n })\n\n const getIconName = (notification: IAddControlNotificationOptions): string | undefined => {\n if (notification.iconName) {\n return notification.iconName;\n }\n return notification.notificationLevel === 'ERROR' ? 'Error' : undefined;\n }\n\n const renderActionButton = (action: IControlNotificationAction, buttonType: 'primary' | 'default') => {\n const Button = buttonType === 'primary' ? PrimaryButton : DefaultButton;\n return <Button\n text={action.message}\n iconProps={action?.iconName ? {\n iconName: action.iconName\n } : undefined}\n onClick={() => action.actions.map(callback => callback())} />\n }\n\n const renderActions = (actions: IControlNotificationAction[]): JSX.Element => {\n if (actions.length === 0) {\n return <></>\n }\n //render actions as buttons\n if (actions.length < 3) {\n return <div className={styles.buttons}>\n {actions.map((action, i) => renderActionButton(action, i === 0 ? 'primary' : 'default'))}\n </div>\n }\n return <CommandBar items={actions.map((action, i) => {\n return {\n key: i.toString(),\n text: action.message,\n commandBarButtonAs: () => <Link onClick={() => action.actions.map(callback => callback())} className={styles.link}>\n {action.iconName &&\n <Icon iconName={action.iconName} />\n }\n {action.message}\n </Link>,\n iconProps: {\n iconName: action.iconName\n },\n onClick: () => {\n action.actions.map(callback => callback())\n }\n }\n })} />\n }\n\n const onNotificationClick = (notification: IAddControlNotificationOptions) => {\n if (notification.actions?.length === 1) {\n notification.actions[0].actions.map(callback => callback());\n return;\n }\n setSelectedNotification(notification);\n };\n\n const getCommandBarItem = (notification: IAddControlNotificationOptions) => {\n const icon = getIconName(notification);\n return {\n key: notification.uniqueId,\n text: notification.title,\n title: notification.title,\n onClick: () => onNotificationClick(notification),\n buttonStyles: {\n textContainer: {\n display: notification.compact ? 'none' : undefined\n }\n },\n iconProps: notification ? {\n iconName: icon,\n styles: {\n root: {\n color: notification.notificationLevel === 'ERROR' ? `${theme.semanticColors.errorIcon} !important` : undefined\n }\n }\n } : undefined\n }\n };\n\n return <div className={`${styles.root}${props.className ? ` ${props.className}` : ''}`}>\n <ThemeProvider theme={overridenTheme} applyTo=\"none\">\n <CommandBar\n overflowItems={notifications.filter(x => x.renderedInOverflow).map(y => getCommandBarItem(y))}\n theme={overridenTheme}\n id={iconId}\n componentRef={commandBarRef}\n items={notifications.filter(x => !x.renderedInOverflow).map(y => getCommandBarItem(y))} />\n </ThemeProvider>\n {selectedNotification &&\n <Callout\n hidden={!selectedNotification}\n className={styles.callout}\n onDismiss={() => setSelectedNotification(null)}\n target={`#${iconId}`}>\n {selectedNotification.title &&\n <Text title={selectedNotification.title} className={styles.calloutTitle} variant={selectedNotification.messages.length > 0 ? 'xLarge' : undefined}>{selectedNotification.title}</Text>\n }\n <Text>{selectedNotification.messages[0]}</Text>\n {selectedNotification.actions &&\n renderActions(selectedNotification.actions)\n }\n </Callout>\n }\n </div>\n});"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;AAiBa,MAAA,aAAa,GAAG,UAAU,CAAoC,CAAC,KAAK,EAAE,GAAG,KAAI;IACtF,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;AACvC,IAAA,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AACzB,IAAA,MAAM,MAAM,GAAG,yBAAyB,CAAM,CAAC,CAAC;AAChD,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA,IAAA,EAAO,MAAM,CAAC,UAAU,EAAE,CAAA,CAAE,EAAE,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAAwC,IAAI,CAAC,CAAC;AAC9G,IAAA,MAAM,aAAa,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;AAChD,IAAA,MAAM,cAAc,GAAG,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,EAAE,aAAa,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAA;AAEjH,IAAA,mBAAmB,CAAC,GAAG,EAAE,MAAK;QAC1B,OAAO;YACH,mBAAmB,EAAE,MAAK;AACtB,gBAAA,aAAa,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;aACtC;SACJ,CAAA;AACL,KAAC,CAAC,CAAA;AAEF,IAAA,MAAM,WAAW,GAAG,CAAC,YAA4C,KAAwB;QACrF,IAAI,YAAY,CAAC,QAAQ,EAAE;YACvB,OAAO,YAAY,CAAC,QAAQ,CAAC;AAChC,SAAA;AACD,QA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E,MAAM,uBAAuB,CAAC,IAAI,CAAC,EAC9C,MAAM,EAAE,CAAA,CAAA,EAAI,MAAM,CAAA,CAAE,EACnB,QAAA,EAAA,CAAA,oBAAoB,CAAC,KAAK;4BACvBD,GAAC,CAAA,IAAI,IAAC,KAAK,EAAE,oBAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,EAAE,oBAAoB,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,GAAG,QAAQ,GAAG,SAAS,YAAG,oBAAoB,CAAC,KAAK,EAAA,CAAQ,EAE1LA,GAAA,CAAC,IAAI,EAAE,EAAA,QAAA,EAAA,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAQ,CAAA,EAC9C,oBAAoB,CAAC,OAAO;AACzB,4BAAA,aAAa,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA,EAAA,CAEzC,IAEZ,CAAA;AACV,CAAC;;;;"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useTheme,
|
|
4
|
-
import { getReadOnlyCellStyles } from './styles.js';
|
|
3
|
+
import { useTheme, Checkbox, Shimmer, Image, Icon, Link, Text } from '@fluentui/react';
|
|
4
|
+
import { getReadOnlyCellStyles, getMultilineStyle } from './styles.js';
|
|
5
5
|
import { Commands } from '../Commands/Commands.js';
|
|
6
|
-
import { Constants, FileAttribute } from '@talxis/client-libraries';
|
|
6
|
+
import { Constants, DataTypes, FileAttribute } from '@talxis/client-libraries';
|
|
7
7
|
import { ReadOnlyOptionSet } from './ReadOnlyOptionSet/ReadOnlyOptionSet.js';
|
|
8
8
|
import { DataType } from '../../../enums/DataType.js';
|
|
9
|
-
import { useColumnValidationController } from '../../../../validation/controllers/useRecordValidationController.js';
|
|
10
9
|
import { useGridInstance } from '../../../hooks/useGridInstance.js';
|
|
11
10
|
import { useSelectionController } from '../../../../selection/controllers/useSelectionController.js';
|
|
12
11
|
import { CHECKBOX_COLUMN_KEY } from '../../../../constants.js';
|
|
@@ -14,14 +13,17 @@ import { Notifications } from './Notifications/Notifications.js';
|
|
|
14
13
|
import { useDebouncedCallback } from 'use-debounce';
|
|
15
14
|
|
|
16
15
|
const ReadOnlyCell = (props) => {
|
|
17
|
-
const
|
|
16
|
+
const selection = useSelectionController();
|
|
18
17
|
const column = props.baseColumn;
|
|
19
18
|
const record = props.data;
|
|
20
19
|
const theme = useTheme();
|
|
21
20
|
const styles = React.useMemo(() => getReadOnlyCellStyles(theme), [theme]);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
if (column.name === CHECKBOX_COLUMN_KEY) {
|
|
22
|
+
return jsx("div", { className: styles.cellContent, children: jsx(Checkbox, { checked: props.node.isSelected(), onChange: (e, checked) => {
|
|
23
|
+
e?.stopPropagation();
|
|
24
|
+
selection.toggle(record, checked);
|
|
25
|
+
} }) });
|
|
26
|
+
}
|
|
25
27
|
const MemoizedNotifications = React.useMemo(() => {
|
|
26
28
|
return React.memo(Notifications, (prevProps, nextProps) => {
|
|
27
29
|
const previousIds = prevProps.notifications.map(x => x.uniqueId).join(';');
|
|
@@ -32,18 +34,19 @@ const ReadOnlyCell = (props) => {
|
|
|
32
34
|
return true;
|
|
33
35
|
});
|
|
34
36
|
}, []);
|
|
37
|
+
const grid = useGridInstance();
|
|
38
|
+
const notifications = record.ui.getNotifications?.(column.name);
|
|
39
|
+
const notificationRef = React.useRef(null);
|
|
40
|
+
//TODO: only do this if editable
|
|
41
|
+
const validation = record.getColumnInfo(column.name);
|
|
35
42
|
const debounceNotificationRemeasure = useDebouncedCallback(() => {
|
|
36
43
|
if (notifications && notifications.length > 0) {
|
|
37
44
|
notificationRef.current?.remeasureCommandBar();
|
|
38
45
|
}
|
|
39
46
|
}, 10);
|
|
40
|
-
const [isValid, errorMessage] = useColumnValidationController({
|
|
41
|
-
column: column,
|
|
42
|
-
record: record,
|
|
43
|
-
});
|
|
44
47
|
debounceNotificationRemeasure();
|
|
45
48
|
const shouldShowNotEditableNotification = () => {
|
|
46
|
-
if (column.isEditable && record.
|
|
49
|
+
if (column.isEditable && !record.getColumnInfo(column.name).security.editable) {
|
|
47
50
|
return true;
|
|
48
51
|
}
|
|
49
52
|
return false;
|
|
@@ -53,7 +56,7 @@ const ReadOnlyCell = (props) => {
|
|
|
53
56
|
if (notifications && notifications.length > 0) {
|
|
54
57
|
count++;
|
|
55
58
|
}
|
|
56
|
-
if (
|
|
59
|
+
if (validation?.error === true) {
|
|
57
60
|
count++;
|
|
58
61
|
}
|
|
59
62
|
if (shouldShowNotEditableNotification()) {
|
|
@@ -62,7 +65,7 @@ const ReadOnlyCell = (props) => {
|
|
|
62
65
|
return count * 40;
|
|
63
66
|
};
|
|
64
67
|
const shouldRenderNotificationsWrapper = () => {
|
|
65
|
-
if (
|
|
68
|
+
if (validation?.error === true) {
|
|
66
69
|
return true;
|
|
67
70
|
}
|
|
68
71
|
if (shouldShowNotEditableNotification()) {
|
|
@@ -82,29 +85,21 @@ const ReadOnlyCell = (props) => {
|
|
|
82
85
|
if (record.ui?.isLoading(column.name)) {
|
|
83
86
|
return jsx(Shimmer, { className: styles.loading });
|
|
84
87
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return jsx("div", { className: styles.cellContent, children: jsx(Checkbox, { checked: props.node.isSelected(), onChange: (e, checked) => {
|
|
88
|
-
e?.stopPropagation();
|
|
89
|
-
selection.toggle(record, checked);
|
|
90
|
-
} }) });
|
|
91
|
-
}
|
|
92
|
-
case Constants.RIBBON_BUTTONS_COLUMN_NAME: {
|
|
93
|
-
return jsx("div", { className: styles.cellContent, children: jsx(Commands, { record: record }) });
|
|
94
|
-
}
|
|
88
|
+
if (column.name === Constants.RIBBON_BUTTONS_COLUMN_NAME) {
|
|
89
|
+
return jsx("div", { className: styles.cellContent, children: jsx(Commands, { record: record }) });
|
|
95
90
|
}
|
|
96
91
|
return (jsxs("div", { style: {
|
|
97
92
|
'--test': `${calculateNotificationsWrapperMinWidth()}px`
|
|
98
|
-
}, className: styles.root, "data-is-valid":
|
|
93
|
+
}, className: styles.root, "data-is-valid": !validation || validation.error === false, children: [jsx("div", { className: styles.cellContentWrapper, children: jsx("div", { className: styles.cellContent, children: jsx(InternalReadOnlyCell, { ...props }) }) }), shouldRenderNotificationsWrapper() &&
|
|
99
94
|
jsxs("div", { className: styles.notificationsWrapper, children: [notifications && notifications.length > 0 &&
|
|
100
|
-
jsx(MemoizedNotifications, { className: styles.notifications, ref: notificationRef, notifications: notifications }),
|
|
95
|
+
jsx(MemoizedNotifications, { className: styles.notifications, ref: notificationRef, notifications: notifications }), validation?.error === true &&
|
|
101
96
|
jsx(MemoizedNotifications, { notifications: [
|
|
102
97
|
{
|
|
103
98
|
notificationLevel: 'ERROR',
|
|
104
99
|
messages: [],
|
|
105
100
|
iconName: 'Error',
|
|
106
101
|
uniqueId: column.name,
|
|
107
|
-
title: errorMessage,
|
|
102
|
+
title: validation.errorMessage,
|
|
108
103
|
compact: true
|
|
109
104
|
}
|
|
110
105
|
] }), shouldShowNotEditableNotification() &&
|
|
@@ -122,11 +117,7 @@ const InternalReadOnlyCell = (props) => {
|
|
|
122
117
|
const column = props.baseColumn;
|
|
123
118
|
const theme = useTheme();
|
|
124
119
|
const styles = getReadOnlyCellStyles(theme);
|
|
125
|
-
const record =
|
|
126
|
-
//this is so we can load the updated record values from state
|
|
127
|
-
const updatedRecord = grid.recordUpdateService.record(props.data.getRecordId()).get();
|
|
128
|
-
return updatedRecord ?? props.data;
|
|
129
|
-
})();
|
|
120
|
+
const record = props.data;
|
|
130
121
|
const formattedValue = record.getFormattedValue(column.name);
|
|
131
122
|
const renderLink = (props, formattedValue) => {
|
|
132
123
|
switch (column.dataType) {
|
|
@@ -141,7 +132,14 @@ const InternalReadOnlyCell = (props) => {
|
|
|
141
132
|
if (!formattedValue) {
|
|
142
133
|
return jsx(Fragment, {});
|
|
143
134
|
}
|
|
144
|
-
|
|
135
|
+
let className = styles.link;
|
|
136
|
+
switch (column.dataType) {
|
|
137
|
+
case DataTypes.Multiple:
|
|
138
|
+
case DataTypes.SingleLineTextArea: {
|
|
139
|
+
className += ` ${getMultilineStyle(props.node.rowHeight)}`;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return (jsx(Link, { ...props, className: className, title: formattedValue, children: formattedValue }));
|
|
145
143
|
};
|
|
146
144
|
const renderText = () => {
|
|
147
145
|
if (column.isPrimary && grid.isNavigationEnabled) {
|
|
@@ -149,7 +147,14 @@ const InternalReadOnlyCell = (props) => {
|
|
|
149
147
|
onClick: () => grid.openDatasetItem(record.getNamedReference())
|
|
150
148
|
}, formattedValue);
|
|
151
149
|
}
|
|
152
|
-
|
|
150
|
+
let className = `${styles.text} talxis-cell-text`;
|
|
151
|
+
switch (column.dataType) {
|
|
152
|
+
case DataTypes.Multiple:
|
|
153
|
+
case DataTypes.SingleLineTextArea: {
|
|
154
|
+
className += ` ${getMultilineStyle(props.node.rowHeight)}`;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return jsx(Text, { className: className, title: formattedValue, children: formattedValue });
|
|
153
158
|
};
|
|
154
159
|
const downloadFile = () => {
|
|
155
160
|
const storage = new FileAttribute(grid.pcfContext.webAPI);
|
|
@@ -179,7 +184,7 @@ const InternalReadOnlyCell = (props) => {
|
|
|
179
184
|
case DataType.LOOKUP_OWNER:
|
|
180
185
|
case DataType.LOOKUP_CUSTOMER: {
|
|
181
186
|
return renderLink({
|
|
182
|
-
onClick: () => grid.openDatasetItem(record.getValue(column.name))
|
|
187
|
+
onClick: () => grid.openDatasetItem(record.getValue(column.name)[0])
|
|
183
188
|
}, formattedValue);
|
|
184
189
|
}
|
|
185
190
|
case DataType.FILE: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadOnlyCell.js","sources":["../../../../../../../src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ILinkProps, Shimmer } from '@fluentui/react';\nimport { Link } from '@fluentui/react';\nimport { Text } from '@fluentui/react';\nimport { getReadOnlyCellStyles } from './styles';\nimport { Commands } from '../Commands/Commands';\nimport { Checkbox, Icon, useTheme, Image } from '@fluentui/react';\nimport { Constants, FileAttribute, IRecord } from '@talxis/client-libraries';\nimport { ReadOnlyOptionSet } from './ReadOnlyOptionSet/ReadOnlyOptionSet';\nimport { IGridColumn } from '../../../interfaces/IGridColumn';\nimport { DataType } from '../../../enums/DataType';\nimport { useColumnValidationController } from '../../../../validation/controllers/useRecordValidationController';\nimport { useGridInstance } from '../../../hooks/useGridInstance';\nimport { useSelectionController } from '../../../../selection/controllers/useSelectionController';\nimport { ICellRendererParams } from '@ag-grid-community/core';\nimport { CHECKBOX_COLUMN_KEY } from '../../../../constants';\nimport { INotificationsRef, Notifications } from './Notifications/Notifications';\nimport { useDebouncedCallback } from 'use-debounce';\n\ninterface ICellProps extends ICellRendererParams {\n baseColumn: IGridColumn;\n data: IRecord;\n [key: string]: any;\n}\n\nexport const ReadOnlyCell = (props: ICellProps) => {\n const grid = useGridInstance();\n const column = props.baseColumn;\n const record = props.data;\n const theme = useTheme();\n const styles = React.useMemo(() => getReadOnlyCellStyles(theme), [theme]);\n const selection = useSelectionController();\n const notifications = record.ui?.getNotifications(column.name);\n const notificationRef = React.useRef<INotificationsRef>(null);\n\n const MemoizedNotifications = React.useMemo(() => {\n return React.memo(Notifications, (prevProps, nextProps) => {\n const previousIds = prevProps.notifications.map(x => x.uniqueId).join(';');\n const nextIds = nextProps.notifications.map(x => x.uniqueId).join(';');\n if (previousIds !== nextIds) {\n return false;\n }\n return true;\n });\n }, []);\n\n const debounceNotificationRemeasure = useDebouncedCallback(() => {\n if (notifications && notifications.length > 0) {\n notificationRef.current?.remeasureCommandBar();\n }\n }, 10)\n\n const [isValid, errorMessage] = useColumnValidationController({\n column: column,\n record: record,\n });\n\n debounceNotificationRemeasure();\n\n const shouldShowNotEditableNotification = (): boolean => {\n if (column.isEditable && record.ui?.isEditable(column.name) === false) {\n return true;\n }\n return false;\n }\n\n const calculateNotificationsWrapperMinWidth = (): number => {\n let count = 0;\n if (notifications && notifications.length > 0) {\n count++\n }\n if (!isValid) {\n count++;\n }\n if (shouldShowNotEditableNotification()) {\n count++;\n }\n return count * 40;\n }\n\n const shouldRenderNotificationsWrapper = (): boolean => {\n if (!isValid) {\n return true;\n }\n if (shouldShowNotEditableNotification()) {\n return true;\n }\n if (notifications && notifications.length > 0) {\n return true;\n }\n return false;\n }\n\n React.useEffect(() => {\n const resizeObserver = new ResizeObserver(() => {\n debounceNotificationRemeasure();\n })\n resizeObserver.observe(props.eGridCell);\n }, []);\n\n\n if (record.ui?.isLoading(column.name)) {\n return <Shimmer className={styles.loading} />\n }\n switch (column.name) {\n case CHECKBOX_COLUMN_KEY: {\n return <div className={styles.cellContent}>\n <Checkbox\n checked={props.node.isSelected()}\n onChange={(e, checked) => {\n e?.stopPropagation()\n selection.toggle(record, checked!)\n }} />\n </div>\n }\n case Constants.RIBBON_BUTTONS_COLUMN_NAME: {\n return <div className={styles.cellContent}>\n <Commands record={record} />\n </div>\n }\n }\n\n return (\n <div style={{\n '--test': `${calculateNotificationsWrapperMinWidth()}px`\n } as React.CSSProperties} className={styles.root} data-is-valid={isValid}>\n <div className={styles.cellContentWrapper}>\n <div className={styles.cellContent}>\n <InternalReadOnlyCell {...props} />\n </div>\n </div>\n {shouldRenderNotificationsWrapper() &&\n <div className={styles.notificationsWrapper}>\n {notifications && notifications.length > 0 &&\n <MemoizedNotifications className={styles.notifications} ref={notificationRef} notifications={notifications} />\n }\n {!isValid &&\n <MemoizedNotifications notifications={[\n {\n notificationLevel: 'ERROR',\n messages: [],\n iconName: 'Error',\n uniqueId: column.name,\n title: errorMessage,\n compact: true\n }\n ]} />\n }\n {\n shouldShowNotEditableNotification() &&\n <MemoizedNotifications className={styles.uneditableNotification} notifications={[{\n iconName: 'Uneditable',\n notificationLevel: 'RECOMMENDATION',\n uniqueId: column.name,\n title: grid.labels['value-not-editable'](),\n compact: true,\n messages: []\n }]} />\n }\n </div>\n }\n </div>\n )\n};\n\nconst InternalReadOnlyCell = (props: ICellProps) => {\n const grid = useGridInstance();\n const column = props.baseColumn;\n const theme = useTheme();\n const styles = getReadOnlyCellStyles(theme);\n const record: IRecord = (() => {\n //this is so we can load the updated record values from state\n const updatedRecord = grid.recordUpdateService.record(props.data.getRecordId()).get() as any;\n return updatedRecord ?? props.data;\n })();\n const formattedValue = record.getFormattedValue(column.name);\n\n const renderLink = (props: ILinkProps, formattedValue: string | null): JSX.Element => {\n switch (column.dataType) {\n case DataType.LOOKUP_OWNER:\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_CUSTOMER: {\n if (!grid.isNavigationEnabled) {\n return renderText();\n }\n }\n }\n if (!formattedValue) {\n return <></>\n }\n return (\n <Link {...props} className={styles.link} title={formattedValue}>\n {formattedValue}\n </Link>\n );\n };\n const renderText = (): JSX.Element => {\n if (column.isPrimary && grid.isNavigationEnabled) {\n return renderLink({\n onClick: () => grid.openDatasetItem(record.getNamedReference())\n }, formattedValue);\n }\n return <Text className={`${styles.text} talxis-cell-text`} title={formattedValue!}>{formattedValue}</Text>\n }\n const downloadFile = () => {\n const storage = new FileAttribute(grid.pcfContext.webAPI);\n const namedReference = record.getNamedReference();\n storage.downloadFileFromAttribute({\n //@ts-ignore - PowerApps do not follow the typings\n entityName: namedReference.etn ?? namedReference.entityName,\n recordId: record.getRecordId(),\n fileAttribute: column.name,\n }, true)\n }\n\n switch (column.dataType) {\n case DataType.SINGLE_LINE_EMAIL: {\n return renderLink({ href: `mailto:${formattedValue}` }, formattedValue);\n }\n case DataType.SINGLE_LINE_PHONE: {\n return renderLink({ href: `tel:${formattedValue}` }, formattedValue);\n }\n case DataType.SINGLE_LINE_URL: {\n return renderLink({\n href: formattedValue ?? \"\",\n target: '_blank',\n rel: 'noopener noreferrer'\n }, formattedValue);\n }\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_OWNER:\n case DataType.LOOKUP_CUSTOMER: {\n return renderLink({\n onClick: () => grid.openDatasetItem(record.getValue(column.name) as any)\n }, formattedValue);\n }\n case DataType.FILE: {\n if (!formattedValue) {\n return <></>\n }\n return (\n <div className={styles.fileWrapper}>\n <Icon iconName='Attach' />\n {\n renderLink({\n onClick: downloadFile\n }, grid.labels.download())\n }\n </div>\n )\n }\n case DataType.IMAGE: {\n if (!formattedValue) {\n return <></>\n }\n return (\n <div className={styles.fileWrapper}>\n <Image className={styles.image} src={`data:image/png;base64,${formattedValue}`} />\n {\n renderLink({\n onClick: downloadFile\n }, 'Download')\n }\n </div>\n )\n }\n case DataType.OPTIONSET:\n case DataType.MULTI_SELECT_OPTIONSET:\n case DataType.TWO_OPTIONS: {\n if (grid.enableOptionSetColors) {\n return <ReadOnlyOptionSet\n column={column}\n record={record}\n defaultRender={renderText} />\n }\n return renderText();\n }\n default: {\n return renderText()\n }\n\n }\n}"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;AAyBa,MAAA,YAAY,GAAG,CAAC,KAAiB,KAAI;AAC9C,IAAA,MAAM,IAAI,GAAG,eAAe,EAAE,CAAC;AAC/B,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC;AAChC,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC;AAC1B,IAAA,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AACzB,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1E,IAAA,MAAM,SAAS,GAAG,sBAAsB,EAAE,CAAC;AAC3C,IAAA,MAAM,aAAa,GAAG,MAAM,CAAC,EAAE,EAAE,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,eAAe,GAAG,K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I,CAAA;AACpC,aAAA;YACD,OAAO,UAAU,EAAE,CAAC;AACvB,SAAA;AACD,QAAA,SAAS;YACL,OAAO,UAAU,EAAE,CAAA;AACtB,SAAA;AAEJ,KAAA;AACL,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"ReadOnlyCell.js","sources":["../../../../../../../src/components/Grid/core/components/Cell/ReadOnlyCell/ReadOnlyCell.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ILinkProps, Shimmer } from '@fluentui/react';\nimport { Link } from '@fluentui/react';\nimport { Text } from '@fluentui/react';\nimport { getMultilineStyle, getReadOnlyCellStyles } from './styles';\nimport { Commands } from '../Commands/Commands';\nimport { Checkbox, Icon, useTheme, Image } from '@fluentui/react';\nimport { Constants, DataTypes, FileAttribute, IRecord } from '@talxis/client-libraries';\nimport { ReadOnlyOptionSet } from './ReadOnlyOptionSet/ReadOnlyOptionSet';\nimport { IGridColumn } from '../../../interfaces/IGridColumn';\nimport { DataType } from '../../../enums/DataType';\nimport { useGridInstance } from '../../../hooks/useGridInstance';\nimport { useSelectionController } from '../../../../selection/controllers/useSelectionController';\nimport { ICellRendererParams } from '@ag-grid-community/core';\nimport { CHECKBOX_COLUMN_KEY } from '../../../../constants';\nimport { INotificationsRef, Notifications } from './Notifications/Notifications';\nimport { useDebouncedCallback } from 'use-debounce';\n\ninterface ICellProps extends ICellRendererParams {\n baseColumn: IGridColumn;\n data: IRecord;\n [key: string]: any;\n}\n\nexport const ReadOnlyCell = (props: ICellProps) => {\n const selection = useSelectionController();\n const column = props.baseColumn;\n const record = props.data;\n const theme = useTheme();\n const styles = React.useMemo(() => getReadOnlyCellStyles(theme), [theme]);\n\n if(column.name === CHECKBOX_COLUMN_KEY) {\n return <div className={styles.cellContent}>\n <Checkbox\n checked={props.node.isSelected()}\n onChange={(e, checked) => {\n e?.stopPropagation()\n selection.toggle(record, checked!)\n }} />\n </div>\n }\n const MemoizedNotifications = React.useMemo(() => {\n return React.memo(Notifications, (prevProps, nextProps) => {\n const previousIds = prevProps.notifications.map(x => x.uniqueId).join(';');\n const nextIds = nextProps.notifications.map(x => x.uniqueId).join(';');\n if (previousIds !== nextIds) {\n return false;\n }\n return true;\n });\n }, []);\n \n const grid = useGridInstance();\n const notifications = record.ui.getNotifications?.(column.name);\n const notificationRef = React.useRef<INotificationsRef>(null);\n //TODO: only do this if editable\n const validation = record.getColumnInfo(column.name);\n\n const debounceNotificationRemeasure = useDebouncedCallback(() => {\n if (notifications && notifications.length > 0) {\n notificationRef.current?.remeasureCommandBar();\n }\n }, 10)\n\n debounceNotificationRemeasure();\n\n const shouldShowNotEditableNotification = (): boolean => {\n if (column.isEditable && !record.getColumnInfo(column.name).security.editable) {\n return true;\n }\n return false;\n }\n\n const calculateNotificationsWrapperMinWidth = (): number => {\n let count = 0;\n if (notifications && notifications.length > 0) {\n count++\n }\n if (validation?.error === true) {\n count++;\n }\n if (shouldShowNotEditableNotification()) {\n count++;\n }\n return count * 40;\n }\n\n const shouldRenderNotificationsWrapper = (): boolean => {\n if (validation?.error === true) {\n return true;\n }\n if (shouldShowNotEditableNotification()) {\n return true;\n }\n if (notifications && notifications.length > 0) {\n return true;\n }\n return false;\n }\n\n React.useEffect(() => {\n const resizeObserver = new ResizeObserver(() => {\n debounceNotificationRemeasure();\n })\n resizeObserver.observe(props.eGridCell);\n }, []);\n\n\n if (record.ui?.isLoading(column.name)) {\n return <Shimmer className={styles.loading} />\n }\n if(column.name === Constants.RIBBON_BUTTONS_COLUMN_NAME) {\n return <div className={styles.cellContent}>\n <Commands record={record} />\n </div>\n }\n return (\n <div style={{\n '--test': `${calculateNotificationsWrapperMinWidth()}px`\n } as React.CSSProperties} className={styles.root} data-is-valid={!validation || validation.error === false}>\n <div className={styles.cellContentWrapper}>\n <div className={styles.cellContent}>\n <InternalReadOnlyCell {...props} />\n </div>\n </div>\n {shouldRenderNotificationsWrapper() &&\n <div className={styles.notificationsWrapper}>\n {notifications && notifications.length > 0 &&\n <MemoizedNotifications className={styles.notifications} ref={notificationRef} notifications={notifications} />\n }\n {validation?.error === true &&\n <MemoizedNotifications notifications={[\n {\n notificationLevel: 'ERROR',\n messages: [],\n iconName: 'Error',\n uniqueId: column.name,\n title: validation.errorMessage,\n compact: true\n }\n ]} />\n }\n {\n shouldShowNotEditableNotification() &&\n <MemoizedNotifications className={styles.uneditableNotification} notifications={[{\n iconName: 'Uneditable',\n notificationLevel: 'RECOMMENDATION',\n uniqueId: column.name,\n title: grid.labels['value-not-editable'](),\n compact: true,\n messages: []\n }]} />\n }\n </div>\n }\n </div>\n )\n};\n\nconst InternalReadOnlyCell = (props: ICellProps) => {\n const grid = useGridInstance();\n const column = props.baseColumn;\n const theme = useTheme();\n const styles = getReadOnlyCellStyles(theme);\n const record = props.data;\n const formattedValue = record.getFormattedValue(column.name);\n\n const renderLink = (props: ILinkProps, formattedValue: string | null): JSX.Element => {\n switch (column.dataType) {\n case DataType.LOOKUP_OWNER:\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_CUSTOMER: {\n if (!grid.isNavigationEnabled) {\n return renderText();\n }\n }\n }\n if (!formattedValue) {\n return <></>\n }\n let className = styles.link;\n switch(column.dataType) {\n case DataTypes.Multiple:\n case DataTypes.SingleLineTextArea: {\n className += ` ${getMultilineStyle(props.node.rowHeight!)}`\n }\n }\n return (\n <Link {...props} className={className} title={formattedValue}>\n {formattedValue}\n </Link>\n );\n };\n const renderText = (): JSX.Element => {\n if (column.isPrimary && grid.isNavigationEnabled) {\n return renderLink({\n onClick: () => grid.openDatasetItem(record.getNamedReference())\n }, formattedValue);\n }\n let className = `${styles.text} talxis-cell-text`\n switch(column.dataType) {\n case DataTypes.Multiple:\n case DataTypes.SingleLineTextArea: {\n className += ` ${getMultilineStyle(props.node.rowHeight!)}`\n }\n }\n return <Text className={className} title={formattedValue!}>{formattedValue}</Text>\n }\n const downloadFile = () => {\n const storage = new FileAttribute(grid.pcfContext.webAPI);\n const namedReference = record.getNamedReference();\n storage.downloadFileFromAttribute({\n //@ts-ignore - PowerApps do not follow the typings\n entityName: namedReference.etn ?? namedReference.entityName,\n recordId: record.getRecordId(),\n fileAttribute: column.name,\n }, true)\n }\n\n switch (column.dataType) {\n case DataType.SINGLE_LINE_EMAIL: {\n return renderLink({ href: `mailto:${formattedValue}` }, formattedValue);\n }\n case DataType.SINGLE_LINE_PHONE: {\n return renderLink({ href: `tel:${formattedValue}` }, formattedValue);\n }\n case DataType.SINGLE_LINE_URL: {\n return renderLink({\n href: formattedValue ?? \"\",\n target: '_blank',\n rel: 'noopener noreferrer'\n }, formattedValue);\n }\n case DataType.LOOKUP_SIMPLE:\n case DataType.LOOKUP_OWNER:\n case DataType.LOOKUP_CUSTOMER: {\n return renderLink({\n onClick: () => grid.openDatasetItem(record.getValue(column.name)[0])\n }, formattedValue);\n }\n case DataType.FILE: {\n if (!formattedValue) {\n return <></>\n }\n return (\n <div className={styles.fileWrapper}>\n <Icon iconName='Attach' />\n {\n renderLink({\n onClick: downloadFile\n }, grid.labels.download())\n }\n </div>\n )\n }\n case DataType.IMAGE: {\n if (!formattedValue) {\n return <></>\n }\n return (\n <div className={styles.fileWrapper}>\n <Image className={styles.image} src={`data:image/png;base64,${formattedValue}`} />\n {\n renderLink({\n onClick: downloadFile\n }, 'Download')\n }\n </div>\n )\n }\n case DataType.OPTIONSET:\n case DataType.MULTI_SELECT_OPTIONSET:\n case DataType.TWO_OPTIONS: {\n if (grid.enableOptionSetColors) {\n return <ReadOnlyOptionSet\n column={column}\n record={record}\n defaultRender={renderText} />\n }\n return renderText();\n }\n default: {\n return renderText()\n }\n\n }\n}"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;AAwBa,MAAA,YAAY,GAAG,CAAC,KAAiB,KAAI;AAC9C,IAAA,MAAM,SAAS,GAAG,sBAAsB,EAAE,CAAC;AAC3C,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAAC;AAChC,IAAA,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC;A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AC,CAE5B,EAAA,CAAA,EACT;AACJ,SAAA;AACD,QAAA,KAAK,QAAQ,CAAC,KAAK,EAAE;YACjB,IAAI,CAAC,cAAc,EAAE;AACjB,gBAAA,OAAOA,iBAAK,CAAA;AACf,aAAA;YACD,QACIC,IAAK,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,WAAW,EAAA,QAAA,EAAA,CAC9BD,GAAC,CAAA,KAAK,EAAC,EAAA,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,CAAyB,sBAAA,EAAA,cAAc,CAAE,CAAA,EAAA,CAAI,EAE9E,UAAU,CAAC;AACP,wBAAA,OAAO,EAAE,YAAY;AACxB,qBAAA,EAAE,UAAU,CAAC,CAEhB,EAAA,CAAA,EACT;AACJ,SAAA;QACD,KAAK,QAAQ,CAAC,SAAS,CAAC;QACxB,KAAK,QAAQ,CAAC,sBAAsB,CAAC;AACrC,QAAA,KAAK,QAAQ,CAAC,WAAW,EAAE;YACvB,IAAI,IAAI,CAAC,qBAAqB,EAAE;AAC5B,gBAAA,OAAOA,GAAC,CAAA,iBAAiB,EACrB,EAAA,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,UAAU,GAAI,CAAA;AACpC,aAAA;YACD,OAAO,UAAU,EAAE,CAAC;AACvB,SAAA;AACD,QAAA,SAAS;YACL,OAAO,UAAU,EAAE,CAAA;AACtB,SAAA;AAEJ,KAAA;AACL,CAAC;;;;"}
|
|
@@ -91,4 +91,9 @@ export declare const getReadOnlyCellStyles: (theme: ITheme) => import("@fluentui
|
|
|
91
91
|
backgroundSize: string;
|
|
92
92
|
background: string;
|
|
93
93
|
};
|
|
94
|
+
multiline: {
|
|
95
|
+
alignSelf: string;
|
|
96
|
+
whiteSpace: string;
|
|
97
|
+
};
|
|
94
98
|
}>;
|
|
99
|
+
export declare const getMultilineStyle: (height: number) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { keyframes, mergeStyleSets } from '@fluentui/react';
|
|
1
|
+
import { keyframes, mergeStyleSets, mergeStyles } from '@fluentui/react';
|
|
2
2
|
|
|
3
3
|
const shimmer = keyframes({
|
|
4
4
|
'100%': {
|
|
@@ -23,7 +23,7 @@ const getReadOnlyCellStyles = (theme) => {
|
|
|
23
23
|
text: {
|
|
24
24
|
fontSize: 14,
|
|
25
25
|
overflow: 'hidden',
|
|
26
|
-
textOverflow: 'ellipsis'
|
|
26
|
+
textOverflow: 'ellipsis',
|
|
27
27
|
},
|
|
28
28
|
link: {
|
|
29
29
|
fontSize: 14,
|
|
@@ -98,8 +98,26 @@ const getReadOnlyCellStyles = (theme) => {
|
|
|
98
98
|
backgroundSize: '1000px 100%',
|
|
99
99
|
background: `linear-gradient(to right, color-mix(in oklab, ${theme.palette.white}, ${theme.palette.black} 8%) 4%, color-mix(in oklab, ${theme.palette.white}, ${theme.palette.black} 5%) 25%, color-mix(in oklab, ${theme.palette.white}, ${theme.palette.black} 8%) 36%)`
|
|
100
100
|
},
|
|
101
|
+
multiline: {
|
|
102
|
+
alignSelf: 'baseline',
|
|
103
|
+
whiteSpace: 'normal'
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const getMultilineStyle = (height) => {
|
|
108
|
+
const clamp = Math.floor(height / 20);
|
|
109
|
+
return mergeStyles({
|
|
110
|
+
alignSelf: 'baseline',
|
|
111
|
+
whiteSpace: 'normal',
|
|
112
|
+
display: '-webkit-box',
|
|
113
|
+
textAlign: 'left',
|
|
114
|
+
overflowWrap: 'break-word',
|
|
115
|
+
lineHeight: "1.2",
|
|
116
|
+
paddingTop: 2,
|
|
117
|
+
'-webkit-line-clamp': clamp.toString(),
|
|
118
|
+
'-webkit-box-orient': 'vertical'
|
|
101
119
|
});
|
|
102
120
|
};
|
|
103
121
|
|
|
104
|
-
export { getReadOnlyCellStyles };
|
|
122
|
+
export { getMultilineStyle, getReadOnlyCellStyles };
|
|
105
123
|
//# sourceMappingURL=styles.js.map
|