@nethserver/ns8-ui-lib 0.0.98 → 0.1.1
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/ns8-ui-lib.esm.js +1410 -497
- package/dist/ns8-ui-lib.min.js +1 -1
- package/dist/ns8-ui-lib.ssr.js +1188 -522
- package/package.json +1 -1
- package/src/lib-components/NsCheckbox.vue +113 -0
- package/src/lib-components/NsComboBox.vue +579 -0
- package/src/lib-components/NsDataTable.vue +12 -3
- package/src/lib-components/NsMultiSelect.vue +63 -2
- package/src/lib-components/NsTag.vue +1 -0
- package/src/lib-components/NsTextInput.vue +8 -6
|
@@ -380,6 +380,7 @@ export default {
|
|
|
380
380
|
backwardText: { type: String, default: undefined },
|
|
381
381
|
forwardText: { type: String, default: undefined },
|
|
382
382
|
pageNumberLabel: { type: String, default: undefined },
|
|
383
|
+
filterRowsCallback: { type: Function }
|
|
383
384
|
},
|
|
384
385
|
data() {
|
|
385
386
|
return {
|
|
@@ -455,9 +456,17 @@ export default {
|
|
|
455
456
|
}
|
|
456
457
|
},
|
|
457
458
|
filterRows() {
|
|
459
|
+
if (this.filterRowsCallback) {
|
|
460
|
+
// call custom filterRows function
|
|
461
|
+
this.filteredRows = this.filterRowsCallback(this.searchFilter);
|
|
462
|
+
} else {
|
|
463
|
+
this.filteredRows = this.defaultFilterRows();
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
defaultFilterRows() {
|
|
458
467
|
if (!this.searchFilter) {
|
|
459
|
-
|
|
460
|
-
} else
|
|
468
|
+
return this.allRows;
|
|
469
|
+
} else {
|
|
461
470
|
// clean query
|
|
462
471
|
const cleanRegex = /[^a-zA-Z0-9]/g;
|
|
463
472
|
const queryText = this.searchFilter.replace(cleanRegex, "");
|
|
@@ -486,7 +495,7 @@ export default {
|
|
|
486
495
|
}
|
|
487
496
|
});
|
|
488
497
|
}, this);
|
|
489
|
-
|
|
498
|
+
return searchResults;
|
|
490
499
|
}
|
|
491
500
|
},
|
|
492
501
|
paginateTable(ev) {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
[`${carbonPrefix}--multi-select__wrapper--inline--invalid ${carbonPrefix}--list-box__wrapper--inline--invalid`]:
|
|
9
9
|
inline && isInvalid,
|
|
10
10
|
[`${carbonPrefix}--multi-select--filterable`]: filterable,
|
|
11
|
+
'margin-bottom-on-open': marginBottomOnOpenEnabled,
|
|
11
12
|
},
|
|
12
13
|
]"
|
|
13
14
|
@focusout="onFocusOut"
|
|
@@ -19,8 +20,24 @@
|
|
|
19
20
|
`${carbonPrefix}--label`,
|
|
20
21
|
{ [`${carbonPrefix}--label--disabled`]: disabled },
|
|
21
22
|
]"
|
|
22
|
-
>{{ title }}</label
|
|
23
23
|
>
|
|
24
|
+
<div class="label-with-tooltip">
|
|
25
|
+
<span>
|
|
26
|
+
{{ title }}
|
|
27
|
+
</span>
|
|
28
|
+
<!-- tooltip -->
|
|
29
|
+
<cv-interactive-tooltip
|
|
30
|
+
v-if="hasTooltipSlot"
|
|
31
|
+
:alignment="tooltipAlignment"
|
|
32
|
+
:direction="tooltipDirection"
|
|
33
|
+
class="info"
|
|
34
|
+
>
|
|
35
|
+
<template slot="content">
|
|
36
|
+
<slot name="tooltip"></slot>
|
|
37
|
+
</template>
|
|
38
|
+
</cv-interactive-tooltip>
|
|
39
|
+
</div>
|
|
40
|
+
</label>
|
|
24
41
|
|
|
25
42
|
<div
|
|
26
43
|
role="listbox"
|
|
@@ -102,13 +119,14 @@
|
|
|
102
119
|
@input="onInput"
|
|
103
120
|
@focus="inputFocus"
|
|
104
121
|
@click.stop.prevent="inputClick"
|
|
122
|
+
:disabled="disabled"
|
|
105
123
|
/>
|
|
106
124
|
<div
|
|
107
125
|
v-if="filter.length > 0"
|
|
108
126
|
role="button"
|
|
109
127
|
:class="`${carbonPrefix}--list-box__selection`"
|
|
110
128
|
tabindex="0"
|
|
111
|
-
title="
|
|
129
|
+
:title="clearFilterLabel"
|
|
112
130
|
@click.stop="clearFilter"
|
|
113
131
|
@keydown.enter.stop.prevent="clearFilter"
|
|
114
132
|
@keydown.space.stop.prevent
|
|
@@ -194,6 +212,7 @@
|
|
|
194
212
|
:key="item.value"
|
|
195
213
|
:label="item.label"
|
|
196
214
|
:kind="selectedItemsColor"
|
|
215
|
+
:disabled="disabled"
|
|
197
216
|
class="selected-item"
|
|
198
217
|
/>
|
|
199
218
|
</div>
|
|
@@ -282,6 +301,7 @@ export default {
|
|
|
282
301
|
showSelectedItems: { type: Boolean, default: true },
|
|
283
302
|
unselectAriaLabel: { type: String, default: "Unselect" },
|
|
284
303
|
clearSelectionAriaLabel: { type: String, default: "Clear selection" },
|
|
304
|
+
clearFilterLabel: { type: String, default: "Clear filter" },
|
|
285
305
|
selectedLabel: { type: String, default: "selected" },
|
|
286
306
|
userInputLabel: { type: String, default: "user input" },
|
|
287
307
|
// limit the number of options to be displayed
|
|
@@ -290,6 +310,17 @@ export default {
|
|
|
290
310
|
showItemType: { type: Boolean, default: false },
|
|
291
311
|
// use cv-tag color
|
|
292
312
|
selectedItemsColor: { type: String, default: "high-contrast" },
|
|
313
|
+
marginBottomOnOpen: { type: Boolean, default: false },
|
|
314
|
+
tooltipAlignment: {
|
|
315
|
+
type: String,
|
|
316
|
+
default: "start",
|
|
317
|
+
validator: (val) => ["start", "center", "end"].includes(val),
|
|
318
|
+
},
|
|
319
|
+
tooltipDirection: {
|
|
320
|
+
type: String,
|
|
321
|
+
default: "bottom",
|
|
322
|
+
validator: (val) => ["top", "left", "bottom", "right".includes(val)],
|
|
323
|
+
},
|
|
293
324
|
},
|
|
294
325
|
data() {
|
|
295
326
|
return {
|
|
@@ -302,6 +333,7 @@ export default {
|
|
|
302
333
|
dataFilter: "",
|
|
303
334
|
isHelper: false,
|
|
304
335
|
isInvalid: false,
|
|
336
|
+
marginBottomOnOpenEnabled: false,
|
|
305
337
|
};
|
|
306
338
|
},
|
|
307
339
|
model: {
|
|
@@ -328,6 +360,19 @@ export default {
|
|
|
328
360
|
selectionFeedback() {
|
|
329
361
|
this.updateOptions();
|
|
330
362
|
},
|
|
363
|
+
open() {
|
|
364
|
+
if (this.marginBottomOnOpen) {
|
|
365
|
+
if (this.open) {
|
|
366
|
+
setTimeout(() => {
|
|
367
|
+
this.marginBottomOnOpenEnabled = true;
|
|
368
|
+
}, 300);
|
|
369
|
+
} else {
|
|
370
|
+
setTimeout(() => {
|
|
371
|
+
this.marginBottomOnOpenEnabled = false;
|
|
372
|
+
}, 300);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
},
|
|
331
376
|
},
|
|
332
377
|
created() {
|
|
333
378
|
this.internalOptions = _cloneDeep(this.options);
|
|
@@ -388,6 +433,9 @@ export default {
|
|
|
388
433
|
this.internalOptions.find((opt) => opt.value === val)
|
|
389
434
|
);
|
|
390
435
|
},
|
|
436
|
+
hasTooltipSlot() {
|
|
437
|
+
return !!this.$slots.tooltip;
|
|
438
|
+
},
|
|
391
439
|
},
|
|
392
440
|
methods: {
|
|
393
441
|
checkSlots() {
|
|
@@ -649,6 +697,15 @@ export default {
|
|
|
649
697
|
margin-left: 0;
|
|
650
698
|
margin-bottom: 0.25rem;
|
|
651
699
|
}
|
|
700
|
+
|
|
701
|
+
.margin-bottom-on-open {
|
|
702
|
+
margin-bottom: 14rem;
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
.label-with-tooltip {
|
|
706
|
+
display: flex;
|
|
707
|
+
align-items: baseline;
|
|
708
|
+
}
|
|
652
709
|
</style>
|
|
653
710
|
|
|
654
711
|
<style lang="scss">
|
|
@@ -658,4 +715,8 @@ export default {
|
|
|
658
715
|
position: relative;
|
|
659
716
|
right: 1px;
|
|
660
717
|
}
|
|
718
|
+
|
|
719
|
+
.ns-multi-select .bx--tooltip__label .bx--tooltip__trigger {
|
|
720
|
+
margin-left: 0.25rem;
|
|
721
|
+
}
|
|
661
722
|
</style>
|
|
@@ -19,14 +19,16 @@
|
|
|
19
19
|
},
|
|
20
20
|
]"
|
|
21
21
|
>
|
|
22
|
-
<div>
|
|
23
|
-
|
|
22
|
+
<div class="label-with-tooltip">
|
|
23
|
+
<span>
|
|
24
|
+
{{ label }}
|
|
25
|
+
</span>
|
|
24
26
|
<!-- tooltip -->
|
|
25
27
|
<cv-interactive-tooltip
|
|
26
28
|
v-if="hasTooltipSlot"
|
|
27
29
|
:alignment="tooltipAlignment"
|
|
28
30
|
:direction="tooltipDirection"
|
|
29
|
-
class="
|
|
31
|
+
class="info"
|
|
30
32
|
>
|
|
31
33
|
<template slot="content">
|
|
32
34
|
<slot name="tooltip"></slot>
|
|
@@ -158,9 +160,9 @@ export default {
|
|
|
158
160
|
</script>
|
|
159
161
|
|
|
160
162
|
<style scoped lang="scss">
|
|
161
|
-
.tooltip {
|
|
162
|
-
display:
|
|
163
|
-
|
|
163
|
+
.label-with-tooltip {
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: baseline;
|
|
164
166
|
}
|
|
165
167
|
|
|
166
168
|
.prefix {
|