@leapdevuk/component-toolbox 0.0.127 → 0.0.128
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/dist/CHANGELOG.md +6 -0
- package/dist/components/datepicker/index.d.ts +4 -4
- package/dist/components/datepicker/utils.d.ts +198 -105
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { default as LCTDatePicker } from './DatePicker';
|
|
2
|
+
export { dbDateOnlyFormat as lctDbDateOnlyFormat } from './utils';
|
|
3
|
+
export { formatAsDBDate as lctFormatAsDBDate } from './utils';
|
|
2
4
|
export { formatDate as lctFormatDate } from './utils';
|
|
3
|
-
export {
|
|
5
|
+
export { formatDateTime as lctFormatDateTime } from './utils';
|
|
4
6
|
export { formatReportDate as lctFormatReportDate } from './utils';
|
|
7
|
+
export { getFormattedLocalDateTime as lctGetFormattedLocalDateTime } from './utils';
|
|
5
8
|
export { getLocale as lctGetLocale } from './utils';
|
|
6
9
|
export { parseDate as lctParseDate } from './utils';
|
|
7
10
|
export { utcFormat as lctUTCFormat } from './utils';
|
|
8
|
-
export { dbDateOnlyFormat as lctDbDateOnlyFormat } from './utils';
|
|
9
|
-
export { formatAsDBDate as lctFormatAsDBDate } from './utils';
|
|
10
|
-
export { getFormattedLocalDateTime as lctGetFormattedLocalDateTime } from './utils';
|
|
@@ -1,134 +1,204 @@
|
|
|
1
1
|
import { Api, LeapContext } from '@leapdev/leap-host';
|
|
2
2
|
import { Locale } from 'date-fns';
|
|
3
|
+
/**
|
|
4
|
+
* This constant defines the date format used for database storage.
|
|
5
|
+
* It is used to ensure consistent date formatting across the application,
|
|
6
|
+
* especially when interacting with databases or APIs that require a specific date format.
|
|
7
|
+
*/
|
|
8
|
+
export declare const dbDateOnlyFormat = "yyyy-MM-dd";
|
|
9
|
+
/**
|
|
10
|
+
* This constant defines the default date format used in the application.
|
|
11
|
+
* It is used for displaying dates in the user interface and for formatting dates in various components.
|
|
12
|
+
*/
|
|
3
13
|
export declare const defaultDateFormat = "dd/MM/yyyy";
|
|
14
|
+
/**
|
|
15
|
+
* This constant defines the default date and time format used in the application.
|
|
16
|
+
* It is used for displaying both date and time in the user interface and for formatting datetime values
|
|
17
|
+
*/
|
|
4
18
|
export declare const defaultDateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
|
19
|
+
/**
|
|
20
|
+
* This constant defines the minimum date that can be used in the application.
|
|
21
|
+
* It is set to January 1, 1900, and is used to ensure that date inputs do not go below this value.
|
|
22
|
+
* It is useful for setting a minimum date in date pickers or other date-related components.
|
|
23
|
+
*/
|
|
5
24
|
export declare const minDateAsObject: Date;
|
|
25
|
+
/**
|
|
26
|
+
* This constant defines the timezone used in the application.
|
|
27
|
+
* It is derived from the user's system settings and is used for formatting dates and times in the user's local timezone.
|
|
28
|
+
* It ensures that date and time values are displayed correctly based on the user's timezone.
|
|
29
|
+
*/
|
|
6
30
|
export declare const timezone: string;
|
|
31
|
+
/**
|
|
32
|
+
* This constant defines the UTC format used for date and time values in the application.
|
|
33
|
+
* It is used to ensure that date and time values are stored and displayed in a consistent UTC format.
|
|
34
|
+
*/
|
|
7
35
|
export declare const utcFormat = "yyyy-MM-dd HH:mm:ss";
|
|
8
|
-
export declare const dbDateOnlyFormat = "yyyy-MM-dd";
|
|
9
36
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
37
|
+
* This function returns the minimum date as a string formatted in the default date format.
|
|
38
|
+
* It is useful for setting a minimum date in date pickers or other date-related components.
|
|
39
|
+
* @returns (string): The minimum date formatted as a string in the default date format.
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
15
42
|
* const minDate = getMinDate(); // Returns "01/01/1900"
|
|
16
|
-
*
|
|
43
|
+
* ```
|
|
17
44
|
*/
|
|
18
45
|
export declare const minDate: string;
|
|
46
|
+
/**
|
|
47
|
+
* This function returns a date that is one week from today, formatted as a string.
|
|
48
|
+
* It is useful for scenarios where you need to calculate a date one week in the future,
|
|
49
|
+
* such as setting deadlines or reminders.
|
|
50
|
+
* @returns (string): A formatted date string representing one week from today.
|
|
51
|
+
* It can be used in various contexts, such as displaying future dates in a user interface or calculating due dates.
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const oneWeekFromToday = getOneWeekFromToday(); // Returns "dd/MM/yyyy" format of the date one week from today
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
19
57
|
export declare const oneWeek: string;
|
|
58
|
+
/**
|
|
59
|
+
* This function returns today's date formatted as a string in the default date format.
|
|
60
|
+
* It is useful for displaying the current date in a user interface or for date calculations.
|
|
61
|
+
* @returns (string): Today's date formatted as a string in the default date format.
|
|
62
|
+
* It can be used in various contexts, such as displaying the current date in a user interface or calculating date differences.
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const todayDate = getTodayDate(); // Returns "dd/MM/yyyy" format of today's date
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
20
68
|
export declare const today: string;
|
|
69
|
+
/**
|
|
70
|
+
* This function returns a date that is one day from today, formatted as a string.
|
|
71
|
+
* It is useful for scenarios where you need to calculate a date one day in the future,
|
|
72
|
+
* such as setting deadlines or reminders.
|
|
73
|
+
* @returns (string): A formatted date string representing tomorrow's date.
|
|
74
|
+
* It can be used in various contexts, such as displaying future dates in a user interface or calculating due dates.
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const tomorrowDate = getTomorrowDate(); // Returns "dd/MM/yyyy" format of the date tomorrow
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
21
80
|
export declare const tomorrow: string;
|
|
81
|
+
/**
|
|
82
|
+
* This function returns a date that is two weeks from today, formatted as a string.
|
|
83
|
+
* It is useful for scenarios where you need to calculate a date two weeks in the future,
|
|
84
|
+
* such as setting deadlines or reminders.
|
|
85
|
+
* @returns (string): A formatted date string representing two weeks from today.
|
|
86
|
+
* It can be used in various contexts, such as displaying future dates in a user interface or calculating due dates.
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const twoWeeksFromToday = getTwoWeeksFromToday(); // Returns "dd/MM/yyyy" format of the date two weeks from today
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
22
92
|
export declare const twoWeeks: string;
|
|
23
93
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
94
|
+
* This function returns the current date formatted as a string based on the provided format.
|
|
95
|
+
* @param formatString (optional) The format string to use for the date. Defaults to "dd/MM/yyyy".
|
|
96
|
+
* It is useful for getting the current date in a specific format, such as "dd/MM/yyyy" or "MM/dd/yyyy".
|
|
97
|
+
* If no format string is provided, it defaults to "dd/MM/yyyy".
|
|
98
|
+
* @returns (string): The current date formatted as a string.
|
|
99
|
+
* It can be used in various contexts, such as displaying the current date in a user interface or storing it in a database.
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
32
102
|
* const formattedDate = defaultDate(); // Returns the current date in "dd/MM/yyyy" format
|
|
33
103
|
* const formattedDateUS = defaultDate("MM/dd/yyyy"); // Returns the current date in "MM/dd/yyyy" format
|
|
34
|
-
*
|
|
104
|
+
* ```
|
|
35
105
|
*/
|
|
36
106
|
export declare const defaultDate: (formatString?: string) => string;
|
|
37
107
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
108
|
+
* This function formats a date based on the provided parameters.
|
|
109
|
+
* It can format the date to the start or end of the day, handle UTC dates,
|
|
110
|
+
* and format it as a date-only string.
|
|
111
|
+
* It is useful for displaying dates in a specific format,
|
|
112
|
+
* such as in a date picker or when saving dates to a database.
|
|
113
|
+
* @param date (Date | null | undefined): The date to format. If null or undefined, it returns null.
|
|
114
|
+
* @param startOfDate (boolean): If true, formats the date to the start of the day.
|
|
115
|
+
* @param endOfDate (boolean): If true, formats the date to the end of the day.
|
|
116
|
+
* @param isUTC (boolean): If true, formats the date in UTC format.
|
|
117
|
+
* @param dateOnly (boolean): If true, formats the date as a date-only string (e.g., "yyyy-MM-dd").
|
|
118
|
+
* This is useful for scenarios where you need to display or store only the date part without the time.
|
|
119
|
+
* It can be used in various contexts, such as displaying dates in a user interface or saving them to a database.
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
52
122
|
* const formattedDate = formatDate(new Date(), true, false, false, true); // Formats the current date to the start of the day as a date-only string
|
|
53
123
|
* const formattedUTCDate = formatDate(new Date(), false, false, true); // Formats the current date in UTC format
|
|
54
124
|
* const formattedEndDate = formatDate(new Date(), false, true); // Formats the current date to the end of the day
|
|
55
|
-
*
|
|
56
|
-
*
|
|
125
|
+
* ```
|
|
126
|
+
* @returns (string | null): A formatted date string based on the provided parameters. If the input date is null or undefined, it returns null.
|
|
57
127
|
*/
|
|
58
128
|
export declare const formatDate: (date?: Date | null, startOfDate?: boolean, endOfDate?: boolean, isUTC?: boolean, dateOnly?: boolean) => string | null;
|
|
59
129
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
130
|
+
* This function parses a date string into a Date object based on the provided format.
|
|
131
|
+
* It splits the date string into parts (day, month, year) and constructs a Date object.
|
|
132
|
+
* If the date string is invalid or cannot be parsed, it returns null.
|
|
133
|
+
* It also handles two-digit years by converting them to four-digit years.
|
|
134
|
+
* @param date (any): The date string to parse. It can be in various formats (e.g., "dd/MM/yyyy", "MM/dd/yyyy").
|
|
135
|
+
* @param formatString (string): The format string to use for parsing the date.
|
|
136
|
+
* @param localDateformat (string): The local date format to use for parsing. It should match the format of the input date string.
|
|
137
|
+
* @param parseKeyboardVal (boolean): Whether to parse the date from a keyboard input. Defaults to false.
|
|
138
|
+
* @returns (string | null): Returns a formatted date string if parsing is successful, or null if the input is invalid.
|
|
139
|
+
* This function is useful for converting user input or string representations of dates into a Date object.
|
|
140
|
+
* It can handle various date formats and ensures that the resulting Date object is valid.
|
|
141
|
+
* If the input date string is invalid or cannot be parsed, it returns null.
|
|
142
|
+
* It also includes logic to handle two-digit years by converting them to four-digit years.
|
|
143
|
+
* @example
|
|
144
|
+
* ```typescript
|
|
75
145
|
* const parsedDate = parseDate("25/12/2023", "dd/MM/yyyy", "dd/MM/yyyy");
|
|
76
146
|
* console.log(parsedDate); // Returns "2023-12-25" in the "yyyy-MM-dd" format
|
|
77
147
|
* const parsedDateUS = parseDate("12/25/23", "MM/dd/yyyy", "MM/dd/yyyy");
|
|
78
148
|
* console.log(parsedDateUS); // Returns "2023-12-25" in the "yyyy-MM-dd" format
|
|
79
149
|
* const parsedInvalidDate = parseDate("31/02/2023", "dd/MM/yyyy", "dd/MM/yyyy");
|
|
80
150
|
* console.log(parsedInvalidDate); // Returns null, as February 31st is invalid
|
|
81
|
-
*
|
|
151
|
+
* ```
|
|
82
152
|
*/
|
|
83
153
|
export declare const parseDate: (date: any, formatString: string | undefined, localDateformat: string, parseKeyboardVal?: boolean) => string | null;
|
|
84
154
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
155
|
+
* This function returns a locale object based on the provided LeapContext.
|
|
156
|
+
* It checks the hostInfo.region and returns the corresponding locale with weekStartsOn set to 1.
|
|
157
|
+
* If the region is not recognized, it returns undefined.
|
|
158
|
+
* @param leapContext (LeapContext | undefined): The LeapContext object containing hostInfo with region information.
|
|
159
|
+
* @returns The function supports UK, US, AU (including NZ), and CA regions. If the region is not recognized, it returns undefined.
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
92
162
|
* const locale = getLocale(leapContext); // Returns the appropriate locale based on the region
|
|
93
163
|
* const localeUS = getLocale({ hostInfo: { region: "us" } }); // Returns enUS locale
|
|
94
164
|
* const localeUK = getLocale({ hostInfo: { region: "uk" } }); // Returns enGB locale
|
|
95
165
|
* const localeAU = getLocale({ hostInfo: { region: "au" } }); // Returns enAU locale
|
|
96
166
|
* const localeCA = getLocale({ hostInfo: { region: "ca" } }); // Returns enGB locale
|
|
97
|
-
*
|
|
167
|
+
* ```
|
|
98
168
|
*/
|
|
99
169
|
export declare const getLocale: (leapContext?: LeapContext) => Locale | undefined;
|
|
100
170
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
171
|
+
* This function formats a date or datetime value into a string based on the provided locale.
|
|
172
|
+
* It supports both date-only and datetime formats, and can handle UTC dates.
|
|
173
|
+
* @param value (string | Date | undefined): The date or datetime value to format.
|
|
174
|
+
* @param locale (Locale | undefined): The locale to use for formatting. If undefined, it will not format the date.
|
|
175
|
+
* @param isUtc (boolean): Whether the date is in UTC format. Defaults to true.
|
|
176
|
+
* @param dateOnly (boolean): Whether to format the value as a date only.
|
|
177
|
+
* @param show24H (boolean): Whether to show the time in 24-hour format. Defaults to false.
|
|
178
|
+
* @returns (string): A formatted date or datetime string. If the input value is invalid or locale is undefined, it returns an empty string.
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
111
181
|
* const formattedDate = lctFormatDateTime(new Date(), enGB, true, false, true); // Returns "01/01/2023 14:30"
|
|
112
182
|
* const formattedDateTime = lctFormatDateTime("2023-01-01T14:30:00Z", enUS, true, false, false); // Returns "01/01/2023 02:30 PM"
|
|
113
183
|
* const formattedDateOnly = lctFormatDateTime("2023-01-01", enAU, false, true); // Returns "01/01/2023"
|
|
114
184
|
* const formattedInvalid = lctFormatDateTime(undefined, enGB); // Returns ""
|
|
115
185
|
* ```
|
|
116
186
|
*/
|
|
117
|
-
export declare const
|
|
187
|
+
export declare const formatDateTime: (value?: string | Date, locale?: Locale, isUtc?: boolean, dateOnly?: boolean, show24H?: boolean) => string;
|
|
118
188
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
189
|
+
* This function formats a date string into a report-friendly format based on the provided locale.
|
|
190
|
+
* It handles both ISO date strings and strings in the format "yyyy-MM-dd".
|
|
121
191
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
192
|
+
* @param date (string | null): The date string to format. It can be in ISO format or "yyyy-MM-dd".
|
|
193
|
+
* @param locale (Locale | undefined): The locale to use for formatting. If undefined, it will not format the date.
|
|
194
|
+
* @returns (string): A formatted date string. If the input date is invalid or locale is undefined, it returns an empty string and logs a warning.
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
127
197
|
* const formattedReportDate = formatReportDate("2023-12-25", enGB); // Returns "25-12-2023"
|
|
128
198
|
* const formattedReportDateISO = formatReportDate("2023-12-25T00:00:00Z", enUS); // Returns "12-25-2023"
|
|
129
199
|
* const formattedReportDateInvalid = formatReportDate("31-02-2023", enGB); // Returns "", logs warning
|
|
130
200
|
* const formattedReportDateNull = formatReportDate(null, enGB); // Returns "", logs warning
|
|
131
|
-
*
|
|
201
|
+
* ```
|
|
132
202
|
*/
|
|
133
203
|
export declare const formatReportDate: (date: string | null, locale?: Locale) => string;
|
|
134
204
|
/**
|
|
@@ -136,34 +206,57 @@ export declare const formatReportDate: (date: string | null, locale?: Locale) =>
|
|
|
136
206
|
*/
|
|
137
207
|
export declare const getDateTimeWithOffset: (date: string) => Date;
|
|
138
208
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
209
|
+
* This function checks if a string is null or undefined.
|
|
210
|
+
* It returns true if the string is null, undefined, or an empty string.
|
|
211
|
+
* @param value (string | null | undefined): The string to check.
|
|
212
|
+
* @returns (boolean): Returns true if the string is null, undefined, or empty; otherwise, false.
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
145
215
|
* const isNullOrUndefined = isStringNullOrUndefined(null); // Returns true
|
|
146
216
|
* const isEmptyString = isStringNullOrUndefined(""); // Returns true
|
|
147
217
|
* const isValidString = isStringNullOrUndefined("Hello"); // Returns false
|
|
148
|
-
*
|
|
218
|
+
* ```
|
|
149
219
|
*/
|
|
150
220
|
export declare const isStringNullOrUndefined: (value?: string | null) => boolean;
|
|
151
221
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
222
|
+
* This function formats a date as a string in the "yyyy-MM-dd" format, suitable for database storage.
|
|
223
|
+
* It takes a Date object as input and returns the formatted string.
|
|
224
|
+
* @param date (Date): The date to format.
|
|
225
|
+
* @returns (string): A formatted date string in the "yyyy-MM-dd" format.
|
|
226
|
+
* @example
|
|
227
|
+
* ```typescript
|
|
158
228
|
* const dbFormattedDate = formatAsDBDate(new Date()); // Returns "2023-12-25"
|
|
159
229
|
* const dbFormattedDateInvalid = formatAsDBDate(new Date("Invalid Date")); // Returns "Invalid date"
|
|
160
|
-
*
|
|
230
|
+
* ```
|
|
161
231
|
*/
|
|
162
232
|
export declare const formatAsDBDate: (date: Date) => string;
|
|
233
|
+
/**
|
|
234
|
+
* This function formats a date or datetime value into a string based on the provided locale.
|
|
235
|
+
* It supports both date-only and datetime formats, and can handle UTC dates.
|
|
236
|
+
* It also allows for formatting the start or end of the day.
|
|
237
|
+
* @param value (string | Date | undefined): The date or datetime value to format.
|
|
238
|
+
* @param locale (Locale | undefined): The locale to use for formatting. If undefined, it will not format the date.
|
|
239
|
+
* @param isUtc (boolean): Whether the date is in UTC format. Defaults to true.
|
|
240
|
+
* @param dateOnly (boolean): Whether to format the value as a date only.
|
|
241
|
+
* @param show24H (boolean): Whether to show the time in 24-hour format. Defaults to false.
|
|
242
|
+
* @param formatString (string): The format string to use for formatting the date. If not provided, it defaults to the locale's short date format.
|
|
243
|
+
* @param formatStartOfDay (boolean): If true, formats the date to the start of the day.
|
|
244
|
+
* @param formatEndOfDay (boolean): If true, formats the date to the end of the day.
|
|
245
|
+
* @returns (string): A formatted date or datetime string. If the input value is invalid or locale is undefined, it returns an empty string.
|
|
246
|
+
* @example
|
|
247
|
+
* ```typescript
|
|
248
|
+
* const formattedDate = getFormattedLocalDateTime(new Date(), enGB, true, false, true); // Returns "01/01/2023 14:30"
|
|
249
|
+
* const formattedDateTime = getFormattedLocalDateTime("2023-01-01T14:30:00Z", enUS, true, false, false); // Returns "01/01/2023 02:30 PM"
|
|
250
|
+
* const formattedDateOnly = getFormattedLocalDateTime("2023-01-01", enAU, false, true); // Returns "01/01/2023"
|
|
251
|
+
* const formattedInvalid = getFormattedLocalDateTime(undefined, enGB); // Returns ""
|
|
252
|
+
* const formattedStartOfDay = getFormattedLocalDateTime(new Date(), enGB, true, false, true, undefined, true); // Returns "01/01/2023 00:00"
|
|
253
|
+
* const formattedEndOfDay = getFormattedLocalDateTime(new Date(), enGB, true, false, true, undefined, false, true); // Returns "01/01/2023 23:59"
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
163
256
|
export declare const getFormattedLocalDateTime: (value?: string | Date, locale?: Locale, isUtc?: boolean, dateOnly?: boolean, show24H?: boolean, formatString?: string, formatStartOfDay?: boolean, formatEndOfDay?: boolean) => string;
|
|
164
257
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
258
|
+
* This enum defines the types of buttons available in the dialog.
|
|
259
|
+
* It is used to identify which button was clicked by the user.
|
|
167
260
|
*/
|
|
168
261
|
export declare enum DialogButtonType {
|
|
169
262
|
Confirm = 1,
|
|
@@ -171,19 +264,19 @@ export declare enum DialogButtonType {
|
|
|
171
264
|
Cancel = 3
|
|
172
265
|
}
|
|
173
266
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
267
|
+
* This function shows a 3-button alert dialog using the Leap SDK.
|
|
268
|
+
* It allows the user to confirm, refuse, or cancel an action.
|
|
269
|
+
* It takes a message, button texts, and callbacks for each action.
|
|
270
|
+
* @param message (string): The message to display in the dialog.
|
|
271
|
+
* @param confirmButtonText (string): The text for the confirm button.
|
|
272
|
+
* @param confirmCallback (function): The callback function to execute when the confirm button is clicked.
|
|
273
|
+
* @param refuseButtonText (string): The text for the refuse button. Optional.
|
|
274
|
+
* @param refuseCallback (function): The callback function to execute when the refuse button is clicked. Optional.
|
|
275
|
+
* @param cancelButtonText (string): The text for the cancel button. Optional.
|
|
276
|
+
* @param sdkApi (Api): The Leap SDK API instance to use for showing the dialog.
|
|
277
|
+
* @returns A promise that resolves when the dialog is closed.
|
|
278
|
+
* @example
|
|
279
|
+
* ```typescript
|
|
187
280
|
* show3buttonAlert(
|
|
188
281
|
* "Are you sure you want to proceed?",
|
|
189
282
|
* "Yes",
|
|
@@ -193,6 +286,6 @@ export declare enum DialogButtonType {
|
|
|
193
286
|
* "Cancel",
|
|
194
287
|
* sdkApi
|
|
195
288
|
* );
|
|
196
|
-
*
|
|
289
|
+
* ```
|
|
197
290
|
*/
|
|
198
291
|
export declare const show3buttonAlert: (message: string, confirmButtonText: string, confirmCallback: () => void, refuseButtonText?: string, refuseCallback?: () => void, cancelButtonText?: string, sdkApi?: Api) => Promise<void> | undefined;
|