@descope/web-components-ui 1.114.0 → 1.116.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.
@@ -1,19 +1,19 @@
1
1
  import { formats } from './formats';
2
2
 
3
- export const isValidTimestamp = (val) => !Number.isNaN(Number(val));
3
+ export const isValidEpoch = (val) => !Number.isNaN(Number(val));
4
4
 
5
5
  export const isNumber = (val) => !!String(val || '').trim() && !Number.isNaN(Number(val));
6
6
 
7
- export const getTimestampParts = (timestamp) => {
8
- const date = newDate(timestamp);
7
+ export const getPartsFromEpoch = (epoch) => {
8
+ const date = newDate(epoch);
9
9
  const year = date.getFullYear();
10
10
  const month = date.getMonth() + 1;
11
11
  const day = date.getDate();
12
12
  return [year, month, day];
13
13
  };
14
14
 
15
- export const formatTimestamp = (timestamp, format) => {
16
- const [year, month, day] = getTimestampParts(timestamp);
15
+ export const formatEpoch = (epoch, format) => {
16
+ const [year, month, day] = getPartsFromEpoch(epoch);
17
17
 
18
18
  const parts = {
19
19
  DD: String(day).padStart(2, '0'),
@@ -36,8 +36,8 @@ export const newDate = (date) => {
36
36
  };
37
37
 
38
38
  export const getCurrentTime = () => newDate().getTime();
39
- export const getFullYear = (timestamp) => newDate(timestamp).getFullYear().toString();
40
- export const getMonth = (timestamp) => (newDate(timestamp).getMonth() + 1).toString();
39
+ export const getFullYear = (epoch) => newDate(epoch).getFullYear().toString();
40
+ export const getMonth = (epoch) => (newDate(epoch).getMonth() + 1).toString();
41
41
  export const getCurrentDay = () => newDate().getDate();
42
42
  export const getCurrentYear = () => newDate().getFullYear().toString();
43
43
 
@@ -55,3 +55,10 @@ export const parseDateString = (val, format) => {
55
55
  if (!trimmed) return null;
56
56
  return formats[format].getDate(trimmed);
57
57
  };
58
+
59
+ export const dateToEpoch = (date, isUtc) => {
60
+ if (isUtc) {
61
+ return new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate())).getTime();
62
+ }
63
+ return date.getTime();
64
+ };
@@ -314,10 +314,6 @@ const multiSelectComboBoxMixin = (superclass) =>
314
314
 
315
315
  this.setGetValidity();
316
316
 
317
- this.setComboBoxDescriptor();
318
-
319
- this.#overrideOverlaySettings();
320
-
321
317
  this.#handleCustomValues();
322
318
 
323
319
  this.renderItems();
@@ -330,6 +326,14 @@ const multiSelectComboBoxMixin = (superclass) =>
330
326
  // tries to override it, causing us to lose the user set placeholder.
331
327
  forwardAttrs(this, this.baseElement, { includeAttrs: ['placeholder'] });
332
328
 
329
+ // This is a workaround for a problem we have in Console App, where in ScreenBuilder - the inputElement is not ready when trying to
330
+ // set the component's descriptor and override the overlay settings.
331
+ // THIS IS A PROBLEM WITH THE CONSOLE APP THAT NEEDS TO BE RESOLVED. Until then, we use this workaround.
332
+ setTimeout(() => {
333
+ this.setComboBoxDescriptor();
334
+ this.#overrideOverlaySettings();
335
+ });
336
+
333
337
  this.setDefaultValues();
334
338
 
335
339
  this.baseElement.addEventListener('selected-items-changed', () => {