@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
|
@@ -22,21 +22,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
26
|
exports.generateValidationSchema = exports.formValidator = void 0;
|
|
36
27
|
exports.PromptDialog = PromptDialog;
|
|
37
28
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
29
|
const react_components_1 = require("@fluentui/react-components");
|
|
39
30
|
const utils_1 = require("@headless-adminapp/app/dataform/utils");
|
|
31
|
+
const form_1 = require("@headless-adminapp/app/form");
|
|
32
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
40
33
|
const yup_1 = require("@hookform/resolvers/yup");
|
|
41
34
|
const lodash_1 = require("lodash");
|
|
42
35
|
const react_hook_form_1 = require("react-hook-form");
|
|
@@ -44,16 +37,21 @@ const yup = __importStar(require("yup"));
|
|
|
44
37
|
const SectionControl_1 = require("../DataForm/SectionControl");
|
|
45
38
|
const StandardControl_1 = require("../PageEntityForm/StandardControl");
|
|
46
39
|
function PromptDialog(props) {
|
|
47
|
-
|
|
40
|
+
const { language, region } = (0, locale_1.useLocale)();
|
|
41
|
+
const formValidationStrings = (0, form_1.useFormValidationStrings)();
|
|
48
42
|
const form = (0, react_hook_form_1.useForm)({
|
|
49
43
|
mode: 'all',
|
|
50
44
|
defaultValues: props.defaultValues,
|
|
51
45
|
shouldUnregister: false,
|
|
52
|
-
resolver: (0, exports.formValidator)(
|
|
46
|
+
resolver: (0, exports.formValidator)({
|
|
47
|
+
attributes: props.attributes,
|
|
48
|
+
language,
|
|
49
|
+
strings: formValidationStrings,
|
|
50
|
+
region,
|
|
51
|
+
}),
|
|
53
52
|
});
|
|
54
53
|
return ((0, jsx_runtime_1.jsx)(react_components_1.Dialog, { open: props.open, onOpenChange: () => {
|
|
55
|
-
|
|
56
|
-
(_a = props.onDismiss) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
54
|
+
props.onDismiss?.();
|
|
57
55
|
}, children: (0, jsx_runtime_1.jsx)(react_components_1.DialogSurface, { style: { maxWidth: 480 }, children: (0, jsx_runtime_1.jsxs)(react_components_1.DialogBody, { children: [!!props.title && (0, jsx_runtime_1.jsx)(react_components_1.DialogTitle, { children: props.title }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogContent, { children: [!!props.text && (0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: props.text }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
58
56
|
display: 'flex',
|
|
59
57
|
flexDirection: 'column',
|
|
@@ -62,37 +60,44 @@ function PromptDialog(props) {
|
|
|
62
60
|
marginBottom: react_components_1.tokens.spacingVerticalL,
|
|
63
61
|
}, children: Object.entries(props.attributes).map(([attributeName, attribute]) => {
|
|
64
62
|
return ((0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: form.control, name: attributeName, render: ({ field, fieldState, formState }) => {
|
|
65
|
-
var _a, _b;
|
|
66
63
|
const isError = (fieldState.isTouched || formState.isSubmitted) &&
|
|
67
|
-
!!
|
|
64
|
+
!!fieldState.error?.message;
|
|
68
65
|
const errorMessage = fieldState.isTouched || formState.isSubmitted
|
|
69
|
-
?
|
|
66
|
+
? fieldState.error?.message
|
|
70
67
|
: '';
|
|
71
|
-
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: attribute.label, labelPosition: "left", required: attribute.required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(StandardControl_1.StandardControl, { attribute: attribute, name: attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError }) }));
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)(SectionControl_1.SectionControlWrapper, { label: attribute.label, labelPosition: "left", required: attribute.required, isError: isError, errorMessage: errorMessage, children: (0, jsx_runtime_1.jsx)(StandardControl_1.StandardControl, { attribute: attribute, name: attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur, errorMessage: errorMessage, isError: isError, readOnly: attribute.readonly }) }));
|
|
72
69
|
} }, attributeName));
|
|
73
|
-
}) })] }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", onClick: () => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}))();
|
|
81
|
-
}), children: (_b = props.confirmText) !== null && _b !== void 0 ? _b : 'Confirm' })] })] }) }) }));
|
|
70
|
+
}) })] }), (0, jsx_runtime_1.jsxs)(react_components_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "secondary", type: "button", onClick: () => {
|
|
71
|
+
props.onCancel?.();
|
|
72
|
+
}, children: props.cancelText ?? 'Cancel' }), (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "primary", disabled: form.formState.submitCount > 0 && !form.formState.isValid, onClick: async () => {
|
|
73
|
+
await form.handleSubmit(async (values) => {
|
|
74
|
+
props.onConfirm?.(values);
|
|
75
|
+
})();
|
|
76
|
+
}, children: props.confirmText ?? 'Confirm' })] })] }) }) }));
|
|
82
77
|
}
|
|
83
|
-
exports.formValidator = (0, lodash_1.memoize)(function formValidator(attributes) {
|
|
84
|
-
return (values, context, options) =>
|
|
85
|
-
const validator = (0, exports.generateValidationSchema)(
|
|
78
|
+
exports.formValidator = (0, lodash_1.memoize)(function formValidator({ attributes, language, strings, region, }) {
|
|
79
|
+
return async (values, context, options) => {
|
|
80
|
+
const validator = (0, exports.generateValidationSchema)({
|
|
81
|
+
attributes,
|
|
82
|
+
language,
|
|
83
|
+
strings,
|
|
84
|
+
region,
|
|
85
|
+
});
|
|
86
86
|
const resolver = (0, yup_1.yupResolver)(validator);
|
|
87
|
-
const result =
|
|
87
|
+
const result = await resolver(values, context, options);
|
|
88
88
|
return result;
|
|
89
|
-
}
|
|
90
|
-
}, (
|
|
91
|
-
exports.generateValidationSchema = (0, lodash_1.memoize)(function generateValidationSchema(attributes) {
|
|
89
|
+
};
|
|
90
|
+
}, (options) => JSON.stringify(options));
|
|
91
|
+
exports.generateValidationSchema = (0, lodash_1.memoize)(function generateValidationSchema({ attributes, language, strings, region, }) {
|
|
92
92
|
const columns = Object.keys(attributes);
|
|
93
|
-
return yup.object().shape(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
return yup.object().shape({
|
|
94
|
+
...columns.reduce((acc, column) => {
|
|
95
|
+
const attribute = attributes[column];
|
|
96
|
+
const validationSchema = (0, utils_1.generateAttributeValidationSchema)(attribute, language, strings, region);
|
|
97
|
+
return {
|
|
98
|
+
...acc,
|
|
99
|
+
[column]: validationSchema,
|
|
100
|
+
};
|
|
101
|
+
}, {}),
|
|
102
|
+
});
|
|
103
|
+
}, (options) => JSON.stringify(options));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CommandBarContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandBarContainer = CommandBarContainer;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const command_1 = require("@headless-adminapp/app/command");
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/command/hooks");
|
|
7
|
+
const insights_1 = require("@headless-adminapp/app/insights");
|
|
8
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
9
|
+
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
10
|
+
function CommandBarContainer() {
|
|
11
|
+
const baseCommandHandleContext = (0, hooks_1.useBaseCommandHandlerContext)();
|
|
12
|
+
const insightExpereince = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (x) => x.experience);
|
|
13
|
+
const transformedCommands = (0, command_1.useCommands)([insightExpereince.commands], {
|
|
14
|
+
...baseCommandHandleContext,
|
|
15
|
+
primaryControl: {},
|
|
16
|
+
});
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { flex: 1, flexShrink: 0, overflow: 'hidden' }, children: (0, jsx_runtime_1.jsx)(OverflowCommandBar_1.OverflowCommandBar, { commands: transformedCommands }) }));
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FilterBarContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterBarContainer = FilterBarContainer;
|
|
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/dialog/hooks");
|
|
7
|
+
const insights_1 = require("@headless-adminapp/app/insights");
|
|
8
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
9
|
+
const utils_1 = require("@headless-adminapp/app/utils");
|
|
10
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
11
|
+
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
12
|
+
function FilterBarContainer() {
|
|
13
|
+
const openPromptDialog = (0, hooks_1.useOpenPromptDialog)();
|
|
14
|
+
const insightsState = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (state) => state);
|
|
15
|
+
const insightExpereince = insightsState.experience;
|
|
16
|
+
const setValue = (0, mutable_1.useContextSetValue)(insights_1.InsightsContext);
|
|
17
|
+
const handleOpenPromptDialog = async () => {
|
|
18
|
+
const attributes = insightExpereince.filters.reduce((acc, item) => {
|
|
19
|
+
acc[item.logicalName] =
|
|
20
|
+
insightsState.experience.attributes[item.logicalName];
|
|
21
|
+
return acc;
|
|
22
|
+
}, {});
|
|
23
|
+
const defaultValues = insightExpereince.filters.reduce((acc, item) => {
|
|
24
|
+
acc[item.logicalName] = insightsState.data[item.logicalName];
|
|
25
|
+
return acc;
|
|
26
|
+
}, {});
|
|
27
|
+
const result = await openPromptDialog({
|
|
28
|
+
attributes,
|
|
29
|
+
defaultValues,
|
|
30
|
+
title: 'Modify filter',
|
|
31
|
+
allowDismiss: true,
|
|
32
|
+
});
|
|
33
|
+
if (!result) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
setValue({
|
|
37
|
+
data: result,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const filterCommandItems = insightExpereince.filters
|
|
41
|
+
.map((item) => {
|
|
42
|
+
const logicalName = item.logicalName;
|
|
43
|
+
const value = insightsState.data[logicalName];
|
|
44
|
+
const attribute = insightsState.experience.attributes[logicalName];
|
|
45
|
+
if (!item.showInFilterBar) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (!attribute || !value) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
if (item.allowQuickFilter) {
|
|
52
|
+
return {
|
|
53
|
+
type: 'button',
|
|
54
|
+
Icon: item.Icon,
|
|
55
|
+
text: (0, utils_1.getAttributeFormattedValue)(attribute, value, { maxCount: 2 }),
|
|
56
|
+
onClick: async () => {
|
|
57
|
+
const result = await openPromptDialog({
|
|
58
|
+
allowDismiss: true,
|
|
59
|
+
attributes: {
|
|
60
|
+
[logicalName]: attribute,
|
|
61
|
+
},
|
|
62
|
+
defaultValues: {
|
|
63
|
+
[logicalName]: value,
|
|
64
|
+
},
|
|
65
|
+
title: item.quickFilterTitle ?? attribute.label,
|
|
66
|
+
});
|
|
67
|
+
if (!result) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
setValue({
|
|
71
|
+
data: {
|
|
72
|
+
...insightsState.data,
|
|
73
|
+
[logicalName]: result[logicalName],
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
type: 'label',
|
|
81
|
+
Icon: item.Icon,
|
|
82
|
+
text: (item.beforeContent ?? '') +
|
|
83
|
+
(0, utils_1.getAttributeFormattedValue)(attribute, value, { maxCount: 2 }),
|
|
84
|
+
};
|
|
85
|
+
})
|
|
86
|
+
.filter(Boolean);
|
|
87
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
88
|
+
display: 'flex',
|
|
89
|
+
flex: 1,
|
|
90
|
+
flexShrink: 0,
|
|
91
|
+
alignItems: 'center',
|
|
92
|
+
overflow: 'hidden',
|
|
93
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
94
|
+
display: 'flex',
|
|
95
|
+
flex: 1,
|
|
96
|
+
overflow: 'hidden',
|
|
97
|
+
flexShrink: 0,
|
|
98
|
+
}, children: (0, jsx_runtime_1.jsx)(OverflowCommandBar_1.OverflowCommandBar, { commands: [filterCommandItems], align: "end", beforeDivider: true }) }), insightExpereince.filters.length > 0 && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "primary", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Filter, { size: 16 }), onClick: handleOpenPromptDialog, style: { flexShrink: 0, marginInline: 8 }, children: "Filter" }))] }));
|
|
99
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export declare function WidgetGrid({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function WidgetGridItem({ column, row, children, }: PropsWithChildren<{
|
|
4
|
+
column?: number;
|
|
5
|
+
row?: number;
|
|
6
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
package/Insights/Grid.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetGrid = WidgetGrid;
|
|
4
|
+
exports.WidgetGridItem = WidgetGridItem;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
7
|
+
function WidgetGrid({ children }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
9
|
+
padding: react_components_1.tokens.spacingHorizontalM,
|
|
10
|
+
width: '100%',
|
|
11
|
+
// flex: 1,
|
|
12
|
+
display: 'grid',
|
|
13
|
+
gridTemplateColumns: '1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr',
|
|
14
|
+
rowGap: react_components_1.tokens.spacingVerticalM,
|
|
15
|
+
columnGap: react_components_1.tokens.spacingHorizontalM,
|
|
16
|
+
}, children: children }));
|
|
17
|
+
}
|
|
18
|
+
function WidgetGridItem({ column, row, children, }) {
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
gridColumn: column ? `span ${column}` : undefined,
|
|
23
|
+
gridRow: row ? `span ${row}` : undefined,
|
|
24
|
+
height: row ? 100 * row + 12 * (row - 1) : 100,
|
|
25
|
+
}, children: children }));
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function InsightsContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InsightsContainer = InsightsContainer;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const ScrollView_1 = require("@headless-adminapp/app/components/ScrollView");
|
|
7
|
+
const insights_1 = require("@headless-adminapp/app/insights");
|
|
8
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
9
|
+
const CommandBarContainer_1 = require("./CommandBarContainer");
|
|
10
|
+
const FilterBarContainer_1 = require("./FilterBarContainer");
|
|
11
|
+
const Widgets_1 = require("./Widgets");
|
|
12
|
+
function InsightsContainer() {
|
|
13
|
+
const insightsState = (0, mutable_1.useContextSelector)(insights_1.InsightsContext, (state) => state);
|
|
14
|
+
const insightExpereince = insightsState.experience;
|
|
15
|
+
const titleButton = ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", style: { pointerEvents: 'auto' }, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: { color: react_components_1.tokens.colorNeutralForeground1 }, children: insightExpereince.title }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground2 }, children: insightExpereince.subtitle })] }) }));
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flex: 1,
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
backgroundColor: react_components_1.tokens.colorNeutralBackground2,
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { padding: 12 }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
23
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
24
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
25
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
26
|
+
display: 'flex',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
minHeight: 40,
|
|
29
|
+
}, children: [(0, jsx_runtime_1.jsx)(CommandBarContainer_1.CommandBarContainer, {}), (0, jsx_runtime_1.jsx)(FilterBarContainer_1.FilterBarContainer, {})] }) }), (0, jsx_runtime_1.jsx)("div", { style: { padding: 12 }, children: insightsState.insightLookup.length > 0 ? ((0, jsx_runtime_1.jsxs)(react_components_1.Menu, { children: [(0, jsx_runtime_1.jsx)(react_components_1.MenuTrigger, { disableButtonEnhancement: true, children: titleButton }), (0, jsx_runtime_1.jsx)(react_components_1.MenuPopover, { children: (0, jsx_runtime_1.jsx)(react_components_1.MenuList, { children: insightsState.insightLookup.map((insight) => ((0, jsx_runtime_1.jsx)(react_components_1.MenuItem, { onClick: () => insightsState.onInsightSelect(insight.id), children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: insight.title }), (0, jsx_runtime_1.jsx)(react_components_1.Caption2, { style: { color: react_components_1.tokens.colorNeutralForeground2 }, children: insight.subtitle })] }) }, insight.id))) }) })] })) : (titleButton) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'column',
|
|
32
|
+
flex: 1,
|
|
33
|
+
overflow: 'hidden',
|
|
34
|
+
}, children: (0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, { children: (0, jsx_runtime_1.jsx)(Widgets_1.Widgets, { widgets: insightExpereince.widgets }) }) })] }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChartWidgetExperience } from '@headless-adminapp/core/experience/insights';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface WidgetChartContainerProps {
|
|
4
|
+
content: ChartWidgetExperience;
|
|
5
|
+
}
|
|
6
|
+
export declare const WidgetChartContainer: FC<WidgetChartContainerProps>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetChartContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const BodyLoading_1 = require("../components/BodyLoading");
|
|
7
|
+
const AreaChart_1 = require("./charts/AreaChart");
|
|
8
|
+
const BarChart_1 = require("./charts/BarChart");
|
|
9
|
+
const ComposedChart_1 = require("./charts/ComposedChart");
|
|
10
|
+
const GaugeChart_1 = require("./charts/GaugeChart");
|
|
11
|
+
const LineChart_1 = require("./charts/LineChart");
|
|
12
|
+
const OhlcChart_1 = require("./charts/OhlcChart");
|
|
13
|
+
const PieChart_1 = require("./charts/PieChart");
|
|
14
|
+
const RadarChart_1 = require("./charts/RadarChart");
|
|
15
|
+
const ScatterChart_1 = require("./charts/ScatterChart");
|
|
16
|
+
const useWidgetDetail_1 = require("./hooks/useWidgetDetail");
|
|
17
|
+
const WidgetTitleBar_1 = require("./WidgetTitleBar");
|
|
18
|
+
function getChartComponent(type
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
) {
|
|
21
|
+
switch (type) {
|
|
22
|
+
case 'line':
|
|
23
|
+
return LineChart_1.LineChart;
|
|
24
|
+
case 'area':
|
|
25
|
+
return AreaChart_1.AreaChart;
|
|
26
|
+
case 'bar':
|
|
27
|
+
return BarChart_1.BarChart;
|
|
28
|
+
case 'composed':
|
|
29
|
+
return ComposedChart_1.ComposedChart;
|
|
30
|
+
case 'scatter':
|
|
31
|
+
return ScatterChart_1.ScatterChart;
|
|
32
|
+
case 'pie':
|
|
33
|
+
return PieChart_1.PieChart;
|
|
34
|
+
case 'radar':
|
|
35
|
+
return RadarChart_1.RadarChart;
|
|
36
|
+
case 'gauge':
|
|
37
|
+
return GaugeChart_1.GaugeChart;
|
|
38
|
+
case 'ohlc':
|
|
39
|
+
return OhlcChart_1.OhlcChart;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const WidgetChartContainer = ({ content, }) => {
|
|
43
|
+
const { transformedCommands, dataset, isPending, isFetching, widget } = (0, useWidgetDetail_1.useWidgetDetail)(content);
|
|
44
|
+
const info = content.chart;
|
|
45
|
+
const type = info.chart.type;
|
|
46
|
+
const ChartComponent = getChartComponent(type);
|
|
47
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
48
|
+
display: 'flex',
|
|
49
|
+
flex: 1,
|
|
50
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
51
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
52
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
53
|
+
flexDirection: 'column',
|
|
54
|
+
}, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: widget.title, commands: transformedCommands }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, position: 'relative' }, children: [!isPending && ((0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', inset: 0 }, children: (0, jsx_runtime_1.jsx)(ChartComponent, { dataset: dataset, chartInfo: info.chart }) })), (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: isFetching })] })] }));
|
|
55
|
+
};
|
|
56
|
+
exports.WidgetChartContainer = WidgetChartContainer;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetDataGridContainer = WidgetDataGridContainer;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const command_1 = require("@headless-adminapp/app/command");
|
|
7
|
+
const hooks_1 = require("@headless-adminapp/app/command/hooks");
|
|
8
|
+
const DataGridProvider_1 = require("@headless-adminapp/app/datagrid/DataGridProvider");
|
|
9
|
+
const hooks_2 = require("@headless-adminapp/app/datagrid/hooks");
|
|
10
|
+
const hooks_3 = require("@headless-adminapp/app/metadata/hooks");
|
|
11
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
12
|
+
const widget_1 = require("@headless-adminapp/app/widget");
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
const DataGrid_1 = require("../DataGrid");
|
|
15
|
+
const WidgetTitleBar_1 = require("./WidgetTitleBar");
|
|
16
|
+
function WidgetDataGridContainer({ content, }) {
|
|
17
|
+
const logicalName = content.logicalName;
|
|
18
|
+
const schema = (0, hooks_3.useSchema)(logicalName);
|
|
19
|
+
const { view } = (0, hooks_3.useExperienceView)(logicalName);
|
|
20
|
+
if (!view) {
|
|
21
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "Loading..." });
|
|
22
|
+
}
|
|
23
|
+
if (!schema) {
|
|
24
|
+
return (0, jsx_runtime_1.jsx)("div", { children: "Schema not found" });
|
|
25
|
+
}
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flex: 1,
|
|
29
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
30
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
31
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
32
|
+
// padding: tokens.spacingHorizontalM,
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
}, children: (0, jsx_runtime_1.jsx)(DataGridProvider_1.DataGridProvider, { schema: schema, view: view, views: [], onChangeView: () => { }, commands: [], allowViewSelection: false, maxRecords: content.maxRecords, extraFilter: content.filter, children: (0, jsx_runtime_1.jsx)(FormSubgridContainer, { content: content }) }) }));
|
|
35
|
+
}
|
|
36
|
+
const FormSubgridContainer = ({ content, }) => {
|
|
37
|
+
const baseCommandHandleContext = (0, hooks_1.useBaseCommandHandlerContext)();
|
|
38
|
+
const primaryControl = (0, hooks_2.useGridControlContext)();
|
|
39
|
+
const widgetSetValue = (0, mutable_1.useContextSetValue)(widget_1.WidgetContext);
|
|
40
|
+
const updateStateValue = (0, react_1.useCallback)(
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
(value) => {
|
|
43
|
+
widgetSetValue((state) => ({
|
|
44
|
+
...state,
|
|
45
|
+
data: { ...state.data, ...value },
|
|
46
|
+
}));
|
|
47
|
+
}, [widgetSetValue]);
|
|
48
|
+
const transformedCommands = (0, command_1.useCommands)([content.commands], {
|
|
49
|
+
...baseCommandHandleContext,
|
|
50
|
+
primaryControl: {
|
|
51
|
+
...primaryControl,
|
|
52
|
+
updateStateValue,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
56
|
+
display: 'flex',
|
|
57
|
+
flex: 1,
|
|
58
|
+
flexDirection: 'column',
|
|
59
|
+
// gap: 8,
|
|
60
|
+
// backgroundColor: tokens.colorNeutralBackground2,
|
|
61
|
+
// padding: 2,
|
|
62
|
+
overflow: 'hidden',
|
|
63
|
+
}, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: "Recent transactions", commands: transformedCommands }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
64
|
+
// gap: 12,
|
|
65
|
+
flex: 1,
|
|
66
|
+
display: 'flex',
|
|
67
|
+
flexDirection: 'column',
|
|
68
|
+
// overflow: 'hidden',
|
|
69
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
70
|
+
flex: 1,
|
|
71
|
+
display: 'flex',
|
|
72
|
+
flexDirection: 'column',
|
|
73
|
+
marginTop: 8,
|
|
74
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
75
|
+
gap: 16,
|
|
76
|
+
display: 'flex',
|
|
77
|
+
flexDirection: 'column',
|
|
78
|
+
flex: 1,
|
|
79
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, display: 'flex', minHeight: 300 }, children: (0, jsx_runtime_1.jsx)(DataGrid_1.GridTableContainer, { disableColumnSort: true, disableColumnFilter: true, disableSelection: true, disableContextMenu: true }) }) }) }) })] }));
|
|
80
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TableWidgetExperience } from '@headless-adminapp/core/experience/insights';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface WidgetTableContainerProps {
|
|
4
|
+
content: TableWidgetExperience;
|
|
5
|
+
}
|
|
6
|
+
export declare const WidgetTableContainer: FC<WidgetTableContainerProps>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetTableContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const utils_1 = require("@headless-adminapp/app/utils");
|
|
7
|
+
const BodyLoading_1 = require("../components/BodyLoading");
|
|
8
|
+
const useWidgetDetail_1 = require("./hooks/useWidgetDetail");
|
|
9
|
+
const WidgetTitleBar_1 = require("./WidgetTitleBar");
|
|
10
|
+
const WidgetTableContainer = ({ content, }) => {
|
|
11
|
+
const { transformedCommands, dataset, isPending, isFetching, widget } = (0, useWidgetDetail_1.useWidgetDetail)(content);
|
|
12
|
+
const info = content.table;
|
|
13
|
+
const data = dataset[0];
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
flex: 1,
|
|
17
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
18
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
19
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
20
|
+
flexDirection: 'column',
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
}, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: widget.title, commands: transformedCommands }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, position: 'relative', overflow: 'auto' }, children: [!isPending && ((0, jsx_runtime_1.jsxs)(react_components_1.Table, { style: {
|
|
23
|
+
borderCollapse: 'collapse',
|
|
24
|
+
width: '100%',
|
|
25
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_components_1.TableHeader, { style: {
|
|
26
|
+
position: 'sticky',
|
|
27
|
+
top: 0,
|
|
28
|
+
background: react_components_1.tokens.colorNeutralBackground3,
|
|
29
|
+
zIndex: 2,
|
|
30
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.TableRow, { style: {
|
|
31
|
+
position: 'sticky',
|
|
32
|
+
top: 0,
|
|
33
|
+
minWidth: 'calc(100% - 16px)',
|
|
34
|
+
}, children: info.columns.map((column, index) => {
|
|
35
|
+
const attribute = info.attributes[column];
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.TableHeaderCell, { style: {
|
|
37
|
+
minWidth: 32,
|
|
38
|
+
flexShrink: 0,
|
|
39
|
+
flex: 1,
|
|
40
|
+
position: 'sticky',
|
|
41
|
+
background: react_components_1.tokens.colorNeutralBackground3,
|
|
42
|
+
borderBottom: `${react_components_1.tokens.strokeWidthThin} solid ${react_components_1.tokens.colorNeutralStroke3}`,
|
|
43
|
+
}, children: attribute.label }, column + String(index)));
|
|
44
|
+
}) }) }), (0, jsx_runtime_1.jsx)(react_components_1.TableBody, { children: data.map((row, index) => ((0, jsx_runtime_1.jsx)(react_components_1.TableRow, { children: info.columns.map((column) => {
|
|
45
|
+
const attribute = info.attributes[column];
|
|
46
|
+
const value = row[column];
|
|
47
|
+
const formattedValue = (0, utils_1.getAttributeFormattedValue)(attribute, value) ?? '';
|
|
48
|
+
switch (attribute?.type) {
|
|
49
|
+
case 'money':
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.TableCell, { children: formattedValue }, column));
|
|
51
|
+
case 'lookup':
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return (0, jsx_runtime_1.jsx)(react_components_1.TableCell, { children: formattedValue }, column);
|
|
55
|
+
}) }, index))) })] })), (0, jsx_runtime_1.jsx)(BodyLoading_1.BodyLoading, { loading: isFetching })] })] }));
|
|
56
|
+
};
|
|
57
|
+
exports.WidgetTableContainer = WidgetTableContainer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TileWidgetExperience } from '@headless-adminapp/core/experience/insights';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
interface WidgetTileContainerProps {
|
|
4
|
+
content: TileWidgetExperience;
|
|
5
|
+
}
|
|
6
|
+
export declare const WidgetTileContainer: FC<WidgetTileContainerProps>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidgetTileContainer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const useWidgetDetail_1 = require("./hooks/useWidgetDetail");
|
|
7
|
+
const WidgetTitleBar_1 = require("./WidgetTitleBar");
|
|
8
|
+
const WidgetTileContainer = ({ content, }) => {
|
|
9
|
+
const { transformedCommands, widget } = (0, useWidgetDetail_1.useWidgetDetail)(content);
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flex: 1,
|
|
13
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
14
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
15
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
16
|
+
flexDirection: 'column',
|
|
17
|
+
}, children: [(0, jsx_runtime_1.jsx)(WidgetTitleBar_1.WidgetTitleBar, { title: widget.title, commands: transformedCommands }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
18
|
+
flex: 1,
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
paddingInline: 16,
|
|
22
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Title2, { children: "Not supported yet" }) }) })] }));
|
|
23
|
+
};
|
|
24
|
+
exports.WidgetTileContainer = WidgetTileContainer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CommandItemState } from '@headless-adminapp/app/command';
|
|
2
|
+
interface WidgetTitleBarProps {
|
|
3
|
+
title: string;
|
|
4
|
+
commands: CommandItemState[][];
|
|
5
|
+
}
|
|
6
|
+
export declare function WidgetTitleBar({ title, commands }: WidgetTitleBarProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
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.WidgetTitleBar = WidgetTitleBar;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
9
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
|
+
const CommandBar_1 = __importDefault(require("../CommandBar"));
|
|
11
|
+
const OverflowCommandBar_1 = require("../OverflowCommandBar");
|
|
12
|
+
function WidgetTitleBar({ title, commands }) {
|
|
13
|
+
const { language } = (0, locale_1.useLocale)();
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
paddingInline: 16,
|
|
17
|
+
paddingBlock: 8,
|
|
18
|
+
height: 40,
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Body1Strong, { children: title }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), commands?.[0]?.length > 0 && ((0, jsx_runtime_1.jsx)("div", { style: { marginRight: -20 }, children: (0, jsx_runtime_1.jsx)(CommandBar_1.default.Wrapper, { children: commands[0].map((command, index) => (0, OverflowCommandBar_1.renderCommandItem)(index, command, language)) }) }))] }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }) })] }));
|
|
21
|
+
}
|