@gooddata/sdk-ui-kit 10.25.0-alpha.8 → 10.25.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.
- package/esm/@ui/UiButton/UiButton.js +1 -1
- package/esm/@ui/UiButton/UiButton.js.map +1 -1
- package/esm/@ui/UiChip/UiChip.d.ts.map +1 -1
- package/esm/@ui/UiChip/UiChip.js +9 -2
- package/esm/@ui/UiChip/UiChip.js.map +1 -1
- package/esm/@ui/UiFocusTrap/UiFocusTrap.d.ts +11 -1
- package/esm/@ui/UiFocusTrap/UiFocusTrap.d.ts.map +1 -1
- package/esm/@ui/UiFocusTrap/UiFocusTrap.js +31 -7
- package/esm/@ui/UiFocusTrap/UiFocusTrap.js.map +1 -1
- package/esm/@ui/UiSkeleton/UiSkeleton.d.ts +5 -1
- package/esm/@ui/UiSkeleton/UiSkeleton.d.ts.map +1 -1
- package/esm/@ui/UiSkeleton/UiSkeleton.js +2 -2
- package/esm/@ui/UiSkeleton/UiSkeleton.js.map +1 -1
- package/esm/Datepicker/Datepicker.d.ts +5 -0
- package/esm/Datepicker/Datepicker.d.ts.map +1 -1
- package/esm/Datepicker/Datepicker.js +9 -2
- package/esm/Datepicker/Datepicker.js.map +1 -1
- package/esm/Dialog/CommunityEditionDialog.d.ts.map +1 -1
- package/esm/Dialog/CommunityEditionDialog.js +5 -3
- package/esm/Dialog/CommunityEditionDialog.js.map +1 -1
- package/esm/Dialog/ConfirmDialogBase.d.ts +2 -6
- package/esm/Dialog/ConfirmDialogBase.d.ts.map +1 -1
- package/esm/Dialog/ConfirmDialogBase.js +32 -41
- package/esm/Dialog/ConfirmDialogBase.js.map +1 -1
- package/esm/Dialog/Dialog.d.ts +3 -5
- package/esm/Dialog/Dialog.d.ts.map +1 -1
- package/esm/Dialog/Dialog.js +10 -13
- package/esm/Dialog/Dialog.js.map +1 -1
- package/esm/Dialog/DialogBase.d.ts +2 -8
- package/esm/Dialog/DialogBase.d.ts.map +1 -1
- package/esm/Dialog/DialogBase.js +22 -39
- package/esm/Dialog/DialogBase.js.map +1 -1
- package/esm/Dialog/DialogCloseButton.d.ts +4 -0
- package/esm/Dialog/DialogCloseButton.d.ts.map +1 -0
- package/esm/Dialog/DialogCloseButton.js +8 -0
- package/esm/Dialog/DialogCloseButton.js.map +1 -0
- package/esm/Dialog/ExportDialog.d.ts +3 -3
- package/esm/Dialog/ExportDialog.d.ts.map +1 -1
- package/esm/Dialog/ExportDialog.js +3 -4
- package/esm/Dialog/ExportDialog.js.map +1 -1
- package/esm/Dialog/ExportDialogBase.d.ts +3 -11
- package/esm/Dialog/ExportDialogBase.d.ts.map +1 -1
- package/esm/Dialog/ExportDialogBase.js +14 -50
- package/esm/Dialog/ExportDialogBase.js.map +1 -1
- package/esm/Dialog/HubspotConversionTouchPointDialog.d.ts.map +1 -1
- package/esm/Dialog/HubspotConversionTouchPointDialog.js +5 -3
- package/esm/Dialog/HubspotConversionTouchPointDialog.js.map +1 -1
- package/esm/Dialog/HubspotConversionTouchPointDialogBase.d.ts +6 -0
- package/esm/Dialog/HubspotConversionTouchPointDialogBase.d.ts.map +1 -1
- package/esm/Dialog/HubspotConversionTouchPointDialogBase.js +3 -2
- package/esm/Dialog/HubspotConversionTouchPointDialogBase.js.map +1 -1
- package/esm/Dialog/StylingEditorDialog/StylingEditorDialog.d.ts +3 -2
- package/esm/Dialog/StylingEditorDialog/StylingEditorDialog.d.ts.map +1 -1
- package/esm/Dialog/StylingEditorDialog/StylingEditorDialog.js +5 -3
- package/esm/Dialog/StylingEditorDialog/StylingEditorDialog.js.map +1 -1
- package/esm/Dialog/StylingEditorDialog/StylingEditorDialogFooter.d.ts +3 -3
- package/esm/Dialog/StylingEditorDialog/StylingEditorDialogFooter.d.ts.map +1 -1
- package/esm/Dialog/StylingEditorDialog/StylingEditorDialogFooter.js +1 -1
- package/esm/Dialog/StylingEditorDialog/StylingEditorDialogFooter.js.map +1 -1
- package/esm/Dialog/StylingEditorDialog/index.d.ts +1 -1
- package/esm/Dialog/typings.d.ts +40 -21
- package/esm/Dialog/typings.d.ts.map +1 -1
- package/esm/Dropdown/DropdownList.d.ts.map +1 -1
- package/esm/Dropdown/DropdownList.js +3 -1
- package/esm/Dropdown/DropdownList.js.map +1 -1
- package/esm/Form/InputPure.d.ts +2 -1
- package/esm/Form/InputPure.d.ts.map +1 -1
- package/esm/Form/InputPure.js +3 -2
- package/esm/Form/InputPure.js.map +1 -1
- package/esm/List/InsightListItem.d.ts +2 -1
- package/esm/List/InsightListItem.d.ts.map +1 -1
- package/esm/List/InsightListItem.js +2 -2
- package/esm/List/InsightListItem.js.map +1 -1
- package/esm/List/InvertableSelect/InvertableSelectSearchBar.d.ts.map +1 -1
- package/esm/List/InvertableSelect/InvertableSelectSearchBar.js +3 -1
- package/esm/List/InvertableSelect/InvertableSelectSearchBar.js.map +1 -1
- package/esm/RecurrenceForm/CronExpression.d.ts +6 -2
- package/esm/RecurrenceForm/CronExpression.d.ts.map +1 -1
- package/esm/RecurrenceForm/CronExpression.js +15 -32
- package/esm/RecurrenceForm/CronExpression.js.map +1 -1
- package/esm/RecurrenceForm/CronExpressionSuggestion.d.ts +10 -0
- package/esm/RecurrenceForm/CronExpressionSuggestion.d.ts.map +1 -0
- package/esm/RecurrenceForm/CronExpressionSuggestion.js +21 -0
- package/esm/RecurrenceForm/CronExpressionSuggestion.js.map +1 -0
- package/esm/RecurrenceForm/DateTime.d.ts +1 -1
- package/esm/RecurrenceForm/DateTime.d.ts.map +1 -1
- package/esm/RecurrenceForm/DateTime.js +44 -6
- package/esm/RecurrenceForm/DateTime.js.map +1 -1
- package/esm/RecurrenceForm/Recurrence.d.ts +4 -0
- package/esm/RecurrenceForm/Recurrence.d.ts.map +1 -1
- package/esm/RecurrenceForm/Recurrence.js +30 -8
- package/esm/RecurrenceForm/Recurrence.js.map +1 -1
- package/esm/RecurrenceForm/RecurrenceForm.d.ts +4 -1
- package/esm/RecurrenceForm/RecurrenceForm.d.ts.map +1 -1
- package/esm/RecurrenceForm/RecurrenceForm.js +9 -6
- package/esm/RecurrenceForm/RecurrenceForm.js.map +1 -1
- package/esm/RecurrenceForm/RepeatTypeDescription.js +3 -2
- package/esm/RecurrenceForm/RepeatTypeDescription.js.map +1 -1
- package/esm/RecurrenceForm/RepeatTypeSelect.d.ts +1 -1
- package/esm/RecurrenceForm/RepeatTypeSelect.d.ts.map +1 -1
- package/esm/RecurrenceForm/RepeatTypeSelect.js +41 -18
- package/esm/RecurrenceForm/RepeatTypeSelect.js.map +1 -1
- package/esm/RecurrenceForm/constants.d.ts +1 -6
- package/esm/RecurrenceForm/constants.d.ts.map +1 -1
- package/esm/RecurrenceForm/constants.js +2 -7
- package/esm/RecurrenceForm/constants.js.map +1 -1
- package/esm/RecurrenceForm/locales.d.ts.map +1 -1
- package/esm/RecurrenceForm/locales.js +3 -1
- package/esm/RecurrenceForm/locales.js.map +1 -1
- package/esm/RecurrenceForm/useCronValidation.d.ts +17 -0
- package/esm/RecurrenceForm/useCronValidation.d.ts.map +1 -0
- package/esm/RecurrenceForm/useCronValidation.js +81 -0
- package/esm/RecurrenceForm/useCronValidation.js.map +1 -0
- package/esm/RecurrenceForm/utils.d.ts +3 -2
- package/esm/RecurrenceForm/utils.d.ts.map +1 -1
- package/esm/RecurrenceForm/utils.js +7 -2
- package/esm/RecurrenceForm/utils.js.map +1 -1
- package/esm/RecurrenceForm/utils.test.js +75 -65
- package/esm/RecurrenceForm/utils.test.js.map +1 -1
- package/esm/Typography/Typography.d.ts +1 -0
- package/esm/Typography/Typography.d.ts.map +1 -1
- package/esm/Typography/Typography.js +3 -3
- package/esm/Typography/Typography.js.map +1 -1
- package/esm/responsive/interfaces.d.ts +4 -0
- package/esm/responsive/interfaces.d.ts.map +1 -1
- package/esm/responsive/interfaces.js +1 -1
- package/esm/responsive/useMediaQuery.d.ts.map +1 -1
- package/esm/responsive/useMediaQuery.js +3 -1
- package/esm/responsive/useMediaQuery.js.map +1 -1
- package/esm/sdk-ui-kit.d.ts +105 -64
- package/esm/typings/utilities.d.ts +1 -0
- package/esm/typings/utilities.d.ts.map +1 -1
- package/esm/typings/utilities.js +2 -1
- package/esm/typings/utilities.js.map +1 -1
- package/package.json +9 -8
- package/src/@ui/UiChip/UiChip.scss +2 -0
- package/styles/css/aria.css +13 -0
- package/styles/css/aria.css.map +1 -0
- package/styles/css/bubble.css +1 -1
- package/styles/css/button.css +2 -2
- package/styles/css/datepicker.css +6 -6
- package/styles/css/descriptionPanel.css +1 -1
- package/styles/css/dialog.css +3 -3
- package/styles/css/dialogList.css +2 -2
- package/styles/css/form.css +2 -2
- package/styles/css/header.css +9 -9
- package/styles/css/hyperlink.css +1 -1
- package/styles/css/invertableSelect.css +1 -1
- package/styles/css/list.css +4 -4
- package/styles/css/main.css +132 -59
- package/styles/css/main.css.map +1 -1
- package/styles/css/menu.css +4 -4
- package/styles/css/messages.css +1 -1
- package/styles/css/overlay.css +3 -3
- package/styles/css/recurrenceForm.css +60 -2
- package/styles/css/recurrenceForm.css.map +1 -1
- package/styles/css/settingWidget.css +1 -1
- package/styles/css/shareDialog.css +4 -4
- package/styles/css/shareDialogSelectControl.css +3 -3
- package/styles/css/stylingEditorDialog.css +1 -1
- package/styles/css/tabs.css +1 -1
- package/styles/css/typo.css +11 -11
- package/styles/scss/aria.scss +13 -0
- package/styles/scss/main.scss +1 -0
- package/styles/scss/recurrenceForm.scss +76 -2
- package/styles/scss/variables.scss +1 -1
@@ -7,15 +7,19 @@ import { WeekStart } from "@gooddata/sdk-model";
|
|
7
7
|
export interface IRecurrenceProps {
|
8
8
|
label: string;
|
9
9
|
showRepeatTypeDescription?: boolean;
|
10
|
+
showInheritValue?: boolean;
|
10
11
|
recurrenceType: RecurrenceType;
|
12
|
+
inheritRecurrenceType?: RecurrenceType;
|
11
13
|
startDate?: Date | null;
|
12
14
|
timezone?: string;
|
13
15
|
cronValue: string;
|
16
|
+
cronPlaceholder?: string;
|
14
17
|
weekStart?: WeekStart;
|
15
18
|
onRepeatTypeChange: (repeatType: string) => void;
|
16
19
|
onCronValueChange: (cronValue: string, isValid: boolean) => void;
|
17
20
|
allowHourlyRecurrence?: boolean;
|
18
21
|
showTimezoneInOccurrence?: boolean;
|
22
|
+
isWhiteLabeled?: boolean;
|
19
23
|
onRecurrenceDropdownOpen?: () => void;
|
20
24
|
}
|
21
25
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Recurrence.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/Recurrence.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"Recurrence.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/Recurrence.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKhD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,cAAc,CAAC;IAC/B,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,kBAAkB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACjE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;CACzC;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA8FjD,CAAC"}
|
@@ -1,9 +1,13 @@
|
|
1
1
|
// (C) 2024-2025 GoodData Corporation
|
2
2
|
import React from "react";
|
3
|
+
import cx from "classnames";
|
3
4
|
import { RepeatTypeSelect } from "./RepeatTypeSelect.js";
|
4
5
|
import { CronExpression } from "./CronExpression.js";
|
5
6
|
import { RECURRENCE_TYPES } from "./constants.js";
|
6
7
|
import { RepeatTypeDescription } from "./RepeatTypeDescription.js";
|
8
|
+
import { CronExpressionSuggestion } from "./CronExpressionSuggestion.js";
|
9
|
+
import { useCronValidation } from "./useCronValidation.js";
|
10
|
+
import { useId } from "../utils/useId.js";
|
7
11
|
/**
|
8
12
|
* @internal
|
9
13
|
*
|
@@ -11,13 +15,31 @@ import { RepeatTypeDescription } from "./RepeatTypeDescription.js";
|
|
11
15
|
* @param props - IRecurrenceProps
|
12
16
|
*/
|
13
17
|
export const Recurrence = (props) => {
|
14
|
-
const { label, recurrenceType, startDate, cronValue, timezone, onRepeatTypeChange, onCronValueChange, allowHourlyRecurrence, showTimezoneInOccurrence, showRepeatTypeDescription, weekStart = "Sunday", onRecurrenceDropdownOpen, } = props;
|
15
|
-
const
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
const { label, recurrenceType, inheritRecurrenceType, startDate, cronValue, cronPlaceholder, timezone, onRepeatTypeChange, onCronValueChange, allowHourlyRecurrence, showTimezoneInOccurrence, showRepeatTypeDescription, showInheritValue, isWhiteLabeled, weekStart = "Sunday", onRecurrenceDropdownOpen, } = props;
|
19
|
+
const { cronError, handleChange, handleOnBlur } = useCronValidation({
|
20
|
+
allowHourlyRecurrence,
|
21
|
+
onCronValueChange,
|
22
|
+
});
|
23
|
+
const labelId = `${useId()}-label`;
|
24
|
+
const errorId = `${useId()}-error`;
|
25
|
+
const recurrenceFormClasses = cx("gd-recurrence-form-repeat", "gd-input-component", {
|
26
|
+
"gd-recurrence-form-repeat-cron": recurrenceType === RECURRENCE_TYPES.CRON,
|
27
|
+
});
|
28
|
+
const isInherit = recurrenceType === RECURRENCE_TYPES.INHERIT;
|
29
|
+
const isCron = recurrenceType === RECURRENCE_TYPES.CRON ||
|
30
|
+
(isInherit && inheritRecurrenceType === RECURRENCE_TYPES.CRON);
|
31
|
+
const isSpecified = recurrenceType !== RECURRENCE_TYPES.CRON ||
|
32
|
+
(isInherit && inheritRecurrenceType !== RECURRENCE_TYPES.CRON);
|
33
|
+
return (React.createElement(React.Fragment, null,
|
34
|
+
React.createElement("div", { className: recurrenceFormClasses },
|
35
|
+
label ? (React.createElement("label", { id: labelId, className: "gd-label" }, label)) : null,
|
36
|
+
React.createElement("div", { className: "gd-recurrence-form-repeat-inner" },
|
37
|
+
React.createElement(RepeatTypeSelect, { repeatType: recurrenceType, startDate: startDate, onChange: onRepeatTypeChange, allowHourlyRecurrence: allowHourlyRecurrence, showInheritValue: showInheritValue, onRepeatDropdownOpen: onRecurrenceDropdownOpen }),
|
38
|
+
isSpecified && showRepeatTypeDescription ? (React.createElement(RepeatTypeDescription, { repeatType: isInherit ? inheritRecurrenceType : recurrenceType, startDate: startDate, weekStart: weekStart, timezone: timezone, showTimezone: Boolean(showTimezoneInOccurrence && !isInherit) })) : null,
|
39
|
+
isCron ? (React.createElement(CronExpression, { expression: isInherit ? cronPlaceholder : cronValue, onChange: handleChange, allowHourlyRecurrence: allowHourlyRecurrence, timezone: timezone, showTimezone: showTimezoneInOccurrence, validationError: cronError, onBlur: handleOnBlur, accessibilityConfig: {
|
40
|
+
ariaDescribedBy: cronError ? errorId : undefined,
|
41
|
+
ariaLabelledBy: labelId,
|
42
|
+
}, disabled: isInherit })) : null)),
|
43
|
+
!isInherit ? (React.createElement(CronExpressionSuggestion, { errorId: errorId, validationError: cronError, recurrenceType: recurrenceType, isWhiteLabeled: isWhiteLabeled })) : null));
|
22
44
|
};
|
23
45
|
//# sourceMappingURL=Recurrence.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Recurrence.js","sourceRoot":"","sources":["../../src/RecurrenceForm/Recurrence.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;
|
1
|
+
{"version":3,"file":"Recurrence.js","sourceRoot":"","sources":["../../src/RecurrenceForm/Recurrence.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAwB1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAA+B,CAAC,KAAK,EAAE,EAAE;IAC5D,MAAM,EACF,KAAK,EACL,cAAc,EACd,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACj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,WAAW,IAAI,yBAAyB,CAAC,CAAC,CAAC,CACxC,oBAAC,qBAAqB,IAClB,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,cAAc,EAC9D,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,OAAO,CAAC,wBAAwB,IAAI,CAAC,SAAS,CAAC,GAC/D,CACL,CAAC,CAAC,CAAC,IAAI;gBACP,MAAM,CAAC,CAAC,CAAC,CACN,oBAAC,cAAc,IACX,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,EACnD,QAAQ,EAAE,YAAY,EACtB,qBAAqB,EAAE,qBAAqB,EAC5C,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,wBAAwB,EACtC,eAAe,EAAE,SAAS,EAC1B,MAAM,EAAE,YAAY,EACpB,mBAAmB,EAAE;wBACjB,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;wBAChD,cAAc,EAAE,OAAO;qBAC1B,EACD,QAAQ,EAAE,SAAS,GACrB,CACL,CAAC,CAAC,CAAC,IAAI,CACN,CACJ;QACL,CAAC,SAAS,CAAC,CAAC,CAAC,CACV,oBAAC,wBAAwB,IACrB,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,SAAS,EAC1B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,cAAc,GAChC,CACL,CAAC,CAAC,CAAC,IAAI,CACT,CACN,CAAC;AACN,CAAC,CAAC"}
|
@@ -5,7 +5,8 @@ import { WeekStart } from "@gooddata/sdk-model";
|
|
5
5
|
*/
|
6
6
|
export interface IRecurrenceFormProps {
|
7
7
|
startDate?: Date | null;
|
8
|
-
cronExpression
|
8
|
+
cronExpression?: string;
|
9
|
+
placeholder?: string;
|
9
10
|
onChange: (cronExpression: string, startDate: Date | null, isValid: boolean) => void;
|
10
11
|
locale?: string;
|
11
12
|
dateFormat?: string;
|
@@ -18,6 +19,8 @@ export interface IRecurrenceFormProps {
|
|
18
19
|
allowHourlyRecurrence?: boolean;
|
19
20
|
showRepeatTypeDescription?: boolean;
|
20
21
|
showTimezoneInOccurrence?: boolean;
|
22
|
+
showInheritValue?: boolean;
|
23
|
+
isWhiteLabeled?: boolean;
|
21
24
|
onRecurrenceDropdownOpen?: () => void;
|
22
25
|
}
|
23
26
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RecurrenceForm.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/RecurrenceForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
1
|
+
{"version":3,"file":"RecurrenceForm.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/RecurrenceForm.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAmBhD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;CACzC;AAsHD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAIzD,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// (C) 2024 GoodData Corporation
|
1
|
+
// (C) 2024-2025 GoodData Corporation
|
2
2
|
import React, { useCallback, useState } from "react";
|
3
3
|
import { useIntl } from "react-intl";
|
4
4
|
import { IntlWrapper } from "@gooddata/sdk-ui";
|
@@ -7,13 +7,14 @@ import { transformCronExpressionToRecurrenceType, constructCronExpression, isCro
|
|
7
7
|
import { DateTime } from "./DateTime.js";
|
8
8
|
import { Recurrence } from "./Recurrence.js";
|
9
9
|
import { messages } from "./locales.js";
|
10
|
-
import { DEFAULT_DATE_FORMAT, DEFAULT_LOCALE, DEFAULT_TIME_FORMAT, DEFAULT_WEEK_START } from "./constants.js";
|
10
|
+
import { DEFAULT_DATE_FORMAT, DEFAULT_LOCALE, DEFAULT_TIME_FORMAT, DEFAULT_WEEK_START, RECURRENCE_TYPES, } from "./constants.js";
|
11
11
|
const RecurrenceFormCore = (props) => {
|
12
|
-
const { startDate = null, cronExpression, onChange, locale = DEFAULT_LOCALE, dateFormat = DEFAULT_DATE_FORMAT, timeFormat = DEFAULT_TIME_FORMAT, weekStart = DEFAULT_WEEK_START, timezone, startLabel, repeatLabel, className, allowHourlyRecurrence = true, showRepeatTypeDescription, showTimezoneInOccurrence, onRecurrenceDropdownOpen, } = props;
|
12
|
+
const { startDate = null, cronExpression = "", placeholder, onChange, locale = DEFAULT_LOCALE, dateFormat = DEFAULT_DATE_FORMAT, timeFormat = DEFAULT_TIME_FORMAT, weekStart = DEFAULT_WEEK_START, timezone, startLabel, repeatLabel, className, allowHourlyRecurrence = true, showRepeatTypeDescription, showTimezoneInOccurrence, showInheritValue, isWhiteLabeled, onRecurrenceDropdownOpen, } = props;
|
13
13
|
const intl = useIntl();
|
14
14
|
const [dateValue, setDateValue] = useState(startDate);
|
15
15
|
const [cronValue, setCronValue] = useState(cronExpression);
|
16
|
-
const [recurrenceType, setRecurrenceType] = useState(transformCronExpressionToRecurrenceType(dateValue, cronExpression, allowHourlyRecurrence, weekStart));
|
16
|
+
const [recurrenceType, setRecurrenceType] = useState(transformCronExpressionToRecurrenceType(dateValue, cronExpression, allowHourlyRecurrence, showInheritValue, weekStart));
|
17
|
+
const [inheritRecurrenceType] = useState(transformCronExpressionToRecurrenceType(dateValue, placeholder, allowHourlyRecurrence, false, weekStart));
|
17
18
|
const onDateChange = useCallback((date, valid) => {
|
18
19
|
setDateValue(date);
|
19
20
|
const newExpression = constructCronExpression(date, recurrenceType, cronExpression, weekStart);
|
@@ -22,7 +23,9 @@ const RecurrenceFormCore = (props) => {
|
|
22
23
|
const onRepeatTypeChange = useCallback((type) => {
|
23
24
|
setRecurrenceType(type);
|
24
25
|
const newExpression = constructCronExpression(dateValue, type, cronValue, weekStart);
|
25
|
-
onChange(newExpression, dateValue,
|
26
|
+
onChange(newExpression, dateValue, type === RECURRENCE_TYPES.INHERIT
|
27
|
+
? true
|
28
|
+
: isCronExpressionValid(newExpression, allowHourlyRecurrence));
|
26
29
|
}, [cronValue, dateValue, onChange, weekStart, allowHourlyRecurrence]);
|
27
30
|
const onCronValueChange = useCallback((cron, isValid) => {
|
28
31
|
setCronValue(cron);
|
@@ -30,7 +33,7 @@ const RecurrenceFormCore = (props) => {
|
|
30
33
|
}, [dateValue, onChange]);
|
31
34
|
return (React.createElement("div", { className: cx("gd-recurrence-form s-recurrence-form", className) },
|
32
35
|
Boolean(startDate) && (React.createElement(DateTime, { label: startLabel ?? intl.formatMessage({ id: messages.starts.id }), date: dateValue, onDateChange: onDateChange, locale: locale, dateFormat: dateFormat, timezone: timezone, weekStart: weekStart, timeFormat: timeFormat })),
|
33
|
-
React.createElement(Recurrence, { label: repeatLabel ?? intl.formatMessage({ id: messages.repeats.id }), showRepeatTypeDescription: showRepeatTypeDescription, recurrenceType: recurrenceType, startDate: dateValue, cronValue: cronValue, onRepeatTypeChange: onRepeatTypeChange, onCronValueChange: onCronValueChange, allowHourlyRecurrence: allowHourlyRecurrence, weekStart: weekStart, timezone: timezone, showTimezoneInOccurrence: showTimezoneInOccurrence, onRecurrenceDropdownOpen: onRecurrenceDropdownOpen })));
|
36
|
+
React.createElement(Recurrence, { label: repeatLabel ?? intl.formatMessage({ id: messages.repeats.id }), showRepeatTypeDescription: showRepeatTypeDescription, recurrenceType: recurrenceType, inheritRecurrenceType: inheritRecurrenceType, startDate: dateValue, cronValue: cronValue, cronPlaceholder: placeholder, onRepeatTypeChange: onRepeatTypeChange, onCronValueChange: onCronValueChange, allowHourlyRecurrence: allowHourlyRecurrence, weekStart: weekStart, timezone: timezone, showInheritValue: showInheritValue, showTimezoneInOccurrence: showTimezoneInOccurrence, onRecurrenceDropdownOpen: onRecurrenceDropdownOpen, isWhiteLabeled: isWhiteLabeled })));
|
34
37
|
};
|
35
38
|
/**
|
36
39
|
* @internal
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RecurrenceForm.js","sourceRoot":"","sources":["../../src/RecurrenceForm/RecurrenceForm.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"RecurrenceForm.js","sourceRoot":"","sources":["../../src/RecurrenceForm/RecurrenceForm.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,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"react";
|
3
3
|
import { useIntl } from "react-intl";
|
4
4
|
import { transformRecurrenceTypeToDescription } from "./utils.js";
|
@@ -10,6 +10,7 @@ export const RepeatTypeDescription = (props) => {
|
|
10
10
|
transformRecurrenceTypeToDescription(intl, repeatType, startDate, weekStart),
|
11
11
|
showTimezone && timezone ? React.createElement(React.Fragment, null,
|
12
12
|
" ",
|
13
|
-
timezone
|
13
|
+
timezone,
|
14
|
+
" time") : null)));
|
14
15
|
};
|
15
16
|
//# sourceMappingURL=RepeatTypeDescription.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RepeatTypeDescription.js","sourceRoot":"","sources":["../../src/RecurrenceForm/RepeatTypeDescription.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"RepeatTypeDescription.js","sourceRoot":"","sources":["../../src/RecurrenceForm/RepeatTypeDescription.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAGrC,OAAO,EAAE,oCAAoC,EAAE,MAAM,YAAY,CAAC;AAUlE,MAAM,CAAC,MAAM,qBAAqB,GAA0C,CAAC,KAAK,EAAE,EAAE;IAClF,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IAE3E,OAAO,CACH,6BAAK,SAAS,EAAC,sFAAsF;QACjG;YACK,oCAAoC,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC;YAC5E,YAAY,IAAI,QAAQ,CAAC,CAAC,CAAC;;gBAAI,QAAQ;wBAAS,CAAC,CAAC,CAAC,IAAI,CACrD,CACL,CACT,CAAC;AACN,CAAC,CAAC"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { RecurrenceType } from "./types.js";
|
3
3
|
export interface IRepeatTypeSelectProps {
|
4
|
-
id: string;
|
5
4
|
repeatType: RecurrenceType;
|
5
|
+
showInheritValue?: boolean;
|
6
6
|
startDate?: Date | null;
|
7
7
|
onChange: (repeatType: string) => void;
|
8
8
|
allowHourlyRecurrence?: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RepeatTypeSelect.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/RepeatTypeSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"RepeatTypeSelect.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/RepeatTypeSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAiG5C,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,cAAc,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAoD7D,CAAC"}
|
@@ -4,43 +4,65 @@ import { useIntl } from "react-intl";
|
|
4
4
|
import { invariant } from "ts-invariant";
|
5
5
|
import { Dropdown, DropdownList, DropdownButton } from "../Dropdown/index.js";
|
6
6
|
import { SingleSelectListItem } from "../List/index.js";
|
7
|
-
import { DEFAULT_DROPDOWN_ALIGN_POINTS, DEFAULT_DROPDOWN_WIDTH, DEFAULT_DROPDOWN_ZINDEX, RECURRENCE_TYPES,
|
7
|
+
import { DEFAULT_DROPDOWN_ALIGN_POINTS, DEFAULT_DROPDOWN_WIDTH, DEFAULT_DROPDOWN_ZINDEX, RECURRENCE_TYPES, } from "./constants.js";
|
8
8
|
import { getWeekNumber, getIntlDayName, isLastOccurrenceOfWeekdayInMonth } from "./utils.js";
|
9
9
|
import { messages } from "./locales.js";
|
10
10
|
const getLocalizationKey = (id) => {
|
11
11
|
switch (id) {
|
12
12
|
case RECURRENCE_TYPES.HOURLY:
|
13
|
-
return
|
13
|
+
return {
|
14
|
+
title: messages.recurrence_hourly,
|
15
|
+
};
|
14
16
|
case RECURRENCE_TYPES.DAILY:
|
15
|
-
return
|
17
|
+
return {
|
18
|
+
title: messages.recurrence_daily,
|
19
|
+
};
|
16
20
|
case RECURRENCE_TYPES.WEEKLY:
|
17
|
-
return
|
21
|
+
return {
|
22
|
+
title: messages.recurrence_weekly,
|
23
|
+
};
|
18
24
|
case RECURRENCE_TYPES.MONTHLY:
|
19
|
-
return
|
25
|
+
return {
|
26
|
+
title: messages.recurrence_monthly,
|
27
|
+
};
|
20
28
|
case RECURRENCE_TYPES.CRON:
|
21
|
-
return
|
29
|
+
return {
|
30
|
+
title: messages.recurrence_cron,
|
31
|
+
};
|
32
|
+
case RECURRENCE_TYPES.INHERIT:
|
33
|
+
return {
|
34
|
+
title: messages.recurrence_inherit,
|
35
|
+
info: messages.recurrence_inherit_info,
|
36
|
+
};
|
22
37
|
default:
|
23
38
|
throw new Error("Invariant: Unexpected localization key.");
|
24
39
|
}
|
25
40
|
};
|
26
|
-
const getRepeatItems = (intl, startDate, allowHourlyRecurrence) => {
|
41
|
+
const getRepeatItems = (intl, startDate, allowHourlyRecurrence, showInheritValue) => {
|
27
42
|
const isLastOccurrenceOfWeekDay = isLastOccurrenceOfWeekdayInMonth(startDate);
|
28
|
-
const recurrenceTypes =
|
29
|
-
|
30
|
-
|
31
|
-
|
43
|
+
const recurrenceTypes = [
|
44
|
+
...(showInheritValue ? [RECURRENCE_TYPES.INHERIT] : []),
|
45
|
+
...(allowHourlyRecurrence ? [RECURRENCE_TYPES.HOURLY] : []),
|
46
|
+
RECURRENCE_TYPES.DAILY,
|
47
|
+
RECURRENCE_TYPES.WEEKLY,
|
48
|
+
RECURRENCE_TYPES.MONTHLY,
|
49
|
+
RECURRENCE_TYPES.CRON,
|
50
|
+
];
|
51
|
+
return recurrenceTypes.map((id) => {
|
52
|
+
const { title, info } = getLocalizationKey(id);
|
53
|
+
if (id === RECURRENCE_TYPES.MONTHLY && !startDate) {
|
32
54
|
return {
|
33
55
|
id,
|
34
56
|
title: intl.formatMessage(messages.recurrence_monthly_first),
|
35
57
|
};
|
36
58
|
}
|
37
|
-
if (id ===
|
59
|
+
if (id === RECURRENCE_TYPES.WEEKLY && !startDate) {
|
38
60
|
return {
|
39
61
|
id,
|
40
62
|
title: intl.formatMessage(messages.recurrence_weekly_first),
|
41
63
|
};
|
42
64
|
}
|
43
|
-
if (id ===
|
65
|
+
if (id === RECURRENCE_TYPES.MONTHLY && isLastOccurrenceOfWeekDay) {
|
44
66
|
return {
|
45
67
|
id,
|
46
68
|
title: intl.formatMessage(messages.recurrence_monthly_last, {
|
@@ -50,23 +72,24 @@ const getRepeatItems = (intl, startDate, allowHourlyRecurrence) => {
|
|
50
72
|
}
|
51
73
|
return {
|
52
74
|
id,
|
53
|
-
title: intl.formatMessage(
|
75
|
+
title: intl.formatMessage(title, {
|
54
76
|
day: getIntlDayName(intl, startDate),
|
55
77
|
week: getWeekNumber(startDate),
|
56
78
|
}),
|
79
|
+
info: info ? intl.formatMessage(info) : undefined,
|
57
80
|
};
|
58
81
|
});
|
59
82
|
};
|
60
83
|
export const RepeatTypeSelect = (props) => {
|
61
|
-
const {
|
84
|
+
const { onChange, repeatType, startDate = null, allowHourlyRecurrence, showInheritValue, onRepeatDropdownOpen, } = props;
|
62
85
|
const intl = useIntl();
|
63
|
-
const repeatItems = getRepeatItems(intl, startDate, allowHourlyRecurrence);
|
86
|
+
const repeatItems = getRepeatItems(intl, startDate, allowHourlyRecurrence, showInheritValue);
|
64
87
|
const repeatTypeItem = repeatItems.find((item) => item.id === repeatType);
|
65
88
|
invariant(repeatTypeItem, "Inconsistent state in RepeatTypeSelect");
|
66
|
-
return (React.createElement(Dropdown, { alignPoints: DEFAULT_DROPDOWN_ALIGN_POINTS, className: "gd-recurrence-form-type s-recurrence-form-type", renderButton: ({ toggleDropdown, isOpen, dropdownId }) => (React.createElement(DropdownButton, {
|
89
|
+
return (React.createElement(Dropdown, { alignPoints: DEFAULT_DROPDOWN_ALIGN_POINTS, className: "gd-recurrence-form-type s-recurrence-form-type", renderButton: ({ toggleDropdown, isOpen, dropdownId }) => (React.createElement(DropdownButton, { value: repeatTypeItem.title, onClick: () => {
|
67
90
|
!isOpen && onRepeatDropdownOpen?.();
|
68
91
|
toggleDropdown();
|
69
|
-
}, dropdownId: dropdownId, isOpen: isOpen })), renderBody: ({ closeDropdown, isMobile }) => (React.createElement(DropdownList, { width: DEFAULT_DROPDOWN_WIDTH, items: repeatItems, isMobile: isMobile, renderItem: ({ item }) => (React.createElement(SingleSelectListItem, { title: item.title, onClick: () => {
|
92
|
+
}, dropdownId: dropdownId, isOpen: isOpen })), renderBody: ({ closeDropdown, isMobile }) => (React.createElement(DropdownList, { width: DEFAULT_DROPDOWN_WIDTH, items: repeatItems, isMobile: isMobile, renderItem: ({ item }) => (React.createElement(SingleSelectListItem, { title: item.title, info: item.info, onClick: () => {
|
70
93
|
onChange(item.id);
|
71
94
|
closeDropdown();
|
72
95
|
}, isSelected: repeatTypeItem.id === item.id })) })), overlayPositionType: "sameAsTarget", overlayZIndex: DEFAULT_DROPDOWN_ZINDEX }));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RepeatTypeSelect.js","sourceRoot":"","sources":["../../src/RecurrenceForm/RepeatTypeSelect.tsx"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAgC,OAAO,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,SA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AAC,cAAc,EAAE,wCAAwC,CAAC,CAAC;IAEpE,OAAO,CACH,oBAAC,QAAQ,IACL,WAAW,EAAE,6BAA6B,EAC1C,SAAS,EAAC,gDAAgD,EAC1D,YAAY,EAAE,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CACtD,oBAAC,cAAc,IACX,KAAK,EAAE,cAAc,CAAC,KAAK,EAC3B,OAAO,EAAE,GAAG,EAAE;gBACV,CAAC,MAAM,IAAI,oBAAoB,EAAE,EAAE,CAAC;gBACpC,cAAc,EAAE,CAAC;YACrB,CAAC,EACD,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,GAChB,CACL,EACD,UAAU,EAAE,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CACzC,oBAAC,YAAY,IACT,KAAK,EAAE,sBAAsB,EAC7B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACtB,oBAAC,oBAAoB,IACjB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,GAAG,EAAE;oBACV,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBAClB,aAAa,EAAE,CAAC;gBACpB,CAAC,EACD,UAAU,EAAE,cAAc,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,GAC3C,CACL,GACH,CACL,EACD,mBAAmB,EAAC,cAAc,EAClC,aAAa,EAAE,uBAAuB,GACxC,CACL,CAAC;AACN,CAAC,CAAC"}
|
@@ -14,16 +14,11 @@ export declare const DEFAULT_DROPDOWN_WIDTH = 199;
|
|
14
14
|
* @internal
|
15
15
|
*/
|
16
16
|
export declare const RECURRENCE_TYPES: {
|
17
|
+
INHERIT: string;
|
17
18
|
HOURLY: string;
|
18
19
|
DAILY: string;
|
19
20
|
WEEKLY: string;
|
20
21
|
MONTHLY: string;
|
21
22
|
CRON: string;
|
22
23
|
};
|
23
|
-
export declare const RECURRENCE_TYPES_WITHOUT_HOURS: {
|
24
|
-
DAILY: string;
|
25
|
-
WEEKLY: string;
|
26
|
-
MONTHLY: string;
|
27
|
-
CRON: string;
|
28
|
-
};
|
29
24
|
//# sourceMappingURL=constants.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,eAAO,MAAM,cAAc,UAAU,CAAC;AACtC,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAChD,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C,eAAO,MAAM,6BAA6B;;GAOzC,CAAC;AACF,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,gBAAgB
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,eAAO,MAAM,cAAc,UAAU,CAAC;AACtC,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAChD,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAE3C,eAAO,MAAM,6BAA6B;;GAOzC,CAAC;AACF,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;CAO5B,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// (C) 2024 GoodData Corporation
|
1
|
+
// (C) 2024-2025 GoodData Corporation
|
2
2
|
export const TIME_ANCHOR = 60; // 1 hour granularity for time picker
|
3
3
|
export const MAX_VISIBLE_TIME_ITEMS_COUNT = 5;
|
4
4
|
export const DEFAULT_LOCALE = "en-US";
|
@@ -20,16 +20,11 @@ export const DEFAULT_DROPDOWN_WIDTH = 199;
|
|
20
20
|
* @internal
|
21
21
|
*/
|
22
22
|
export const RECURRENCE_TYPES = {
|
23
|
+
INHERIT: "inherit",
|
23
24
|
HOURLY: "hourly",
|
24
25
|
DAILY: "daily",
|
25
26
|
WEEKLY: "weekly",
|
26
27
|
MONTHLY: "monthly",
|
27
28
|
CRON: "cron",
|
28
29
|
};
|
29
|
-
export const RECURRENCE_TYPES_WITHOUT_HOURS = {
|
30
|
-
DAILY: "daily",
|
31
|
-
WEEKLY: "weekly",
|
32
|
-
MONTHLY: "monthly",
|
33
|
-
CRON: "cron",
|
34
|
-
};
|
35
30
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/RecurrenceForm/constants.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/RecurrenceForm/constants.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC,CAAC,qCAAqC;AACpE,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAE9C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AACtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAC3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE3C,MAAM,CAAC,MAAM,6BAA6B,GAAG;IACzC;QACI,KAAK,EAAE,OAAO;KACjB;IACD;QACI,KAAK,EAAE,OAAO;KACjB;CACJ,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAC5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC5B,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;CACf,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/locales.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,YAAY,CAAC;AAE/D,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/locales.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,YAAY,CAAC;AAE/D,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAoBrD,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// (C) 2024 GoodData Corporation
|
1
|
+
// (C) 2024-2025 GoodData Corporation
|
2
2
|
import { defineMessages } from "react-intl";
|
3
3
|
export const messages = defineMessages({
|
4
4
|
starts: { id: "recurrence.starts" },
|
@@ -11,6 +11,8 @@ export const messages = defineMessages({
|
|
11
11
|
recurrence_weekly: { id: "recurrence.types.weekly" },
|
12
12
|
recurrence_weekly_first: { id: "recurrence.types.weekly.first" },
|
13
13
|
recurrence_cron: { id: "recurrence.types.cron" },
|
14
|
+
recurrence_inherit: { id: "recurrence.types.inherit" },
|
15
|
+
recurrence_inherit_info: { id: "recurrence.types.inherit.info" },
|
14
16
|
description_recurrence_hourly: { id: "recurrence.description.hourly" },
|
15
17
|
description_recurrence_daily: { id: "recurrence.description.daily" },
|
16
18
|
description_recurrence_weekly_first: { id: "recurrence.description.weekly_first" },
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../../src/RecurrenceForm/locales.ts"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../../src/RecurrenceForm/locales.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,EAAqB,cAAc,EAAE,MAAM,YAAY,CAAC;AAE/D,MAAM,CAAC,MAAM,QAAQ,GAAsC,cAAc,CAAC;IACtE,MAAM,EAAE,EAAE,EAAE,EAAE,mBAAmB,EAAE;IACnC,OAAO,EAAE,EAAE,EAAE,EAAE,oBAAoB,EAAE;IACrC,iBAAiB,EAAE,EAAE,EAAE,EAAE,yBAAyB,EAAE;IACpD,gBAAgB,EAAE,EAAE,EAAE,EAAE,wBAAwB,EAAE;IAClD,kBAAkB,EAAE,EAAE,EAAE,EAAE,0BAA0B,EAAE;IACtD,uBAAuB,EAAE,EAAE,EAAE,EAAE,+BAA+B,EAAE;IAChE,wBAAwB,EAAE,EAAE,EAAE,EAAE,gCAAgC,EAAE;IAClE,iBAAiB,EAAE,EAAE,EAAE,EAAE,yBAAyB,EAAE;IACpD,uBAAuB,EAAE,EAAE,EAAE,EAAE,+BAA+B,EAAE;IAChE,eAAe,EAAE,EAAE,EAAE,EAAE,uBAAuB,EAAE;IAChD,kBAAkB,EAAE,EAAE,EAAE,EAAE,0BAA0B,EAAE;IACtD,uBAAuB,EAAE,EAAE,EAAE,EAAE,+BAA+B,EAAE;IAEhE,6BAA6B,EAAE,EAAE,EAAE,EAAE,+BAA+B,EAAE;IACtE,4BAA4B,EAAE,EAAE,EAAE,EAAE,8BAA8B,EAAE;IACpE,mCAAmC,EAAE,EAAE,EAAE,EAAE,qCAAqC,EAAE;IAClF,6BAA6B,EAAE,EAAE,EAAE,EAAE,+BAA+B,EAAE;IACtE,oCAAoC,EAAE,EAAE,EAAE,EAAE,sCAAsC,EAAE;IACpF,8BAA8B,EAAE,EAAE,EAAE,EAAE,gCAAgC,EAAE;CAC3E,CAAC,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export declare enum RecurrenceFormCronErrorTypes {
|
2
|
+
EMPTY = "EMPTY",
|
3
|
+
WRONG_FORMAT = "WRONG_FORMAT",
|
4
|
+
FREQUENCY_TOO_HIGH = "FREQUENCY_TOO_HIGH"
|
5
|
+
}
|
6
|
+
interface IUseCronValidationProps {
|
7
|
+
allowHourlyRecurrence: boolean;
|
8
|
+
onCronValueChange: (cronValue: string, isValid: boolean) => void;
|
9
|
+
}
|
10
|
+
interface UseCronValidationResult {
|
11
|
+
cronError: string | null;
|
12
|
+
handleOnBlur: (value: string) => void;
|
13
|
+
handleChange: (expression: string) => void;
|
14
|
+
}
|
15
|
+
export declare const useCronValidation: (props: IUseCronValidationProps) => UseCronValidationResult;
|
16
|
+
export {};
|
17
|
+
//# sourceMappingURL=useCronValidation.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useCronValidation.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/useCronValidation.ts"],"names":[],"mappings":"AAOA,oBAAY,4BAA4B;IACpC,KAAK,UAAU;IACf,YAAY,iBAAiB;IAC7B,kBAAkB,uBAAuB;CAC5C;AAQD,UAAU,uBAAuB;IAC7B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACpE;AAED,UAAU,uBAAuB;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAeD,eAAO,MAAM,iBAAiB,UAAW,uBAAuB,KAAG,uBA2ElE,CAAC"}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
// (C) 2024-2025 GoodData Corporation
|
2
|
+
import { useCallback, useState } from "react";
|
3
|
+
import cronParser from "cron-parser";
|
4
|
+
import { isCronExpressionValid } from "./utils.js";
|
5
|
+
import { defineMessages } from "react-intl";
|
6
|
+
export var RecurrenceFormCronErrorTypes;
|
7
|
+
(function (RecurrenceFormCronErrorTypes) {
|
8
|
+
RecurrenceFormCronErrorTypes["EMPTY"] = "EMPTY";
|
9
|
+
RecurrenceFormCronErrorTypes["WRONG_FORMAT"] = "WRONG_FORMAT";
|
10
|
+
RecurrenceFormCronErrorTypes["FREQUENCY_TOO_HIGH"] = "FREQUENCY_TOO_HIGH";
|
11
|
+
})(RecurrenceFormCronErrorTypes || (RecurrenceFormCronErrorTypes = {}));
|
12
|
+
const errorMessages = defineMessages({
|
13
|
+
empty: { id: "recurrence.error.empty" },
|
14
|
+
wrongFormat: { id: "recurrence.error.wrongFormat" },
|
15
|
+
frequencyTooHigh: { id: "recurrence.error.too_often" },
|
16
|
+
});
|
17
|
+
const getErrorMessage = (errorType) => {
|
18
|
+
switch (errorType) {
|
19
|
+
case RecurrenceFormCronErrorTypes.EMPTY:
|
20
|
+
return errorMessages.empty.id;
|
21
|
+
case RecurrenceFormCronErrorTypes.WRONG_FORMAT:
|
22
|
+
return errorMessages.wrongFormat.id;
|
23
|
+
case RecurrenceFormCronErrorTypes.FREQUENCY_TOO_HIGH:
|
24
|
+
return errorMessages.frequencyTooHigh.id;
|
25
|
+
default:
|
26
|
+
return "";
|
27
|
+
}
|
28
|
+
};
|
29
|
+
export const useCronValidation = (props) => {
|
30
|
+
const { allowHourlyRecurrence, onCronValueChange } = props;
|
31
|
+
const [cronError, setCronError] = useState(null);
|
32
|
+
const parseCron = useCallback((expression) => {
|
33
|
+
try {
|
34
|
+
cronParser.CronExpressionParser.parse(expression);
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
catch {
|
38
|
+
return false;
|
39
|
+
}
|
40
|
+
}, []);
|
41
|
+
const validate = useCallback((expression) => {
|
42
|
+
const trimmedCronExpression = expression.trim();
|
43
|
+
const parts = expression.split(/\s+/).filter(Boolean);
|
44
|
+
if (trimmedCronExpression.length === 0) {
|
45
|
+
return RecurrenceFormCronErrorTypes.EMPTY;
|
46
|
+
}
|
47
|
+
if (parts.length !== 6) {
|
48
|
+
return RecurrenceFormCronErrorTypes.WRONG_FORMAT;
|
49
|
+
}
|
50
|
+
const isValidCron = parseCron(expression);
|
51
|
+
if (!isValidCron) {
|
52
|
+
return RecurrenceFormCronErrorTypes.WRONG_FORMAT;
|
53
|
+
}
|
54
|
+
const isValid = isCronExpressionValid(expression, allowHourlyRecurrence);
|
55
|
+
if (!isValid) {
|
56
|
+
return RecurrenceFormCronErrorTypes.FREQUENCY_TOO_HIGH;
|
57
|
+
}
|
58
|
+
return null;
|
59
|
+
}, [allowHourlyRecurrence, parseCron]);
|
60
|
+
const handleValidation = useCallback((expression) => {
|
61
|
+
const validationResult = validate(expression);
|
62
|
+
setCronError(validationResult ? getErrorMessage(validationResult) : null);
|
63
|
+
return !validationResult;
|
64
|
+
}, [validate]);
|
65
|
+
const handleChange = useCallback((expression) => {
|
66
|
+
const validationResult = validate(expression);
|
67
|
+
if (cronError) {
|
68
|
+
setCronError(validationResult ? getErrorMessage(validationResult) : null);
|
69
|
+
}
|
70
|
+
onCronValueChange(expression, !validationResult);
|
71
|
+
}, [cronError, validate, onCronValueChange]);
|
72
|
+
const handleOnBlur = useCallback((value) => {
|
73
|
+
handleValidation(value);
|
74
|
+
}, [handleValidation]);
|
75
|
+
return {
|
76
|
+
cronError,
|
77
|
+
handleOnBlur,
|
78
|
+
handleChange,
|
79
|
+
};
|
80
|
+
};
|
81
|
+
//# sourceMappingURL=useCronValidation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"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AAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC1E,OAAO,CAAC,gBAAgB,CAAC;IAC7B,CAAC,EACD,CAAC,QAAQ,CAAC,CACb,CAAC;IAEF,MAAM,YAAY,GAAG,WAAW,CAC5B,CAAC,UAAkB,EAAE,EAAE;QACnB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;QAE9C,IAAI,SAAS,EAAE,CAAC;YACZ,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC9E,CAAC;QAED,iBAAiB,CAAC,UAAU,EAAE,CAAC,gBAAgB,CAAC,CAAC;IACrD,CAAC,EACD,CAAC,SAAS,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAC3C,CAAC;IAEF,MAAM,YAAY,GAAG,WAAW,CAC5B,CAAC,KAAa,EAAE,EAAE;QACd,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,EACD,CAAC,gBAAgB,CAAC,CACrB,CAAC;IAEF,OAAO;QACH,SAAS;QACT,YAAY;QACZ,YAAY;KACf,CAAC;AACN,CAAC,CAAC"}
|
@@ -12,9 +12,10 @@ export declare const constructCronExpression: (date: Date | null, recurrenceType
|
|
12
12
|
* @param date - date to compare with cron expression
|
13
13
|
* @param cronExpression - cron expression to transform
|
14
14
|
* @param allowHourlyRecurrence - whether hourly recurrence is allowed
|
15
|
+
* @param allowInheritValue - whether inherit value is allowed
|
15
16
|
* @param weekStart - Week start day
|
16
17
|
*/
|
17
|
-
export declare const transformCronExpressionToRecurrenceType: (date: Date | null, cronExpression: string, allowHourlyRecurrence: boolean, weekStart: WeekStart) => RecurrenceType;
|
18
|
+
export declare const transformCronExpressionToRecurrenceType: (date: Date | null, cronExpression: string | undefined, allowHourlyRecurrence: boolean, allowInheritValue: boolean, weekStart: WeekStart) => RecurrenceType;
|
18
19
|
export declare const transformRecurrenceTypeToDescription: (intl: IntlShape, recurrenceType: RecurrenceType, startDate: Date | null, weekStart: WeekStart) => string;
|
19
|
-
export declare const isCronExpressionValid: (expression: string, allowHourlyRecurrence: boolean) => boolean;
|
20
|
+
export declare const isCronExpressionValid: (expression: string | undefined, allowHourlyRecurrence: boolean) => boolean;
|
20
21
|
//# sourceMappingURL=utils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM5C,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAKrF;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAKvD;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,CAgB3E;AAaD,eAAO,MAAM,uBAAuB,SAC1B,IAAI,GAAG,IAAI,kBACD,cAAc,kBACd,MAAM,aACX,SAAS,
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/RecurrenceForm/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAM5C,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAKrF;AA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