@headless-adminapp/fluent 0.0.17-alpha.7 → 1.0.0

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 (270) hide show
  1. package/App/App.d.ts +0 -1
  2. package/App/App.js +2 -4
  3. package/App/AppHeaderContianer.d.ts +5 -1
  4. package/App/AppHeaderContianer.js +43 -26
  5. package/App/AppLogo.js +15 -4
  6. package/App/AppUI.js +9 -1
  7. package/App/LayoutProvider.d.ts +7 -0
  8. package/App/LayoutProvider.js +17 -0
  9. package/App/NavigationContainer.d.ts +10 -1
  10. package/App/NavigationContainer.js +22 -22
  11. package/App/QuickActionItem.js +2 -2
  12. package/App/utils.js +3 -4
  13. package/CommandBar/Button.d.ts +2 -1
  14. package/CommandBar/Button.js +2 -2
  15. package/CommandBar/Divider.d.ts +2 -1
  16. package/CommandBar/Divider.js +2 -2
  17. package/CommandBar/IconButton.d.ts +2 -1
  18. package/CommandBar/IconButton.js +2 -2
  19. package/CommandBar/Label.d.ts +2 -1
  20. package/CommandBar/Label.js +2 -2
  21. package/CommandBar/MenuButton.d.ts +2 -1
  22. package/CommandBar/MenuButton.js +3 -3
  23. package/CommandBar/MenuItem.js +5 -4
  24. package/CommandBar/MenuItems.js +4 -4
  25. package/CommandBar/MenuList.js +5 -4
  26. package/CommandBar/Wrapper.d.ts +2 -2
  27. package/CommandBar/Wrapper.js +2 -2
  28. package/CommandBar/index.d.ts +6 -6
  29. package/DataGrid/ActionCell.d.ts +1 -1
  30. package/DataGrid/ActionCell.js +8 -4
  31. package/DataGrid/CustomizeColumns/AddColumns.js +35 -37
  32. package/DataGrid/CustomizeColumns/ColumnItem.js +8 -6
  33. package/DataGrid/CustomizeColumns/CustomizeColumns.d.ts +2 -2
  34. package/DataGrid/CustomizeColumns/CustomizeColumns.js +3 -6
  35. package/DataGrid/FormSubgridViewSelector.js +1 -5
  36. package/DataGrid/GridColumnHeader/ConditionValueControl.js +19 -25
  37. package/DataGrid/GridColumnHeader/FilterForm.js +9 -10
  38. package/DataGrid/GridColumnHeader/OperatorSelect.js +10 -3
  39. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +22 -13
  40. package/DataGrid/GridColumnHeader/utils.js +10 -7
  41. package/DataGrid/GridHeaderDesktop.js +4 -5
  42. package/DataGrid/GridHeaderMobile.d.ts +5 -0
  43. package/DataGrid/GridHeaderMobile.js +29 -0
  44. package/DataGrid/GridListContainer.d.ts +12 -0
  45. package/DataGrid/GridListContainer.js +93 -0
  46. package/DataGrid/GridPaginationContainer.js +1 -2
  47. package/DataGrid/GridTableContainer.js +113 -77
  48. package/DataGrid/TableCell/TableCellBase.d.ts +2 -2
  49. package/DataGrid/TableCell/TableCellBase.js +6 -1
  50. package/DataGrid/TableCell/TableCellCheckbox.js +6 -5
  51. package/DataGrid/TableCell/TableCellChoice.d.ts +15 -0
  52. package/DataGrid/TableCell/TableCellChoice.js +30 -0
  53. package/DataGrid/TableCell/TableCellLink.d.ts +2 -1
  54. package/DataGrid/TableCell/TableCellLink.js +13 -5
  55. package/DataGrid/TableCell/TableCellText.js +9 -4
  56. package/DataGrid/types.d.ts +5 -0
  57. package/DataGrid/types.js +2 -0
  58. package/DataGrid/useTableColumns.d.ts +2 -3
  59. package/DataGrid/useTableColumns.js +297 -155
  60. package/DialogContainer/AlertDialog.js +3 -6
  61. package/DialogContainer/ConfirmDialog.js +5 -9
  62. package/DialogContainer/DialogContainer.js +2 -13
  63. package/DialogContainer/ErrorDialog.js +3 -6
  64. package/DialogContainer/PromptDialog.d.ts +13 -2
  65. package/DialogContainer/PromptDialog.js +44 -39
  66. package/Insights/CommandBarContainer.d.ts +1 -0
  67. package/Insights/CommandBarContainer.js +18 -0
  68. package/Insights/FilterBarContainer.d.ts +1 -0
  69. package/Insights/FilterBarContainer.js +99 -0
  70. package/Insights/Grid.d.ts +6 -0
  71. package/Insights/Grid.js +26 -0
  72. package/Insights/InsightsContainer.d.ts +1 -0
  73. package/Insights/InsightsContainer.js +35 -0
  74. package/Insights/WidgetChartContainer.d.ts +7 -0
  75. package/Insights/WidgetChartContainer.js +56 -0
  76. package/Insights/WidgetDataGridContainer.d.ts +4 -0
  77. package/Insights/WidgetDataGridContainer.js +80 -0
  78. package/Insights/WidgetTableContainer.d.ts +7 -0
  79. package/Insights/WidgetTableContainer.js +57 -0
  80. package/Insights/WidgetTileContainer.d.ts +7 -0
  81. package/Insights/WidgetTileContainer.js +24 -0
  82. package/Insights/WidgetTitleBar.d.ts +7 -0
  83. package/Insights/WidgetTitleBar.js +21 -0
  84. package/Insights/Widgets.d.ts +4 -0
  85. package/Insights/Widgets.js +57 -0
  86. package/Insights/charts/AreaChart.d.ts +5 -0
  87. package/Insights/charts/AreaChart.js +20 -0
  88. package/Insights/charts/BarChart.d.ts +5 -0
  89. package/Insights/charts/BarChart.js +20 -0
  90. package/Insights/charts/ComposedChart.d.ts +5 -0
  91. package/Insights/charts/ComposedChart.js +19 -0
  92. package/Insights/charts/CustomTooltipContent.d.ts +7 -0
  93. package/Insights/charts/CustomTooltipContent.js +25 -0
  94. package/Insights/charts/GaugeChart.d.ts +5 -0
  95. package/Insights/charts/GaugeChart.js +8 -0
  96. package/Insights/charts/LineChart.d.ts +5 -0
  97. package/Insights/charts/LineChart.js +21 -0
  98. package/Insights/charts/OhlcChart.d.ts +6 -0
  99. package/Insights/charts/OhlcChart.js +119 -0
  100. package/Insights/charts/PieChart.d.ts +5 -0
  101. package/Insights/charts/PieChart.js +54 -0
  102. package/Insights/charts/RadarChart.d.ts +5 -0
  103. package/Insights/charts/RadarChart.js +38 -0
  104. package/Insights/charts/ScatterChart.d.ts +5 -0
  105. package/Insights/charts/ScatterChart.js +81 -0
  106. package/Insights/charts/constants.d.ts +1 -0
  107. package/Insights/charts/constants.js +25 -0
  108. package/Insights/charts/formatters.d.ts +14 -0
  109. package/Insights/charts/formatters.js +186 -0
  110. package/Insights/charts/index.d.ts +4 -0
  111. package/Insights/charts/index.js +13 -0
  112. package/Insights/charts/renderers.d.ts +10 -0
  113. package/Insights/charts/renderers.js +64 -0
  114. package/Insights/hooks/useQueriesData.d.ts +7 -0
  115. package/Insights/hooks/useQueriesData.js +90 -0
  116. package/Insights/hooks/useWidgetDetail.d.ts +10 -0
  117. package/Insights/hooks/useWidgetDetail.js +39 -0
  118. package/OverflowCommandBar/OverflowCommandBar.js +1 -4
  119. package/OverflowCommandBar/OverflowMenu.js +5 -17
  120. package/OverflowCommandBar/render.js +3 -4
  121. package/OverflowCommandBar/utils.js +2 -3
  122. package/PageBoard/BoardColumn.d.ts +5 -0
  123. package/PageBoard/BoardColumn.js +9 -0
  124. package/PageBoard/BoardColumnCard.d.ts +12 -0
  125. package/PageBoard/BoardColumnCard.js +29 -0
  126. package/PageBoard/BoardColumnUI.d.ts +2 -0
  127. package/PageBoard/BoardColumnUI.js +76 -0
  128. package/PageBoard/BoardingColumnCardLoading.d.ts +1 -0
  129. package/PageBoard/BoardingColumnCardLoading.js +21 -0
  130. package/PageBoard/Header.d.ts +7 -0
  131. package/PageBoard/Header.js +31 -0
  132. package/PageBoard/PageBoard.d.ts +7 -0
  133. package/PageBoard/PageBoard.js +46 -0
  134. package/PageBoard/index.d.ts +1 -0
  135. package/PageBoard/index.js +5 -0
  136. package/PageCalendar/CalendarSection.d.ts +20 -0
  137. package/PageCalendar/CalendarSection.js +108 -0
  138. package/PageCalendar/EventDialog/AttributeController.d.ts +10 -0
  139. package/PageCalendar/EventDialog/AttributeController.js +17 -0
  140. package/PageCalendar/EventDialog/EventDialog.d.ts +25 -0
  141. package/PageCalendar/EventDialog/EventDialog.js +21 -0
  142. package/PageCalendar/EventDialog/EventFormBody.d.ts +18 -0
  143. package/PageCalendar/EventDialog/EventFormBody.js +69 -0
  144. package/PageCalendar/EventDialog/EventFormContent.d.ts +10 -0
  145. package/PageCalendar/EventDialog/EventFormContent.js +27 -0
  146. package/PageCalendar/EventDialog/types.d.ts +3 -0
  147. package/PageCalendar/EventDialog/types.js +2 -0
  148. package/PageCalendar/EventDialog/utils.d.ts +23 -0
  149. package/PageCalendar/EventDialog/utils.js +57 -0
  150. package/PageCalendar/Header.d.ts +8 -0
  151. package/PageCalendar/Header.js +35 -0
  152. package/PageCalendar/PageCalendar.d.ts +7 -0
  153. package/PageCalendar/PageCalendar.js +231 -0
  154. package/PageCalendar/TitleSelector.d.ts +10 -0
  155. package/PageCalendar/TitleSelector.js +73 -0
  156. package/PageCalendar/ViewSelector.d.ts +8 -0
  157. package/PageCalendar/ViewSelector.js +52 -0
  158. package/PageCalendar/baseEventAttributes.d.ts +35 -0
  159. package/PageCalendar/baseEventAttributes.js +38 -0
  160. package/PageCalendar/context.d.ts +20 -0
  161. package/PageCalendar/context.js +5 -0
  162. package/PageCalendar/hooks/index.d.ts +1 -0
  163. package/PageCalendar/hooks/index.js +17 -0
  164. package/PageCalendar/hooks/useConfig.d.ts +3 -0
  165. package/PageCalendar/hooks/useConfig.js +8 -0
  166. package/PageCalendar/index.d.ts +1 -0
  167. package/PageCalendar/index.js +5 -0
  168. package/PageCalendar/renderEventContent.d.ts +2 -0
  169. package/PageCalendar/renderEventContent.js +22 -0
  170. package/PageCalendar/types.d.ts +5 -0
  171. package/PageCalendar/types.js +9 -0
  172. package/PageCalendar/utils.d.ts +3 -0
  173. package/PageCalendar/utils.js +17 -0
  174. package/PageEntityForm/CommandContainer.js +9 -5
  175. package/PageEntityForm/PageCustomEntityForm.d.ts +15 -0
  176. package/PageEntityForm/PageCustomEntityForm.js +17 -0
  177. package/PageEntityForm/PageEntityFormDesktopContainer.js +42 -22
  178. package/PageEntityForm/ProcessFlow.d.ts +10 -0
  179. package/PageEntityForm/ProcessFlow.js +84 -0
  180. package/PageEntityForm/RecordAvatar.d.ts +2 -0
  181. package/PageEntityForm/RecordAvatar.js +83 -0
  182. package/PageEntityForm/RecordCard.d.ts +1 -1
  183. package/PageEntityForm/RecordCard.js +60 -53
  184. package/PageEntityForm/RecordCardLoading.d.ts +8 -0
  185. package/PageEntityForm/RecordCardLoading.js +24 -0
  186. package/PageEntityForm/RecordSetNavigatorContainer.js +1 -2
  187. package/PageEntityForm/RelatedViewSelector.d.ts +0 -2
  188. package/PageEntityForm/RelatedViewSelector.js +37 -11
  189. package/PageEntityForm/SectionContainer.d.ts +2 -2
  190. package/PageEntityForm/SectionContainer.js +77 -13
  191. package/PageEntityForm/StandardControl.d.ts +1 -22
  192. package/PageEntityForm/StandardControl.js +103 -117
  193. package/PageEntityForm/SubgridControl.d.ts +1 -0
  194. package/PageEntityForm/SubgridControl.js +4 -2
  195. package/PageEntityForm/UploadImageDialog.d.ts +12 -0
  196. package/PageEntityForm/UploadImageDialog.js +114 -0
  197. package/PageEntityView/FormSubgridContainer.js +5 -2
  198. package/PageEntityView/FormSubgridNotAvailableContainer.d.ts +2 -0
  199. package/PageEntityView/FormSubgridNotAvailableContainer.js +48 -0
  200. package/PageEntityView/PageEntityView.js +4 -1
  201. package/PageEntityView/PageEntityViewDesktopFrame.js +1 -0
  202. package/PageEntityView/PageEntityViewMobileContainer.d.ts +2 -0
  203. package/PageEntityView/PageEntityViewMobileContainer.js +14 -0
  204. package/PageEntityView/PageEntityViewStringContext.d.ts +2 -0
  205. package/PageEntityView/PageEntityViewStringContext.js +2 -0
  206. package/PageInsights/PageInsights.d.ts +9 -0
  207. package/PageInsights/PageInsights.js +25 -0
  208. package/PageInsights/index.d.ts +1 -0
  209. package/PageInsights/index.js +6 -0
  210. package/ToastNotificationContainer/index.js +1 -2
  211. package/componentStore.d.ts +2 -0
  212. package/componentStore.js +5 -0
  213. package/components/BodyLoading.d.ts +1 -1
  214. package/components/BodyLoading.js +13 -8
  215. package/components/DndProvider.d.ts +12 -0
  216. package/components/DndProvider.js +68 -0
  217. package/components/LoginForm.js +5 -21
  218. package/form/FormControl.js +19 -41
  219. package/form/controls/AttachmentControl.d.ts +27 -0
  220. package/form/controls/AttachmentControl.js +220 -0
  221. package/form/controls/AttachmentsControl.d.ts +6 -0
  222. package/form/controls/AttachmentsControl.js +35 -0
  223. package/form/controls/CurrencyControl.js +38 -6
  224. package/form/controls/DateControl.d.ts +1 -1
  225. package/form/controls/DateControl.js +15 -3
  226. package/form/controls/DateRangeControl.js +4 -6
  227. package/form/controls/DateTimeControl.d.ts +1 -1
  228. package/form/controls/DateTimeControl.js +107 -12
  229. package/form/controls/DecimalControl.d.ts +5 -0
  230. package/form/controls/DecimalControl.js +52 -0
  231. package/form/controls/DurationControl.d.ts +4 -0
  232. package/form/controls/DurationControl.js +209 -0
  233. package/form/controls/EmailControl.d.ts +1 -1
  234. package/form/controls/EmailControl.js +5 -5
  235. package/form/controls/IntegerControl.d.ts +4 -0
  236. package/form/controls/IntegerControl.js +25 -0
  237. package/form/controls/LookupControl.d.ts +1 -0
  238. package/form/controls/LookupControl.js +57 -13
  239. package/form/controls/MultiSelectControl.js +3 -3
  240. package/form/controls/MultiSelectLookupControl.js +16 -17
  241. package/form/controls/PasswordControl.js +1 -1
  242. package/form/controls/RichTextControl.d.ts +5 -0
  243. package/form/controls/RichTextControl.js +33 -0
  244. package/form/controls/SelectControl.js +4 -5
  245. package/form/controls/SwitchControl.d.ts +1 -1
  246. package/form/controls/SwitchControl.js +4 -2
  247. package/form/controls/TelephoneControl.d.ts +1 -1
  248. package/form/controls/TelephoneControl.js +26 -4
  249. package/form/controls/TextAreaControl.d.ts +1 -1
  250. package/form/controls/TextAreaControl.js +6 -6
  251. package/form/controls/TextControl.js +4 -4
  252. package/form/controls/UrlControl.d.ts +4 -0
  253. package/form/controls/UrlControl.js +16 -0
  254. package/form/controls/useLookupData.js +26 -41
  255. package/form/layout/FormSection/FormSection.js +10 -3
  256. package/form/layout/FormTab/FormTab.js +4 -4
  257. package/form/types.d.ts +2 -2
  258. package/package.json +17 -12
  259. package/styles.css +149 -0
  260. package/types/index.d.ts +18 -0
  261. package/utils/avatar.d.ts +2 -0
  262. package/utils/avatar.js +45 -0
  263. package/App/AppProvider.d.ts +0 -9
  264. package/App/AppProvider.js +0 -50
  265. package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
  266. package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
  267. package/DataGrid/getAttributeFormattedValue.d.ts +0 -16
  268. package/DataGrid/getAttributeFormattedValue.js +0 -92
  269. package/form/controls/NumberControl.d.ts +0 -4
  270. package/form/controls/NumberControl.js +0 -16
@@ -5,19 +5,114 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.DateTimeControl = DateTimeControl;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_components_1 = require("@fluentui/react-components");
8
9
  const react_datepicker_compat_1 = require("@fluentui/react-datepicker-compat");
10
+ const react_timepicker_compat_1 = require("@fluentui/react-timepicker-compat");
11
+ const locale_1 = require("@headless-adminapp/app/locale");
12
+ const icons_1 = require("@headless-adminapp/icons");
9
13
  const dayjs_1 = __importDefault(require("dayjs"));
14
+ const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
15
+ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
16
+ const utc_1 = __importDefault(require("dayjs/plugin/utc"));
17
+ const react_1 = require("react");
18
+ dayjs_1.default.extend(customParseFormat_1.default);
19
+ dayjs_1.default.extend(utc_1.default);
20
+ dayjs_1.default.extend(timezone_1.default);
10
21
  function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
11
- // const { shortDate: dateFormat } = useLocale();
12
- // return (
13
- // <TimePicker
14
- // )
15
- return ((0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: placeholder, appearance: "filled-darker", formatDate: (date) => date ? (0, dayjs_1.default)(date).format('YYYY-MM-DD HH:mm:ss') : '',
16
- // size="sm"
17
- // error={error}
18
- // maxDate={maxDate}
19
- // minDate={minDate}
20
- disabled: disabled, readOnly: readOnly,
21
- // inputFormat={inputFormat}
22
- value: value ? new Date(value) : null, onSelectDate: (date) => onChange === null || onChange === void 0 ? void 0 : onChange(date ? date.toISOString() : null) }));
22
+ const { dateFormats: { short: dateFormat }, timeFormats: { short: timeFormat }, timezone, } = (0, locale_1.useLocale)();
23
+ const [internalTimeValue, setInternalTimeValue] = (0, react_1.useState)(value ? (0, dayjs_1.default)(value).tz(timezone).format(timeFormat) : '');
24
+ const internalTimeValueRef = (0, react_1.useRef)(internalTimeValue);
25
+ internalTimeValueRef.current = internalTimeValue;
26
+ (0, react_1.useEffect)(() => {
27
+ const updatedValue = value
28
+ ? (0, dayjs_1.default)(value).tz(timezone).format(timeFormat)
29
+ : '';
30
+ if (internalTimeValueRef.current !== updatedValue) {
31
+ setInternalTimeValue(updatedValue);
32
+ }
33
+ }, [value, timezone, timeFormat]);
34
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
35
+ display: 'flex',
36
+ alignItems: 'center',
37
+ gap: react_components_1.tokens.spacingHorizontalS,
38
+ }, children: [(0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus?.(), onBlur: () => onBlur?.(), placeholder: placeholder, appearance: "filled-darker", formatDate: (date) => date ? (0, dayjs_1.default)(date).tz(timezone).format(dateFormat) : '', disabled: disabled, readOnly: readOnly, value: value ? new Date(value) : null, onSelectDate: (date) => {
39
+ if (!date) {
40
+ onChange?.(null);
41
+ }
42
+ else if (!value) {
43
+ onChange?.((0, dayjs_1.default)(date).tz(timezone, true).toISOString());
44
+ }
45
+ else {
46
+ onChange?.((0, dayjs_1.default)(date)
47
+ .tz(timezone, true)
48
+ .set('hour', (0, dayjs_1.default)(value).tz(timezone).hour())
49
+ .set('minute', (0, dayjs_1.default)(value).tz(timezone).minute())
50
+ .toISOString());
51
+ }
52
+ },
53
+ // allowTextInput={true}
54
+ contentAfter: (0, jsx_runtime_1.jsx)("div", { style: {
55
+ display: 'flex',
56
+ alignItems: 'center',
57
+ justifyContent: 'center',
58
+ marginRight: -4,
59
+ color: react_components_1.tokens.colorNeutralForeground2,
60
+ }, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Calendar, { size: 20 }) }), style: { flex: 1 }, input: {
61
+ style: { minWidth: 0, width: '100%' },
62
+ } }), (0, jsx_runtime_1.jsx)(react_timepicker_compat_1.TimePicker, { appearance: "filled-darker", style: { flex: 1, minWidth: 0 }, input: {
63
+ style: { minWidth: 0 },
64
+ }, readOnly: readOnly || disabled || !value,
65
+ // selectedTime={value ? new Date(value) : null}
66
+ selectedTime: value
67
+ ? (0, dayjs_1.default)((0, dayjs_1.default)(value).tz(timezone).format('YYYY-MM-DD HH:mm:ss')).toDate()
68
+ : null, freeform: true,
69
+ // formatDateToTimeString={(date) => {
70
+ // return dayjs(date).tz(timezone).format(timeFormat);
71
+ // }}
72
+ value: internalTimeValue, onTimeChange: (_, data) => {
73
+ const dateValue = value
74
+ ? (0, dayjs_1.default)(value).tz(timezone)
75
+ : (0, dayjs_1.default)().tz(timezone);
76
+ if (data.selectedTime) {
77
+ onChange?.(dateValue
78
+ .set('hour', (0, dayjs_1.default)(data.selectedTime).tz(timezone, true).hour())
79
+ .set('minute', (0, dayjs_1.default)(data.selectedTime).tz(timezone, true).minute())
80
+ .toISOString());
81
+ }
82
+ else if (data.selectedTimeText) {
83
+ let resolvedTime = resolveTimeValue(data.selectedTimeText, timeFormat);
84
+ if (!resolvedTime) {
85
+ setInternalTimeValue(value ? (0, dayjs_1.default)(value).format(timeFormat) : '');
86
+ return;
87
+ }
88
+ const newValue = dateValue
89
+ .set('hour', resolvedTime.getHours())
90
+ .set('minute', resolvedTime.getMinutes())
91
+ .toISOString();
92
+ if (newValue !== value) {
93
+ onChange?.(newValue);
94
+ }
95
+ setInternalTimeValue(newValue ? (0, dayjs_1.default)(newValue).tz(timezone).format(timeFormat) : '');
96
+ }
97
+ }, onInput: (e) => {
98
+ setInternalTimeValue(e.currentTarget.value);
99
+ }, onBlur: () => {
100
+ onBlur?.();
101
+ }, expandIcon: (0, jsx_runtime_1.jsx)("div", { style: {
102
+ display: 'flex',
103
+ alignItems: 'center',
104
+ justifyContent: 'center',
105
+ marginRight: -4,
106
+ color: react_components_1.tokens.colorNeutralForeground2,
107
+ }, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Clock, { size: 20 }) }) })] }));
108
+ }
109
+ function resolveTimeValue(value, timeFormat) {
110
+ if (!value) {
111
+ return;
112
+ }
113
+ const time = (0, dayjs_1.default)(value, timeFormat);
114
+ if (!time.isValid()) {
115
+ return;
116
+ }
117
+ return time.toDate();
23
118
  }
@@ -0,0 +1,5 @@
1
+ import { ControlProps } from './types';
2
+ export interface DecimalControlProps extends ControlProps<number> {
3
+ decimalPlaces?: number;
4
+ }
5
+ export declare function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, decimalPlaces, }: DecimalControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecimalControl = DecimalControl;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /* 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);
11
+ internalValueRef.current = internalValue;
12
+ (0, react_1.useEffect)(() => {
13
+ let _value = '';
14
+ if (typeof value === 'number') {
15
+ _value = value.toString();
16
+ }
17
+ if (!_value && internalValueRef.current === '-') {
18
+ return;
19
+ }
20
+ if (internalValueRef.current !== _value) {
21
+ setInternalValue(_value);
22
+ }
23
+ }, [value]);
24
+ const handleChange = (e) => {
25
+ let value = e.target.value;
26
+ if (!value) {
27
+ setInternalValue('');
28
+ onChange?.(null);
29
+ return;
30
+ }
31
+ value = value.replace(',', '');
32
+ if (value === '-') {
33
+ setInternalValue('-');
34
+ onChange?.(null);
35
+ return;
36
+ }
37
+ if (isNaN(Number(value))) {
38
+ return;
39
+ }
40
+ if (decimalPlaces) {
41
+ const parts = value.split('.');
42
+ if (parts.length > 1) {
43
+ value = `${parts[0]}.${parts[1].slice(0, decimalPlaces)}`;
44
+ }
45
+ }
46
+ setInternalValue(value);
47
+ onChange?.(Number(value));
48
+ };
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?.(), onFocus: () => onFocus?.(), readOnly: readOnly || disabled, style: {
50
+ width: '100%',
51
+ } }));
52
+ }
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { ControlProps } from './types';
3
+ export type DurationControlProps = ControlProps<number>;
4
+ export declare const DurationControl: FC<DurationControlProps>;
@@ -0,0 +1,209 @@
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)({
8
+ listbox: {
9
+ maxHeight: '300px !important',
10
+ },
11
+ });
12
+ const options = [
13
+ { text: '1 minute', value: '1' },
14
+ {
15
+ text: '5 minutes',
16
+ value: '5',
17
+ },
18
+ {
19
+ text: '15 minutes',
20
+ value: '15',
21
+ },
22
+ {
23
+ text: '30 minutes',
24
+ value: '30',
25
+ },
26
+ {
27
+ text: '45 minutes',
28
+ value: '45',
29
+ },
30
+ {
31
+ text: '1 hour',
32
+ value: '60',
33
+ },
34
+ {
35
+ text: '1.5 hours',
36
+ value: '90',
37
+ },
38
+ {
39
+ text: '2 hours',
40
+ value: '120',
41
+ },
42
+ {
43
+ text: '2.5 hours',
44
+ value: '150',
45
+ },
46
+ {
47
+ text: '3 hours',
48
+ value: '180',
49
+ },
50
+ {
51
+ text: '3.5 hours',
52
+ value: '210',
53
+ },
54
+ {
55
+ text: '4 hours',
56
+ value: '240',
57
+ },
58
+ {
59
+ text: '4.5 hours',
60
+ value: '270',
61
+ },
62
+ {
63
+ text: '5 hours',
64
+ value: '300',
65
+ },
66
+ {
67
+ text: '5.5 hours',
68
+ value: '330',
69
+ },
70
+ {
71
+ text: '6 hours',
72
+ value: '360',
73
+ },
74
+ {
75
+ text: '6.5 hours',
76
+ value: '390',
77
+ },
78
+ {
79
+ text: '7 hours',
80
+ value: '420',
81
+ },
82
+ {
83
+ text: '7.5 hours',
84
+ value: '450',
85
+ },
86
+ {
87
+ text: '8 hours',
88
+ value: '480',
89
+ },
90
+ {
91
+ text: '1 day',
92
+ value: '1440',
93
+ },
94
+ {
95
+ text: '2 days',
96
+ value: '2880',
97
+ },
98
+ {
99
+ text: '3 days',
100
+ value: '4320',
101
+ },
102
+ ];
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);
106
+ const styles = useStyles();
107
+ (0, react_1.useEffect)(() => {
108
+ setSearchText(getDisplayValue(value));
109
+ }, [value]);
110
+ const filteredItems = (0, react_1.useMemo)(() => {
111
+ if (!filterEnabled) {
112
+ return options;
113
+ }
114
+ return options.filter((item) => item.text.toLowerCase().includes(searchText.toLowerCase()));
115
+ }, [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: () => {
117
+ let newValue = null;
118
+ if (searchText) {
119
+ newValue = resolveValue(searchText);
120
+ if (newValue === undefined) {
121
+ newValue = value;
122
+ }
123
+ }
124
+ if (newValue !== null) {
125
+ console.log('onBlur', newValue);
126
+ onChange?.(newValue);
127
+ }
128
+ setSearchText(getDisplayValue(newValue));
129
+ setFilterEnabled(false);
130
+ onBlur?.();
131
+ }, onFocus: onFocus, id: id, autoFocus: autoFocus, onChange: (e) => {
132
+ setFilterEnabled(true);
133
+ setSearchText(e.target.value);
134
+ }, onOptionSelect: (e, item) => {
135
+ console.log('onOptionSelect', e, item);
136
+ if (!item.optionValue) {
137
+ return;
138
+ }
139
+ else {
140
+ onChange?.(Number(item.optionValue));
141
+ }
142
+ setSearchText('');
143
+ }, children: filteredItems.map((item) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: item.value, children: item.text }, item.value))) }) }));
144
+ };
145
+ exports.DurationControl = DurationControl;
146
+ function getDisplayValue(value) {
147
+ if (!value) {
148
+ return '';
149
+ }
150
+ // No decimal, if value is decimal, round to nearest whole number
151
+ // 1 - 1 minute
152
+ // 2-59 minutes -> 2-59 minutes
153
+ // 90 minutes -> 1.5 hours
154
+ // more than a day -> 1 day, 1.5 days, 2 days, etc.
155
+ // check if value has decimal
156
+ if (value % 1 !== 0) {
157
+ // round to nearest whole number
158
+ value = Math.round(value);
159
+ }
160
+ if (!value) {
161
+ return '';
162
+ }
163
+ if (value === 1) {
164
+ return '1 minute';
165
+ }
166
+ if (value < 60) {
167
+ return `${value} minutes`;
168
+ }
169
+ if (value === 60) {
170
+ return '1 hour';
171
+ }
172
+ if (value < 1440) {
173
+ return `${Number((value / 60).toFixed(2))} hours`;
174
+ }
175
+ if (value === 1440) {
176
+ return '1 day';
177
+ }
178
+ return `${Number((value / 1440).toFixed(2))} days`;
179
+ }
180
+ function resolveValue(value) {
181
+ if (!value) {
182
+ return null;
183
+ }
184
+ const numberValue = Number(value);
185
+ if (!isNaN(numberValue)) {
186
+ return numberValue;
187
+ }
188
+ const timeFormat = /^(\d+):[0-5][0-9]$/;
189
+ if (timeFormat.test(value)) {
190
+ const [hours, minutes] = value.split(':').map(Number);
191
+ return hours * 60 + minutes;
192
+ }
193
+ const minutesFormat = /^(\d+(\.\d+)?) m/;
194
+ if (minutesFormat.test(value)) {
195
+ const [, minutes] = value.match(minutesFormat);
196
+ return Math.floor(Number(minutes));
197
+ }
198
+ const hoursFormat = /^(\d+(\.\d+)?) h/;
199
+ if (hoursFormat.test(value)) {
200
+ const [, hours] = value.match(hoursFormat);
201
+ return Math.floor(Number(hours) * 60);
202
+ }
203
+ const daysFormat = /^(\d+(\.\d+)?) d/;
204
+ if (daysFormat.test(value)) {
205
+ const [, days] = value.match(daysFormat);
206
+ return Math.floor(Number(days) * 1440);
207
+ }
208
+ return undefined;
209
+ }
@@ -3,4 +3,4 @@ export interface EmailControlProps extends ControlProps<string> {
3
3
  autoComplete?: string;
4
4
  textTransform?: 'capitalize' | 'uppercase' | 'lowercase' | 'none';
5
5
  }
6
- export declare function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, }: EmailControlProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, }: Readonly<EmailControlProps>): import("react/jsx-runtime").JSX.Element;
@@ -9,13 +9,13 @@ function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder,
9
9
  // size="sm"
10
10
  value: value || '', onChange: (e) => {
11
11
  textTransform === 'uppercase'
12
- ? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toUpperCase())
12
+ ? onChange?.(e.target.value.toUpperCase())
13
13
  : textTransform === 'lowercase'
14
- ? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toLowerCase())
15
- : onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
16
- }, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
14
+ ? onChange?.(e.target.value.toLowerCase())
15
+ : onChange?.(e.target.value);
16
+ }, onBlur: () => onBlur?.(), onFocus: () => onFocus?.(),
17
17
  // invalid={error}
18
- disabled: disabled, readOnly: readOnly, autoComplete: autoComplete, style: {
18
+ readOnly: disabled || readOnly, autoComplete: autoComplete, style: {
19
19
  flex: 1,
20
20
  paddingRight: react_components_1.tokens.spacingHorizontalXS,
21
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 }));
@@ -0,0 +1,4 @@
1
+ import { ControlProps } from './types';
2
+ export interface IntegerControlProps extends ControlProps<number> {
3
+ }
4
+ export declare function IntegerControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }: IntegerControlProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntegerControl = IntegerControl;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /* 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, readOnly: readOnly || disabled, onChange: (e, data) => {
9
+ if (data.value !== undefined) {
10
+ onChange?.(data.value);
11
+ }
12
+ else if (!data.displayValue) {
13
+ onChange?.(null);
14
+ }
15
+ else if (data.displayValue !== undefined) {
16
+ const newValue = parseFloat(data.displayValue);
17
+ if (!Number.isNaN(newValue)) {
18
+ onChange?.(newValue);
19
+ }
20
+ }
21
+ else {
22
+ onChange?.(null);
23
+ }
24
+ } }));
25
+ }
@@ -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;
@@ -3,17 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LookupControl = LookupControl;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
+ const app_1 = require("@headless-adminapp/app/app");
6
7
  const hooks_1 = require("@headless-adminapp/app/hooks");
7
8
  const hooks_2 = require("@headless-adminapp/app/route/hooks");
8
- const app_1 = require("@headless-adminapp/core/experience/app");
9
+ const app_2 = require("@headless-adminapp/core/experience/app");
9
10
  const icons_1 = require("@headless-adminapp/icons");
10
11
  const react_1 = require("react");
11
12
  const AppStringContext_1 = require("../../App/AppStringContext");
12
13
  const RecordCard_1 = require("../../PageEntityForm/RecordCard");
14
+ const avatar_1 = require("../../utils/avatar");
13
15
  const useLookupData_1 = require("./useLookupData");
14
16
  function LookupControl(props) {
15
17
  const Control = LookupControlMd;
16
- return (0, jsx_runtime_1.jsx)(Control, Object.assign({}, props));
18
+ return (0, jsx_runtime_1.jsx)(Control, { ...props });
17
19
  }
18
20
  const useStyles = (0, react_components_1.makeStyles)({
19
21
  option: {
@@ -46,7 +48,7 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
46
48
  }
47
49
  return routeResolver({
48
50
  logicalName: schema.logicalName,
49
- type: app_1.PageType.EntityForm,
51
+ type: app_2.PageType.EntityForm,
50
52
  id: value.id,
51
53
  });
52
54
  }, [allowNavigation, routeResolver, schema.logicalName, value]);
@@ -85,7 +87,7 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
85
87
  const { isLoading: isViewLoading, view } = (0, useLookupData_1.useGetLookupView)(schema.logicalName, viewId);
86
88
  const { data, isLoading } = (0, useLookupData_1.useLookupData)({
87
89
  schema,
88
- view: view === null || view === void 0 ? void 0 : view.experience,
90
+ view: view?.experience,
89
91
  searchText: debouncedSearchText,
90
92
  dataService,
91
93
  enabled: lookupEnabled && !isViewLoading && !value && !readOnly && !disabled,
@@ -101,33 +103,75 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
101
103
  const handleChange = (value) => {
102
104
  setSearchText('');
103
105
  if (!value) {
104
- return onChange === null || onChange === void 0 ? void 0 : onChange(null);
106
+ return onChange?.(null);
105
107
  }
106
108
  else {
107
- return onChange === null || onChange === void 0 ? void 0 : onChange({
109
+ return onChange?.({
108
110
  id: value[schema.idAttribute],
109
111
  name: value[schema.primaryAttribute],
110
112
  logicalName: schema.logicalName,
111
113
  });
112
114
  }
113
115
  };
114
- return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: '100%' }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.Combobox, { name: name, appearance: "filled-darker", expandIcon: readOnly || disabled ? null : isLoading ? ((0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" })) : ((0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 18 })), placeholder: placeholder, inputMode: "search", style: { width: '100%' }, autoComplete: "off", readOnly: readOnly || disabled,
116
+ 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,
115
117
  // disabled={disabled}
116
118
  open: open && !value && !readOnly && !disabled, value: !value ? searchText : '', onOpenChange: (e, data) => setOpen(data.open), onChange: (e) => {
117
119
  setSearchText(e.target.value);
118
120
  }, onOptionSelect: (e, item) => {
119
- const _item = data === null || data === void 0 ? void 0 : data.records.find((x) => String(x[schema.idAttribute]) === item.optionValue);
120
- 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: {
121
+ const _item = data?.records.find((x) => String(x[schema.idAttribute]) === String(item.optionValue));
122
+ handleChange(_item ?? null);
123
+ }, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [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?.experience.card, record: item, schema: schema }) }, item[schema.idAttribute]))), !isLoading && !data?.records.length && ((0, jsx_runtime_1.jsx)("div", { style: {
122
124
  paddingInline: react_components_1.tokens.spacingHorizontalL,
123
125
  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: {
126
+ }, 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, {}), onClick: () => {
127
+ router.push(routeResolver({
128
+ logicalName: schema.logicalName,
129
+ type: app_2.PageType.EntityForm,
130
+ }));
131
+ }, children: loockupStrings.newRecord }) })] }))] }), !!value && ((0, jsx_runtime_1.jsx)("div", { style: {
125
132
  position: 'absolute',
126
133
  inset: 0,
127
134
  alignItems: 'center',
128
135
  paddingInline: 4,
129
136
  display: 'flex',
130
137
  }, 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: () => {
131
- 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 })) }) }) }))] }));
138
+ onChange?.(null);
139
+ }, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Close, { size: 16 }) }), primaryText: {
140
+ style: {
141
+ paddingBottom: 0,
142
+ },
143
+ }, children: allowNavigation && path ? ((0, jsx_runtime_1.jsxs)(react_components_1.Link, { href: path, onClick: handleOpenRecord, style: {
144
+ display: 'flex',
145
+ alignItems: 'center',
146
+ gap: react_components_1.tokens.spacingHorizontalXS,
147
+ }, children: [(0, jsx_runtime_1.jsx)(LookupAvatar, { schema: schema, logicalName: schema.logicalName, value: value }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: {
148
+ overflow: 'hidden',
149
+ textOverflow: 'ellipsis',
150
+ whiteSpace: 'nowrap',
151
+ }, children: value?.name })] })) : ((0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: value?.name })) }) }) }))] }));
152
+ };
153
+ const LookupAvatar = ({ logicalName, schema, value, }) => {
154
+ const { schemaMetadataDic } = (0, app_1.useAppContext)();
155
+ if (!schema.avatarAttribute) {
156
+ const experienceSchema = schemaMetadataDic[logicalName];
157
+ const Icon = experienceSchema.icon ?? icons_1.Icons.Entity ?? icons_1.IconPlaceholder;
158
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { style: {
159
+ width: 20,
160
+ height: 20,
161
+ }, icon: {
162
+ style: {
163
+ background: 'transparent',
164
+ color: 'inherit',
165
+ },
166
+ children: (0, jsx_runtime_1.jsx)(Icon, { size: 20 }),
167
+ } }));
168
+ }
169
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { style: {
170
+ width: 20,
171
+ height: 20,
172
+ fontSize: react_components_1.tokens.fontSizeBase100,
173
+ backgroundColor: 'transparent',
174
+ }, name: value?.name, color: (0, avatar_1.getAvatarColor)(value?.name), image: {
175
+ src: value?.avatar,
176
+ } }));
133
177
  };
@@ -8,10 +8,10 @@ function MultiSelectControl({ value, onChange, options, id, name, disabled, onBl
8
8
  const transformedOptions = (0, react_1.useMemo)(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
9
9
  const handleChange = (value) => {
10
10
  const selectedOptions = options.filter((x) => value.includes(String(x.value)));
11
- onChange === null || onChange === void 0 ? void 0 : onChange(selectedOptions.map((x) => x.value));
11
+ onChange?.(selectedOptions.map((x) => x.value));
12
12
  };
13
- const selectedOptions = (0, react_1.useMemo)(() => options.filter((x) => value === null || value === void 0 ? void 0 : value.includes(x.value)), [options, value]);
13
+ const selectedOptions = (0, react_1.useMemo)(() => options.filter((x) => value?.includes(x.value)), [options, value]);
14
14
  return ((0, jsx_runtime_1.jsx)(react_components_1.Dropdown, { placeholder: placeholder, id: id, name: name, appearance: "filled-darker", multiselect: true, value: selectedOptions.map((x) => x.label).join(', '), selectedOptions: value ? value.map(String) : [], onOptionSelect: (event, data) => {
15
15
  handleChange(data.selectedOptions);
16
- }, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), disabled: disabled, children: transformedOptions.map((x) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.value, children: x.label }, x.value))) }));
16
+ }, onBlur: () => onBlur?.(), onFocus: () => onFocus?.(), disabled: disabled, children: transformedOptions.map((x) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.value, children: x.label }, x.value))) }));
17
17
  }