@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.
Files changed (174) hide show
  1. package/App/App.js +7 -11
  2. package/App/AppHeaderContianer.js +38 -42
  3. package/App/AppLogo.js +8 -12
  4. package/App/AppStringContext.js +9 -13
  5. package/App/AppUI.js +11 -15
  6. package/App/LayoutProvider.js +11 -15
  7. package/App/NavigationContainer.js +25 -29
  8. package/App/QuickActionItem.js +5 -9
  9. package/App/index.js +1 -5
  10. package/App/utils.js +1 -4
  11. package/CommandBar/Button.js +14 -17
  12. package/CommandBar/Divider.js +6 -9
  13. package/CommandBar/IconButton.js +13 -16
  14. package/CommandBar/Label.js +8 -11
  15. package/CommandBar/MenuButton.js +17 -20
  16. package/CommandBar/MenuItem.js +15 -18
  17. package/CommandBar/MenuItems.js +8 -11
  18. package/CommandBar/MenuList.js +9 -12
  19. package/CommandBar/Wrapper.js +7 -10
  20. package/CommandBar/index.js +13 -15
  21. package/DataForm/SectionControl.js +4 -7
  22. package/DataGrid/ActionCell.js +11 -14
  23. package/DataGrid/CommandContainer.js +6 -10
  24. package/DataGrid/CustomizeColumns/AddColumns.js +34 -37
  25. package/DataGrid/CustomizeColumns/ColumnItem.js +19 -23
  26. package/DataGrid/CustomizeColumns/CustomizeColumns.js +36 -42
  27. package/DataGrid/CustomizeColumns/index.js +1 -5
  28. package/DataGrid/FormSubgridCommandContainer.js +13 -17
  29. package/DataGrid/FormSubgridViewSelector.js +18 -22
  30. package/DataGrid/GridColumnHeader/ConditionValueControl.js +14 -20
  31. package/DataGrid/GridColumnHeader/FilterForm.js +23 -27
  32. package/DataGrid/GridColumnHeader/OperatorSelect.js +13 -19
  33. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +28 -32
  34. package/DataGrid/GridColumnHeader/index.js +1 -5
  35. package/DataGrid/GridColumnHeader/utils.js +2 -6
  36. package/DataGrid/GridHeaderContainer.js +4 -8
  37. package/DataGrid/GridHeaderDesktop.js +26 -30
  38. package/DataGrid/GridHeaderMobile.js +17 -21
  39. package/DataGrid/GridListContainer.js +39 -43
  40. package/DataGrid/GridPaginationContainer.js +12 -16
  41. package/DataGrid/GridTableContainer.js +74 -78
  42. package/DataGrid/TableCell/TableCellAction.js +11 -15
  43. package/DataGrid/TableCell/TableCellBase.js +4 -8
  44. package/DataGrid/TableCell/TableCellCheckbox.js +7 -10
  45. package/DataGrid/TableCell/TableCellChoice.js +11 -14
  46. package/DataGrid/TableCell/TableCellLink.d.ts +1 -1
  47. package/DataGrid/TableCell/TableCellLink.js +13 -12
  48. package/DataGrid/TableCell/TableCellText.js +7 -10
  49. package/DataGrid/TableCell/index.js +4 -20
  50. package/DataGrid/index.js +4 -11
  51. package/DataGrid/types.js +1 -2
  52. package/DataGrid/useTableColumns.js +139 -90
  53. package/DataGrid/utils.js +1 -5
  54. package/DialogContainer/AlertDialog.js +5 -8
  55. package/DialogContainer/ConfirmDialog.js +6 -9
  56. package/DialogContainer/DialogContainer.js +14 -18
  57. package/DialogContainer/ErrorDialog.js +9 -12
  58. package/DialogContainer/PromptDialog.js +30 -57
  59. package/DialogContainer/index.js +1 -5
  60. package/Insights/CommandBarContainer.js +11 -14
  61. package/Insights/FilterBarContainer.js +17 -20
  62. package/Insights/Grid.js +9 -13
  63. package/Insights/InsightsContainer.js +19 -22
  64. package/Insights/WidgetChartContainer.js +30 -34
  65. package/Insights/WidgetDataGridContainer.js +32 -35
  66. package/Insights/WidgetTableContainer.js +24 -28
  67. package/Insights/WidgetTileContainer.js +12 -16
  68. package/Insights/WidgetTitleBar.js +9 -15
  69. package/Insights/Widgets.js +25 -28
  70. package/Insights/charts/AreaChart.js +12 -15
  71. package/Insights/charts/BarChart.js +12 -15
  72. package/Insights/charts/ComposedChart.js +12 -15
  73. package/Insights/charts/CustomTooltipContent.js +8 -12
  74. package/Insights/charts/GaugeChart.js +3 -6
  75. package/Insights/charts/LineChart.js +12 -15
  76. package/Insights/charts/OhlcChart.js +36 -41
  77. package/Insights/charts/PieChart.js +23 -26
  78. package/Insights/charts/RadarChart.js +16 -19
  79. package/Insights/charts/ScatterChart.js +23 -26
  80. package/Insights/charts/constants.js +1 -4
  81. package/Insights/charts/formatters.js +17 -29
  82. package/Insights/charts/index.js +1 -2
  83. package/Insights/charts/renderers.js +25 -36
  84. package/Insights/hooks/useQueriesData.js +19 -25
  85. package/Insights/hooks/useWidgetDetail.js +13 -16
  86. package/OverflowCommandBar/OverflowCommandBar.js +12 -19
  87. package/OverflowCommandBar/OverflowMenu.js +16 -20
  88. package/OverflowCommandBar/OverflowMenuDivider.js +6 -10
  89. package/OverflowCommandBar/index.js +3 -9
  90. package/OverflowCommandBar/render.js +9 -15
  91. package/OverflowCommandBar/utils.js +1 -4
  92. package/PageBoard/BoardColumn.js +5 -8
  93. package/PageBoard/BoardColumnCard.js +12 -15
  94. package/PageBoard/BoardColumnUI.js +34 -38
  95. package/PageBoard/BoardingColumnCardLoading.js +10 -13
  96. package/PageBoard/Header.js +16 -20
  97. package/PageBoard/PageBoard.d.ts +1 -1
  98. package/PageBoard/PageBoard.js +26 -29
  99. package/PageBoard/index.js +1 -5
  100. package/PageEntityForm/CommandContainer.js +21 -25
  101. package/PageEntityForm/FormTabRelated.js +17 -20
  102. package/PageEntityForm/PageEntityForm.js +16 -20
  103. package/PageEntityForm/PageEntityFormDesktopContainer.js +68 -72
  104. package/PageEntityForm/PageEntityFormStringContext.js +5 -9
  105. package/PageEntityForm/ProcessFlow.js +21 -24
  106. package/PageEntityForm/RecordCard.js +21 -24
  107. package/PageEntityForm/RecordCardLoading.js +10 -13
  108. package/PageEntityForm/RecordSetNavigatorContainer.js +30 -34
  109. package/PageEntityForm/RelatedViewSelector.js +28 -31
  110. package/PageEntityForm/SectionContainer.js +25 -28
  111. package/PageEntityForm/StandardControl.d.ts +3 -3
  112. package/PageEntityForm/StandardControl.js +74 -81
  113. package/PageEntityForm/SubgridControl.js +20 -23
  114. package/PageEntityForm/index.js +1 -5
  115. package/PageEntityView/FormSubgridContainer.js +22 -26
  116. package/PageEntityView/PageEntityView.js +15 -19
  117. package/PageEntityView/PageEntityViewDesktopContainer.js +9 -13
  118. package/PageEntityView/PageEntityViewDesktopFrame.js +17 -21
  119. package/PageEntityView/PageEntityViewMobileContainer.js +9 -13
  120. package/PageEntityView/PageEntityViewStringContext.js +5 -9
  121. package/PageEntityView/index.js +1 -5
  122. package/PageInsights/PageInsights.js +9 -13
  123. package/PageInsights/index.js +1 -6
  124. package/ProgressIndicatorContainer/index.js +10 -14
  125. package/ToastNotificationContainer/index.js +14 -18
  126. package/componentStore.js +2 -5
  127. package/components/BodyLoading.js +7 -11
  128. package/components/DialogLogin.js +5 -8
  129. package/components/LoginForm.js +21 -47
  130. package/components/PageBroken.js +5 -8
  131. package/components/PageLoading.js +5 -8
  132. package/components/PageLogin.js +14 -17
  133. package/form/FormControl.js +39 -44
  134. package/form/FormControlLoading.js +4 -8
  135. package/form/controls/AttachmentControl.js +56 -60
  136. package/form/controls/AttachmentsControl.js +15 -19
  137. package/form/controls/CurrencyControl.js +10 -13
  138. package/form/controls/DateControl.js +18 -24
  139. package/form/controls/DateRangeControl.js +14 -20
  140. package/form/controls/DateTimeControl.js +39 -45
  141. package/form/controls/DecimalControl.js +8 -11
  142. package/form/controls/DurationControl.js +11 -15
  143. package/form/controls/EmailControl.js +7 -10
  144. package/form/controls/IntegerControl.js +4 -7
  145. package/form/controls/LookupControl.d.ts +1 -0
  146. package/form/controls/LookupControl.js +75 -38
  147. package/form/controls/MultiSelectControl.js +8 -11
  148. package/form/controls/MultiSelectLookupControl.js +40 -43
  149. package/form/controls/PasswordControl.js +8 -11
  150. package/form/controls/RichTextControl.js +5 -32
  151. package/form/controls/SelectControl.js +8 -11
  152. package/form/controls/SwitchControl.js +4 -7
  153. package/form/controls/TelephoneControl.js +7 -10
  154. package/form/controls/TextAreaControl.js +4 -7
  155. package/form/controls/TextControl.js +5 -8
  156. package/form/controls/UrlControl.js +7 -10
  157. package/form/controls/types.js +1 -2
  158. package/form/controls/useLookupData.js +14 -18
  159. package/form/layout/FormBody/FormBody.js +6 -10
  160. package/form/layout/FormBody/index.js +1 -17
  161. package/form/layout/FormSection/FormSection.js +18 -22
  162. package/form/layout/FormSection/FormSectionColumn.js +3 -7
  163. package/form/layout/FormSection/FormSectionLoading.js +1 -5
  164. package/form/layout/FormSection/index.js +1 -5
  165. package/form/layout/FormTab/FormTab.js +16 -20
  166. package/form/layout/FormTab/FormTabColumn.js +5 -9
  167. package/form/layout/FormTab/index.js +1 -5
  168. package/form/layout/TabContext.js +2 -5
  169. package/form/layout/index.js +3 -9
  170. package/form/types.js +1 -2
  171. package/package.json +3 -2
  172. package/types/index.js +1 -2
  173. package/utils/avatar.d.ts +2 -0
  174. package/utils/avatar.js +42 -0
@@ -1,15 +1,12 @@
1
- "use strict";
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
- const react_components_1 = require("@fluentui/react-components");
7
- const react_1 = require("react");
8
- function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, decimalPlaces, }) {
9
- const [internalValue, setInternalValue] = (0, react_1.useState)(value ? value.toString() : '');
10
- const internalValueRef = (0, react_1.useRef)(internalValue);
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
- (0, react_1.useEffect)(() => {
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 ((0, jsx_runtime_1.jsx)(react_components_1.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: {
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DurationControl = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_components_1 = require("@fluentui/react-components");
6
- const react_1 = require("react");
7
- const 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] = (0, react_1.useState)('');
105
- const [filterEnabled, setFilterEnabled] = (0, react_1.useState)(false);
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
- (0, react_1.useEffect)(() => {
104
+ useEffect(() => {
108
105
  setSearchText(getDisplayValue(value));
109
106
  }, [value]);
110
- const filteredItems = (0, react_1.useMemo)(() => {
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 ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', width: '100%' }, children: (0, jsx_runtime_1.jsx)(react_components_1.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: () => {
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) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: item.value, children: item.text }, item.value))) }) }));
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
- "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, 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: 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 }));
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
- "use strict";
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
- const react_components_1 = require("@fluentui/react-components");
7
- function IntegerControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }) {
8
- return ((0, jsx_runtime_1.jsx)(react_components_1.SpinButton, { appearance: "filled-darker", placeholder: placeholder, id: id, name: name, value: value !== null && value !== void 0 ? value : null, onChange: (e, data) => {
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
  }
@@ -11,6 +11,7 @@ export type DataLookup = {
11
11
  id: string;
12
12
  name: string;
13
13
  logicalName: string;
14
+ avatar?: string;
14
15
  };
15
16
  export type LookupControlProps = ControlProps<DataLookup> & {
16
17
  async?: boolean;
@@ -1,28 +1,27 @@
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) {
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 (0, jsx_runtime_1.jsx)(Control, Object.assign({}, props));
15
+ return _jsx(Control, Object.assign({}, props));
17
16
  }
18
- const useStyles = (0, react_components_1.makeStyles)({
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: react_components_1.tokens.colorNeutralBackground1Hover,
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] = (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)(() => {
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: app_1.PageType.EntityForm,
48
+ type: PageType.EntityForm,
50
49
  id: value.id,
51
50
  });
52
51
  }, [allowNavigation, routeResolver, schema.logicalName, value]);
53
- const handleOpenRecord = (0, react_1.useCallback)((event) => {
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
- (0, react_1.useEffect)(() => {
60
+ useEffect(() => {
62
61
  if (open)
63
62
  setLookupEnabled(true);
64
63
  }, [open]);
65
- const [debouncedSearchText] = (0, hooks_1.useDebouncedValue)(searchText, 500);
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 } = (0, useLookupData_1.useGetLookupView)(schema.logicalName, viewId);
86
- const { data, isLoading } = (0, useLookupData_1.useLookupData)({
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
- (0, react_1.useEffect)(() => {
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 ((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: !value ? placeholder : '', inputMode: "search", style: { width: '100%', minWidth: 'unset' }, autoComplete: "off", readOnly: readOnly || disabled,
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) => ((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: {
122
- paddingInline: react_components_1.tokens.spacingHorizontalL,
123
- paddingBlock: react_components_1.tokens.spacingVerticalS,
124
- }, 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: {
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: (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: () => {
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: (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 })) }) }) }))] }));
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
- "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, 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 = (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) => {
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) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.value, children: x.label }, x.value))) }));
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
- "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) {
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 (0, jsx_runtime_1.jsx)(Control, Object.assign({}, props));
13
+ return _jsx(Control, Object.assign({}, props));
17
14
  }
18
- const useStyles = (0, react_components_1.makeStyles)({
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: react_components_1.tokens.colorNeutralBackground1Hover,
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] = (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)(() => {
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] = (0, hooks_1.useDebouncedValue)(searchText, 500);
39
+ const [debouncedSearchText] = useDebouncedValue(searchText, 500);
43
40
  const styles = useStyles();
44
- const { isLoading: isViewLoading, view } = (0, useLookupData_1.useGetLookupView)(schema.logicalName, viewId);
45
- const { data, isLoading } = (0, useLookupData_1.useLookupData)({
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 = (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)(() => {
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 ((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: {
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) => ((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: {
143
- paddingInline: react_components_1.tokens.spacingHorizontalL,
144
- paddingBlock: react_components_1.tokens.spacingVerticalS,
145
- }, 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: {
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: (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}`))) }) })] }));
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 = (0, hooks_2.useRouteResolver)();
158
- const router = (0, hooks_2.useRouter)();
159
- const path = (0, react_1.useMemo)(() => {
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: app_1.PageType.EntityForm,
165
+ type: PageType.EntityForm,
169
166
  id: value.id,
170
167
  });
171
168
  }, [allowNavigation, routeResolver, value]);
172
- const handleOpenRecord = (0, react_1.useCallback)((event) => {
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 ((0, jsx_runtime_1.jsx)(react_components_1.Tag, { as: "span", appearance: "brand", size: "small", dismissible: !disabled && !readOnly, value: value.id, style: {
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: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', cursor: 'pointer' }, onClick: () => {
180
+ }, dismissIcon: _jsx("div", { style: { display: 'flex', cursor: 'pointer' }, onClick: () => {
184
181
  onRemove === null || onRemove === void 0 ? void 0 : onRemove(value.id);
185
- }, 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 })) }));
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
- "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, 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: (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 }) }) }));
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
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
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;