@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,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormSection = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
// import { Divider, Flex, Grid, Paper, Stack, Text } from '@mantine/core';
|
|
6
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
7
|
+
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const FormSectionColumn_1 = require("./FormSectionColumn");
|
|
10
|
+
const FormSectionLoading_1 = require("./FormSectionLoading");
|
|
11
|
+
function determineItemCount(availableWidth, itemWidth, gap, padding) {
|
|
12
|
+
return Math.floor((availableWidth + gap - 2 * padding) / (itemWidth + gap));
|
|
13
|
+
}
|
|
14
|
+
const FormSection = ({ title, children, columnCount, fullHeight, labelPosition, noPadding, hideLabel, }) => {
|
|
15
|
+
// const columnCount = 2;
|
|
16
|
+
const divRef = (0, react_1.useRef)(null);
|
|
17
|
+
const divSize = (0, hooks_1.useElementSize)(divRef, 100);
|
|
18
|
+
const minControlWidth = labelPosition === 'top' ? 200 : 360;
|
|
19
|
+
const gap = 12;
|
|
20
|
+
const padding = noPadding ? 0 : 16;
|
|
21
|
+
let itemCount = determineItemCount(divSize.width, minControlWidth, gap, padding);
|
|
22
|
+
if (!columnCount) {
|
|
23
|
+
itemCount = 1;
|
|
24
|
+
}
|
|
25
|
+
else if (itemCount > columnCount) {
|
|
26
|
+
itemCount = columnCount;
|
|
27
|
+
}
|
|
28
|
+
if (itemCount < 1) {
|
|
29
|
+
itemCount = 1;
|
|
30
|
+
}
|
|
31
|
+
if (itemCount > 4) {
|
|
32
|
+
itemCount = 4;
|
|
33
|
+
}
|
|
34
|
+
if (itemCount === 3) {
|
|
35
|
+
itemCount = 2;
|
|
36
|
+
}
|
|
37
|
+
const template1 = Array.from({ length: itemCount })
|
|
38
|
+
.map(() => '1fr')
|
|
39
|
+
.join(' ');
|
|
40
|
+
const template2 = '';
|
|
41
|
+
const minWidthRequired = minControlWidth * (columnCount !== null && columnCount !== void 0 ? columnCount : 1) +
|
|
42
|
+
gap * ((columnCount !== null && columnCount !== void 0 ? columnCount : 1) - 1) +
|
|
43
|
+
padding * 2;
|
|
44
|
+
const template = divSize.width >= minWidthRequired ? template1 : template2;
|
|
45
|
+
const spanTemplates = {
|
|
46
|
+
'--section-item-span-1': 'span 1',
|
|
47
|
+
'--section-item-span-2': 'span 2',
|
|
48
|
+
'--section-item-span-4': 'span 4',
|
|
49
|
+
'--section-item-spacer-1': 'block',
|
|
50
|
+
'--section-item-spacer-2': 'block',
|
|
51
|
+
'--section-item-spacer-4': 'none',
|
|
52
|
+
};
|
|
53
|
+
if (itemCount === 2) {
|
|
54
|
+
spanTemplates['--section-item-span-4'] = 'span 2';
|
|
55
|
+
spanTemplates['--section-item-spacer-2'] = 'none';
|
|
56
|
+
}
|
|
57
|
+
else if (itemCount === 1) {
|
|
58
|
+
spanTemplates['--section-item-span-2'] = 'span 1';
|
|
59
|
+
spanTemplates['--section-item-span-4'] = 'span 1';
|
|
60
|
+
spanTemplates['--section-item-spacer-1'] = 'none';
|
|
61
|
+
spanTemplates['--section-item-spacer-2'] = 'none';
|
|
62
|
+
}
|
|
63
|
+
// console.log('fsmm', divSize.width, minWidthRequired);
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: divRef, style: {
|
|
65
|
+
boxShadow: react_components_1.tokens.shadow2,
|
|
66
|
+
borderRadius: react_components_1.tokens.borderRadiusMedium,
|
|
67
|
+
background: react_components_1.tokens.colorNeutralBackground1,
|
|
68
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { children: [!hideLabel && !!title && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
69
|
+
display: 'flex',
|
|
70
|
+
paddingInline: 16,
|
|
71
|
+
paddingBlock: 8,
|
|
72
|
+
height: 40,
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
}, 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 } })] }) }), (0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } })] })), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
75
|
+
flex: 1,
|
|
76
|
+
display: 'flex',
|
|
77
|
+
flexDirection: 'column',
|
|
78
|
+
padding,
|
|
79
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: Object.assign({ flex: 1, display: 'grid', gridTemplateColumns: template, rowGap: gap, columnGap: gap }, spanTemplates), children: children }) })] }) }));
|
|
80
|
+
};
|
|
81
|
+
exports.FormSection = FormSection;
|
|
82
|
+
exports.FormSection.Column = FormSectionColumn_1.FormSectionColumn;
|
|
83
|
+
exports.FormSection.Loading = FormSectionLoading_1.FormSectionLoading;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormSectionColumn = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const FormSectionColumn = ({ children, span }) => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", {
|
|
7
|
+
// md={span}
|
|
8
|
+
// xs={12}
|
|
9
|
+
style: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
gap: 16,
|
|
13
|
+
}, children: children }));
|
|
14
|
+
};
|
|
15
|
+
exports.FormSectionColumn = FormSectionColumn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormSection } from './FormSection';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormSection = void 0;
|
|
4
|
+
var FormSection_1 = require("./FormSection");
|
|
5
|
+
Object.defineProperty(exports, "FormSection", { enumerable: true, get: function () { return FormSection_1.FormSection; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { FormTabColumn } from './FormTabColumn';
|
|
3
|
+
interface FormTabProps {
|
|
4
|
+
value: string;
|
|
5
|
+
fullHeight?: boolean;
|
|
6
|
+
columnCount?: number;
|
|
7
|
+
columnWidths?: Array<number | string | [number, number | string]>;
|
|
8
|
+
noWrapper?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const FormTab: FC<PropsWithChildren<FormTabProps>> & {
|
|
11
|
+
Column: typeof FormTabColumn;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormTab = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
6
|
+
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
7
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const FormTabColumn_1 = require("./FormTabColumn");
|
|
10
|
+
function determineItemCount(availableWidth, itemWidth, gap, padding) {
|
|
11
|
+
return Math.floor((availableWidth + gap - 2 * padding) / (itemWidth + gap));
|
|
12
|
+
}
|
|
13
|
+
const FormTab = (props) => {
|
|
14
|
+
const divRef = (0, react_1.useRef)(null);
|
|
15
|
+
const activeTab = (0, mutable_1.useContextSelector)(dataform_1.DataFormContext, (state) => state.activeTab);
|
|
16
|
+
const divSize = (0, hooks_1.useElementSize)(divRef);
|
|
17
|
+
if (activeTab !== props.value) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
if (props.noWrapper) {
|
|
21
|
+
return props.children;
|
|
22
|
+
}
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(FormTabInternal, Object.assign({}, props));
|
|
24
|
+
};
|
|
25
|
+
exports.FormTab = FormTab;
|
|
26
|
+
/** @todo: unfinished component */
|
|
27
|
+
const FormTabInternal = ({ children, value, fullHeight, columnCount, columnWidths, }) => {
|
|
28
|
+
const divRef = (0, react_1.useRef)(null);
|
|
29
|
+
const divSize = (0, hooks_1.useElementSize)(divRef);
|
|
30
|
+
// console.log('dd', divSize.width);
|
|
31
|
+
const padding = 0;
|
|
32
|
+
// const columnCount = 2;
|
|
33
|
+
const minSectionWidth = 392;
|
|
34
|
+
const gap = 12;
|
|
35
|
+
// let itemCount = determineItemCount(
|
|
36
|
+
// divSize.width,
|
|
37
|
+
// minSectionWidth,
|
|
38
|
+
// gap,
|
|
39
|
+
// padding
|
|
40
|
+
// );
|
|
41
|
+
columnCount = columnCount !== null && columnCount !== void 0 ? columnCount : 1;
|
|
42
|
+
// if (itemCount > columnCount) {
|
|
43
|
+
// itemCount = columnCount;
|
|
44
|
+
// }
|
|
45
|
+
// if (itemCount < 1) {
|
|
46
|
+
// itemCount = 1;
|
|
47
|
+
// }
|
|
48
|
+
// if (itemCount > 4) {
|
|
49
|
+
// itemCount = 4;
|
|
50
|
+
// }
|
|
51
|
+
const itemCount = columnCount;
|
|
52
|
+
const template1 = columnWidths
|
|
53
|
+
? columnWidths.join(' ')
|
|
54
|
+
: Array.from({ length: itemCount })
|
|
55
|
+
.map(() => '1fr')
|
|
56
|
+
.join(' ');
|
|
57
|
+
const template2 = '';
|
|
58
|
+
const minWidthRequired = minSectionWidth * itemCount + gap * (itemCount - 1);
|
|
59
|
+
// 1 - 1 * minSectionWidth + gap * 0
|
|
60
|
+
// 2 - 2 * minSectionWidth + gap * 1
|
|
61
|
+
// 4 - 4 * minSectionWidth + gap * 3
|
|
62
|
+
// 8 - 8 * minSectionWidth + gap * 7
|
|
63
|
+
const template = divSize.width >= minWidthRequired ? template1 : template2;
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: divRef, style: {
|
|
65
|
+
display: 'flex',
|
|
66
|
+
flexDirection: 'column',
|
|
67
|
+
flex: 1,
|
|
68
|
+
// marginTop: 12,
|
|
69
|
+
// padding: 12,
|
|
70
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
71
|
+
// display: 'flex',
|
|
72
|
+
// flexWrap: 'wrap',
|
|
73
|
+
// justifyContent: 'flex-start',
|
|
74
|
+
// gap: tokens.spacingHorizontalM,
|
|
75
|
+
// marginInline: -12,
|
|
76
|
+
display: 'grid',
|
|
77
|
+
gridRowGap: 12,
|
|
78
|
+
gridColumnGap: 12,
|
|
79
|
+
gridTemplateColumns: template,
|
|
80
|
+
}, children: children }) }));
|
|
81
|
+
};
|
|
82
|
+
exports.FormTab.Column = FormTabColumn_1.FormTabColumn;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormTabColumn = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const FormTabColumn = ({ children, span: _span, }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
8
|
+
flex: 1,
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
width: '100%',
|
|
12
|
+
gap: react_components_1.tokens.spacingVerticalM,
|
|
13
|
+
}, children: children }) }));
|
|
14
|
+
};
|
|
15
|
+
exports.FormTabColumn = FormTabColumn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FormTab } from './FormTab';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormTab = exports.FormSection = exports.FormBody = void 0;
|
|
4
|
+
var FormBody_1 = require("./FormBody");
|
|
5
|
+
Object.defineProperty(exports, "FormBody", { enumerable: true, get: function () { return FormBody_1.FormBody; } });
|
|
6
|
+
// export { FormFrame } from './FormFrame';
|
|
7
|
+
// export { FormHeader } from './FormHeader';
|
|
8
|
+
var FormSection_1 = require("./FormSection");
|
|
9
|
+
Object.defineProperty(exports, "FormSection", { enumerable: true, get: function () { return FormSection_1.FormSection; } });
|
|
10
|
+
var FormTab_1 = require("./FormTab");
|
|
11
|
+
Object.defineProperty(exports, "FormTab", { enumerable: true, get: function () { return FormTab_1.FormTab; } });
|
package/form/types.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
import { CurrencyControlProps } from './controls/CurrencyControl';
|
|
3
|
+
import { DateControlProps } from './controls/DateControl';
|
|
4
|
+
import { DateTimeControlProps } from './controls/DateTimeControl';
|
|
5
|
+
import { EmailControlProps } from './controls/EmailControl';
|
|
6
|
+
import { LookupControlProps } from './controls/LookupControl';
|
|
7
|
+
import { MultiSelectControlProps } from './controls/MultiSelectControl';
|
|
8
|
+
import { MultiSelectLookupControlProps } from './controls/MultiSelectLookupControl';
|
|
9
|
+
import { NumberControlProps } from './controls/NumberControl';
|
|
10
|
+
import { PasswordControlProps } from './controls/PasswordControl';
|
|
11
|
+
import { SelectControlProps } from './controls/SelectControl';
|
|
12
|
+
import { SwitchControlProps } from './controls/SwitchControl';
|
|
13
|
+
import { TelephoneControlProps } from './controls/TelephoneControl';
|
|
14
|
+
import { TextAreaControlProps } from './controls/TextAreaControl';
|
|
15
|
+
import { TextControlProps } from './controls/TextControl';
|
|
16
|
+
import { ControlProps } from './controls/types';
|
|
17
|
+
export interface BaseFormControlProps {
|
|
18
|
+
error?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type TextFormControlProps = BaseFormControlProps & TextControlProps & {
|
|
21
|
+
type: 'text';
|
|
22
|
+
};
|
|
23
|
+
export type TextAreaFormControlProps = BaseFormControlProps & TextAreaControlProps & {
|
|
24
|
+
type: 'textarea';
|
|
25
|
+
};
|
|
26
|
+
export type TelephoneFormControlProps = BaseFormControlProps & TelephoneControlProps & {
|
|
27
|
+
type: 'telephone';
|
|
28
|
+
};
|
|
29
|
+
export type EmailFormControlProps = BaseFormControlProps & EmailControlProps & {
|
|
30
|
+
type: 'email';
|
|
31
|
+
};
|
|
32
|
+
export type PasswordFormControlProps = BaseFormControlProps & PasswordControlProps & {
|
|
33
|
+
type: 'password';
|
|
34
|
+
};
|
|
35
|
+
export type NumberFormControlProps = BaseFormControlProps & NumberControlProps & {
|
|
36
|
+
type: 'number';
|
|
37
|
+
};
|
|
38
|
+
export type CurrencyFormControlProps = BaseFormControlProps & CurrencyControlProps & {
|
|
39
|
+
type: 'currency';
|
|
40
|
+
};
|
|
41
|
+
export type DateFormControlProps = BaseFormControlProps & DateControlProps & {
|
|
42
|
+
type: 'date';
|
|
43
|
+
};
|
|
44
|
+
export type DateTimeFormControlProps = BaseFormControlProps & DateTimeControlProps & {
|
|
45
|
+
type: 'datetime';
|
|
46
|
+
};
|
|
47
|
+
export type LookupFormControlProps = BaseFormControlProps & LookupControlProps & {
|
|
48
|
+
type: 'lookup';
|
|
49
|
+
};
|
|
50
|
+
export type MultiSelectLookupsFormControlProps = BaseFormControlProps & MultiSelectLookupControlProps & {
|
|
51
|
+
type: 'lookups';
|
|
52
|
+
};
|
|
53
|
+
export type SelectFormControlProps<T> = BaseFormControlProps & SelectControlProps<T> & {
|
|
54
|
+
type: 'select';
|
|
55
|
+
};
|
|
56
|
+
export type MultiSelectFormControlProps<T> = BaseFormControlProps & MultiSelectControlProps<T> & {
|
|
57
|
+
type: 'multi-select';
|
|
58
|
+
};
|
|
59
|
+
export type SwitchFormControlProps = BaseFormControlProps & SwitchControlProps & {
|
|
60
|
+
type: 'switch';
|
|
61
|
+
};
|
|
62
|
+
export type CustomFormControlProps<T> = BaseFormControlProps & ControlProps<T> & {
|
|
63
|
+
type: 'custom';
|
|
64
|
+
renderControl: ({ value, onChange, disabled, }: {
|
|
65
|
+
value: T | null;
|
|
66
|
+
onChange?: (value: T) => void;
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
}) => JSX.Element;
|
|
69
|
+
};
|
|
70
|
+
export type FormControlProps<T> = {
|
|
71
|
+
label?: string;
|
|
72
|
+
helperText?: false | string;
|
|
73
|
+
required?: boolean;
|
|
74
|
+
} & (CustomFormControlProps<T> | TextFormControlProps | TextAreaFormControlProps | TelephoneFormControlProps | EmailFormControlProps | PasswordFormControlProps | NumberFormControlProps | CurrencyFormControlProps | DateFormControlProps | DateTimeFormControlProps | SelectFormControlProps<T> | MultiSelectFormControlProps<T> | LookupFormControlProps | MultiSelectLookupsFormControlProps | SwitchFormControlProps);
|
package/form/types.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@headless-adminapp/fluent",
|
|
3
|
+
"version": "0.0.17-alpha.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public",
|
|
9
|
+
"directory": "dist"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/headless-adminapp/adminapp.git",
|
|
14
|
+
"directory": "packages/fluent"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/headless-adminapp/adminapp/issues"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"ts-check": "tsc --noEmit",
|
|
22
|
+
"copy-files": "cp package.json dist",
|
|
23
|
+
"prepublishOnly": "pnpm run build && pnpm run copy-files",
|
|
24
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [],
|
|
27
|
+
"author": "",
|
|
28
|
+
"license": "ISC",
|
|
29
|
+
"gitHead": "86b3b0f6764173ba69e71d81ef613ec570ae4a35"
|
|
30
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare module '@headless-adminapp/icons/types' {
|
|
2
|
+
interface IconSet {
|
|
3
|
+
SignOut: Icon;
|
|
4
|
+
Close: Icon;
|
|
5
|
+
Add: Icon;
|
|
6
|
+
Edit: Icon;
|
|
7
|
+
Delete: Icon;
|
|
8
|
+
Refresh: Icon;
|
|
9
|
+
ArrowLeft: Icon;
|
|
10
|
+
ArrowRight: Icon;
|
|
11
|
+
MoreVertical: Icon;
|
|
12
|
+
MoreHorizontal: Icon;
|
|
13
|
+
Search: Icon;
|
|
14
|
+
Mail: Icon;
|
|
15
|
+
Phone: Icon;
|
|
16
|
+
Eye: Icon;
|
|
17
|
+
EyeOff: Icon;
|
|
18
|
+
Error: Icon;
|
|
19
|
+
Settings: Icon;
|
|
20
|
+
Calendar: Icon;
|
|
21
|
+
EditColumns: Icon;
|
|
22
|
+
ArrowDown: Icon;
|
|
23
|
+
ArrowUp: Icon;
|
|
24
|
+
Filter: Icon;
|
|
25
|
+
FilterDismiss: Icon;
|
|
26
|
+
ChevronDown: Icon;
|
|
27
|
+
ChevronUp: Icon;
|
|
28
|
+
ListLtr: Icon;
|
|
29
|
+
ListRtl: Icon;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {};
|
package/types/index.js
ADDED