@esportsplus/ui 0.24.4 → 0.24.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/build/components/field/index.d.ts +651 -1501
- package/build/components/field/select.d.ts +50 -21
- package/build/components/field/select.js +30 -30
- package/package.json +1 -1
- package/src/components/field/select.ts +103 -101
|
@@ -1,25 +1,54 @@
|
|
|
1
1
|
import { type Attributes, type Renderable } from '@esportsplus/template';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
declare const select: {
|
|
3
|
+
(): ReturnType<(this: {
|
|
4
|
+
options: {
|
|
5
|
+
content: unknown;
|
|
6
|
+
} & Attributes;
|
|
7
|
+
option?: Attributes;
|
|
8
|
+
state: {
|
|
9
|
+
active: boolean;
|
|
10
|
+
error: string;
|
|
11
|
+
render: boolean;
|
|
12
|
+
selected: string | number;
|
|
13
|
+
};
|
|
14
|
+
}, attributes: Readonly<Attributes>, content: Renderable<unknown>) => Renderable<any>>;
|
|
15
|
+
<T extends Attributes>(attributes: T): ReturnType<(this: {
|
|
16
|
+
options: {
|
|
17
|
+
content: unknown;
|
|
18
|
+
} & Attributes;
|
|
19
|
+
option?: Attributes;
|
|
20
|
+
state: {
|
|
21
|
+
active: boolean;
|
|
22
|
+
error: string;
|
|
23
|
+
render: boolean;
|
|
24
|
+
selected: string | number;
|
|
25
|
+
};
|
|
26
|
+
}, attributes: Readonly<Attributes>, content: Renderable<unknown>) => Renderable<any>>;
|
|
27
|
+
<T extends Renderable<unknown>>(content: T): ReturnType<(this: {
|
|
28
|
+
options: {
|
|
29
|
+
content: unknown;
|
|
30
|
+
} & Attributes;
|
|
31
|
+
option?: Attributes;
|
|
32
|
+
state: {
|
|
33
|
+
active: boolean;
|
|
34
|
+
error: string;
|
|
35
|
+
render: boolean;
|
|
36
|
+
selected: string | number;
|
|
37
|
+
};
|
|
38
|
+
}, attributes: Readonly<Attributes>, content: Renderable<unknown>) => Renderable<any>>;
|
|
39
|
+
(attributes: Attributes, content: Renderable<unknown>): ReturnType<(this: {
|
|
40
|
+
options: {
|
|
41
|
+
content: unknown;
|
|
42
|
+
} & Attributes;
|
|
43
|
+
option?: Attributes;
|
|
44
|
+
state: {
|
|
45
|
+
active: boolean;
|
|
46
|
+
error: string;
|
|
47
|
+
render: boolean;
|
|
48
|
+
selected: string | number;
|
|
49
|
+
};
|
|
50
|
+
}, attributes: Readonly<Attributes>, content: Renderable<unknown>) => Renderable<any>>;
|
|
51
|
+
};
|
|
23
52
|
declare const _default: {
|
|
24
53
|
(): ReturnType<(this: {
|
|
25
54
|
attributes?: ({
|
|
@@ -30,13 +30,13 @@ function set(state, value) {
|
|
|
30
30
|
field = null;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
const select = function (attributes, content) {
|
|
33
|
+
const select = template.factory(function (attributes, content) {
|
|
34
34
|
let { option, options, state } = this;
|
|
35
35
|
return html `
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
<label
|
|
37
|
+
class='field-mask field-mask--select'
|
|
38
|
+
${omit(attributes, OMIT_MASK)}
|
|
39
|
+
${{
|
|
40
40
|
onclick: () => {
|
|
41
41
|
if (state.render) {
|
|
42
42
|
set(state, !state.active);
|
|
@@ -44,28 +44,28 @@ const select = function (attributes, content) {
|
|
|
44
44
|
state.render = true;
|
|
45
45
|
}
|
|
46
46
|
}}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
>
|
|
48
|
+
<input class='field-mask-tag field-mask-tag--hidden'
|
|
49
|
+
${{
|
|
50
50
|
name: attributes.name,
|
|
51
51
|
onclick: () => { },
|
|
52
52
|
onrender: form.input.onrender(state),
|
|
53
53
|
value: () => state.selected
|
|
54
54
|
}}
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
${attributes['field-mask-tag']}
|
|
56
|
+
>
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
${content || html `
|
|
59
|
+
<div class='field-mask-text' ${attributes['field-mask-text']}>
|
|
60
|
+
${() => {
|
|
61
61
|
return (options[state.selected]?.content || '-');
|
|
62
62
|
}}
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
</div>
|
|
64
|
+
`}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
<div class='field-mask-arrow' ${attributes['field-mask-arrow']}></div>
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
${() => {
|
|
69
69
|
if (!state.render) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
@@ -93,23 +93,23 @@ const select = function (attributes, content) {
|
|
|
93
93
|
scrollbar: attributes['scrollbar'],
|
|
94
94
|
'scrollbar-container-content': attributes['scrollbar-container-content']
|
|
95
95
|
}, keys.map((key) => html `
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
<div class='link'
|
|
97
|
+
${omit(options[key], OMIT_OPTION)}
|
|
98
|
+
${option}
|
|
99
|
+
${{
|
|
100
100
|
class: () => selected[key] && '--active',
|
|
101
101
|
'data-key': key
|
|
102
102
|
}}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
>
|
|
104
|
+
<span class='--text-truncate --pointer-none'>
|
|
105
|
+
${options[key].content}
|
|
106
|
+
</span>
|
|
107
|
+
</div>
|
|
108
|
+
`));
|
|
109
109
|
}}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
};
|
|
110
|
+
</label>
|
|
111
|
+
`;
|
|
112
|
+
});
|
|
113
113
|
export default template.factory((attributes, content) => {
|
|
114
114
|
let options = attributes.options, state = attributes.state || reactive({
|
|
115
115
|
active: false,
|
package/package.json
CHANGED
|
@@ -51,114 +51,116 @@ function set(state: { active: boolean }, value: boolean) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
const select =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
const select = template.factory(
|
|
55
|
+
function(
|
|
56
|
+
this: {
|
|
57
|
+
options: { content: unknown } & Attributes;
|
|
58
|
+
option?: Attributes;
|
|
59
|
+
state: {
|
|
60
|
+
active: boolean;
|
|
61
|
+
error: string;
|
|
62
|
+
render: boolean;
|
|
63
|
+
selected: string | number;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
attributes: A,
|
|
67
|
+
content: Renderable<unknown>
|
|
68
|
+
) {
|
|
69
|
+
let { option, options, state } = this;
|
|
70
|
+
|
|
71
|
+
return html`
|
|
72
|
+
<label
|
|
73
|
+
class='field-mask field-mask--select'
|
|
74
|
+
${omit(attributes, OMIT_MASK)}
|
|
75
|
+
${{
|
|
76
|
+
onclick: () => {
|
|
77
|
+
if (state.render) {
|
|
78
|
+
set(state, !state.active);
|
|
79
|
+
}
|
|
69
80
|
|
|
70
|
-
|
|
71
|
-
<label
|
|
72
|
-
class='field-mask field-mask--select'
|
|
73
|
-
${omit(attributes, OMIT_MASK)}
|
|
74
|
-
${{
|
|
75
|
-
onclick: () => {
|
|
76
|
-
if (state.render) {
|
|
77
|
-
set(state, !state.active);
|
|
81
|
+
state.render = true;
|
|
78
82
|
}
|
|
79
|
-
|
|
80
|
-
state.render = true;
|
|
81
|
-
}
|
|
82
|
-
}}
|
|
83
|
-
>
|
|
84
|
-
<input class='field-mask-tag field-mask-tag--hidden'
|
|
85
|
-
${{
|
|
86
|
-
name: attributes.name,
|
|
87
|
-
onclick: () => { /* Prevent double click events from firing */ },
|
|
88
|
-
onrender: form.input.onrender(state),
|
|
89
|
-
value: () => state.selected
|
|
90
83
|
}}
|
|
91
|
-
${attributes['field-mask-tag']}
|
|
92
84
|
>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
85
|
+
<input class='field-mask-tag field-mask-tag--hidden'
|
|
86
|
+
${{
|
|
87
|
+
name: attributes.name,
|
|
88
|
+
onclick: () => { /* Prevent double click events from firing */ },
|
|
89
|
+
onrender: form.input.onrender(state),
|
|
90
|
+
value: () => state.selected
|
|
99
91
|
}}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
class: [
|
|
119
|
-
...toArray(attributes['tooltip-content']?.class),
|
|
120
|
-
`tooltip-content tooltip-content--${attributes['tooltip-content']?.direction || 's'} --flex-column --width-full`
|
|
121
|
-
],
|
|
122
|
-
onclick: (e: Event) => {
|
|
123
|
-
let key = (e?.target as HTMLElement)?.dataset?.key;
|
|
124
|
-
|
|
125
|
-
if (key === undefined) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
let previous = state.selected;
|
|
130
|
-
|
|
131
|
-
set(state, false);
|
|
132
|
-
state.selected = key;
|
|
92
|
+
${attributes['field-mask-tag']}
|
|
93
|
+
>
|
|
94
|
+
|
|
95
|
+
${content || html`
|
|
96
|
+
<div class='field-mask-text' ${attributes['field-mask-text']}>
|
|
97
|
+
${() => {
|
|
98
|
+
// @ts-ignore
|
|
99
|
+
return (options[ state.selected ]?.content || '-');
|
|
100
|
+
}}
|
|
101
|
+
</div>
|
|
102
|
+
`}
|
|
103
|
+
|
|
104
|
+
<div class='field-mask-arrow' ${attributes['field-mask-arrow']}></div>
|
|
105
|
+
|
|
106
|
+
${() => {
|
|
107
|
+
if (!state.render) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
133
110
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
111
|
+
let keys = Object.keys(options),
|
|
112
|
+
selected = reactive(
|
|
113
|
+
Object.fromEntries( keys.map(key => [key, false]) )
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
return scrollbar(
|
|
117
|
+
{
|
|
118
|
+
...attributes['tooltip-content'],
|
|
119
|
+
class: [
|
|
120
|
+
...toArray(attributes['tooltip-content']?.class),
|
|
121
|
+
`tooltip-content tooltip-content--${attributes['tooltip-content']?.direction || 's'} --flex-column --width-full`
|
|
122
|
+
],
|
|
123
|
+
onclick: (e: Event) => {
|
|
124
|
+
let key = (e?.target as HTMLElement)?.dataset?.key;
|
|
125
|
+
|
|
126
|
+
if (key === undefined) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
let previous = state.selected;
|
|
131
|
+
|
|
132
|
+
set(state, false);
|
|
133
|
+
state.selected = key;
|
|
134
|
+
|
|
135
|
+
selected[key] = true;
|
|
136
|
+
selected[previous] = false;
|
|
137
|
+
},
|
|
138
|
+
onconnect: () => {
|
|
139
|
+
set(state, true);
|
|
140
|
+
},
|
|
141
|
+
scrollbar: attributes['scrollbar'],
|
|
142
|
+
'scrollbar-container-content': attributes['scrollbar-container-content']
|
|
139
143
|
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
'
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
`;
|
|
161
|
-
};
|
|
144
|
+
keys.map((key) => html`
|
|
145
|
+
<div class='link'
|
|
146
|
+
${omit(options[key] as Attributes, OMIT_OPTION)}
|
|
147
|
+
${option}
|
|
148
|
+
${{
|
|
149
|
+
class: () => selected[key] && '--active',
|
|
150
|
+
'data-key': key
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
<span class='--text-truncate --pointer-none'>
|
|
154
|
+
${(options[key] as any).content}
|
|
155
|
+
</span>
|
|
156
|
+
</div>
|
|
157
|
+
`)
|
|
158
|
+
);
|
|
159
|
+
}}
|
|
160
|
+
</label>
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
163
|
+
);
|
|
162
164
|
|
|
163
165
|
|
|
164
166
|
export default template.factory<
|