@headless-adminapp/fluent 0.0.17-alpha.7 → 1.0.0
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 +22 -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 +35 -37
- 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 +30 -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 +42 -22
- 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 +15 -3
- package/form/controls/DateRangeControl.js +4 -6
- package/form/controls/DateTimeControl.d.ts +1 -1
- package/form/controls/DateTimeControl.js +107 -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
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.generateValidationSchema = exports.formValidator = void 0;
|
|
27
|
+
const utils_1 = require("@headless-adminapp/app/dataform/utils");
|
|
28
|
+
const yup_1 = require("@hookform/resolvers/yup");
|
|
29
|
+
const lodash_1 = require("lodash");
|
|
30
|
+
const yup = __importStar(require("yup"));
|
|
31
|
+
// TODO: refactor duplicate code
|
|
32
|
+
exports.formValidator = (0, lodash_1.memoize)(function formValidator({ attributes, language, strings, region, }) {
|
|
33
|
+
return async (values, context, options) => {
|
|
34
|
+
const validator = (0, exports.generateValidationSchema)({
|
|
35
|
+
attributes,
|
|
36
|
+
language,
|
|
37
|
+
strings,
|
|
38
|
+
region,
|
|
39
|
+
});
|
|
40
|
+
const resolver = (0, yup_1.yupResolver)(validator);
|
|
41
|
+
const result = await resolver(values, context, options);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
}, (options) => JSON.stringify(options));
|
|
45
|
+
exports.generateValidationSchema = (0, lodash_1.memoize)(function generateValidationSchema({ attributes, language, strings, region, }) {
|
|
46
|
+
const columns = Object.keys(attributes);
|
|
47
|
+
return yup.object().shape({
|
|
48
|
+
...columns.reduce((acc, column) => {
|
|
49
|
+
const attribute = attributes[column];
|
|
50
|
+
const validationSchema = (0, utils_1.generateAttributeValidationSchema)(attribute, language, strings, region);
|
|
51
|
+
return {
|
|
52
|
+
...acc,
|
|
53
|
+
[column]: validationSchema,
|
|
54
|
+
};
|
|
55
|
+
}, {}),
|
|
56
|
+
});
|
|
57
|
+
}, (options) => JSON.stringify(options));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InferredSchemaType, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
3
|
+
interface HeaderProps<SA extends SchemaAttributes = SchemaAttributes> {
|
|
4
|
+
filterForm: UseFormReturn<InferredSchemaType<SA>, unknown, undefined>;
|
|
5
|
+
onCreateButtonClick: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function Header<SA extends SchemaAttributes = SchemaAttributes>({ filterForm, onCreateButtonClick, }: Readonly<HeaderProps<SA>>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Header = Header;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const useConfig_1 = require("@headless-adminapp/app/calendar/hooks/useConfig");
|
|
7
|
+
const icons_fluent_1 = require("@headless-adminapp/icons-fluent");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
10
|
+
const StandardControl_1 = require("../PageEntityForm/StandardControl");
|
|
11
|
+
function Header({ filterForm, onCreateButtonClick, }) {
|
|
12
|
+
const config = (0, useConfig_1.useConfig)();
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexDirection: 'column',
|
|
16
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
17
|
+
borderRadius: react_components_1.tokens.borderRadiusLarge,
|
|
18
|
+
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
19
|
+
paddingInline: react_components_1.tokens.spacingHorizontalM,
|
|
20
|
+
gap: react_components_1.tokens.spacingVerticalS,
|
|
21
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
22
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
gap: react_components_1.tokens.spacingHorizontalM,
|
|
26
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { 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: config.title }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground2 }, children: config.description })] }) }) }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
27
|
+
display: 'flex',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
gap: react_components_1.tokens.spacingHorizontalS,
|
|
30
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { style: { fontWeight: react_components_1.tokens.fontWeightMedium }, icon: (0, jsx_runtime_1.jsx)(icons_fluent_1.iconSet.Add, {}), appearance: "primary", onClick: onCreateButtonClick, children: "Create" }) })] }), !!config.filterAttributes && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: react_components_1.tokens.spacingHorizontalS }, children: Object.entries(config.filterAttributes).map(([attributeName, attribute]) => {
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: filterForm.control, name: attributeName, render: ({ field }) => {
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(StandardControl_1.StandardControl, { attribute: attribute, name: attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur }) }));
|
|
33
|
+
} }, attributeName));
|
|
34
|
+
}) })] }))] }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CalendarConfig } from '@headless-adminapp/app/calendar/types';
|
|
2
|
+
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
3
|
+
interface PageCalendarProps<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes> {
|
|
4
|
+
config: CalendarConfig<SA1, SA2, SA3>;
|
|
5
|
+
}
|
|
6
|
+
export declare function PageCalendar<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes>(props: Readonly<PageCalendarProps<SA1, SA2, SA3>>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.PageCalendar = PageCalendar;
|
|
30
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
32
|
+
const auth_1 = require("@headless-adminapp/app/auth");
|
|
33
|
+
const context_1 = require("@headless-adminapp/app/calendar/context");
|
|
34
|
+
const dialog_1 = require("@headless-adminapp/app/dialog");
|
|
35
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
36
|
+
const progress_indicator_1 = require("@headless-adminapp/app/progress-indicator");
|
|
37
|
+
const toast_notification_1 = require("@headless-adminapp/app/toast-notification");
|
|
38
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
39
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
40
|
+
const isoWeek_1 = __importDefault(require("dayjs/plugin/isoWeek"));
|
|
41
|
+
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
42
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
43
|
+
const react_1 = require("react");
|
|
44
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
45
|
+
const EventDialog_1 = require("./EventDialog/EventDialog");
|
|
46
|
+
const Header_1 = require("./Header");
|
|
47
|
+
const types_1 = require("./types");
|
|
48
|
+
const utils_1 = require("./utils");
|
|
49
|
+
const CalendarSection = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./CalendarSection'))).then((mod) => ({ default: mod.CalendarSection })));
|
|
50
|
+
dayjs_1.default.extend(utc_1.default);
|
|
51
|
+
dayjs_1.default.extend(timezone_1.default);
|
|
52
|
+
dayjs_1.default.extend(isoWeek_1.default);
|
|
53
|
+
function PageCalendar(props) {
|
|
54
|
+
const contextValue = (0, mutable_1.useCreateContextStore)({
|
|
55
|
+
config: props.config,
|
|
56
|
+
});
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
contextValue.setValue({
|
|
59
|
+
config: props.config,
|
|
60
|
+
});
|
|
61
|
+
}, [contextValue, props.config]);
|
|
62
|
+
const config = props.config;
|
|
63
|
+
const openDialog = (0, dialog_1.useOpenDialog)();
|
|
64
|
+
const openConfirmDialog = (0, dialog_1.useOpenConfirmDialog)();
|
|
65
|
+
const openToastNotification = (0, toast_notification_1.useOpenToastNotification)();
|
|
66
|
+
const { hideProgressIndicator, showProgressIndicator } = (0, progress_indicator_1.useProgressIndicator)();
|
|
67
|
+
const [activeStartDate, setActiveStartDate] = (0, react_1.useState)(null);
|
|
68
|
+
const [activeEndDate, setActiveEndDate] = (0, react_1.useState)(null);
|
|
69
|
+
const [currentStartDate, setCurrentStartDate] = (0, react_1.useState)(null);
|
|
70
|
+
const [currentEndDate, setCurrentEndDate] = (0, react_1.useState)(null);
|
|
71
|
+
const [viewType, setViewType] = (0, react_1.useState)(types_1.ViewType.Month);
|
|
72
|
+
const queryClient = (0, react_query_1.useQueryClient)();
|
|
73
|
+
const filterForm = (0, react_hook_form_1.useForm)({
|
|
74
|
+
mode: 'all',
|
|
75
|
+
defaultValues: config.defaultFilter,
|
|
76
|
+
shouldUnregister: false,
|
|
77
|
+
});
|
|
78
|
+
const filterValues = filterForm.watch();
|
|
79
|
+
const auth = (0, auth_1.useAuthSession)();
|
|
80
|
+
const { data: events, isPending: loading } = (0, react_query_1.useQuery)({
|
|
81
|
+
queryKey: [
|
|
82
|
+
'calendar-events',
|
|
83
|
+
'list',
|
|
84
|
+
activeStartDate,
|
|
85
|
+
activeEndDate,
|
|
86
|
+
filterValues,
|
|
87
|
+
auth,
|
|
88
|
+
],
|
|
89
|
+
queryFn: async () => {
|
|
90
|
+
if (!activeStartDate || !activeEndDate) {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
const result = await config.eventsResolver({
|
|
95
|
+
start: activeStartDate,
|
|
96
|
+
end: activeEndDate,
|
|
97
|
+
filter: filterValues,
|
|
98
|
+
auth,
|
|
99
|
+
});
|
|
100
|
+
return result.map(utils_1.transformEvent);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
openToastNotification({
|
|
104
|
+
title: 'Error',
|
|
105
|
+
text: error.message,
|
|
106
|
+
type: 'error',
|
|
107
|
+
});
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
112
|
+
});
|
|
113
|
+
function openEventDetailModel(values) {
|
|
114
|
+
const { close } = openDialog({
|
|
115
|
+
type: 'custom',
|
|
116
|
+
Component: EventDialog_1.EventDialog,
|
|
117
|
+
props: {
|
|
118
|
+
onDismiss: () => {
|
|
119
|
+
close();
|
|
120
|
+
},
|
|
121
|
+
config,
|
|
122
|
+
values,
|
|
123
|
+
onSubmit: async (data) => {
|
|
124
|
+
try {
|
|
125
|
+
const { id, end, start, title, allDay, description, ...rest } = data.values;
|
|
126
|
+
await config.saveEvent({
|
|
127
|
+
event: {
|
|
128
|
+
id,
|
|
129
|
+
title,
|
|
130
|
+
start: start ? new Date(start) : null,
|
|
131
|
+
end: end ? new Date(end) : null,
|
|
132
|
+
allDay: allDay ?? false,
|
|
133
|
+
description,
|
|
134
|
+
...rest,
|
|
135
|
+
},
|
|
136
|
+
modifiedValues: data.modifiedValues,
|
|
137
|
+
});
|
|
138
|
+
await queryClient.invalidateQueries({
|
|
139
|
+
queryKey: ['calendar-events'],
|
|
140
|
+
});
|
|
141
|
+
close();
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
openToastNotification({
|
|
145
|
+
title: 'Error',
|
|
146
|
+
text: error.message,
|
|
147
|
+
type: 'error',
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
onDelete: async (id) => {
|
|
152
|
+
try {
|
|
153
|
+
const confirmResult = await openConfirmDialog({
|
|
154
|
+
title: 'Delete Event',
|
|
155
|
+
text: 'Are you sure you want to delete this event?',
|
|
156
|
+
});
|
|
157
|
+
if (!confirmResult?.confirmed) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
showProgressIndicator('Deleting event...');
|
|
161
|
+
await config.deleteEvent(id);
|
|
162
|
+
await queryClient.invalidateQueries({
|
|
163
|
+
queryKey: ['calendar-events'],
|
|
164
|
+
});
|
|
165
|
+
close();
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
openToastNotification({
|
|
169
|
+
title: 'Error',
|
|
170
|
+
text: error.message,
|
|
171
|
+
type: 'error',
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
hideProgressIndicator();
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
allowOpenRecord: !!config.openRecord,
|
|
179
|
+
onOpenRecord: config.openRecord,
|
|
180
|
+
onCancel: () => {
|
|
181
|
+
close();
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
function handleDateSelect(selectInfo) {
|
|
187
|
+
openEventDetailModel({
|
|
188
|
+
title: '',
|
|
189
|
+
start: selectInfo.start.toISOString(),
|
|
190
|
+
end: selectInfo.end.toISOString(),
|
|
191
|
+
allDay: selectInfo.allDay,
|
|
192
|
+
customer: null,
|
|
193
|
+
description: '',
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
function handleEventClick(clickInfo) {
|
|
197
|
+
openEventDetailModel({
|
|
198
|
+
id: clickInfo.event.id,
|
|
199
|
+
title: clickInfo.event.title,
|
|
200
|
+
start: clickInfo.event.start?.toISOString(),
|
|
201
|
+
end: clickInfo.event.end?.toISOString(),
|
|
202
|
+
allDay: clickInfo.event.allDay,
|
|
203
|
+
description: '',
|
|
204
|
+
...clickInfo.event.extendedProps,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function handleCreateButtonClick() {
|
|
208
|
+
openEventDetailModel({
|
|
209
|
+
title: '',
|
|
210
|
+
start: null,
|
|
211
|
+
end: null,
|
|
212
|
+
allDay: false,
|
|
213
|
+
description: '',
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
const onRangeChange = ({ currentStart, currentEnd, activeStart, activeEnd, viewType, }) => {
|
|
217
|
+
setCurrentStartDate(currentStart);
|
|
218
|
+
setCurrentEndDate(currentEnd);
|
|
219
|
+
setActiveStartDate(activeStart);
|
|
220
|
+
setActiveEndDate(activeEnd);
|
|
221
|
+
setViewType(viewType);
|
|
222
|
+
};
|
|
223
|
+
return ((0, jsx_runtime_1.jsx)(context_1.CalendarContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
224
|
+
display: 'flex',
|
|
225
|
+
flexDirection: 'column',
|
|
226
|
+
flex: 1,
|
|
227
|
+
gap: react_components_1.tokens.spacingVerticalM,
|
|
228
|
+
padding: react_components_1.tokens.spacingHorizontalL,
|
|
229
|
+
background: react_components_1.tokens.colorNeutralBackground3,
|
|
230
|
+
}, children: [(0, jsx_runtime_1.jsx)(Header_1.Header, { filterForm: filterForm, onCreateButtonClick: handleCreateButtonClick }), (0, jsx_runtime_1.jsx)(CalendarSection, { startDate: currentStartDate, endDate: currentEndDate, viewType: viewType, onRangeChange: onRangeChange, events: events ?? [], onEventClick: handleEventClick, onDateSelect: handleDateSelect, loading: loading })] }) }));
|
|
231
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ViewType } from './types';
|
|
3
|
+
interface TitleSelectorProps {
|
|
4
|
+
start?: Date | null;
|
|
5
|
+
end?: Date | null;
|
|
6
|
+
viewType: ViewType;
|
|
7
|
+
onChange: (start: Date, end: Date) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const TitleSelector: FC<TitleSelectorProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
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.TitleSelector = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_calendar_compat_1 = require("@fluentui/react-calendar-compat");
|
|
9
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
10
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
11
|
+
const icons_fluent_1 = require("@headless-adminapp/icons-fluent");
|
|
12
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
13
|
+
const isoWeek_1 = __importDefault(require("dayjs/plugin/isoWeek"));
|
|
14
|
+
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
15
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
16
|
+
const react_1 = require("react");
|
|
17
|
+
const types_1 = require("./types");
|
|
18
|
+
dayjs_1.default.extend(utc_1.default);
|
|
19
|
+
dayjs_1.default.extend(timezone_1.default);
|
|
20
|
+
dayjs_1.default.extend(isoWeek_1.default);
|
|
21
|
+
const TitleSelector = ({ start, end, onChange, viewType, }) => {
|
|
22
|
+
const { timezone } = (0, locale_1.useLocale)();
|
|
23
|
+
const label = (0, react_1.useMemo)(() => {
|
|
24
|
+
if (!start || !end) {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
switch (viewType) {
|
|
28
|
+
case types_1.ViewType.Day:
|
|
29
|
+
return (0, dayjs_1.default)(start).format('MMM D, YYYY');
|
|
30
|
+
case types_1.ViewType.Week:
|
|
31
|
+
return `${(0, dayjs_1.default)(start).format('MMM D')} - ${(0, dayjs_1.default)(end).format('MMM D, YYYY')}`;
|
|
32
|
+
case types_1.ViewType.Month:
|
|
33
|
+
return (0, dayjs_1.default)(start).format('MMMM YYYY');
|
|
34
|
+
}
|
|
35
|
+
return '';
|
|
36
|
+
}, [start, end, viewType]);
|
|
37
|
+
if (!start || !end) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(react_components_1.Popover, { positioning: "below", children: [(0, jsx_runtime_1.jsx)(react_components_1.PopoverTrigger, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "subtle", style: {
|
|
41
|
+
fontWeight: react_components_1.tokens.fontWeightMedium,
|
|
42
|
+
fontSize: react_components_1.tokens.fontSizeBase400,
|
|
43
|
+
}, icon: (0, jsx_runtime_1.jsx)(icons_fluent_1.iconSet.ChevronDown, { size: 16 }), iconPosition: "after", children: label }) }), (0, jsx_runtime_1.jsxs)(react_components_1.PopoverSurface, { tabIndex: -1, style: { padding: 0 }, children: [viewType === types_1.ViewType.Month && ((0, jsx_runtime_1.jsx)(react_calendar_compat_1.Calendar, { dateRangeType: react_calendar_compat_1.DateRangeType.Month, highlightSelectedMonth: true, isDayPickerVisible: false, value: start ? (0, dayjs_1.default)(start).toDate() : new Date(), onSelectDate: (date) => {
|
|
44
|
+
const start = (0, dayjs_1.default)(date)
|
|
45
|
+
.tz(timezone, true)
|
|
46
|
+
.startOf('month')
|
|
47
|
+
.toDate();
|
|
48
|
+
const end = (0, dayjs_1.default)(date)
|
|
49
|
+
.tz(timezone, true)
|
|
50
|
+
.endOf('month')
|
|
51
|
+
.toDate();
|
|
52
|
+
onChange(start, end);
|
|
53
|
+
} })), viewType === types_1.ViewType.Week && ((0, jsx_runtime_1.jsx)(react_calendar_compat_1.Calendar, { dateRangeType: react_calendar_compat_1.DateRangeType.Week, firstDayOfWeek: 1, value: start ? (0, dayjs_1.default)(start).toDate() : new Date(), onSelectDate: (date) => {
|
|
54
|
+
const start = (0, dayjs_1.default)(date)
|
|
55
|
+
.tz(timezone, true)
|
|
56
|
+
.startOf('isoWeek')
|
|
57
|
+
.toDate();
|
|
58
|
+
const end = (0, dayjs_1.default)(date)
|
|
59
|
+
.tz(timezone, true)
|
|
60
|
+
.endOf('isoWeek')
|
|
61
|
+
.toDate();
|
|
62
|
+
onChange(start, end);
|
|
63
|
+
} })), viewType === types_1.ViewType.Day && ((0, jsx_runtime_1.jsx)(react_calendar_compat_1.Calendar, { dateRangeType: react_calendar_compat_1.DateRangeType.Day, firstDayOfWeek: 1, value: start ? (0, dayjs_1.default)(start).toDate() : new Date(), onSelectDate: (date) => {
|
|
64
|
+
console.log('d', date);
|
|
65
|
+
const start = (0, dayjs_1.default)(date)
|
|
66
|
+
.tz(timezone, true)
|
|
67
|
+
.startOf('day')
|
|
68
|
+
.toDate();
|
|
69
|
+
const end = (0, dayjs_1.default)(date).tz(timezone, true).endOf('day').toDate();
|
|
70
|
+
onChange(start, end);
|
|
71
|
+
} }))] })] }));
|
|
72
|
+
};
|
|
73
|
+
exports.TitleSelector = TitleSelector;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewSelector = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const types_1 = require("./types");
|
|
8
|
+
const viewItems = [
|
|
9
|
+
{
|
|
10
|
+
label: 'Month',
|
|
11
|
+
value: types_1.ViewType.Month,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
label: 'Week',
|
|
15
|
+
value: types_1.ViewType.Week,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: 'Day',
|
|
19
|
+
value: types_1.ViewType.Day,
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
23
|
+
root: {},
|
|
24
|
+
button: {
|
|
25
|
+
'&:not(:first-of-type)': {
|
|
26
|
+
// borderLeftWidth: 0,
|
|
27
|
+
borderTopLeftRadius: 0,
|
|
28
|
+
borderBottomLeftRadius: 0,
|
|
29
|
+
},
|
|
30
|
+
'&:not(:last-of-type)': {
|
|
31
|
+
borderRightWidth: 0,
|
|
32
|
+
borderTopRightRadius: 0,
|
|
33
|
+
borderBottomRightRadius: 0,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
active: {
|
|
37
|
+
'&+button': {
|
|
38
|
+
borderLeftColor: 'transparent !important',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
const ViewSelector = ({ viewType, onChange }) => {
|
|
43
|
+
const styles = useStyles();
|
|
44
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
45
|
+
display: 'inline-flex',
|
|
46
|
+
overflow: 'hidden',
|
|
47
|
+
}, className: styles.root, children: viewItems.map((item) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_components_1.Button, { className: (0, react_components_1.mergeClasses)(styles.button, item.value === viewType && styles.active), appearance: item.value === viewType ? 'primary' : 'secondary', onClick: () => onChange(item.value), style: {
|
|
48
|
+
fontWeight: react_components_1.tokens.fontWeightRegular,
|
|
49
|
+
minWidth: 60,
|
|
50
|
+
}, children: item.label }, item.value) }, item.value))) }));
|
|
51
|
+
};
|
|
52
|
+
exports.ViewSelector = ViewSelector;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const baseEventAttributes: {
|
|
2
|
+
id: {
|
|
3
|
+
type: "id";
|
|
4
|
+
label: string;
|
|
5
|
+
string: true;
|
|
6
|
+
};
|
|
7
|
+
title: {
|
|
8
|
+
type: "string";
|
|
9
|
+
format: "text";
|
|
10
|
+
label: string;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
start: {
|
|
14
|
+
type: "date";
|
|
15
|
+
format: "datetime";
|
|
16
|
+
label: string;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
end: {
|
|
20
|
+
type: "date";
|
|
21
|
+
format: "datetime";
|
|
22
|
+
label: string;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
allDay: {
|
|
26
|
+
type: "boolean";
|
|
27
|
+
label: string;
|
|
28
|
+
};
|
|
29
|
+
description: {
|
|
30
|
+
type: "string";
|
|
31
|
+
format: "textarea";
|
|
32
|
+
label: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type BaseEventAttributes = typeof baseEventAttributes;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.baseEventAttributes = void 0;
|
|
4
|
+
const utils_1 = require("@headless-adminapp/core/schema/utils");
|
|
5
|
+
exports.baseEventAttributes = (0, utils_1.defineSchemaAttributes)({
|
|
6
|
+
id: {
|
|
7
|
+
type: 'id',
|
|
8
|
+
label: 'ID',
|
|
9
|
+
string: true,
|
|
10
|
+
},
|
|
11
|
+
title: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
format: 'text',
|
|
14
|
+
label: 'Title',
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
start: {
|
|
18
|
+
type: 'date',
|
|
19
|
+
format: 'datetime',
|
|
20
|
+
label: 'Start',
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
end: {
|
|
24
|
+
type: 'date',
|
|
25
|
+
format: 'datetime',
|
|
26
|
+
label: 'End',
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
allDay: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
label: 'All day',
|
|
32
|
+
},
|
|
33
|
+
description: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
format: 'textarea',
|
|
36
|
+
label: 'Description',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { InferredSchemaType, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import { CalendarEventResolverFn, CalendarEventSaveFn, CalendarEventsResolverFn } from './types';
|
|
3
|
+
export interface CalendarConfig<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes> {
|
|
4
|
+
eventsResolver: CalendarEventsResolverFn<SA3>;
|
|
5
|
+
eventResolver?: CalendarEventResolverFn;
|
|
6
|
+
saveEvent: CalendarEventSaveFn<SA1, SA2>;
|
|
7
|
+
beforeDescriptionAttributes?: SA1;
|
|
8
|
+
afterDescriptionAttributes?: SA2;
|
|
9
|
+
filterAttributes?: SA3;
|
|
10
|
+
defaultFilter?: InferredSchemaType<SA3>;
|
|
11
|
+
openRecord?: (id: string) => void;
|
|
12
|
+
deleteEvent: (id: string) => Promise<void>;
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
eventLabel: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CalendarContextState<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes> {
|
|
18
|
+
config: CalendarConfig<SA1, SA2, SA3>;
|
|
19
|
+
}
|
|
20
|
+
export declare const CalendarContext: import("react").Context<import("@headless-adminapp/app/mutable").ContextValue<CalendarContextState<SchemaAttributes, SchemaAttributes, SchemaAttributes>>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useConfig';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useConfig"), exports);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import { CalendarConfig } from '../context';
|
|
3
|
+
export declare function useConfig<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes>(): CalendarConfig<SA1, SA2, SA3>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useConfig = useConfig;
|
|
4
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useConfig() {
|
|
7
|
+
return (0, mutable_1.useContextSelector)(context_1.CalendarContext, (state) => state.config);
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PageCalendar } from './PageCalendar';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PageCalendar = void 0;
|
|
4
|
+
var PageCalendar_1 = require("./PageCalendar");
|
|
5
|
+
Object.defineProperty(exports, "PageCalendar", { enumerable: true, get: function () { return PageCalendar_1.PageCalendar; } });
|