@dile/ui 2.5.3 → 2.5.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/components/spinner/spinner-block.js +4 -0
- package/components/spinner/src/DileSpinnerBlock.js +25 -0
- package/mixins/close-document-click/src/DileCloseDocumentClick.js +10 -5
- package/package.json +2 -2
- package/components/datepicker/calendar.js +0 -3
- package/components/datepicker/datepicker.js +0 -4
- package/components/datepicker/index.js +0 -2
- package/components/datepicker/src/DileCalendar.js +0 -72
- package/components/datepicker/src/DileDatepicker.js +0 -114
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
|
|
3
|
+
export class DileSpinnerBlock extends LitElement {
|
|
4
|
+
static get styles() {
|
|
5
|
+
return css`
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
}
|
|
9
|
+
.loading {
|
|
10
|
+
height: var(--dile-spinner-block-height, 120px);
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: var(--dile-spinner-block-justify-content, center);
|
|
13
|
+
align-items: var(--dile-spinner-block-align-items, center);
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render() {
|
|
19
|
+
return html`
|
|
20
|
+
<section class="loading">
|
|
21
|
+
<dile-spinner active></dile-spinner>
|
|
22
|
+
</section>
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -11,15 +11,18 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export const DileCloseDocumentClick = (SuperClass) =>
|
|
13
13
|
class extends SuperClass {
|
|
14
|
+
|
|
14
15
|
constructor() {
|
|
15
|
-
super()
|
|
16
|
+
super()
|
|
17
|
+
if(!DileCloseDocumentClick.elements) {
|
|
18
|
+
DileCloseDocumentClick.elements = [];
|
|
19
|
+
}
|
|
16
20
|
this.closeDocumentHandler = this.closeAll.bind(this);
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
connectedCallback() {
|
|
20
24
|
super.connectedCallback();
|
|
21
|
-
if (!DileCloseDocumentClick.elements) {
|
|
22
|
-
DileCloseDocumentClick.elements = [];
|
|
25
|
+
if (!DileCloseDocumentClick.elements.length) {
|
|
23
26
|
document.addEventListener("click", this.closeDocumentHandler);
|
|
24
27
|
}
|
|
25
28
|
DileCloseDocumentClick.elements.push(this);
|
|
@@ -40,8 +43,10 @@ export const DileCloseDocumentClick = (SuperClass) =>
|
|
|
40
43
|
* Close all the elements of this type
|
|
41
44
|
*/
|
|
42
45
|
closeAll() {
|
|
43
|
-
|
|
44
|
-
ele.
|
|
46
|
+
if(DileCloseDocumentClick.elements) {
|
|
47
|
+
for (let ele of DileCloseDocumentClick.elements) {
|
|
48
|
+
ele.close();
|
|
49
|
+
}
|
|
45
50
|
}
|
|
46
51
|
}
|
|
47
52
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/ui",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.5",
|
|
4
4
|
"description": "UI Core components from dile-components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "dc75b0e2d5e2c20dcee71f1bf857947a31370836"
|
|
30
30
|
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { css } from 'lit';
|
|
2
|
-
import { LionCalendar } from '@lion/calendar';
|
|
3
|
-
|
|
4
|
-
export class DileCalendar extends LionCalendar {
|
|
5
|
-
static get styles() {
|
|
6
|
-
return [
|
|
7
|
-
super.styles,
|
|
8
|
-
css`
|
|
9
|
-
.calendar__navigation {
|
|
10
|
-
display: flex;
|
|
11
|
-
justify-content: var(--dile-calendar-navigation-justify-content, space-between);
|
|
12
|
-
align-items: center;
|
|
13
|
-
margin-top: 0.4rem;
|
|
14
|
-
}
|
|
15
|
-
.calendar__navigation button {
|
|
16
|
-
min-height: auto;
|
|
17
|
-
min-width: 30px;
|
|
18
|
-
}
|
|
19
|
-
.calendar__navigation h2 {
|
|
20
|
-
margin: 0;
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
min-height: auto;
|
|
24
|
-
font-size: 0.9rem;
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
@media(min-width: 400px) {
|
|
28
|
-
.calendar__navigation h2 {
|
|
29
|
-
font-size: var(--dile-calendar-navigation-text-size, 1.1rem);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
.calendar__day-button {
|
|
33
|
-
min-width: 26px;
|
|
34
|
-
min-height: 26px;
|
|
35
|
-
background-color: var(--dile-calendar-day-background-color, rgba(90, 90, 90, 0.08));
|
|
36
|
-
color: var(--dile-calendar-day-text-color, #303030);
|
|
37
|
-
border-radius: var(--dile-calendar-day-border-radius, 2px);
|
|
38
|
-
}
|
|
39
|
-
.calendar__day-button[today] {
|
|
40
|
-
background-color: var(--dile-calendar-today-background-color, rgba(90, 90, 90, 0.20));
|
|
41
|
-
}
|
|
42
|
-
.calendar__day-button[next-month], .calendar__day-button[previous-month] {
|
|
43
|
-
color: var(--dile-calendar-out-day-text-color, #777);
|
|
44
|
-
opacity: 0.6;
|
|
45
|
-
}
|
|
46
|
-
.calendar__next-button , .calendar__previous-button{
|
|
47
|
-
background-color: transparent;
|
|
48
|
-
color: var(--dile-calendar-nav-buttons-color, #303030);
|
|
49
|
-
font-size: 1.1em;
|
|
50
|
-
}
|
|
51
|
-
@media(min-width: 350px) {
|
|
52
|
-
.calendar__day-button {
|
|
53
|
-
min-width: var(--dile-calendar-day-size, 28px);
|
|
54
|
-
min-height: var(--dile-calendar-day-size, 28px);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
@media(min-width: 400px) {
|
|
58
|
-
.calendar__day-button {
|
|
59
|
-
min-width: var(--dile-calendar-day-size, 32px);
|
|
60
|
-
min-height: var(--dile-calendar-day-size, 32px);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
@media(min-width: 500px) {
|
|
64
|
-
.calendar__day-button {
|
|
65
|
-
min-width: var(--dile-calendar-day-size, 36px);
|
|
66
|
-
min-height: var(--dile-calendar-day-size, 36px);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
`
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { html, css, LitElement } from "lit";
|
|
2
|
-
import { DileInput } from '../../input/index.js';
|
|
3
|
-
import '../../icon/icon.js';
|
|
4
|
-
import { calendarIcon } from '@dile/icons/index.js';
|
|
5
|
-
import '../../menu-overlay/menu-overlay.js';
|
|
6
|
-
import { formatDate } from '@lion/localize';
|
|
7
|
-
|
|
8
|
-
export class DileDatepicker extends DileInput {
|
|
9
|
-
static get styles() {
|
|
10
|
-
return [
|
|
11
|
-
super.styles,
|
|
12
|
-
css`
|
|
13
|
-
div.container {
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: flex-end;
|
|
16
|
-
}
|
|
17
|
-
section.input {
|
|
18
|
-
flex-grow: 1;
|
|
19
|
-
margin-right: 10px;
|
|
20
|
-
}
|
|
21
|
-
dile-icon {
|
|
22
|
-
cursor: pointer;
|
|
23
|
-
--dile-icon-size: var(--dile-datepicker-trigger-size, 36px);
|
|
24
|
-
}
|
|
25
|
-
dile-calendar {
|
|
26
|
-
font-size: var(--dile-datepicker-font-size, 0.9rem);
|
|
27
|
-
}
|
|
28
|
-
dile-menu-overlay {
|
|
29
|
-
--dile-menu-overlay-width: var(--dile-datepicker-width, 280px);
|
|
30
|
-
}
|
|
31
|
-
dile-icon {
|
|
32
|
-
--dile-icon-color: var(--dile-datepicker-trigger-color, #39c);
|
|
33
|
-
}
|
|
34
|
-
dile-icon.trigger-disabled {
|
|
35
|
-
--dile-icon-color: var(--dile-datepicker-trigger-disabled-color, #ccc);
|
|
36
|
-
}
|
|
37
|
-
span {
|
|
38
|
-
display: flex;
|
|
39
|
-
margin-bottom: var(--dile-datepicker-trigger-margin-bottom, 0.2em);
|
|
40
|
-
}
|
|
41
|
-
@media(min-width: 350px) {
|
|
42
|
-
dile-menu-overlay {
|
|
43
|
-
--dile-menu-overlay-width: var(--dile-datepicker-width, 300px);
|
|
44
|
-
--dile-menu-overlay-max-width: var(--dile-datepicker-width, 300px);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
@media(min-width: 450px) {
|
|
48
|
-
dile-menu-overlay {
|
|
49
|
-
--dile-menu-overlay-width: var(--dile-datepicker-width, 320px);
|
|
50
|
-
--dile-menu-overlay-max-width: var(--dile-datepicker-width, 320px);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
@media(min-width: 500px) {
|
|
54
|
-
dile-menu-overlay {
|
|
55
|
-
--dile-menu-overlay-width: var(--dile-datepicker-width, 350px);
|
|
56
|
-
--dile-menu-overlay-max-width: var(--dile-datepicker-width, 350px);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
`];
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static get properties() {
|
|
63
|
-
return {
|
|
64
|
-
firstDayOfWeek: { type: Number },
|
|
65
|
-
horizontalAlign: { type: String },
|
|
66
|
-
verticalAlign: { type: String },
|
|
67
|
-
moveTop: { type: Number },
|
|
68
|
-
moveLeft: { type: Number },
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
constructor() {
|
|
73
|
-
super();
|
|
74
|
-
this.firstDayOfWeek = 0;
|
|
75
|
-
this.horizontalAlign = 'under_right';
|
|
76
|
-
this.verticalAlign = 'center';
|
|
77
|
-
this.moveTop = 0;
|
|
78
|
-
this.moveLeft = 0;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
render() {
|
|
83
|
-
return html`
|
|
84
|
-
<div class="container">
|
|
85
|
-
<section class="input">
|
|
86
|
-
${super.render()}
|
|
87
|
-
</section>
|
|
88
|
-
<span>
|
|
89
|
-
${this.disabled
|
|
90
|
-
? html`<dile-icon class="trigger-disabled" .icon="${calendarIcon}"></dile-icon>`
|
|
91
|
-
: html`
|
|
92
|
-
<dile-menu-overlay moveTop="${this.moveTop}" moveLeft="${this.moveLeft}" verticalAlign="${this.verticalAlign}" horizontalAlign="${this.horizontalAlign}" id="menu">
|
|
93
|
-
<dile-icon .icon="${calendarIcon}" slot="trigger"></dile-icon>
|
|
94
|
-
<div slot="content" class="calendar">
|
|
95
|
-
<dile-calendar
|
|
96
|
-
class="demo-calendar"
|
|
97
|
-
.firstDayOfWeek="${this.firstDayOfWeek}"
|
|
98
|
-
@user-selected-date-changed=${this.showDate}
|
|
99
|
-
></dile-calendar>
|
|
100
|
-
</div>
|
|
101
|
-
</dile-menu-overlay>
|
|
102
|
-
`
|
|
103
|
-
}
|
|
104
|
-
</span>
|
|
105
|
-
</div>
|
|
106
|
-
`;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
showDate(e) {
|
|
110
|
-
let date = formatDate(e.detail.selectedDate);
|
|
111
|
-
this.value = date;
|
|
112
|
-
this.shadowRoot.getElementById('menu').close();
|
|
113
|
-
}
|
|
114
|
-
}
|