@headless-adminapp/fluent 1.4.30 → 1.4.31
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/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +4 -1
- package/DataGrid/useTableColumns.js +10 -8
- package/Insights/WidgetDataGridContainer.d.ts +0 -1
- package/Insights/WidgetDataGridContainer.js +2 -2
- package/PageEntityForm/EditableGridControl/CardUi.js +1 -1
- package/PageEntityForm/EditableGridControl/TableUi.js +1 -1
- package/package.json +2 -2
|
@@ -59,6 +59,9 @@ const TableHeaderFilterCell = ({ children, sortDirection, onChangeSortDirection,
|
|
|
59
59
|
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
60
60
|
const attribute = (0, react_1.useMemo)(() => {
|
|
61
61
|
const _attribute = schema.attributes[column.name];
|
|
62
|
+
if (!_attribute) {
|
|
63
|
+
throw new Error(`Attribute not found: ${column.name} in ${schema.logicalName}`);
|
|
64
|
+
}
|
|
62
65
|
if (!column.expandedKey) {
|
|
63
66
|
return _attribute;
|
|
64
67
|
}
|
|
@@ -101,7 +104,7 @@ const TableHeaderFilterCell = ({ children, sortDirection, onChangeSortDirection,
|
|
|
101
104
|
if (!disableFilter) {
|
|
102
105
|
menuItems.push(filterMenuItems);
|
|
103
106
|
}
|
|
104
|
-
const headerCell = ((0, jsx_runtime_1.jsxs)(react_components_1.TableHeaderCell, { as: "
|
|
107
|
+
const headerCell = ((0, jsx_runtime_1.jsxs)(react_components_1.TableHeaderCell, { as: "th", className: (0, react_components_1.mergeClasses)(styles.root, align === 'right' && styles.right), style: {
|
|
105
108
|
textAlign: align,
|
|
106
109
|
width: minWidth,
|
|
107
110
|
minWidth: minWidth,
|
|
@@ -66,17 +66,19 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
|
|
|
66
66
|
columns: columns.map((column) => {
|
|
67
67
|
const attribute = schema.attributes[column.name];
|
|
68
68
|
let defaultMaxWidth = 1000;
|
|
69
|
-
if (attribute
|
|
70
|
-
if (attribute.
|
|
71
|
-
|
|
69
|
+
if (attribute) {
|
|
70
|
+
if (attribute.type === 'date') {
|
|
71
|
+
if (attribute.format === 'datetime') {
|
|
72
|
+
defaultMaxWidth = 200;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
defaultMaxWidth = 100;
|
|
76
|
+
}
|
|
72
77
|
}
|
|
73
|
-
else {
|
|
74
|
-
defaultMaxWidth =
|
|
78
|
+
else if (attribute.type === 'money') {
|
|
79
|
+
defaultMaxWidth = 150;
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
|
-
else if (attribute.type === 'money') {
|
|
78
|
-
defaultMaxWidth = 150;
|
|
79
|
-
}
|
|
80
82
|
return {
|
|
81
83
|
width: column.width ?? 100,
|
|
82
84
|
maxWidth: column.maxWidth ?? defaultMaxWidth,
|
|
@@ -11,6 +11,5 @@ interface WidgetDataGridContainerProps {
|
|
|
11
11
|
viewId?: string;
|
|
12
12
|
allowContextMenu?: boolean;
|
|
13
13
|
}
|
|
14
|
-
/*** @deprecated Need refactoring */
|
|
15
14
|
export declare function WidgetDataGridContainer({ logicalName, maxRecords, filter, commands, title, view, viewId, allowContextMenu, }: Readonly<WidgetDataGridContainerProps>): import("react/jsx-runtime").JSX.Element;
|
|
16
15
|
export {};
|
|
@@ -6,6 +6,7 @@ const command_1 = require("@headless-adminapp/app/command");
|
|
|
6
6
|
const hooks_1 = require("@headless-adminapp/app/command/hooks");
|
|
7
7
|
const DataGridProvider_1 = require("@headless-adminapp/app/datagrid/DataGridProvider");
|
|
8
8
|
const hooks_2 = require("@headless-adminapp/app/datagrid/hooks");
|
|
9
|
+
const historystate_1 = require("@headless-adminapp/app/historystate");
|
|
9
10
|
const hooks_3 = require("@headless-adminapp/app/hooks");
|
|
10
11
|
const hooks_4 = require("@headless-adminapp/app/metadata/hooks");
|
|
11
12
|
const BodyLoading_1 = require("../components/BodyLoading");
|
|
@@ -13,7 +14,6 @@ const DataGrid_1 = require("../DataGrid");
|
|
|
13
14
|
const GridListContainer_1 = require("../DataGrid/GridListContainer");
|
|
14
15
|
const WidgetSection_1 = require("./WidgetSection");
|
|
15
16
|
const WidgetTitleBar_1 = require("./WidgetTitleBar");
|
|
16
|
-
/*** @deprecated Need refactoring */
|
|
17
17
|
function WidgetDataGridContainer({ logicalName, maxRecords, filter, commands, title, view, viewId, allowContextMenu, }) {
|
|
18
18
|
const schema = (0, hooks_4.useSchema)(logicalName);
|
|
19
19
|
const { view: _view, isLoadingView } = (0, hooks_4.useExperienceView)(logicalName, viewId);
|
|
@@ -28,7 +28,7 @@ function WidgetDataGridContainer({ logicalName, maxRecords, filter, commands, ti
|
|
|
28
28
|
if (!schema) {
|
|
29
29
|
return ((0, jsx_runtime_1.jsx)(WidgetSection_1.WidgetSection, { children: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, position: 'relative' }, children: "Schema not found" }) }));
|
|
30
30
|
}
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: [], onChangeView: () => { }, commands: contextCommands, allowViewSelection: false, maxRecords: maxRecords, extraFilter: filter, children: (0, jsx_runtime_1.jsx)(FormSubgridContainer, { title: title, commands: commands, allowContextMenu: allowContextMenu }) }));
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(historystate_1.HistoryStateKeyProvider, { historyKey: "~", children: (0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: [], onChangeView: () => { }, commands: contextCommands, allowViewSelection: false, maxRecords: maxRecords, extraFilter: filter, children: (0, jsx_runtime_1.jsx)(FormSubgridContainer, { title: title, commands: commands, allowContextMenu: allowContextMenu }) }) }));
|
|
32
32
|
}
|
|
33
33
|
const FormSubgridContainer = ({ title, commands, allowContextMenu, }) => {
|
|
34
34
|
const isMobile = (0, hooks_3.useIsMobile)();
|
|
@@ -66,7 +66,7 @@ const CardUi = ({ schema, control, formControl, onAddRow, onRemoveRow, rows, ali
|
|
|
66
66
|
const previousValue = field.value;
|
|
67
67
|
field.onChange(value);
|
|
68
68
|
eventManager.emit(constants_1.EVENT_KEY_ON_FIELD_CHANGE, field.name, value, previousValue);
|
|
69
|
-
}, onBlur: field.onBlur, placeholder: "" }) }));
|
|
69
|
+
}, onBlur: field.onBlur, placeholder: "", allowNewRecord: true, allowNavigation: true, allowQuickCreate: true }) }));
|
|
70
70
|
} }) }, attributeName));
|
|
71
71
|
}) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), !readOnly && ((0, jsx_runtime_1.jsx)(fluent_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Delete, { size: 16 }), appearance: "primary", onClick: () => onRemoveRow?.(index), style: {
|
|
72
72
|
alignSelf: 'flex-start',
|
|
@@ -70,7 +70,7 @@ const TableUi = ({ schema, control, formControl, onAddRow, onRemoveRow, rows, al
|
|
|
70
70
|
const previousValue = field.value;
|
|
71
71
|
field.onChange(value);
|
|
72
72
|
eventManager.emit(constants_1.EVENT_KEY_ON_FIELD_CHANGE, field.name, value, previousValue);
|
|
73
|
-
}, onBlur: field.onBlur, placeholder: "" }) }));
|
|
73
|
+
}, onBlur: field.onBlur, placeholder: "", allowNewRecord: true, allowNavigation: true, allowQuickCreate: true }) }));
|
|
74
74
|
} }) }, attributeName));
|
|
75
75
|
}), !readOnly && ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { children: (0, jsx_runtime_1.jsx)(fluent_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Delete, { size: 16 }), appearance: "subtle", onClick: () => onRemoveRow?.(index) }) }))] }, item.__key))) })] }));
|
|
76
76
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/fluent",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.31",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/lodash": "4.17.20"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "3c6a0b0fc245e8d9c6a4cb6811cbba079dfa5146"
|
|
58
58
|
}
|