@esportsplus/ui 0.21.7 → 0.21.9
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.
|
@@ -16,6 +16,20 @@ const OMIT_MASK = [
|
|
|
16
16
|
'tooltip-content',
|
|
17
17
|
];
|
|
18
18
|
const OMIT_OPTION = ['content'];
|
|
19
|
+
let field = null;
|
|
20
|
+
function set(state, value) {
|
|
21
|
+
state.active = value;
|
|
22
|
+
if (state.active) {
|
|
23
|
+
root.onclick.push(() => state.active = false);
|
|
24
|
+
if (field) {
|
|
25
|
+
field.active = false;
|
|
26
|
+
}
|
|
27
|
+
field = state;
|
|
28
|
+
}
|
|
29
|
+
else if (field === state) {
|
|
30
|
+
field = null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
19
33
|
const select = function (attributes, content) {
|
|
20
34
|
let { option, options, state } = this;
|
|
21
35
|
return html `
|
|
@@ -24,11 +38,10 @@ const select = function (attributes, content) {
|
|
|
24
38
|
${omit(attributes, OMIT_MASK)}
|
|
25
39
|
${{
|
|
26
40
|
onclick: () => {
|
|
27
|
-
state.
|
|
28
|
-
|
|
29
|
-
if (state.active) {
|
|
30
|
-
root.onclick.push(() => state.active = false);
|
|
41
|
+
if (state.render) {
|
|
42
|
+
set(state, !state.active);
|
|
31
43
|
}
|
|
44
|
+
state.render = true;
|
|
32
45
|
}
|
|
33
46
|
}}
|
|
34
47
|
>
|
|
@@ -69,11 +82,14 @@ const select = function (attributes, content) {
|
|
|
69
82
|
return;
|
|
70
83
|
}
|
|
71
84
|
let previous = state.selected;
|
|
85
|
+
set(state, false);
|
|
72
86
|
state.selected = key;
|
|
73
|
-
state.active = false;
|
|
74
87
|
selected[key] = true;
|
|
75
88
|
selected[previous] = false;
|
|
76
89
|
},
|
|
90
|
+
onconnect: () => {
|
|
91
|
+
set(state, true);
|
|
92
|
+
},
|
|
77
93
|
scrollbar: attributes['scrollbar'],
|
|
78
94
|
'scrollbar-container-content': attributes['scrollbar-container-content']
|
|
79
95
|
}, keys.map((key) => html `
|
package/package.json
CHANGED
|
@@ -22,6 +22,27 @@ const OMIT_MASK = [
|
|
|
22
22
|
const OMIT_OPTION = ['content'];
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
let field: { active: boolean } | null = null;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
function set(state: { active: boolean }, value: boolean) {
|
|
29
|
+
state.active = value;
|
|
30
|
+
|
|
31
|
+
if (state.active) {
|
|
32
|
+
root.onclick.push(() => state.active = false);
|
|
33
|
+
|
|
34
|
+
if (field) {
|
|
35
|
+
field.active = false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
field = state;
|
|
39
|
+
}
|
|
40
|
+
else if (field === state) {
|
|
41
|
+
field = null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
25
46
|
const select = function(
|
|
26
47
|
this: {
|
|
27
48
|
options: { content: unknown } & Attributes;
|
|
@@ -49,12 +70,11 @@ const select = function(
|
|
|
49
70
|
${omit(attributes, OMIT_MASK)}
|
|
50
71
|
${{
|
|
51
72
|
onclick: () => {
|
|
52
|
-
state.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (state.active) {
|
|
56
|
-
root.onclick.push(() => state.active = false);
|
|
73
|
+
if (state.render) {
|
|
74
|
+
set(state, !state.active);
|
|
57
75
|
}
|
|
76
|
+
|
|
77
|
+
state.render = true;
|
|
58
78
|
}
|
|
59
79
|
}}
|
|
60
80
|
>
|
|
@@ -105,12 +125,15 @@ const select = function(
|
|
|
105
125
|
|
|
106
126
|
let previous = state.selected;
|
|
107
127
|
|
|
128
|
+
set(state, false);
|
|
108
129
|
state.selected = key;
|
|
109
|
-
state.active = false;
|
|
110
130
|
|
|
111
131
|
selected[key] = true;
|
|
112
132
|
selected[previous] = false;
|
|
113
133
|
},
|
|
134
|
+
onconnect: () => {
|
|
135
|
+
set(state, true);
|
|
136
|
+
},
|
|
114
137
|
scrollbar: attributes['scrollbar'],
|
|
115
138
|
'scrollbar-container-content': attributes['scrollbar-container-content']
|
|
116
139
|
},
|