@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,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
// import { AttachmentControl } from './controls/AttachmentControl';
|
|
21
|
+
const CurrencyControl_1 = require("./controls/CurrencyControl");
|
|
22
|
+
const DateControl_1 = require("./controls/DateControl");
|
|
23
|
+
const DateTimeControl_1 = require("./controls/DateTimeControl");
|
|
24
|
+
const EmailControl_1 = require("./controls/EmailControl");
|
|
25
|
+
const LookupControl_1 = require("./controls/LookupControl");
|
|
26
|
+
const MultiSelectControl_1 = __importDefault(require("./controls/MultiSelectControl"));
|
|
27
|
+
const MultiSelectLookupControl_1 = require("./controls/MultiSelectLookupControl");
|
|
28
|
+
const NumberControl_1 = require("./controls/NumberControl");
|
|
29
|
+
const PasswordControl_1 = require("./controls/PasswordControl");
|
|
30
|
+
const SelectControl_1 = __importDefault(require("./controls/SelectControl"));
|
|
31
|
+
const SwitchControl_1 = require("./controls/SwitchControl");
|
|
32
|
+
const TelephoneControl_1 = require("./controls/TelephoneControl");
|
|
33
|
+
const TextAreaControl_1 = require("./controls/TextAreaControl");
|
|
34
|
+
const TextControl_1 = require("./controls/TextControl");
|
|
35
|
+
const FormControlLoading_1 = require("./FormControlLoading");
|
|
36
|
+
function Control(props) {
|
|
37
|
+
const { type, label: _label, value, onChange } = props, rest = __rest(props, ["type", "label", "value", "onChange"]);
|
|
38
|
+
switch (type) {
|
|
39
|
+
case 'custom':
|
|
40
|
+
return props.renderControl({
|
|
41
|
+
value: props.value,
|
|
42
|
+
onChange: props.onChange,
|
|
43
|
+
disabled: props.disabled,
|
|
44
|
+
});
|
|
45
|
+
case 'text':
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(TextControl_1.TextControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
47
|
+
case 'textarea':
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(TextAreaControl_1.TextAreaControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
49
|
+
case 'telephone':
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(TelephoneControl_1.TelephoneControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
51
|
+
case 'email':
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(EmailControl_1.EmailControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
53
|
+
case 'password':
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(PasswordControl_1.PasswordControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
55
|
+
case 'number':
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)(NumberControl_1.NumberControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
57
|
+
case 'currency':
|
|
58
|
+
return ((0, jsx_runtime_1.jsx)(CurrencyControl_1.CurrencyControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
59
|
+
case 'date':
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(DateControl_1.DateControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
61
|
+
case 'datetime':
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(DateTimeControl_1.DateTimeControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
63
|
+
case 'select':
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(SelectControl_1.default, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
65
|
+
case 'multi-select':
|
|
66
|
+
return ((0, jsx_runtime_1.jsx)(MultiSelectControl_1.default, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
67
|
+
case 'lookup':
|
|
68
|
+
return ((0, jsx_runtime_1.jsx)(LookupControl_1.LookupControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
69
|
+
case 'lookups':
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(MultiSelectLookupControl_1.MultiSelectLookupControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
71
|
+
case 'switch':
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(SwitchControl_1.SwitchControl, Object.assign({ value: value, onChange: onChange }, rest)));
|
|
73
|
+
// case 'attachment':
|
|
74
|
+
// return (
|
|
75
|
+
// <AttachmentControl
|
|
76
|
+
// value={value}
|
|
77
|
+
// onChange={onChange}
|
|
78
|
+
// {...(rest as any)}
|
|
79
|
+
// />
|
|
80
|
+
// );
|
|
81
|
+
default:
|
|
82
|
+
return (0, jsx_runtime_1.jsx)("div", {});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function randomUUID() {
|
|
86
|
+
return Math.random().toString(36).substring(2, 15);
|
|
87
|
+
}
|
|
88
|
+
function FormControl(props) {
|
|
89
|
+
const { label, id, onChange, error, helperText, required } = props;
|
|
90
|
+
const _id = (0, react_1.useMemo)(() => id || randomUUID(), [id]);
|
|
91
|
+
const noop = (0, react_1.useCallback)(() => { }, []);
|
|
92
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Label, { style: { width: 160, marginTop: 4 }, children: label }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flex: 1, flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(Control, Object.assign({ id: _id, onChange: onChange || noop }, props)) })] }));
|
|
93
|
+
}
|
|
94
|
+
FormControl.Loading = FormControlLoading_1.FormControlLoading;
|
|
95
|
+
exports.default = FormControl;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormControlLoading = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const FormControlLoading = () => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: 6, marginTop: 2 }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Skeleton, { style: { width: 100, height: 20 } }), (0, jsx_runtime_1.jsx)(react_components_1.Skeleton, { style: { height: 32 } })] }));
|
|
8
|
+
};
|
|
9
|
+
exports.FormControlLoading = FormControlLoading;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ControlProps } from './types';
|
|
2
|
+
export interface CurrencyControlProps extends ControlProps<number> {
|
|
3
|
+
}
|
|
4
|
+
export declare function CurrencyControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, autoFocus, borderOnFocusOnly, readOnly, }: CurrencyControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CurrencyControl = CurrencyControl;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
function CurrencyControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, autoFocus, borderOnFocusOnly, readOnly, }) {
|
|
7
|
+
var _a;
|
|
8
|
+
console.log('CurrencyControl', value);
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { placeholder: placeholder, id: id, autoFocus: autoFocus, name: name, value: (_a = value === null || value === void 0 ? void 0 : value.toString()) !== null && _a !== void 0 ? _a : '', onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value ? Number(e.target.value) : null), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), appearance: "filled-darker", onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
10
|
+
// invalid={error}
|
|
11
|
+
// icon={<div>₹</div>}
|
|
12
|
+
// startDecorator={<div>₹</div>}
|
|
13
|
+
contentBefore: (0, jsx_runtime_1.jsx)("div", { children: "\u20B9" }), disabled: disabled, readOnly: readOnly, style: {
|
|
14
|
+
width: '100%',
|
|
15
|
+
} }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ControlProps } from './types';
|
|
2
|
+
export interface DateControlProps extends ControlProps<string> {
|
|
3
|
+
maxDate?: Date;
|
|
4
|
+
minDate?: Date;
|
|
5
|
+
}
|
|
6
|
+
export declare function DateControl({ value, onChange, id, name, onBlur, onFocus, error, placeholder, disabled, maxDate, minDate, borderOnFocusOnly, readOnly, }: DateControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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.DateControl = DateControl;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_datepicker_compat_1 = require("@fluentui/react-datepicker-compat");
|
|
9
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
11
|
+
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
12
|
+
function DateControl({ value, onChange, id, name, onBlur, onFocus, error, placeholder, disabled, maxDate, minDate, borderOnFocusOnly, readOnly, }) {
|
|
13
|
+
const { dateFormats } = (0, locale_1.useLocale)();
|
|
14
|
+
const { datePickerStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: placeholder, appearance: "filled-darker",
|
|
16
|
+
// size="sm"
|
|
17
|
+
// error={error}
|
|
18
|
+
// maxDate={maxDate}
|
|
19
|
+
// minDate={minDate}
|
|
20
|
+
disabled: disabled, readOnly: readOnly, formatDate: (date) => (date ? (0, dayjs_1.default)(date).format(dateFormats.short) : ''), value: value ? new Date(value) : null, onSelectDate: (date) => onChange === null || onChange === void 0 ? void 0 : onChange(date ? date.toISOString() : null), strings: datePickerStrings }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ControlProps } from './types';
|
|
2
|
+
export interface DateRangeControlProps extends ControlProps<[string | null, string | null]> {
|
|
3
|
+
maxDate?: Date;
|
|
4
|
+
minDate?: Date;
|
|
5
|
+
}
|
|
6
|
+
export declare function DateRangeControl({ value, onChange, id, name, onBlur, onFocus, disabled, maxDate, minDate, readOnly, }: DateRangeControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
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.DateRangeControl = DateRangeControl;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_datepicker_compat_1 = require("@fluentui/react-datepicker-compat");
|
|
9
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
10
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
11
|
+
const react_1 = require("react");
|
|
12
|
+
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
13
|
+
function DateRangeControl({ value, onChange, id, name, onBlur, onFocus, disabled, maxDate, minDate, readOnly, }) {
|
|
14
|
+
const [from, setFrom] = (0, react_1.useState)(value ? value[0] : null);
|
|
15
|
+
const [to, setTo] = (0, react_1.useState)(value ? value[1] : null);
|
|
16
|
+
const { datePickerStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
17
|
+
const { dateFormats } = (0, locale_1.useLocale)();
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
19
|
+
if (value) {
|
|
20
|
+
setFrom(value[0]);
|
|
21
|
+
setTo(value[1]);
|
|
22
|
+
}
|
|
23
|
+
}, [value]);
|
|
24
|
+
const _minDate = minDate
|
|
25
|
+
? new Date(minDate)
|
|
26
|
+
: from
|
|
27
|
+
? new Date(from)
|
|
28
|
+
: undefined;
|
|
29
|
+
const _maxDate = maxDate ? new Date(maxDate) : to ? new Date(to) : undefined;
|
|
30
|
+
const handleChangeFrom = (date) => {
|
|
31
|
+
var _a;
|
|
32
|
+
setFrom(date ? date.toISOString() : null);
|
|
33
|
+
// if (date && to) {
|
|
34
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([(_a = date === null || date === void 0 ? void 0 : date.toISOString()) !== null && _a !== void 0 ? _a : null, to]);
|
|
35
|
+
// }
|
|
36
|
+
};
|
|
37
|
+
const handleChangeTo = (date) => {
|
|
38
|
+
var _a;
|
|
39
|
+
setTo(date ? date.toISOString() : null);
|
|
40
|
+
// if (date && from) {
|
|
41
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([from, (_a = date === null || date === void 0 ? void 0 : date.toISOString()) !== null && _a !== void 0 ? _a : null]);
|
|
42
|
+
// }
|
|
43
|
+
};
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', gap: 8 }, children: [(0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: "From", appearance: "filled-darker", disabled: disabled, readOnly: readOnly, formatDate: (date) => date ? (0, dayjs_1.default)(date).format(dateFormats.short) : '', value: from ? new Date(from) : null, onSelectDate: (date) => handleChangeFrom(date), strings: datePickerStrings, minDate: minDate, maxDate: _maxDate, style: { flex: 1 }, input: {
|
|
45
|
+
style: { width: '100%' },
|
|
46
|
+
} }), (0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: "To", appearance: "filled-darker", disabled: disabled, readOnly: readOnly, formatDate: (date) => (date ? (0, dayjs_1.default)(date).format('YYYY-MM-DD') : ''), value: to ? new Date(to) : null, onSelectDate: (date) => handleChangeTo(date), strings: datePickerStrings, minDate: _minDate, maxDate: maxDate, style: { flex: 1 }, input: {
|
|
47
|
+
style: { width: '100%' },
|
|
48
|
+
} })] }));
|
|
49
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ControlProps } from './types';
|
|
2
|
+
export interface DateTimeControlProps extends ControlProps<string> {
|
|
3
|
+
maxDate?: Date;
|
|
4
|
+
minDate?: Date;
|
|
5
|
+
}
|
|
6
|
+
export declare function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, error, placeholder, disabled, maxDate, minDate, borderOnFocusOnly, readOnly, }: DateTimeControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
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.DateTimeControl = DateTimeControl;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_datepicker_compat_1 = require("@fluentui/react-datepicker-compat");
|
|
9
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
10
|
+
function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, error, placeholder, disabled, maxDate, minDate, borderOnFocusOnly, readOnly, }) {
|
|
11
|
+
// const { shortDate: dateFormat } = useLocale();
|
|
12
|
+
// return (
|
|
13
|
+
// <TimePicker
|
|
14
|
+
// )
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: placeholder, appearance: "filled-darker", formatDate: (date) => date ? (0, dayjs_1.default)(date).format('YYYY-MM-DD HH:mm:ss') : '',
|
|
16
|
+
// size="sm"
|
|
17
|
+
// error={error}
|
|
18
|
+
// maxDate={maxDate}
|
|
19
|
+
// minDate={minDate}
|
|
20
|
+
disabled: disabled, readOnly: readOnly,
|
|
21
|
+
// inputFormat={inputFormat}
|
|
22
|
+
value: value ? new Date(value) : null, onSelectDate: (date) => onChange === null || onChange === void 0 ? void 0 : onChange(date ? date.toISOString() : null) }));
|
|
23
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ControlProps } from './types';
|
|
2
|
+
export interface EmailControlProps extends ControlProps<string> {
|
|
3
|
+
autoComplete?: string;
|
|
4
|
+
textTransform?: 'capitalize' | 'uppercase' | 'lowercase' | 'none';
|
|
5
|
+
}
|
|
6
|
+
export declare function EmailControl({ value, onChange, id, name, onBlur, onFocus, error, placeholder, disabled, autoComplete, textTransform, borderOnFocusOnly, readOnly, }: EmailControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmailControl = EmailControl;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
7
|
+
function EmailControl({ value, onChange, id, name, onBlur, onFocus, error, placeholder, disabled, autoComplete, textTransform, borderOnFocusOnly, readOnly, }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "email", placeholder: placeholder, id: id, appearance: "filled-darker", name: name,
|
|
9
|
+
// size="sm"
|
|
10
|
+
value: value || '', onChange: (e) => {
|
|
11
|
+
textTransform === 'uppercase'
|
|
12
|
+
? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toUpperCase())
|
|
13
|
+
: textTransform === 'lowercase'
|
|
14
|
+
? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toLowerCase())
|
|
15
|
+
: onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
|
|
16
|
+
}, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
17
|
+
// invalid={error}
|
|
18
|
+
disabled: disabled, readOnly: readOnly, autoComplete: autoComplete, style: {
|
|
19
|
+
flex: 1,
|
|
20
|
+
paddingRight: react_components_1.tokens.spacingHorizontalXS,
|
|
21
|
+
}, contentAfter: !!value ? ((0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: () => window.open(`mailto:${value}`, '_blank'), color: "primary", appearance: "transparent", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Mail, {}), size: "small" })) : undefined }));
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Schema } from '@headless-adminapp/core/schema';
|
|
2
|
+
import { ISchemaExperienceStore } from '@headless-adminapp/core/store';
|
|
3
|
+
import { IDataService } from '@headless-adminapp/core/transport';
|
|
4
|
+
import { ControlProps } from './types';
|
|
5
|
+
export interface LookupOption {
|
|
6
|
+
limit: number;
|
|
7
|
+
search: string;
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type DataLookup = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
logicalName: string;
|
|
14
|
+
};
|
|
15
|
+
export type LookupControlProps = ControlProps<DataLookup> & {
|
|
16
|
+
async?: boolean;
|
|
17
|
+
lookupKey?: string;
|
|
18
|
+
openRecord?: (id: string) => void;
|
|
19
|
+
dataService: IDataService;
|
|
20
|
+
schema: Schema;
|
|
21
|
+
experienceStore: ISchemaExperienceStore;
|
|
22
|
+
viewId?: string;
|
|
23
|
+
allowNavigation?: boolean;
|
|
24
|
+
allowNewRecord?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare function LookupControl(props: LookupControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LookupControl = LookupControl;
|
|
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/hooks");
|
|
7
|
+
const hooks_2 = require("@headless-adminapp/app/route/hooks");
|
|
8
|
+
const app_1 = require("@headless-adminapp/core/experience/app");
|
|
9
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const AppStringContext_1 = require("../../App/AppStringContext");
|
|
12
|
+
const RecordCard_1 = require("../../PageEntityForm/RecordCard");
|
|
13
|
+
const useLookupData_1 = require("./useLookupData");
|
|
14
|
+
function LookupControl(props) {
|
|
15
|
+
const Control = LookupControlMd;
|
|
16
|
+
return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, props));
|
|
17
|
+
}
|
|
18
|
+
const useStyles = (0, react_components_1.makeStyles)({
|
|
19
|
+
option: {
|
|
20
|
+
padding: 0,
|
|
21
|
+
'& .fui-Option__checkIcon': {
|
|
22
|
+
display: 'none',
|
|
23
|
+
},
|
|
24
|
+
'&[data-activedescendant-focusvisible]': {
|
|
25
|
+
background: react_components_1.tokens.colorNeutralBackground1Hover,
|
|
26
|
+
'&:after': {
|
|
27
|
+
border: 'none !important',
|
|
28
|
+
// background: tokens.colorNeutralBackground1Hover,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, dataService, schema, viewId, allowNavigation, allowNewRecord, }) => {
|
|
34
|
+
const [lookupEnabled, setLookupEnabled] = (0, react_1.useState)(false);
|
|
35
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
36
|
+
const [searchText, setSearchText] = (0, react_1.useState)('');
|
|
37
|
+
const { loockupStrings } = (0, AppStringContext_1.useAppStrings)();
|
|
38
|
+
const routeResolver = (0, hooks_2.useRouteResolver)();
|
|
39
|
+
const router = (0, hooks_2.useRouter)();
|
|
40
|
+
const path = (0, react_1.useMemo)(() => {
|
|
41
|
+
if (!value) {
|
|
42
|
+
return '';
|
|
43
|
+
}
|
|
44
|
+
if (!allowNavigation) {
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
return routeResolver({
|
|
48
|
+
logicalName: schema.logicalName,
|
|
49
|
+
type: app_1.PageType.EntityForm,
|
|
50
|
+
id: value.id,
|
|
51
|
+
});
|
|
52
|
+
}, [allowNavigation, routeResolver, schema.logicalName, value]);
|
|
53
|
+
const handleOpenRecord = (0, react_1.useCallback)((event) => {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
if (!path) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
router.push(path);
|
|
60
|
+
}, [path, router]);
|
|
61
|
+
(0, react_1.useEffect)(() => {
|
|
62
|
+
if (open)
|
|
63
|
+
setLookupEnabled(true);
|
|
64
|
+
}, [open]);
|
|
65
|
+
const [debouncedSearchText] = (0, hooks_1.useDebouncedValue)(searchText, 500);
|
|
66
|
+
const styles = useStyles();
|
|
67
|
+
// const useLookupData = useMemo(
|
|
68
|
+
// () =>
|
|
69
|
+
// createUseLookupDataHook({
|
|
70
|
+
// dataResolver: dataResolverRef.current,
|
|
71
|
+
// useLookupQuery: undefined,
|
|
72
|
+
// lookupKey,
|
|
73
|
+
// }),
|
|
74
|
+
// [lookupKey]
|
|
75
|
+
// );
|
|
76
|
+
// const {
|
|
77
|
+
// data,
|
|
78
|
+
// isLoading: loading,
|
|
79
|
+
// isFetching,
|
|
80
|
+
// } = useLookupData({
|
|
81
|
+
// limit: 10,
|
|
82
|
+
// search: async ? debouncedSearchText : '',
|
|
83
|
+
// enabled: lookupEnabled,
|
|
84
|
+
// });
|
|
85
|
+
const { isLoading: isViewLoading, view } = (0, useLookupData_1.useGetLookupView)(schema.logicalName, viewId);
|
|
86
|
+
const { data, isLoading } = (0, useLookupData_1.useLookupData)({
|
|
87
|
+
schema,
|
|
88
|
+
view: view === null || view === void 0 ? void 0 : view.experience,
|
|
89
|
+
searchText: debouncedSearchText,
|
|
90
|
+
dataService,
|
|
91
|
+
enabled: lookupEnabled && !isViewLoading && !value && !readOnly && !disabled,
|
|
92
|
+
});
|
|
93
|
+
(0, react_1.useEffect)(() => {
|
|
94
|
+
if (value) {
|
|
95
|
+
setSearchText(value.name);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
setSearchText('');
|
|
99
|
+
}
|
|
100
|
+
}, [value]);
|
|
101
|
+
const handleChange = (value) => {
|
|
102
|
+
setSearchText('');
|
|
103
|
+
if (!value) {
|
|
104
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
108
|
+
id: value[schema.idAttribute],
|
|
109
|
+
name: value[schema.primaryAttribute],
|
|
110
|
+
logicalName: schema.logicalName,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: '100%' }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.Combobox, { name: name, appearance: "filled-darker", expandIcon: readOnly || disabled ? null : isLoading ? ((0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" })) : ((0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 18 })), placeholder: placeholder, inputMode: "search", style: { width: '100%' }, autoComplete: "off", readOnly: readOnly || disabled,
|
|
115
|
+
// disabled={disabled}
|
|
116
|
+
open: open && !value && !readOnly && !disabled, value: !value ? searchText : '', onOpenChange: (e, data) => setOpen(data.open), onChange: (e) => {
|
|
117
|
+
setSearchText(e.target.value);
|
|
118
|
+
}, onOptionSelect: (e, item) => {
|
|
119
|
+
console.log('onOptionSelect', item);
|
|
120
|
+
const _item = data === null || data === void 0 ? void 0 : data.records.find((x) => String(x[schema.idAttribute]) === item.optionValue);
|
|
121
|
+
handleChange(_item !== null && _item !== void 0 ? _item : null);
|
|
122
|
+
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data === null || data === void 0 ? void 0 : data.records.map((item) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: item[schema.idAttribute], className: (0, react_components_1.mergeClasses)(styles.option), text: item[schema.primaryAttribute], children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view === null || view === void 0 ? void 0 : view.experience.card, record: item, schema: schema }) }, item[schema.idAttribute]))), !isLoading && !(data === null || data === void 0 ? void 0 : data.records.length) && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
123
|
+
paddingInline: react_components_1.tokens.spacingHorizontalL,
|
|
124
|
+
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
125
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: loockupStrings.noRecordsFound }) })), allowNewRecord && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: react_components_1.tokens.spacingVerticalXXS }, children: (0, jsx_runtime_1.jsx)(react_components_1.ToolbarButton, { style: { fontWeight: 'normal' }, icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), children: loockupStrings.newRecord }) })] }))] }), !!value && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
126
|
+
position: 'absolute',
|
|
127
|
+
inset: 0,
|
|
128
|
+
alignItems: 'center',
|
|
129
|
+
paddingInline: 4,
|
|
130
|
+
display: 'flex',
|
|
131
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.TagGroup, { as: "div", children: (0, jsx_runtime_1.jsx)(react_components_1.Tag, { as: "span", appearance: "brand", size: "small", dismissible: !disabled && !readOnly, value: value.id, style: { paddingRight: !disabled && !readOnly ? 0 : 5 }, dismissIcon: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', cursor: 'pointer' }, onClick: () => {
|
|
132
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
133
|
+
}, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Close, { size: 16 }) }), children: allowNavigation && path ? ((0, jsx_runtime_1.jsx)(react_components_1.Link, { href: path, onClick: handleOpenRecord, children: (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: value === null || value === void 0 ? void 0 : value.name }) })) : ((0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: value === null || value === void 0 ? void 0 : value.name })) }) }) }))] }));
|
|
134
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Lookup } from './SelectControl';
|
|
2
|
+
import { ControlProps } from './types';
|
|
3
|
+
export interface MultiSelectControlProps<T> extends ControlProps<T[]> {
|
|
4
|
+
options: Lookup<T>[];
|
|
5
|
+
}
|
|
6
|
+
export default function MultiSelectControl<T extends string | number>({ value, onChange, options, id, name, disabled, error, onBlur, onFocus, placeholder, }: MultiSelectControlProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = MultiSelectControl;
|
|
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
|
+
function MultiSelectControl({ value, onChange, options, id, name, disabled, error, onBlur, onFocus, placeholder, }) {
|
|
8
|
+
const transformedOptions = (0, react_1.useMemo)(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
|
|
9
|
+
const handleChange = (value) => {
|
|
10
|
+
const selectedOptions = options.filter((x) => value.includes(String(x.value)));
|
|
11
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selectedOptions.map((x) => x.value));
|
|
12
|
+
};
|
|
13
|
+
const selectedOptions = (0, react_1.useMemo)(() => options.filter((x) => value === null || value === void 0 ? void 0 : value.includes(x.value)), [options, value]);
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Dropdown, { placeholder: placeholder, id: id, name: name, appearance: "filled-darker", multiselect: true, value: selectedOptions.map((x) => x.label).join(', '), selectedOptions: value ? value.map(String) : [], onOptionSelect: (event, data) => {
|
|
15
|
+
handleChange(data.selectedOptions);
|
|
16
|
+
}, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), disabled: disabled, children: transformedOptions.map((x) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.value, children: x.label }, x.value))) }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Schema } from '@headless-adminapp/core/schema';
|
|
2
|
+
import { ISchemaExperienceStore } from '@headless-adminapp/core/store';
|
|
3
|
+
import { IDataService } from '@headless-adminapp/core/transport';
|
|
4
|
+
import { ControlProps } from './types';
|
|
5
|
+
export interface LookupOption {
|
|
6
|
+
limit: number;
|
|
7
|
+
search: string;
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type DataLookup = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
logicalName: string;
|
|
14
|
+
};
|
|
15
|
+
export type MultiSelectLookupControlProps = ControlProps<DataLookup[]> & {
|
|
16
|
+
async?: boolean;
|
|
17
|
+
lookupKey?: string;
|
|
18
|
+
openRecord?: (id: string) => void;
|
|
19
|
+
dataService: IDataService;
|
|
20
|
+
schema: Schema;
|
|
21
|
+
experienceStore: ISchemaExperienceStore;
|
|
22
|
+
viewId?: string;
|
|
23
|
+
allowNavigation?: boolean;
|
|
24
|
+
allowNewRecord?: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare function MultiSelectLookupControl(props: MultiSelectLookupControlProps): import("react/jsx-runtime").JSX.Element;
|