@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,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MultiSelectLookupControl = MultiSelectLookupControl;
|
|
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 MultiSelectLookupControl(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
|
+
(0, react_1.useEffect)(() => {
|
|
39
|
+
if (open)
|
|
40
|
+
setLookupEnabled(true);
|
|
41
|
+
}, [open]);
|
|
42
|
+
const [debouncedSearchText] = (0, hooks_1.useDebouncedValue)(searchText, 500);
|
|
43
|
+
const styles = useStyles();
|
|
44
|
+
const { isLoading: isViewLoading, view } = (0, useLookupData_1.useGetLookupView)(schema.logicalName, viewId);
|
|
45
|
+
const { data, isLoading } = (0, useLookupData_1.useLookupData)({
|
|
46
|
+
schema,
|
|
47
|
+
view: view === null || view === void 0 ? void 0 : view.experience,
|
|
48
|
+
searchText: debouncedSearchText,
|
|
49
|
+
dataService,
|
|
50
|
+
enabled: lookupEnabled && !isViewLoading && !readOnly && !disabled,
|
|
51
|
+
});
|
|
52
|
+
const tagGroupContainerRef = (0, react_1.useRef)(null);
|
|
53
|
+
const [inputLeft, setInputLeft] = (0, react_1.useState)(0);
|
|
54
|
+
const [containerHeight, setContainerHeight] = (0, react_1.useState)(32);
|
|
55
|
+
(0, react_1.useEffect)(() => {
|
|
56
|
+
const timer = setInterval(() => {
|
|
57
|
+
var _a, _b, _c;
|
|
58
|
+
if (!tagGroupContainerRef.current) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const lastElementChild = (_b = (_a = tagGroupContainerRef.current) === null || _a === void 0 ? void 0 : _a.lastElementChild) === null || _b === void 0 ? void 0 : _b.querySelector('.fui-Tag:last-of-type');
|
|
62
|
+
if (!lastElementChild) {
|
|
63
|
+
setContainerHeight(32);
|
|
64
|
+
setInputLeft(0);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const containerBoundingRect = tagGroupContainerRef.current.getBoundingClientRect();
|
|
68
|
+
const lastElementBoundingRect = lastElementChild === null || lastElementChild === void 0 ? void 0 : lastElementChild.getBoundingClientRect();
|
|
69
|
+
const remainingWidth = containerBoundingRect.right - ((_c = lastElementBoundingRect === null || lastElementBoundingRect === void 0 ? void 0 : lastElementBoundingRect.right) !== null && _c !== void 0 ? _c : 0);
|
|
70
|
+
let newHeight = containerBoundingRect.height + 8;
|
|
71
|
+
if (remainingWidth > 100) {
|
|
72
|
+
setInputLeft(containerBoundingRect.width - remainingWidth);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
setInputLeft(0);
|
|
76
|
+
newHeight = containerBoundingRect.height + 32 + 4;
|
|
77
|
+
}
|
|
78
|
+
setContainerHeight(newHeight);
|
|
79
|
+
}, 500);
|
|
80
|
+
return () => {
|
|
81
|
+
clearInterval(timer);
|
|
82
|
+
};
|
|
83
|
+
}, []);
|
|
84
|
+
// useEffect(() => {
|
|
85
|
+
// if (value) {
|
|
86
|
+
// // setSearchText(value.name); // TODO:
|
|
87
|
+
// } else {
|
|
88
|
+
// setSearchText('');
|
|
89
|
+
// }
|
|
90
|
+
// }, [value]);
|
|
91
|
+
const handleAdd = (selectedValue) => {
|
|
92
|
+
setSearchText('');
|
|
93
|
+
if (!value) {
|
|
94
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange([
|
|
95
|
+
{
|
|
96
|
+
id: selectedValue[schema.idAttribute],
|
|
97
|
+
name: selectedValue[schema.primaryAttribute],
|
|
98
|
+
logicalName: schema.logicalName,
|
|
99
|
+
},
|
|
100
|
+
]);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
if (value.find((x) => x.id === selectedValue[schema.idAttribute])) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange([
|
|
107
|
+
...value,
|
|
108
|
+
{
|
|
109
|
+
id: selectedValue[schema.idAttribute],
|
|
110
|
+
name: selectedValue[schema.primaryAttribute],
|
|
111
|
+
logicalName: schema.logicalName,
|
|
112
|
+
},
|
|
113
|
+
]);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const handleRemove = (id) => {
|
|
117
|
+
const newValue = value === null || value === void 0 ? void 0 : value.filter((x) => x.id !== id);
|
|
118
|
+
if (!(newValue === null || newValue === void 0 ? void 0 : newValue.length)) {
|
|
119
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: '100%', height: containerHeight }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.Combobox, { name: name, appearance: "filled-darker", expandIcon: (0, jsx_runtime_1.jsx)("div", { style: { position: 'absolute', right: 4, bottom: 8 }, children: 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 })) }), input: {
|
|
126
|
+
style: {
|
|
127
|
+
position: 'absolute',
|
|
128
|
+
bottom: 0,
|
|
129
|
+
right: 0,
|
|
130
|
+
left: inputLeft,
|
|
131
|
+
height: 30,
|
|
132
|
+
},
|
|
133
|
+
}, placeholder: placeholder, inputMode: "search", style: { width: '100%', height: '100%' }, autoComplete: "off", readOnly: readOnly || disabled, open: open && !readOnly && !disabled, value: searchText, onOpenChange: (e, data) => {
|
|
134
|
+
setOpen(data.open);
|
|
135
|
+
}, onChange: (e) => {
|
|
136
|
+
setSearchText(e.target.value);
|
|
137
|
+
}, onOptionSelect: (e, item) => {
|
|
138
|
+
console.log('onOptionSelect', item);
|
|
139
|
+
const _item = data === null || data === void 0 ? void 0 : data.records.find((x) => String(x[schema.idAttribute]) === item.optionValue);
|
|
140
|
+
if (!_item)
|
|
141
|
+
return;
|
|
142
|
+
handleAdd(_item);
|
|
143
|
+
}, 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: {
|
|
144
|
+
paddingInline: react_components_1.tokens.spacingHorizontalL,
|
|
145
|
+
paddingBlock: react_components_1.tokens.spacingVerticalS,
|
|
146
|
+
}, 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 }) })] }))] }), (0, jsx_runtime_1.jsx)("div", { ref: tagGroupContainerRef, style: {
|
|
147
|
+
position: 'absolute',
|
|
148
|
+
top: 4,
|
|
149
|
+
left: 0,
|
|
150
|
+
right: 0,
|
|
151
|
+
alignItems: 'center',
|
|
152
|
+
paddingInline: 4,
|
|
153
|
+
display: 'flex',
|
|
154
|
+
pointerEvents: 'none',
|
|
155
|
+
}, children: (0, jsx_runtime_1.jsx)(react_components_1.TagGroup, { as: "div", style: { flexWrap: 'wrap', rowGap: 8 }, children: value === null || value === void 0 ? void 0 : value.map((item, index) => ((0, jsx_runtime_1.jsx)(TagItem, { disabled: disabled, readOnly: readOnly, value: item, onRemove: handleRemove, allowNavigation: allowNavigation }, `${item.id}-${index}`))) }) })] }));
|
|
156
|
+
};
|
|
157
|
+
function TagItem({ disabled, readOnly, value, onRemove, allowNavigation, }) {
|
|
158
|
+
const routeResolver = (0, hooks_2.useRouteResolver)();
|
|
159
|
+
const router = (0, hooks_2.useRouter)();
|
|
160
|
+
const path = (0, react_1.useMemo)(() => {
|
|
161
|
+
if (!value) {
|
|
162
|
+
return '';
|
|
163
|
+
}
|
|
164
|
+
if (!allowNavigation) {
|
|
165
|
+
return '';
|
|
166
|
+
}
|
|
167
|
+
return routeResolver({
|
|
168
|
+
logicalName: value.logicalName,
|
|
169
|
+
type: app_1.PageType.EntityForm,
|
|
170
|
+
id: value.id,
|
|
171
|
+
});
|
|
172
|
+
}, [allowNavigation, routeResolver, value]);
|
|
173
|
+
const handleOpenRecord = (0, react_1.useCallback)((event) => {
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
event.stopPropagation();
|
|
176
|
+
if (!path) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
router.push(path);
|
|
180
|
+
}, [path, router]);
|
|
181
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Tag, { as: "span", appearance: "brand", size: "small", dismissible: !disabled && !readOnly, value: value.id, style: {
|
|
182
|
+
paddingRight: !disabled && !readOnly ? 0 : 5,
|
|
183
|
+
pointerEvents: 'auto',
|
|
184
|
+
}, dismissIcon: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', cursor: 'pointer' }, onClick: () => {
|
|
185
|
+
onRemove === null || onRemove === void 0 ? void 0 : onRemove(value.id);
|
|
186
|
+
}, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Close, { size: 16 }) }), children: allowNavigation && !!path ? ((0, jsx_runtime_1.jsx)(react_components_1.Link, { 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 })) }));
|
|
187
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ControlProps } from './types';
|
|
2
|
+
export interface NumberControlProps extends ControlProps<number> {
|
|
3
|
+
}
|
|
4
|
+
export declare function NumberControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }: NumberControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NumberControl = NumberControl;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
function NumberControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }) {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "number", placeholder: placeholder, id: id, appearance: "filled-darker", name: name,
|
|
8
|
+
// value={value ?? ''}
|
|
9
|
+
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(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
10
|
+
// invalid={error}
|
|
11
|
+
// size="sm"
|
|
12
|
+
disabled: disabled, readOnly: readOnly, style: {
|
|
13
|
+
width: '100%',
|
|
14
|
+
} }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InputProps } from '@fluentui/react-components';
|
|
2
|
+
import { ControlProps } from './types';
|
|
3
|
+
export interface PasswordControlProps extends ControlProps<string> {
|
|
4
|
+
appearance?: InputProps['appearance'];
|
|
5
|
+
}
|
|
6
|
+
export declare function PasswordControl({ value, onChange, id, name, onBlur, onFocus, error, placeholder, disabled, autoFocus, appearance, }: PasswordControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PasswordControl = PasswordControl;
|
|
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
|
+
const react_1 = require("react");
|
|
8
|
+
function PasswordControl({ value, onChange, id, name, onBlur, onFocus, error, placeholder, disabled, autoFocus, appearance = 'filled-darker', }) {
|
|
9
|
+
const [showPassword, setShowPassword] = (0, react_1.useState)(false);
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { placeholder: placeholder, id: id, name: name, appearance: appearance, type: showPassword ? 'text' : 'password', autoFocus: autoFocus, value: value || '', onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
11
|
+
// invalid={error}
|
|
12
|
+
disabled: disabled, contentAfter: (0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", size: "small", onClick: () => setShowPassword(!showPassword), icon: showPassword ? (0, jsx_runtime_1.jsx)(icons_1.Icons.EyeOff, { size: 18 }) : (0, jsx_runtime_1.jsx)(icons_1.Icons.Eye, { size: 18 }) }) }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ControlProps } from './types';
|
|
2
|
+
export interface Lookup<T = string> {
|
|
3
|
+
label: string;
|
|
4
|
+
value: T;
|
|
5
|
+
}
|
|
6
|
+
export interface SelectControlProps<T> extends ControlProps<T> {
|
|
7
|
+
options: Lookup<T>[];
|
|
8
|
+
}
|
|
9
|
+
export default function SelectControl<T extends string | number>({ value, onChange, options, id, name, disabled, error, onBlur, onFocus, placeholder, readOnly, }: SelectControlProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = SelectControl;
|
|
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 SelectControl({ value, onChange, options, id, name, disabled, error, onBlur, onFocus, placeholder, readOnly, }) {
|
|
8
|
+
var _a;
|
|
9
|
+
const transformedOptions = (0, react_1.useMemo)(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
|
|
10
|
+
const handleChange = (value) => {
|
|
11
|
+
const option = options.find((x) => String(x.value) === value);
|
|
12
|
+
if (option) {
|
|
13
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(option.value);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const selectedOption = (0, react_1.useMemo)(() => options.find((x) => x.value === value), [options, value]);
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Dropdown, { placeholder: placeholder, id: id, name: name, appearance: "filled-darker",
|
|
21
|
+
// data={transformedOptions}
|
|
22
|
+
value: (_a = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) !== null && _a !== void 0 ? _a : '',
|
|
23
|
+
// onChange={(e, v) => handleChange(v as string)}
|
|
24
|
+
selectedOptions: value ? [String(value)] : [], onOptionSelect: (event, data) => {
|
|
25
|
+
handleChange(data.optionValue);
|
|
26
|
+
}, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
27
|
+
// error={error}
|
|
28
|
+
disabled: disabled, children: transformedOptions.map((x) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.value, children: x.label }, x.value))) }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ControlProps } from './types';
|
|
2
|
+
export interface TelephoneControlProps extends ControlProps<string> {
|
|
3
|
+
autoComplete?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function TelephoneControl({ value, onChange, id, name, onBlur, onFocus, error, placeholder, disabled, autoComplete, }: TelephoneControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TelephoneControl = TelephoneControl;
|
|
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 TelephoneControl({ value, onChange, id, name, onBlur, onFocus, error, placeholder, disabled, autoComplete, }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "tel", placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value || '', onChange: (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
9
|
+
// invalid={error}
|
|
10
|
+
disabled: disabled, autoComplete: autoComplete, style: {
|
|
11
|
+
width: '100%',
|
|
12
|
+
paddingRight: react_components_1.tokens.spacingHorizontalXS,
|
|
13
|
+
},
|
|
14
|
+
// size="sm"
|
|
15
|
+
contentAfter: !!value ? ((0, jsx_runtime_1.jsx)(react_components_1.Button, { appearance: "transparent", size: "small", onClick: () => window.open(`tel:${value}`, '_blank'), icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Phone, {}) })) : undefined }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ControlProps } from './types';
|
|
2
|
+
export interface TextAreaControlProps extends ControlProps<string> {
|
|
3
|
+
rows?: number;
|
|
4
|
+
textTransform?: 'capitalize' | 'uppercase' | 'lowercase' | 'none';
|
|
5
|
+
}
|
|
6
|
+
export declare function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, error, disabled, rows, textTransform, }: TextAreaControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextAreaControl = TextAreaControl;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
function TextAreaControl({ value, onChange, id, name, placeholder, onBlur, onFocus, error, disabled, rows = 5, textTransform, }) {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Textarea, { placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: value || '', onChange: (e) => {
|
|
8
|
+
textTransform === 'uppercase'
|
|
9
|
+
? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toUpperCase())
|
|
10
|
+
: textTransform === 'lowercase'
|
|
11
|
+
? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toLowerCase())
|
|
12
|
+
: onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
|
|
13
|
+
}, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
14
|
+
// error={error}
|
|
15
|
+
disabled: disabled, rows: rows }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InputProps } from '@fluentui/react-components';
|
|
2
|
+
import { ControlProps } from './types';
|
|
3
|
+
export interface TextControlProps extends ControlProps<string> {
|
|
4
|
+
autoComplete?: string;
|
|
5
|
+
autoCapitalize?: string;
|
|
6
|
+
autoCorrect?: string;
|
|
7
|
+
textTransform?: 'capitalize' | 'uppercase' | 'lowercase' | 'none';
|
|
8
|
+
appearance?: InputProps['appearance'];
|
|
9
|
+
}
|
|
10
|
+
export declare function TextControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, autoFocus, autoCapitalize, autoCorrect, textTransform, readOnly, appearance, }: TextControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextControl = TextControl;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
+
function TextControl({ value, onChange, id, name, onBlur, onFocus,
|
|
7
|
+
// error,
|
|
8
|
+
placeholder, disabled, autoComplete, autoFocus, autoCapitalize, autoCorrect, textTransform,
|
|
9
|
+
// borderOnFocusOnly,
|
|
10
|
+
readOnly, appearance = 'filled-darker', }) {
|
|
11
|
+
const readonly = disabled || readOnly;
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { placeholder: placeholder, id: id, name: name, autoFocus: autoFocus, appearance: appearance, value: value || '', onChange: (e) => {
|
|
13
|
+
textTransform === 'uppercase'
|
|
14
|
+
? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toUpperCase())
|
|
15
|
+
: textTransform === 'lowercase'
|
|
16
|
+
? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toLowerCase())
|
|
17
|
+
: onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
|
|
18
|
+
}, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
|
|
19
|
+
// invalid={error}
|
|
20
|
+
// readOnly={readOnly || disabled}
|
|
21
|
+
readOnly: readonly, autoComplete: autoComplete, autoCorrect: autoCorrect, autoCapitalize: autoCapitalize, className: (0, react_components_1.mergeClasses)(readonly && 'TextControl_readonly'), style: {
|
|
22
|
+
width: '100%',
|
|
23
|
+
} }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ControlProps<T> {
|
|
2
|
+
id?: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
value: T | null;
|
|
5
|
+
onChange?: (value: T | null) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
onBlur?: () => void;
|
|
8
|
+
onFocus?: () => void;
|
|
9
|
+
error?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
autoFocus?: boolean;
|
|
12
|
+
borderOnFocusOnly?: boolean;
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ViewExperience } from '@headless-adminapp/core/experience/view';
|
|
2
|
+
import { InferredSchemaType, Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
3
|
+
import { IDataService } from '@headless-adminapp/core/transport';
|
|
4
|
+
interface UseLookupDataOptions {
|
|
5
|
+
dataService: IDataService;
|
|
6
|
+
searchText?: string;
|
|
7
|
+
schema: Schema;
|
|
8
|
+
view: ViewExperience | null | undefined;
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function useLookupData<S extends SchemaAttributes = SchemaAttributes>({ schema, view, searchText, dataService, enabled, }: UseLookupDataOptions): {
|
|
12
|
+
data: import("@headless-adminapp/core/transport").RetriveRecordsResult<InferredSchemaType<S>> | undefined;
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function useGetLookupView(logicalName: string, viewId?: string): {
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
view: import("@headless-adminapp/core/experience/view").View<SchemaAttributes> | undefined;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.useLookupData = useLookupData;
|
|
13
|
+
exports.useGetLookupView = useGetLookupView;
|
|
14
|
+
const hooks_1 = require("@headless-adminapp/app/hooks");
|
|
15
|
+
const hooks_2 = require("@headless-adminapp/app/metadata/hooks");
|
|
16
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
17
|
+
const react_1 = require("react");
|
|
18
|
+
function useLookupData({ schema, view, searchText, dataService, enabled, }) {
|
|
19
|
+
var _a;
|
|
20
|
+
const [search] = (0, hooks_1.useDebouncedValue)(searchText, 500);
|
|
21
|
+
const columns = (0, react_1.useMemo)(() => {
|
|
22
|
+
var _a;
|
|
23
|
+
if (!(view === null || view === void 0 ? void 0 : view.card)) {
|
|
24
|
+
return [schema.primaryAttribute];
|
|
25
|
+
}
|
|
26
|
+
return Array.from(new Set([
|
|
27
|
+
view.card.primaryColumn,
|
|
28
|
+
view.card.avatarColumn,
|
|
29
|
+
...((_a = view.card.secondaryColumns) !== null && _a !== void 0 ? _a : [])
|
|
30
|
+
.filter((x) => !x.expandedKey)
|
|
31
|
+
.map((x) => x.name),
|
|
32
|
+
])).filter(Boolean);
|
|
33
|
+
}, [schema.primaryAttribute, view === null || view === void 0 ? void 0 : view.card]);
|
|
34
|
+
const expand = (0, react_1.useMemo)(() => {
|
|
35
|
+
var _a;
|
|
36
|
+
return (((_a = view === null || view === void 0 ? void 0 : view.card) === null || _a === void 0 ? void 0 : _a.secondaryColumns) || [])
|
|
37
|
+
.filter((x) => x.expandedKey)
|
|
38
|
+
.reduce((acc, x) => {
|
|
39
|
+
if (!acc[x.name]) {
|
|
40
|
+
acc[x.name] = [];
|
|
41
|
+
}
|
|
42
|
+
if (!acc[x.name].includes(x.expandedKey)) {
|
|
43
|
+
acc[x.name].push(x.expandedKey);
|
|
44
|
+
}
|
|
45
|
+
return acc;
|
|
46
|
+
}, {});
|
|
47
|
+
}, [(_a = view === null || view === void 0 ? void 0 : view.card) === null || _a === void 0 ? void 0 : _a.secondaryColumns]);
|
|
48
|
+
const queryKey = (0, react_1.useMemo)(() => [
|
|
49
|
+
'data',
|
|
50
|
+
'retriveLookupRecords',
|
|
51
|
+
schema.logicalName,
|
|
52
|
+
search,
|
|
53
|
+
view === null || view === void 0 ? void 0 : view.filter,
|
|
54
|
+
view === null || view === void 0 ? void 0 : view.defaultSorting,
|
|
55
|
+
columns,
|
|
56
|
+
expand,
|
|
57
|
+
], [
|
|
58
|
+
columns,
|
|
59
|
+
expand,
|
|
60
|
+
schema.logicalName,
|
|
61
|
+
search,
|
|
62
|
+
view === null || view === void 0 ? void 0 : view.filter,
|
|
63
|
+
view === null || view === void 0 ? void 0 : view.defaultSorting,
|
|
64
|
+
]);
|
|
65
|
+
const { data, isFetching } = (0, react_query_1.useQuery)({
|
|
66
|
+
queryKey: queryKey,
|
|
67
|
+
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
var _a;
|
|
69
|
+
const result = yield dataService.retriveRecords({
|
|
70
|
+
logicalName: schema.logicalName,
|
|
71
|
+
search,
|
|
72
|
+
columns: columns,
|
|
73
|
+
expand,
|
|
74
|
+
filter: (_a = view === null || view === void 0 ? void 0 : view.filter) !== null && _a !== void 0 ? _a : null,
|
|
75
|
+
skip: 0,
|
|
76
|
+
limit: 5,
|
|
77
|
+
sort: view === null || view === void 0 ? void 0 : view.defaultSorting,
|
|
78
|
+
});
|
|
79
|
+
return result;
|
|
80
|
+
}),
|
|
81
|
+
placeholderData: react_query_1.keepPreviousData,
|
|
82
|
+
enabled: enabled !== null && enabled !== void 0 ? enabled : false,
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
data,
|
|
86
|
+
isLoading: isFetching,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function useGetLookupView(logicalName, viewId) {
|
|
90
|
+
const { experienceStore } = (0, hooks_2.useMetadata)();
|
|
91
|
+
const { isPending, data, error } = (0, react_query_1.useQuery)({
|
|
92
|
+
queryKey: ['data', 'getLookupView', logicalName, viewId],
|
|
93
|
+
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
return experienceStore.getViewLookupV2(logicalName, viewId);
|
|
95
|
+
}),
|
|
96
|
+
});
|
|
97
|
+
if (error) {
|
|
98
|
+
console.error(error);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
isLoading: isPending,
|
|
102
|
+
view: data,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormBody = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ScrollView_1 = require("@headless-adminapp/app/components/ScrollView");
|
|
6
|
+
const locale_1 = require("@headless-adminapp/app/locale");
|
|
7
|
+
const FormBody = ({ children }) => {
|
|
8
|
+
const { direction } = (0, locale_1.useLocale)();
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column', flex: 1 }, children: (0, jsx_runtime_1.jsx)(ScrollView_1.ScrollView, { autoHide: true, className: "FormBody_scrollview", rtl: direction === 'rtl', children: children }) }));
|
|
10
|
+
};
|
|
11
|
+
exports.FormBody = FormBody;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FormBody';
|
|
@@ -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("./FormBody"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { FormSectionColumn } from './FormSectionColumn';
|
|
3
|
+
import { FormSectionLoading } from './FormSectionLoading';
|
|
4
|
+
interface FormSectionProps {
|
|
5
|
+
title?: string;
|
|
6
|
+
fullHeight?: boolean;
|
|
7
|
+
columnCount?: number;
|
|
8
|
+
labelPosition?: 'top' | 'left';
|
|
9
|
+
noPadding?: boolean;
|
|
10
|
+
hideLabel?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const FormSection: FC<PropsWithChildren<FormSectionProps>> & {
|
|
13
|
+
Column: typeof FormSectionColumn;
|
|
14
|
+
Loading: typeof FormSectionLoading;
|
|
15
|
+
};
|
|
16
|
+
export {};
|