@headless-adminapp/fluent 0.0.17-alpha.52 → 0.0.17-alpha.53
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.js +7 -11
- package/App/AppHeaderContianer.js +38 -42
- package/App/AppLogo.js +8 -12
- package/App/AppStringContext.js +9 -13
- package/App/AppUI.js +11 -15
- package/App/LayoutProvider.js +11 -15
- package/App/NavigationContainer.js +25 -29
- package/App/QuickActionItem.js +5 -9
- package/App/index.js +1 -5
- package/App/utils.js +1 -4
- package/CommandBar/Button.js +14 -17
- package/CommandBar/Divider.js +6 -9
- package/CommandBar/IconButton.js +13 -16
- package/CommandBar/Label.js +8 -11
- package/CommandBar/MenuButton.js +17 -20
- package/CommandBar/MenuItem.js +15 -18
- package/CommandBar/MenuItems.js +8 -11
- package/CommandBar/MenuList.js +9 -12
- package/CommandBar/Wrapper.js +7 -10
- package/CommandBar/index.js +13 -15
- package/DataForm/SectionControl.js +4 -7
- package/DataGrid/ActionCell.js +11 -14
- package/DataGrid/CommandContainer.js +6 -10
- package/DataGrid/CustomizeColumns/AddColumns.js +34 -37
- package/DataGrid/CustomizeColumns/ColumnItem.js +19 -23
- package/DataGrid/CustomizeColumns/CustomizeColumns.js +36 -42
- package/DataGrid/CustomizeColumns/index.js +1 -5
- package/DataGrid/FormSubgridCommandContainer.js +13 -17
- package/DataGrid/FormSubgridViewSelector.js +18 -22
- package/DataGrid/GridColumnHeader/ConditionValueControl.js +14 -20
- package/DataGrid/GridColumnHeader/FilterForm.js +23 -27
- package/DataGrid/GridColumnHeader/OperatorSelect.js +13 -19
- package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +28 -32
- package/DataGrid/GridColumnHeader/index.js +1 -5
- package/DataGrid/GridColumnHeader/utils.js +2 -6
- package/DataGrid/GridHeaderContainer.js +4 -8
- package/DataGrid/GridHeaderDesktop.js +26 -30
- package/DataGrid/GridHeaderMobile.js +17 -21
- package/DataGrid/GridListContainer.js +39 -43
- package/DataGrid/GridPaginationContainer.js +12 -16
- package/DataGrid/GridTableContainer.js +74 -78
- package/DataGrid/TableCell/TableCellAction.js +11 -15
- package/DataGrid/TableCell/TableCellBase.js +4 -8
- package/DataGrid/TableCell/TableCellCheckbox.js +7 -10
- package/DataGrid/TableCell/TableCellChoice.js +11 -14
- package/DataGrid/TableCell/TableCellLink.d.ts +1 -1
- package/DataGrid/TableCell/TableCellLink.js +13 -12
- package/DataGrid/TableCell/TableCellText.js +7 -10
- package/DataGrid/TableCell/index.js +4 -20
- package/DataGrid/index.js +4 -11
- package/DataGrid/types.js +1 -2
- package/DataGrid/useTableColumns.js +139 -90
- package/DataGrid/utils.js +1 -5
- package/DialogContainer/AlertDialog.js +5 -8
- package/DialogContainer/ConfirmDialog.js +6 -9
- package/DialogContainer/DialogContainer.js +14 -18
- package/DialogContainer/ErrorDialog.js +9 -12
- package/DialogContainer/PromptDialog.js +30 -57
- package/DialogContainer/index.js +1 -5
- package/Insights/CommandBarContainer.js +11 -14
- package/Insights/FilterBarContainer.js +17 -20
- package/Insights/Grid.js +9 -13
- package/Insights/InsightsContainer.js +19 -22
- package/Insights/WidgetChartContainer.js +30 -34
- package/Insights/WidgetDataGridContainer.js +32 -35
- package/Insights/WidgetTableContainer.js +24 -28
- package/Insights/WidgetTileContainer.js +12 -16
- package/Insights/WidgetTitleBar.js +9 -15
- package/Insights/Widgets.js +25 -28
- package/Insights/charts/AreaChart.js +12 -15
- package/Insights/charts/BarChart.js +12 -15
- package/Insights/charts/ComposedChart.js +12 -15
- package/Insights/charts/CustomTooltipContent.js +8 -12
- package/Insights/charts/GaugeChart.js +3 -6
- package/Insights/charts/LineChart.js +12 -15
- package/Insights/charts/OhlcChart.js +36 -41
- package/Insights/charts/PieChart.js +23 -26
- package/Insights/charts/RadarChart.js +16 -19
- package/Insights/charts/ScatterChart.js +23 -26
- package/Insights/charts/constants.js +1 -4
- package/Insights/charts/formatters.js +17 -29
- package/Insights/charts/index.js +1 -2
- package/Insights/charts/renderers.js +25 -36
- package/Insights/hooks/useQueriesData.js +19 -25
- package/Insights/hooks/useWidgetDetail.js +13 -16
- package/OverflowCommandBar/OverflowCommandBar.js +12 -19
- package/OverflowCommandBar/OverflowMenu.js +16 -20
- package/OverflowCommandBar/OverflowMenuDivider.js +6 -10
- package/OverflowCommandBar/index.js +3 -9
- package/OverflowCommandBar/render.js +9 -15
- package/OverflowCommandBar/utils.js +1 -4
- package/PageBoard/BoardColumn.js +5 -8
- package/PageBoard/BoardColumnCard.js +12 -15
- package/PageBoard/BoardColumnUI.js +34 -38
- package/PageBoard/BoardingColumnCardLoading.js +10 -13
- package/PageBoard/Header.js +16 -20
- package/PageBoard/PageBoard.d.ts +1 -1
- package/PageBoard/PageBoard.js +26 -29
- package/PageBoard/index.js +1 -5
- package/PageEntityForm/CommandContainer.js +21 -25
- package/PageEntityForm/FormTabRelated.js +17 -20
- package/PageEntityForm/PageEntityForm.js +16 -20
- package/PageEntityForm/PageEntityFormDesktopContainer.js +68 -72
- package/PageEntityForm/PageEntityFormStringContext.js +5 -9
- package/PageEntityForm/ProcessFlow.js +21 -24
- package/PageEntityForm/RecordCard.js +21 -24
- package/PageEntityForm/RecordCardLoading.js +10 -13
- package/PageEntityForm/RecordSetNavigatorContainer.js +30 -34
- package/PageEntityForm/RelatedViewSelector.js +28 -31
- package/PageEntityForm/SectionContainer.js +25 -28
- package/PageEntityForm/StandardControl.d.ts +3 -3
- package/PageEntityForm/StandardControl.js +74 -81
- package/PageEntityForm/SubgridControl.js +20 -23
- package/PageEntityForm/index.js +1 -5
- package/PageEntityView/FormSubgridContainer.js +22 -26
- package/PageEntityView/PageEntityView.js +15 -19
- package/PageEntityView/PageEntityViewDesktopContainer.js +9 -13
- package/PageEntityView/PageEntityViewDesktopFrame.js +17 -21
- package/PageEntityView/PageEntityViewMobileContainer.js +9 -13
- package/PageEntityView/PageEntityViewStringContext.js +5 -9
- package/PageEntityView/index.js +1 -5
- package/PageInsights/PageInsights.js +9 -13
- package/PageInsights/index.js +1 -6
- package/ProgressIndicatorContainer/index.js +10 -14
- package/ToastNotificationContainer/index.js +14 -18
- package/componentStore.js +2 -5
- package/components/BodyLoading.js +7 -11
- package/components/DialogLogin.js +5 -8
- package/components/LoginForm.js +21 -47
- package/components/PageBroken.js +5 -8
- package/components/PageLoading.js +5 -8
- package/components/PageLogin.js +14 -17
- package/form/FormControl.js +39 -44
- package/form/FormControlLoading.js +4 -8
- package/form/controls/AttachmentControl.js +56 -60
- package/form/controls/AttachmentsControl.js +15 -19
- package/form/controls/CurrencyControl.js +10 -13
- package/form/controls/DateControl.js +18 -24
- package/form/controls/DateRangeControl.js +14 -20
- package/form/controls/DateTimeControl.js +39 -45
- package/form/controls/DecimalControl.js +8 -11
- package/form/controls/DurationControl.js +11 -15
- package/form/controls/EmailControl.js +7 -10
- package/form/controls/IntegerControl.js +4 -7
- package/form/controls/LookupControl.d.ts +1 -0
- package/form/controls/LookupControl.js +75 -38
- package/form/controls/MultiSelectControl.js +8 -11
- package/form/controls/MultiSelectLookupControl.js +40 -43
- package/form/controls/PasswordControl.js +8 -11
- package/form/controls/RichTextControl.js +5 -32
- package/form/controls/SelectControl.js +8 -11
- package/form/controls/SwitchControl.js +4 -7
- package/form/controls/TelephoneControl.js +7 -10
- package/form/controls/TextAreaControl.js +4 -7
- package/form/controls/TextControl.js +5 -8
- package/form/controls/UrlControl.js +7 -10
- package/form/controls/types.js +1 -2
- package/form/controls/useLookupData.js +14 -18
- package/form/layout/FormBody/FormBody.js +6 -10
- package/form/layout/FormBody/index.js +1 -17
- package/form/layout/FormSection/FormSection.js +18 -22
- package/form/layout/FormSection/FormSectionColumn.js +3 -7
- package/form/layout/FormSection/FormSectionLoading.js +1 -5
- package/form/layout/FormSection/index.js +1 -5
- package/form/layout/FormTab/FormTab.js +16 -20
- package/form/layout/FormTab/FormTabColumn.js +5 -9
- package/form/layout/FormTab/index.js +1 -5
- package/form/layout/TabContext.js +2 -5
- package/form/layout/index.js +3 -9
- package/form/types.js +1 -2
- package/package.json +3 -2
- package/types/index.js +1 -2
- package/utils/avatar.d.ts +2 -0
- package/utils/avatar.js +42 -0
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DecimalControl = DecimalControl;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
2
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, decimalPlaces, }) {
|
|
9
|
-
const [internalValue, setInternalValue] =
|
|
10
|
-
const internalValueRef =
|
|
3
|
+
import { Input } from '@fluentui/react-components';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
export function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, decimalPlaces, }) {
|
|
6
|
+
const [internalValue, setInternalValue] = useState(value ? value.toString() : '');
|
|
7
|
+
const internalValueRef = useRef(internalValue);
|
|
11
8
|
internalValueRef.current = internalValue;
|
|
12
|
-
|
|
9
|
+
useEffect(() => {
|
|
13
10
|
let _value = '';
|
|
14
11
|
if (typeof value === 'number') {
|
|
15
12
|
_value = value.toString();
|
|
@@ -46,7 +43,7 @@ function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, dis
|
|
|
46
43
|
setInternalValue(value);
|
|
47
44
|
onChange === null || onChange === void 0 ? void 0 : onChange(Number(value));
|
|
48
45
|
};
|
|
49
|
-
return ((
|
|
46
|
+
return (_jsx(Input, { placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: internalValue, onChange: handleChange, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), disabled: disabled, readOnly: readOnly, style: {
|
|
50
47
|
width: '100%',
|
|
51
48
|
} }));
|
|
52
49
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const react_components_1 = require("@fluentui/react-components");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const useStyles = (0, react_components_1.makeStyles)({
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Combobox, makeStyles, Option } from '@fluentui/react-components';
|
|
3
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
4
|
+
const useStyles = makeStyles({
|
|
8
5
|
listbox: {
|
|
9
6
|
maxHeight: '300px !important',
|
|
10
7
|
},
|
|
@@ -100,20 +97,20 @@ const options = [
|
|
|
100
97
|
value: '4320',
|
|
101
98
|
},
|
|
102
99
|
];
|
|
103
|
-
const DurationControl = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, }) => {
|
|
104
|
-
const [searchText, setSearchText] =
|
|
105
|
-
const [filterEnabled, setFilterEnabled] =
|
|
100
|
+
export const DurationControl = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, }) => {
|
|
101
|
+
const [searchText, setSearchText] = useState('');
|
|
102
|
+
const [filterEnabled, setFilterEnabled] = useState(false);
|
|
106
103
|
const styles = useStyles();
|
|
107
|
-
|
|
104
|
+
useEffect(() => {
|
|
108
105
|
setSearchText(getDisplayValue(value));
|
|
109
106
|
}, [value]);
|
|
110
|
-
const filteredItems =
|
|
107
|
+
const filteredItems = useMemo(() => {
|
|
111
108
|
if (!filterEnabled) {
|
|
112
109
|
return options;
|
|
113
110
|
}
|
|
114
111
|
return options.filter((item) => item.text.toLowerCase().includes(searchText.toLowerCase()));
|
|
115
112
|
}, [searchText, filterEnabled]);
|
|
116
|
-
return ((
|
|
113
|
+
return (_jsx("div", { style: { position: 'relative', width: '100%' }, children: _jsx(Combobox, { name: name, appearance: "filled-darker", placeholder: placeholder, inputMode: "search", style: { width: '100%', minWidth: 'unset' }, listbox: { className: styles.listbox }, autoComplete: "off", readOnly: readOnly || disabled, value: searchText, disableAutoFocus: true, selectedOptions: value ? [value.toString()] : [], onBlur: () => {
|
|
117
114
|
let newValue = null;
|
|
118
115
|
if (searchText) {
|
|
119
116
|
newValue = resolveValue(searchText);
|
|
@@ -140,9 +137,8 @@ const DurationControl = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
140
137
|
onChange === null || onChange === void 0 ? void 0 : onChange(Number(item.optionValue));
|
|
141
138
|
}
|
|
142
139
|
setSearchText('');
|
|
143
|
-
}, children: filteredItems.map((item) => ((
|
|
140
|
+
}, children: filteredItems.map((item) => (_jsx(Option, { value: item.value, children: item.text }, item.value))) }) }));
|
|
144
141
|
};
|
|
145
|
-
exports.DurationControl = DurationControl;
|
|
146
142
|
function getDisplayValue(value) {
|
|
147
143
|
if (!value) {
|
|
148
144
|
return '';
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const icons_1 = require("@headless-adminapp/icons");
|
|
7
|
-
function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, }) {
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "email", placeholder: placeholder, id: id, appearance: "filled-darker", name: name,
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Input, tokens } from '@fluentui/react-components';
|
|
3
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
4
|
+
export function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, }) {
|
|
5
|
+
return (_jsx(Input, { type: "email", placeholder: placeholder, id: id, appearance: "filled-darker", name: name,
|
|
9
6
|
// size="sm"
|
|
10
7
|
value: value || '', onChange: (e) => {
|
|
11
8
|
textTransform === 'uppercase'
|
|
@@ -17,6 +14,6 @@ function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder,
|
|
|
17
14
|
// invalid={error}
|
|
18
15
|
disabled: disabled, readOnly: readOnly, autoComplete: autoComplete, style: {
|
|
19
16
|
flex: 1,
|
|
20
|
-
paddingRight:
|
|
21
|
-
}, contentAfter: !!value ? ((
|
|
17
|
+
paddingRight: tokens.spacingHorizontalXS,
|
|
18
|
+
}, contentAfter: !!value ? (_jsx(Button, { onClick: () => window.open(`mailto:${value}`, '_blank'), color: "primary", appearance: "transparent", icon: _jsx(Icons.Mail, {}), size: "small" })) : undefined }));
|
|
22
19
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IntegerControl = IntegerControl;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
2
|
/* eslint-disable unused-imports/no-unused-vars */
|
|
6
|
-
|
|
7
|
-
function IntegerControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }) {
|
|
8
|
-
return ((
|
|
3
|
+
import { SpinButton } from '@fluentui/react-components';
|
|
4
|
+
export function IntegerControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }) {
|
|
5
|
+
return (_jsx(SpinButton, { appearance: "filled-darker", placeholder: placeholder, id: id, name: name, value: value !== null && value !== void 0 ? value : null, onChange: (e, data) => {
|
|
9
6
|
if (data.value !== undefined) {
|
|
10
7
|
onChange === null || onChange === void 0 ? void 0 : onChange(data.value);
|
|
11
8
|
}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function LookupControl(props) {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar, Body1, Combobox, Divider, Link, makeStyles, mergeClasses, Option, Spinner, Tag, TagGroup, tokens, ToolbarButton, } from '@fluentui/react-components';
|
|
3
|
+
import { useAppContext } from '@headless-adminapp/app/app';
|
|
4
|
+
import { useDebouncedValue } from '@headless-adminapp/app/hooks';
|
|
5
|
+
import { useRouter, useRouteResolver, } from '@headless-adminapp/app/route/hooks';
|
|
6
|
+
import { PageType } from '@headless-adminapp/core/experience/app';
|
|
7
|
+
import { IconPlaceholder, Icons } from '@headless-adminapp/icons';
|
|
8
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
9
|
+
import { useAppStrings } from '../../App/AppStringContext';
|
|
10
|
+
import { RecordCard } from '../../PageEntityForm/RecordCard';
|
|
11
|
+
import { getAvatarColor } from '../../utils/avatar';
|
|
12
|
+
import { useGetLookupView, useLookupData } from './useLookupData';
|
|
13
|
+
export function LookupControl(props) {
|
|
15
14
|
const Control = LookupControlMd;
|
|
16
|
-
return (
|
|
15
|
+
return _jsx(Control, Object.assign({}, props));
|
|
17
16
|
}
|
|
18
|
-
const useStyles =
|
|
17
|
+
const useStyles = makeStyles({
|
|
19
18
|
option: {
|
|
20
19
|
padding: 0,
|
|
21
20
|
'& .fui-Option__checkIcon': {
|
|
22
21
|
display: 'none',
|
|
23
22
|
},
|
|
24
23
|
'&[data-activedescendant-focusvisible]': {
|
|
25
|
-
background:
|
|
24
|
+
background: tokens.colorNeutralBackground1Hover,
|
|
26
25
|
'&:after': {
|
|
27
26
|
border: 'none !important',
|
|
28
27
|
// background: tokens.colorNeutralBackground1Hover,
|
|
@@ -31,13 +30,13 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
31
30
|
},
|
|
32
31
|
});
|
|
33
32
|
const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, dataService, schema, viewId, allowNavigation, allowNewRecord, }) => {
|
|
34
|
-
const [lookupEnabled, setLookupEnabled] =
|
|
35
|
-
const [open, setOpen] =
|
|
36
|
-
const [searchText, setSearchText] =
|
|
37
|
-
const { loockupStrings } =
|
|
38
|
-
const routeResolver =
|
|
39
|
-
const router =
|
|
40
|
-
const path =
|
|
33
|
+
const [lookupEnabled, setLookupEnabled] = useState(false);
|
|
34
|
+
const [open, setOpen] = useState(false);
|
|
35
|
+
const [searchText, setSearchText] = useState('');
|
|
36
|
+
const { loockupStrings } = useAppStrings();
|
|
37
|
+
const routeResolver = useRouteResolver();
|
|
38
|
+
const router = useRouter();
|
|
39
|
+
const path = useMemo(() => {
|
|
41
40
|
if (!value) {
|
|
42
41
|
return '';
|
|
43
42
|
}
|
|
@@ -46,11 +45,11 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
46
45
|
}
|
|
47
46
|
return routeResolver({
|
|
48
47
|
logicalName: schema.logicalName,
|
|
49
|
-
type:
|
|
48
|
+
type: PageType.EntityForm,
|
|
50
49
|
id: value.id,
|
|
51
50
|
});
|
|
52
51
|
}, [allowNavigation, routeResolver, schema.logicalName, value]);
|
|
53
|
-
const handleOpenRecord =
|
|
52
|
+
const handleOpenRecord = useCallback((event) => {
|
|
54
53
|
event.preventDefault();
|
|
55
54
|
event.stopPropagation();
|
|
56
55
|
if (!path) {
|
|
@@ -58,11 +57,11 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
58
57
|
}
|
|
59
58
|
router.push(path);
|
|
60
59
|
}, [path, router]);
|
|
61
|
-
|
|
60
|
+
useEffect(() => {
|
|
62
61
|
if (open)
|
|
63
62
|
setLookupEnabled(true);
|
|
64
63
|
}, [open]);
|
|
65
|
-
const [debouncedSearchText] =
|
|
64
|
+
const [debouncedSearchText] = useDebouncedValue(searchText, 500);
|
|
66
65
|
const styles = useStyles();
|
|
67
66
|
// const useLookupData = useMemo(
|
|
68
67
|
// () =>
|
|
@@ -82,15 +81,15 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
82
81
|
// search: async ? debouncedSearchText : '',
|
|
83
82
|
// enabled: lookupEnabled,
|
|
84
83
|
// });
|
|
85
|
-
const { isLoading: isViewLoading, view } =
|
|
86
|
-
const { data, isLoading } =
|
|
84
|
+
const { isLoading: isViewLoading, view } = useGetLookupView(schema.logicalName, viewId);
|
|
85
|
+
const { data, isLoading } = useLookupData({
|
|
87
86
|
schema,
|
|
88
87
|
view: view === null || view === void 0 ? void 0 : view.experience,
|
|
89
88
|
searchText: debouncedSearchText,
|
|
90
89
|
dataService,
|
|
91
90
|
enabled: lookupEnabled && !isViewLoading && !value && !readOnly && !disabled,
|
|
92
91
|
});
|
|
93
|
-
|
|
92
|
+
useEffect(() => {
|
|
94
93
|
if (value) {
|
|
95
94
|
setSearchText(value.name);
|
|
96
95
|
}
|
|
@@ -111,23 +110,61 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
111
110
|
});
|
|
112
111
|
}
|
|
113
112
|
};
|
|
114
|
-
return ((
|
|
113
|
+
return (_jsxs("div", { style: { position: 'relative', width: '100%' }, children: [_jsxs(Combobox, { name: name, appearance: "filled-darker", expandIcon: readOnly || disabled ? null : isLoading ? (_jsx(Spinner, { size: "extra-tiny" })) : (_jsx(Icons.Search, { size: 18 })), placeholder: !value ? placeholder : '', inputMode: "search", style: { width: '100%', minWidth: 'unset' }, autoComplete: "off", readOnly: readOnly || disabled,
|
|
115
114
|
// disabled={disabled}
|
|
116
115
|
open: open && !value && !readOnly && !disabled, value: !value ? searchText : '', onOpenChange: (e, data) => setOpen(data.open), onChange: (e) => {
|
|
117
116
|
setSearchText(e.target.value);
|
|
118
117
|
}, onOptionSelect: (e, item) => {
|
|
119
118
|
const _item = data === null || data === void 0 ? void 0 : data.records.find((x) => String(x[schema.idAttribute]) === String(item.optionValue));
|
|
120
119
|
handleChange(_item !== null && _item !== void 0 ? _item : null);
|
|
121
|
-
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data === null || data === void 0 ? void 0 : data.records.map((item) => ((
|
|
122
|
-
paddingInline:
|
|
123
|
-
paddingBlock:
|
|
124
|
-
}, children: (
|
|
120
|
+
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data === null || data === void 0 ? void 0 : data.records.map((item) => (_jsx(Option, { value: item[schema.idAttribute], className: mergeClasses(styles.option), text: item[schema.primaryAttribute], children: _jsx(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) && (_jsx("div", { style: {
|
|
121
|
+
paddingInline: tokens.spacingHorizontalL,
|
|
122
|
+
paddingBlock: tokens.spacingVerticalS,
|
|
123
|
+
}, children: _jsx(Body1, { children: loockupStrings.noRecordsFound }) })), allowNewRecord && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx("div", { style: { marginTop: tokens.spacingVerticalXXS }, children: _jsx(ToolbarButton, { style: { fontWeight: 'normal' }, icon: _jsx(Icons.Add, {}), children: loockupStrings.newRecord }) })] }))] }), !!value && (_jsx("div", { style: {
|
|
125
124
|
position: 'absolute',
|
|
126
125
|
inset: 0,
|
|
127
126
|
alignItems: 'center',
|
|
128
127
|
paddingInline: 4,
|
|
129
128
|
display: 'flex',
|
|
130
|
-
}, children: (
|
|
129
|
+
}, children: _jsx(TagGroup, { as: "div", children: _jsx(Tag, { as: "span", appearance: "brand", size: "small", dismissible: !disabled && !readOnly, value: value.id, style: { paddingRight: !disabled && !readOnly ? 0 : 5 }, dismissIcon: _jsx("div", { style: { display: 'flex', cursor: 'pointer' }, onClick: () => {
|
|
131
130
|
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
132
|
-
}, children: (
|
|
131
|
+
}, children: _jsx(Icons.Close, { size: 16 }) }), primaryText: {
|
|
132
|
+
style: {
|
|
133
|
+
paddingBottom: 0,
|
|
134
|
+
},
|
|
135
|
+
}, children: allowNavigation && path ? (_jsxs(Link, { href: path, onClick: handleOpenRecord, style: {
|
|
136
|
+
display: 'flex',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
gap: tokens.spacingHorizontalXS,
|
|
139
|
+
}, children: [_jsx(LookupAvatar, { schema: schema, logicalName: schema.logicalName, value: value }), _jsx(Body1, { style: {
|
|
140
|
+
overflow: 'hidden',
|
|
141
|
+
textOverflow: 'ellipsis',
|
|
142
|
+
whiteSpace: 'nowrap',
|
|
143
|
+
}, children: value === null || value === void 0 ? void 0 : value.name })] })) : (_jsx(Body1, { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: value === null || value === void 0 ? void 0 : value.name })) }) }) }))] }));
|
|
144
|
+
};
|
|
145
|
+
const LookupAvatar = ({ logicalName, schema, value, }) => {
|
|
146
|
+
var _a, _b;
|
|
147
|
+
const { schemaMetadataDic } = useAppContext();
|
|
148
|
+
if (!schema.avatarAttribute) {
|
|
149
|
+
const experienceSchema = schemaMetadataDic[logicalName];
|
|
150
|
+
const Icon = (_b = (_a = experienceSchema.icon) !== null && _a !== void 0 ? _a : Icons.Entity) !== null && _b !== void 0 ? _b : IconPlaceholder;
|
|
151
|
+
return (_jsx(Avatar, { style: {
|
|
152
|
+
width: 20,
|
|
153
|
+
height: 20,
|
|
154
|
+
}, icon: {
|
|
155
|
+
style: {
|
|
156
|
+
background: 'transparent',
|
|
157
|
+
color: 'inherit',
|
|
158
|
+
},
|
|
159
|
+
children: _jsx(Icon, { size: 20 }),
|
|
160
|
+
} }));
|
|
161
|
+
}
|
|
162
|
+
return (_jsx(Avatar, { style: {
|
|
163
|
+
width: 20,
|
|
164
|
+
height: 20,
|
|
165
|
+
fontSize: tokens.fontSizeBase100,
|
|
166
|
+
backgroundColor: 'transparent',
|
|
167
|
+
}, name: value === null || value === void 0 ? void 0 : value.name, color: getAvatarColor(value === null || value === void 0 ? void 0 : value.name), image: {
|
|
168
|
+
src: value === null || value === void 0 ? void 0 : value.avatar,
|
|
169
|
+
} }));
|
|
133
170
|
};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
function MultiSelectControl({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, }) {
|
|
8
|
-
const transformedOptions = (0, react_1.useMemo)(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Dropdown, Option } from '@fluentui/react-components';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
export default function MultiSelectControl({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, }) {
|
|
5
|
+
const transformedOptions = useMemo(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
|
|
9
6
|
const handleChange = (value) => {
|
|
10
7
|
const selectedOptions = options.filter((x) => value.includes(String(x.value)));
|
|
11
8
|
onChange === null || onChange === void 0 ? void 0 : onChange(selectedOptions.map((x) => x.value));
|
|
12
9
|
};
|
|
13
|
-
const selectedOptions =
|
|
14
|
-
return ((
|
|
10
|
+
const selectedOptions = useMemo(() => options.filter((x) => value === null || value === void 0 ? void 0 : value.includes(x.value)), [options, value]);
|
|
11
|
+
return (_jsx(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
12
|
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) => ((
|
|
13
|
+
}, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), disabled: disabled, children: transformedOptions.map((x) => (_jsx(Option, { value: x.value, children: x.label }, x.value))) }));
|
|
17
14
|
}
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const RecordCard_1 = require("../../PageEntityForm/RecordCard");
|
|
13
|
-
const useLookupData_1 = require("./useLookupData");
|
|
14
|
-
function MultiSelectLookupControl(props) {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Body1, Combobox, Divider, Link, makeStyles, mergeClasses, Option, Spinner, Tag, TagGroup, tokens, ToolbarButton, } from '@fluentui/react-components';
|
|
3
|
+
import { useDebouncedValue } from '@headless-adminapp/app/hooks';
|
|
4
|
+
import { useRouter, useRouteResolver, } from '@headless-adminapp/app/route/hooks';
|
|
5
|
+
import { PageType } from '@headless-adminapp/core/experience/app';
|
|
6
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
7
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
|
+
import { useAppStrings } from '../../App/AppStringContext';
|
|
9
|
+
import { RecordCard } from '../../PageEntityForm/RecordCard';
|
|
10
|
+
import { useGetLookupView, useLookupData } from './useLookupData';
|
|
11
|
+
export function MultiSelectLookupControl(props) {
|
|
15
12
|
const Control = LookupControlMd;
|
|
16
|
-
return (
|
|
13
|
+
return _jsx(Control, Object.assign({}, props));
|
|
17
14
|
}
|
|
18
|
-
const useStyles =
|
|
15
|
+
const useStyles = makeStyles({
|
|
19
16
|
option: {
|
|
20
17
|
padding: 0,
|
|
21
18
|
'& .fui-Option__checkIcon': {
|
|
22
19
|
display: 'none',
|
|
23
20
|
},
|
|
24
21
|
'&[data-activedescendant-focusvisible]': {
|
|
25
|
-
background:
|
|
22
|
+
background: tokens.colorNeutralBackground1Hover,
|
|
26
23
|
'&:after': {
|
|
27
24
|
border: 'none !important',
|
|
28
25
|
// background: tokens.colorNeutralBackground1Hover,
|
|
@@ -31,28 +28,28 @@ const useStyles = (0, react_components_1.makeStyles)({
|
|
|
31
28
|
},
|
|
32
29
|
});
|
|
33
30
|
const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, dataService, schema, viewId, allowNavigation, allowNewRecord, }) => {
|
|
34
|
-
const [lookupEnabled, setLookupEnabled] =
|
|
35
|
-
const [open, setOpen] =
|
|
36
|
-
const [searchText, setSearchText] =
|
|
37
|
-
const { loockupStrings } =
|
|
38
|
-
|
|
31
|
+
const [lookupEnabled, setLookupEnabled] = useState(false);
|
|
32
|
+
const [open, setOpen] = useState(false);
|
|
33
|
+
const [searchText, setSearchText] = useState('');
|
|
34
|
+
const { loockupStrings } = useAppStrings();
|
|
35
|
+
useEffect(() => {
|
|
39
36
|
if (open)
|
|
40
37
|
setLookupEnabled(true);
|
|
41
38
|
}, [open]);
|
|
42
|
-
const [debouncedSearchText] =
|
|
39
|
+
const [debouncedSearchText] = useDebouncedValue(searchText, 500);
|
|
43
40
|
const styles = useStyles();
|
|
44
|
-
const { isLoading: isViewLoading, view } =
|
|
45
|
-
const { data, isLoading } =
|
|
41
|
+
const { isLoading: isViewLoading, view } = useGetLookupView(schema.logicalName, viewId);
|
|
42
|
+
const { data, isLoading } = useLookupData({
|
|
46
43
|
schema,
|
|
47
44
|
view: view === null || view === void 0 ? void 0 : view.experience,
|
|
48
45
|
searchText: debouncedSearchText,
|
|
49
46
|
dataService,
|
|
50
47
|
enabled: lookupEnabled && !isViewLoading && !readOnly && !disabled,
|
|
51
48
|
});
|
|
52
|
-
const tagGroupContainerRef =
|
|
53
|
-
const [inputLeft, setInputLeft] =
|
|
54
|
-
const [containerHeight, setContainerHeight] =
|
|
55
|
-
|
|
49
|
+
const tagGroupContainerRef = useRef(null);
|
|
50
|
+
const [inputLeft, setInputLeft] = useState(0);
|
|
51
|
+
const [containerHeight, setContainerHeight] = useState(32);
|
|
52
|
+
useEffect(() => {
|
|
56
53
|
const timer = setInterval(() => {
|
|
57
54
|
var _a, _b, _c;
|
|
58
55
|
if (!tagGroupContainerRef.current) {
|
|
@@ -122,7 +119,7 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
122
119
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
123
120
|
}
|
|
124
121
|
};
|
|
125
|
-
return ((
|
|
122
|
+
return (_jsxs("div", { style: { position: 'relative', width: '100%', height: containerHeight }, children: [_jsxs(Combobox, { name: name, appearance: "filled-darker", expandIcon: _jsx("div", { style: { position: 'absolute', right: 4, bottom: 8 }, children: readOnly || disabled ? null : isLoading ? (_jsx(Spinner, { size: "extra-tiny" })) : (_jsx(Icons.Search, { size: 18 })) }), input: {
|
|
126
123
|
style: {
|
|
127
124
|
position: 'absolute',
|
|
128
125
|
bottom: 0,
|
|
@@ -139,10 +136,10 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
139
136
|
if (!_item)
|
|
140
137
|
return;
|
|
141
138
|
handleAdd(_item);
|
|
142
|
-
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data === null || data === void 0 ? void 0 : data.records.map((item) => ((
|
|
143
|
-
paddingInline:
|
|
144
|
-
paddingBlock:
|
|
145
|
-
}, children: (
|
|
139
|
+
}, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data === null || data === void 0 ? void 0 : data.records.map((item) => (_jsx(Option, { value: item[schema.idAttribute], className: mergeClasses(styles.option), text: item[schema.primaryAttribute], children: _jsx(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) && (_jsx("div", { style: {
|
|
140
|
+
paddingInline: tokens.spacingHorizontalL,
|
|
141
|
+
paddingBlock: tokens.spacingVerticalS,
|
|
142
|
+
}, children: _jsx(Body1, { children: loockupStrings.noRecordsFound }) })), allowNewRecord && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx("div", { style: { marginTop: tokens.spacingVerticalXXS }, children: _jsx(ToolbarButton, { style: { fontWeight: 'normal' }, icon: _jsx(Icons.Add, {}), children: loockupStrings.newRecord }) })] }))] }), _jsx("div", { ref: tagGroupContainerRef, style: {
|
|
146
143
|
position: 'absolute',
|
|
147
144
|
top: 4,
|
|
148
145
|
left: 0,
|
|
@@ -151,12 +148,12 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
|
|
|
151
148
|
paddingInline: 4,
|
|
152
149
|
display: 'flex',
|
|
153
150
|
pointerEvents: 'none',
|
|
154
|
-
}, children: (
|
|
151
|
+
}, children: _jsx(TagGroup, { as: "div", style: { flexWrap: 'wrap', rowGap: 8 }, children: value === null || value === void 0 ? void 0 : value.map((item, index) => (_jsx(TagItem, { disabled: disabled, readOnly: readOnly, value: item, onRemove: handleRemove, allowNavigation: allowNavigation }, `${item.id}-${index}`))) }) })] }));
|
|
155
152
|
};
|
|
156
153
|
function TagItem({ disabled, readOnly, value, onRemove, allowNavigation, }) {
|
|
157
|
-
const routeResolver =
|
|
158
|
-
const router =
|
|
159
|
-
const path =
|
|
154
|
+
const routeResolver = useRouteResolver();
|
|
155
|
+
const router = useRouter();
|
|
156
|
+
const path = useMemo(() => {
|
|
160
157
|
if (!value) {
|
|
161
158
|
return '';
|
|
162
159
|
}
|
|
@@ -165,11 +162,11 @@ function TagItem({ disabled, readOnly, value, onRemove, allowNavigation, }) {
|
|
|
165
162
|
}
|
|
166
163
|
return routeResolver({
|
|
167
164
|
logicalName: value.logicalName,
|
|
168
|
-
type:
|
|
165
|
+
type: PageType.EntityForm,
|
|
169
166
|
id: value.id,
|
|
170
167
|
});
|
|
171
168
|
}, [allowNavigation, routeResolver, value]);
|
|
172
|
-
const handleOpenRecord =
|
|
169
|
+
const handleOpenRecord = useCallback((event) => {
|
|
173
170
|
event.preventDefault();
|
|
174
171
|
event.stopPropagation();
|
|
175
172
|
if (!path) {
|
|
@@ -177,10 +174,10 @@ function TagItem({ disabled, readOnly, value, onRemove, allowNavigation, }) {
|
|
|
177
174
|
}
|
|
178
175
|
router.push(path);
|
|
179
176
|
}, [path, router]);
|
|
180
|
-
return ((
|
|
177
|
+
return (_jsx(Tag, { as: "span", appearance: "brand", size: "small", dismissible: !disabled && !readOnly, value: value.id, style: {
|
|
181
178
|
paddingRight: !disabled && !readOnly ? 0 : 5,
|
|
182
179
|
pointerEvents: 'auto',
|
|
183
|
-
}, dismissIcon: (
|
|
180
|
+
}, dismissIcon: _jsx("div", { style: { display: 'flex', cursor: 'pointer' }, onClick: () => {
|
|
184
181
|
onRemove === null || onRemove === void 0 ? void 0 : onRemove(value.id);
|
|
185
|
-
}, children: (
|
|
182
|
+
}, children: _jsx(Icons.Close, { size: 16 }) }), children: allowNavigation && !!path ? (_jsx(Link, { onClick: handleOpenRecord, children: _jsx(Body1, { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: value === null || value === void 0 ? void 0 : value.name }) })) : (_jsx(Body1, { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: value === null || value === void 0 ? void 0 : value.name })) }));
|
|
186
183
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
function PasswordControl({ value, onChange, id, name, onBlur, onFocus, 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(),
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Input } from '@fluentui/react-components';
|
|
3
|
+
import { Icons } from '@headless-adminapp/icons';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
export function PasswordControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, appearance = 'filled-darker', }) {
|
|
6
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
7
|
+
return (_jsx(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
8
|
// invalid={error}
|
|
12
|
-
disabled: disabled, contentAfter: (
|
|
9
|
+
disabled: disabled, contentAfter: _jsx(Button, { appearance: "transparent", size: "small", onClick: () => setShowPassword(!showPassword), icon: showPassword ? _jsx(Icons.EyeOff, { size: 18 }) : _jsx(Icons.Eye, { size: 18 }) }) }));
|
|
13
10
|
}
|
|
@@ -1,33 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { lazy } from 'react';
|
|
3
|
+
const ReactQuill = lazy(() => import('react-quill'));
|
|
4
|
+
export const RichTextControl = ({ value, onChange, id, onBlur, onFocus, disabled, readOnly, }) => {
|
|
5
|
+
return (_jsx(ReactQuill, { value: value !== null && value !== void 0 ? value : '', onChange: onChange, className: "hdlapp_rte", readOnly: disabled || readOnly, style: { maxHeight: '400px', minHeight: '200px' }, onFocus: onFocus, onBlur: onBlur, id: id }));
|
|
24
6
|
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.RichTextControl = void 0;
|
|
27
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
|
-
const react_1 = require("react");
|
|
29
|
-
const ReactQuill = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('react-quill'))));
|
|
30
|
-
const RichTextControl = ({ value, onChange, id, onBlur, onFocus, disabled, readOnly, }) => {
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)(ReactQuill, { value: value !== null && value !== void 0 ? value : '', onChange: onChange, className: "hdlapp_rte", readOnly: disabled || readOnly, style: { maxHeight: '400px', minHeight: '200px' }, onFocus: onFocus, onBlur: onBlur, id: id }));
|
|
32
|
-
};
|
|
33
|
-
exports.RichTextControl = RichTextControl;
|