@headless-adminapp/app 1.4.11 → 1.4.13

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.
Files changed (32) hide show
  1. package/app/LayoutProvider.js +2 -1
  2. package/builders/CommandBuilder/SubgridCommandBuilder.js +2 -2
  3. package/builders/CommandBuilder/ViewCommandBuilder.js +3 -2
  4. package/builders/utils.d.ts +4 -4
  5. package/builders/utils.js +24 -16
  6. package/header/HeaderProvider.d.ts +2 -0
  7. package/header/HeaderProvider.js +11 -0
  8. package/header/components/MobileHeaderLeftContent.d.ts +7 -0
  9. package/header/components/MobileHeaderLeftContent.js +9 -0
  10. package/header/components/MobileHeaderRightContent.d.ts +6 -0
  11. package/header/components/MobileHeaderRightContent.js +9 -0
  12. package/header/components/MobileHeaderTitle.d.ts +7 -0
  13. package/header/components/MobileHeaderTitle.js +9 -0
  14. package/header/context.d.ts +11 -0
  15. package/header/context.js +10 -0
  16. package/header/hooks/index.d.ts +4 -0
  17. package/header/hooks/index.js +11 -0
  18. package/header/hooks/useHeaderShowBackButton.d.ts +1 -0
  19. package/header/hooks/useHeaderShowBackButton.js +7 -0
  20. package/header/hooks/useHeaderValue.d.ts +2 -0
  21. package/header/hooks/useHeaderValue.js +14 -0
  22. package/header/hooks/useMobileHeader.d.ts +5 -0
  23. package/header/hooks/useMobileHeader.js +9 -0
  24. package/header/hooks/useMobileHeaderSetValue.d.ts +2 -0
  25. package/header/hooks/useMobileHeaderSetValue.js +30 -0
  26. package/header/index.d.ts +3 -0
  27. package/header/index.js +22 -0
  28. package/hooks/useElementLayout.d.ts +6 -2
  29. package/hooks/useElementLayout.js +22 -3
  30. package/package.json +2 -2
  31. package/utils/getAttributeFormattedValue.d.ts +1 -1
  32. package/utils/getAttributeFormattedValue.js +9 -1
@@ -6,6 +6,7 @@ const react_query_1 = require("@tanstack/react-query");
6
6
  const auth_1 = require("../auth");
7
7
  const defaults_1 = require("../defaults");
8
8
  const dialog_1 = require("../dialog");
9
+ const header_1 = require("../header");
9
10
  const locale_1 = require("../locale");
10
11
  const metadata_1 = require("../metadata");
11
12
  const progress_indicator_1 = require("../progress-indicator");
@@ -39,6 +40,6 @@ const defaultDataService = {
39
40
  },
40
41
  };
41
42
  const LayoutProvider = ({ authPlaceholder, authProps, dataService = defaultDataService, fileService, localeProps, metadataProps, queryClient = defaults_1.queryClient, routeProps, children, containers: { DialogContainer, ProgressIndicatorContainer, ToastNotificationContainer, }, }) => {
42
- return ((0, jsx_runtime_1.jsx)(route_1.RouteProvider, { ...routeProps, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(locale_1.LocaleProvider, { ...localeProps, children: (0, jsx_runtime_1.jsx)(metadata_1.MetadataProvider, { ...metadataProps, children: (0, jsx_runtime_1.jsx)(transport_1.DataServiceContext.Provider, { value: dataService, children: (0, jsx_runtime_1.jsx)(context_1.FileServiceContext.Provider, { value: fileService ?? null, children: (0, jsx_runtime_1.jsx)(dialog_1.DialogProvider, { children: (0, jsx_runtime_1.jsx)(progress_indicator_1.ProgressIndicatorProvider, { children: (0, jsx_runtime_1.jsxs)(toast_notification_1.ToastNotificationProvider, { children: [(0, jsx_runtime_1.jsx)(DialogContainer, {}), (0, jsx_runtime_1.jsx)(ProgressIndicatorContainer, {}), (0, jsx_runtime_1.jsx)(ToastNotificationContainer, {}), (0, jsx_runtime_1.jsx)(auth_1.AuthProvider, { ...authProps, children: (0, jsx_runtime_1.jsx)(AuthWrapper_1.AuthWrapper, { Placeholder: authPlaceholder, children: children }) })] }) }) }) }) }) }) }) }) }));
43
+ return ((0, jsx_runtime_1.jsx)(route_1.RouteProvider, { ...routeProps, children: (0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient, children: (0, jsx_runtime_1.jsx)(locale_1.LocaleProvider, { ...localeProps, children: (0, jsx_runtime_1.jsx)(metadata_1.MetadataProvider, { ...metadataProps, children: (0, jsx_runtime_1.jsx)(transport_1.DataServiceContext.Provider, { value: dataService, children: (0, jsx_runtime_1.jsx)(context_1.FileServiceContext.Provider, { value: fileService ?? null, children: (0, jsx_runtime_1.jsx)(dialog_1.DialogProvider, { children: (0, jsx_runtime_1.jsx)(progress_indicator_1.ProgressIndicatorProvider, { children: (0, jsx_runtime_1.jsxs)(toast_notification_1.ToastNotificationProvider, { children: [(0, jsx_runtime_1.jsx)(DialogContainer, {}), (0, jsx_runtime_1.jsx)(ProgressIndicatorContainer, {}), (0, jsx_runtime_1.jsx)(ToastNotificationContainer, {}), (0, jsx_runtime_1.jsx)(auth_1.AuthProvider, { ...authProps, children: (0, jsx_runtime_1.jsx)(header_1.HeaderProvider, { children: (0, jsx_runtime_1.jsx)(AuthWrapper_1.AuthWrapper, { Placeholder: authPlaceholder, children: children }) }) })] }) }) }) }) }) }) }) }) }));
43
44
  };
44
45
  exports.LayoutProvider = LayoutProvider;
@@ -206,7 +206,7 @@ var SubgridCommandBuilder;
206
206
  fileName: context.secondaryControl.view.name + '.xlsx',
207
207
  gridColumns: context.secondaryControl.gridColumns,
208
208
  records: result.records,
209
- schema: context.secondaryControl.schema,
209
+ attributes: context.secondaryControl.schema.attributes,
210
210
  schemaStore: context.stores.schemaStore,
211
211
  locale: context.locale,
212
212
  });
@@ -240,7 +240,7 @@ var SubgridCommandBuilder;
240
240
  fileName: context.secondaryControl.view.name + '.csv',
241
241
  gridColumns: context.secondaryControl.gridColumns,
242
242
  records: result.records,
243
- schema: context.secondaryControl.schema,
243
+ attributes: context.secondaryControl.schema.attributes,
244
244
  schemaStore: context.stores.schemaStore,
245
245
  locale: context.locale,
246
246
  });
@@ -69,6 +69,7 @@ var ViewCommandBuilder;
69
69
  Icon,
70
70
  text,
71
71
  localizedText: localizedTexts,
72
+ isQuickAction: true,
72
73
  onClick: (context) => {
73
74
  context.navigation.openForm({
74
75
  logicalName: context.primaryControl.schema.logicalName,
@@ -308,7 +309,7 @@ async function exportRecordsToExcel(context) {
308
309
  fileName: context.primaryControl.view.name + '.xlsx',
309
310
  gridColumns: context.primaryControl.gridColumns,
310
311
  records: result.records,
311
- schema: context.primaryControl.schema,
312
+ attributes: context.primaryControl.schema.attributes,
312
313
  schemaStore: context.stores.schemaStore,
313
314
  locale: context.locale,
314
315
  });
@@ -325,7 +326,7 @@ async function exportRecordsToCSV(context) {
325
326
  fileName: context.primaryControl.view.name + '.csv',
326
327
  gridColumns: context.primaryControl.gridColumns,
327
328
  records: result.records,
328
- schema: context.primaryControl.schema,
329
+ attributes: context.primaryControl.schema.attributes,
329
330
  schemaStore: context.stores.schemaStore,
330
331
  locale: context.locale,
331
332
  });
@@ -4,10 +4,11 @@ import { InferredSchemaType, Schema, SchemaAttributes } from '@headless-adminapp
4
4
  import { ISchemaStore } from '@headless-adminapp/core/store';
5
5
  import { Filter, IDataService } from '@headless-adminapp/core/transport';
6
6
  import { TransformedViewColumn } from '../datagrid';
7
- type ExportFn<S extends SchemaAttributes = SchemaAttributes> = (option: {
8
- schema: Schema<S>;
7
+ export type ExportColumn<S extends SchemaAttributes = SchemaAttributes> = Omit<TransformedViewColumn<S>, 'id' | 'component' | 'width' | 'maxWidth'>;
8
+ export type ExportFn<S extends SchemaAttributes = SchemaAttributes> = (option: {
9
+ attributes: S;
9
10
  records: unknown[];
10
- gridColumns: TransformedViewColumn<SchemaAttributes>[];
11
+ gridColumns: ExportColumn<S>[];
11
12
  schemaStore: ISchemaStore;
12
13
  fileName: string;
13
14
  locale: Locale;
@@ -27,4 +28,3 @@ export declare function retriveRecords<S extends SchemaAttributes = SchemaAttrib
27
28
  skip: number;
28
29
  limit: number;
29
30
  }): Promise<import("@headless-adminapp/core/transport").RetriveRecordsResult<InferredSchemaType<S>>>;
30
- export {};
package/builders/utils.js CHANGED
@@ -27,34 +27,38 @@ exports.exportRecordsXLS = exports.exportRecordsCSV = void 0;
27
27
  exports.retriveRecords = retriveRecords;
28
28
  const utils_1 = require("../datagrid/DataGridProvider/utils");
29
29
  const utils_2 = require("../utils");
30
- const getHeaders = (schema, gridColumns, schemaStore) => {
30
+ const getHeaders = (attributes, gridColumns, schemaStore) => {
31
31
  const headers = gridColumns.map((column) => {
32
32
  if (column.name.indexOf('.') !== -1) {
33
33
  const [lookup, field] = column.name.split('.');
34
- const entity = schema.attributes[lookup].entity;
34
+ const entity = attributes[lookup].entity;
35
35
  const lookupSchema = schemaStore.getSchema(entity);
36
- return `${lookupSchema.attributes[field]?.label} (${schema.attributes[lookup]?.label})`;
36
+ return `${lookupSchema.attributes[field]?.label} (${attributes[lookup]?.label})`;
37
37
  }
38
- return column.label ?? schema.attributes[column.name]?.label;
38
+ return column.label ?? attributes[column.name]?.label;
39
39
  });
40
40
  return headers;
41
41
  };
42
- function getAttribute({ column, schema, schemaStore, }) {
42
+ function getAttribute({ column, attributes, schemaStore, }) {
43
43
  let attribute;
44
44
  if (column.expandedKey) {
45
45
  const lookup = column.name;
46
46
  const field = column.expandedKey;
47
- const entity = schema.attributes[lookup].entity;
47
+ const entity = attributes[lookup].entity;
48
48
  const lookupSchema = schemaStore.getSchema(entity);
49
49
  attribute = lookupSchema.attributes[field];
50
50
  }
51
51
  else {
52
- attribute = schema.attributes[column.name];
52
+ attribute = attributes[column.name];
53
53
  }
54
54
  return attribute;
55
55
  }
56
- function extractAttributeData({ column, record, schema, schemaStore, }) {
57
- const attribute = getAttribute({ column, schema, schemaStore });
56
+ function extractAttributeData({ column, record, attributes, schemaStore, }) {
57
+ const attribute = getAttribute({
58
+ column,
59
+ attributes,
60
+ schemaStore,
61
+ });
58
62
  let value;
59
63
  if (column.expandedKey) {
60
64
  const lookup = column.name;
@@ -69,15 +73,15 @@ function extractAttributeData({ column, record, schema, schemaStore, }) {
69
73
  value,
70
74
  };
71
75
  }
72
- const exportRecordsCSV = async ({ schema, records, gridColumns, schemaStore, fileName, locale, }) => {
76
+ const exportRecordsCSV = async ({ attributes, records, gridColumns, schemaStore, fileName, locale, }) => {
73
77
  const csvDownload = await Promise.resolve().then(() => __importStar(require('json-to-csv-export')));
74
- const headers = getHeaders(schema, gridColumns, schemaStore);
78
+ const headers = getHeaders(attributes, gridColumns, schemaStore);
75
79
  const cellData = records.map((record) => {
76
80
  return gridColumns.map((column) => {
77
81
  const { attribute, value } = extractAttributeData({
78
82
  column,
79
83
  record,
80
- schema,
84
+ attributes,
81
85
  schemaStore,
82
86
  });
83
87
  if (attribute.type === 'money' || attribute.type === 'number') {
@@ -94,15 +98,15 @@ const exportRecordsCSV = async ({ schema, records, gridColumns, schemaStore, fil
94
98
  });
95
99
  };
96
100
  exports.exportRecordsCSV = exportRecordsCSV;
97
- const exportRecordsXLS = async ({ fileName, gridColumns, records, schema, schemaStore, locale, }) => {
101
+ const exportRecordsXLS = async ({ fileName, gridColumns, records, attributes, schemaStore, locale, }) => {
98
102
  const ExcelJS = await Promise.resolve().then(() => __importStar(require('exceljs')));
99
- const headers = getHeaders(schema, gridColumns, schemaStore);
103
+ const headers = getHeaders(attributes, gridColumns, schemaStore);
100
104
  const cellData = records.map((item) => {
101
105
  return gridColumns.map((column) => {
102
106
  const { attribute, value } = extractAttributeData({
103
107
  column,
104
108
  record: item,
105
- schema,
109
+ attributes,
106
110
  schemaStore,
107
111
  });
108
112
  if (!value) {
@@ -128,7 +132,11 @@ const exportRecordsXLS = async ({ fileName, gridColumns, records, schema, schema
128
132
  worksheet.addRow(row);
129
133
  });
130
134
  gridColumns.forEach((column, index) => {
131
- const attribute = getAttribute({ column, schema, schemaStore });
135
+ const attribute = getAttribute({
136
+ column,
137
+ attributes: attributes,
138
+ schemaStore,
139
+ });
132
140
  const sheetColumn = worksheet.getColumn(index + 1);
133
141
  let formatFn = (value) => (0, utils_2.getAttributeFormattedValue)(attribute, value, locale) ?? '';
134
142
  if (attribute?.type === 'money') {
@@ -0,0 +1,2 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ export declare const HeaderProvider: FC<PropsWithChildren<{}>>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeaderProvider = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const context_1 = require("../mutable/context");
6
+ const context_2 = require("./context");
7
+ const HeaderProvider = ({ children }) => {
8
+ const contextValue = (0, context_1.useCreateContextStore)(context_2.defaultHeaderStoreState);
9
+ return ((0, jsx_runtime_1.jsx)(context_2.HeaderContext.Provider, { value: contextValue, children: children }));
10
+ };
11
+ exports.HeaderProvider = HeaderProvider;
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ interface MobileHeaderLeftContentProps {
3
+ type: 'menu' | 'back';
4
+ order?: number;
5
+ }
6
+ export declare const MobileHeaderLeftContent: FC<MobileHeaderLeftContentProps>;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MobileHeaderLeftContent = void 0;
4
+ const useMobileHeaderSetValue_1 = require("../hooks/useMobileHeaderSetValue");
5
+ const MobileHeaderLeftContent = ({ type, order = 0, }) => {
6
+ (0, useMobileHeaderSetValue_1.useMobileHeaderSetValue)(type === 'back', order, 'showBackButton');
7
+ return null;
8
+ };
9
+ exports.MobileHeaderLeftContent = MobileHeaderLeftContent;
@@ -0,0 +1,6 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ interface MobileHeaderLeftContentProps {
3
+ order?: number;
4
+ }
5
+ export declare const MobileHeaderRightContent: FC<PropsWithChildren<MobileHeaderLeftContentProps>>;
6
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MobileHeaderRightContent = void 0;
4
+ const useMobileHeaderSetValue_1 = require("../hooks/useMobileHeaderSetValue");
5
+ const MobileHeaderRightContent = ({ children, order = 0 }) => {
6
+ (0, useMobileHeaderSetValue_1.useMobileHeaderSetValue)(children, order, 'rightComponent');
7
+ return null;
8
+ };
9
+ exports.MobileHeaderRightContent = MobileHeaderRightContent;
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ interface MobileHeaderTitleProps {
3
+ title: React.ReactNode;
4
+ order?: number;
5
+ }
6
+ export declare const MobileHeaderTitle: FC<MobileHeaderTitleProps>;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MobileHeaderTitle = void 0;
4
+ const useMobileHeaderSetValue_1 = require("../hooks/useMobileHeaderSetValue");
5
+ const MobileHeaderTitle = ({ title, order = 0, }) => {
6
+ (0, useMobileHeaderSetValue_1.useMobileHeaderSetValue)(title, order, 'title');
7
+ return null;
8
+ };
9
+ exports.MobileHeaderTitle = MobileHeaderTitle;
@@ -0,0 +1,11 @@
1
+ export type DataStack<T> = {
2
+ order: number;
3
+ value: T;
4
+ }[];
5
+ export interface HeaderStoreState {
6
+ title: DataStack<React.ReactNode>;
7
+ showBackButton: DataStack<boolean>;
8
+ rightComponent: DataStack<React.ReactNode>;
9
+ }
10
+ export declare const defaultHeaderStoreState: HeaderStoreState;
11
+ export declare const HeaderContext: import("react").Context<import("../mutable/context").ContextValue<HeaderStoreState>>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeaderContext = exports.defaultHeaderStoreState = void 0;
4
+ const context_1 = require("../mutable/context");
5
+ exports.defaultHeaderStoreState = {
6
+ title: [],
7
+ showBackButton: [],
8
+ rightComponent: [],
9
+ };
10
+ exports.HeaderContext = (0, context_1.createContext)();
@@ -0,0 +1,4 @@
1
+ export { useHeaderValue } from './useHeaderValue';
2
+ export { useMobileHeaderSetValue } from './useMobileHeaderSetValue';
3
+ export { useHeaderShowBackButton } from './useHeaderShowBackButton';
4
+ export { useMobileHeader } from './useMobileHeader';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMobileHeader = exports.useHeaderShowBackButton = exports.useMobileHeaderSetValue = exports.useHeaderValue = void 0;
4
+ var useHeaderValue_1 = require("./useHeaderValue");
5
+ Object.defineProperty(exports, "useHeaderValue", { enumerable: true, get: function () { return useHeaderValue_1.useHeaderValue; } });
6
+ var useMobileHeaderSetValue_1 = require("./useMobileHeaderSetValue");
7
+ Object.defineProperty(exports, "useMobileHeaderSetValue", { enumerable: true, get: function () { return useMobileHeaderSetValue_1.useMobileHeaderSetValue; } });
8
+ var useHeaderShowBackButton_1 = require("./useHeaderShowBackButton");
9
+ Object.defineProperty(exports, "useHeaderShowBackButton", { enumerable: true, get: function () { return useHeaderShowBackButton_1.useHeaderShowBackButton; } });
10
+ var useMobileHeader_1 = require("./useMobileHeader");
11
+ Object.defineProperty(exports, "useMobileHeader", { enumerable: true, get: function () { return useMobileHeader_1.useMobileHeader; } });
@@ -0,0 +1 @@
1
+ export declare function useHeaderShowBackButton(show: boolean, order?: number): void;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useHeaderShowBackButton = useHeaderShowBackButton;
4
+ const useMobileHeaderSetValue_1 = require("./useMobileHeaderSetValue");
5
+ function useHeaderShowBackButton(show, order = 0) {
6
+ (0, useMobileHeaderSetValue_1.useMobileHeaderSetValue)(show, order, 'showBackButton');
7
+ }
@@ -0,0 +1,2 @@
1
+ import { HeaderStoreState } from '../context';
2
+ export declare function useHeaderValue<T>(field: keyof HeaderStoreState): T | null;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useHeaderValue = useHeaderValue;
4
+ const mutable_1 = require("../../mutable");
5
+ const context_1 = require("../context");
6
+ function getLastValue(data) {
7
+ if (!data.length)
8
+ return null;
9
+ return data[data.length - 1];
10
+ }
11
+ function useHeaderValue(field) {
12
+ const value = (0, mutable_1.useContextSelector)(context_1.HeaderContext, (state) => getLastValue(state[field])?.value ?? null);
13
+ return value;
14
+ }
@@ -0,0 +1,5 @@
1
+ export declare function useMobileHeader(showBackButton: boolean, options?: {
2
+ title?: React.ReactNode;
3
+ rightContent?: React.ReactNode;
4
+ order?: number;
5
+ }): void;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMobileHeader = useMobileHeader;
4
+ const useMobileHeaderSetValue_1 = require("./useMobileHeaderSetValue");
5
+ function useMobileHeader(showBackButton, options) {
6
+ (0, useMobileHeaderSetValue_1.useMobileHeaderSetValue)(showBackButton, options?.order ?? 0, 'showBackButton');
7
+ (0, useMobileHeaderSetValue_1.useMobileHeaderSetValue)(options?.title, options?.order ?? 0, 'title');
8
+ (0, useMobileHeaderSetValue_1.useMobileHeaderSetValue)(options?.rightContent, options?.order ?? 0, 'rightComponent');
9
+ }
@@ -0,0 +1,2 @@
1
+ import { HeaderStoreState } from '../context';
2
+ export declare function useMobileHeaderSetValue<T>(value: T, order: number, field: keyof HeaderStoreState): void;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMobileHeaderSetValue = useMobileHeaderSetValue;
4
+ const react_1 = require("react");
5
+ const mutable_1 = require("../../mutable");
6
+ const context_1 = require("../context");
7
+ function mergeStack(prevState, value, order) {
8
+ return [
9
+ ...prevState.filter((x) => x.order !== order),
10
+ {
11
+ order,
12
+ value,
13
+ },
14
+ ].sort((a, b) => a.order - b.order);
15
+ }
16
+ function useMobileHeaderSetValue(value, order, field) {
17
+ const setValue = (0, mutable_1.useContextSetValue)(context_1.HeaderContext);
18
+ (0, react_1.useEffect)(() => {
19
+ setValue((state) => ({
20
+ [field]: mergeStack(state[field], value, order),
21
+ }));
22
+ }, [setValue, field, order, value]);
23
+ (0, react_1.useEffect)(() => {
24
+ return () => {
25
+ setValue((state) => ({
26
+ [field]: state[field].filter((x) => x.order !== order),
27
+ }));
28
+ };
29
+ }, [setValue, field, order]);
30
+ }
@@ -0,0 +1,3 @@
1
+ export { HeaderContext, type HeaderStoreState } from './context';
2
+ export { HeaderProvider } from './HeaderProvider';
3
+ export * from './hooks';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.HeaderProvider = exports.HeaderContext = void 0;
18
+ var context_1 = require("./context");
19
+ Object.defineProperty(exports, "HeaderContext", { enumerable: true, get: function () { return context_1.HeaderContext; } });
20
+ var HeaderProvider_1 = require("./HeaderProvider");
21
+ Object.defineProperty(exports, "HeaderProvider", { enumerable: true, get: function () { return HeaderProvider_1.HeaderProvider; } });
22
+ __exportStar(require("./hooks"), exports);
@@ -1,7 +1,11 @@
1
1
  import { RefObject } from 'react';
2
- interface Size {
2
+ interface ElementLayout {
3
3
  width: number;
4
4
  height: number;
5
+ top: number;
6
+ left: number;
7
+ right: number;
8
+ bottom: number;
5
9
  }
6
- export declare function useElementSize(elementRef: RefObject<HTMLElement>, interval?: number): Size;
10
+ export declare function useElementSize(elementRef: RefObject<HTMLElement>, interval?: number): ElementLayout;
7
11
  export {};
@@ -3,17 +3,36 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useElementSize = useElementSize;
4
4
  const react_1 = require("react");
5
5
  function useElementSize(elementRef, interval) {
6
- const [size, setSize] = (0, react_1.useState)({ width: 0, height: 0 });
6
+ const [size, setSize] = (0, react_1.useState)({
7
+ width: 0,
8
+ height: 0,
9
+ top: 0,
10
+ left: 0,
11
+ right: 0,
12
+ bottom: 0,
13
+ });
7
14
  (0, react_1.useLayoutEffect)(() => {
8
15
  function updateSize() {
9
16
  if (elementRef.current) {
10
17
  const element = elementRef.current;
11
18
  const rect = element.getBoundingClientRect();
12
19
  setSize((size) => {
13
- if (size.width === rect.width && size.height === rect.height) {
20
+ if (size.width === rect.width &&
21
+ size.height === rect.height &&
22
+ size.top === rect.top &&
23
+ size.left === rect.left &&
24
+ size.right === rect.right &&
25
+ size.bottom === rect.bottom) {
14
26
  return size;
15
27
  }
16
- return { width: rect.width, height: rect.height };
28
+ return {
29
+ width: rect.width,
30
+ height: rect.height,
31
+ top: rect.top,
32
+ left: rect.left,
33
+ right: rect.right,
34
+ bottom: rect.bottom,
35
+ };
17
36
  });
18
37
  }
19
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/app",
3
- "version": "1.4.11",
3
+ "version": "1.4.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -38,5 +38,5 @@
38
38
  "uuid": "11.0.3",
39
39
  "yup": "^1.4.0"
40
40
  },
41
- "gitHead": "a021ad89086df820727f8dc87e57a039b0126bf2"
41
+ "gitHead": "70b319f4b807a300e6b01c8d7e8c1768839f9541"
42
42
  }
@@ -8,7 +8,7 @@ interface AttributeFormattedValueStringsSet {
8
8
  export declare function getAttributeLookupsFormattedValue(value: unknown, options?: {
9
9
  maxCount?: number;
10
10
  }): string;
11
- export declare function getAttributeAttachmentFormattedValue(value: unknown): string;
11
+ export declare function getAttributeAttachmentFormattedValue(value: unknown): string | null;
12
12
  export declare function getAttributeDateFormattedValue(attribute: DateAttribute, value: unknown, locale: Locale): string;
13
13
  export declare function getAttributeDateRangeFormattedValue(value: unknown, locale: Locale): string;
14
14
  export declare function getAttributeBooleanFormattedValue(attribute: BooleanAttribute, value: unknown, options?: {
@@ -35,7 +35,15 @@ function getAttributeLookupsFormattedValue(value, options) {
35
35
  }
36
36
  }
37
37
  function getAttributeAttachmentFormattedValue(value) {
38
- return value?.url ?? null;
38
+ const name = value?.name;
39
+ const url = value?.url;
40
+ if (name) {
41
+ return name;
42
+ }
43
+ if (url) {
44
+ return url;
45
+ }
46
+ return null;
39
47
  }
40
48
  function getAttributeDateFormattedValue(attribute, value, locale) {
41
49
  if (attribute.format === 'datetime') {