@headless-adminapp/fluent 0.0.17-alpha.5 → 0.0.17-alpha.52
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/AppHeaderContianer.d.ts +5 -1
- package/App/AppHeaderContianer.js +25 -19
- package/App/AppLogo.js +14 -2
- package/App/AppUI.js +9 -1
- package/App/LayoutProvider.d.ts +7 -0
- package/App/LayoutProvider.js +29 -0
- package/App/NavigationContainer.d.ts +10 -1
- package/App/NavigationContainer.js +26 -22
- package/App/QuickActionItem.js +1 -1
- package/CommandBar/Button.d.ts +2 -1
- package/CommandBar/Button.js +2 -2
- package/CommandBar/Divider.d.ts +2 -1
- package/CommandBar/Divider.js +2 -2
- package/CommandBar/IconButton.d.ts +2 -1
- package/CommandBar/IconButton.js +2 -2
- package/CommandBar/Label.d.ts +2 -1
- package/CommandBar/Label.js +2 -2
- package/CommandBar/MenuButton.d.ts +2 -1
- package/CommandBar/MenuButton.js +3 -3
- package/CommandBar/MenuItem.js +6 -5
- package/CommandBar/MenuItems.js +7 -4
- package/CommandBar/MenuList.js +4 -3
- package/CommandBar/Wrapper.d.ts +2 -2
- package/CommandBar/Wrapper.js +2 -2
- package/CommandBar/index.d.ts +6 -6
- package/DataGrid/ActionCell.d.ts +1 -1
- package/DataGrid/ActionCell.js +8 -4
- package/DataGrid/CustomizeColumns/AddColumns.js +4 -5
- package/DataGrid/CustomizeColumns/ColumnItem.js +3 -1
- package/DataGrid/CustomizeColumns/CustomizeColumns.d.ts +2 -2
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +1 -3
- package/DataGrid/GridColumnHeader/FilterForm.js +4 -2
- package/DataGrid/GridColumnHeader/OperatorSelect.js +9 -2
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +21 -12
- package/DataGrid/GridColumnHeader/utils.js +10 -7
- package/DataGrid/GridHeaderDesktop.js +5 -2
- package/DataGrid/GridHeaderMobile.d.ts +5 -0
- package/DataGrid/GridHeaderMobile.js +32 -0
- package/DataGrid/GridListContainer.d.ts +12 -0
- package/DataGrid/GridListContainer.js +91 -0
- package/DataGrid/GridTableContainer.js +104 -83
- package/DataGrid/TableCell/TableCellBase.d.ts +2 -2
- package/DataGrid/TableCell/TableCellCheckbox.js +4 -3
- package/DataGrid/TableCell/TableCellChoice.d.ts +15 -0
- package/DataGrid/TableCell/TableCellChoice.js +31 -0
- package/DataGrid/TableCell/TableCellLink.d.ts +1 -0
- package/DataGrid/TableCell/TableCellLink.js +8 -4
- package/DataGrid/TableCell/TableCellText.js +9 -4
- package/DataGrid/types.d.ts +5 -0
- package/DataGrid/types.js +2 -0
- package/DataGrid/useTableColumns.d.ts +2 -3
- package/DataGrid/useTableColumns.js +237 -165
- package/DialogContainer/PromptDialog.d.ts +3 -2
- package/DialogContainer/PromptDialog.js +10 -6
- package/Insights/CommandBarContainer.d.ts +1 -0
- package/Insights/CommandBarContainer.js +15 -0
- package/Insights/FilterBarContainer.d.ts +1 -0
- package/Insights/FilterBarContainer.js +107 -0
- package/Insights/Grid.d.ts +6 -0
- package/Insights/Grid.js +26 -0
- package/Insights/InsightsContainer.d.ts +1 -0
- package/Insights/InsightsContainer.js +35 -0
- package/Insights/WidgetChartContainer.d.ts +7 -0
- package/Insights/WidgetChartContainer.js +56 -0
- package/Insights/WidgetDataGridContainer.d.ts +4 -0
- package/Insights/WidgetDataGridContainer.js +71 -0
- package/Insights/WidgetTableContainer.d.ts +7 -0
- package/Insights/WidgetTableContainer.js +58 -0
- package/Insights/WidgetTileContainer.d.ts +7 -0
- package/Insights/WidgetTileContainer.js +24 -0
- package/Insights/WidgetTitleBar.d.ts +7 -0
- package/Insights/WidgetTitleBar.js +22 -0
- package/Insights/Widgets.d.ts +4 -0
- package/Insights/Widgets.js +57 -0
- package/Insights/charts/AreaChart.d.ts +5 -0
- package/Insights/charts/AreaChart.js +20 -0
- package/Insights/charts/BarChart.d.ts +5 -0
- package/Insights/charts/BarChart.js +20 -0
- package/Insights/charts/ComposedChart.d.ts +5 -0
- package/Insights/charts/ComposedChart.js +20 -0
- package/Insights/charts/CustomTooltipContent.d.ts +7 -0
- package/Insights/charts/CustomTooltipContent.js +25 -0
- package/Insights/charts/GaugeChart.d.ts +5 -0
- package/Insights/charts/GaugeChart.js +8 -0
- package/Insights/charts/LineChart.d.ts +5 -0
- package/Insights/charts/LineChart.js +21 -0
- package/Insights/charts/OhlcChart.d.ts +6 -0
- package/Insights/charts/OhlcChart.js +118 -0
- package/Insights/charts/PieChart.d.ts +5 -0
- package/Insights/charts/PieChart.js +58 -0
- package/Insights/charts/RadarChart.d.ts +5 -0
- package/Insights/charts/RadarChart.js +39 -0
- package/Insights/charts/ScatterChart.d.ts +5 -0
- package/Insights/charts/ScatterChart.js +86 -0
- package/Insights/charts/constants.d.ts +1 -0
- package/Insights/charts/constants.js +25 -0
- package/Insights/charts/formatters.d.ts +14 -0
- package/Insights/charts/formatters.js +188 -0
- package/Insights/charts/index.d.ts +4 -0
- package/Insights/charts/index.js +13 -0
- package/Insights/charts/renderers.d.ts +10 -0
- package/Insights/charts/renderers.js +65 -0
- package/Insights/hooks/useQueriesData.d.ts +7 -0
- package/Insights/hooks/useQueriesData.js +99 -0
- package/Insights/hooks/useWidgetDetail.d.ts +10 -0
- package/Insights/hooks/useWidgetDetail.js +33 -0
- package/OverflowCommandBar/OverflowCommandBar.js +1 -4
- package/OverflowCommandBar/OverflowMenu.js +1 -1
- package/PageBoard/BoardColumn.d.ts +5 -0
- package/PageBoard/BoardColumn.js +9 -0
- package/PageBoard/BoardColumnCard.d.ts +12 -0
- package/PageBoard/BoardColumnCard.js +28 -0
- package/PageBoard/BoardColumnUI.d.ts +2 -0
- package/PageBoard/BoardColumnUI.js +81 -0
- package/PageBoard/BoardingColumnCardLoading.d.ts +1 -0
- package/PageBoard/BoardingColumnCardLoading.js +21 -0
- package/PageBoard/Header.d.ts +7 -0
- package/PageBoard/Header.js +40 -0
- package/PageBoard/PageBoard.d.ts +7 -0
- package/PageBoard/PageBoard.js +47 -0
- package/PageBoard/index.d.ts +1 -0
- package/PageBoard/index.js +5 -0
- package/PageEntityForm/CommandContainer.js +18 -6
- package/PageEntityForm/FormTabRelated.js +1 -2
- package/PageEntityForm/PageEntityFormDesktopContainer.js +35 -19
- package/PageEntityForm/ProcessFlow.d.ts +10 -0
- package/PageEntityForm/ProcessFlow.js +84 -0
- package/PageEntityForm/RecordCard.d.ts +1 -1
- package/PageEntityForm/RecordCard.js +55 -52
- package/PageEntityForm/RecordCardLoading.d.ts +8 -0
- package/PageEntityForm/RecordCardLoading.js +25 -0
- package/PageEntityForm/RecordSetNavigatorContainer.js +4 -7
- package/PageEntityForm/RelatedViewSelector.d.ts +0 -2
- package/PageEntityForm/RelatedViewSelector.js +36 -6
- package/PageEntityForm/SectionContainer.js +23 -5
- package/PageEntityForm/StandardControl.d.ts +2 -2
- package/PageEntityForm/StandardControl.js +94 -113
- package/PageEntityForm/SubgridControl.d.ts +1 -0
- package/PageEntityForm/SubgridControl.js +3 -2
- package/PageEntityView/FormSubgridContainer.js +5 -2
- package/PageEntityView/PageEntityView.js +4 -1
- package/PageEntityView/PageEntityViewDesktopFrame.js +1 -0
- package/PageEntityView/PageEntityViewMobileContainer.d.ts +2 -0
- package/PageEntityView/PageEntityViewMobileContainer.js +14 -0
- package/PageEntityView/PageEntityViewStringContext.d.ts +1 -0
- package/PageEntityView/PageEntityViewStringContext.js +1 -0
- package/PageInsights/PageInsights.d.ts +9 -0
- package/PageInsights/PageInsights.js +25 -0
- package/PageInsights/index.d.ts +1 -0
- package/PageInsights/index.js +6 -0
- package/componentStore.d.ts +2 -0
- package/componentStore.js +5 -0
- package/components/BodyLoading.js +12 -8
- package/components/PageLogin.js +0 -1
- package/form/FormControl.js +5 -16
- package/form/controls/AttachmentControl.d.ts +17 -0
- package/form/controls/AttachmentControl.js +225 -0
- package/form/controls/AttachmentsControl.d.ts +6 -0
- package/form/controls/AttachmentsControl.js +45 -0
- package/form/controls/CurrencyControl.js +38 -6
- package/form/controls/DateControl.d.ts +1 -1
- package/form/controls/DateControl.js +15 -3
- package/form/controls/DateTimeControl.d.ts +1 -1
- package/form/controls/DateTimeControl.js +100 -13
- package/form/controls/DecimalControl.d.ts +5 -0
- package/form/controls/DecimalControl.js +52 -0
- package/form/controls/DurationControl.d.ts +4 -0
- package/form/controls/DurationControl.js +209 -0
- package/form/controls/EmailControl.d.ts +1 -1
- package/form/controls/EmailControl.js +1 -1
- package/form/controls/IntegerControl.d.ts +4 -0
- package/form/controls/IntegerControl.js +25 -0
- package/form/controls/LookupControl.js +2 -2
- package/form/controls/MultiSelectControl.d.ts +1 -1
- package/form/controls/MultiSelectControl.js +1 -1
- package/form/controls/MultiSelectLookupControl.js +1 -1
- package/form/controls/NumberControl.js +1 -0
- package/form/controls/PasswordControl.d.ts +1 -1
- package/form/controls/PasswordControl.js +1 -1
- package/form/controls/RichTextControl.d.ts +5 -0
- package/form/controls/RichTextControl.js +33 -0
- package/form/controls/SelectControl.d.ts +1 -1
- package/form/controls/SelectControl.js +1 -1
- package/form/controls/SwitchControl.d.ts +1 -1
- package/form/controls/SwitchControl.js +4 -2
- package/form/controls/TelephoneControl.d.ts +1 -1
- package/form/controls/TelephoneControl.js +2 -2
- package/form/controls/TextAreaControl.d.ts +1 -1
- package/form/controls/TextAreaControl.js +2 -2
- package/form/controls/UrlControl.d.ts +4 -0
- package/form/controls/UrlControl.js +16 -0
- package/form/controls/utils.d.ts +4 -0
- package/form/controls/utils.js +42 -0
- package/form/layout/FormSection/FormSection.js +1 -1
- package/form/layout/FormSection/FormSectionColumn.js +1 -1
- package/form/layout/FormSection/FormSectionLoading.js +1 -1
- package/form/layout/FormTab/FormTab.js +3 -2
- package/form/types.d.ts +2 -2
- package/package.json +11 -5
- package/styles.css +100 -0
- package/types/index.d.ts +14 -0
- package/App/AppProvider.d.ts +0 -9
- package/App/AppProvider.js +0 -50
- package/DataGrid/getAttributeFormattedValue.d.ts +0 -16
- package/DataGrid/getAttributeFormattedValue.js +0 -92
|
@@ -10,7 +10,36 @@ const utils_1 = require("@headless-adminapp/core/attributes/utils");
|
|
|
10
10
|
const icons_1 = require("@headless-adminapp/icons");
|
|
11
11
|
const react_1 = require("react");
|
|
12
12
|
const PageEntityFormStringContext_1 = require("./PageEntityFormStringContext");
|
|
13
|
-
function getRelatedItems(currentSchema, schemas) {
|
|
13
|
+
function getRelatedItems(currentSchema, schemas, relatedItems) {
|
|
14
|
+
if (relatedItems === null) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
if (relatedItems) {
|
|
18
|
+
return relatedItems.map((item) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
const schema = schemas[item.logicalName];
|
|
21
|
+
if (!schema) {
|
|
22
|
+
throw new Error(`Schema not found: ${item.logicalName}`);
|
|
23
|
+
}
|
|
24
|
+
if (!schema.attributes[item.attributeName]) {
|
|
25
|
+
throw new Error(`Attribute not found: ${item.logicalName}.${item.attributeName}`);
|
|
26
|
+
}
|
|
27
|
+
const attribute = schema.attributes[item.attributeName];
|
|
28
|
+
if (!(0, utils_1.isLookupAttribute)(attribute)) {
|
|
29
|
+
throw new Error(`Attribute is not a lookup: ${item.logicalName}.${item.attributeName}`);
|
|
30
|
+
}
|
|
31
|
+
if (attribute.entity !== currentSchema.logicalName) {
|
|
32
|
+
throw new Error(`Attribute entity does not match: ${item.logicalName}.${item.attributeName}`);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
key: `${schema.logicalName}.${item.attributeName}`,
|
|
36
|
+
logicalName: schema.logicalName,
|
|
37
|
+
attributeName: item.attributeName,
|
|
38
|
+
pluralLabel: (_a = item.pluralLabel) !== null && _a !== void 0 ? _a : schema.pluralLabel,
|
|
39
|
+
localizedPluralLabels: (_b = item.localizedPluralLabels) !== null && _b !== void 0 ? _b : schema.localizedPluralLabels,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
}
|
|
14
43
|
return Object.values(schemas)
|
|
15
44
|
.map((s) => {
|
|
16
45
|
return Object.entries(s.attributes)
|
|
@@ -28,17 +57,16 @@ function getRelatedItems(currentSchema, schemas) {
|
|
|
28
57
|
})
|
|
29
58
|
.filter(Boolean)
|
|
30
59
|
.map((item) => {
|
|
60
|
+
var _a, _b;
|
|
31
61
|
if (!item) {
|
|
32
62
|
throw new Error('item is null');
|
|
33
63
|
}
|
|
34
64
|
return {
|
|
35
65
|
key: `${s.logicalName}.${item.key}`,
|
|
36
66
|
logicalName: s.logicalName,
|
|
37
|
-
label: s.label,
|
|
38
|
-
localizedLabels: s.localizedLabels,
|
|
39
|
-
pluralLabel: s.pluralLabel,
|
|
40
|
-
localizedPluralLabels: s.localizedPluralLabels,
|
|
41
67
|
attributeName: item.key,
|
|
68
|
+
pluralLabel: (_a = item.attribute.relatedLabel) !== null && _a !== void 0 ? _a : s.pluralLabel,
|
|
69
|
+
localizedPluralLabels: (_b = item.attribute.localizedRelatedLabel) !== null && _b !== void 0 ? _b : s.localizedPluralLabels,
|
|
42
70
|
};
|
|
43
71
|
});
|
|
44
72
|
})
|
|
@@ -46,10 +74,11 @@ function getRelatedItems(currentSchema, schemas) {
|
|
|
46
74
|
}
|
|
47
75
|
function RelatedViewSelector(props) {
|
|
48
76
|
const schema = (0, hooks_1.useDataFormSchema)();
|
|
77
|
+
const formConfig = (0, hooks_1.useSelectedForm)();
|
|
49
78
|
const { schemas } = (0, hooks_2.useMetadata)();
|
|
50
79
|
const strings = (0, PageEntityFormStringContext_1.usePageEntityFormStrings)();
|
|
51
80
|
const { language } = (0, locale_1.useLocale)();
|
|
52
|
-
const data = (0, react_1.useMemo)(() => getRelatedItems(schema, schemas), [schema, schemas]);
|
|
81
|
+
const data = (0, react_1.useMemo)(() => getRelatedItems(schema, schemas, formConfig.experience.relatedItems), [formConfig.experience.relatedItems, schema, schemas]);
|
|
53
82
|
if (!data.length) {
|
|
54
83
|
return null;
|
|
55
84
|
}
|
|
@@ -70,6 +99,7 @@ function RelatedViewSelector(props) {
|
|
|
70
99
|
outlineStyle: 'none',
|
|
71
100
|
textTransform: 'none',
|
|
72
101
|
columnGap: react_components_1.tokens.spacingHorizontalSNudge,
|
|
102
|
+
color: react_components_1.tokens.colorNeutralForeground2,
|
|
73
103
|
}, children: [strings.related, (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronDown, { size: 16 })] }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: data.map((item) => {
|
|
74
104
|
var _a, _b;
|
|
75
105
|
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => props.onSelect(item), children: (_b = (_a = item.localizedPluralLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : item.pluralLabel }, item.key));
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SectionContainer = SectionContainer;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const builders_1 = require("@headless-adminapp/app/builders");
|
|
6
5
|
const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
|
|
7
6
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
7
|
+
const utils_1 = require("@headless-adminapp/app/locale/utils");
|
|
8
8
|
const react_hook_form_1 = require("react-hook-form");
|
|
9
|
+
const componentStore_1 = require("../componentStore");
|
|
9
10
|
const SectionControl_1 = require("../DataForm/SectionControl");
|
|
10
11
|
const layout_1 = require("../form/layout");
|
|
11
12
|
const StandardControl_1 = require("./StandardControl");
|
|
@@ -16,11 +17,18 @@ function SectionContainer({ section }) {
|
|
|
16
17
|
const recordId = (0, hooks_1.useRecordId)();
|
|
17
18
|
const readonly = (0, hooks_1.useFormIsReadonly)();
|
|
18
19
|
const { language } = (0, locale_1.useLocale)();
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(layout_1.FormSection, { title: (0,
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(layout_1.FormSection, { title: (0, utils_1.localizedLabel)(language, section), columnCount: section.columnCount, labelPosition: section.labelPosition, noPadding: section.noPadding, hideLabel: section.hideLabel, children: section.controls.map((control, index) => {
|
|
20
21
|
var _a;
|
|
21
22
|
switch (control.type) {
|
|
22
|
-
case 'standard':
|
|
23
|
+
case 'standard': {
|
|
23
24
|
const attribute = schema.attributes[control.attributeName];
|
|
25
|
+
let Control = StandardControl_1.StandardControl;
|
|
26
|
+
if (control.component) {
|
|
27
|
+
const OverrideControl = componentStore_1.componentStore.getComponent(control.component);
|
|
28
|
+
if (OverrideControl) {
|
|
29
|
+
Control = OverrideControl;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
24
32
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
25
33
|
gridColumn: control.span
|
|
26
34
|
? `var(--section-item-span-${control.span})`
|
|
@@ -33,15 +41,25 @@ function SectionContainer({ section }) {
|
|
|
33
41
|
? (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message
|
|
34
42
|
: '';
|
|
35
43
|
const label = (_g = (_f = (_d = (_c = control.localizedLabels) === null || _c === void 0 ? void 0 : _c[language]) !== null && _d !== void 0 ? _d : (_e = attribute.localizedLabels) === null || _e === void 0 ? void 0 : _e[language]) !== null && _f !== void 0 ? _f : control.label) !== null && _g !== void 0 ? _g : attribute.label;
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: label, labelPosition: section.labelPosition, required: attribute.required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: label, labelPosition: section.labelPosition, required: attribute.required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError, disabled: readonly, label: label, placeholder: label, allowNavigation: true, allowNewRecord: true, fileServiceContext: {
|
|
45
|
+
type: 'entity-form',
|
|
46
|
+
recordId,
|
|
47
|
+
attributeName: control.attributeName,
|
|
48
|
+
logicalName: schema.logicalName,
|
|
49
|
+
} }) }));
|
|
37
50
|
} }, control.attributeName) }, control.attributeName));
|
|
51
|
+
}
|
|
38
52
|
case 'editablegrid': {
|
|
39
53
|
return null;
|
|
40
54
|
}
|
|
41
55
|
case 'quickview':
|
|
42
56
|
return null;
|
|
43
57
|
case 'subgrid':
|
|
44
|
-
|
|
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
|
|
45
63
|
? false
|
|
46
64
|
: {
|
|
47
65
|
logicalName: schema.logicalName,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Attribute } from '@headless-adminapp/core/attributes';
|
|
2
2
|
import { FC } from 'react';
|
|
3
|
-
interface StandardControlProps {
|
|
3
|
+
export interface StandardControlProps {
|
|
4
4
|
attribute: Attribute;
|
|
5
5
|
label?: string;
|
|
6
6
|
isError: boolean;
|
|
@@ -10,6 +10,7 @@ interface StandardControlProps {
|
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
onChange: (value: any) => void;
|
|
12
12
|
onBlur: () => void;
|
|
13
|
+
fileServiceContext?: Record<string, unknown>;
|
|
13
14
|
disabled?: boolean;
|
|
14
15
|
borderOnFocusOnly?: boolean;
|
|
15
16
|
hideLabel?: boolean;
|
|
@@ -21,4 +22,3 @@ interface StandardControlProps {
|
|
|
21
22
|
allowNewRecord?: boolean;
|
|
22
23
|
}
|
|
23
24
|
export declare const StandardControl: FC<StandardControlProps>;
|
|
24
|
-
export {};
|
|
@@ -8,31 +8,39 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
const hooks_1 = require("@headless-adminapp/app/metadata/hooks");
|
|
9
9
|
const transport_1 = require("@headless-adminapp/app/transport");
|
|
10
10
|
const react_1 = require("react");
|
|
11
|
+
const componentStore_1 = require("../componentStore");
|
|
12
|
+
const AttachmentControl_1 = require("../form/controls/AttachmentControl");
|
|
13
|
+
const AttachmentsControl_1 = require("../form/controls/AttachmentsControl");
|
|
11
14
|
const CurrencyControl_1 = require("../form/controls/CurrencyControl");
|
|
12
15
|
const DateControl_1 = require("../form/controls/DateControl");
|
|
13
16
|
const DateRangeControl_1 = require("../form/controls/DateRangeControl");
|
|
14
17
|
const DateTimeControl_1 = require("../form/controls/DateTimeControl");
|
|
18
|
+
const DecimalControl_1 = require("../form/controls/DecimalControl");
|
|
19
|
+
const DurationControl_1 = require("../form/controls/DurationControl");
|
|
15
20
|
const EmailControl_1 = require("../form/controls/EmailControl");
|
|
21
|
+
const IntegerControl_1 = require("../form/controls/IntegerControl");
|
|
16
22
|
const LookupControl_1 = require("../form/controls/LookupControl");
|
|
17
23
|
const MultiSelectControl_1 = __importDefault(require("../form/controls/MultiSelectControl"));
|
|
18
24
|
const MultiSelectLookupControl_1 = require("../form/controls/MultiSelectLookupControl");
|
|
19
|
-
const
|
|
25
|
+
const RichTextControl_1 = require("../form/controls/RichTextControl");
|
|
20
26
|
const SelectControl_1 = __importDefault(require("../form/controls/SelectControl"));
|
|
21
27
|
const SwitchControl_1 = require("../form/controls/SwitchControl");
|
|
22
28
|
const TelephoneControl_1 = require("../form/controls/TelephoneControl");
|
|
23
29
|
const TextAreaControl_1 = require("../form/controls/TextAreaControl");
|
|
24
30
|
const TextControl_1 = require("../form/controls/TextControl");
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const UrlControl_1 = require("../form/controls/UrlControl");
|
|
32
|
+
const StandardControl = (props) => {
|
|
33
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
34
|
+
const { attribute, label: _label, isError,
|
|
35
|
+
// errorMessage,
|
|
36
|
+
name, value, onBlur, onChange,
|
|
37
|
+
// dataService,
|
|
38
|
+
// fileService,
|
|
39
|
+
disabled, borderOnFocusOnly, placeholder: _placeholder,
|
|
40
|
+
// hideLabel,
|
|
41
|
+
hidePlaceholder, readOnly,
|
|
42
|
+
// quickViewControl,
|
|
43
|
+
allowNavigation, allowNewRecord, } = props;
|
|
36
44
|
const isDisabled = attribute.readonly || disabled;
|
|
37
45
|
// const label = hideLabel ? undefined : _label ?? attribute.label;
|
|
38
46
|
const placeholder = hidePlaceholder
|
|
@@ -40,6 +48,7 @@ allowNavigation, allowNewRecord, }) => {
|
|
|
40
48
|
: (_a = _placeholder !== null && _placeholder !== void 0 ? _placeholder : _label) !== null && _a !== void 0 ? _a : attribute.label;
|
|
41
49
|
// const required = quickViewControl ? false : attribute.required;
|
|
42
50
|
const dataService = (0, transport_1.useDataService)();
|
|
51
|
+
const fileService = (0, transport_1.useFileService)();
|
|
43
52
|
const { schemaStore, experienceStore } = (0, hooks_1.useMetadata)();
|
|
44
53
|
// const { openQuickCreate } = useQuickCreateForm();
|
|
45
54
|
switch (attribute.type) {
|
|
@@ -55,21 +64,52 @@ allowNavigation, allowNewRecord, }) => {
|
|
|
55
64
|
readOnly,
|
|
56
65
|
};
|
|
57
66
|
switch (attribute.format) {
|
|
58
|
-
case 'text':
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
case '
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
case '
|
|
67
|
-
|
|
67
|
+
case 'text': {
|
|
68
|
+
const Control = (_b = componentStore_1.componentStore.getComponent('Form.TextControl')) !== null && _b !== void 0 ? _b : TextControl_1.TextControl;
|
|
69
|
+
return ((0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps, { textTransform: attribute.textTransform })));
|
|
70
|
+
}
|
|
71
|
+
case 'email': {
|
|
72
|
+
const Control = (_c = componentStore_1.componentStore.getComponent('Form.EmailControl')) !== null && _c !== void 0 ? _c : EmailControl_1.EmailControl;
|
|
73
|
+
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
74
|
+
}
|
|
75
|
+
case 'phone': {
|
|
76
|
+
const Control = (_d = componentStore_1.componentStore.getComponent('Form.TelephoneControl')) !== null && _d !== void 0 ? _d : TelephoneControl_1.TelephoneControl;
|
|
77
|
+
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
78
|
+
}
|
|
79
|
+
case 'url': {
|
|
80
|
+
const Control = (_e = componentStore_1.componentStore.getComponent('Form.UrlControl')) !== null && _e !== void 0 ? _e : UrlControl_1.UrlControl;
|
|
81
|
+
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
82
|
+
}
|
|
83
|
+
case 'textarea': {
|
|
84
|
+
const Control = (_f = componentStore_1.componentStore.getComponent('Form.TextAreaControl')) !== null && _f !== void 0 ? _f : TextAreaControl_1.TextAreaControl;
|
|
85
|
+
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
86
|
+
}
|
|
87
|
+
case 'richtext': {
|
|
88
|
+
const Control = (_g = componentStore_1.componentStore.getComponent('Form.RichTextControl')) !== null && _g !== void 0 ? _g : RichTextControl_1.RichTextControl;
|
|
89
|
+
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
90
|
+
}
|
|
68
91
|
default:
|
|
69
92
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
|
|
70
93
|
}
|
|
71
|
-
case 'number':
|
|
72
|
-
|
|
94
|
+
case 'number': {
|
|
95
|
+
switch (attribute.format) {
|
|
96
|
+
case 'decimal': {
|
|
97
|
+
const Control = (_h = componentStore_1.componentStore.getComponent('Form.DecimalControl')) !== null && _h !== void 0 ? _h : DecimalControl_1.DecimalControl;
|
|
98
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly, decimalPlaces: attribute.decimalPlaces }));
|
|
99
|
+
}
|
|
100
|
+
case 'integer': {
|
|
101
|
+
const Control = (_j = componentStore_1.componentStore.getComponent('Form.IntegerControl')) !== null && _j !== void 0 ? _j : IntegerControl_1.IntegerControl;
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
103
|
+
}
|
|
104
|
+
case 'duration': {
|
|
105
|
+
const Control = (_k = componentStore_1.componentStore.getComponent('Form.DurationControl')) !== null && _k !== void 0 ? _k : DurationControl_1.DurationControl;
|
|
106
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
107
|
+
}
|
|
108
|
+
default: {
|
|
109
|
+
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
73
113
|
case 'date': {
|
|
74
114
|
const controlProps = {
|
|
75
115
|
name,
|
|
@@ -82,10 +122,12 @@ allowNavigation, allowNewRecord, }) => {
|
|
|
82
122
|
readOnly,
|
|
83
123
|
};
|
|
84
124
|
if (attribute.format === 'datetime') {
|
|
85
|
-
|
|
125
|
+
const Control = (_l = componentStore_1.componentStore.getComponent('Form.DateTimeControl')) !== null && _l !== void 0 ? _l : DateTimeControl_1.DateTimeControl;
|
|
126
|
+
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
86
127
|
}
|
|
87
128
|
else {
|
|
88
|
-
|
|
129
|
+
const Control = (_m = componentStore_1.componentStore.getComponent('Form.DateControl')) !== null && _m !== void 0 ? _m : DateControl_1.DateControl;
|
|
130
|
+
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
89
131
|
}
|
|
90
132
|
}
|
|
91
133
|
case 'daterange': {
|
|
@@ -99,105 +141,40 @@ allowNavigation, allowNewRecord, }) => {
|
|
|
99
141
|
disabled: isDisabled,
|
|
100
142
|
readOnly,
|
|
101
143
|
};
|
|
102
|
-
|
|
144
|
+
const Control = (_o = componentStore_1.componentStore.getComponent('Form.DateRangeControl')) !== null && _o !== void 0 ? _o : DateRangeControl_1.DateRangeControl;
|
|
145
|
+
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, controlProps));
|
|
103
146
|
}
|
|
104
147
|
case 'money': {
|
|
105
|
-
|
|
148
|
+
const Control = (_p = componentStore_1.componentStore.getComponent('Form.CurrencyControl')) !== null && _p !== void 0 ? _p : CurrencyControl_1.CurrencyControl;
|
|
149
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly }));
|
|
106
150
|
}
|
|
107
151
|
case 'lookup': {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// const path = routes?.create?.();
|
|
111
|
-
// let createButtonProps:
|
|
112
|
-
// | {
|
|
113
|
-
// label: string;
|
|
114
|
-
// onClick: () => void;
|
|
115
|
-
// }
|
|
116
|
-
// | undefined;
|
|
117
|
-
// if (allowQuickCreate && experienceSchema.defaultQuickCreateForm) {
|
|
118
|
-
// createButtonProps = {
|
|
119
|
-
// label: 'New record',
|
|
120
|
-
// onClick: async () => {
|
|
121
|
-
// try {
|
|
122
|
-
// const result = await openQuickCreate({
|
|
123
|
-
// logicalName: attribute.entity,
|
|
124
|
-
// });
|
|
125
|
-
// if (result) {
|
|
126
|
-
// onChange(result);
|
|
127
|
-
// }
|
|
128
|
-
// } catch (error) {
|
|
129
|
-
// console.error(error);
|
|
130
|
-
// }
|
|
131
|
-
// },
|
|
132
|
-
// };
|
|
133
|
-
// } else if (path) {
|
|
134
|
-
// createButtonProps = {
|
|
135
|
-
// label: 'New record',
|
|
136
|
-
// onClick: () => {
|
|
137
|
-
// router.push(path);
|
|
138
|
-
// },
|
|
139
|
-
// };
|
|
140
|
-
// }
|
|
141
|
-
// return (
|
|
142
|
-
// <FormControl
|
|
143
|
-
// type="lookup"
|
|
144
|
-
// name={name}
|
|
145
|
-
// label={label}
|
|
146
|
-
// placeholder={placeholder}
|
|
147
|
-
// required={required}
|
|
148
|
-
// value={value}
|
|
149
|
-
// onChange={onChange}
|
|
150
|
-
// onBlur={onBlur}
|
|
151
|
-
// error={isError}
|
|
152
|
-
// helperText={errorMessage}
|
|
153
|
-
// disabled={isDisabled}
|
|
154
|
-
// borderOnFocusOnly={borderOnFocusOnly}
|
|
155
|
-
// readOnly={readOnly}
|
|
156
|
-
// createButton={createButtonProps}
|
|
157
|
-
// openRecord={
|
|
158
|
-
// routes?.edit
|
|
159
|
-
// ? (id) => {
|
|
160
|
-
// router.push(routes.edit!(id));
|
|
161
|
-
// }
|
|
162
|
-
// : undefined
|
|
163
|
-
// }
|
|
164
|
-
// async
|
|
165
|
-
// dataResolver={async (options) => {
|
|
166
|
-
// const lookupSchema = getSchema(attribute.entity);
|
|
167
|
-
// const data = await dataService.retriveRecords({
|
|
168
|
-
// logicalName: attribute.entity,
|
|
169
|
-
// search: options?.search ?? '',
|
|
170
|
-
// columnFilters: {},
|
|
171
|
-
// pagination: {
|
|
172
|
-
// pageIndex: 0,
|
|
173
|
-
// rowsPerPage: 10,
|
|
174
|
-
// sortBy: 'createdAt',
|
|
175
|
-
// sortOrder: 'desc',
|
|
176
|
-
// },
|
|
177
|
-
// viewFilter: null,
|
|
178
|
-
// columns: ['_id', lookupSchema.primaryAttribute ?? 'name'],
|
|
179
|
-
// limit: options?.limit ?? 10,
|
|
180
|
-
// });
|
|
181
|
-
// return data.records.map((x: any) => ({
|
|
182
|
-
// _id: x._id,
|
|
183
|
-
// name: x[lookupSchema.primaryAttribute ?? 'name'],
|
|
184
|
-
// }));
|
|
185
|
-
// }}
|
|
186
|
-
// />
|
|
187
|
-
// );
|
|
188
|
-
return ((0, jsx_runtime_1.jsx)(LookupControl_1.LookupControl, { name: name, value: value, onChange: onChange, onBlur: onBlur, placeholder: placeholder, disabled: isDisabled, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, allowNavigation: allowNavigation, allowNewRecord: allowNewRecord }));
|
|
152
|
+
const Control = (_q = componentStore_1.componentStore.getComponent('Form.LookupControl')) !== null && _q !== void 0 ? _q : LookupControl_1.LookupControl;
|
|
153
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, placeholder: placeholder, disabled: isDisabled, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, allowNavigation: allowNavigation, allowNewRecord: allowNewRecord }));
|
|
189
154
|
}
|
|
190
155
|
case 'lookups': {
|
|
191
|
-
|
|
156
|
+
const Control = (_r = componentStore_1.componentStore.getComponent('Form.MultiSelectLookupControl')) !== null && _r !== void 0 ? _r : MultiSelectLookupControl_1.MultiSelectLookupControl;
|
|
157
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, placeholder: placeholder, disabled: isDisabled, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, allowNavigation: allowNavigation, allowNewRecord: allowNewRecord }));
|
|
192
158
|
}
|
|
193
159
|
case 'boolean': {
|
|
194
|
-
|
|
160
|
+
const Control = (_s = componentStore_1.componentStore.getComponent('Form.SwitchControl')) !== null && _s !== void 0 ? _s : SwitchControl_1.SwitchControl;
|
|
161
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
195
162
|
}
|
|
196
163
|
case 'choice': {
|
|
197
|
-
|
|
164
|
+
const Control = (_t = componentStore_1.componentStore.getComponent('Form.SelectControl')) !== null && _t !== void 0 ? _t : SelectControl_1.default;
|
|
165
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, options: attribute.options, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly }));
|
|
198
166
|
}
|
|
199
167
|
case 'choices': {
|
|
200
|
-
|
|
168
|
+
const Control = (_u = componentStore_1.componentStore.getComponent('Form.MultiSelectControl')) !== null && _u !== void 0 ? _u : MultiSelectControl_1.default;
|
|
169
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, options: attribute.options, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly }));
|
|
170
|
+
}
|
|
171
|
+
case 'attachment': {
|
|
172
|
+
const Control = (_v = componentStore_1.componentStore.getComponent('Form.AttachmentControl')) !== null && _v !== void 0 ? _v : AttachmentControl_1.AttachmentControl;
|
|
173
|
+
return ((0, jsx_runtime_1.jsx)(Control, { fileService: fileService, format: attribute.format, location: attribute.location, name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly, fileServiceContext: props.fileServiceContext }));
|
|
174
|
+
}
|
|
175
|
+
case 'attachments': {
|
|
176
|
+
const Control = (_w = componentStore_1.componentStore.getComponent('Form.AttachmentsControl')) !== null && _w !== void 0 ? _w : AttachmentsControl_1.AttachmentsControl;
|
|
177
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, placeholder: placeholder, borderOnFocusOnly: borderOnFocusOnly, readOnly: readOnly }));
|
|
201
178
|
}
|
|
202
179
|
// case 'attachment': {
|
|
203
180
|
// return (
|
|
@@ -222,6 +199,10 @@ allowNavigation, allowNewRecord, }) => {
|
|
|
222
199
|
// );
|
|
223
200
|
// }
|
|
224
201
|
}
|
|
202
|
+
const FallBackControl = componentStore_1.componentStore.getComponent('StandardControl.FallBack');
|
|
203
|
+
if (FallBackControl) {
|
|
204
|
+
return (0, jsx_runtime_1.jsx)(FallBackControl, Object.assign({}, props));
|
|
205
|
+
}
|
|
225
206
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
|
|
226
207
|
};
|
|
227
208
|
exports.StandardControl = StandardControl;
|
|
@@ -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
|
-
|
|
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, associated: props.associated, extraFilter: extraFilter, allowViewSelection: (_b = props.allowViewSelection) !== null && _b !== void 0 ? _b : false, children: (0, jsx_runtime_1.jsx)(ContainerComponent, {}) }));
|
|
66
67
|
}
|
|
@@ -35,11 +35,14 @@ const FormSubgridContainer = ({ hideCommandBar, hideSearch, }) => {
|
|
|
35
35
|
}, children: (0, jsx_runtime_1.jsx)(FormSubgridViewSelector_1.FormSubgridViewSelector, {}) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }) }), (!hideCommandBar || !hideSearch) && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
36
36
|
display: 'flex',
|
|
37
37
|
flexDirection: 'row',
|
|
38
|
-
gap:
|
|
38
|
+
gap: 10,
|
|
39
39
|
overflow: 'hidden',
|
|
40
40
|
width: '100%',
|
|
41
41
|
paddingBlock: 4,
|
|
42
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
42
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
43
|
+
flex: 1,
|
|
44
|
+
minWidth: 0,
|
|
45
|
+
}, children: !hideCommandBar && (0, jsx_runtime_1.jsx)(FormSubgridCommandContainer_1.FormSubgridCommandContainer, {}) }), !hideSearch && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
43
46
|
display: 'flex',
|
|
44
47
|
alignItems: 'center',
|
|
45
48
|
justifyContent: 'end',
|
|
@@ -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;
|
|
@@ -25,6 +25,7 @@ const PageEntityViewDesktopFrame = ({ commandBar, header, content, footer }) =>
|
|
|
25
25
|
background: react_components_1.tokens.colorNeutralBackground1,
|
|
26
26
|
display: 'flex',
|
|
27
27
|
// overflow: 'hidden',
|
|
28
|
+
minHeight: 40,
|
|
28
29
|
}, children: commandBar }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
29
30
|
flex: 1,
|
|
30
31
|
display: 'flex',
|
|
@@ -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() {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InsightExpereince, InsightLookup } from '@headless-adminapp/core/experience/insights';
|
|
2
|
+
export declare function createInsightLookup(insights: InsightExpereince[]): InsightLookup[];
|
|
3
|
+
interface PageInsightsProps {
|
|
4
|
+
insights: InsightExpereince[];
|
|
5
|
+
insightId: string;
|
|
6
|
+
onChangeInsight: (id: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function PageInsights({ insightId, insights, onChangeInsight, }: PageInsightsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInsightLookup = createInsightLookup;
|
|
4
|
+
exports.PageInsights = PageInsights;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const InsightsProvider_1 = require("@headless-adminapp/app/insights/InsightsProvider");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const InsightsContainer_1 = require("../Insights/InsightsContainer");
|
|
9
|
+
function createInsightLookup(insights) {
|
|
10
|
+
return insights.map((insight) => ({
|
|
11
|
+
id: insight.id,
|
|
12
|
+
title: insight.title,
|
|
13
|
+
subtitle: insight.subtitle,
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
function PageInsights({ insightId, insights, onChangeInsight, }) {
|
|
17
|
+
const insightExpereince = (0, react_1.useMemo)(() => {
|
|
18
|
+
return insights.find((insight) => insight.id === insightId);
|
|
19
|
+
}, [insightId, insights]);
|
|
20
|
+
const insightLookups = (0, react_1.useMemo)(() => createInsightLookup(insights), [insights]);
|
|
21
|
+
if (!insightExpereince) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(InsightsProvider_1.InsightsProvider, { experience: insightExpereince, insightLookup: insightLookups, onInsightSelect: onChangeInsight, children: (0, jsx_runtime_1.jsx)(InsightsContainer_1.InsightsContainer, {}) }));
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PageInsights, createInsightLookup } from './PageInsights';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInsightLookup = exports.PageInsights = void 0;
|
|
4
|
+
var PageInsights_1 = require("./PageInsights");
|
|
5
|
+
Object.defineProperty(exports, "PageInsights", { enumerable: true, get: function () { return PageInsights_1.PageInsights; } });
|
|
6
|
+
Object.defineProperty(exports, "createInsightLookup", { enumerable: true, get: function () { return PageInsights_1.createInsightLookup; } });
|