@headless-adminapp/fluent 0.0.17-alpha.38 → 0.0.17-alpha.40

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.
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ interface GridHeaderMobileProps {
3
+ }
4
+ export declare const GridHeaderMobile: FC<GridHeaderMobileProps>;
5
+ export {};
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GridHeaderMobile = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
7
+ const locale_1 = require("@headless-adminapp/app/locale");
8
+ const icons_1 = require("@headless-adminapp/icons");
9
+ const AppStringContext_1 = require("../App/AppStringContext");
10
+ const GridHeaderMobile = () => {
11
+ const viewLookup = (0, hooks_1.useGridViewLookupData)();
12
+ const selectedView = (0, hooks_1.useSelectedView)();
13
+ const changeView = (0, hooks_1.useChangeView)();
14
+ const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
15
+ const { language } = (0, locale_1.useLocale)();
16
+ const appStrings = (0, AppStringContext_1.useAppStrings)();
17
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
18
+ alignItems: 'center',
19
+ paddingInline: 8,
20
+ gap: 8,
21
+ display: 'flex',
22
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { alignItems: 'center', display: 'flex', gap: 16, flex: 1 }, children: (0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value), style: { flex: 1 } }) }), (0, jsx_runtime_1.jsx)("div", { style: {
23
+ alignItems: 'center',
24
+ gap: 16,
25
+ justifyContent: 'space-between',
26
+ display: 'flex',
27
+ }, children: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { hasIcons: true, children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, {}), iconPosition: "after" }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => {
28
+ var _a, _b;
29
+ return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), icon: selectedView.id === view.id ? ((0, jsx_runtime_1.jsx)(icons_1.Icons.Checkmark, {})) : undefined, children: (_b = (_a = view.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : view.name }, view.id));
30
+ }) }) })] }) })] }));
31
+ };
32
+ exports.GridHeaderMobile = GridHeaderMobile;
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ interface GridListContainerProps {
3
+ disableSelection?: boolean;
4
+ disableContextMenu?: boolean;
5
+ disableColumnResize?: boolean;
6
+ disableColumnSort?: boolean;
7
+ disableColumnReorder?: boolean;
8
+ disableColumnFilter?: boolean;
9
+ noPadding?: boolean;
10
+ }
11
+ export declare const GridListContainer: FC<GridListContainerProps>;
12
+ export {};
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GridListContainer = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const datagrid_1 = require("@headless-adminapp/app/datagrid");
7
+ const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
8
+ const locale_1 = require("@headless-adminapp/app/locale");
9
+ const mutable_1 = require("@headless-adminapp/app/mutable");
10
+ const navigation_1 = require("@headless-adminapp/app/navigation");
11
+ const hooks_2 = require("@headless-adminapp/app/recordset/hooks");
12
+ const react_virtual_1 = require("@tanstack/react-virtual");
13
+ const react_1 = require("react");
14
+ const uuid_1 = require("uuid");
15
+ const RecordCard_1 = require("../PageEntityForm/RecordCard");
16
+ const RecordCardLoading_1 = require("../PageEntityForm/RecordCardLoading");
17
+ const ScrollbarWithMoreDataRequest_1 = require("./ScrollbarWithMoreDataRequest");
18
+ const useStyles = (0, react_components_1.makeStyles)({
19
+ root: {
20
+ '&:hover': {
21
+ background: react_components_1.tokens.colorNeutralBackground1Hover,
22
+ },
23
+ },
24
+ });
25
+ const fallbackData = [];
26
+ const GridListContainer = ({}) => {
27
+ const styles = useStyles();
28
+ const data = (0, hooks_1.useGridData)();
29
+ const dataState = (0, hooks_1.useGridDataState)();
30
+ const fetchNextPage = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.fetchNextPage);
31
+ const schema = (0, hooks_1.useDataGridSchema)();
32
+ const view = (0, hooks_1.useSelectedView)();
33
+ const tableWrapperRef = (0, react_1.useRef)(null);
34
+ const { direction } = (0, locale_1.useLocale)();
35
+ const dataRef = (0, react_1.useRef)(data);
36
+ dataRef.current = data;
37
+ const uniqueRecords = (0, react_1.useMemo)(() => {
38
+ var _a;
39
+ return ((_a = data === null || data === void 0 ? void 0 : data.records.map((record) => (Object.assign(Object.assign({}, record), { __uuid: (0, uuid_1.v4)() })))) !== null && _a !== void 0 ? _a : fallbackData);
40
+ }, [data === null || data === void 0 ? void 0 : data.records]);
41
+ const rows = uniqueRecords;
42
+ const virtualizer = (0, react_virtual_1.useVirtualizer)({
43
+ count: rows.length,
44
+ getScrollElement: () => { var _a, _b; return (_b = (_a = tableWrapperRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement; },
45
+ estimateSize: () => 40,
46
+ overscan: 5,
47
+ enabled: true,
48
+ });
49
+ const virtualItems = virtualizer.getVirtualItems();
50
+ const virtualSize = virtualizer.getTotalSize();
51
+ const recordSetSetter = (0, hooks_2.useRecordSetSetter)();
52
+ const openFormInternal = (0, navigation_1.useOpenForm)();
53
+ const openRecord = (0, react_1.useCallback)((id) => {
54
+ var _a, _b;
55
+ recordSetSetter(schema.logicalName, (_b = (_a = dataRef.current) === null || _a === void 0 ? void 0 : _a.records.map((x) => x[schema.idAttribute])) !== null && _b !== void 0 ? _b : []);
56
+ openFormInternal({
57
+ logicalName: schema.logicalName,
58
+ id,
59
+ });
60
+ }, [openFormInternal, recordSetSetter, schema.idAttribute, schema.logicalName]);
61
+ return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(ScrollbarWithMoreDataRequest_1.ScrollbarWithMoreDataRequest, { data: data === null || data === void 0 ? void 0 : data.records, hasMore: dataState === null || dataState === void 0 ? void 0 : dataState.hasNextPage, rtl: direction === 'rtl', onRequestMore: () => {
62
+ fetchNextPage();
63
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
64
+ position: 'relative',
65
+ }, ref: tableWrapperRef, children: (0, jsx_runtime_1.jsxs)("div", { style: {
66
+ display: 'flex',
67
+ flexDirection: 'column',
68
+ width: '100%',
69
+ height: virtualizer.getTotalSize(),
70
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
71
+ display: 'flex',
72
+ flexDirection: 'column',
73
+ }, children: virtualItems.map((virtualRow) => {
74
+ const row = rows[virtualRow.index];
75
+ return ((0, jsx_runtime_1.jsx)("div", { ref: virtualizer.measureElement, "data-index": virtualRow.index, className: (0, react_components_1.mergeClasses)(styles.root), style: {
76
+ width: '100%',
77
+ position: 'absolute',
78
+ transform: `translateY(${virtualRow.start}px)`,
79
+ }, onClick: () => {
80
+ const id = row[schema.idAttribute];
81
+ openRecord(id);
82
+ }, children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view.experience.card, record: row, schema: schema, selected: false }) }, virtualRow.key));
83
+ }) }), dataState.isFetching && ((0, jsx_runtime_1.jsx)("div", { style: {
84
+ display: 'flex',
85
+ flexDirection: 'column',
86
+ width: '100%',
87
+ position: 'absolute',
88
+ transform: `translateY(${virtualSize}px)`,
89
+ }, children: Array.from({ length: 10 }).map((_, index) => ((0, jsx_runtime_1.jsx)(RecordCardLoading_1.RecordCardLoading, { cardView: view.experience.card, schema: schema }, index))) }))] }) }) }) }));
90
+ };
91
+ exports.GridListContainer = GridListContainer;
@@ -9,10 +9,12 @@ const locale_1 = require("@headless-adminapp/app/locale");
9
9
  const mutable_1 = require("@headless-adminapp/app/mutable");
10
10
  const navigation_1 = require("@headless-adminapp/app/navigation");
11
11
  const hooks_2 = require("@headless-adminapp/app/recordset/hooks");
12
+ const icons_1 = require("@headless-adminapp/icons");
12
13
  const react_table_1 = require("@tanstack/react-table");
13
14
  const react_virtual_1 = require("@tanstack/react-virtual");
14
15
  const react_1 = require("react");
15
16
  const uuid_1 = require("uuid");
17
+ const PageEntityViewStringContext_1 = require("../PageEntityView/PageEntityViewStringContext");
16
18
  const ScrollbarWithMoreDataRequest_1 = require("./ScrollbarWithMoreDataRequest");
17
19
  const useTableColumns_1 = require("./useTableColumns");
18
20
  const utils_1 = require("./utils");
@@ -84,6 +86,7 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
84
86
  });
85
87
  }, [openFormInternal, recordSetSetter, schema.idAttribute, schema.logicalName]);
86
88
  const { direction } = (0, locale_1.useLocale)();
89
+ const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
87
90
  const dataRef = (0, react_1.useRef)(data);
88
91
  dataRef.current = data;
89
92
  const tableColumns = (0, useTableColumns_1.useTableColumns)({
@@ -177,71 +180,80 @@ const GridTableContainer = ({ noPadding, disableColumnFilter, disableColumnSort,
177
180
  const isScrolledToRight = ((_c = (_b = (_a = tableWrapperRef.current) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.scrollLeft) ===
178
181
  ((_g = (_f = (_e = (_d = tableWrapperRef.current) === null || _d === void 0 ? void 0 : _d.parentElement) === null || _e === void 0 ? void 0 : _e.parentElement) === null || _f === void 0 ? void 0 : _f.scrollWidth) !== null && _g !== void 0 ? _g : 0) -
179
182
  ((_l = (_k = (_j = (_h = tableWrapperRef.current) === null || _h === void 0 ? void 0 : _h.parentElement) === null || _j === void 0 ? void 0 : _j.parentElement) === null || _k === void 0 ? void 0 : _k.clientWidth) !== null && _l !== void 0 ? _l : 0);
180
- return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(ScrollbarWithMoreDataRequest_1.ScrollbarWithMoreDataRequest, { data: data === null || data === void 0 ? void 0 : data.records, hasMore: dataState === null || dataState === void 0 ? void 0 : dataState.hasNextPage, rtl: direction === 'rtl', onRequestMore: () => {
183
+ return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsxs)(ScrollbarWithMoreDataRequest_1.ScrollbarWithMoreDataRequest, { data: data === null || data === void 0 ? void 0 : data.records, hasMore: dataState === null || dataState === void 0 ? void 0 : dataState.hasNextPage, rtl: direction === 'rtl', onRequestMore: () => {
181
184
  fetchNextPage();
182
- }, children: (0, jsx_runtime_1.jsx)("div", { style: {
183
- paddingInline: noPadding ? 0 : 8,
184
- position: 'relative',
185
- }, ref: tableWrapperRef, children: (0, jsx_runtime_1.jsxs)(react_components_1.Table, { style: {
186
- display: 'flex',
187
- flexDirection: 'column',
188
- borderCollapse: 'collapse',
189
- width: '100%',
190
- height: virtualizer.getTotalSize() + 33,
191
- ['--action-shadow']: !isScrolledToRight
192
- ? '-2px 0px 6px rgba(0, 0, 0, 0.12)'
193
- : 'none',
194
- }, ref: tableElementRef, className: "table-pseduo", children: [(0, jsx_runtime_1.jsx)(react_components_1.TableHeader, { style: {
195
- display: 'flex',
196
- position: 'sticky',
197
- top: 0,
198
- background: react_components_1.tokens.colorNeutralBackground3,
199
- zIndex: 2,
200
- }, children: table.getHeaderGroups().map((headerGroup) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { style: {
185
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
186
+ paddingInline: noPadding ? 0 : 8,
187
+ position: 'relative',
188
+ }, ref: tableWrapperRef, children: (0, jsx_runtime_1.jsxs)(react_components_1.Table, { style: {
189
+ display: 'flex',
190
+ flexDirection: 'column',
191
+ borderCollapse: 'collapse',
192
+ width: '100%',
193
+ height: virtualizer.getTotalSize() + 33,
194
+ ['--action-shadow']: !isScrolledToRight
195
+ ? '-2px 0px 6px rgba(0, 0, 0, 0.12)'
196
+ : 'none',
197
+ }, ref: tableElementRef, className: "table-pseduo", children: [(0, jsx_runtime_1.jsx)(react_components_1.TableHeader, { style: {
198
+ display: 'flex',
201
199
  position: 'sticky',
202
200
  top: 0,
203
- display: 'flex',
204
- minWidth: 'calc(100% - 16px)',
205
- }, children: headerGroup.headers.map((header) => header.isPlaceholder
206
- ? null
207
- : (0, react_table_1.flexRender)(header.column.columnDef.header, Object.assign(Object.assign({}, header.getContext()), { key: header.id }))) }, headerGroup.id))) }), (0, jsx_runtime_1.jsx)(react_components_1.TableBody, { style: {
208
- display: 'flex',
209
- flexDirection: 'column',
210
- transform: 'translateY(-33px)',
211
- }, children: virtualItems.map((virtualRow) => {
212
- const row = rows[virtualRow.index];
213
- return ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { className: (0, react_components_1.mergeClasses)(styles.root), style: {
201
+ background: react_components_1.tokens.colorNeutralBackground3,
202
+ zIndex: 2,
203
+ }, children: table.getHeaderGroups().map((headerGroup) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { style: {
204
+ position: 'sticky',
205
+ top: 0,
214
206
  display: 'flex',
215
- height: `${virtualRow.size}px`,
216
207
  minWidth: 'calc(100% - 16px)',
217
- position: 'absolute',
218
- transform: `translateY(${virtualRow.start}px)`,
219
- }, onClick: () => {
220
- setSelectedIdsRef.current(() => {
221
- const id = row.original[schema.idAttribute];
222
- return [id];
223
- });
224
- }, onDoubleClick: () => {
225
- const id = row.original[schema.idAttribute];
226
- openRecord(id);
227
- }, children: row.getVisibleCells().map((cell) => (0, react_table_1.flexRender)(cell.column.columnDef.cell, Object.assign(Object.assign({}, cell.getContext()), { key: cell.column.id }))) }, row.id));
228
- }) }), dataState.isFetching && ((0, jsx_runtime_1.jsx)(react_components_1.TableBody, { style: {
229
- display: 'flex',
230
- flexDirection: 'column',
231
- position: 'absolute',
232
- transform: `translateY(${virtualSize}px)`,
233
- }, children: Array.from({ length: 10 }).map((_, index) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { style: {
208
+ }, children: headerGroup.headers.map((header) => header.isPlaceholder
209
+ ? null
210
+ : (0, react_table_1.flexRender)(header.column.columnDef.header, Object.assign(Object.assign({}, header.getContext()), { key: header.id }))) }, headerGroup.id))) }), (0, jsx_runtime_1.jsx)(react_components_1.TableBody, { style: {
234
211
  display: 'flex',
235
- height: 44,
236
- alignItems: 'center',
237
- }, children: table.getAllColumns().map((column, index) => {
238
- if (!column.getIsVisible())
239
- return null;
240
- return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { style: {
212
+ flexDirection: 'column',
213
+ transform: 'translateY(-33px)',
214
+ }, children: virtualItems.map((virtualRow) => {
215
+ const row = rows[virtualRow.index];
216
+ return ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { className: (0, react_components_1.mergeClasses)(styles.root), style: {
241
217
  display: 'flex',
242
- alignItems: 'center',
243
- width: column.getSize(),
244
- }, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { size: 16 }) }, index));
245
- }) }, index))) }))] }) }) }) }));
218
+ height: `${virtualRow.size}px`,
219
+ minWidth: 'calc(100% - 16px)',
220
+ position: 'absolute',
221
+ transform: `translateY(${virtualRow.start}px)`,
222
+ }, onClick: () => {
223
+ setSelectedIdsRef.current(() => {
224
+ const id = row.original[schema.idAttribute];
225
+ return [id];
226
+ });
227
+ }, onDoubleClick: () => {
228
+ const id = row.original[schema.idAttribute];
229
+ openRecord(id);
230
+ }, children: row.getVisibleCells().map((cell) => (0, react_table_1.flexRender)(cell.column.columnDef.cell, Object.assign(Object.assign({}, cell.getContext()), { key: cell.column.id }))) }, row.id));
231
+ }) }), dataState.isFetching && ((0, jsx_runtime_1.jsx)(react_components_1.TableBody, { style: {
232
+ display: 'flex',
233
+ flexDirection: 'column',
234
+ position: 'absolute',
235
+ transform: `translateY(${virtualSize}px)`,
236
+ }, children: Array.from({ length: 10 }).map((_, index) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { style: {
237
+ display: 'flex',
238
+ height: 44,
239
+ alignItems: 'center',
240
+ }, children: table.getAllColumns().map((column, index) => {
241
+ if (!column.getIsVisible())
242
+ return null;
243
+ return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { style: {
244
+ display: 'flex',
245
+ alignItems: 'center',
246
+ width: column.getSize(),
247
+ }, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { size: 16 }) }, index));
248
+ }) }, index))) }))] }) }), (data === null || data === void 0 ? void 0 : data.records.length) === 0 && !dataState.isFetching && ((0, jsx_runtime_1.jsxs)("div", { style: {
249
+ display: 'flex',
250
+ flexDirection: 'column',
251
+ alignItems: 'center',
252
+ justifyContent: 'center',
253
+ position: 'absolute',
254
+ inset: 0,
255
+ gap: react_components_1.tokens.spacingVerticalL,
256
+ color: react_components_1.tokens.colorNeutralForeground3,
257
+ }, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 64 }) }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: strings.noRecordsFound })] }))] }) }));
246
258
  };
247
259
  exports.GridTableContainer = GridTableContainer;
@@ -45,7 +45,7 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
45
45
  const isSubgrid = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.isSubGrid);
46
46
  const contextCommands = isSubgrid
47
47
  ? // eslint-disable-next-line react-hooks/rules-of-hooks
48
- (0, hooks_1.useSubGridCommands)()
48
+ (0, hooks_1.useSubGridContextCommands)()
49
49
  : // eslint-disable-next-line react-hooks/rules-of-hooks
50
50
  (0, hooks_1.useMainGridContextCommands)();
51
51
  const mutableContextCommandState = (0, mutable_1.useMutableState)(contextCommands, true);
@@ -20,6 +20,9 @@ function WidgetDataGridContainer({ content, }) {
20
20
  if (!view) {
21
21
  return (0, jsx_runtime_1.jsx)("div", { children: "Loading..." });
22
22
  }
23
+ if (!schema) {
24
+ return (0, jsx_runtime_1.jsx)("div", { children: "Schema not found" });
25
+ }
23
26
  return ((0, jsx_runtime_1.jsx)("div", { style: {
24
27
  display: 'flex',
25
28
  flex: 1,
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
- 'use client';
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.WidgetTileContainer = void 0;
5
4
  const jsx_runtime_1 = require("react/jsx-runtime");
6
5
  const react_components_1 = require("@fluentui/react-components");
7
- const WidgetTitleBar_1 = require("./WidgetTitleBar");
8
6
  const useWidgetDetail_1 = require("./hooks/useWidgetDetail");
7
+ const WidgetTitleBar_1 = require("./WidgetTitleBar");
9
8
  const WidgetTileContainer = ({ content, }) => {
10
9
  const { transformedCommands, widget } = (0, useWidgetDetail_1.useWidgetDetail)(content);
11
10
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Widgets = Widgets;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const hooks_1 = require("@headless-adminapp/app/hooks");
5
6
  const insights_1 = require("@headless-adminapp/app/insights");
6
7
  const mutable_1 = require("@headless-adminapp/app/mutable");
7
8
  const widget_1 = require("@headless-adminapp/app/widget");
@@ -21,12 +22,13 @@ const WidgetProvider = ({ children, widget, }) => {
21
22
  widget,
22
23
  data: widget.defaultData,
23
24
  });
24
- }, [widget]);
25
+ }, [contextValue, widget]);
25
26
  return ((0, jsx_runtime_1.jsx)(widget_1.WidgetContext.Provider, { value: contextValue, children: children }));
26
27
  };
27
28
  function Widgets({ widgets, }) {
29
+ const isMobile = (0, hooks_1.useIsMobile)();
28
30
  return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGrid, { children: widgets.map((widget, index) => {
29
- return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGridItem, { row: widget.rows, column: widget.columns, children: (0, jsx_runtime_1.jsx)(WidgetProvider, { widget: widget, children: (0, jsx_runtime_1.jsx)(WidgetItem, {}) }) }, index));
31
+ return ((0, jsx_runtime_1.jsx)(Grid_1.WidgetGridItem, { row: widget.rows, column: isMobile ? 12 : widget.columns, children: (0, jsx_runtime_1.jsx)(WidgetProvider, { widget: widget, children: (0, jsx_runtime_1.jsx)(WidgetItem, {}) }) }, index));
30
32
  }) }));
31
33
  }
32
34
  function WidgetItem() {
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ /* eslint-disable unused-imports/no-unused-vars */
3
+ // TODO: Remove eslint disable condition after finishing the implementation
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
5
  // number format - decimal or currency
4
6
  // number format - number of decimals
@@ -45,7 +45,7 @@ function renderLine(line, dataset) {
45
45
  function renderLines(lines, dataset) {
46
46
  return lines.map((line) => renderLine(line, dataset));
47
47
  }
48
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
48
+ // eslint-disable-next-line unused-imports/no-unused-vars
49
49
  function renderArea(area, dataset) {
50
50
  return ((0, jsx_runtime_1.jsx)(recharts_1.Area, { yAxisId: 'left', type: area.curveType, dataKey: area.dataKey, name: area.dataLabel, stroke: area.color, fill: area.color, strokeWidth: 1, dot: false, activeDot: {
51
51
  stroke: area.color,
@@ -55,7 +55,7 @@ function renderArea(area, dataset) {
55
55
  function renderAreas(areas, dataset) {
56
56
  return areas.map((area) => renderArea(area, dataset));
57
57
  }
58
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
58
+ // eslint-disable-next-line unused-imports/no-unused-vars
59
59
  function renderBar(bar, dataset) {
60
60
  return ((0, jsx_runtime_1.jsx)(recharts_1.Bar, { yAxisId: 'left', type: bar.curveType, dataKey: bar.dataKey, name: bar.dataLabel, stroke: bar.color, fill: bar.color, strokeWidth: 1, stackId: bar.stackId }, bar.dataKey));
61
61
  }
@@ -52,7 +52,7 @@ function RecordCard({ schema, cardView, record, selected, }) {
52
52
  display: 'flex',
53
53
  flexDirection: 'column',
54
54
  flex: 1,
55
- }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: _record[cardView.primaryColumn] }), (_a = cardView.secondaryColumns) === null || _a === void 0 ? void 0 : _a.map((column) => {
55
+ }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { wordBreak: 'break-all' }, children: _record[cardView.primaryColumn] }), (_a = cardView.secondaryColumns) === null || _a === void 0 ? void 0 : _a.map((column) => {
56
56
  const value = _record[column.name];
57
57
  if (!value) {
58
58
  return null;
@@ -0,0 +1,8 @@
1
+ import { CardView } from '@headless-adminapp/core/experience/view';
2
+ import { Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
3
+ interface RecordCardLoadingProps<S extends SchemaAttributes = SchemaAttributes> {
4
+ schema: Schema<S>;
5
+ cardView: CardView<S>;
6
+ }
7
+ export declare function RecordCardLoading<S extends SchemaAttributes = SchemaAttributes>({ cardView }: RecordCardLoadingProps<S>): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecordCardLoading = RecordCardLoading;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const useStyles = (0, react_components_1.makeStyles)({
7
+ root: {
8
+ width: '100%',
9
+ display: 'flex',
10
+ flexDirection: 'row',
11
+ paddingInline: react_components_1.tokens.spacingHorizontalL,
12
+ paddingBlock: react_components_1.tokens.spacingVerticalS,
13
+ gap: react_components_1.tokens.spacingHorizontalS,
14
+ },
15
+ });
16
+ function RecordCardLoading({ cardView }) {
17
+ var _a;
18
+ const styles = useStyles();
19
+ return ((0, jsx_runtime_1.jsxs)("div", { className: (0, react_components_1.mergeClasses)(styles.root), children: [cardView.showAvatar && ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { color: "neutral", style: { cursor: 'pointer' } })), (0, jsx_runtime_1.jsxs)("div", { style: {
20
+ display: 'flex',
21
+ flexDirection: 'column',
22
+ flex: 1,
23
+ gap: react_components_1.tokens.spacingVerticalXXS,
24
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { paddingBlock: 2 }, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { size: 16, style: { height: 16 } }) }), (_a = cardView.secondaryColumns) === null || _a === void 0 ? void 0 : _a.map((_, index) => ((0, jsx_runtime_1.jsx)("div", { style: { paddingBlock: 2 }, children: (0, jsx_runtime_1.jsx)(react_components_1.SkeletonItem, { size: 16, style: { width: 160, height: 12 } }) }, index)))] })] }));
25
+ }
@@ -55,7 +55,11 @@ function SectionContainer({ section }) {
55
55
  case 'quickview':
56
56
  return null;
57
57
  case 'subgrid':
58
- return ((0, jsx_runtime_1.jsx)(SubgridControl_1.SubgridControl, { logicalName: control.logicalName, allowViewSelection: control.allowViewSelection, viewId: control.viewId, availableViewIds: control.availableViewIds, associated: !control.associatedAttribute
58
+ let ContainerComponent = null;
59
+ if (control.component) {
60
+ ContainerComponent = componentStore_1.componentStore.getComponent(control.component);
61
+ }
62
+ return ((0, jsx_runtime_1.jsx)(SubgridControl_1.SubgridControl, { logicalName: control.logicalName, allowViewSelection: control.allowViewSelection, viewId: control.viewId, availableViewIds: control.availableViewIds, ContainerComponent: ContainerComponent, associated: !control.associatedAttribute
59
63
  ? false
60
64
  : {
61
65
  logicalName: schema.logicalName,
@@ -8,6 +8,7 @@ interface SubgridControlProps {
8
8
  id: string;
9
9
  refAttributeName: string;
10
10
  };
11
+ ContainerComponent?: React.ComponentType<any> | null;
11
12
  }
12
13
  export declare function SubgridControl(props: SubgridControlProps): import("react/jsx-runtime").JSX.Element;
13
14
  export {};
@@ -8,7 +8,7 @@ const hooks_1 = require("@headless-adminapp/app/metadata/hooks");
8
8
  const react_1 = require("react");
9
9
  const FormSubgridContainer_1 = require("../PageEntityView/FormSubgridContainer");
10
10
  function SubgridControl(props) {
11
- var _a;
11
+ var _a, _b;
12
12
  const schema = (0, hooks_1.useSchema)(props.logicalName);
13
13
  const [viewId, setViewId] = (0, react_1.useState)(props.viewId);
14
14
  const { view, isLoadingView } = (0, hooks_1.useExperienceView)(props.logicalName, viewId, !!props.associated, props.availableViewIds);
@@ -62,5 +62,6 @@ function SubgridControl(props) {
62
62
  }
63
63
  return brokenContent;
64
64
  }
65
- return ((0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: viewLookup, onChangeView: setViewId, commands: (props.associated ? subgridCommands : commands), isSubGrid: props.associated ? true : false, associated: props.associated, extraFilter: extraFilter, allowViewSelection: (_a = props.allowViewSelection) !== null && _a !== void 0 ? _a : false, children: (0, jsx_runtime_1.jsx)(FormSubgridContainer_1.FormSubgridContainer, {}) }));
65
+ const ContainerComponent = (_a = props.ContainerComponent) !== null && _a !== void 0 ? _a : FormSubgridContainer_1.FormSubgridContainer;
66
+ return ((0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: viewLookup, onChangeView: setViewId, commands: (props.associated ? subgridCommands : commands), isSubGrid: props.associated ? true : false, associated: props.associated, extraFilter: extraFilter, allowViewSelection: (_b = props.allowViewSelection) !== null && _b !== void 0 ? _b : false, children: (0, jsx_runtime_1.jsx)(ContainerComponent, {}) }));
66
67
  }
@@ -3,13 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PageEntityView = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const datagrid_1 = require("@headless-adminapp/app/datagrid");
6
+ const hooks_1 = require("@headless-adminapp/app/hooks");
6
7
  const PageEntityViewProvider_1 = require("@headless-adminapp/app/providers/PageEntityViewProvider");
7
8
  const icons_1 = require("@headless-adminapp/icons");
8
9
  const PageBroken_1 = require("../components/PageBroken");
9
10
  const PageLoading_1 = require("../components/PageLoading");
10
11
  const PageEntityViewDesktopContainer_1 = require("./PageEntityViewDesktopContainer");
12
+ const PageEntityViewMobileContainer_1 = require("./PageEntityViewMobileContainer");
11
13
  const PageEntityView = ({ logicalName, viewId, onChangeView, }) => {
12
14
  const result = (0, datagrid_1.useLoadMainGridPage)(logicalName, viewId);
15
+ const isMobile = (0, hooks_1.useIsMobile)();
13
16
  if (result.loading) {
14
17
  return (0, jsx_runtime_1.jsx)(PageLoading_1.PageLoading, {});
15
18
  }
@@ -17,6 +20,6 @@ const PageEntityView = ({ logicalName, viewId, onChangeView, }) => {
17
20
  return ((0, jsx_runtime_1.jsx)(PageBroken_1.PageBroken, { Icon: icons_1.Icons.Error, title: result.title, message: result.message }));
18
21
  }
19
22
  const { schema, commands, viewLookup, view } = result;
20
- return ((0, jsx_runtime_1.jsx)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: (0, jsx_runtime_1.jsx)(PageEntityViewDesktopContainer_1.PageEntityViewDesktopContainer, {}) }));
23
+ return ((0, jsx_runtime_1.jsx)(PageEntityViewProvider_1.PageEntityViewProvider, { schema: schema, view: view, availableViews: viewLookup, commands: commands, onChangeView: onChangeView, children: isMobile ? ((0, jsx_runtime_1.jsx)(PageEntityViewMobileContainer_1.PageEntityViewMobileContainer, {})) : ((0, jsx_runtime_1.jsx)(PageEntityViewDesktopContainer_1.PageEntityViewDesktopContainer, {})) }));
21
24
  };
22
25
  exports.PageEntityView = PageEntityView;
@@ -0,0 +1,2 @@
1
+ import { FC } from 'react';
2
+ export declare const PageEntityViewMobileContainer: FC;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PageEntityViewMobileContainer = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const CommandContainer_1 = require("../DataGrid/CommandContainer");
7
+ const GridHeaderMobile_1 = require("../DataGrid/GridHeaderMobile");
8
+ const GridListContainer_1 = require("../DataGrid/GridListContainer");
9
+ const GridPaginationContainer_1 = require("../DataGrid/GridPaginationContainer");
10
+ const PageEntityViewDesktopFrame_1 = require("./PageEntityViewDesktopFrame");
11
+ const PageEntityViewMobileContainer = () => {
12
+ return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(PageEntityViewDesktopFrame_1.PageEntityViewDesktopFrame, { commandBar: (0, jsx_runtime_1.jsx)(CommandContainer_1.CommandContainer, {}), header: (0, jsx_runtime_1.jsx)(GridHeaderMobile_1.GridHeaderMobile, {}), content: (0, jsx_runtime_1.jsx)(GridListContainer_1.GridListContainer, {}), footer: (0, jsx_runtime_1.jsx)(GridPaginationContainer_1.GridPaginationContainer, {}) }) }));
13
+ };
14
+ exports.PageEntityViewMobileContainer = PageEntityViewMobileContainer;
@@ -17,6 +17,7 @@ export interface PageEntityViewStringSet {
17
17
  filter: string;
18
18
  clearFilter: string;
19
19
  filterBy: string;
20
+ noRecordsFound: string;
20
21
  }
21
22
  export declare const defaultPageEntityViewStrings: PageEntityViewStringSet;
22
23
  export declare const PageEntityViewStringContext: import("react").Context<PageEntityViewStringSet>;
@@ -22,6 +22,7 @@ exports.defaultPageEntityViewStrings = {
22
22
  filter: 'Filter',
23
23
  sortByDescending: 'Sort by descending',
24
24
  filterBy: 'Filter by',
25
+ noRecordsFound: "We didn't find anything to show here",
25
26
  };
26
27
  exports.PageEntityViewStringContext = (0, react_1.createContext)(exports.defaultPageEntityViewStrings);
27
28
  function usePageEntityViewStrings() {
@@ -16,7 +16,7 @@ function createInsightLookup(insights) {
16
16
  function PageInsights({ insightId, insights, onChangeInsight, }) {
17
17
  const insightExpereince = (0, react_1.useMemo)(() => {
18
18
  return insights.find((insight) => insight.id === insightId);
19
- }, [insightId]);
19
+ }, [insightId, insights]);
20
20
  const insightLookups = (0, react_1.useMemo)(() => createInsightLookup(insights), [insights]);
21
21
  if (!insightExpereince) {
22
22
  return null;
@@ -2,4 +2,4 @@ import { ControlProps } from './types';
2
2
  export interface TelephoneControlProps extends ControlProps<string> {
3
3
  autoComplete?: string;
4
4
  }
5
- export declare function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, }: TelephoneControlProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, autoComplete, }: TelephoneControlProps): import("react/jsx-runtime").JSX.Element;
@@ -4,10 +4,10 @@ exports.TelephoneControl = TelephoneControl;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const icons_1 = require("@headless-adminapp/icons");
7
- function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, }) {
7
+ function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, autoComplete, }) {
8
8
  return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "tel", placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value || '', onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
9
9
  // invalid={error}
10
- disabled: disabled, autoComplete: autoComplete, style: {
10
+ readOnly: disabled || readOnly, autoComplete: autoComplete, style: {
11
11
  width: '100%',
12
12
  paddingRight: react_components_1.tokens.spacingHorizontalXS,
13
13
  },
@@ -3,4 +3,4 @@ export interface TextAreaControlProps extends ControlProps<string> {
3
3
  rows?: number;
4
4
  textTransform?: 'capitalize' | 'uppercase' | 'lowercase' | 'none';
5
5
  }
6
- export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, rows, textTransform, }: TextAreaControlProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows, textTransform, }: TextAreaControlProps): import("react/jsx-runtime").JSX.Element;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TextAreaControl = TextAreaControl;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
- function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, rows = 5, textTransform, }) {
6
+ function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, disabled, readOnly, rows = 5, textTransform, }) {
7
7
  return ((0, jsx_runtime_1.jsx)(react_components_1.Textarea, { placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value || '', onChange: (e) => {
8
8
  textTransform === 'uppercase'
9
9
  ? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toUpperCase())
@@ -12,5 +12,5 @@ function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFoc
12
12
  : onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
13
13
  }, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
14
14
  // error={error}
15
- disabled: disabled, rows: rows }));
15
+ readOnly: disabled || readOnly, rows: rows }));
16
16
  }
@@ -1,4 +1,4 @@
1
1
  import { ControlProps } from './types';
2
2
  export interface UrlControlProps extends ControlProps<string> {
3
3
  }
4
- export declare function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, }: UrlControlProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }: UrlControlProps): import("react/jsx-runtime").JSX.Element;
@@ -4,10 +4,10 @@ exports.UrlControl = UrlControl;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const icons_1 = require("@headless-adminapp/icons");
7
- function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, }) {
7
+ function UrlControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
8
8
  return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "url", placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value || '', onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
9
9
  // invalid={error}
10
- disabled: disabled, autoComplete: "off", style: {
10
+ readOnly: disabled || readOnly, autoComplete: "off", style: {
11
11
  width: '100%',
12
12
  paddingRight: react_components_1.tokens.spacingHorizontalXS,
13
13
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/fluent",
3
- "version": "0.0.17-alpha.38",
3
+ "version": "0.0.17-alpha.40",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -48,5 +48,5 @@
48
48
  "uuid": "11.0.3",
49
49
  "yup": "^1.4.0"
50
50
  },
51
- "gitHead": "cf5abc4c56618fcc873bd31e3a26a84a9509edfa"
51
+ "gitHead": "5141e4c378ed0b2aac011927e4d6c10c797624e0"
52
52
  }
package/types/index.d.ts CHANGED
@@ -39,6 +39,7 @@ declare module '@headless-adminapp/icons/types' {
39
39
  Copy: Icon;
40
40
  Document: Icon;
41
41
  Image: Icon;
42
+ Checkmark: Icon;
42
43
  }
43
44
  }
44
45
  export {};