@headless-adminapp/fluent 1.4.30 → 1.4.32

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/App/App.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
2
  interface AppProps {
3
+ appFooter?: React.ReactNode;
3
4
  }
4
5
  export declare const App: FC<PropsWithChildren<AppProps>>;
5
6
  export {};
package/App/App.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.App = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const AppUI_1 = require("./AppUI");
6
- const App = ({ children }) => {
7
- return (0, jsx_runtime_1.jsx)(AppUI_1.AppUI, { children: children });
6
+ const App = (props) => {
7
+ return (0, jsx_runtime_1.jsx)(AppUI_1.AppUI, { ...props });
8
8
  };
9
9
  exports.App = App;
package/App/AppUI.d.ts CHANGED
@@ -1,2 +1,6 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
- export declare const AppUI: FC<PropsWithChildren>;
2
+ interface AppUIProps {
3
+ appFooter?: React.ReactNode;
4
+ }
5
+ export declare const AppUI: FC<PropsWithChildren<AppUIProps>>;
6
+ export {};
package/App/AppUI.js CHANGED
@@ -7,7 +7,7 @@ const hooks_1 = require("@headless-adminapp/app/hooks");
7
7
  const react_1 = require("react");
8
8
  const AppHeaderContianer_1 = require("./AppHeaderContianer");
9
9
  const Navigation_1 = require("./Navigation");
10
- const AppUI = ({ children }) => {
10
+ const AppUI = ({ children, appFooter, }) => {
11
11
  const isMobile = (0, hooks_1.useIsMobile)();
12
12
  const isTablet = (0, hooks_1.useIsTablet)();
13
13
  const [isNavOpen, setIsNavOpen] = (0, react_1.useState)(!isMobile);
@@ -31,6 +31,6 @@ const AppUI = ({ children }) => {
31
31
  flex: 1,
32
32
  position: 'relative',
33
33
  overflow: 'hidden',
34
- }, children: children })] })] }));
34
+ }, children: children })] }), appFooter] }));
35
35
  };
36
36
  exports.AppUI = AppUI;
@@ -70,6 +70,7 @@ const NavigationContainer = ({ open, type, onOpenChange, isMini, }) => {
70
70
  gap: 8,
71
71
  }, children: (0, jsx_runtime_1.jsx)(react_components_1.Hamburger, { onClick: () => onOpenChange(false) }) }) })), (0, jsx_runtime_1.jsx)(react_components_1.NavDrawerBody, { style: {
72
72
  paddingTop: 8,
73
+ paddingBottom: 8,
73
74
  }, children: sections.map((section, index) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [!section.hideLabel && !isMini && ((0, jsx_runtime_1.jsx)(react_components_1.NavSectionHeader, { children: section.label })), isMini && index > 0 && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.5 } }) })), section.items.map((item) => {
74
75
  if (item.type === app_2.PageType.Category) {
75
76
  const isActive = item.items.some((subItem) => subItem.active);
@@ -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: "div", className: (0, react_components_1.mergeClasses)(styles.root, align === 'right' && styles.right), style: {
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.type === 'date') {
70
- if (attribute.format === 'datetime') {
71
- defaultMaxWidth = 200;
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 = 100;
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.30",
3
+ "version": "1.4.32",
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": "deb5d4fe0c4d7504e8479b252e23b8155a4f6a4b"
57
+ "gitHead": "adf0790db7264b5050b1160837bb599780791b24"
58
58
  }