@headless-adminapp/fluent 0.0.17-alpha.53 → 0.0.17-alpha.56
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.js +11 -7
- package/App/AppHeaderContianer.js +50 -44
- package/App/AppLogo.js +12 -9
- package/App/AppStringContext.js +13 -9
- package/App/AppUI.js +15 -11
- package/App/LayoutProvider.js +16 -24
- package/App/NavigationContainer.js +28 -28
- package/App/QuickActionItem.js +10 -6
- package/App/index.js +5 -1
- package/App/utils.js +7 -5
- package/CommandBar/Button.js +17 -14
- package/CommandBar/Divider.js +9 -6
- package/CommandBar/IconButton.js +16 -13
- package/CommandBar/Label.js +11 -8
- package/CommandBar/MenuButton.js +20 -17
- package/CommandBar/MenuItem.js +19 -16
- package/CommandBar/MenuItems.js +10 -10
- package/CommandBar/MenuList.js +12 -9
- package/CommandBar/Wrapper.js +10 -7
- package/CommandBar/index.js +15 -13
- package/DataForm/SectionControl.js +7 -4
- package/DataGrid/ActionCell.js +14 -11
- package/DataGrid/CommandContainer.js +10 -6
- package/DataGrid/CustomizeColumns/AddColumns.js +61 -59
- package/DataGrid/CustomizeColumns/ColumnItem.js +23 -19
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +41 -36
- package/DataGrid/CustomizeColumns/index.js +5 -1
- package/DataGrid/FormSubgridCommandContainer.js +17 -13
- package/DataGrid/FormSubgridViewSelector.js +21 -21
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +33 -33
- package/DataGrid/GridColumnHeader/FilterForm.js +28 -27
- package/DataGrid/GridColumnHeader/OperatorSelect.js +19 -13
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +35 -31
- package/DataGrid/GridColumnHeader/index.js +5 -1
- package/DataGrid/GridColumnHeader/utils.js +6 -2
- package/DataGrid/GridHeaderContainer.js +8 -4
- package/DataGrid/GridHeaderDesktop.js +28 -28
- package/DataGrid/GridHeaderMobile.js +20 -19
- package/DataGrid/GridListContainer.js +50 -44
- package/DataGrid/GridPaginationContainer.js +16 -13
- package/DataGrid/GridTableContainer.js +98 -89
- package/DataGrid/TableCell/TableCellAction.js +15 -11
- package/DataGrid/TableCell/TableCellBase.js +13 -4
- package/DataGrid/TableCell/TableCellCheckbox.js +11 -8
- package/DataGrid/TableCell/TableCellChoice.js +15 -13
- package/DataGrid/TableCell/TableCellLink.js +14 -11
- package/DataGrid/TableCell/TableCellText.js +10 -7
- package/DataGrid/TableCell/index.js +20 -4
- package/DataGrid/index.js +11 -4
- package/DataGrid/types.js +2 -1
- package/DataGrid/useTableColumns.js +98 -103
- package/DataGrid/utils.js +5 -1
- package/DialogContainer/AlertDialog.js +11 -11
- package/DialogContainer/ConfirmDialog.js +13 -14
- package/DialogContainer/DialogContainer.js +19 -26
- package/DialogContainer/ErrorDialog.js +15 -15
- package/DialogContainer/PromptDialog.js +76 -58
- package/DialogContainer/index.js +5 -1
- package/Insights/CommandBarContainer.js +17 -11
- package/Insights/FilterBarContainer.js +32 -37
- package/Insights/Grid.js +13 -9
- package/Insights/InsightsContainer.js +22 -19
- package/Insights/WidgetChartContainer.js +34 -30
- package/Insights/WidgetDataGridContainer.js +45 -33
- package/Insights/WidgetTableContainer.js +29 -26
- package/Insights/WidgetTileContainer.js +16 -12
- package/Insights/WidgetTitleBar.js +15 -10
- package/Insights/Widgets.js +28 -25
- package/Insights/charts/AreaChart.js +15 -12
- package/Insights/charts/BarChart.js +15 -12
- package/Insights/charts/ComposedChart.js +15 -13
- package/Insights/charts/CustomTooltipContent.js +13 -9
- package/Insights/charts/GaugeChart.js +6 -3
- package/Insights/charts/LineChart.js +15 -12
- package/Insights/charts/OhlcChart.js +46 -40
- package/Insights/charts/PieChart.js +25 -26
- package/Insights/charts/RadarChart.js +19 -17
- package/Insights/charts/ScatterChart.js +26 -28
- package/Insights/charts/constants.js +4 -1
- package/Insights/charts/formatters.js +33 -23
- package/Insights/charts/index.js +2 -1
- package/Insights/charts/renderers.js +36 -26
- package/Insights/hooks/useQueriesData.js +27 -30
- package/Insights/hooks/useWidgetDetail.js +24 -15
- package/OverflowCommandBar/OverflowCommandBar.js +19 -12
- package/OverflowCommandBar/OverflowMenu.js +22 -30
- package/OverflowCommandBar/OverflowMenuDivider.js +10 -6
- package/OverflowCommandBar/index.js +9 -3
- package/OverflowCommandBar/render.js +15 -10
- package/OverflowCommandBar/utils.js +6 -4
- package/PageBoard/BoardColumn.js +8 -5
- package/PageBoard/BoardColumnCard.d.ts +1 -1
- package/PageBoard/BoardColumnCard.js +15 -11
- package/PageBoard/BoardColumnUI.js +45 -46
- package/PageBoard/BoardingColumnCardLoading.js +13 -10
- package/PageBoard/Header.js +23 -28
- package/PageBoard/PageBoard.js +28 -26
- package/PageBoard/index.js +5 -1
- package/PageEntityForm/CommandContainer.js +25 -21
- package/PageEntityForm/FormTabRelated.js +20 -17
- package/PageEntityForm/PageEntityForm.js +20 -16
- package/PageEntityForm/PageEntityFormDesktopContainer.js +77 -70
- package/PageEntityForm/PageEntityFormStringContext.js +9 -5
- package/PageEntityForm/ProcessFlow.js +24 -21
- package/PageEntityForm/RecordCard.js +31 -24
- package/PageEntityForm/RecordCardLoading.js +13 -11
- package/PageEntityForm/RecordSetNavigatorContainer.js +34 -31
- package/PageEntityForm/RelatedViewSelector.js +34 -36
- package/PageEntityForm/SectionContainer.js +35 -31
- package/PageEntityForm/StandardControl.js +84 -76
- package/PageEntityForm/SubgridControl.js +23 -21
- package/PageEntityForm/index.js +5 -1
- package/PageEntityView/FormSubgridContainer.js +26 -22
- package/PageEntityView/PageEntityView.js +19 -15
- package/PageEntityView/PageEntityViewDesktopContainer.js +13 -9
- package/PageEntityView/PageEntityViewDesktopFrame.js +21 -17
- package/PageEntityView/PageEntityViewMobileContainer.js +13 -9
- package/PageEntityView/PageEntityViewStringContext.js +9 -5
- package/PageEntityView/index.js +5 -1
- package/PageInsights/PageInsights.js +13 -9
- package/PageInsights/index.js +6 -1
- package/ProgressIndicatorContainer/index.js +14 -10
- package/ToastNotificationContainer/index.js +18 -15
- package/componentStore.js +5 -2
- package/components/BodyLoading.js +11 -7
- package/components/DialogLogin.js +8 -5
- package/components/DndProvider.d.ts +12 -0
- package/components/DndProvider.js +68 -0
- package/components/LoginForm.js +46 -36
- package/components/PageBroken.js +8 -5
- package/components/PageLoading.js +8 -5
- package/components/PageLogin.js +17 -14
- package/form/FormControl.js +44 -50
- package/form/FormControlLoading.js +8 -4
- package/form/controls/AttachmentControl.js +72 -77
- package/form/controls/AttachmentsControl.js +24 -30
- package/form/controls/CurrencyControl.js +16 -13
- package/form/controls/DateControl.js +24 -18
- package/form/controls/DateRangeControl.js +22 -18
- package/form/controls/DateTimeControl.js +49 -43
- package/form/controls/DecimalControl.js +14 -11
- package/form/controls/DurationControl.js +18 -14
- package/form/controls/EmailControl.js +14 -11
- package/form/controls/IntegerControl.js +11 -8
- package/form/controls/LookupControl.js +58 -56
- package/form/controls/MultiSelectControl.js +12 -9
- package/form/controls/MultiSelectLookupControl.js +55 -53
- package/form/controls/PasswordControl.js +11 -8
- package/form/controls/RichTextControl.js +32 -5
- package/form/controls/SelectControl.js +15 -13
- package/form/controls/SwitchControl.js +7 -4
- package/form/controls/TelephoneControl.js +10 -7
- package/form/controls/TextAreaControl.js +11 -8
- package/form/controls/TextControl.js +12 -9
- package/form/controls/UrlControl.js +10 -7
- package/form/controls/types.js +2 -1
- package/form/controls/useLookupData.js +43 -54
- package/form/layout/FormBody/FormBody.js +10 -6
- package/form/layout/FormBody/index.js +17 -1
- package/form/layout/FormSection/FormSection.js +31 -20
- package/form/layout/FormSection/FormSectionColumn.js +7 -3
- package/form/layout/FormSection/FormSectionLoading.js +5 -1
- package/form/layout/FormSection/index.js +5 -1
- package/form/layout/FormTab/FormTab.js +21 -17
- package/form/layout/FormTab/FormTabColumn.js +9 -5
- package/form/layout/FormTab/index.js +5 -1
- package/form/layout/TabContext.js +5 -2
- package/form/layout/index.js +9 -3
- package/form/types.js +2 -1
- package/package.json +4 -12
- package/types/index.js +2 -1
- package/utils/avatar.js +4 -1
- package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
- package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
- package/form/controls/NumberControl.d.ts +0 -4
- package/form/controls/NumberControl.js +0 -16
- package/form/controls/utils.d.ts +0 -4
- package/form/controls/utils.js +0 -42
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CustomizeColumns = CustomizeColumns;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
9
|
+
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
10
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
11
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
12
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
13
|
+
const immutability_helper_1 = __importDefault(require("immutability-helper"));
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
const DndProvider_1 = require("../../components/DndProvider");
|
|
16
|
+
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
17
|
+
const AddColumns_1 = require("./AddColumns");
|
|
18
|
+
const ColumnItem_1 = require("./ColumnItem");
|
|
19
|
+
function CustomizeColumns({ onClose, opened }) {
|
|
20
|
+
const columns = (0, hooks_1.useGridColumns)();
|
|
21
|
+
const setContextValue = (0, mutable_1.useContextSetValue)(datagrid_1.GridContext);
|
|
22
|
+
const [showAddColumns, setShowAddColumns] = (0, react_1.useState)(false);
|
|
23
|
+
const [items, setItems] = (0, react_1.useState)(columns);
|
|
24
|
+
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
25
|
+
const isDirty = (0, react_1.useMemo)(() => {
|
|
21
26
|
return JSON.stringify(items) !== JSON.stringify(columns);
|
|
22
27
|
}, [columns, items]);
|
|
23
|
-
const moveItem = useCallback((dragIndex, hoverIndex) => {
|
|
24
|
-
setItems((prevCards) =>
|
|
28
|
+
const moveItem = (0, react_1.useCallback)((dragIndex, hoverIndex) => {
|
|
29
|
+
setItems((prevCards) => (0, immutability_helper_1.default)(prevCards, {
|
|
25
30
|
$splice: [
|
|
26
31
|
[dragIndex, 1],
|
|
27
32
|
[hoverIndex, 0, prevCards[dragIndex]],
|
|
28
33
|
],
|
|
29
34
|
}));
|
|
30
35
|
}, []);
|
|
31
|
-
const onColumnAdd = useCallback((column) => {
|
|
36
|
+
const onColumnAdd = (0, react_1.useCallback)((column) => {
|
|
32
37
|
setItems((prev) => {
|
|
33
38
|
if (prev.some((x) => x.id === column.id)) {
|
|
34
39
|
return prev;
|
|
@@ -36,37 +41,37 @@ export function CustomizeColumns({ onClose, opened }) {
|
|
|
36
41
|
return [...prev, column];
|
|
37
42
|
});
|
|
38
43
|
}, []);
|
|
39
|
-
const onColumnRemove = useCallback((column) => {
|
|
44
|
+
const onColumnRemove = (0, react_1.useCallback)((column) => {
|
|
40
45
|
setItems((prev) => prev.filter((x) => x.id !== column.id));
|
|
41
46
|
}, []);
|
|
42
|
-
return (
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Drawer, { separator: true, open: opened, position: "end", size: "small", children: [(0, jsx_runtime_1.jsx)(react_components_1.DrawerHeader, { children: (0, jsx_runtime_1.jsx)(react_components_1.DrawerHeaderTitle, { action: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", "aria-label": "Close", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Close, {}), onClick: onClose }), children: strings.editColumns }) }), (0, jsx_runtime_1.jsxs)("div", { style: { width: '100%', display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
43
48
|
display: 'flex',
|
|
44
49
|
gap: 8,
|
|
45
|
-
marginBottom: tokens.spacingVerticalXS,
|
|
46
|
-
paddingInline: tokens.spacingHorizontalS,
|
|
47
|
-
}, children: [
|
|
48
|
-
fontWeight: tokens.fontSizeBase400,
|
|
50
|
+
marginBottom: react_components_1.tokens.spacingVerticalXS,
|
|
51
|
+
paddingInline: react_components_1.tokens.spacingHorizontalS,
|
|
52
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), style: {
|
|
53
|
+
fontWeight: react_components_1.tokens.fontSizeBase400,
|
|
49
54
|
minWidth: 'unset',
|
|
50
|
-
}, onClick: () => setShowAddColumns(true), children: strings.add }),
|
|
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: () => {
|
|
51
56
|
setItems(columns);
|
|
52
|
-
}, children: strings.reset })] }),
|
|
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: {
|
|
53
58
|
display: 'flex',
|
|
54
59
|
flexDirection: 'column',
|
|
55
60
|
width: '100%',
|
|
56
|
-
gap: tokens.spacingVerticalS,
|
|
61
|
+
gap: react_components_1.tokens.spacingVerticalS,
|
|
57
62
|
// padding: tokens.spacingHorizontalS,
|
|
58
|
-
paddingBlock: tokens.spacingVerticalS,
|
|
59
|
-
}, children: items.map((item, index) => (
|
|
63
|
+
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
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: {
|
|
60
65
|
display: 'flex',
|
|
61
66
|
padding: 8,
|
|
62
67
|
gap: 8,
|
|
63
68
|
justifyContent: 'flex-end',
|
|
64
|
-
}, children: [
|
|
69
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: () => {
|
|
65
70
|
setContextValue({
|
|
66
71
|
columns: items,
|
|
67
72
|
});
|
|
68
73
|
onClose();
|
|
69
|
-
}, appearance: "primary", children: strings.apply }),
|
|
74
|
+
}, appearance: "primary", children: strings.apply }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: () => {
|
|
70
75
|
onClose();
|
|
71
76
|
}, children: strings.cancel })] })] })] }));
|
|
72
77
|
}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomizeColumns = void 0;
|
|
4
|
+
var CustomizeColumns_1 = require("./CustomizeColumns");
|
|
5
|
+
Object.defineProperty(exports, "CustomizeColumns", { enumerable: true, get: function () { return CustomizeColumns_1.CustomizeColumns; } });
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormSubgridCommandContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
7
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
8
|
+
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
9
|
+
const FormSubgridCommandContainer = () => {
|
|
10
|
+
const isSubgrid = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.isSubGrid);
|
|
8
11
|
if (isSubgrid) {
|
|
9
|
-
return
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(InternalSubGridCommandContainer, {});
|
|
10
13
|
}
|
|
11
|
-
return
|
|
14
|
+
return (0, jsx_runtime_1.jsx)(InternalMainGridCommandContainer, {});
|
|
12
15
|
};
|
|
16
|
+
exports.FormSubgridCommandContainer = FormSubgridCommandContainer;
|
|
13
17
|
const InternalMainGridCommandContainer = () => {
|
|
14
|
-
const gridCommands = useMainGridCommands();
|
|
15
|
-
return
|
|
18
|
+
const gridCommands = (0, hooks_1.useMainGridCommands)();
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(OverflowCommandBar_1.OverflowCommandBar, { commands: gridCommands });
|
|
16
20
|
};
|
|
17
21
|
const InternalSubGridCommandContainer = () => {
|
|
18
|
-
const gridCommands = useSubGridCommands();
|
|
19
|
-
return
|
|
22
|
+
const gridCommands = (0, hooks_1.useSubGridCommands)();
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(OverflowCommandBar_1.OverflowCommandBar, { commands: gridCommands });
|
|
20
24
|
};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormSubgridViewSelector = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const datagrid_1 = require("@headless-adminapp/app/datagrid");
|
|
7
|
+
const hooks_1 = require("@headless-adminapp/app/datagrid/hooks");
|
|
8
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
9
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
10
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
11
|
+
const FormSubgridViewSelector = () => {
|
|
12
|
+
const viewLookup = (0, hooks_1.useGridViewLookupData)();
|
|
13
|
+
const selectedView = (0, hooks_1.useSelectedView)();
|
|
14
|
+
const changeView = (0, hooks_1.useChangeView)();
|
|
15
|
+
const { language } = (0, locale_1.useLocale)();
|
|
16
|
+
const allowViewSelection = (0, mutable_1.useContextSelector)(datagrid_1.GridContext, (state) => state.allowViewSelection);
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
16
18
|
alignItems: 'center',
|
|
17
19
|
paddingBlock: 4,
|
|
18
20
|
paddingInline: 4,
|
|
@@ -20,18 +22,16 @@ export const FormSubgridViewSelector = () => {
|
|
|
20
22
|
width: '100%',
|
|
21
23
|
display: 'flex',
|
|
22
24
|
height: 40,
|
|
23
|
-
}, children:
|
|
25
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
24
26
|
flex: 1,
|
|
25
27
|
alignItems: 'center',
|
|
26
28
|
gap: 16,
|
|
27
29
|
justifyContent: 'space-between',
|
|
28
30
|
display: 'flex',
|
|
29
|
-
}, children:
|
|
31
|
+
}, 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: allowViewSelection ? (0, jsx_runtime_1.jsx)(icons_1.Icons.ChevronDown, {}) : null, iconPosition: "after", style: {
|
|
30
32
|
paddingInline: 8,
|
|
31
33
|
paddingBlock: 4,
|
|
32
34
|
pointerEvents: allowViewSelection ? 'auto' : 'none',
|
|
33
|
-
}, children:
|
|
34
|
-
var _a, _b;
|
|
35
|
-
return (_jsx(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));
|
|
36
|
-
}) }) })] }) }) }));
|
|
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))) }) })] }) }) }));
|
|
37
36
|
};
|
|
37
|
+
exports.FormSubgridViewSelector = FormSubgridViewSelector;
|
|
@@ -1,30 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ConditionValueControl = ConditionValueControl;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const hooks_1 = require("@headless-adminapp/app/metadata/hooks");
|
|
9
|
+
const transport_1 = require("@headless-adminapp/app/transport");
|
|
10
|
+
const FormControl_1 = __importDefault(require("../../form/FormControl"));
|
|
11
|
+
function ConditionValueControl({ attribute, type, value, onChange, }) {
|
|
12
|
+
const dataService = (0, transport_1.useDataService)();
|
|
13
|
+
const { schemaStore, experienceStore } = (0, hooks_1.useMetadata)();
|
|
9
14
|
switch (type) {
|
|
10
15
|
case 'string':
|
|
11
|
-
return (
|
|
12
|
-
onChange
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "text", value: value ?? null, onChange: (value) => {
|
|
17
|
+
onChange?.(value);
|
|
13
18
|
} }));
|
|
14
19
|
case 'number':
|
|
15
|
-
return (
|
|
16
|
-
onChange
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "number", value: value ?? null, onChange: (value) => {
|
|
21
|
+
onChange?.(value);
|
|
17
22
|
} }));
|
|
18
23
|
case 'money':
|
|
19
|
-
return (
|
|
20
|
-
onChange
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "currency", value: value ?? null, onChange: (value) => {
|
|
25
|
+
onChange?.(value);
|
|
21
26
|
} }));
|
|
22
27
|
case 'lookup':
|
|
23
28
|
if (attribute.type !== 'lookup') {
|
|
24
29
|
return null;
|
|
25
30
|
}
|
|
26
|
-
return (
|
|
27
|
-
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 ?? []);
|
|
28
33
|
} }));
|
|
29
34
|
// return (
|
|
30
35
|
// <FormControl
|
|
@@ -40,25 +45,24 @@ export function ConditionValueControl({ attribute, type, value, onChange, }) {
|
|
|
40
45
|
// />
|
|
41
46
|
// );
|
|
42
47
|
case 'date':
|
|
43
|
-
return (
|
|
44
|
-
onChange
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "date", value: value ?? null, onChange: (value) => {
|
|
49
|
+
onChange?.(value);
|
|
45
50
|
} }));
|
|
46
51
|
case 'boolean':
|
|
47
52
|
if (attribute.type !== 'boolean') {
|
|
48
53
|
return null;
|
|
49
54
|
}
|
|
50
|
-
return (
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "multi-select", options: [
|
|
51
56
|
{
|
|
52
|
-
label:
|
|
57
|
+
label: attribute.trueLabel ?? 'Yes',
|
|
53
58
|
value: 'true',
|
|
54
59
|
},
|
|
55
60
|
{
|
|
56
|
-
label:
|
|
61
|
+
label: attribute.falseLabel ?? 'No',
|
|
57
62
|
value: 'false',
|
|
58
63
|
},
|
|
59
|
-
], value:
|
|
60
|
-
|
|
61
|
-
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') ?? []);
|
|
62
66
|
} }));
|
|
63
67
|
case 'choice':
|
|
64
68
|
case 'choices':
|
|
@@ -67,15 +71,11 @@ export function ConditionValueControl({ attribute, type, value, onChange, }) {
|
|
|
67
71
|
}
|
|
68
72
|
const isNumeric = 'number' in attribute && attribute.number === true;
|
|
69
73
|
// const isString = 'string' in attribute && attribute.string === true;
|
|
70
|
-
return (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
76
|
-
}), value: (_d = value === null || value === void 0 ? void 0 : value.map((x) => (isNumeric ? x.toString() : x))) !== null && _d !== void 0 ? _d : [], onChange: (value) => {
|
|
77
|
-
var _a;
|
|
78
|
-
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)) ?? []);
|
|
79
79
|
} }));
|
|
80
80
|
default:
|
|
81
81
|
return null;
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterForm = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const column_filter_1 = require("@headless-adminapp/app/datagrid/column-filter");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
9
|
+
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
10
|
+
const ConditionValueControl_1 = require("./ConditionValueControl");
|
|
11
|
+
const OperatorSelect_1 = require("./OperatorSelect");
|
|
12
|
+
const utils_1 = require("./utils");
|
|
13
|
+
const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
|
|
14
|
+
const [operator, setOperator] = (0, react_1.useState)((0, utils_1.getDefaultOperator)(defaultValue?.operator, attribute.type));
|
|
15
|
+
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
16
|
+
const { operatorStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
17
|
+
const operatorOptions = (0, react_1.useMemo)(() => {
|
|
18
|
+
return (0, column_filter_1.getLocalizedOperatorOptions)(operatorStrings);
|
|
16
19
|
}, [operatorStrings]);
|
|
17
|
-
const selectedOption = useMemo(() => {
|
|
20
|
+
const selectedOption = (0, react_1.useMemo)(() => {
|
|
18
21
|
return operatorOptions[attribute.type].find((option) => option.value === operator);
|
|
19
22
|
}, [operator, attribute.type, operatorOptions]);
|
|
20
|
-
const [values, setValues] = useState(getDefaultValues(selectedOption, defaultValue
|
|
23
|
+
const [values, setValues] = (0, react_1.useState)((0, utils_1.getDefaultValues)(selectedOption, defaultValue?.value, attribute.type));
|
|
21
24
|
const handleChangeOperator = (operator) => {
|
|
22
25
|
setOperator(operator);
|
|
23
26
|
setValues([]);
|
|
@@ -29,25 +32,23 @@ export const FilterForm = ({ defaultValue, attribute, onApply, onCancel, }) => {
|
|
|
29
32
|
return next;
|
|
30
33
|
});
|
|
31
34
|
};
|
|
32
|
-
const isValid = useMemo(() => {
|
|
35
|
+
const isValid = (0, react_1.useMemo)(() => {
|
|
33
36
|
return (!!selectedOption &&
|
|
34
37
|
values.filter((value) => {
|
|
35
38
|
return value !== null && value !== undefined;
|
|
36
39
|
}).length === selectedOption.controls.length);
|
|
37
40
|
}, [selectedOption, values]);
|
|
38
|
-
return (
|
|
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: {
|
|
39
42
|
display: 'flex',
|
|
40
43
|
flexDirection: 'column',
|
|
41
|
-
gap: tokens.spacingVerticalS,
|
|
42
|
-
}, children: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} }, x + String(i)));
|
|
47
|
-
})] }) }), _jsxs(DialogActions, { children: [_jsx(DialogTrigger, { disableButtonEnhancement: true, children: _jsx(Button, { appearance: "secondary", onClick: onCancel, children: strings.cancel }) }), _jsx(Button, { type: "submit", appearance: "primary", disabled: !isValid, onClick: () => {
|
|
48
|
-
onApply === null || onApply === void 0 ? void 0 : onApply({
|
|
44
|
+
gap: react_components_1.tokens.spacingVerticalS,
|
|
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?.({
|
|
49
49
|
operator,
|
|
50
50
|
value: values,
|
|
51
51
|
});
|
|
52
52
|
}, children: strings.apply })] })] }));
|
|
53
53
|
};
|
|
54
|
+
exports.FilterForm = FilterForm;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.OperatorSelect = OperatorSelect;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const column_filter_1 = require("@headless-adminapp/app/datagrid/column-filter");
|
|
9
|
+
const transport_1 = require("@headless-adminapp/app/transport");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
12
|
+
const SelectControl_1 = __importDefault(require("../../form/controls/SelectControl"));
|
|
13
|
+
function OperatorSelect({ attribute, value, onChange, }) {
|
|
14
|
+
const { operatorStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
15
|
+
const dataService = (0, transport_1.useDataService)();
|
|
16
|
+
const operatorOptions = (0, react_1.useMemo)(() => {
|
|
17
|
+
return (0, column_filter_1.getLocalizedOperatorOptions)(operatorStrings);
|
|
12
18
|
}, [operatorStrings]);
|
|
13
|
-
const options = useMemo(() => {
|
|
19
|
+
const options = (0, react_1.useMemo)(() => {
|
|
14
20
|
const supportedOperators = dataService.supportedOperators;
|
|
15
21
|
let operators = operatorOptions[attribute.type];
|
|
16
22
|
if (supportedOperators) {
|
|
@@ -18,5 +24,5 @@ export function OperatorSelect({ attribute, value, onChange, }) {
|
|
|
18
24
|
}
|
|
19
25
|
return operators;
|
|
20
26
|
}, [attribute.type, operatorOptions, dataService]);
|
|
21
|
-
return (
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(SelectControl_1.default, { options: options, onChange: (value) => onChange?.(value), value: value }));
|
|
22
28
|
}
|