@headless-adminapp/fluent 0.0.17-alpha.7 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App/App.d.ts +0 -1
- package/App/App.js +2 -4
- package/App/AppHeaderContianer.d.ts +5 -1
- package/App/AppHeaderContianer.js +43 -26
- package/App/AppLogo.js +15 -4
- package/App/AppUI.js +9 -1
- package/App/LayoutProvider.d.ts +7 -0
- package/App/LayoutProvider.js +17 -0
- package/App/NavigationContainer.d.ts +10 -1
- package/App/NavigationContainer.js +22 -22
- package/App/QuickActionItem.js +2 -2
- package/App/utils.js +3 -4
- 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 +5 -4
- package/CommandBar/MenuItems.js +4 -4
- package/CommandBar/MenuList.js +5 -4
- 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 +35 -37
- package/DataGrid/CustomizeColumns/ColumnItem.js +8 -6
- package/DataGrid/CustomizeColumns/CustomizeColumns.d.ts +2 -2
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +3 -6
- package/DataGrid/FormSubgridViewSelector.js +1 -5
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +19 -25
- package/DataGrid/GridColumnHeader/FilterForm.js +9 -10
- package/DataGrid/GridColumnHeader/OperatorSelect.js +10 -3
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +22 -13
- package/DataGrid/GridColumnHeader/utils.js +10 -7
- package/DataGrid/GridHeaderDesktop.js +4 -5
- package/DataGrid/GridHeaderMobile.d.ts +5 -0
- package/DataGrid/GridHeaderMobile.js +29 -0
- package/DataGrid/GridListContainer.d.ts +12 -0
- package/DataGrid/GridListContainer.js +93 -0
- package/DataGrid/GridPaginationContainer.js +1 -2
- package/DataGrid/GridTableContainer.js +113 -77
- package/DataGrid/TableCell/TableCellBase.d.ts +2 -2
- package/DataGrid/TableCell/TableCellBase.js +6 -1
- package/DataGrid/TableCell/TableCellCheckbox.js +6 -5
- package/DataGrid/TableCell/TableCellChoice.d.ts +15 -0
- package/DataGrid/TableCell/TableCellChoice.js +30 -0
- package/DataGrid/TableCell/TableCellLink.d.ts +2 -1
- package/DataGrid/TableCell/TableCellLink.js +13 -5
- 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 +297 -155
- package/DialogContainer/AlertDialog.js +3 -6
- package/DialogContainer/ConfirmDialog.js +5 -9
- package/DialogContainer/DialogContainer.js +2 -13
- package/DialogContainer/ErrorDialog.js +3 -6
- package/DialogContainer/PromptDialog.d.ts +13 -2
- package/DialogContainer/PromptDialog.js +44 -39
- package/Insights/CommandBarContainer.d.ts +1 -0
- package/Insights/CommandBarContainer.js +18 -0
- package/Insights/FilterBarContainer.d.ts +1 -0
- package/Insights/FilterBarContainer.js +99 -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 +80 -0
- package/Insights/WidgetTableContainer.d.ts +7 -0
- package/Insights/WidgetTableContainer.js +57 -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 +21 -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 +19 -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 +119 -0
- package/Insights/charts/PieChart.d.ts +5 -0
- package/Insights/charts/PieChart.js +54 -0
- package/Insights/charts/RadarChart.d.ts +5 -0
- package/Insights/charts/RadarChart.js +38 -0
- package/Insights/charts/ScatterChart.d.ts +5 -0
- package/Insights/charts/ScatterChart.js +81 -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 +186 -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 +64 -0
- package/Insights/hooks/useQueriesData.d.ts +7 -0
- package/Insights/hooks/useQueriesData.js +90 -0
- package/Insights/hooks/useWidgetDetail.d.ts +10 -0
- package/Insights/hooks/useWidgetDetail.js +39 -0
- package/OverflowCommandBar/OverflowCommandBar.js +1 -4
- package/OverflowCommandBar/OverflowMenu.js +5 -17
- package/OverflowCommandBar/render.js +3 -4
- package/OverflowCommandBar/utils.js +2 -3
- package/PageBoard/BoardColumn.d.ts +5 -0
- package/PageBoard/BoardColumn.js +9 -0
- package/PageBoard/BoardColumnCard.d.ts +12 -0
- package/PageBoard/BoardColumnCard.js +29 -0
- package/PageBoard/BoardColumnUI.d.ts +2 -0
- package/PageBoard/BoardColumnUI.js +76 -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 +31 -0
- package/PageBoard/PageBoard.d.ts +7 -0
- package/PageBoard/PageBoard.js +46 -0
- package/PageBoard/index.d.ts +1 -0
- package/PageBoard/index.js +5 -0
- package/PageCalendar/CalendarSection.d.ts +20 -0
- package/PageCalendar/CalendarSection.js +108 -0
- package/PageCalendar/EventDialog/AttributeController.d.ts +10 -0
- package/PageCalendar/EventDialog/AttributeController.js +17 -0
- package/PageCalendar/EventDialog/EventDialog.d.ts +25 -0
- package/PageCalendar/EventDialog/EventDialog.js +21 -0
- package/PageCalendar/EventDialog/EventFormBody.d.ts +18 -0
- package/PageCalendar/EventDialog/EventFormBody.js +69 -0
- package/PageCalendar/EventDialog/EventFormContent.d.ts +10 -0
- package/PageCalendar/EventDialog/EventFormContent.js +27 -0
- package/PageCalendar/EventDialog/types.d.ts +3 -0
- package/PageCalendar/EventDialog/types.js +2 -0
- package/PageCalendar/EventDialog/utils.d.ts +23 -0
- package/PageCalendar/EventDialog/utils.js +57 -0
- package/PageCalendar/Header.d.ts +8 -0
- package/PageCalendar/Header.js +35 -0
- package/PageCalendar/PageCalendar.d.ts +7 -0
- package/PageCalendar/PageCalendar.js +231 -0
- package/PageCalendar/TitleSelector.d.ts +10 -0
- package/PageCalendar/TitleSelector.js +73 -0
- package/PageCalendar/ViewSelector.d.ts +8 -0
- package/PageCalendar/ViewSelector.js +52 -0
- package/PageCalendar/baseEventAttributes.d.ts +35 -0
- package/PageCalendar/baseEventAttributes.js +38 -0
- package/PageCalendar/context.d.ts +20 -0
- package/PageCalendar/context.js +5 -0
- package/PageCalendar/hooks/index.d.ts +1 -0
- package/PageCalendar/hooks/index.js +17 -0
- package/PageCalendar/hooks/useConfig.d.ts +3 -0
- package/PageCalendar/hooks/useConfig.js +8 -0
- package/PageCalendar/index.d.ts +1 -0
- package/PageCalendar/index.js +5 -0
- package/PageCalendar/renderEventContent.d.ts +2 -0
- package/PageCalendar/renderEventContent.js +22 -0
- package/PageCalendar/types.d.ts +5 -0
- package/PageCalendar/types.js +9 -0
- package/PageCalendar/utils.d.ts +3 -0
- package/PageCalendar/utils.js +17 -0
- package/PageEntityForm/CommandContainer.js +9 -5
- package/PageEntityForm/PageCustomEntityForm.d.ts +15 -0
- package/PageEntityForm/PageCustomEntityForm.js +17 -0
- package/PageEntityForm/PageEntityFormDesktopContainer.js +42 -22
- package/PageEntityForm/ProcessFlow.d.ts +10 -0
- package/PageEntityForm/ProcessFlow.js +84 -0
- package/PageEntityForm/RecordAvatar.d.ts +2 -0
- package/PageEntityForm/RecordAvatar.js +83 -0
- package/PageEntityForm/RecordCard.d.ts +1 -1
- package/PageEntityForm/RecordCard.js +60 -53
- package/PageEntityForm/RecordCardLoading.d.ts +8 -0
- package/PageEntityForm/RecordCardLoading.js +24 -0
- package/PageEntityForm/RecordSetNavigatorContainer.js +1 -2
- package/PageEntityForm/RelatedViewSelector.d.ts +0 -2
- package/PageEntityForm/RelatedViewSelector.js +37 -11
- package/PageEntityForm/SectionContainer.d.ts +2 -2
- package/PageEntityForm/SectionContainer.js +77 -13
- package/PageEntityForm/StandardControl.d.ts +1 -22
- package/PageEntityForm/StandardControl.js +103 -117
- package/PageEntityForm/SubgridControl.d.ts +1 -0
- package/PageEntityForm/SubgridControl.js +4 -2
- package/PageEntityForm/UploadImageDialog.d.ts +12 -0
- package/PageEntityForm/UploadImageDialog.js +114 -0
- package/PageEntityView/FormSubgridContainer.js +5 -2
- package/PageEntityView/FormSubgridNotAvailableContainer.d.ts +2 -0
- package/PageEntityView/FormSubgridNotAvailableContainer.js +48 -0
- 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 +2 -0
- package/PageEntityView/PageEntityViewStringContext.js +2 -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/ToastNotificationContainer/index.js +1 -2
- package/componentStore.d.ts +2 -0
- package/componentStore.js +5 -0
- package/components/BodyLoading.d.ts +1 -1
- package/components/BodyLoading.js +13 -8
- package/components/DndProvider.d.ts +12 -0
- package/components/DndProvider.js +68 -0
- package/components/LoginForm.js +5 -21
- package/form/FormControl.js +19 -41
- package/form/controls/AttachmentControl.d.ts +27 -0
- package/form/controls/AttachmentControl.js +220 -0
- package/form/controls/AttachmentsControl.d.ts +6 -0
- package/form/controls/AttachmentsControl.js +35 -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/DateRangeControl.js +4 -6
- package/form/controls/DateTimeControl.d.ts +1 -1
- package/form/controls/DateTimeControl.js +107 -12
- 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 +5 -5
- package/form/controls/IntegerControl.d.ts +4 -0
- package/form/controls/IntegerControl.js +25 -0
- package/form/controls/LookupControl.d.ts +1 -0
- package/form/controls/LookupControl.js +57 -13
- package/form/controls/MultiSelectControl.js +3 -3
- package/form/controls/MultiSelectLookupControl.js +16 -17
- 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.js +4 -5
- 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 +26 -4
- package/form/controls/TextAreaControl.d.ts +1 -1
- package/form/controls/TextAreaControl.js +6 -6
- package/form/controls/TextControl.js +4 -4
- package/form/controls/UrlControl.d.ts +4 -0
- package/form/controls/UrlControl.js +16 -0
- package/form/controls/useLookupData.js +26 -41
- package/form/layout/FormSection/FormSection.js +10 -3
- package/form/layout/FormTab/FormTab.js +4 -4
- package/form/types.d.ts +2 -2
- package/package.json +17 -12
- package/styles.css +149 -0
- package/types/index.d.ts +18 -0
- package/utils/avatar.d.ts +2 -0
- package/utils/avatar.js +45 -0
- package/App/AppProvider.d.ts +0 -9
- package/App/AppProvider.js +0 -50
- package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
- package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
- package/DataGrid/getAttributeFormattedValue.d.ts +0 -16
- package/DataGrid/getAttributeFormattedValue.js +0 -92
- package/form/controls/NumberControl.d.ts +0 -4
- package/form/controls/NumberControl.js +0 -16
|
@@ -25,7 +25,6 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
27
|
const RecordSetNavigatorContainer = () => {
|
|
28
|
-
var _a, _b;
|
|
29
28
|
const { data, cardView, schema } = (0, hooks_2.useRecordSetResult)();
|
|
30
29
|
const [visible] = (0, hooks_2.useRecordSetVisibility)();
|
|
31
30
|
const recordId = (0, hooks_1.useRecordId)();
|
|
@@ -55,7 +54,7 @@ const RecordSetNavigatorContainer = () => {
|
|
|
55
54
|
flexDirection: 'column',
|
|
56
55
|
paddingInline: 16,
|
|
57
56
|
paddingBlock: 8,
|
|
58
|
-
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children:
|
|
57
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: schema.localizedPluralLabels?.[language] ?? schema?.pluralLabel }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { vertical: false, style: { opacity: 0.2 } }) }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, { autoHide: true, rtl: direction === 'rtl', children: data?.map((record) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { role: "button", className: (0, react_components_1.mergeClasses)(styles.item, recordId ===
|
|
59
58
|
record[schema.idAttribute] &&
|
|
60
59
|
styles.selected), onClick: () => {
|
|
61
60
|
openForm({
|
|
@@ -2,8 +2,6 @@ import { Localized } from '@headless-adminapp/core/types';
|
|
|
2
2
|
export interface RelatedItemInfo {
|
|
3
3
|
key: string;
|
|
4
4
|
logicalName: string;
|
|
5
|
-
label: string;
|
|
6
|
-
localizedLabels?: Localized<string>;
|
|
7
5
|
pluralLabel: string;
|
|
8
6
|
localizedPluralLabels?: Localized<string>;
|
|
9
7
|
attributeName: string;
|
|
@@ -10,7 +10,35 @@ 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
|
+
const schema = schemas[item.logicalName];
|
|
20
|
+
if (!schema) {
|
|
21
|
+
throw new Error(`Schema not found: ${item.logicalName}`);
|
|
22
|
+
}
|
|
23
|
+
if (!schema.attributes[item.attributeName]) {
|
|
24
|
+
throw new Error(`Attribute not found: ${item.logicalName}.${item.attributeName}`);
|
|
25
|
+
}
|
|
26
|
+
const attribute = schema.attributes[item.attributeName];
|
|
27
|
+
if (!(0, utils_1.isLookupAttribute)(attribute)) {
|
|
28
|
+
throw new Error(`Attribute is not a lookup: ${item.logicalName}.${item.attributeName}`);
|
|
29
|
+
}
|
|
30
|
+
if (attribute.entity !== currentSchema.logicalName) {
|
|
31
|
+
throw new Error(`Attribute entity does not match: ${item.logicalName}.${item.attributeName}`);
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
key: `${schema.logicalName}.${item.attributeName}`,
|
|
35
|
+
logicalName: schema.logicalName,
|
|
36
|
+
attributeName: item.attributeName,
|
|
37
|
+
pluralLabel: item.pluralLabel ?? schema.pluralLabel,
|
|
38
|
+
localizedPluralLabels: item.localizedPluralLabels ?? schema.localizedPluralLabels,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}
|
|
14
42
|
return Object.values(schemas)
|
|
15
43
|
.map((s) => {
|
|
16
44
|
return Object.entries(s.attributes)
|
|
@@ -34,11 +62,9 @@ function getRelatedItems(currentSchema, schemas) {
|
|
|
34
62
|
return {
|
|
35
63
|
key: `${s.logicalName}.${item.key}`,
|
|
36
64
|
logicalName: s.logicalName,
|
|
37
|
-
label: s.label,
|
|
38
|
-
localizedLabels: s.localizedLabels,
|
|
39
|
-
pluralLabel: s.pluralLabel,
|
|
40
|
-
localizedPluralLabels: s.localizedPluralLabels,
|
|
41
65
|
attributeName: item.key,
|
|
66
|
+
pluralLabel: item.attribute.relatedLabel ?? s.pluralLabel,
|
|
67
|
+
localizedPluralLabels: item.attribute.localizedRelatedLabel ?? s.localizedPluralLabels,
|
|
42
68
|
};
|
|
43
69
|
});
|
|
44
70
|
})
|
|
@@ -46,11 +72,13 @@ function getRelatedItems(currentSchema, schemas) {
|
|
|
46
72
|
}
|
|
47
73
|
function RelatedViewSelector(props) {
|
|
48
74
|
const schema = (0, hooks_1.useDataFormSchema)();
|
|
75
|
+
const recordId = (0, hooks_1.useRecordId)();
|
|
76
|
+
const formConfig = (0, hooks_1.useSelectedForm)();
|
|
49
77
|
const { schemas } = (0, hooks_2.useMetadata)();
|
|
50
78
|
const strings = (0, PageEntityFormStringContext_1.usePageEntityFormStrings)();
|
|
51
79
|
const { language } = (0, locale_1.useLocale)();
|
|
52
|
-
const data = (0, react_1.useMemo)(() => getRelatedItems(schema, schemas), [schema, schemas]);
|
|
53
|
-
if (!data.length) {
|
|
80
|
+
const data = (0, react_1.useMemo)(() => getRelatedItems(schema, schemas, formConfig.experience.relatedItems), [formConfig.experience.relatedItems, schema, schemas]);
|
|
81
|
+
if (!data.length || !recordId) {
|
|
54
82
|
return null;
|
|
55
83
|
}
|
|
56
84
|
return ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsxs)("button", { style: {
|
|
@@ -70,8 +98,6 @@ function RelatedViewSelector(props) {
|
|
|
70
98
|
outlineStyle: 'none',
|
|
71
99
|
textTransform: 'none',
|
|
72
100
|
columnGap: react_components_1.tokens.spacingHorizontalSNudge,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
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));
|
|
76
|
-
}) }) })] }));
|
|
101
|
+
color: react_components_1.tokens.colorNeutralForeground2,
|
|
102
|
+
}, 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) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => props.onSelect(item), children: item.localizedPluralLabels?.[language] ?? item.pluralLabel }, item.key))) }) })] }));
|
|
77
103
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Section } from '@headless-adminapp/core/experience/form';
|
|
2
|
-
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import type { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
3
3
|
export declare function SectionContainer<S extends SchemaAttributes = SchemaAttributes>({ section }: {
|
|
4
4
|
section: Section<S>;
|
|
5
5
|
readOnly: boolean;
|
|
6
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,10 +2,17 @@
|
|
|
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
|
|
5
|
+
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
6
|
+
const constants_1 = require("@headless-adminapp/app/dataform/constants");
|
|
7
|
+
const utils_1 = require("@headless-adminapp/app/dataform/DataFormProvider/utils");
|
|
6
8
|
const hooks_1 = require("@headless-adminapp/app/dataform/hooks");
|
|
9
|
+
const useEventManager_1 = require("@headless-adminapp/app/dataform/hooks/useEventManager");
|
|
7
10
|
const locale_1 = require("@headless-adminapp/app/locale");
|
|
11
|
+
const utils_2 = require("@headless-adminapp/app/locale/utils");
|
|
12
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
13
|
+
const react_1 = require("react");
|
|
8
14
|
const react_hook_form_1 = require("react-hook-form");
|
|
15
|
+
const componentStore_1 = require("../componentStore");
|
|
9
16
|
const SectionControl_1 = require("../DataForm/SectionControl");
|
|
10
17
|
const layout_1 = require("../form/layout");
|
|
11
18
|
const StandardControl_1 = require("./StandardControl");
|
|
@@ -14,46 +21,103 @@ function SectionContainer({ section }) {
|
|
|
14
21
|
const schema = (0, hooks_1.useDataFormSchema)();
|
|
15
22
|
const formInstance = (0, hooks_1.useFormInstance)();
|
|
16
23
|
const recordId = (0, hooks_1.useRecordId)();
|
|
17
|
-
const
|
|
24
|
+
const isFormReadonly = (0, hooks_1.useFormIsReadonly)();
|
|
18
25
|
const { language } = (0, locale_1.useLocale)();
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
const eventManager = (0, useEventManager_1.useEventManager)();
|
|
27
|
+
const disabledControls = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.disabledControls);
|
|
28
|
+
const hiddenControls = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.hiddenControls);
|
|
29
|
+
const requiredFields = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.requiredFields);
|
|
30
|
+
const hiddenSections = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.hiddenSections);
|
|
31
|
+
const visibleControls = (0, react_1.useMemo)(() => section.controls.filter((control) => {
|
|
32
|
+
return !(0, utils_1.getIsControlHidden)({
|
|
33
|
+
control,
|
|
34
|
+
hiddenControls,
|
|
35
|
+
});
|
|
36
|
+
}), [section.controls, hiddenControls]);
|
|
37
|
+
if (hiddenSections[section.name] || visibleControls.length === 0) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(layout_1.FormSection, { title: (0, utils_2.localizedLabel)(language, section), columnCount: section.columnCount, labelPosition: section.labelPosition, noPadding: section.noPadding, hideLabel: section.hideLabel, children: visibleControls.map((control, index) => {
|
|
21
41
|
switch (control.type) {
|
|
22
|
-
case 'standard':
|
|
42
|
+
case 'standard': {
|
|
23
43
|
const attribute = schema.attributes[control.attributeName];
|
|
44
|
+
let Control = StandardControl_1.StandardControl;
|
|
45
|
+
if (control.component) {
|
|
46
|
+
if (typeof control.component === 'function') {
|
|
47
|
+
Control = control.component;
|
|
48
|
+
}
|
|
49
|
+
else if (typeof control.component === 'string') {
|
|
50
|
+
const OverrideControl = componentStore_1.componentStore.getComponent(control.component);
|
|
51
|
+
if (OverrideControl) {
|
|
52
|
+
Control = OverrideControl;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const disabled = (0, utils_1.getIsFieldDisabled)({
|
|
57
|
+
isFormReadonly,
|
|
58
|
+
disabledFields: disabledControls,
|
|
59
|
+
attribute,
|
|
60
|
+
control,
|
|
61
|
+
});
|
|
62
|
+
const required = (0, utils_1.getIsFieldRequired)({
|
|
63
|
+
attribute,
|
|
64
|
+
requiredFields,
|
|
65
|
+
control,
|
|
66
|
+
});
|
|
24
67
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
25
68
|
gridColumn: control.span
|
|
26
69
|
? `var(--section-item-span-${control.span})`
|
|
27
70
|
: undefined,
|
|
28
71
|
}, children: (0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: formInstance.control, name: control.attributeName, render: ({ field, fieldState, formState }) => {
|
|
29
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
30
72
|
const isError = (fieldState.isTouched || formState.isSubmitted) &&
|
|
31
|
-
!!
|
|
73
|
+
!!fieldState.error?.message;
|
|
32
74
|
const errorMessage = fieldState.isTouched || formState.isSubmitted
|
|
33
|
-
?
|
|
75
|
+
? fieldState.error?.message
|
|
34
76
|
: '';
|
|
35
|
-
const label =
|
|
36
|
-
|
|
77
|
+
const label = control.localizedLabels?.[language] ??
|
|
78
|
+
attribute.localizedLabels?.[language] ??
|
|
79
|
+
control.label ??
|
|
80
|
+
attribute.label;
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: label, labelPosition: section.labelPosition, required: required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(Control, { attribute: attribute, name: control.attributeName, value: field.value, onChange: (value) => {
|
|
82
|
+
field.onChange(value);
|
|
83
|
+
eventManager.emit(constants_1.EVENT_KEY_ON_FIELD_CHANGE, control.attributeName, value);
|
|
84
|
+
}, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError, readOnly: disabled, label: label, placeholder: label, allowNavigation: true, allowNewRecord: true, fileServiceContext: {
|
|
85
|
+
type: 'entity-form',
|
|
86
|
+
recordId,
|
|
87
|
+
attributeName: control.attributeName,
|
|
88
|
+
logicalName: schema.logicalName,
|
|
89
|
+
} }) }));
|
|
37
90
|
} }, control.attributeName) }, control.attributeName));
|
|
91
|
+
}
|
|
38
92
|
case 'editablegrid': {
|
|
39
93
|
return null;
|
|
40
94
|
}
|
|
41
95
|
case 'quickview':
|
|
42
96
|
return null;
|
|
43
|
-
case 'subgrid':
|
|
44
|
-
|
|
97
|
+
case 'subgrid': {
|
|
98
|
+
let ContainerComponent = null;
|
|
99
|
+
if (control.component) {
|
|
100
|
+
if (typeof control.component === 'function') {
|
|
101
|
+
ContainerComponent = control.component;
|
|
102
|
+
}
|
|
103
|
+
else if (typeof control.component === 'string') {
|
|
104
|
+
ContainerComponent = componentStore_1.componentStore.getComponent(control.component);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
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
108
|
? false
|
|
46
109
|
: {
|
|
47
110
|
logicalName: schema.logicalName,
|
|
48
111
|
id: recordId,
|
|
49
112
|
refAttributeName: control.associatedAttribute,
|
|
50
113
|
} }, index));
|
|
114
|
+
}
|
|
51
115
|
case 'spacer':
|
|
52
116
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
53
117
|
gridColumn: control.span
|
|
54
118
|
? `var(--section-item-span-${control.span})`
|
|
55
119
|
: undefined,
|
|
56
|
-
display: `var(--section-item-spacer-${
|
|
120
|
+
display: `var(--section-item-spacer-${control.span ?? 1})`,
|
|
57
121
|
} }, index));
|
|
58
122
|
default:
|
|
59
123
|
return null;
|
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { StandardControlProps } from '@headless-adminapp/core/experience/form/SectionControl';
|
|
2
2
|
import { FC } from 'react';
|
|
3
|
-
interface StandardControlProps {
|
|
4
|
-
attribute: Attribute;
|
|
5
|
-
label?: string;
|
|
6
|
-
isError: boolean;
|
|
7
|
-
errorMessage: string | undefined;
|
|
8
|
-
name: string;
|
|
9
|
-
value: any;
|
|
10
|
-
placeholder?: string;
|
|
11
|
-
onChange: (value: any) => void;
|
|
12
|
-
onBlur: () => void;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
borderOnFocusOnly?: boolean;
|
|
15
|
-
hideLabel?: boolean;
|
|
16
|
-
hidePlaceholder?: boolean;
|
|
17
|
-
allowQuickCreate?: boolean;
|
|
18
|
-
readOnly?: boolean;
|
|
19
|
-
quickViewControl?: boolean;
|
|
20
|
-
allowNavigation?: boolean;
|
|
21
|
-
allowNewRecord?: boolean;
|
|
22
|
-
}
|
|
23
3
|
export declare const StandardControl: FC<StandardControlProps>;
|
|
24
|
-
export {};
|
|
@@ -8,42 +8,53 @@ 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
|
-
|
|
36
|
-
|
|
31
|
+
const UrlControl_1 = require("../form/controls/UrlControl");
|
|
32
|
+
// Standard Control (Base control)
|
|
33
|
+
// TextControl
|
|
34
|
+
// TextInput
|
|
35
|
+
const StandardControl = (props) => {
|
|
36
|
+
const { attribute, label: _label, isError,
|
|
37
|
+
// errorMessage,
|
|
38
|
+
name, value, onBlur, onChange,
|
|
39
|
+
// dataService,
|
|
40
|
+
// fileService,
|
|
41
|
+
borderOnFocusOnly, placeholder: _placeholder,
|
|
42
|
+
// hideLabel,
|
|
43
|
+
hidePlaceholder, readOnly,
|
|
44
|
+
// quickViewControl,
|
|
45
|
+
allowNavigation, allowNewRecord, } = props;
|
|
46
|
+
const isDisabled = readOnly;
|
|
37
47
|
// const label = hideLabel ? undefined : _label ?? attribute.label;
|
|
38
48
|
const placeholder = hidePlaceholder
|
|
39
49
|
? undefined
|
|
40
|
-
:
|
|
50
|
+
: _placeholder ?? _label ?? attribute.label;
|
|
41
51
|
// const required = quickViewControl ? false : attribute.required;
|
|
42
52
|
const dataService = (0, transport_1.useDataService)();
|
|
53
|
+
const fileService = (0, transport_1.useFileService)();
|
|
43
54
|
const { schemaStore, experienceStore } = (0, hooks_1.useMetadata)();
|
|
44
55
|
// const { openQuickCreate } = useQuickCreateForm();
|
|
45
56
|
switch (attribute.type) {
|
|
46
|
-
case 'string':
|
|
57
|
+
case 'string': {
|
|
47
58
|
const controlProps = {
|
|
48
59
|
name,
|
|
49
60
|
placeholder,
|
|
@@ -51,25 +62,58 @@ allowNavigation, allowNewRecord, }) => {
|
|
|
51
62
|
onChange,
|
|
52
63
|
onBlur,
|
|
53
64
|
error: isError,
|
|
54
|
-
disabled:
|
|
65
|
+
disabled: readOnly,
|
|
55
66
|
readOnly,
|
|
56
67
|
};
|
|
57
68
|
switch (attribute.format) {
|
|
58
|
-
case 'text':
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
case '
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
case '
|
|
67
|
-
|
|
69
|
+
case 'text': {
|
|
70
|
+
const Control = componentStore_1.componentStore.getComponent('Form.TextControl') ?? TextControl_1.TextControl;
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)(Control, { ...controlProps, textTransform: attribute.textTransform }));
|
|
72
|
+
}
|
|
73
|
+
case 'email': {
|
|
74
|
+
const Control = componentStore_1.componentStore.getComponent('Form.EmailControl') ?? EmailControl_1.EmailControl;
|
|
75
|
+
return (0, jsx_runtime_1.jsx)(Control, { ...controlProps });
|
|
76
|
+
}
|
|
77
|
+
case 'phone': {
|
|
78
|
+
const Control = componentStore_1.componentStore.getComponent('Form.TelephoneControl') ?? TelephoneControl_1.TelephoneControl;
|
|
79
|
+
return (0, jsx_runtime_1.jsx)(Control, { ...controlProps });
|
|
80
|
+
}
|
|
81
|
+
case 'url': {
|
|
82
|
+
const Control = componentStore_1.componentStore.getComponent('Form.UrlControl') ??
|
|
83
|
+
UrlControl_1.UrlControl;
|
|
84
|
+
return (0, jsx_runtime_1.jsx)(Control, { ...controlProps });
|
|
85
|
+
}
|
|
86
|
+
case 'textarea': {
|
|
87
|
+
const Control = componentStore_1.componentStore.getComponent('Form.TextAreaControl') ?? TextAreaControl_1.TextAreaControl;
|
|
88
|
+
return (0, jsx_runtime_1.jsx)(Control, { ...controlProps });
|
|
89
|
+
}
|
|
90
|
+
case 'richtext': {
|
|
91
|
+
const Control = componentStore_1.componentStore.getComponent('Form.RichTextControl') ?? RichTextControl_1.RichTextControl;
|
|
92
|
+
return (0, jsx_runtime_1.jsx)(Control, { ...controlProps });
|
|
93
|
+
}
|
|
68
94
|
default:
|
|
69
95
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
|
|
70
96
|
}
|
|
71
|
-
|
|
72
|
-
|
|
97
|
+
}
|
|
98
|
+
case 'number': {
|
|
99
|
+
switch (attribute.format) {
|
|
100
|
+
case 'decimal': {
|
|
101
|
+
const Control = componentStore_1.componentStore.getComponent('Form.DecimalControl') ?? DecimalControl_1.DecimalControl;
|
|
102
|
+
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 }));
|
|
103
|
+
}
|
|
104
|
+
case 'integer': {
|
|
105
|
+
const Control = componentStore_1.componentStore.getComponent('Form.IntegerControl') ?? IntegerControl_1.IntegerControl;
|
|
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
|
+
case 'duration': {
|
|
109
|
+
const Control = componentStore_1.componentStore.getComponent('Form.DurationControl') ?? DurationControl_1.DurationControl;
|
|
110
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, placeholder: placeholder, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
111
|
+
}
|
|
112
|
+
default: {
|
|
113
|
+
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
73
117
|
case 'date': {
|
|
74
118
|
const controlProps = {
|
|
75
119
|
name,
|
|
@@ -82,10 +126,13 @@ allowNavigation, allowNewRecord, }) => {
|
|
|
82
126
|
readOnly,
|
|
83
127
|
};
|
|
84
128
|
if (attribute.format === 'datetime') {
|
|
85
|
-
|
|
129
|
+
const Control = componentStore_1.componentStore.getComponent('Form.DateTimeControl') ?? DateTimeControl_1.DateTimeControl;
|
|
130
|
+
return (0, jsx_runtime_1.jsx)(Control, { ...controlProps });
|
|
86
131
|
}
|
|
87
132
|
else {
|
|
88
|
-
|
|
133
|
+
const Control = componentStore_1.componentStore.getComponent('Form.DateControl') ??
|
|
134
|
+
DateControl_1.DateControl;
|
|
135
|
+
return (0, jsx_runtime_1.jsx)(Control, { ...controlProps });
|
|
89
136
|
}
|
|
90
137
|
}
|
|
91
138
|
case 'daterange': {
|
|
@@ -99,105 +146,40 @@ allowNavigation, allowNewRecord, }) => {
|
|
|
99
146
|
disabled: isDisabled,
|
|
100
147
|
readOnly,
|
|
101
148
|
};
|
|
102
|
-
|
|
149
|
+
const Control = componentStore_1.componentStore.getComponent('Form.DateRangeControl') ?? DateRangeControl_1.DateRangeControl;
|
|
150
|
+
return (0, jsx_runtime_1.jsx)(Control, { ...controlProps });
|
|
103
151
|
}
|
|
104
152
|
case 'money': {
|
|
105
|
-
|
|
153
|
+
const Control = componentStore_1.componentStore.getComponent('Form.CurrencyControl') ?? CurrencyControl_1.CurrencyControl;
|
|
154
|
+
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
155
|
}
|
|
107
156
|
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 }));
|
|
157
|
+
const Control = componentStore_1.componentStore.getComponent('Form.LookupControl') ?? LookupControl_1.LookupControl;
|
|
158
|
+
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
159
|
}
|
|
190
160
|
case 'lookups': {
|
|
191
|
-
|
|
161
|
+
const Control = componentStore_1.componentStore.getComponent('Form.MultiSelectLookupControl') ?? MultiSelectLookupControl_1.MultiSelectLookupControl;
|
|
162
|
+
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
163
|
}
|
|
193
164
|
case 'boolean': {
|
|
194
|
-
|
|
165
|
+
const Control = componentStore_1.componentStore.getComponent('Form.SwitchControl') ?? SwitchControl_1.SwitchControl;
|
|
166
|
+
return ((0, jsx_runtime_1.jsx)(Control, { name: name, value: value, onChange: onChange, onBlur: onBlur, error: isError, disabled: isDisabled, readOnly: readOnly }));
|
|
195
167
|
}
|
|
196
168
|
case 'choice': {
|
|
197
|
-
|
|
169
|
+
const Control = componentStore_1.componentStore.getComponent('Form.SelectControl') ?? SelectControl_1.default;
|
|
170
|
+
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
171
|
}
|
|
199
172
|
case 'choices': {
|
|
200
|
-
|
|
173
|
+
const Control = componentStore_1.componentStore.getComponent('Form.MultiSelectControl') ?? MultiSelectControl_1.default;
|
|
174
|
+
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 }));
|
|
175
|
+
}
|
|
176
|
+
case 'attachment': {
|
|
177
|
+
const Control = componentStore_1.componentStore.getComponent('Form.AttachmentControl') ?? AttachmentControl_1.AttachmentControl;
|
|
178
|
+
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 }));
|
|
179
|
+
}
|
|
180
|
+
case 'attachments': {
|
|
181
|
+
const Control = componentStore_1.componentStore.getComponent('Form.AttachmentsControl') ?? AttachmentsControl_1.AttachmentsControl;
|
|
182
|
+
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
183
|
}
|
|
202
184
|
// case 'attachment': {
|
|
203
185
|
// return (
|
|
@@ -222,6 +204,10 @@ allowNavigation, allowNewRecord, }) => {
|
|
|
222
204
|
// );
|
|
223
205
|
// }
|
|
224
206
|
}
|
|
207
|
+
const FallBackControl = componentStore_1.componentStore.getComponent('StandardControl.FallBack');
|
|
208
|
+
if (FallBackControl) {
|
|
209
|
+
return (0, jsx_runtime_1.jsx)(FallBackControl, { ...props });
|
|
210
|
+
}
|
|
225
211
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {});
|
|
226
212
|
};
|
|
227
213
|
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 {};
|
|
@@ -7,8 +7,8 @@ const DataGridProvider_1 = require("@headless-adminapp/app/datagrid/DataGridProv
|
|
|
7
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
|
+
const FormSubgridNotAvailableContainer_1 = require("../PageEntityView/FormSubgridNotAvailableContainer");
|
|
10
11
|
function SubgridControl(props) {
|
|
11
|
-
var _a;
|
|
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,7 @@ function SubgridControl(props) {
|
|
|
62
62
|
}
|
|
63
63
|
return brokenContent;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
const ContainerComponent = props.ContainerComponent ?? FormSubgridContainer_1.FormSubgridContainer;
|
|
66
|
+
const disabled = !!props.associated && !props.associated.id;
|
|
67
|
+
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: props.allowViewSelection ?? false, disabled: disabled, children: disabled ? (0, jsx_runtime_1.jsx)(FormSubgridNotAvailableContainer_1.FormSubgridNotAvailableContainer, {}) : (0, jsx_runtime_1.jsx)(ContainerComponent, {}) }));
|
|
66
68
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FileObject } from '@headless-adminapp/core/attributes/AttachmentAttribute';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface UploadImageDialogProps {
|
|
4
|
+
recordId: string;
|
|
5
|
+
recordTitle: string;
|
|
6
|
+
currentImage: FileObject | null;
|
|
7
|
+
onChange?: (value: FileObject | null) => void;
|
|
8
|
+
open: boolean;
|
|
9
|
+
onOpenChange: (open: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const UploadImageDialog: FC<UploadImageDialogProps>;
|
|
12
|
+
export {};
|