@headless-adminapp/fluent 1.2.3 → 1.2.4

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.
@@ -53,34 +53,28 @@ const CalendarSection = ({ startDate, endDate, viewType, onRangeChange, events,
53
53
  switch (props.view.type) {
54
54
  case types_1.ViewType.Month:
55
55
  onRangeChange?.({
56
- currentStart: currentStart, //dayjs(currentStart).tz(timezone).startOf('month').toDate(),
57
- currentEnd: currentEnd, // dayjs(currentEnd).tz(timezone).endOf('month').toDate(),
58
- activeStart: activeStart, // dayjs(activeStart).tz(timezone).startOf('day').toDate(),
59
- activeEnd: activeEnd, // dayjs(activeEnd).tz(timezone).endOf('day').toDate(),
56
+ currentStart: currentStart,
57
+ currentEnd: currentEnd,
58
+ activeStart: activeStart,
59
+ activeEnd: activeEnd,
60
60
  viewType: types_1.ViewType.Month,
61
61
  });
62
62
  break;
63
63
  case types_1.ViewType.Week:
64
64
  onRangeChange?.({
65
- currentStart: (0, dayjs_1.default)(currentStart)
66
- .tz(timezone)
67
- .startOf('isoWeek')
68
- .toDate(),
69
- currentEnd: (0, dayjs_1.default)(currentEnd).tz(timezone).endOf('isoWeek').toDate(),
70
- activeStart: (0, dayjs_1.default)(activeStart).tz(timezone).startOf('day').toDate(),
71
- activeEnd: (0, dayjs_1.default)(activeEnd).tz(timezone).endOf('day').toDate(),
65
+ currentStart: currentStart,
66
+ currentEnd: currentEnd,
67
+ activeStart: activeStart,
68
+ activeEnd: activeEnd,
72
69
  viewType: types_1.ViewType.Week,
73
70
  });
74
71
  break;
75
72
  case types_1.ViewType.Day:
76
73
  onRangeChange?.({
77
- currentStart: (0, dayjs_1.default)(currentStart)
78
- .tz(timezone)
79
- .startOf('day')
80
- .toDate(),
81
- currentEnd: (0, dayjs_1.default)(currentEnd).tz(timezone).endOf('day').toDate(),
82
- activeStart: (0, dayjs_1.default)(activeStart).tz(timezone).startOf('day').toDate(),
83
- activeEnd: (0, dayjs_1.default)(activeEnd).tz(timezone).endOf('day').toDate(),
74
+ currentStart: currentStart,
75
+ currentEnd: currentEnd,
76
+ activeStart: activeStart,
77
+ activeEnd: activeEnd,
84
78
  viewType: types_1.ViewType.Day,
85
79
  });
86
80
  break;
@@ -4,12 +4,14 @@ exports.Header = Header;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_components_1 = require("@fluentui/react-components");
6
6
  const useConfig_1 = require("@headless-adminapp/app/calendar/hooks/useConfig");
7
- const icons_fluent_1 = require("@headless-adminapp/icons-fluent");
7
+ const icons_1 = require("@headless-adminapp/icons");
8
+ const react_query_1 = require("@tanstack/react-query");
8
9
  const react_1 = require("react");
9
10
  const react_hook_form_1 = require("react-hook-form");
10
11
  const StandardControl_1 = require("../PageEntityForm/StandardControl");
11
12
  function Header({ filterForm, onCreateButtonClick, }) {
12
13
  const config = (0, useConfig_1.useConfig)();
14
+ const queryClient = (0, react_query_1.useQueryClient)();
13
15
  return ((0, jsx_runtime_1.jsxs)("div", { style: {
14
16
  display: 'flex',
15
17
  flexDirection: 'column',
@@ -23,11 +25,15 @@ function Header({ filterForm, onCreateButtonClick, }) {
23
25
  display: 'flex',
24
26
  alignItems: 'center',
25
27
  gap: react_components_1.tokens.spacingHorizontalM,
26
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: { color: react_components_1.tokens.colorNeutralForeground1 }, children: config.title }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground2 }, children: config.description })] }) }) }), (0, jsx_runtime_1.jsx)("div", { style: {
28
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { flex: 1 }, children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)(react_components_1.Subtitle2, { style: { color: react_components_1.tokens.colorNeutralForeground1 }, children: config.title }), (0, jsx_runtime_1.jsx)(react_components_1.Caption1, { style: { color: react_components_1.tokens.colorNeutralForeground2 }, children: config.description })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
27
29
  display: 'flex',
28
30
  alignItems: 'center',
29
31
  gap: react_components_1.tokens.spacingHorizontalS,
30
- }, children: !!config.createOptions && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { style: { fontWeight: react_components_1.tokens.fontWeightMedium }, icon: (0, jsx_runtime_1.jsx)(icons_fluent_1.iconSet.Add, {}), appearance: "primary", onClick: onCreateButtonClick, children: "Create" })) })] }), !!config.filterAttributes &&
32
+ }, children: [!!config.createOptions && ((0, jsx_runtime_1.jsx)(react_components_1.Button, { style: { fontWeight: react_components_1.tokens.fontWeightMedium }, icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), appearance: "primary", onClick: onCreateButtonClick, children: "Create" })), (0, jsx_runtime_1.jsx)(react_components_1.Button, { icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Refresh, {}), appearance: "subtle", style: { fontWeight: react_components_1.tokens.fontWeightRegular }, onClick: async () => {
33
+ await queryClient.invalidateQueries({
34
+ queryKey: ['calendar-events', 'list'],
35
+ });
36
+ } })] })] }), !!config.filterAttributes &&
31
37
  Object.keys(config.filterAttributes).length > 0 && ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, { style: { opacity: 0.2 } }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', gap: react_components_1.tokens.spacingHorizontalS }, children: Object.entries(config.filterAttributes).map(([attributeName, attribute]) => {
32
38
  return ((0, jsx_runtime_1.jsx)(react_hook_form_1.Controller, { control: filterForm.control, name: attributeName, render: ({ field }) => {
33
39
  return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(StandardControl_1.StandardControl, { attribute: attribute, name: attributeName, value: field.value, onChange: field.onChange, onBlur: field.onBlur }) }));
@@ -28,17 +28,27 @@ const TitleSelector = ({ start, end, onChange, viewType, }) => {
28
28
  }
29
29
  switch (viewType) {
30
30
  case types_1.ViewType.Day:
31
- return (0, dayjs_1.default)(start).format(isMobile ? 'MMM D' : 'MMM D, YYYY');
31
+ return (0, dayjs_1.default)(start)
32
+ .tz(timezone)
33
+ .format(isMobile ? 'MMM D' : 'MMM D, YYYY');
32
34
  case types_1.ViewType.Week:
33
35
  if (isMobile) {
34
- return `${(0, dayjs_1.default)(start).format('MMM D')} - ${(0, dayjs_1.default)(end).format('D')}`;
36
+ return `${(0, dayjs_1.default)(start).tz(timezone).format('MMM D')} - ${(0, dayjs_1.default)(end)
37
+ .tz(timezone)
38
+ .subtract(1, 'millisecond')
39
+ .format('D')}`;
35
40
  }
36
- return `${(0, dayjs_1.default)(start).format('MMM D')} - ${(0, dayjs_1.default)(end).format('MMM D, YYYY')}`;
41
+ return `${(0, dayjs_1.default)(start).tz(timezone).format('MMM D')} - ${(0, dayjs_1.default)(end)
42
+ .tz(timezone)
43
+ .subtract(1, 'millisecond')
44
+ .format('MMM D, YYYY')}`;
37
45
  case types_1.ViewType.Month:
38
- return (0, dayjs_1.default)(start).format(isMobile ? 'MMM YYYY' : 'MMMM YYYY');
46
+ return (0, dayjs_1.default)(start)
47
+ .tz(timezone)
48
+ .format(isMobile ? 'MMM YYYY' : 'MMMM YYYY');
39
49
  }
40
50
  return '';
41
- }, [start, end, viewType, isMobile]);
51
+ }, [start, end, viewType, timezone, isMobile]);
42
52
  if (!start || !end) {
43
53
  return null;
44
54
  }
@@ -111,5 +111,5 @@ const PopoverContent = ({ eventInfo, onClose }) => {
111
111
  .tz(timezone)
112
112
  .format(timeFormats.short) +
113
113
  ' - ' +
114
- (0, dayjs_1.default)(eventInfo.event.end).tz(timezone).format(timeFormats.short)] }), (0, jsx_runtime_1.jsx)("div", { children: eventInfo.event.extendedProps.description }), !!config.EventExtendedDetailComponent && ((0, jsx_runtime_1.jsx)(config.EventExtendedDetailComponent, { eventInfo: eventInfo }))] })] }));
114
+ (0, dayjs_1.default)(eventInfo.event.end).tz(timezone).format(timeFormats.short)] }), !!eventInfo.event.extendedProps.description && ((0, jsx_runtime_1.jsx)("div", { children: eventInfo.event.extendedProps.description })), !!config.EventExtendedDetailComponent && ((0, jsx_runtime_1.jsx)(config.EventExtendedDetailComponent, { eventInfo: eventInfo }))] })] }));
115
115
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@headless-adminapp/fluent",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -52,5 +52,5 @@
52
52
  "uuid": "11.0.3",
53
53
  "yup": "^1.4.0"
54
54
  },
55
- "gitHead": "8d3c42183ed245a59d5200b4f0d4d271ebfe2160"
55
+ "gitHead": "776239a44a2e6d53c3f92665f516feff4e8a83b6"
56
56
  }