@headless-adminapp/fluent 0.0.17-alpha.8 → 1.0.1
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 +27 -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 +33 -35
- 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 +34 -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 +39 -19
- 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 +18 -7
- package/form/controls/DateRangeControl.js +4 -6
- package/form/controls/DateTimeControl.d.ts +1 -1
- package/form/controls/DateTimeControl.js +108 -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
|
@@ -13,13 +13,17 @@ const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
|
13
13
|
const hooks_4 = require("@headless-adminapp/app/recordset/hooks");
|
|
14
14
|
const hooks_5 = require("@headless-adminapp/app/route/hooks");
|
|
15
15
|
const utils_1 = require("@headless-adminapp/app/utils");
|
|
16
|
+
const phone_1 = require("@headless-adminapp/app/utils/phone");
|
|
16
17
|
const app_1 = require("@headless-adminapp/core/experience/app");
|
|
17
18
|
const react_table_1 = require("@tanstack/react-table");
|
|
18
19
|
const react_1 = require("react");
|
|
20
|
+
const componentStore_1 = require("../componentStore");
|
|
19
21
|
const GridColumnHeader_1 = require("../DataGrid/GridColumnHeader");
|
|
20
22
|
const TableCell_1 = require("../DataGrid/TableCell");
|
|
21
23
|
const TableCellLink_1 = require("../DataGrid/TableCell/TableCellLink");
|
|
24
|
+
const avatar_1 = require("../utils/avatar");
|
|
22
25
|
const ActionCell_1 = require("./ActionCell");
|
|
26
|
+
const TableCellChoice_1 = require("./TableCell/TableCellChoice");
|
|
23
27
|
const columnHelper = (0, react_table_1.createColumnHelper)();
|
|
24
28
|
const useStyles = (0, react_components_1.makeStyles)({
|
|
25
29
|
selectionCell: {
|
|
@@ -38,33 +42,29 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
|
|
|
38
42
|
const [, setSorting] = (0, hooks_1.useGridSorting)();
|
|
39
43
|
const schema = (0, hooks_1.useDataGridSchema)();
|
|
40
44
|
const { schemaStore } = (0, hooks_3.useMetadata)();
|
|
41
|
-
const [, setSelectedIds] = (0, hooks_1.useGridSelection)();
|
|
45
|
+
const [selectedIds, setSelectedIds] = (0, hooks_1.useGridSelection)();
|
|
42
46
|
const setSelectedIdsRef = (0, react_1.useRef)(setSelectedIds);
|
|
43
47
|
setSelectedIdsRef.current = setSelectedIds;
|
|
44
48
|
const isSubgrid = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.isSubGrid);
|
|
45
49
|
const contextCommands = isSubgrid
|
|
46
50
|
? // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
47
|
-
(0, hooks_1.
|
|
51
|
+
(0, hooks_1.useSubGridContextCommands)()
|
|
48
52
|
: // eslint-disable-next-line react-hooks/rules-of-hooks
|
|
49
53
|
(0, hooks_1.useMainGridContextCommands)();
|
|
50
54
|
const mutableContextCommandState = (0, mutable_1.useMutableState)(contextCommands, true);
|
|
51
55
|
(0, react_1.useEffect)(() => {
|
|
52
56
|
mutableContextCommandState.setValue(contextCommands);
|
|
53
57
|
}, [contextCommands, mutableContextCommandState]);
|
|
54
|
-
const tableWrapperSize = (0, hooks_2.useElementSize)(tableWrapperRef);
|
|
58
|
+
const tableWrapperSize = (0, hooks_2.useElementSize)(tableWrapperRef, 100);
|
|
55
59
|
const columnWidths = (0, react_1.useMemo)(() => {
|
|
56
|
-
|
|
57
|
-
const availableWidth = Math.max(0, ((_a = tableWrapperSize.width) !== null && _a !== void 0 ? _a : 0) - 32 - 32 - 16);
|
|
60
|
+
const availableWidth = Math.max(0, (tableWrapperSize.width ?? 0) - 32 - 32 - 16);
|
|
58
61
|
const { columns: calculatedColumns } = (0, utils_1.calculateColumnWidths)({
|
|
59
62
|
availableWidth,
|
|
60
63
|
gapWidth: 0,
|
|
61
|
-
columns: columns.map((column) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
maxWidth: (_b = column.maxWidth) !== null && _b !== void 0 ? _b : 1000,
|
|
66
|
-
});
|
|
67
|
-
}),
|
|
64
|
+
columns: columns.map((column) => ({
|
|
65
|
+
width: column.width ?? 100,
|
|
66
|
+
maxWidth: column.maxWidth ?? 1000,
|
|
67
|
+
})),
|
|
68
68
|
});
|
|
69
69
|
return calculatedColumns;
|
|
70
70
|
}, [columns, tableWrapperSize.width]);
|
|
@@ -73,167 +73,309 @@ function useTableColumns({ disableSelection, disableContextMenu, disableColumnRe
|
|
|
73
73
|
const router = (0, hooks_5.useRouter)();
|
|
74
74
|
const recordSetSetter = (0, hooks_4.useRecordSetSetter)();
|
|
75
75
|
const openRecord = (0, useOpenRecord_1.useOpenRecord)();
|
|
76
|
-
const
|
|
76
|
+
const locale = (0, locale_1.useLocale)();
|
|
77
77
|
const dataRef = (0, react_1.useRef)(data);
|
|
78
78
|
dataRef.current = data;
|
|
79
|
-
|
|
79
|
+
const headingSelectionState = (0, react_1.useMemo)(() => {
|
|
80
|
+
if (data?.records.length === 0) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
if (selectedIds.length === 0) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (selectedIds.length === dataRef.current?.records.length) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
return 'mixed';
|
|
90
|
+
}, [data?.records.length, selectedIds]);
|
|
91
|
+
const actionColumns = (0, react_1.useMemo)(() => {
|
|
92
|
+
if (disableContextMenu)
|
|
93
|
+
return [];
|
|
80
94
|
return [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
} }, column.id));
|
|
161
|
-
}
|
|
162
|
-
switch (attribute === null || attribute === void 0 ? void 0 : attribute.type) {
|
|
163
|
-
case 'money':
|
|
164
|
-
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: formattedValue, width: info.column.getSize(), textAlignment: "right" }, column.id));
|
|
165
|
-
case 'lookup':
|
|
166
|
-
if (!value) {
|
|
167
|
-
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: "", width: info.column.getSize() }, column.id));
|
|
168
|
-
}
|
|
169
|
-
const path = routeResolver({
|
|
170
|
-
logicalName: attribute.entity,
|
|
171
|
-
type: app_1.PageType.EntityForm,
|
|
172
|
-
id: value.id,
|
|
173
|
-
});
|
|
174
|
-
return ((0, jsx_runtime_1.jsx)(TableCellLink_1.TableCellLink, { value: formattedValue, width: info.column.getSize(), href: path, onClick: () => {
|
|
175
|
-
recordSetSetter('', []);
|
|
176
|
-
router.push(path);
|
|
177
|
-
} }, column.id));
|
|
178
|
-
}
|
|
179
|
-
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: formattedValue, width: info.column.getSize() }, column.id));
|
|
180
|
-
},
|
|
181
|
-
enableResizing: true,
|
|
182
|
-
size: columnWidths[index],
|
|
183
|
-
minSize: 100,
|
|
184
|
-
maxSize: 1000,
|
|
185
|
-
});
|
|
95
|
+
columnHelper.accessor((info) => info[schema.idAttribute], {
|
|
96
|
+
id: '$actionColumn',
|
|
97
|
+
header: () => ((0, jsx_runtime_1.jsx)(react_components_1.TableHeaderCell, { style: {
|
|
98
|
+
minWidth: 32,
|
|
99
|
+
flexShrink: 0,
|
|
100
|
+
// width: 32,
|
|
101
|
+
flex: 1,
|
|
102
|
+
position: 'sticky',
|
|
103
|
+
display: 'flex',
|
|
104
|
+
right: 0,
|
|
105
|
+
top: 0,
|
|
106
|
+
// zIndex: 1,
|
|
107
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
108
|
+
borderBottom: `${react_components_1.tokens.strokeWidthThin} solid ${react_components_1.tokens.colorNeutralStroke3}`,
|
|
109
|
+
}, children: "\u00A0" })),
|
|
110
|
+
cell: (info) => ((0, jsx_runtime_1.jsx)(ActionCell_1.ActionCell, { onOpen: () => {
|
|
111
|
+
const id = info.row.original[schema.idAttribute];
|
|
112
|
+
setSelectedIdsRef.current([id]);
|
|
113
|
+
}, mutableState: mutableContextCommandState })),
|
|
114
|
+
enableResizing: false,
|
|
115
|
+
size: 32,
|
|
116
|
+
minSize: 32,
|
|
117
|
+
maxSize: 32,
|
|
118
|
+
}),
|
|
119
|
+
];
|
|
120
|
+
}, [disableContextMenu, mutableContextCommandState, schema.idAttribute]);
|
|
121
|
+
const selectionColumns = (0, react_1.useMemo)(() => {
|
|
122
|
+
if (disableSelection)
|
|
123
|
+
return [];
|
|
124
|
+
function getAllIds() {
|
|
125
|
+
return (dataRef.current?.records.map((record) => record[schema.idAttribute]) ?? []);
|
|
126
|
+
}
|
|
127
|
+
function toggleAllSelectedIds() {
|
|
128
|
+
setSelectedIdsRef.current((ids) => {
|
|
129
|
+
if (ids.length === dataRef.current?.records.length) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
return getAllIds();
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function excludeId(ids, id) {
|
|
136
|
+
return ids.filter((i) => i !== id);
|
|
137
|
+
}
|
|
138
|
+
function toggleSelectedId(info) {
|
|
139
|
+
setSelectedIdsRef.current((ids) => {
|
|
140
|
+
const id = info.row.original[schema.idAttribute];
|
|
141
|
+
if (ids.includes(id)) {
|
|
142
|
+
return excludeId(ids, id);
|
|
143
|
+
}
|
|
144
|
+
return [...ids, id];
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return [
|
|
148
|
+
columnHelper.accessor((info) => info[schema.idAttribute], {
|
|
149
|
+
id: '$selectColumn',
|
|
150
|
+
header: () => ((0, jsx_runtime_1.jsx)(react_components_1.TableSelectionCell, { checked: headingSelectionState, as: 'th', style: {
|
|
151
|
+
position: 'sticky',
|
|
152
|
+
display: 'flex',
|
|
153
|
+
left: 0,
|
|
154
|
+
top: 0,
|
|
155
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
156
|
+
zIndex: 1,
|
|
157
|
+
width: 32,
|
|
158
|
+
maxWidth: 32,
|
|
159
|
+
minWidth: 32,
|
|
160
|
+
}, onClick: toggleAllSelectedIds })),
|
|
161
|
+
cell: (info) => ((0, jsx_runtime_1.jsx)(react_components_1.TableSelectionCell, { className: (0, react_components_1.mergeClasses)(styles.selectionCell), checked: info.row.getIsSelected(), onClick: (event) => {
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
event.stopPropagation();
|
|
164
|
+
toggleSelectedId(info);
|
|
165
|
+
}, style: {
|
|
166
|
+
width: 32,
|
|
167
|
+
maxWidth: 32,
|
|
168
|
+
minWidth: 32,
|
|
169
|
+
} })),
|
|
170
|
+
enableResizing: false,
|
|
171
|
+
size: 32,
|
|
172
|
+
minSize: 32,
|
|
173
|
+
maxSize: 32,
|
|
186
174
|
}),
|
|
187
|
-
...(disableContextMenu
|
|
188
|
-
? []
|
|
189
|
-
: [
|
|
190
|
-
columnHelper.accessor((info) => info[schema.idAttribute], {
|
|
191
|
-
id: '$actionColumn',
|
|
192
|
-
header: () => ((0, jsx_runtime_1.jsx)(react_components_1.TableHeaderCell, { style: {
|
|
193
|
-
minWidth: 32,
|
|
194
|
-
flexShrink: 0,
|
|
195
|
-
// width: 32,
|
|
196
|
-
flex: 1,
|
|
197
|
-
position: 'sticky',
|
|
198
|
-
display: 'flex',
|
|
199
|
-
right: 0,
|
|
200
|
-
top: 0,
|
|
201
|
-
// zIndex: 1,
|
|
202
|
-
background: react_components_1.tokens.colorNeutralBackground3,
|
|
203
|
-
borderBottom: `${react_components_1.tokens.strokeWidthThin} solid ${react_components_1.tokens.colorNeutralStroke3}`,
|
|
204
|
-
}, children: "\u00A0" })),
|
|
205
|
-
cell: (info) => ((0, jsx_runtime_1.jsx)(ActionCell_1.ActionCell, { onOpen: () => {
|
|
206
|
-
const id = info.row.original[schema.idAttribute];
|
|
207
|
-
setSelectedIdsRef.current([id]);
|
|
208
|
-
}, mutableState: mutableContextCommandState })),
|
|
209
|
-
enableResizing: false,
|
|
210
|
-
size: 32,
|
|
211
|
-
minSize: 32,
|
|
212
|
-
maxSize: 32,
|
|
213
|
-
}),
|
|
214
|
-
]),
|
|
215
175
|
];
|
|
216
176
|
}, [
|
|
217
177
|
disableSelection,
|
|
218
|
-
|
|
219
|
-
disableContextMenu,
|
|
178
|
+
headingSelectionState,
|
|
220
179
|
schema.idAttribute,
|
|
221
|
-
schema.attributes,
|
|
222
|
-
schema.primaryAttribute,
|
|
223
|
-
schema.logicalName,
|
|
224
180
|
styles.selectionCell,
|
|
181
|
+
]);
|
|
182
|
+
const restColumns = (0, react_1.useMemo)(() => {
|
|
183
|
+
return gridColumns.map((column, index) => {
|
|
184
|
+
function onChangeSortDirection(direction) {
|
|
185
|
+
setSorting([
|
|
186
|
+
{
|
|
187
|
+
field: column.name,
|
|
188
|
+
order: direction,
|
|
189
|
+
},
|
|
190
|
+
]);
|
|
191
|
+
}
|
|
192
|
+
return columnHelper.accessor((info) => info[column.name], {
|
|
193
|
+
id: column.id,
|
|
194
|
+
header: (props) => {
|
|
195
|
+
return renderCellHeaderContent({
|
|
196
|
+
props,
|
|
197
|
+
column,
|
|
198
|
+
disableColumnResize,
|
|
199
|
+
disableColumnFilter,
|
|
200
|
+
disableColumnSort,
|
|
201
|
+
onChangeSortDirection,
|
|
202
|
+
attribute: schema.attributes[column.name],
|
|
203
|
+
});
|
|
204
|
+
},
|
|
205
|
+
cell: (info) => renderCellContent({
|
|
206
|
+
info,
|
|
207
|
+
column,
|
|
208
|
+
schema,
|
|
209
|
+
locale,
|
|
210
|
+
schemaStore,
|
|
211
|
+
routeResolver,
|
|
212
|
+
openRecord,
|
|
213
|
+
recordSetSetter,
|
|
214
|
+
router,
|
|
215
|
+
}),
|
|
216
|
+
enableResizing: true,
|
|
217
|
+
size: columnWidths[index],
|
|
218
|
+
minSize: 100,
|
|
219
|
+
maxSize: 1000,
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
}, [
|
|
223
|
+
gridColumns,
|
|
225
224
|
columnWidths,
|
|
226
225
|
disableColumnResize,
|
|
227
226
|
disableColumnFilter,
|
|
228
227
|
disableColumnSort,
|
|
228
|
+
schema,
|
|
229
229
|
setSorting,
|
|
230
|
-
|
|
231
|
-
dateFormats.short,
|
|
230
|
+
locale,
|
|
232
231
|
schemaStore,
|
|
233
232
|
routeResolver,
|
|
234
233
|
openRecord,
|
|
235
234
|
recordSetSetter,
|
|
236
235
|
router,
|
|
237
|
-
mutableContextCommandState,
|
|
238
236
|
]);
|
|
237
|
+
return (0, react_1.useMemo)(() => {
|
|
238
|
+
return [...selectionColumns, ...restColumns, ...actionColumns];
|
|
239
|
+
}, [selectionColumns, restColumns, actionColumns]);
|
|
240
|
+
}
|
|
241
|
+
function renderCellHeaderContent({ column, props, disableColumnResize, disableColumnFilter, disableColumnSort, onChangeSortDirection, attribute, }) {
|
|
242
|
+
return ((0, jsx_runtime_1.jsx)(GridColumnHeader_1.TableHeaderFilterCell, { columnName: column.name, sortDirection: props.column.getIsSorted() || undefined, minWidth: props.header.getSize(), column: column, resizable: !disableColumnResize, disableFilter: disableColumnFilter, disableSort: disableColumnSort, onChangeSortDirection: onChangeSortDirection, attribute: attribute, onResetSize: props.column.resetSize, resizeHandler: props.header.getResizeHandler(), children: column.label }, column.id));
|
|
243
|
+
}
|
|
244
|
+
function renderCellContent({ info, column, schema, schemaStore, locale, routeResolver, openRecord, recordSetSetter, router, }) {
|
|
245
|
+
const { currency, dateFormats, timezone, timeFormats } = locale;
|
|
246
|
+
let attribute;
|
|
247
|
+
let value;
|
|
248
|
+
if (column.expandedKey) {
|
|
249
|
+
const lookup = column.name;
|
|
250
|
+
const field = column.expandedKey;
|
|
251
|
+
const entity = schema.attributes[lookup].entity;
|
|
252
|
+
const lookupSchema = schemaStore.getSchema(entity);
|
|
253
|
+
attribute = lookupSchema.attributes[field];
|
|
254
|
+
value = info.row.original.$expand?.[lookup]?.[field];
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
attribute = schema.attributes[column.name];
|
|
258
|
+
value = info.getValue();
|
|
259
|
+
}
|
|
260
|
+
const formattedValue = (0, utils_1.getAttributeFormattedValue)(attribute, value, {
|
|
261
|
+
currency: currency.currency,
|
|
262
|
+
dateFormat: dateFormats.short,
|
|
263
|
+
timeFormat: timeFormats.short,
|
|
264
|
+
timezone,
|
|
265
|
+
currencyDisplay: currency.currencyDisplay,
|
|
266
|
+
currencySign: currency.currencySign,
|
|
267
|
+
locale: locale.locale,
|
|
268
|
+
region: locale.region,
|
|
269
|
+
}) ?? '';
|
|
270
|
+
if (column.plainText) {
|
|
271
|
+
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: formattedValue, width: info.column.getSize() }, column.id));
|
|
272
|
+
}
|
|
273
|
+
if (column.component) {
|
|
274
|
+
const Component = componentStore_1.componentStore.getComponent(column.component);
|
|
275
|
+
if (!Component) {
|
|
276
|
+
throw new Error(`Component with name ${column.component} not found`);
|
|
277
|
+
}
|
|
278
|
+
return ((0, jsx_runtime_1.jsx)(Component, { column: column, schema: schema, record: info.row.original, value: value, attribute: attribute, formattedValue: formattedValue, width: info.column.getSize() }));
|
|
279
|
+
}
|
|
280
|
+
if (schema.primaryAttribute === column.name) {
|
|
281
|
+
return renderPrimaryAttribute({
|
|
282
|
+
info,
|
|
283
|
+
column,
|
|
284
|
+
routeResolver,
|
|
285
|
+
openRecord,
|
|
286
|
+
schema,
|
|
287
|
+
value: value,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
switch (attribute?.type) {
|
|
291
|
+
case 'money':
|
|
292
|
+
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: formattedValue, width: info.column.getSize(), textAlignment: "right" }, column.id));
|
|
293
|
+
case 'lookup': {
|
|
294
|
+
return renderLookupAttribute({
|
|
295
|
+
info,
|
|
296
|
+
column,
|
|
297
|
+
schemaStore,
|
|
298
|
+
routeResolver,
|
|
299
|
+
recordSetSetter,
|
|
300
|
+
router,
|
|
301
|
+
value,
|
|
302
|
+
attribute,
|
|
303
|
+
formattedValue,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
case 'attachment': {
|
|
307
|
+
const url = value?.url;
|
|
308
|
+
if (!url) {
|
|
309
|
+
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: "", width: info.column.getSize() }, column.id));
|
|
310
|
+
}
|
|
311
|
+
return ((0, jsx_runtime_1.jsx)(TableCellLink_1.TableCellLink, { value: formattedValue, width: info.column.getSize(), href: url, target: "_blank" }, column.id));
|
|
312
|
+
}
|
|
313
|
+
case 'choice':
|
|
314
|
+
return ((0, jsx_runtime_1.jsx)(TableCellChoice_1.TableCellChoice, { column: column, schema: schema, record: info.row.original, value: value, attribute: attribute, formattedValue: formattedValue, width: info.column.getSize() }));
|
|
315
|
+
}
|
|
316
|
+
if (attribute.type === 'string' && attribute.format === 'phone') {
|
|
317
|
+
const parsedNumber = (0, phone_1.parsePhoneNumber)(value, locale.region);
|
|
318
|
+
if (parsedNumber.isValid && parsedNumber.uri) {
|
|
319
|
+
return ((0, jsx_runtime_1.jsx)(TableCellLink_1.TableCellLink, { value: formattedValue, width: info.column.getSize(), href: parsedNumber.uri }, column.id));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
if (attribute.type === 'string' &&
|
|
323
|
+
attribute.format === 'email' &&
|
|
324
|
+
value &&
|
|
325
|
+
typeof value === 'string') {
|
|
326
|
+
return ((0, jsx_runtime_1.jsx)(TableCellLink_1.TableCellLink, { value: formattedValue, width: info.column.getSize(), href: `mailto:${value}` }, column.id));
|
|
327
|
+
}
|
|
328
|
+
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: formattedValue, width: info.column.getSize() }, column.id));
|
|
329
|
+
}
|
|
330
|
+
function renderPrimaryAttribute({ info, column, schema, routeResolver, openRecord, value, }) {
|
|
331
|
+
const path = routeResolver({
|
|
332
|
+
logicalName: schema.logicalName,
|
|
333
|
+
type: app_1.PageType.EntityForm,
|
|
334
|
+
id: info.row.original[schema.idAttribute],
|
|
335
|
+
});
|
|
336
|
+
return ((0, jsx_runtime_1.jsx)(TableCellLink_1.TableCellLink, { value: (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [renderPrimaryAttributeAvatar({
|
|
337
|
+
info,
|
|
338
|
+
schema,
|
|
339
|
+
value,
|
|
340
|
+
}), value] }), width: info.column.getSize(), href: path, onClick: () => {
|
|
341
|
+
openRecord(info.row.original[schema.idAttribute]);
|
|
342
|
+
} }, column.id));
|
|
343
|
+
}
|
|
344
|
+
function renderPrimaryAttributeAvatar({ info, schema, value, }) {
|
|
345
|
+
if (!schema.avatarAttribute) {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
const avatarAttribute = schema.attributes[schema.avatarAttribute];
|
|
349
|
+
if (avatarAttribute.type !== 'attachment') {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
const avatarValue = info.row.original[schema.avatarAttribute];
|
|
353
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { style: {
|
|
354
|
+
width: 24,
|
|
355
|
+
height: 24,
|
|
356
|
+
fontSize: react_components_1.tokens.fontSizeBase100,
|
|
357
|
+
}, name: value, color: (0, avatar_1.getAvatarColor)(value), image: {
|
|
358
|
+
src: avatarValue?.url,
|
|
359
|
+
} }));
|
|
360
|
+
}
|
|
361
|
+
function renderLookupAttribute({ value, info, column, schemaStore, routeResolver, recordSetSetter, router, attribute, formattedValue, }) {
|
|
362
|
+
if (!value) {
|
|
363
|
+
return ((0, jsx_runtime_1.jsx)(TableCell_1.TableCellText, { value: "", width: info.column.getSize() }, column.id));
|
|
364
|
+
}
|
|
365
|
+
const lookupSchema = schemaStore.getSchema(attribute.entity);
|
|
366
|
+
const path = routeResolver({
|
|
367
|
+
logicalName: attribute.entity,
|
|
368
|
+
type: app_1.PageType.EntityForm,
|
|
369
|
+
id: value.id,
|
|
370
|
+
});
|
|
371
|
+
return ((0, jsx_runtime_1.jsx)(TableCellLink_1.TableCellLink, { value: (0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [!!lookupSchema.avatarAttribute && ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { style: {
|
|
372
|
+
width: 24,
|
|
373
|
+
height: 24,
|
|
374
|
+
fontSize: react_components_1.tokens.fontSizeBase100,
|
|
375
|
+
}, name: formattedValue, color: (0, avatar_1.getAvatarColor)(formattedValue), image: {
|
|
376
|
+
src: value.avatar,
|
|
377
|
+
} })), formattedValue] }), width: info.column.getSize(), href: path, onClick: () => {
|
|
378
|
+
recordSetSetter('', []);
|
|
379
|
+
router.push(path);
|
|
380
|
+
} }, column.id));
|
|
239
381
|
}
|
|
@@ -4,12 +4,9 @@ exports.AlertDialog = AlertDialog;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
function AlertDialog(props) {
|
|
7
|
-
var _a;
|
|
8
7
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: props.open, onOpenChange: () => {
|
|
9
|
-
|
|
10
|
-
(_a = props.onDismiss) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
8
|
+
props.onDismiss?.();
|
|
11
9
|
}, children: (0, jsx_runtime_1.jsx)(react_components_1.DialogSurface, { style: { maxWidth: 480 }, children: (0, jsx_runtime_1.jsxs)(react_components_1.DialogBody, { children: [!!props.title && (0, jsx_runtime_1.jsx)(react_components_1.DialogTitle, { children: props.title }), (0, jsx_runtime_1.jsx)(react_components_1.DialogContent, { children: props.message }), (0, jsx_runtime_1.jsx)(react_components_1.DialogActions, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "primary", onClick: () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}, children: (_a = props.confirmText) !== null && _a !== void 0 ? _a : 'Close' }) })] }) }) }));
|
|
10
|
+
props.onConfirm?.();
|
|
11
|
+
}, children: props.confirmText ?? 'Close' }) })] }) }) }));
|
|
15
12
|
}
|
|
@@ -4,15 +4,11 @@ exports.ConfirmDialog = ConfirmDialog;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
function ConfirmDialog(props) {
|
|
7
|
-
var _a, _b;
|
|
8
7
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: props.open, onOpenChange: () => {
|
|
9
|
-
|
|
10
|
-
(_a = props.onDismiss) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
8
|
+
props.onDismiss?.();
|
|
11
9
|
}, children: (0, jsx_runtime_1.jsx)(react_components_1.DialogSurface, { style: { maxWidth: 480 }, children: (0, jsx_runtime_1.jsxs)(react_components_1.DialogBody, { children: [!!props.title && (0, jsx_runtime_1.jsx)(react_components_1.DialogTitle, { children: props.title }), (0, jsx_runtime_1.jsx)(react_components_1.DialogContent, { children: props.message }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", onClick: () => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
(_a = props.onConfirm) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
17
|
-
}, children: (_b = props.confirmText) !== null && _b !== void 0 ? _b : 'Confirm' })] })] }) }) }));
|
|
10
|
+
props.onCancel?.();
|
|
11
|
+
}, children: props.cancelText ?? 'Cancel' }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "primary", onClick: () => {
|
|
12
|
+
props.onConfirm?.();
|
|
13
|
+
}, children: props.confirmText ?? 'Confirm' })] })] }) }) }));
|
|
18
14
|
}
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.DialogContainer = void 0;
|
|
15
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -21,7 +10,7 @@ const PromptDialog_1 = require("./PromptDialog");
|
|
|
21
10
|
const DialogContainer = () => {
|
|
22
11
|
const items = (0, hooks_1.useDialogItems)();
|
|
23
12
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: items.map((item) => {
|
|
24
|
-
const { id, isOpen
|
|
13
|
+
const { id, isOpen, ...options } = item;
|
|
25
14
|
switch (options.type) {
|
|
26
15
|
case 'alert':
|
|
27
16
|
return ((0, jsx_runtime_1.jsx)(AlertDialog_1.AlertDialog, { message: options.text, open: isOpen, confirmText: options.confirmButtonLabel, onConfirm: options.onConfirm, onDismiss: options.onDismiss, title: options.title }, id));
|
|
@@ -35,7 +24,7 @@ const DialogContainer = () => {
|
|
|
35
24
|
// confirmButtonLabel={options.confirmButtonLabel}
|
|
36
25
|
defaultValues: options.defaultValues, onCancel: options.onCancel, onDismiss: options.onDismiss, onConfirm: options.onConfirm, text: options.text, title: options.title, open: isOpen, cancelText: options.cancelButtonLabel, confirmText: options.confirmButtonLabel }, id));
|
|
37
26
|
case 'custom':
|
|
38
|
-
return ((0, jsx_runtime_1.jsx)(options.Component,
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(options.Component, { id: id, isOpen: isOpen, ...options.props }, id));
|
|
39
28
|
}
|
|
40
29
|
return null;
|
|
41
30
|
}) }));
|
|
@@ -5,10 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_components_1 = require("@fluentui/react-components");
|
|
6
6
|
const icons_1 = require("@headless-adminapp/icons");
|
|
7
7
|
function ErrorDialog(props) {
|
|
8
|
-
var _a;
|
|
9
8
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: props.open, onOpenChange: () => {
|
|
10
|
-
|
|
11
|
-
(_a = props.onDismiss) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
9
|
+
props.onDismiss?.();
|
|
12
10
|
}, children: (0, jsx_runtime_1.jsx)(react_components_1.DialogSurface, { style: { maxWidth: 480 }, children: (0, jsx_runtime_1.jsxs)(react_components_1.DialogBody, { children: [(0, jsx_runtime_1.jsxs)(react_components_1.DialogTitle, { style: { display: 'flex', alignItems: 'center' }, children: [(0, jsx_runtime_1.jsx)("span", { style: {
|
|
13
11
|
color: react_components_1.tokens.colorPaletteRedForeground1,
|
|
14
12
|
// marginBottom: tokens.spacingVerticalL,
|
|
@@ -16,7 +14,6 @@ function ErrorDialog(props) {
|
|
|
16
14
|
alignItems: 'center',
|
|
17
15
|
marginRight: react_components_1.tokens.spacingHorizontalS,
|
|
18
16
|
}, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Error, {}) }), props.title || 'Error'] }), (0, jsx_runtime_1.jsx)(react_components_1.DialogContent, { children: props.message }), (0, jsx_runtime_1.jsx)(react_components_1.DialogActions, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "primary", style: { background: react_components_1.tokens.colorPaletteRedBackground3 }, onClick: () => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, children: (_a = props.confirmText) !== null && _a !== void 0 ? _a : 'Close' }) })] }) }) }));
|
|
17
|
+
props.onConfirm?.();
|
|
18
|
+
}, children: props.confirmText ?? 'Close' }) })] }) }) }));
|
|
22
19
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FormValidationStringSet } from '@headless-adminapp/app/form';
|
|
1
2
|
import { PromptDialogOptions } from '@headless-adminapp/core/experience/dialog';
|
|
2
3
|
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
3
4
|
import * as yup from 'yup';
|
|
@@ -14,12 +15,22 @@ interface PromptDialogProps<SA extends SchemaAttributes = SchemaAttributes> {
|
|
|
14
15
|
onDismiss?: PromptDialogOptions<SA>['onDismiss'];
|
|
15
16
|
}
|
|
16
17
|
export declare function PromptDialog(props: PromptDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export declare const formValidator: (<A extends SchemaAttributes = SchemaAttributes>(attributes
|
|
18
|
+
export declare const formValidator: (<A extends SchemaAttributes = SchemaAttributes>({ attributes, language, strings, region, }: {
|
|
19
|
+
attributes: A;
|
|
20
|
+
language: string;
|
|
21
|
+
strings: FormValidationStringSet;
|
|
22
|
+
region: string;
|
|
23
|
+
}) => (values: Record<string, any>, context: any, options: any) => Promise<import("react-hook-form").ResolverResult<{
|
|
18
24
|
[x: string]: any;
|
|
19
25
|
[x: number]: any;
|
|
20
26
|
[x: symbol]: any;
|
|
21
27
|
}>>) & import("lodash").MemoizedFunction;
|
|
22
|
-
export declare const generateValidationSchema: (<A extends SchemaAttributes = SchemaAttributes>(attributes
|
|
28
|
+
export declare const generateValidationSchema: (<A extends SchemaAttributes = SchemaAttributes>({ attributes, language, strings, region, }: {
|
|
29
|
+
attributes: A;
|
|
30
|
+
language: string;
|
|
31
|
+
strings: FormValidationStringSet;
|
|
32
|
+
region: string;
|
|
33
|
+
}) => yup.ObjectSchema<{
|
|
23
34
|
[x: string]: any;
|
|
24
35
|
}, yup.AnyObject, {
|
|
25
36
|
[x: string]: any;
|