@kubex/zinc 1.1.168 → 1.1.170
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/custom-elements.json +1 -39
- package/dist/vscode.html-custom-data.json +0 -10
- package/dist/web-types.json +1 -21
- package/dist/zn.d.ts +0 -8
- package/dist/zn.min.js +67 -69
- package/docs/pages/components/content-block.md +0 -29
- package/package.json +1 -1
- package/src/components/content-block/content-block.component.ts +2 -17
- package/src/components/content-block/content-block.scss +0 -13
- package/src/components/linked-select/linked-select.component.ts +8 -2
- package/src/components/linked-select/linked-select.test.ts +37 -2
|
@@ -52,35 +52,6 @@ layout: component
|
|
|
52
52
|
</zn-content-block>
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
### Subject
|
|
56
|
-
|
|
57
|
-
When a subject is available it is always shown in the header after the sender — expanded or
|
|
58
|
-
collapsed — in place of the truncated body preview. When `subject` is empty,
|
|
59
|
-
`subject-placeholder` is shown dimmed in its place. Omit both attributes to fall back to the
|
|
60
|
-
body preview (e.g. notes).
|
|
61
|
-
|
|
62
|
-
```html:preview
|
|
63
|
-
|
|
64
|
-
<zn-content-block
|
|
65
|
-
time="16 Jun 2025, 13:00"
|
|
66
|
-
sender="John Smith"
|
|
67
|
-
avatar="JS"
|
|
68
|
-
subject="Re: Help with my order"
|
|
69
|
-
>
|
|
70
|
-
<div slot="text">Text formatted message goes here.</div>
|
|
71
|
-
</zn-content-block>
|
|
72
|
-
|
|
73
|
-
<zn-content-block
|
|
74
|
-
time="16 Jun 2025, 13:05"
|
|
75
|
-
sender="John Smith"
|
|
76
|
-
avatar="JS"
|
|
77
|
-
subject=""
|
|
78
|
-
subject-placeholder="This message has no subject."
|
|
79
|
-
>
|
|
80
|
-
<div slot="text">Text formatted message goes here.</div>
|
|
81
|
-
</zn-content-block>
|
|
82
|
-
```
|
|
83
|
-
|
|
84
55
|
### Attachments
|
|
85
56
|
|
|
86
57
|
Attachments render in a row at the bottom of the content and are only visible while the block
|
package/package.json
CHANGED
|
@@ -34,16 +34,6 @@ export default class ContentBlock extends ZincElement {
|
|
|
34
34
|
@property() sender = '';
|
|
35
35
|
@property() avatar = '';
|
|
36
36
|
|
|
37
|
-
/** The message subject, shown in the header after the sender. */
|
|
38
|
-
@property() subject = '';
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Placeholder shown dimmed in place of the subject when `subject` is empty
|
|
42
|
-
* (e.g. "This message has no subject."). Omit both for content without a
|
|
43
|
-
* subject line (e.g. notes).
|
|
44
|
-
*/
|
|
45
|
-
@property({attribute: 'subject-placeholder'}) subjectPlaceholder = '';
|
|
46
|
-
|
|
47
37
|
@property({type: Boolean, reflect: true}) outbound = false;
|
|
48
38
|
|
|
49
39
|
@property({type: Boolean, attribute: "no-collapse"}) noCollapse = false;
|
|
@@ -235,12 +225,7 @@ export default class ContentBlock extends ZincElement {
|
|
|
235
225
|
<span class="content-block-header__caption">
|
|
236
226
|
<slot name="caption">${this.sender}</slot>
|
|
237
227
|
</span>
|
|
238
|
-
|
|
239
|
-
<span class="${classMap({
|
|
240
|
-
'content-block-header__subject': true,
|
|
241
|
-
'content-block-header__subject--empty': !this.subject
|
|
242
|
-
})}">${this.subject || this.subjectPlaceholder}</span>` : html`
|
|
243
|
-
<span class="content-block-header__description">${this.truncateText()}</span>`}
|
|
228
|
+
<span class="content-block-header__description">${this.truncateText()}</span>
|
|
244
229
|
${this.attachmentCount > 0 ? html`
|
|
245
230
|
<span class="content-block-header__attachments" part="header-attachments">
|
|
246
231
|
<zn-icon src="paperclip@lu" size="14"></zn-icon>${this.attachmentCount}
|
|
@@ -265,7 +250,7 @@ export default class ContentBlock extends ZincElement {
|
|
|
265
250
|
</div>
|
|
266
251
|
</div>
|
|
267
252
|
|
|
268
|
-
<zn-sp no-gap flush-x>
|
|
253
|
+
<zn-sp no-gap flush-x flush-t>
|
|
269
254
|
<iframe class="${classMap({'hidden': !initialShowHtml})}" title="Content block HTML preview"></iframe>
|
|
270
255
|
<slot class="html-content" name="html" style="display: none;"></slot>
|
|
271
256
|
<slot name="text" style="display: none;"></slot>
|
|
@@ -51,19 +51,6 @@
|
|
|
51
51
|
text-overflow: ellipsis;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
.content-block-header__subject {
|
|
55
|
-
flex: 1 1 auto;
|
|
56
|
-
min-width: 0;
|
|
57
|
-
font-size: var(--zn-font-size-medium);
|
|
58
|
-
overflow: hidden;
|
|
59
|
-
white-space: nowrap;
|
|
60
|
-
text-overflow: ellipsis;
|
|
61
|
-
|
|
62
|
-
&--empty {
|
|
63
|
-
opacity: 0.5;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
54
|
.content-block-header__description {
|
|
68
55
|
flex: 1 1 auto;
|
|
69
56
|
min-width: 0;
|
|
@@ -152,7 +152,12 @@ export default class ZnLinkedSelect extends ZincElement implements ZincFormContr
|
|
|
152
152
|
// The inner select only auto-selects on slotchange, which lit skips when it
|
|
153
153
|
// can reuse the option elements of the outgoing group, so the first option of
|
|
154
154
|
// the new group is resolved here rather than left to the select.
|
|
155
|
-
|
|
155
|
+
const keys = Object.keys(this.currentOptions());
|
|
156
|
+
if (this.multiple) {
|
|
157
|
+
this.value = keys.length === 1 ? keys : [];
|
|
158
|
+
} else {
|
|
159
|
+
this.value = keys[0] ?? "";
|
|
160
|
+
}
|
|
156
161
|
this.requestUpdate();
|
|
157
162
|
this.formControlController.updateValidity();
|
|
158
163
|
// A host reading the value off change events would otherwise keep the
|
|
@@ -191,6 +196,7 @@ export default class ZnLinkedSelect extends ZincElement implements ZincFormContr
|
|
|
191
196
|
|
|
192
197
|
render() {
|
|
193
198
|
const options = this.currentOptions();
|
|
199
|
+
const placeholder = Object.keys(options).length ? this.placeholder : 'No options available';
|
|
194
200
|
return html`
|
|
195
201
|
<zn-select part="select"
|
|
196
202
|
class="linked-select"
|
|
@@ -201,7 +207,7 @@ export default class ZnLinkedSelect extends ZincElement implements ZincFormContr
|
|
|
201
207
|
?multiple="${this.multiple}"
|
|
202
208
|
?clearable="${this.clearable}"
|
|
203
209
|
?search="${this.search}"
|
|
204
|
-
placeholder="${
|
|
210
|
+
placeholder="${placeholder}"
|
|
205
211
|
help-text="${this.helpText}"
|
|
206
212
|
.value="${this.value}"
|
|
207
213
|
@zn-change=${this.handleSelectChange}
|
|
@@ -57,6 +57,11 @@ describe('<zn-linked-select>', () => {
|
|
|
57
57
|
expect(childOptions(child)).to.deep.equal([]);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
+
it('should say no options are available in the placeholder when the group is empty', async () => {
|
|
61
|
+
const { child } = await group();
|
|
62
|
+
expect(child.input.placeholder).to.equal('No options available');
|
|
63
|
+
});
|
|
64
|
+
|
|
60
65
|
it('should keep an array value when multiple', async () => {
|
|
61
66
|
const { parent, child } = await group(true);
|
|
62
67
|
parent.value = 'cat-1';
|
|
@@ -81,7 +86,7 @@ describe('<zn-linked-select>', () => {
|
|
|
81
86
|
child.value = ['cat-1-a'];
|
|
82
87
|
await child.updateComplete;
|
|
83
88
|
|
|
84
|
-
parent.value = 'cat-
|
|
89
|
+
parent.value = 'cat-1';
|
|
85
90
|
const changed = oneEvent(child, 'zn-change');
|
|
86
91
|
parent.emit('zn-change');
|
|
87
92
|
await changed;
|
|
@@ -94,10 +99,40 @@ describe('<zn-linked-select>', () => {
|
|
|
94
99
|
let changes = 0;
|
|
95
100
|
child.addEventListener('zn-change', () => changes++);
|
|
96
101
|
|
|
97
|
-
parent.value = 'cat-
|
|
102
|
+
parent.value = 'cat-1';
|
|
98
103
|
parent.emit('zn-change');
|
|
99
104
|
await child.updateComplete;
|
|
100
105
|
|
|
101
106
|
expect(changes).to.equal(0);
|
|
102
107
|
});
|
|
108
|
+
|
|
109
|
+
it('should preselect the only option of the linked group', async () => {
|
|
110
|
+
const { parent, child } = await group();
|
|
111
|
+
parent.value = 'cat-2';
|
|
112
|
+
const changed = oneEvent(child, 'zn-change');
|
|
113
|
+
parent.emit('zn-change');
|
|
114
|
+
await changed;
|
|
115
|
+
|
|
116
|
+
expect(child.value).to.equal('cat-2-a');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('should preselect the first option of the linked group', async () => {
|
|
120
|
+
const { parent, child } = await group();
|
|
121
|
+
parent.value = 'cat-1';
|
|
122
|
+
const changed = oneEvent(child, 'zn-change');
|
|
123
|
+
parent.emit('zn-change');
|
|
124
|
+
await changed;
|
|
125
|
+
|
|
126
|
+
expect(child.value).to.equal('cat-1-a');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('should preselect the only option of the linked group when multiple', async () => {
|
|
130
|
+
const { parent, child } = await group(true);
|
|
131
|
+
parent.value = 'cat-2';
|
|
132
|
+
const changed = oneEvent(child, 'zn-change');
|
|
133
|
+
parent.emit('zn-change');
|
|
134
|
+
await changed;
|
|
135
|
+
|
|
136
|
+
expect(child.value).to.deep.equal(['cat-2-a']);
|
|
137
|
+
});
|
|
103
138
|
});
|