@headless-adminapp/fluent 0.0.17-alpha.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 +6 -0
- package/App/App.js +12 -0
- package/App/AppHeaderContianer.d.ts +2 -0
- package/App/AppHeaderContianer.js +67 -0
- package/App/AppLogo.d.ts +8 -0
- package/App/AppLogo.js +17 -0
- package/App/AppProvider.d.ts +9 -0
- package/App/AppProvider.js +50 -0
- package/App/AppStringContext.d.ts +16 -0
- package/App/AppStringContext.js +23 -0
- package/App/AppUI.d.ts +2 -0
- package/App/AppUI.js +16 -0
- package/App/NavigationContainer.d.ts +1 -0
- package/App/NavigationContainer.js +63 -0
- package/App/QuickActionItem.d.ts +10 -0
- package/App/QuickActionItem.js +32 -0
- package/App/index.d.ts +1 -0
- package/App/index.js +5 -0
- package/App/utils.d.ts +14 -0
- package/App/utils.js +27 -0
- package/CommandBar/Button.d.ts +11 -0
- package/CommandBar/Button.js +36 -0
- package/CommandBar/Divider.d.ts +2 -0
- package/CommandBar/Divider.js +10 -0
- package/CommandBar/IconButton.d.ts +9 -0
- package/CommandBar/IconButton.js +32 -0
- package/CommandBar/Label.d.ts +7 -0
- package/CommandBar/Label.js +23 -0
- package/CommandBar/MenuButton.d.ts +13 -0
- package/CommandBar/MenuButton.js +43 -0
- package/CommandBar/MenuItem.d.ts +11 -0
- package/CommandBar/MenuItem.js +37 -0
- package/CommandBar/MenuItems.d.ts +6 -0
- package/CommandBar/MenuItems.js +11 -0
- package/CommandBar/MenuList.d.ts +6 -0
- package/CommandBar/MenuList.js +13 -0
- package/CommandBar/Wrapper.d.ts +8 -0
- package/CommandBar/Wrapper.js +24 -0
- package/CommandBar/index.d.ts +9 -0
- package/CommandBar/index.js +17 -0
- package/CommandBar/types.d.ts +0 -0
- package/CommandBar/types.js +1 -0
- package/DataForm/SectionControl.d.ts +10 -0
- package/DataForm/SectionControl.js +8 -0
- package/DataGrid/ActionCell.d.ts +8 -0
- package/DataGrid/ActionCell.js +11 -0
- package/DataGrid/CommandContainer.d.ts +2 -0
- package/DataGrid/CommandContainer.js +11 -0
- package/DataGrid/CustomizeColumns/AddColumns.d.ts +10 -0
- package/DataGrid/CustomizeColumns/AddColumns.js +94 -0
- package/DataGrid/CustomizeColumns/ColumnItem.d.ts +16 -0
- package/DataGrid/CustomizeColumns/ColumnItem.js +86 -0
- package/DataGrid/CustomizeColumns/CustomizeColumns.d.ts +6 -0
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +80 -0
- package/DataGrid/CustomizeColumns/index.d.ts +1 -0
- package/DataGrid/CustomizeColumns/index.js +5 -0
- package/DataGrid/FormSubgridCommandContainer.d.ts +2 -0
- package/DataGrid/FormSubgridCommandContainer.js +24 -0
- package/DataGrid/FormSubgridViewSelector.d.ts +2 -0
- package/DataGrid/FormSubgridViewSelector.js +41 -0
- package/DataGrid/GridColumnHeader/ConditionValueControl.d.ts +9 -0
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +89 -0
- package/DataGrid/GridColumnHeader/FilterForm.d.ts +11 -0
- package/DataGrid/GridColumnHeader/FilterForm.js +55 -0
- package/DataGrid/GridColumnHeader/OperatorSelect.d.ts +9 -0
- package/DataGrid/GridColumnHeader/OperatorSelect.js +21 -0
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.d.ts +22 -0
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +152 -0
- package/DataGrid/GridColumnHeader/index.d.ts +1 -0
- package/DataGrid/GridColumnHeader/index.js +5 -0
- package/DataGrid/GridColumnHeader/utils.d.ts +5 -0
- package/DataGrid/GridColumnHeader/utils.js +18 -0
- package/DataGrid/GridHeaderContainer.d.ts +2 -0
- package/DataGrid/GridHeaderContainer.js +9 -0
- package/DataGrid/GridHeaderDesktop.d.ts +6 -0
- package/DataGrid/GridHeaderDesktop.js +40 -0
- package/DataGrid/GridPaginationContainer.d.ts +2 -0
- package/DataGrid/GridPaginationContainer.js +20 -0
- package/DataGrid/GridTableContainer.d.ts +12 -0
- package/DataGrid/GridTableContainer.js +248 -0
- package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +9 -0
- package/DataGrid/ScrollbarWithMoreDataRequest.js +33 -0
- package/DataGrid/TableCell/TableCellAction.d.ts +8 -0
- package/DataGrid/TableCell/TableCellAction.js +41 -0
- package/DataGrid/TableCell/TableCellBase.d.ts +7 -0
- package/DataGrid/TableCell/TableCellBase.js +9 -0
- package/DataGrid/TableCell/TableCellCheckbox.d.ts +6 -0
- package/DataGrid/TableCell/TableCellCheckbox.js +14 -0
- package/DataGrid/TableCell/TableCellLink.d.ts +8 -0
- package/DataGrid/TableCell/TableCellLink.js +33 -0
- package/DataGrid/TableCell/TableCellText.d.ts +7 -0
- package/DataGrid/TableCell/TableCellText.js +24 -0
- package/DataGrid/TableCell/index.d.ts +4 -0
- package/DataGrid/TableCell/index.js +20 -0
- package/DataGrid/getAttributeFormattedValue.d.ts +16 -0
- package/DataGrid/getAttributeFormattedValue.js +92 -0
- package/DataGrid/index.d.ts +4 -0
- package/DataGrid/index.js +11 -0
- package/DataGrid/useTableColumns.d.ts +10 -0
- package/DataGrid/useTableColumns.js +251 -0
- package/DataGrid/utils.d.ts +2 -0
- package/DataGrid/utils.js +15 -0
- package/DialogContainer/AlertDialog.d.ts +10 -0
- package/DialogContainer/AlertDialog.js +15 -0
- package/DialogContainer/ConfirmDialog.d.ts +12 -0
- package/DialogContainer/ConfirmDialog.js +18 -0
- package/DialogContainer/DialogContainer.d.ts +1 -0
- package/DialogContainer/DialogContainer.js +43 -0
- package/DialogContainer/ErrorDialog.d.ts +10 -0
- package/DialogContainer/ErrorDialog.js +22 -0
- package/DialogContainer/PromptDialog.d.ts +27 -0
- package/DialogContainer/PromptDialog.js +99 -0
- package/DialogContainer/index.d.ts +1 -0
- package/DialogContainer/index.js +5 -0
- package/LICENSE +21 -0
- package/OverflowCommandBar/OverflowCommandBar.d.ts +10 -0
- package/OverflowCommandBar/OverflowCommandBar.js +32 -0
- package/OverflowCommandBar/OverflowMenu.d.ts +4 -0
- package/OverflowCommandBar/OverflowMenu.js +45 -0
- package/OverflowCommandBar/OverflowMenuDivider.d.ts +4 -0
- package/OverflowCommandBar/OverflowMenuDivider.js +14 -0
- package/OverflowCommandBar/index.d.ts +3 -0
- package/OverflowCommandBar/index.js +9 -0
- package/OverflowCommandBar/render.d.ts +2 -0
- package/OverflowCommandBar/render.js +26 -0
- package/OverflowCommandBar/utils.d.ts +4 -0
- package/OverflowCommandBar/utils.js +17 -0
- package/PageEntityForm/CommandContainer.d.ts +2 -0
- package/PageEntityForm/CommandContainer.js +49 -0
- package/PageEntityForm/FormTabRelated.d.ts +6 -0
- package/PageEntityForm/FormTabRelated.js +41 -0
- package/PageEntityForm/PageEntityForm.d.ts +8 -0
- package/PageEntityForm/PageEntityForm.js +30 -0
- package/PageEntityForm/PageEntityFormDesktopContainer.d.ts +2 -0
- package/PageEntityForm/PageEntityFormDesktopContainer.js +120 -0
- package/PageEntityForm/PageEntityFormStringContext.d.ts +8 -0
- package/PageEntityForm/PageEntityFormStringContext.js +15 -0
- package/PageEntityForm/RecordCard.d.ts +10 -0
- package/PageEntityForm/RecordCard.js +134 -0
- package/PageEntityForm/RecordSetNavigatorContainer.d.ts +2 -0
- package/PageEntityForm/RecordSetNavigatorContainer.js +72 -0
- package/PageEntityForm/RelatedViewSelector.d.ts +15 -0
- package/PageEntityForm/RelatedViewSelector.js +78 -0
- package/PageEntityForm/SectionContainer.d.ts +6 -0
- package/PageEntityForm/SectionContainer.js +62 -0
- package/PageEntityForm/StandardControl.d.ts +24 -0
- package/PageEntityForm/StandardControl.js +227 -0
- package/PageEntityForm/SubgridControl.d.ts +13 -0
- package/PageEntityForm/SubgridControl.js +66 -0
- package/PageEntityForm/index.d.ts +1 -0
- package/PageEntityForm/index.js +5 -0
- package/PageEntityView/FormSubgridContainer.d.ts +7 -0
- package/PageEntityView/FormSubgridContainer.js +65 -0
- package/PageEntityView/PageEntityView.d.ts +8 -0
- package/PageEntityView/PageEntityView.js +22 -0
- package/PageEntityView/PageEntityViewDesktopContainer.d.ts +2 -0
- package/PageEntityView/PageEntityViewDesktopContainer.js +14 -0
- package/PageEntityView/PageEntityViewDesktopFrame.d.ts +9 -0
- package/PageEntityView/PageEntityViewDesktopFrame.js +48 -0
- package/PageEntityView/PageEntityViewStringContext.d.ts +23 -0
- package/PageEntityView/PageEntityViewStringContext.js +30 -0
- package/PageEntityView/index.d.ts +1 -0
- package/PageEntityView/index.js +5 -0
- package/ProgressIndicatorContainer/index.d.ts +1 -0
- package/ProgressIndicatorContainer/index.js +30 -0
- package/ToastNotificationContainer/index.d.ts +1 -0
- package/ToastNotificationContainer/index.js +44 -0
- package/components/BodyLoading.d.ts +6 -0
- package/components/BodyLoading.js +19 -0
- package/components/DialogLogin.d.ts +6 -0
- package/components/DialogLogin.js +9 -0
- package/components/LoginForm.d.ts +6 -0
- package/components/LoginForm.js +101 -0
- package/components/PageBroken.d.ts +8 -0
- package/components/PageBroken.js +15 -0
- package/components/PageLoading.d.ts +5 -0
- package/components/PageLoading.js +15 -0
- package/components/PageLogin.d.ts +7 -0
- package/components/PageLogin.js +46 -0
- package/form/FormControl.d.ts +6 -0
- package/form/FormControl.js +95 -0
- package/form/FormControlLoading.d.ts +2 -0
- package/form/FormControlLoading.js +9 -0
- package/form/controls/CurrencyControl.d.ts +4 -0
- package/form/controls/CurrencyControl.js +16 -0
- package/form/controls/DateControl.d.ts +6 -0
- package/form/controls/DateControl.js +21 -0
- package/form/controls/DateRangeControl.d.ts +6 -0
- package/form/controls/DateRangeControl.js +49 -0
- package/form/controls/DateTimeControl.d.ts +6 -0
- package/form/controls/DateTimeControl.js +23 -0
- package/form/controls/EmailControl.d.ts +6 -0
- package/form/controls/EmailControl.js +22 -0
- package/form/controls/LookupControl.d.ts +26 -0
- package/form/controls/LookupControl.js +134 -0
- package/form/controls/MultiSelectControl.d.ts +6 -0
- package/form/controls/MultiSelectControl.js +17 -0
- package/form/controls/MultiSelectLookupControl.d.ts +26 -0
- package/form/controls/MultiSelectLookupControl.js +187 -0
- package/form/controls/NumberControl.d.ts +4 -0
- package/form/controls/NumberControl.js +15 -0
- package/form/controls/PasswordControl.d.ts +6 -0
- package/form/controls/PasswordControl.js +13 -0
- package/form/controls/SelectControl.d.ts +9 -0
- package/form/controls/SelectControl.js +29 -0
- package/form/controls/SwitchControl.d.ts +4 -0
- package/form/controls/SwitchControl.js +6 -0
- package/form/controls/TelephoneControl.d.ts +5 -0
- package/form/controls/TelephoneControl.js +16 -0
- package/form/controls/TextAreaControl.d.ts +6 -0
- package/form/controls/TextAreaControl.js +16 -0
- package/form/controls/TextControl.d.ts +10 -0
- package/form/controls/TextControl.js +24 -0
- package/form/controls/types.d.ts +14 -0
- package/form/controls/types.js +2 -0
- package/form/controls/useLookupData.d.ts +19 -0
- package/form/controls/useLookupData.js +104 -0
- package/form/layout/FormBody/FormBody.d.ts +2 -0
- package/form/layout/FormBody/FormBody.js +11 -0
- package/form/layout/FormBody/index.d.ts +1 -0
- package/form/layout/FormBody/index.js +17 -0
- package/form/layout/FormSection/FormSection.d.ts +16 -0
- package/form/layout/FormSection/FormSection.js +83 -0
- package/form/layout/FormSection/FormSectionColumn.d.ts +6 -0
- package/form/layout/FormSection/FormSectionColumn.js +15 -0
- package/form/layout/FormSection/FormSectionLoading.d.ts +6 -0
- package/form/layout/FormSection/FormSectionLoading.js +7 -0
- package/form/layout/FormSection/index.d.ts +1 -0
- package/form/layout/FormSection/index.js +5 -0
- package/form/layout/FormTab/FormTab.d.ts +13 -0
- package/form/layout/FormTab/FormTab.js +82 -0
- package/form/layout/FormTab/FormTabColumn.d.ts +6 -0
- package/form/layout/FormTab/FormTabColumn.js +15 -0
- package/form/layout/FormTab/index.d.ts +1 -0
- package/form/layout/FormTab/index.js +5 -0
- package/form/layout/TabContext.d.ts +6 -0
- package/form/layout/TabContext.js +5 -0
- package/form/layout/index.d.ts +3 -0
- package/form/layout/index.js +11 -0
- package/form/types.d.ts +74 -0
- package/form/types.js +5 -0
- package/package.json +30 -0
- package/types/index.d.ts +32 -0
- package/types/index.js +2 -0
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
var _a, _b, _c, _d;
|
|
13
|
+
const dataService = (0, transport_1.useDataService)();
|
|
14
|
+
const { schemaStore, experienceStore } = (0, hooks_1.useMetadata)();
|
|
15
|
+
switch (type) {
|
|
16
|
+
case 'string':
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "text", value: value !== null && value !== void 0 ? value : null, onChange: (value) => {
|
|
18
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
19
|
+
} }));
|
|
20
|
+
case 'number':
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "number", value: value !== null && value !== void 0 ? value : null, onChange: (value) => {
|
|
22
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
23
|
+
} }));
|
|
24
|
+
case 'money':
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "currency", value: value !== null && value !== void 0 ? value : null, onChange: (value) => {
|
|
26
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
27
|
+
} }));
|
|
28
|
+
case 'lookup':
|
|
29
|
+
if (attribute.type !== 'lookup') {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
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 !== null && value !== void 0 ? value : null, onChange: (value) => {
|
|
33
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value !== null && value !== void 0 ? value : []);
|
|
34
|
+
} }));
|
|
35
|
+
// return (
|
|
36
|
+
// <FormControl
|
|
37
|
+
// type="lookup"
|
|
38
|
+
// async
|
|
39
|
+
// dataService={dataService}
|
|
40
|
+
// schema={schemaStore.getSchema(attribute.entity)}
|
|
41
|
+
// experienceStore={experienceStore}
|
|
42
|
+
// value={value?.[0] ?? null}
|
|
43
|
+
// onChange={(value) => {
|
|
44
|
+
// onChange?.(value ? [value] : []);
|
|
45
|
+
// }}
|
|
46
|
+
// />
|
|
47
|
+
// );
|
|
48
|
+
case 'date':
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "date", value: value !== null && value !== void 0 ? value : null, onChange: (value) => {
|
|
50
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
51
|
+
} }));
|
|
52
|
+
case 'boolean':
|
|
53
|
+
if (attribute.type !== 'boolean') {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(FormControl_1.default, { type: "multi-select", options: [
|
|
57
|
+
{
|
|
58
|
+
label: (_a = attribute.trueLabel) !== null && _a !== void 0 ? _a : 'Yes',
|
|
59
|
+
value: 'true',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
label: (_b = attribute.falseLabel) !== null && _b !== void 0 ? _b : 'No',
|
|
63
|
+
value: 'false',
|
|
64
|
+
},
|
|
65
|
+
], value: (_c = value === null || value === void 0 ? void 0 : value.map((x) => (x === true ? 'true' : 'false'))) !== null && _c !== void 0 ? _c : [], onChange: (value) => {
|
|
66
|
+
var _a;
|
|
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 : []);
|
|
68
|
+
} }));
|
|
69
|
+
case 'choice':
|
|
70
|
+
case 'choices':
|
|
71
|
+
if (attribute.type !== 'choice' && attribute.type !== 'choices') {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const isNumeric = 'number' in attribute && attribute.number === true;
|
|
75
|
+
// 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
|
+
var _a;
|
|
78
|
+
return ({
|
|
79
|
+
label: x.label,
|
|
80
|
+
value: isNumeric ? (_a = x.value) === null || _a === void 0 ? void 0 : _a.toString() : x.value,
|
|
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 : []);
|
|
85
|
+
} }));
|
|
86
|
+
default:
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Attribute } from '@headless-adminapp/core/attributes';
|
|
2
|
+
import { ColumnCondition } from '@headless-adminapp/core/experience/view';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
interface FilterFormProps {
|
|
5
|
+
attribute: Attribute;
|
|
6
|
+
defaultValue?: ColumnCondition;
|
|
7
|
+
onApply?: (condition: ColumnCondition) => void;
|
|
8
|
+
onCancel?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const FilterForm: FC<FilterFormProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
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 === null || defaultValue === void 0 ? void 0 : 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);
|
|
19
|
+
}, [operatorStrings]);
|
|
20
|
+
const selectedOption = (0, react_1.useMemo)(() => {
|
|
21
|
+
return operatorOptions[attribute.type].find((option) => option.value === operator);
|
|
22
|
+
}, [operator, attribute.type, operatorOptions]);
|
|
23
|
+
const [values, setValues] = (0, react_1.useState)((0, utils_1.getDefaultValues)(selectedOption, defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.value, attribute.type));
|
|
24
|
+
const handleChangeOperator = (operator) => {
|
|
25
|
+
setOperator(operator);
|
|
26
|
+
setValues([]);
|
|
27
|
+
};
|
|
28
|
+
const handleChangeValue = (value, index) => {
|
|
29
|
+
setValues((prev) => {
|
|
30
|
+
const next = [...prev];
|
|
31
|
+
next[index] = value;
|
|
32
|
+
return next;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
const isValid = (0, react_1.useMemo)(() => {
|
|
36
|
+
return (!!selectedOption &&
|
|
37
|
+
values.filter(Boolean).length === selectedOption.controls.length);
|
|
38
|
+
}, [selectedOption, values]);
|
|
39
|
+
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
|
+
display: 'flex',
|
|
41
|
+
flexDirection: 'column',
|
|
42
|
+
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 === null || selectedOption === void 0 ? void 0 : selectedOption.controls.map((x, i) => {
|
|
44
|
+
var _a;
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(ConditionValueControl_1.ConditionValueControl, { type: x, attribute: attribute, value: (_a = values[i]) !== null && _a !== void 0 ? _a : null, onChange: (value) => {
|
|
46
|
+
handleChangeValue(value, i);
|
|
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({
|
|
50
|
+
operator,
|
|
51
|
+
value: values,
|
|
52
|
+
});
|
|
53
|
+
}, children: strings.apply })] })] }));
|
|
54
|
+
};
|
|
55
|
+
exports.FilterForm = FilterForm;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Attribute } from '@headless-adminapp/core/attributes';
|
|
2
|
+
import { OperatorKey } from '@headless-adminapp/core/transport';
|
|
3
|
+
interface OperatorSelectProps {
|
|
4
|
+
attribute: Attribute;
|
|
5
|
+
value: OperatorKey | null;
|
|
6
|
+
onChange?: (operator: OperatorKey) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function OperatorSelect({ attribute, value, onChange, }: OperatorSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
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 react_1 = require("react");
|
|
10
|
+
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
11
|
+
const SelectControl_1 = __importDefault(require("../../form/controls/SelectControl"));
|
|
12
|
+
function OperatorSelect({ attribute, value, onChange, }) {
|
|
13
|
+
const { operatorStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
14
|
+
const operatorOptions = (0, react_1.useMemo)(() => {
|
|
15
|
+
return (0, column_filter_1.getLocalizedOperatorOptions)(operatorStrings);
|
|
16
|
+
}, [operatorStrings]);
|
|
17
|
+
const options = (0, react_1.useMemo)(() => {
|
|
18
|
+
return operatorOptions[attribute.type];
|
|
19
|
+
}, [attribute.type, operatorOptions]);
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(SelectControl_1.default, { options: options, onChange: (value) => onChange === null || onChange === void 0 ? void 0 : onChange(value), value: value }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TransformedViewColumn } from '@headless-adminapp/app/datagrid';
|
|
2
|
+
import type { Attribute } from '@headless-adminapp/core/attributes';
|
|
3
|
+
import { ColumnCondition } from '@headless-adminapp/core/experience/view';
|
|
4
|
+
import { FC, PropsWithChildren } from 'react';
|
|
5
|
+
interface TableHeaderFilterCellProps {
|
|
6
|
+
sortDirection?: 'asc' | 'desc';
|
|
7
|
+
columnName: string;
|
|
8
|
+
onChangeSortDirection?: (direction: 'asc' | 'desc') => void;
|
|
9
|
+
filterCondition?: ColumnCondition;
|
|
10
|
+
onChangeFilterCondition?: (condition: ColumnCondition | undefined) => void;
|
|
11
|
+
attribute: Attribute;
|
|
12
|
+
minWidth?: number;
|
|
13
|
+
onChangeWidth?: (width: number) => void;
|
|
14
|
+
column: TransformedViewColumn;
|
|
15
|
+
onResetSize?: () => void;
|
|
16
|
+
resizeHandler?: (event: unknown) => void;
|
|
17
|
+
resizable?: boolean;
|
|
18
|
+
disableFilter?: boolean;
|
|
19
|
+
disableSort?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const TableHeaderFilterCell: FC<PropsWithChildren<TableHeaderFilterCellProps>>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableHeaderFilterCell = 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 hooks_2 = require("@headless-adminapp/app/metadata/hooks");
|
|
8
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const PageEntityViewStringContext_1 = require("../../PageEntityView/PageEntityViewStringContext");
|
|
11
|
+
const FilterForm_1 = require("./FilterForm");
|
|
12
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
13
|
+
root: {
|
|
14
|
+
cursor: 'pointer',
|
|
15
|
+
userSelect: 'none',
|
|
16
|
+
'&:active': {
|
|
17
|
+
backgroundColor: react_components_1.tokens.colorSubtleBackgroundPressed,
|
|
18
|
+
},
|
|
19
|
+
'&:hover [data-id="resize-handle"]': {
|
|
20
|
+
opacity: 0.5,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
resizeHandle: {
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
right: '-6px',
|
|
26
|
+
zIndex: 5,
|
|
27
|
+
top: 0,
|
|
28
|
+
bottom: 0,
|
|
29
|
+
width: '12px',
|
|
30
|
+
cursor: 'col-resize',
|
|
31
|
+
// background: 'black',
|
|
32
|
+
userSelect: 'none',
|
|
33
|
+
touchAction: 'none',
|
|
34
|
+
paddingBlock: '6px',
|
|
35
|
+
display: 'flex',
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
opacity: 0,
|
|
38
|
+
'&:hover': {
|
|
39
|
+
opacity: '0.8 !important',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
resizeHandleInner: {
|
|
43
|
+
width: '2px',
|
|
44
|
+
background: react_components_1.tokens.colorNeutralForeground1,
|
|
45
|
+
// borderLeft: `1px solid ${tokens.colorNeutralForeground1}`,
|
|
46
|
+
// borderRight: `1px solid ${tokens.colorNeutralForeground1}`,
|
|
47
|
+
},
|
|
48
|
+
right: {
|
|
49
|
+
'& .fui-TableHeaderCell__button': {
|
|
50
|
+
justifyContent: 'flex-end',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
const TableHeaderFilterCell = ({ children, sortDirection,
|
|
55
|
+
// onChangeFilterCondition,
|
|
56
|
+
onChangeSortDirection,
|
|
57
|
+
// attribute,
|
|
58
|
+
// filterCondition,
|
|
59
|
+
minWidth,
|
|
60
|
+
// onChangeWidth,
|
|
61
|
+
column, onResetSize, resizeHandler, resizable, disableFilter, disableSort, }) => {
|
|
62
|
+
const [visible, setVisible] = (0, react_1.useState)(false);
|
|
63
|
+
const schema = (0, hooks_1.useDataGridSchema)();
|
|
64
|
+
const { getSchema } = (0, hooks_2.useMetadata)();
|
|
65
|
+
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
66
|
+
const attribute = (0, react_1.useMemo)(() => {
|
|
67
|
+
const _attribute = schema.attributes[column.name];
|
|
68
|
+
if (!column.expandedKey) {
|
|
69
|
+
return _attribute;
|
|
70
|
+
}
|
|
71
|
+
if (_attribute.type !== 'lookup') {
|
|
72
|
+
throw new Error('Invalid attribute type');
|
|
73
|
+
}
|
|
74
|
+
const lookupSchema = getSchema(_attribute.entity);
|
|
75
|
+
return lookupSchema.attributes[column.expandedKey];
|
|
76
|
+
}, [column.expandedKey, column.name, getSchema, schema.attributes]);
|
|
77
|
+
const align = (0, react_1.useMemo)(() => {
|
|
78
|
+
switch (attribute.type) {
|
|
79
|
+
case 'money':
|
|
80
|
+
return 'right';
|
|
81
|
+
default:
|
|
82
|
+
return 'left';
|
|
83
|
+
}
|
|
84
|
+
}, [attribute.type]);
|
|
85
|
+
const styles = useStyles();
|
|
86
|
+
const isResizingRef = (0, react_1.useRef)(false);
|
|
87
|
+
const [columnFilters, setColumnFilters] = (0, hooks_1.useGridColumnFilter)();
|
|
88
|
+
const filterCondition = columnFilters[column.id];
|
|
89
|
+
const onChangeFilterCondition = (condition) => {
|
|
90
|
+
setColumnFilters(column.id, condition);
|
|
91
|
+
};
|
|
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 === null || onChangeSortDirection === void 0 ? void 0 : 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 === null || onChangeSortDirection === void 0 ? void 0 : onChangeSortDirection('desc'), children: strings.sortByDescending })] }));
|
|
93
|
+
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 === null || onChangeFilterCondition === void 0 ? void 0 : onChangeFilterCondition(undefined);
|
|
95
|
+
}, children: strings.clearFilter }))] }));
|
|
96
|
+
const menuItems = [];
|
|
97
|
+
if (!disableSort) {
|
|
98
|
+
menuItems.push(sortMenuItems);
|
|
99
|
+
}
|
|
100
|
+
if (!disableFilter) {
|
|
101
|
+
menuItems.push(filterMenuItems);
|
|
102
|
+
}
|
|
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
|
+
textAlign: align,
|
|
105
|
+
width: minWidth,
|
|
106
|
+
minWidth: minWidth,
|
|
107
|
+
maxWidth: minWidth,
|
|
108
|
+
display: 'flex',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
// pointerEvents: disableFilter && disableSort ? 'none' : 'auto',
|
|
111
|
+
}, onClick: (event) => {
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
}, aside: resizable ? ((0, jsx_runtime_1.jsx)("div", { className: (0, react_components_1.mergeClasses)(styles.resizeHandle), "data-id": "resize-handle", onClick: (event) => {
|
|
114
|
+
event.stopPropagation();
|
|
115
|
+
event.preventDefault();
|
|
116
|
+
}, onDoubleClick: (event) => {
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
onResetSize === null || onResetSize === void 0 ? void 0 : onResetSize();
|
|
120
|
+
}, onMouseDown: (event) => {
|
|
121
|
+
event.stopPropagation();
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
resizeHandler === null || resizeHandler === void 0 ? void 0 : resizeHandler(event);
|
|
124
|
+
}, onMouseUp: (event) => {
|
|
125
|
+
event.stopPropagation();
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
}, onTouchStart: (event) => {
|
|
128
|
+
event.stopPropagation();
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
resizeHandler === null || resizeHandler === void 0 ? void 0 : resizeHandler(event);
|
|
131
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { className: (0, react_components_1.mergeClasses)(styles.resizeHandleInner) }) })) : null, onMouseUp: (event) => {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
if (isResizingRef.current) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
isResizingRef.current = false;
|
|
137
|
+
}, sortable: !disableSort,
|
|
138
|
+
// sortDirection="ascending"
|
|
139
|
+
sortDirection: sortDirection === 'asc'
|
|
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 }) }))] }));
|
|
144
|
+
if (disableFilter && disableSort) {
|
|
145
|
+
return headerCell;
|
|
146
|
+
}
|
|
147
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { 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) => {
|
|
148
|
+
onChangeFilterCondition === null || onChangeFilterCondition === void 0 ? void 0 : onChangeFilterCondition(condition);
|
|
149
|
+
setVisible(false);
|
|
150
|
+
}, onCancel: () => setVisible(false) })] }) }) })] }));
|
|
151
|
+
};
|
|
152
|
+
exports.TableHeaderFilterCell = TableHeaderFilterCell;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TableHeaderFilterCell } from './TableHeaderFilterCell';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableHeaderFilterCell = void 0;
|
|
4
|
+
var TableHeaderFilterCell_1 = require("./TableHeaderFilterCell");
|
|
5
|
+
Object.defineProperty(exports, "TableHeaderFilterCell", { enumerable: true, get: function () { return TableHeaderFilterCell_1.TableHeaderFilterCell; } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { OperatorOption } from '@headless-adminapp/app/datagrid';
|
|
2
|
+
import type { AttributeType } from '@headless-adminapp/core/attributes';
|
|
3
|
+
import { OperatorKey } from '@headless-adminapp/core/transport';
|
|
4
|
+
export declare function getDefaultOperator(operator: OperatorKey | undefined, attributeType: AttributeType): OperatorKey;
|
|
5
|
+
export declare function getDefaultValues(operator: OperatorOption, value: any, _attributeType: AttributeType): any[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultOperator = getDefaultOperator;
|
|
4
|
+
exports.getDefaultValues = getDefaultValues;
|
|
5
|
+
function getDefaultOperator(operator, attributeType) {
|
|
6
|
+
return operator
|
|
7
|
+
? operator
|
|
8
|
+
: attributeType === 'date'
|
|
9
|
+
? 'on'
|
|
10
|
+
: attributeType === 'choice' || attributeType === 'lookup'
|
|
11
|
+
? 'in'
|
|
12
|
+
: 'eq';
|
|
13
|
+
}
|
|
14
|
+
function getDefaultValues(operator, value, _attributeType) {
|
|
15
|
+
if (!value)
|
|
16
|
+
return [];
|
|
17
|
+
return Array.isArray(value) ? value : [value];
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridHeaderContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const GridHeaderDesktop_1 = require("./GridHeaderDesktop");
|
|
6
|
+
const GridHeaderContainer = () => {
|
|
7
|
+
return (0, jsx_runtime_1.jsx)(GridHeaderDesktop_1.GridHeaderDesktop, {});
|
|
8
|
+
};
|
|
9
|
+
exports.GridHeaderContainer = GridHeaderContainer;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridHeaderDesktop = 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 react_1 = require("react");
|
|
10
|
+
const AppStringContext_1 = require("../App/AppStringContext");
|
|
11
|
+
const PageEntityViewStringContext_1 = require("../PageEntityView/PageEntityViewStringContext");
|
|
12
|
+
const CustomizeColumns_1 = require("./CustomizeColumns");
|
|
13
|
+
const GridHeaderDesktop = (props) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const viewLookup = (0, hooks_1.useGridViewLookupData)();
|
|
16
|
+
const selectedView = (0, hooks_1.useSelectedView)();
|
|
17
|
+
const changeView = (0, hooks_1.useChangeView)();
|
|
18
|
+
const [searchText, setSearchText] = (0, hooks_1.useSearchText)();
|
|
19
|
+
const [isColumnCustomizationOpen, setIsColumnCustomizationOpen] = (0, react_1.useState)(false);
|
|
20
|
+
const { language } = (0, locale_1.useLocale)();
|
|
21
|
+
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
22
|
+
const appStrings = (0, AppStringContext_1.useAppStrings)();
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
paddingInline: 8,
|
|
26
|
+
gap: 16,
|
|
27
|
+
width: '100%',
|
|
28
|
+
display: 'flex',
|
|
29
|
+
}, children: [(0, jsx_runtime_1.jsx)(CustomizeColumns_1.CustomizeColumns, { opened: isColumnCustomizationOpen, onClose: () => setIsColumnCustomizationOpen(false) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
30
|
+
flex: 1,
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
gap: 16,
|
|
33
|
+
justifyContent: 'space-between',
|
|
34
|
+
display: 'flex',
|
|
35
|
+
}, 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", children: (_b = (_a = selectedView.localizedNames) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : 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) => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
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));
|
|
38
|
+
}) }) })] }) }), (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) })] })] }));
|
|
39
|
+
};
|
|
40
|
+
exports.GridHeaderDesktop = GridHeaderDesktop;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridPaginationContainer = 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 react_1 = require("react");
|
|
8
|
+
const PageEntityViewStringContext_1 = require("../PageEntityView/PageEntityViewStringContext");
|
|
9
|
+
const GridPaginationContainer = () => {
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
const data = (0, hooks_1.useGridData)();
|
|
12
|
+
const [selectedIds] = (0, hooks_1.useGridSelection)();
|
|
13
|
+
const strings = (0, PageEntityViewStringContext_1.usePageEntityViewStrings)();
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(react_components_1.Body1, { style: {
|
|
15
|
+
color: react_components_1.tokens.colorNeutralForeground3,
|
|
16
|
+
display: 'flex',
|
|
17
|
+
gap: 8,
|
|
18
|
+
}, children: [(0, jsx_runtime_1.jsxs)("span", { children: [strings.records, ": ", (_a = data === null || data === void 0 ? void 0 : data.count) !== null && _a !== void 0 ? _a : '-'] }), (0, jsx_runtime_1.jsx)("span", { children: "|" }), (0, jsx_runtime_1.jsxs)("span", { children: [strings.loaded, ": ", (_b = data === null || data === void 0 ? void 0 : data.records.length) !== null && _b !== void 0 ? _b : '-'] }), (selectedIds.length > 0 || ((_c = data === null || data === void 0 ? void 0 : data.count) !== null && _c !== void 0 ? _c : 0) > 0) && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { children: "|" }), (0, jsx_runtime_1.jsxs)("span", { children: [strings.selected, ": ", selectedIds.length] })] }))] }) }));
|
|
19
|
+
};
|
|
20
|
+
exports.GridPaginationContainer = GridPaginationContainer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface GridTableContainerProps {
|
|
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 GridTableContainer: FC<GridTableContainerProps>;
|
|
12
|
+
export {};
|