@onsvisual/svelte-components 0.1.33 → 0.1.35
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/dist/@types/inputs/Select/Select.svelte.d.ts +2 -0
- package/dist/@types/layout/NavSections/NavSection.svelte.d.ts +2 -0
- package/dist/inputs/Select/Select.svelte +8 -1
- package/dist/layout/NavSections/NavSection.svelte +13 -2
- package/dist/layout/NavSections/NavSections.svelte +8 -2
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ export default class Select extends SvelteComponentTyped<{
|
|
|
18
18
|
idKey?: string;
|
|
19
19
|
labelKey?: string;
|
|
20
20
|
groupKey?: string;
|
|
21
|
+
clusterByGroup?: boolean;
|
|
21
22
|
colors?: any[];
|
|
22
23
|
itemFilter?: Function;
|
|
23
24
|
loadOptions?: Function;
|
|
@@ -54,6 +55,7 @@ declare const __propDef: {
|
|
|
54
55
|
idKey?: string;
|
|
55
56
|
labelKey?: string;
|
|
56
57
|
groupKey?: string | null;
|
|
58
|
+
clusterByGroup?: boolean;
|
|
57
59
|
colors?: any[];
|
|
58
60
|
itemFilter?: Function;
|
|
59
61
|
loadOptions?: Function;
|
|
@@ -5,6 +5,7 @@ export default class NavSection extends SvelteComponentTyped<{
|
|
|
5
5
|
id?: string;
|
|
6
6
|
title?: string;
|
|
7
7
|
hideTitle?: boolean;
|
|
8
|
+
subsection?: boolean;
|
|
8
9
|
}, {
|
|
9
10
|
[evt: string]: CustomEvent<any>;
|
|
10
11
|
}, {
|
|
@@ -20,6 +21,7 @@ declare const __propDef: {
|
|
|
20
21
|
id?: string;
|
|
21
22
|
title?: string;
|
|
22
23
|
hideTitle?: boolean;
|
|
24
|
+
subsection?: boolean;
|
|
23
25
|
};
|
|
24
26
|
events: {
|
|
25
27
|
[evt: string]: CustomEvent<any>;
|
|
@@ -78,6 +78,11 @@
|
|
|
78
78
|
* @type {string|null}
|
|
79
79
|
*/
|
|
80
80
|
export let groupKey = null;
|
|
81
|
+
/**
|
|
82
|
+
* Cluster results by group. If {false}, the group name will be the suffix
|
|
83
|
+
* @type {boolean}
|
|
84
|
+
*/
|
|
85
|
+
export let clusterByGroup = false;
|
|
81
86
|
/**
|
|
82
87
|
* Defines the width of the input in characters
|
|
83
88
|
* @type {number}
|
|
@@ -153,6 +158,7 @@
|
|
|
153
158
|
items="{options}"
|
|
154
159
|
itemId="{idKey}"
|
|
155
160
|
label="{labelKey}"
|
|
161
|
+
groupBy="{groupKey && clusterByGroup ? (item) => item[groupKey] : null}"
|
|
156
162
|
showChevron="{!value}"
|
|
157
163
|
multiple="{multiple}"
|
|
158
164
|
clearable="{clearable}"
|
|
@@ -167,7 +173,7 @@
|
|
|
167
173
|
new RegExp(`\\b${filterText}`, "i"),
|
|
168
174
|
(str) => `<b>${str}</b>`
|
|
169
175
|
)}
|
|
170
|
-
{#if groupKey}<span class="item-group">{item[groupKey]}</span>{/if}
|
|
176
|
+
{#if groupKey && !clusterByGroup}<span class="item-group">{item[groupKey]}</span>{/if}
|
|
171
177
|
</div>
|
|
172
178
|
<div slot="empty">{@html noOptionsMessage}</div>
|
|
173
179
|
<div slot="chevron-icon" style:transform="{mode === "search" ? "translateY(2px)" : null}">
|
|
@@ -226,6 +232,7 @@
|
|
|
226
232
|
--multi-item-height: 30px;
|
|
227
233
|
--value-container-padding: 3px 0;
|
|
228
234
|
--multi-select-padding: 0 0 0 6px;
|
|
235
|
+
--group-item-padding-left: 24px;
|
|
229
236
|
}
|
|
230
237
|
:global(.ons-themed-select > .svelte-select:focus-within) {
|
|
231
238
|
outline: 3px solid #fbc900;
|
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
* @type {boolean}
|
|
19
19
|
*/
|
|
20
20
|
export let hideTitle = false;
|
|
21
|
+
/**
|
|
22
|
+
* Treat a section as sub-section. It will have an h3 title, and will be indented in the contents table
|
|
23
|
+
* @type {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export let subsection = false;
|
|
21
26
|
|
|
22
27
|
const sections = getContext("sections");
|
|
23
28
|
const observer = getContext("observer");
|
|
@@ -27,7 +32,7 @@
|
|
|
27
32
|
|
|
28
33
|
onMount(() => {
|
|
29
34
|
if (sections && observer) {
|
|
30
|
-
$sections = [...$sections, { title, id }];
|
|
35
|
+
$sections = [...$sections, { title, id, subsection }];
|
|
31
36
|
$observer.observe(section);
|
|
32
37
|
}
|
|
33
38
|
});
|
|
@@ -42,7 +47,13 @@
|
|
|
42
47
|
|
|
43
48
|
<section id="{id}" aria-label="{title}" bind:this="{section}">
|
|
44
49
|
{#if title}
|
|
45
|
-
|
|
50
|
+
{#if subsection}
|
|
51
|
+
<h3 class="subsection-title ons-u-fs-m" class:ons-u-vh="{hideTitle}">{title}</h3>
|
|
52
|
+
{:else}
|
|
53
|
+
<h2 class="section-title ons-u-mt-l ons-u-pb-no ons-u-pt-no" class:ons-u-vh="{hideTitle}">
|
|
54
|
+
{title}
|
|
55
|
+
</h2>
|
|
56
|
+
{/if}
|
|
46
57
|
{/if}
|
|
47
58
|
<slot />
|
|
48
59
|
{#if tocId}
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
{/if}
|
|
115
115
|
<ol class="ons-list ons-u-mb-m ons-list--dashed">
|
|
116
116
|
{#each $sections as section}
|
|
117
|
-
<li class="ons-list__item">
|
|
117
|
+
<li class="ons-list__item" class:ons-list__item-indented="{section.subsection}">
|
|
118
118
|
<a
|
|
119
119
|
href="#{section.id}"
|
|
120
120
|
class="ons-list__link"
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
</nav>
|
|
131
131
|
</aside>
|
|
132
132
|
</div>
|
|
133
|
-
<div class="ons-grid__col ons-col-8@m ons-u-pl-no">
|
|
133
|
+
<div class="ons-nav-sections ons-grid__col ons-col-8@m ons-u-pl-no">
|
|
134
134
|
<slot name="before" />
|
|
135
135
|
{#if $observer}
|
|
136
136
|
<slot />
|
|
@@ -151,4 +151,10 @@
|
|
|
151
151
|
max-width: calc(100% - 280px);
|
|
152
152
|
width: calc(100% - 280px);
|
|
153
153
|
}
|
|
154
|
+
}
|
|
155
|
+
.ons-list__item-indented {
|
|
156
|
+
margin-left: 50px !important;
|
|
157
|
+
}
|
|
158
|
+
.ons-nav-sections :global(section:first-of-type h2) {
|
|
159
|
+
margin-top: 27px !important;
|
|
154
160
|
}</style>
|