@aquera/nile-elements 1.3.4-beta-1.4 → 1.3.4-beta-1.5

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent nile-elements following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "nile-elements",
6
- "version": "1.3.4-beta-1.4",
6
+ "version": "1.3.4-beta-1.5",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -73,30 +73,26 @@ export function parseDateFromFormat(str: string, format: string): Date | null {
73
73
  export function parseRangeFromFormat(
74
74
  input: string,
75
75
  format: string,
76
- isRange: boolean
76
+ isRange: boolean,
77
+ separator: string
77
78
  ) {
78
79
  if (!isRange) {
79
80
  return { first: parseDateFromFormat(input, format), second: null };
80
81
  }
81
82
 
82
- const RANGE_SEP = " - ";
83
-
84
- if (!input.includes(RANGE_SEP)) {
83
+ if (!input.includes(separator)) {
85
84
  return { first: parseDateFromFormat(input, format), second: null };
86
85
  }
87
86
 
88
- const [firstRaw, secondRaw] = input.split(RANGE_SEP);
87
+ const [firstRaw, secondRaw] = input.split(separator);
89
88
 
90
89
  const first = parseDateFromFormat(firstRaw, format);
91
- let second = null;
92
-
93
- if (secondRaw && secondRaw.length >= 10) {
94
- second = parseDateFromFormat(secondRaw, format);
95
- }
90
+ const second = secondRaw ? parseDateFromFormat(secondRaw, format) : null;
96
91
 
97
92
  return { first, second };
98
93
  }
99
94
 
95
+
100
96
  export function normalizeDateRange(
101
97
  first: Date | null,
102
98
  second: Date | null
@@ -43,7 +43,9 @@ export class NileDatePicker extends NileElement {
43
43
  @property({ attribute: 'allowedDates' }) allowedDates: any = '{}';
44
44
 
45
45
  @property({ type: Boolean, attribute: true, reflect: true }) syncDatePicker = false;
46
- @property({ type: String, attribute: true, reflect: true }) dateFormat = "DD/MM/YYYY";
46
+ @property({ type: String, attribute: true, reflect: true }) dateFormat = "DD/MM/YYYY";
47
+ @property({ type: String, attribute: true, reflect: true }) rangeSeparator = " - ";
48
+
47
49
 
48
50
  @query('nile-dropdown') dropdown: NileDropdown;
49
51
 
@@ -57,7 +59,7 @@ export class NileDatePicker extends NileElement {
57
59
 
58
60
  input.addEventListener("nile-input", (e: any) => {
59
61
  const text = e.detail.value;
60
- const { first, second } = parseRangeFromFormat(text, this.dateFormat, this.range);
62
+ const { first, second } = parseRangeFromFormat(text, this.dateFormat, this.range, this.rangeSeparator);
61
63
 
62
64
  if (!this.range) {
63
65
  if (first) this.jumpTo(first);
@@ -1102,7 +1102,7 @@
1102
1102
  },
1103
1103
  {
1104
1104
  "name": "nile-date-picker",
1105
- "description": "Attributes:\n\n * `range` {`boolean`} - \n\n * `hideTypes` {`boolean`} - \n\n * `doubleClickUnselect` {`boolean`} - \n\n * `allowClear` {`boolean`} - \n\n * `open` {`boolean`} - \n\n * `hide-time-zone` {`boolean`} - \n\n * `type` {`\"absolute\" | \"relative\"`} - \n\n * `showManualInputs` {`boolean`} - \n\n * `value` - \n\n * `hide-duration-fields` - \n\n * `allowedDates` - \n\n * `syncDatePicker` {`boolean`} - \n\n * `dateFormat` {`string`} - \n\nProperties:\n\n * `range` {`boolean`} - \n\n * `hideTypes` {`boolean`} - \n\n * `doubleClickUnselect` {`boolean`} - \n\n * `allowClear` {`boolean`} - \n\n * `open` {`boolean`} - \n\n * `hideTimeZone` {`boolean`} - \n\n * `type` {`\"absolute\" | \"relative\"`} - \n\n * `showManualInputs` {`boolean`} - \n\n * `value` - \n\n * `hideDurationFields` - \n\n * `allowedDates` - \n\n * `syncDatePicker` {`boolean`} - \n\n * `dateFormat` {`string`} - \n\n * `dropdown` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
1105
+ "description": "Attributes:\n\n * `range` {`boolean`} - \n\n * `hideTypes` {`boolean`} - \n\n * `doubleClickUnselect` {`boolean`} - \n\n * `allowClear` {`boolean`} - \n\n * `open` {`boolean`} - \n\n * `hide-time-zone` {`boolean`} - \n\n * `type` {`\"absolute\" | \"relative\"`} - \n\n * `showManualInputs` {`boolean`} - \n\n * `value` - \n\n * `hide-duration-fields` - \n\n * `allowedDates` - \n\n * `syncDatePicker` {`boolean`} - \n\n * `dateFormat` {`string`} - \n\n * `rangeSeparator` {`string`} - \n\nProperties:\n\n * `range` {`boolean`} - \n\n * `hideTypes` {`boolean`} - \n\n * `doubleClickUnselect` {`boolean`} - \n\n * `allowClear` {`boolean`} - \n\n * `open` {`boolean`} - \n\n * `hideTimeZone` {`boolean`} - \n\n * `type` {`\"absolute\" | \"relative\"`} - \n\n * `showManualInputs` {`boolean`} - \n\n * `value` - \n\n * `hideDurationFields` - \n\n * `allowedDates` - \n\n * `syncDatePicker` {`boolean`} - \n\n * `dateFormat` {`string`} - \n\n * `rangeSeparator` {`string`} - \n\n * `dropdown` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
1106
1106
  "attributes": [
1107
1107
  {
1108
1108
  "name": "range",
@@ -1171,6 +1171,10 @@
1171
1171
  {
1172
1172
  "name": "dateFormat",
1173
1173
  "description": "`dateFormat` {`string`} - \n\nProperty: dateFormat\n\nDefault: DD/MM/YYYY"
1174
+ },
1175
+ {
1176
+ "name": "rangeSeparator",
1177
+ "description": "`rangeSeparator` {`string`} - \n\nProperty: rangeSeparator\n\nDefault: - "
1174
1178
  }
1175
1179
  ]
1176
1180
  },