@headless-adminapp/fluent 0.0.17-alpha.39 → 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.
@@ -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;
@@ -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: {
@@ -22,7 +22,7 @@ const WidgetProvider = ({ children, widget, }) => {
22
22
  widget,
23
23
  data: widget.defaultData,
24
24
  });
25
- }, [widget]);
25
+ }, [contextValue, widget]);
26
26
  return ((0, jsx_runtime_1.jsx)(widget_1.WidgetContext.Provider, { value: contextValue, children: children }));
27
27
  };
28
28
  function Widgets({ widgets, }) {
@@ -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
  }
@@ -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
  }
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/fluent",
3
- "version": "0.0.17-alpha.39",
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": "2bfa7d267f5fa6beb476fda508c43661444dc894"
51
+ "gitHead": "5141e4c378ed0b2aac011927e4d6c10c797624e0"
52
52
  }