@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,7 +13,6 @@ const react_1 = require("react");
|
|
|
13
13
|
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
14
14
|
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
15
15
|
function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, }) {
|
|
16
|
-
var _a;
|
|
17
16
|
const schema = (0, hooks_1.useDataGridSchema)();
|
|
18
17
|
const { schemaStore } = (0, hooks_2.useMetadata)();
|
|
19
18
|
const { language } = (0, locale_1.useLocale)();
|
|
@@ -25,26 +24,29 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
|
|
|
25
24
|
attribute,
|
|
26
25
|
}))
|
|
27
26
|
.filter(({ attribute }) => attribute.type === 'lookup');
|
|
28
|
-
const columnGroups =
|
|
27
|
+
const columnGroups = {
|
|
28
|
+
root: {
|
|
29
29
|
label: (0, utils_1.localizedLabel)(language, schema),
|
|
30
30
|
columns: (0, datagrid_1.transformViewColumns)(schema.logicalName, Object.keys(schema.attributes).map((key) => ({
|
|
31
31
|
name: key,
|
|
32
32
|
})), schemaStore, language),
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
33
|
+
},
|
|
34
|
+
...lookupAttributes.reduce((acc, { key, attribute }) => {
|
|
35
|
+
const lookupSchema = schemaStore.getSchema(attribute.entity);
|
|
36
|
+
const columns = (0, datagrid_1.transformViewColumns)(schema.logicalName, Object.keys(lookupSchema.attributes).map((nestedKey) => ({
|
|
37
|
+
name: key,
|
|
38
|
+
expandedKey: nestedKey,
|
|
39
|
+
})), schemaStore, language);
|
|
40
|
+
acc[key] = {
|
|
41
|
+
label: (0, utils_1.localizedLabel)(language, attribute) +
|
|
42
|
+
' (' +
|
|
43
|
+
(0, utils_1.localizedLabel)(language, lookupSchema) +
|
|
44
|
+
')',
|
|
45
|
+
columns,
|
|
46
|
+
};
|
|
47
|
+
return acc;
|
|
48
|
+
}, {}),
|
|
49
|
+
};
|
|
48
50
|
const tableItems = Object.entries(columnGroups).map(([key, group]) => ({
|
|
49
51
|
key,
|
|
50
52
|
label: group.label,
|
|
@@ -64,28 +66,24 @@ function AddColumns({ onColumnAdd, onColumnRemove, columns, opened, onClose, })
|
|
|
64
66
|
gap: 8,
|
|
65
67
|
marginBottom: react_components_1.tokens.spacingVerticalXS,
|
|
66
68
|
paddingInline: react_components_1.tokens.spacingHorizontalS,
|
|
67
|
-
|
|
68
|
-
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value) }), (0, jsx_runtime_1.jsx)(react_components_1.Dropdown, { value: (_a = selectedGroupItem === null || selectedGroupItem === void 0 ? void 0 : selectedGroupItem.label) !== null && _a !== void 0 ? _a : '', selectedOptions: selectedGroupItem ? [String(selectedGroupItem.key)] : [], onOptionSelect: (event, data) => {
|
|
69
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value) }), (0, jsx_runtime_1.jsx)(react_components_1.Dropdown, { value: selectedGroupItem?.label ?? '', selectedOptions: selectedGroupItem ? [String(selectedGroupItem.key)] : [], onOptionSelect: (event, data) => {
|
|
69
70
|
setSelectedGroup(data.optionValue);
|
|
70
71
|
}, style: { flex: 1, minWidth: 'unset' }, positioning: {
|
|
71
72
|
align: 'bottom',
|
|
72
73
|
position: 'below',
|
|
73
|
-
}, children: tableItems.map((x) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.key, children: x.label }, x.key))) })] }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, {})] }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { paddingInline: 0 }, children: filteredColumns.map((column) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
}, children: column.label }, column.id));
|
|
88
|
-
}) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
74
|
+
}, children: tableItems.map((x) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.key, children: x.label }, x.key))) })] }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, {})] }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { paddingInline: 0 }, children: filteredColumns.map((column) => ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", icon: (0, jsx_runtime_1.jsx)(react_components_1.Checkbox, { checked: includedColumnsObj[column.id] ?? false }), style: {
|
|
75
|
+
fontWeight: react_components_1.tokens.fontSizeBase400,
|
|
76
|
+
width: '100%',
|
|
77
|
+
justifyContent: 'flex-start',
|
|
78
|
+
paddingInline: react_components_1.tokens.spacingHorizontalS,
|
|
79
|
+
}, onClick: () => {
|
|
80
|
+
if (includedColumnsObj[column.id]) {
|
|
81
|
+
onColumnRemove(column);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
onColumnAdd(column);
|
|
85
|
+
}
|
|
86
|
+
}, children: column.label }, column.id))) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
89
87
|
display: 'flex',
|
|
90
88
|
padding: 8,
|
|
91
89
|
gap: 8,
|
|
@@ -5,14 +5,15 @@ 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
|
const react_1 = require("react");
|
|
8
|
-
const
|
|
8
|
+
const DndProvider_1 = require("../../components/DndProvider");
|
|
9
9
|
exports.ItemTypes = {
|
|
10
10
|
CARD: 'column',
|
|
11
11
|
};
|
|
12
12
|
const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSet = {}, // defaultCustomizeColumnStrings,
|
|
13
13
|
}) => {
|
|
14
|
+
const { useDrag, useDrop } = (0, DndProvider_1.useDndContext)();
|
|
14
15
|
const ref = (0, react_1.useRef)(null);
|
|
15
|
-
const [{ handlerId }, drop] =
|
|
16
|
+
const [{ handlerId }, drop] = useDrop({
|
|
16
17
|
accept: exports.ItemTypes.CARD,
|
|
17
18
|
collect(monitor) {
|
|
18
19
|
return {
|
|
@@ -20,7 +21,6 @@ const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSe
|
|
|
20
21
|
};
|
|
21
22
|
},
|
|
22
23
|
hover(item, monitor) {
|
|
23
|
-
var _a;
|
|
24
24
|
if (!ref.current) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
@@ -31,7 +31,7 @@ const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSe
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
// Determine rectangle on screen
|
|
34
|
-
const hoverBoundingRect =
|
|
34
|
+
const hoverBoundingRect = ref.current?.getBoundingClientRect();
|
|
35
35
|
// Get vertical middle
|
|
36
36
|
const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
|
37
37
|
// Determine mouse position
|
|
@@ -58,7 +58,7 @@ const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSe
|
|
|
58
58
|
item.index = hoverIndex;
|
|
59
59
|
},
|
|
60
60
|
});
|
|
61
|
-
const [{ isDragging }, drag] =
|
|
61
|
+
const [{ isDragging }, drag] = useDrag({
|
|
62
62
|
type: exports.ItemTypes.CARD,
|
|
63
63
|
item: () => {
|
|
64
64
|
return { id: item.id, index };
|
|
@@ -71,12 +71,14 @@ const ColumnItem = ({ item, index, moveItem, isFirst, isLast, onRemove, stringSe
|
|
|
71
71
|
drag(drop(ref));
|
|
72
72
|
return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: {
|
|
73
73
|
background: react_components_1.tokens.colorNeutralBackground4,
|
|
74
|
-
|
|
74
|
+
paddingBlock: react_components_1.tokens.spacingVerticalXS,
|
|
75
|
+
paddingLeft: react_components_1.tokens.spacingHorizontalS,
|
|
75
76
|
cursor: 'move',
|
|
76
77
|
opacity,
|
|
77
78
|
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
78
79
|
display: 'flex',
|
|
79
80
|
flexDirection: 'row',
|
|
81
|
+
alignItems: 'center',
|
|
80
82
|
}, "data-handler-id": handlerId, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { flex: 1 }, children: item.label }), (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "below-start", children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.MoreVertical, {}), appearance: "transparent", size: "small" }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsxs)(react_components_1.MenuList, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Delete, {}), onClick: onRemove, children: stringSet.remove }), !isFirst && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), onClick: () => {
|
|
81
83
|
moveItem(index, index - 1);
|
|
82
84
|
}, children: stringSet.moveUp })), !isLast && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), onClick: () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface CustomizeColumnsProps {
|
|
2
|
-
opened: boolean;
|
|
3
|
-
onClose: () => void;
|
|
2
|
+
readonly opened: boolean;
|
|
3
|
+
readonly onClose: () => void;
|
|
4
4
|
}
|
|
5
5
|
export declare function CustomizeColumns({ onClose, opened }: CustomizeColumnsProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -12,8 +12,7 @@ const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
|
12
12
|
const icons_1 = require("@headless-adminapp/icons");
|
|
13
13
|
const immutability_helper_1 = __importDefault(require("immutability-helper"));
|
|
14
14
|
const react_1 = require("react");
|
|
15
|
-
const
|
|
16
|
-
const react_dnd_html5_backend_1 = require("react-dnd-html5-backend");
|
|
15
|
+
const DndProvider_1 = require("../../components/DndProvider");
|
|
17
16
|
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
18
17
|
const AddColumns_1 = require("./AddColumns");
|
|
19
18
|
const ColumnItem_1 = require("./ColumnItem");
|
|
@@ -55,16 +54,14 @@ function CustomizeColumns({ onClose, opened }) {
|
|
|
55
54
|
minWidth: 'unset',
|
|
56
55
|
}, onClick: () => setShowAddColumns(true), children: strings.add }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Edit, {}), style: { fontWeight: react_components_1.tokens.fontSizeBase400, minWidth: 'unset' }, disabled: !isDirty, onClick: () => {
|
|
57
56
|
setItems(columns);
|
|
58
|
-
}, children: strings.reset })] }), (0, jsx_runtime_1.jsx)(AddColumns_1.AddColumns, { onColumnAdd: onColumnAdd, onColumnRemove: onColumnRemove, columns: items, opened: showAddColumns, onClose: () => setShowAddColumns(false) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, {})] }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { paddingInline: react_components_1.tokens.spacingHorizontalS }, children: (0, jsx_runtime_1.jsx)(
|
|
57
|
+
}, children: strings.reset })] }), (0, jsx_runtime_1.jsx)(AddColumns_1.AddColumns, { onColumnAdd: onColumnAdd, onColumnRemove: onColumnRemove, columns: items, opened: showAddColumns, onClose: () => setShowAddColumns(false) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, {})] }), (0, jsx_runtime_1.jsx)(react_components_1.DrawerBody, { style: { paddingInline: react_components_1.tokens.spacingHorizontalS }, children: (0, jsx_runtime_1.jsx)(DndProvider_1.DndProvider, { children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
59
58
|
display: 'flex',
|
|
60
59
|
flexDirection: 'column',
|
|
61
60
|
width: '100%',
|
|
62
61
|
gap: react_components_1.tokens.spacingVerticalS,
|
|
63
62
|
// padding: tokens.spacingHorizontalS,
|
|
64
63
|
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
65
|
-
}, children: items.map((item, index) => ((0, jsx_runtime_1.jsx)(ColumnItem_1.ColumnItem, { index: index, item: item, moveItem: moveItem, isFirst: index === 0, isLast: index === items.length - 1, onRemove: () => {
|
|
66
|
-
setItems((prev) => prev.filter((_, i) => i !== index));
|
|
67
|
-
}, stringSet: strings }, item.id))) }) }) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
64
|
+
}, children: items.map((item, index) => ((0, jsx_runtime_1.jsx)(ColumnItem_1.ColumnItem, { index: index, item: item, moveItem: moveItem, isFirst: index === 0, isLast: index === items.length - 1, onRemove: () => onColumnRemove(item), stringSet: strings }, item.id))) }) }) }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
68
65
|
display: 'flex',
|
|
69
66
|
padding: 8,
|
|
70
67
|
gap: 8,
|
|
@@ -9,7 +9,6 @@ const locale_1 = require("@headless-adminapp/app/locale");
|
|
|
9
9
|
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
10
10
|
const icons_1 = require("@headless-adminapp/icons");
|
|
11
11
|
const FormSubgridViewSelector = () => {
|
|
12
|
-
var _a, _b;
|
|
13
12
|
const viewLookup = (0, hooks_1.useGridViewLookupData)();
|
|
14
13
|
const selectedView = (0, hooks_1.useSelectedView)();
|
|
15
14
|
const changeView = (0, hooks_1.useChangeView)();
|
|
@@ -33,9 +32,6 @@ const FormSubgridViewSelector = () => {
|
|
|
33
32
|
paddingInline: 8,
|
|
34
33
|
paddingBlock: 4,
|
|
35
34
|
pointerEvents: allowViewSelection ? 'auto' : 'none',
|
|
36
|
-
}, children:
|
|
37
|
-
var _a, _b;
|
|
38
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), children: (_b = (_a = view.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : view.name }, view.id));
|
|
39
|
-
}) }) })] }) }) }));
|
|
35
|
+
}, children: selectedView.localizedNames?.[language] ?? selectedView.name }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), children: view.localizedNames?.[language] ?? view.name }, view.id))) }) })] }) }) }));
|
|
40
36
|
};
|
|
41
37
|
exports.FormSubgridViewSelector = FormSubgridViewSelector;
|
|
@@ -9,28 +9,27 @@ const hooks_1 = require("@headless-adminapp/app/metadata/hooks");
|
|
|
9
9
|
const transport_1 = require("@headless-adminapp/app/transport");
|
|
10
10
|
const FormControl_1 = __importDefault(require("../../form/FormControl"));
|
|
11
11
|
function ConditionValueControl({ attribute, type, value, onChange, }) {
|
|
12
|
-
var _a, _b, _c, _d;
|
|
13
12
|
const dataService = (0, transport_1.useDataService)();
|
|
14
13
|
const { schemaStore, experienceStore } = (0, hooks_1.useMetadata)();
|
|
15
14
|
switch (type) {
|
|
16
15
|
case 'string':
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "text", value: value
|
|
18
|
-
onChange
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "text", value: value ?? null, onChange: (value) => {
|
|
17
|
+
onChange?.(value);
|
|
19
18
|
} }));
|
|
20
19
|
case 'number':
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "number", value: value
|
|
22
|
-
onChange
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "number", value: value ?? null, onChange: (value) => {
|
|
21
|
+
onChange?.(value);
|
|
23
22
|
} }));
|
|
24
23
|
case 'money':
|
|
25
|
-
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "currency", value: value
|
|
26
|
-
onChange
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "currency", value: value ?? null, onChange: (value) => {
|
|
25
|
+
onChange?.(value);
|
|
27
26
|
} }));
|
|
28
27
|
case 'lookup':
|
|
29
28
|
if (attribute.type !== 'lookup') {
|
|
30
29
|
return null;
|
|
31
30
|
}
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "lookups", async: true, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, value: value
|
|
33
|
-
onChange
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "lookups", async: true, dataService: dataService, schema: schemaStore.getSchema(attribute.entity), experienceStore: experienceStore, value: value ?? null, onChange: (value) => {
|
|
32
|
+
onChange?.(value ?? []);
|
|
34
33
|
} }));
|
|
35
34
|
// return (
|
|
36
35
|
// <FormControl
|
|
@@ -46,8 +45,8 @@ function ConditionValueControl({ attribute, type, value, onChange, }) {
|
|
|
46
45
|
// />
|
|
47
46
|
// );
|
|
48
47
|
case 'date':
|
|
49
|
-
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "date", value: value
|
|
50
|
-
onChange
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "date", value: value ?? null, onChange: (value) => {
|
|
49
|
+
onChange?.(value);
|
|
51
50
|
} }));
|
|
52
51
|
case 'boolean':
|
|
53
52
|
if (attribute.type !== 'boolean') {
|
|
@@ -55,16 +54,15 @@ function ConditionValueControl({ attribute, type, value, onChange, }) {
|
|
|
55
54
|
}
|
|
56
55
|
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "multi-select", options: [
|
|
57
56
|
{
|
|
58
|
-
label:
|
|
57
|
+
label: attribute.trueLabel ?? 'Yes',
|
|
59
58
|
value: 'true',
|
|
60
59
|
},
|
|
61
60
|
{
|
|
62
|
-
label:
|
|
61
|
+
label: attribute.falseLabel ?? 'No',
|
|
63
62
|
value: 'false',
|
|
64
63
|
},
|
|
65
|
-
], value:
|
|
66
|
-
|
|
67
|
-
onChange === null || onChange === void 0 ? void 0 : onChange((_a = value === null || value === void 0 ? void 0 : value.map((x) => x === 'true')) !== null && _a !== void 0 ? _a : []);
|
|
64
|
+
], value: value?.map((x) => (x === true ? 'true' : 'false')) ?? [], onChange: (value) => {
|
|
65
|
+
onChange?.(value?.map((x) => x === 'true') ?? []);
|
|
68
66
|
} }));
|
|
69
67
|
case 'choice':
|
|
70
68
|
case 'choices':
|
|
@@ -73,15 +71,11 @@ function ConditionValueControl({ attribute, type, value, onChange, }) {
|
|
|
73
71
|
}
|
|
74
72
|
const isNumeric = 'number' in attribute && attribute.number === true;
|
|
75
73
|
// const isString = 'string' in attribute && attribute.string === true;
|
|
76
|
-
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "multi-select", options: attribute.options.map((x) => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
}), value: (_d = value === null || value === void 0 ? void 0 : value.map((x) => (isNumeric ? x.toString() : x))) !== null && _d !== void 0 ? _d : [], onChange: (value) => {
|
|
83
|
-
var _a;
|
|
84
|
-
onChange === null || onChange === void 0 ? void 0 : onChange((_a = value === null || value === void 0 ? void 0 : value.map((x) => (isNumeric ? +x : x))) !== null && _a !== void 0 ? _a : []);
|
|
74
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "multi-select", options: attribute.options.map((x) => ({
|
|
75
|
+
label: x.label,
|
|
76
|
+
value: isNumeric ? x.value?.toString() : x.value,
|
|
77
|
+
})), value: value?.map((x) => (isNumeric ? x.toString() : x)) ?? [], onChange: (value) => {
|
|
78
|
+
onChange?.(value?.map((x) => (isNumeric ? +x : x)) ?? []);
|
|
85
79
|
} }));
|
|
86
80
|
default:
|
|
87
81
|
return null;
|
|
@@ -11,7 +11,7 @@ const ConditionValueControl_1 = require("./ConditionValueControl");
|
|
|
11
11
|
const OperatorSelect_1 = require("./OperatorSelect");
|
|
12
12
|
const utils_1 = require("./utils");
|
|
13
13
|
const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
|
|
14
|
-
const [operator, setOperator] = (0, react_1.useState)((0, utils_1.getDefaultOperator)(defaultValue
|
|
14
|
+
const [operator, setOperator] = (0, react_1.useState)((0, utils_1.getDefaultOperator)(defaultValue?.operator, attribute.type));
|
|
15
15
|
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
16
16
|
const { operatorStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
17
17
|
const operatorOptions = (0, react_1.useMemo)(() => {
|
|
@@ -20,7 +20,7 @@ const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
|
|
|
20
20
|
const selectedOption = (0, react_1.useMemo)(() => {
|
|
21
21
|
return operatorOptions[attribute.type].find((option) => option.value === operator);
|
|
22
22
|
}, [operator, attribute.type, operatorOptions]);
|
|
23
|
-
const [values, setValues] = (0, react_1.useState)((0, utils_1.getDefaultValues)(selectedOption, defaultValue
|
|
23
|
+
const [values, setValues] = (0, react_1.useState)((0, utils_1.getDefaultValues)(selectedOption, defaultValue?.value, attribute.type));
|
|
24
24
|
const handleChangeOperator = (operator) => {
|
|
25
25
|
setOperator(operator);
|
|
26
26
|
setValues([]);
|
|
@@ -34,19 +34,18 @@ const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
|
|
|
34
34
|
};
|
|
35
35
|
const isValid = (0, react_1.useMemo)(() => {
|
|
36
36
|
return (!!selectedOption &&
|
|
37
|
-
values.filter(
|
|
37
|
+
values.filter((value) => {
|
|
38
|
+
return value !== null && value !== undefined;
|
|
39
|
+
}).length === selectedOption.controls.length);
|
|
38
40
|
}, [selectedOption, values]);
|
|
39
41
|
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogContent, { style: { paddingBlock: 8 }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
40
42
|
display: 'flex',
|
|
41
43
|
flexDirection: 'column',
|
|
42
44
|
gap: react_components_1.tokens.spacingVerticalS,
|
|
43
|
-
}, children: [(0, jsx_runtime_1.jsx)(OperatorSelect_1.OperatorSelect, { attribute: attribute, onChange: (value) => handleChangeOperator(value), value: operator }), selectedOption
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} }, i));
|
|
48
|
-
})] }) }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", onClick: onCancel, children: strings.cancel }) }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { type: "submit", appearance: "primary", disabled: !isValid, onClick: () => {
|
|
49
|
-
onApply === null || onApply === void 0 ? void 0 : onApply({
|
|
45
|
+
}, children: [(0, jsx_runtime_1.jsx)(OperatorSelect_1.OperatorSelect, { attribute: attribute, onChange: (value) => handleChangeOperator(value), value: operator }), selectedOption?.controls.map((x, i) => ((0, jsx_runtime_1.jsx)(ConditionValueControl_1.ConditionValueControl, { type: x, attribute: attribute, value: values[i] ?? null, onChange: (value) => {
|
|
46
|
+
handleChangeValue(value, i);
|
|
47
|
+
} }, x + String(i))))] }) }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogTrigger, { disableButtonEnhancement: true, children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", onClick: onCancel, children: strings.cancel }) }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { type: "submit", appearance: "primary", disabled: !isValid, onClick: () => {
|
|
48
|
+
onApply?.({
|
|
50
49
|
operator,
|
|
51
50
|
value: values,
|
|
52
51
|
});
|
|
@@ -6,16 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.OperatorSelect = OperatorSelect;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const column_filter_1 = require("@headless-adminapp/app/datagrid/column-filter");
|
|
9
|
+
const transport_1 = require("@headless-adminapp/app/transport");
|
|
9
10
|
const react_1 = require("react");
|
|
10
11
|
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
11
12
|
const SelectControl_1 = __importDefault(require("../../form/controls/SelectControl"));
|
|
12
13
|
function OperatorSelect({ attribute, value, onChange, }) {
|
|
13
14
|
const { operatorStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
15
|
+
const dataService = (0, transport_1.useDataService)();
|
|
14
16
|
const operatorOptions = (0, react_1.useMemo)(() => {
|
|
15
17
|
return (0, column_filter_1.getLocalizedOperatorOptions)(operatorStrings);
|
|
16
18
|
}, [operatorStrings]);
|
|
17
19
|
const options = (0, react_1.useMemo)(() => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const supportedOperators = dataService.supportedOperators;
|
|
21
|
+
let operators = operatorOptions[attribute.type];
|
|
22
|
+
if (supportedOperators) {
|
|
23
|
+
operators = operators.filter((option) => supportedOperators[attribute.type].includes(option.value));
|
|
24
|
+
}
|
|
25
|
+
return operators;
|
|
26
|
+
}, [attribute.type, operatorOptions, dataService]);
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(SelectControl_1.default, { options: options, onChange: (value) => onChange?.(value), value: value }));
|
|
21
28
|
}
|
|
@@ -77,6 +77,7 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
77
77
|
const align = (0, react_1.useMemo)(() => {
|
|
78
78
|
switch (attribute.type) {
|
|
79
79
|
case 'money':
|
|
80
|
+
case 'number':
|
|
80
81
|
return 'right';
|
|
81
82
|
default:
|
|
82
83
|
return 'left';
|
|
@@ -89,9 +90,9 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
89
90
|
const onChangeFilterCondition = (condition) => {
|
|
90
91
|
setColumnFilters(column.id, condition);
|
|
91
92
|
};
|
|
92
|
-
const sortMenuItems = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowUp, { size: 16 }), onClick: () => onChangeSortDirection
|
|
93
|
+
const sortMenuItems = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowUp, { size: 16 }), onClick: () => onChangeSortDirection?.('asc'), children: strings.sortByAscending }), (0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ArrowDown, { size: 16 }), onClick: () => onChangeSortDirection?.('desc'), children: strings.sortByDescending })] }));
|
|
93
94
|
const filterMenuItems = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, { size: 16 }), onClick: () => setVisible(!visible), children: strings.filter }), !!filterCondition && ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.FilterDismiss, { size: 16 }), onClick: () => {
|
|
94
|
-
onChangeFilterCondition
|
|
95
|
+
onChangeFilterCondition(undefined);
|
|
95
96
|
}, children: strings.clearFilter }))] }));
|
|
96
97
|
const menuItems = [];
|
|
97
98
|
if (!disableSort) {
|
|
@@ -100,13 +101,14 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
100
101
|
if (!disableFilter) {
|
|
101
102
|
menuItems.push(filterMenuItems);
|
|
102
103
|
}
|
|
103
|
-
const headerCell = ((0, jsx_runtime_1.jsxs)(react_components_1.TableHeaderCell, { className: (0, react_components_1.mergeClasses)(styles.root, align === 'right' && styles.right), style: {
|
|
104
|
+
const headerCell = ((0, jsx_runtime_1.jsxs)(react_components_1.TableHeaderCell, { as: "div", className: (0, react_components_1.mergeClasses)(styles.root, align === 'right' && styles.right), style: {
|
|
104
105
|
textAlign: align,
|
|
105
106
|
width: minWidth,
|
|
106
107
|
minWidth: minWidth,
|
|
107
108
|
maxWidth: minWidth,
|
|
108
109
|
display: 'flex',
|
|
109
110
|
alignItems: 'center',
|
|
111
|
+
fontWeight: react_components_1.tokens.fontWeightMedium,
|
|
110
112
|
// pointerEvents: disableFilter && disableSort ? 'none' : 'auto',
|
|
111
113
|
}, onClick: (event) => {
|
|
112
114
|
event.preventDefault();
|
|
@@ -116,18 +118,18 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
116
118
|
}, onDoubleClick: (event) => {
|
|
117
119
|
event.stopPropagation();
|
|
118
120
|
event.preventDefault();
|
|
119
|
-
onResetSize
|
|
121
|
+
onResetSize?.();
|
|
120
122
|
}, onMouseDown: (event) => {
|
|
121
123
|
event.stopPropagation();
|
|
122
124
|
event.preventDefault();
|
|
123
|
-
resizeHandler
|
|
125
|
+
resizeHandler?.(event);
|
|
124
126
|
}, onMouseUp: (event) => {
|
|
125
127
|
event.stopPropagation();
|
|
126
128
|
event.preventDefault();
|
|
127
129
|
}, onTouchStart: (event) => {
|
|
128
130
|
event.stopPropagation();
|
|
129
131
|
event.preventDefault();
|
|
130
|
-
resizeHandler
|
|
132
|
+
resizeHandler?.(event);
|
|
131
133
|
}, children: (0, jsx_runtime_1.jsx)("div", { className: (0, react_components_1.mergeClasses)(styles.resizeHandleInner) }) })) : null, onMouseUp: (event) => {
|
|
132
134
|
event.preventDefault();
|
|
133
135
|
if (isResizingRef.current) {
|
|
@@ -136,17 +138,24 @@ column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) =>
|
|
|
136
138
|
isResizingRef.current = false;
|
|
137
139
|
}, sortable: !disableSort,
|
|
138
140
|
// sortDirection="ascending"
|
|
139
|
-
sortDirection: sortDirection
|
|
140
|
-
? 'ascending'
|
|
141
|
-
: sortDirection === 'desc'
|
|
142
|
-
? 'descending'
|
|
143
|
-
: undefined, children: [children, !!filterCondition && ((0, jsx_runtime_1.jsx)("div", { style: { marginTop: 2, color: react_components_1.tokens.colorNeutralForeground1 }, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, { size: 16 }) }))] }));
|
|
141
|
+
sortDirection: getSortDirection(sortDirection), children: [children, !!filterCondition && ((0, jsx_runtime_1.jsx)("div", { style: { marginTop: 2, color: react_components_1.tokens.colorNeutralForeground1 }, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, { size: 16 }) }))] }));
|
|
144
142
|
if (disableFilter && disableSort) {
|
|
145
143
|
return headerCell;
|
|
146
144
|
}
|
|
147
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
148
|
-
onChangeFilterCondition
|
|
145
|
+
return ((0, jsx_runtime_1.jsxs)("th", { children: [(0, jsx_runtime_1.jsxs)(react_components_1.Menu, { positioning: "below-start", children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: headerCell }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: menuItems.map((x, i) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [i > 0 && (0, jsx_runtime_1.jsx)(react_components_1.MenuDivider, {}), x] }, i))) }) })] }), (0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: visible, onOpenChange: () => setVisible(false), children: (0, jsx_runtime_1.jsx)(react_components_1.DialogSurface, { style: { maxWidth: 400 }, children: (0, jsx_runtime_1.jsxs)(react_components_1.DialogBody, { children: [(0, jsx_runtime_1.jsx)(react_components_1.DialogTitle, { children: strings.filterBy }), (0, jsx_runtime_1.jsx)(FilterForm_1.FilterForm, { attribute: attribute, defaultValue: filterCondition, onApply: (condition) => {
|
|
146
|
+
onChangeFilterCondition(condition);
|
|
149
147
|
setVisible(false);
|
|
150
148
|
}, onCancel: () => setVisible(false) })] }) }) })] }));
|
|
151
149
|
};
|
|
152
150
|
exports.TableHeaderFilterCell = TableHeaderFilterCell;
|
|
151
|
+
const getSortDirection = (direction) => {
|
|
152
|
+
if (direction === 'asc') {
|
|
153
|
+
return 'ascending';
|
|
154
|
+
}
|
|
155
|
+
else if (direction === 'desc') {
|
|
156
|
+
return 'descending';
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
@@ -3,13 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getDefaultOperator = getDefaultOperator;
|
|
4
4
|
exports.getDefaultValues = getDefaultValues;
|
|
5
5
|
function getDefaultOperator(operator, attributeType) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
if (operator) {
|
|
7
|
+
return operator;
|
|
8
|
+
}
|
|
9
|
+
if (attributeType === 'date') {
|
|
10
|
+
return 'on';
|
|
11
|
+
}
|
|
12
|
+
if (attributeType === 'choice' || attributeType === 'lookup') {
|
|
13
|
+
return 'in';
|
|
14
|
+
}
|
|
15
|
+
return 'eq';
|
|
13
16
|
}
|
|
14
17
|
function getDefaultValues(operator, value, _attributeType) {
|
|
15
18
|
if (!value)
|
|
@@ -11,7 +11,6 @@ const AppStringContext_1 = require("../App/AppStringContext");
|
|
|
11
11
|
const PageEntityViewStringContext_1 = require("../PageEntityView/PageEntityViewStringContext");
|
|
12
12
|
const CustomizeColumns_1 = require("./CustomizeColumns");
|
|
13
13
|
const GridHeaderDesktop = (props) => {
|
|
14
|
-
var _a, _b;
|
|
15
14
|
const viewLookup = (0, hooks_1.useGridViewLookupData)();
|
|
16
15
|
const selectedView = (0, hooks_1.useSelectedView)();
|
|
17
16
|
const changeView = (0, hooks_1.useChangeView)();
|
|
@@ -31,9 +30,9 @@ const GridHeaderDesktop = (props) => {
|
|
|
31
30
|
gap: 16,
|
|
32
31
|
justifyContent: 'space-between',
|
|
33
32
|
display: 'flex',
|
|
34
|
-
}, children: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronDown, {}), iconPosition: "after",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}) }) })] }) }), (0, jsx_runtime_1.jsxs)("div", { style: { alignItems: 'center', display: 'flex', gap: 16 }, children: [props.headingRight, (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.EditColumns, { size: 24 }), onClick: () => setIsColumnCustomizationOpen(true), children: strings.editColumns }), (0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value) })] })] }));
|
|
33
|
+
}, children: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronDown, {}), iconPosition: "after", style: {
|
|
34
|
+
fontSize: react_components_1.tokens.fontSizeBase400,
|
|
35
|
+
fontWeight: react_components_1.tokens.fontWeightMedium,
|
|
36
|
+
}, children: selectedView.localizedNames?.[language] ?? selectedView.name }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), children: view.localizedNames?.[language] ?? view.name }, view.id))) }) })] }) }), (0, jsx_runtime_1.jsxs)("div", { style: { alignItems: 'center', display: 'flex', gap: 16 }, children: [props.headingRight, (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.EditColumns, { size: 24 }), onClick: () => setIsColumnCustomizationOpen(true), children: strings.editColumns }), (0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value), appearance: "filled-darker" })] })] }));
|
|
38
37
|
};
|
|
39
38
|
exports.GridHeaderDesktop = GridHeaderDesktop;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridHeaderMobile = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
7
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
8
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
9
|
+
const AppStringContext_1 = require("../App/AppStringContext");
|
|
10
|
+
const GridHeaderMobile = () => {
|
|
11
|
+
const viewLookup = (0, hooks_1.useGridViewLookupData)();
|
|
12
|
+
const selectedView = (0, hooks_1.useSelectedView)();
|
|
13
|
+
const changeView = (0, hooks_1.useChangeView)();
|
|
14
|
+
const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
|
|
15
|
+
const { language } = (0, locale_1.useLocale)();
|
|
16
|
+
const appStrings = (0, AppStringContext_1.useAppStrings)();
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
paddingInline: 8,
|
|
20
|
+
gap: 8,
|
|
21
|
+
display: 'flex',
|
|
22
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { alignItems: 'center', display: 'flex', gap: 16, flex: 1 }, children: (0, jsx_runtime_1.jsx)(react_components_1.Input, { contentBefore: (0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 16 }), placeholder: appStrings.searchPlaceholder, value: searchText, onChange: (e) => setSearchText(e.target.value), style: { flex: 1 } }) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
gap: 16,
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
}, children: (0, jsx_runtime_1.jsxs)(react_components_1.Menu, { hasIcons: true, children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, {}), iconPosition: "after" }) }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: viewLookup.map((view) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => changeView(view.id), icon: selectedView.id === view.id ? ((0, jsx_runtime_1.jsx)(icons_1.Icons.Checkmark, {})) : undefined, children: view.localizedNames?.[language] ?? view.name }, view.id))) }) })] }) })] }));
|
|
28
|
+
};
|
|
29
|
+
exports.GridHeaderMobile = GridHeaderMobile;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface GridListContainerProps {
|
|
3
|
+
disableSelection?: boolean;
|
|
4
|
+
disableContextMenu?: boolean;
|
|
5
|
+
disableColumnResize?: boolean;
|
|
6
|
+
disableColumnSort?: boolean;
|
|
7
|
+
disableColumnReorder?: boolean;
|
|
8
|
+
disableColumnFilter?: boolean;
|
|
9
|
+
noPadding?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const GridListContainer: FC<GridListContainerProps>;
|
|
12
|
+
export {};
|