@aquera/nile-elements 0.0.45 → 0.0.46
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/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button/nile-button.css.js +41 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button/nile-button.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button/nile-button.d.ts +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button/nile-button.js +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button/nile-button.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.css.js +10 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.d.ts +9 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.js +114 -25
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.d.ts +4 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.js +25 -6
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-popover/nile-popover.d.ts +6 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-popover/nile-popover.js +21 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-popover/nile-popover.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.iife.js +127 -57
- package/dist/nile-button/nile-button.cjs.js +1 -1
- package/dist/nile-button/nile-button.cjs.js.map +1 -1
- package/dist/nile-button/nile-button.css.cjs.js +1 -1
- package/dist/nile-button/nile-button.css.cjs.js.map +1 -1
- package/dist/nile-button/nile-button.css.esm.js +43 -2
- package/dist/nile-button/nile-button.esm.js +1 -1
- package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.esm.js +10 -2
- package/dist/nile-calendar/nile-calendar.esm.js +44 -28
- package/dist/nile-date-picker/nile-date-picker.cjs.js +1 -1
- package/dist/nile-date-picker/nile-date-picker.cjs.js.map +1 -1
- package/dist/nile-date-picker/nile-date-picker.esm.js +12 -8
- package/dist/nile-popover/nile-popover.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.esm.js +5 -4
- package/dist/src/nile-button/nile-button.css.js +41 -0
- package/dist/src/nile-button/nile-button.css.js.map +1 -1
- package/dist/src/nile-button/nile-button.d.ts +1 -1
- package/dist/src/nile-button/nile-button.js +1 -0
- package/dist/src/nile-button/nile-button.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.css.js +10 -2
- package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.d.ts +9 -1
- package/dist/src/nile-calendar/nile-calendar.js +114 -25
- package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/dist/src/nile-date-picker/nile-date-picker.d.ts +4 -0
- package/dist/src/nile-date-picker/nile-date-picker.js +25 -6
- package/dist/src/nile-date-picker/nile-date-picker.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.d.ts +6 -0
- package/dist/src/nile-popover/nile-popover.js +21 -2
- package/dist/src/nile-popover/nile-popover.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/nile-button/nile-button.css.ts +41 -0
- package/src/nile-button/nile-button.ts +2 -1
- package/src/nile-calendar/nile-calendar.css.ts +10 -2
- package/src/nile-calendar/nile-calendar.ts +206 -80
- package/src/nile-date-picker/nile-date-picker.ts +21 -7
- package/src/nile-popover/nile-popover.ts +20 -2
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": "0.0.
|
6
|
+
"version": "0.0.46",
|
7
7
|
"main": "dist/src/index.js",
|
8
8
|
"type": "module",
|
9
9
|
"module": "dist/src/index.js",
|
@@ -104,4 +104,4 @@
|
|
104
104
|
"prettier --write"
|
105
105
|
]
|
106
106
|
}
|
107
|
-
}
|
107
|
+
}
|
@@ -169,6 +169,35 @@ export const styles = css`
|
|
169
169
|
box-shadow: none;
|
170
170
|
}
|
171
171
|
|
172
|
+
/* ghost */
|
173
|
+
.button--standard.button--ghost{
|
174
|
+
background-color: var(--nile-colors-button-tertiary);
|
175
|
+
border-color: transparent;
|
176
|
+
color: var(--nile-colors-button-tertiary-text);
|
177
|
+
}
|
178
|
+
|
179
|
+
.button--standard.button--ghost:hover:not(.button--disabled) {
|
180
|
+
background-color: var(--nile-colors-button-tertiary-hover);
|
181
|
+
border-color: transparent;
|
182
|
+
color: var(--nile-colors-button-tertiary-text);
|
183
|
+
}
|
184
|
+
|
185
|
+
.button--standard.button--ghost:active:not(.button--disabled) {
|
186
|
+
background-color: var(--nile-colors-button-tertiary-pressed);
|
187
|
+
border-color:transparent;
|
188
|
+
color: var(--nile-colors-button-tertiary-text);
|
189
|
+
}
|
190
|
+
|
191
|
+
.button--standard.button--ghost.button--disabled,
|
192
|
+
.button--standard.button--ghost.button--disabled:hover,
|
193
|
+
.button--standard.button--ghost.button--disabled:active {
|
194
|
+
border-color:transparent;
|
195
|
+
background-color: var(--nile-colors-button-tertiary-disabled);
|
196
|
+
color: var(--nile-colors-button-tertiary-disabled-text);
|
197
|
+
cursor: not-allowed;
|
198
|
+
box-shadow: none;
|
199
|
+
}
|
200
|
+
|
172
201
|
/* caution */
|
173
202
|
.button--standard.button--caution {
|
174
203
|
background-color: var(--nile-colors-button-caution);
|
@@ -233,6 +262,18 @@ export const styles = css`
|
|
233
262
|
--nile-svg-fill: var(--nile-colors-button-tertiary-disabled-text) !important;
|
234
263
|
}
|
235
264
|
|
265
|
+
/* Ghost Variant */
|
266
|
+
.button--standard.button--ghost ::slotted(nile-icon) {
|
267
|
+
--nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;
|
268
|
+
}
|
269
|
+
.button--standard.button--ghost:hover:not(.button--disabled) ::slotted(nile-icon),
|
270
|
+
.button--standard.button--ghost:active:not(.button--disabled) ::slotted(nile-icon) {
|
271
|
+
--nile-svg-fill: var(--nile-colors-button-tertiary-text) !important;
|
272
|
+
}
|
273
|
+
.button--standard.button--ghost ::slotted(nile-icon) {
|
274
|
+
--nile-svg-fill: var(--nile-colors-button-tertiary-disabled-text) !important;
|
275
|
+
}
|
276
|
+
|
236
277
|
/* Caution Variant */
|
237
278
|
.button--standard.button--caution ::slotted(nile-icon) {
|
238
279
|
--nile-svg-fill: var(--nile-colors-button-caution-text) !important;
|
@@ -62,7 +62,7 @@ export class NileButton extends NileElement implements NileFormControl {
|
|
62
62
|
@property() title = ''; // make reactive to pass through
|
63
63
|
|
64
64
|
/** The button's theme variant. */
|
65
|
-
@property({ reflect: true }) variant: 'primary' | 'secondary' | 'tertiary' | 'caution' = 'primary';
|
65
|
+
@property({ reflect: true }) variant: 'primary' | 'secondary' | 'tertiary' | 'caution'|'ghost' = 'primary';
|
66
66
|
|
67
67
|
/** The button's size. */
|
68
68
|
@property({ reflect: true }) size: 'medium' = 'medium';
|
@@ -292,6 +292,7 @@ export class NileButton extends NileElement implements NileFormControl {
|
|
292
292
|
'button--secondary': this.variant === 'secondary',
|
293
293
|
'button--tertiary': this.variant === 'tertiary',
|
294
294
|
'button--caution': this.variant === 'caution',
|
295
|
+
'button--ghost': this.variant === 'ghost',
|
295
296
|
'button--medium': this.size === 'medium',
|
296
297
|
'button--caret': this.caret,
|
297
298
|
'button--circle': this.circle,
|
@@ -174,6 +174,9 @@ export const styles = css`
|
|
174
174
|
margin-top: 6px;
|
175
175
|
padding: 0 16px;
|
176
176
|
width: 290px;
|
177
|
+
display:flex;
|
178
|
+
flex-wrap:wrap;
|
179
|
+
gap:8px;
|
177
180
|
}
|
178
181
|
|
179
182
|
.calender-input--relative {
|
@@ -186,11 +189,11 @@ export const styles = css`
|
|
186
189
|
justify-content: space-between;
|
187
190
|
gap: 8px;
|
188
191
|
margin-top: 12px;
|
189
|
-
width:
|
192
|
+
width:auto;
|
190
193
|
}
|
191
194
|
|
192
195
|
.manual-input {
|
193
|
-
width:
|
196
|
+
width:125px;
|
194
197
|
}
|
195
198
|
|
196
199
|
.manual-input-label {
|
@@ -341,6 +344,11 @@ export const styles = css`
|
|
341
344
|
.months-values {
|
342
345
|
gap: 16px;
|
343
346
|
}
|
347
|
+
|
348
|
+
.not-allowed {
|
349
|
+
pointer-events: none;
|
350
|
+
color:var(--nile-colors-dark-500);
|
351
|
+
}
|
344
352
|
`;
|
345
353
|
|
346
354
|
export default [styles];
|
@@ -12,7 +12,7 @@ import {
|
|
12
12
|
CSSResultArray,
|
13
13
|
TemplateResult,
|
14
14
|
} from 'lit-element';
|
15
|
-
import { customElement } from 'lit/decorators.js';
|
15
|
+
import { customElement, state } from 'lit/decorators.js';
|
16
16
|
import { styles } from './nile-calendar.css';
|
17
17
|
import { animateTo, stopAnimations } from '../internal/animate';
|
18
18
|
import { classMap } from 'lit/directives/class-map.js';
|
@@ -43,7 +43,7 @@ import { TIMEZONES } from './timezones';
|
|
43
43
|
@customElement('nile-calendar')
|
44
44
|
export class NileCalendar extends NileElement {
|
45
45
|
/**
|
46
|
-
|
46
|
+
* The styles for NileCalendar
|
47
47
|
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
48
48
|
*/
|
49
49
|
public static get styles(): CSSResultArray {
|
@@ -60,6 +60,9 @@ export class NileCalendar extends NileElement {
|
|
60
60
|
|
61
61
|
@property({ type: Object }) value: any;
|
62
62
|
|
63
|
+
@property({ type: Object, attribute: 'allowed-dates' })
|
64
|
+
allowedDates: any = {};
|
65
|
+
|
63
66
|
@property({ type: Object }) rangeValue: any;
|
64
67
|
|
65
68
|
@property({ type: String, attribute: 'value' }) valueAttribute:
|
@@ -85,6 +88,62 @@ export class NileCalendar extends NileElement {
|
|
85
88
|
|
86
89
|
@property({ type: String }) selectedTimeZone: string = 'local';
|
87
90
|
|
91
|
+
@state() validAllowedDates = true;
|
92
|
+
|
93
|
+
firstUpdated() {
|
94
|
+
const allowedDatesAttribute = this.getAttribute('allowed-dates');
|
95
|
+
|
96
|
+
if (allowedDatesAttribute !== null ) {
|
97
|
+
try {
|
98
|
+
this.allowedDates = JSON.parse(allowedDatesAttribute);
|
99
|
+
} catch (error) {
|
100
|
+
console.error('Error parsing allowed-dates attribute:', error);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
else
|
104
|
+
{
|
105
|
+
this.validAllowedDates=false;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
@watch('allowedDates')
|
110
|
+
checkValidAllowedDate() {
|
111
|
+
if (Object.keys(this.allowedDates).length ==0) {
|
112
|
+
this.validAllowedDates = false;
|
113
|
+
return;
|
114
|
+
}
|
115
|
+
const startDate = new Date(
|
116
|
+
Date.UTC(
|
117
|
+
this.allowedDates?.startDate?.slice(0, 4),
|
118
|
+
this.allowedDates?.startDate?.slice(5, 7) - 1,
|
119
|
+
this.allowedDates?.startDate?.slice(8, 10)
|
120
|
+
)
|
121
|
+
);
|
122
|
+
const endDate = new Date(
|
123
|
+
Date.UTC(
|
124
|
+
this.allowedDates?.endDate?.slice(0, 4),
|
125
|
+
this.allowedDates?.endDate?.slice(5, 7) - 1,
|
126
|
+
this.allowedDates?.endDate?.slice(8, 10)
|
127
|
+
)
|
128
|
+
);
|
129
|
+
|
130
|
+
if (startDate > endDate) {
|
131
|
+
console.error('StartDate must be greater than endDate');
|
132
|
+
this.validAllowedDates=false;
|
133
|
+
}
|
134
|
+
else
|
135
|
+
{
|
136
|
+
this.validAllowedDates=true;
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
@property({ type: Boolean,attribute:'hide-time-input' }) hideTimeInput: Boolean = false;
|
141
|
+
|
142
|
+
|
143
|
+
@property({ type: Array, attribute: 'hide-duration-fields' })
|
144
|
+
hideDurationFields: String[] = [];
|
145
|
+
@property({ type: Boolean , attribute: 'hide-time-zone' }) hideTimeZone: Boolean = false;
|
146
|
+
|
88
147
|
@watch('value')
|
89
148
|
valueChanged() {
|
90
149
|
if (this.range && this.value) {
|
@@ -186,7 +245,7 @@ export class NileCalendar extends NileElement {
|
|
186
245
|
this.currentYear = this.value.getFullYear();
|
187
246
|
}
|
188
247
|
}
|
189
|
-
|
248
|
+
this.emit('nile-init');
|
190
249
|
}
|
191
250
|
|
192
251
|
disconnectedCallback() {
|
@@ -298,6 +357,30 @@ export class NileCalendar extends NileElement {
|
|
298
357
|
);
|
299
358
|
}
|
300
359
|
|
360
|
+
isAllowedDate(day: number, month: number, year: number) {
|
361
|
+
if (!this.validAllowedDates) {
|
362
|
+
return true;
|
363
|
+
}
|
364
|
+
const dateToCheck = new Date(Date.UTC(year, month, day));
|
365
|
+
const startDate = new Date(
|
366
|
+
Date.UTC(
|
367
|
+
this.allowedDates?.startDate?.slice(0, 4),
|
368
|
+
this.allowedDates?.startDate?.slice(5, 7) - 1,
|
369
|
+
this.allowedDates?.startDate?.slice(8, 10)
|
370
|
+
)
|
371
|
+
);
|
372
|
+
const endDate = new Date(
|
373
|
+
Date.UTC(
|
374
|
+
this.allowedDates?.endDate?.slice(0, 4),
|
375
|
+
this.allowedDates?.endDate?.slice(5, 7) - 1,
|
376
|
+
this.allowedDates?.endDate?.slice(8, 10)
|
377
|
+
)
|
378
|
+
);
|
379
|
+
endDate.setUTCHours(23, 59, 59, 999);
|
380
|
+
const isWithinRange = dateToCheck >= startDate && dateToCheck <= endDate;
|
381
|
+
return isWithinRange;
|
382
|
+
}
|
383
|
+
|
301
384
|
private renderMonth(
|
302
385
|
year: number,
|
303
386
|
month: number,
|
@@ -375,8 +458,8 @@ export class NileCalendar extends NileElement {
|
|
375
458
|
</nile-icon>
|
376
459
|
<span
|
377
460
|
>${new Date(year, month).toLocaleString('default', {
|
378
|
-
|
379
|
-
|
461
|
+
month: 'long',
|
462
|
+
})}
|
380
463
|
${year}</span
|
381
464
|
>
|
382
465
|
<nile-icon
|
@@ -399,31 +482,33 @@ export class NileCalendar extends NileElement {
|
|
399
482
|
</div>
|
400
483
|
<div class="days">
|
401
484
|
${allDays.map((day, index) => {
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
class="day
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
485
|
+
const isCurrentMonth =
|
486
|
+
index >= fillerDaysBefore.length &&
|
487
|
+
index < fillerDaysBefore.length + daysArray.length;
|
488
|
+
return html` <div
|
489
|
+
class="day
|
490
|
+
${this.isAllowedDate(day, month, year) ? '' : 'not-allowed'}
|
491
|
+
${isSelectedDate(day, month, year, isCurrentMonth)} ${isInRange(
|
492
|
+
day,
|
493
|
+
month,
|
494
|
+
year,
|
495
|
+
isCurrentMonth
|
496
|
+
)} ${isInRange(day, month, year, isCurrentMonth)
|
497
|
+
? 'in-range'
|
498
|
+
: ''} ${!isCurrentMonth ? 'filler' : ''}
|
414
499
|
${this.isCurrentDate(day, month, year) && isCurrentMonth
|
415
|
-
|
416
|
-
|
500
|
+
? 'current-date'
|
501
|
+
: ''}
|
417
502
|
"
|
418
503
|
@click="${() => {
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
504
|
+
if (isCurrentMonth) {
|
505
|
+
this.selectDate(day, month, year);
|
506
|
+
}
|
507
|
+
}}"
|
423
508
|
>
|
424
509
|
${day}
|
425
510
|
</div>`;
|
426
|
-
|
511
|
+
})}
|
427
512
|
</div>
|
428
513
|
</div>
|
429
514
|
`;
|
@@ -594,8 +679,8 @@ export class NileCalendar extends NileElement {
|
|
594
679
|
<div
|
595
680
|
class="time-value ${this.selectedUnit === unit &&
|
596
681
|
this.selectedValue === value
|
597
|
-
|
598
|
-
|
682
|
+
? 'time-value--selected'
|
683
|
+
: ''}"
|
599
684
|
@click=${(e: any) => this.handleTimeValueClick(unit, value, e)}
|
600
685
|
>
|
601
686
|
${value}
|
@@ -632,7 +717,6 @@ export class NileCalendar extends NileElement {
|
|
632
717
|
*/
|
633
718
|
render(): TemplateResult {
|
634
719
|
const timeZones: string[] = TIMEZONES;
|
635
|
-
|
636
720
|
const daysArray = this.getDaysArray(this.currentYear, this.currentMonth);
|
637
721
|
const nextMonth = (this.currentMonth + 1) % 12;
|
638
722
|
const nextYear =
|
@@ -643,8 +727,8 @@ export class NileCalendar extends NileElement {
|
|
643
727
|
<div
|
644
728
|
class="base ${this.range ? 'base__range' : ''} ${this.type ===
|
645
729
|
'relative'
|
646
|
-
|
647
|
-
|
730
|
+
? 'base__relative'
|
731
|
+
: ''}"
|
648
732
|
>
|
649
733
|
<div class="calendar-config ${!this.range ? 'hidden' : ''}">
|
650
734
|
<div class="calendar-switcher">
|
@@ -655,7 +739,7 @@ export class NileCalendar extends NileElement {
|
|
655
739
|
</div>
|
656
740
|
</div>
|
657
741
|
|
658
|
-
<div class="calendar-timezone ${!this.range ? 'hidden' : ''}">
|
742
|
+
<div class="calendar-timezone ${!this.range || this.hideTimeZone ? 'hidden' : ''}">
|
659
743
|
<nile-select
|
660
744
|
hoist
|
661
745
|
value=${this.selectedTimeZone}
|
@@ -671,43 +755,63 @@ export class NileCalendar extends NileElement {
|
|
671
755
|
>
|
672
756
|
<div class="calendar-container ${this.range ? 'with-margin' : ''}">
|
673
757
|
${this.renderMonth(
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
758
|
+
this.currentYear,
|
759
|
+
this.currentMonth,
|
760
|
+
this.getDaysArray(this.currentYear, this.currentMonth)
|
761
|
+
)}
|
678
762
|
</div>
|
679
763
|
</div>
|
680
764
|
|
681
765
|
<div class="unit-container ${this.type !== 'relative' ? 'hidden' : ''}">
|
682
|
-
<div
|
766
|
+
<div
|
767
|
+
class="time-unit-group ${this.hideDurationFields?.includes('minutes')
|
768
|
+
? 'hidden'
|
769
|
+
: ''} "
|
770
|
+
>
|
683
771
|
<div class="time-unit-name"><span>Minutes</span></div>
|
684
772
|
<div class="time-unit-value minute-values">
|
685
773
|
${this.renderTimeValues('minutes', [1, 5, 15, 30, 45])}
|
686
774
|
</div>
|
687
775
|
</div>
|
688
776
|
|
689
|
-
<div
|
777
|
+
<div
|
778
|
+
class="time-unit-group ${this.hideDurationFields?.includes('hours')
|
779
|
+
? 'hidden'
|
780
|
+
: ''}"
|
781
|
+
>
|
690
782
|
<div class="time-unit-name"><span>Hours</span></div>
|
691
783
|
<div class="time-unit-value hours-values">
|
692
784
|
${this.renderTimeValues('hours', [1, 2, 3, 6, 8, 12])}
|
693
785
|
</div>
|
694
786
|
</div>
|
695
787
|
|
696
|
-
<div
|
788
|
+
<div
|
789
|
+
class="time-unit-group ${this.hideDurationFields?.includes('days')
|
790
|
+
? 'hidden'
|
791
|
+
: ''}"
|
792
|
+
>
|
697
793
|
<div class="time-unit-name"><span>Days</span></div>
|
698
794
|
<div class="time-unit-value">
|
699
795
|
${this.renderTimeValues('days', [1, 2, 3, 4, 5, 6])}
|
700
796
|
</div>
|
701
797
|
</div>
|
702
798
|
|
703
|
-
<div
|
799
|
+
<div
|
800
|
+
class="time-unit-group ${this.hideDurationFields?.includes('weeks')
|
801
|
+
? 'hidden'
|
802
|
+
: ''}"
|
803
|
+
>
|
704
804
|
<div class="time-unit-name"><span>Weeks</span></div>
|
705
805
|
<div class="time-unit-value weeks-values ">
|
706
806
|
${this.renderTimeValues('weeks', [1, 2, 4, 6])}
|
707
807
|
</div>
|
708
808
|
</div>
|
709
809
|
|
710
|
-
<div
|
810
|
+
<div
|
811
|
+
class="time-unit-group ${this.hideDurationFields?.includes('months')
|
812
|
+
? 'hidden'
|
813
|
+
: ''}"
|
814
|
+
>
|
711
815
|
<div class="time-unit-name"><span>Months:</span></div>
|
712
816
|
<div class="time-unit-value months-values ">
|
713
817
|
${this.renderTimeValues('months', [3, 6, 12, 15])}
|
@@ -716,71 +820,93 @@ export class NileCalendar extends NileElement {
|
|
716
820
|
</div>
|
717
821
|
|
718
822
|
${this.range && this.type === 'relative'
|
719
|
-
|
823
|
+
? html`
|
720
824
|
<div class="calender-input calender-input--relative">
|
721
825
|
<div class="unit-input-container">
|
722
|
-
<nile-input class="manual-input duration-input" label="Duration" value="${
|
723
|
-
|
826
|
+
<nile-input class="manual-input duration-input" label="Duration" value="${
|
827
|
+
this.selectedValue
|
828
|
+
}"
|
724
829
|
@nile-input="${this.handleDurationChange}"
|
725
830
|
placeholder="Enter Value" ></nile-input>
|
726
|
-
<nile-select class="manual-input time-input" label="Unit of time" style="margin-top:3px" value="${
|
727
|
-
|
831
|
+
<nile-select class="manual-input time-input" label="Unit of time" style="margin-top:3px" value="${
|
832
|
+
this.selectedUnit
|
833
|
+
}"
|
728
834
|
@nile-change="${this.handleUnitChange}"
|
729
835
|
>
|
730
|
-
<nile-option value="minutes"
|
731
|
-
|
732
|
-
|
733
|
-
<nile-option value="
|
734
|
-
|
836
|
+
<nile-option value="minutes" class="${
|
837
|
+
this.hideDurationFields?.includes('minutes') ? 'hidden' : ''
|
838
|
+
}"> Minutes </nile-option>
|
839
|
+
<nile-option value="hours" class="${
|
840
|
+
this.hideDurationFields?.includes('hours') ? 'hidden' : ''
|
841
|
+
}"> Hours </nile-option>
|
842
|
+
<nile-option value="days" class="${
|
843
|
+
this.hideDurationFields?.includes('days') ? 'hidden' : ''
|
844
|
+
}"> Days </nile-option>
|
845
|
+
<nile-option value="weeks" class="${
|
846
|
+
this.hideDurationFields?.includes('weeks') ? 'hidden' : ''
|
847
|
+
}"> Weeks </nile-option>
|
848
|
+
<nile-option value="months" class="${
|
849
|
+
this.hideDurationFields?.includes('months') ? 'hidden' : ''
|
850
|
+
}"> Months </nile-option>
|
735
851
|
</nile-select>
|
736
852
|
|
737
853
|
</div>
|
738
854
|
|
739
855
|
<div class="button-container--relative">
|
740
|
-
<nile-button class="apply-button" variant="primary" ?disabled="${
|
741
|
-
|
856
|
+
<nile-button class="apply-button" variant="primary" ?disabled="${
|
857
|
+
!this.startDate || !this.endDate
|
858
|
+
}" @click="${this.confimRange}"> Apply</nile-button>
|
742
859
|
</div>
|
743
860
|
|
744
861
|
|
745
862
|
</div>
|
746
863
|
</div>
|
747
864
|
`
|
748
|
-
|
865
|
+
: ''}
|
749
866
|
${this.range && this.type === 'absolute'
|
750
|
-
|
867
|
+
? html`
|
751
868
|
<div class="calender-input">
|
752
|
-
<
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
869
|
+
<div>
|
870
|
+
<span class="manual-input-label">From </span>
|
871
|
+
<div class="from">
|
872
|
+
<nile-input class="manual-input" value="${this.formatDate(
|
873
|
+
this.startDate
|
874
|
+
)}" placeholder="DD/MM/YYYY" @nile-change="${
|
875
|
+
this.handleStartDateInput
|
876
|
+
}"></nile-input>
|
877
|
+
<nile-input class="manual-input ${this.hideTimeInput ? 'hidden':''}" value="${this.formatTime(
|
878
|
+
this.startDate
|
879
|
+
)}" placeholder="HH:MM:SS" @nile-change="${
|
880
|
+
this.handleStartTimeInput
|
881
|
+
}"> </nile-input>
|
882
|
+
</div>
|
763
883
|
</div>
|
764
|
-
|
765
|
-
<
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
884
|
+
|
885
|
+
<div>
|
886
|
+
<span class="manual-input-label">To </span>
|
887
|
+
<div class="from">
|
888
|
+
<nile-input class="manual-input" value="${this.formatDate(
|
889
|
+
this.endDate
|
890
|
+
)}" placeholder="DD/MM/YYYY" @nile-change="${
|
891
|
+
this.handleEndDateInput
|
892
|
+
}"></nile-input>
|
893
|
+
<nile-input class="manual-input ${this.hideTimeInput ? 'hidden':''} " value="${this.formatTime(
|
894
|
+
this.endDate
|
895
|
+
)}" placeholder="HH:MM:SS" @nile-change="${
|
896
|
+
this.handleEndTimeInput
|
897
|
+
}"> </nile-input>
|
898
|
+
</div>
|
899
|
+
</div>
|
900
|
+
|
776
901
|
</div>
|
777
902
|
<div class="button-container">
|
778
|
-
<nile-button class="apply-button" ?disabled="${
|
779
|
-
|
903
|
+
<nile-button class="apply-button" ?disabled="${
|
904
|
+
!this.startDate || !this.endDate
|
905
|
+
}" @click="${this.confimRange}"> Apply</nile-button>
|
780
906
|
</div>
|
781
907
|
</div>
|
782
908
|
`
|
783
|
-
|
909
|
+
: ''}
|
784
910
|
</div>
|
785
911
|
`;
|
786
912
|
}
|
@@ -792,4 +918,4 @@ declare global {
|
|
792
918
|
interface HTMLElementTagNameMap {
|
793
919
|
'nile-calendar': NileCalendar;
|
794
920
|
}
|
795
|
-
}
|
921
|
+
}
|
@@ -35,24 +35,38 @@ export class NileDatePicker extends NileElement {
|
|
35
35
|
|
36
36
|
@property({ type: Boolean }) range = false;
|
37
37
|
|
38
|
+
@property({ type: Boolean, attribute: 'hide-time-input' }) hideTimeInput =
|
39
|
+
false;
|
40
|
+
|
41
|
+
@property({ type: Boolean ,attribute: 'hide-time-zone' }) hideTimeZone = false;
|
42
|
+
|
38
43
|
@property() value: any;
|
44
|
+
@property({ type: Array, attribute: 'hide-duration-fields' })
|
45
|
+
hideDurationFields: any = [];
|
39
46
|
|
40
|
-
@
|
47
|
+
@property({ attribute: 'allowed-dates' })
|
48
|
+
allowedDates: any ;
|
41
49
|
|
50
|
+
@query('nile-dropdown') dropdown: NileDropdown;
|
42
51
|
|
43
52
|
/**
|
44
53
|
* Render method
|
45
54
|
* @slot This is a slot test
|
46
55
|
*/
|
47
56
|
render(): TemplateResult {
|
57
|
+
|
48
58
|
return html`
|
49
59
|
<nile-dropdown .hoist="${true}" distance="6">
|
50
|
-
<slot
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
60
|
+
<slot slot="trigger" part="trigger" name="trigger"></slot>
|
61
|
+
<nile-calendar
|
62
|
+
value="${this.value}"
|
63
|
+
.range="${this.range}"
|
64
|
+
@nile-changed="${this.handleChanged}"
|
65
|
+
allowed-dates="${this.allowedDates}"
|
66
|
+
.hideTimeInput="${this.hideTimeInput}"
|
67
|
+
.hideDurationFields="${this.hideDurationFields}"
|
68
|
+
.hideTimeZone="${this.hideTimeZone}"
|
69
|
+
></nile-calendar>
|
56
70
|
</nile-dropdown>
|
57
71
|
`;
|
58
72
|
}
|
@@ -65,6 +65,16 @@ export class NilePopover extends LitElement {
|
|
65
65
|
| 'center'
|
66
66
|
| 'anchor' = 'anchor';
|
67
67
|
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Enable this option to prevent the panel from being clipped when the component is placed inside a container with
|
71
|
+
* `overflow: auto|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
72
|
+
*/
|
73
|
+
@property({ type: Boolean }) hoist = false;
|
74
|
+
|
75
|
+
@property({ type: Boolean }) flip = false;
|
76
|
+
|
77
|
+
|
68
78
|
/* #endregion */
|
69
79
|
|
70
80
|
/* #region Methods */
|
@@ -86,6 +96,13 @@ export class NilePopover extends LitElement {
|
|
86
96
|
|
87
97
|
private handleClick = () => {
|
88
98
|
this.isShow = !this.isShow;
|
99
|
+
const allPopovers = document.querySelectorAll('nile-popover');
|
100
|
+
|
101
|
+
allPopovers.forEach(popover => {
|
102
|
+
if (popover !== this) {
|
103
|
+
popover.isShow=false;
|
104
|
+
}
|
105
|
+
});
|
89
106
|
};
|
90
107
|
|
91
108
|
private handleDocumentClick = () => {
|
@@ -103,8 +120,9 @@ export class NilePopover extends LitElement {
|
|
103
120
|
placement="${this.placement}"
|
104
121
|
@click=${(e: Event) => e.stopPropagation()}
|
105
122
|
arrowPlacement="${this.arrowPlacement}"
|
106
|
-
flip
|
123
|
+
.flip="${this.flip}"
|
107
124
|
shift
|
125
|
+
strategy=${this.hoist ? 'fixed' : 'absolute'}
|
108
126
|
>
|
109
127
|
<slot
|
110
128
|
slot="anchor"
|
@@ -118,7 +136,7 @@ export class NilePopover extends LitElement {
|
|
118
136
|
class="popover__box"
|
119
137
|
>
|
120
138
|
<slot name="title" class="popover__title">${this.title}</slot>
|
121
|
-
<slot></slot>
|
139
|
+
<slot part="base"></slot>
|
122
140
|
<slot name="action" class="popover__action"> </slot>
|
123
141
|
</div>`
|
124
142
|
: html``}
|