vira 25.13.1 → 25.15.0
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/elements/pop-up/pop-up-menu-item.d.ts +10 -8
- package/dist/elements/pop-up/vira-menu-trigger.element.js +5 -1
- package/dist/elements/pop-up/vira-menu.element.js +43 -19
- package/dist/elements/table/create-table.d.ts +26 -21
- package/dist/elements/table/create-table.js +4 -4
- package/dist/elements/table/vira-table.element.d.ts +14 -7
- package/dist/elements/table/vira-table.element.js +115 -59
- package/dist/elements/vira-dropdown.element.d.ts +0 -5
- package/dist/elements/vira-dropdown.element.js +3 -8
- package/dist/elements/vira-link.element.d.ts +11 -5
- package/package.json +7 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
2
|
import { type HTMLTemplateResult } from 'element-vir';
|
|
3
|
+
import { type ViraLinkRoute } from '../vira-link.element.js';
|
|
3
4
|
/**
|
|
4
5
|
* An individual menu item consumed partially by `ViraMenuItem` and used by `ViraMenu`.
|
|
5
6
|
*
|
|
@@ -8,17 +9,18 @@ import { type HTMLTemplateResult } from 'element-vir';
|
|
|
8
9
|
export type MenuItem = {
|
|
9
10
|
/** Each `id` must be unique across all items in a single menu. */
|
|
10
11
|
id: PropertyKey;
|
|
11
|
-
/** The user-facing label for this menu item. */
|
|
12
|
-
label: string;
|
|
13
|
-
} & PartialWithUndefined<{
|
|
14
|
-
disabled: boolean;
|
|
15
|
-
/** Text assigned to the `title` HTML attribute that'll show on long hover. */
|
|
16
|
-
titleText: string;
|
|
17
12
|
/**
|
|
18
|
-
*
|
|
13
|
+
* The user-facing label for this menu item.
|
|
14
|
+
*
|
|
15
|
+
* Optionally, this can be a custom HTML template. This will replace the menu item text and icon
|
|
19
16
|
* content, but will still be styled correctly if used within `ViraMenu`. Feel free to use
|
|
20
17
|
* `ViraMenuItem` as the template with a custom `<slot>` to keep the selected checkmark
|
|
21
18
|
* functionality.
|
|
22
19
|
*/
|
|
23
|
-
|
|
20
|
+
label: string | HTMLTemplateResult;
|
|
21
|
+
} & PartialWithUndefined<{
|
|
22
|
+
route: ViraLinkRoute;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
/** Text assigned to the `title` HTML attribute that'll show on long hover. */
|
|
25
|
+
titleText: string;
|
|
24
26
|
}>;
|
|
@@ -77,7 +77,11 @@ export const ViraMenuTrigger = defineViraElement()({
|
|
|
77
77
|
}
|
|
78
78
|
dispatch(new events.itemActivate(updateSelectedItems(item, inputs.selected, inputs.isMultiSelect)));
|
|
79
79
|
if (!inputs.isMultiSelect) {
|
|
80
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Defer pop up removal to prevent race conditions with element-internal
|
|
82
|
+
* click handlers.
|
|
83
|
+
*/
|
|
84
|
+
globalThis.setTimeout(() => state.popUpManager?.removePopUp());
|
|
81
85
|
}
|
|
82
86
|
})}
|
|
83
87
|
>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { check } from '@augment-vir/assert';
|
|
1
2
|
import { nav, navAttribute, NavController, NavValue } from 'device-navigation';
|
|
2
3
|
import { classMap, css, html, ifDefined, testId } from 'element-vir';
|
|
3
4
|
import { viraFormCssVars } from '../../styles/form-themes.js';
|
|
4
5
|
import { noNativeFormStyles, viraDisabledStyles } from '../../styles/index.js';
|
|
5
6
|
import { defineViraElement } from '../define-vira-element.js';
|
|
7
|
+
import { ViraLink } from '../vira-link.element.js';
|
|
6
8
|
import { assertUniqueIdProps } from './pop-up-helpers.js';
|
|
7
9
|
import { ViraMenuItem } from './vira-menu-item.element.js';
|
|
8
10
|
/**
|
|
@@ -47,7 +49,8 @@ export const ViraMenu = defineViraElement()({
|
|
|
47
49
|
|
|
48
50
|
.menu-item {
|
|
49
51
|
${noNativeFormStyles};
|
|
50
|
-
background-color
|
|
52
|
+
will-change: background-color;
|
|
53
|
+
background-color: inherit;
|
|
51
54
|
outline: none;
|
|
52
55
|
cursor: pointer;
|
|
53
56
|
}
|
|
@@ -99,29 +102,50 @@ export const ViraMenu = defineViraElement()({
|
|
|
99
102
|
assertUniqueIdProps(inputs.items);
|
|
100
103
|
const itemTemplates = inputs.items.map((item) => {
|
|
101
104
|
const selected = !!inputs.selected?.includes(item.id);
|
|
102
|
-
const innerTemplate = item.
|
|
103
|
-
html `
|
|
104
|
-
|
|
105
|
+
const innerTemplate = check.isString(item.label)
|
|
106
|
+
? html `
|
|
107
|
+
<${ViraMenuItem.assign({
|
|
105
108
|
label: item.label,
|
|
106
109
|
selected,
|
|
107
110
|
hideCheckIcon: inputs.hideCheckIcons,
|
|
108
111
|
})}></${ViraMenuItem}>
|
|
109
|
-
|
|
112
|
+
`
|
|
113
|
+
: item.label;
|
|
110
114
|
const disabled = item.disabled || (!inputs.isMultiSelect && selected);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
if (item.route) {
|
|
116
|
+
return html `
|
|
117
|
+
<${ViraLink.assign({
|
|
118
|
+
route: item.route,
|
|
119
|
+
})}
|
|
120
|
+
class="menu-item ${classMap({
|
|
121
|
+
disabled: !!item.disabled,
|
|
122
|
+
selected,
|
|
123
|
+
})}"
|
|
124
|
+
${testId(viraMenuTestIds.item)}
|
|
125
|
+
title=${ifDefined(item.titleText || undefined)}
|
|
126
|
+
role="option"
|
|
127
|
+
${nav(state.internalNavController, { disabled })}
|
|
128
|
+
>
|
|
129
|
+
${innerTemplate}
|
|
130
|
+
</${ViraLink}>
|
|
131
|
+
`;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return html `
|
|
135
|
+
<button
|
|
136
|
+
class="menu-item ${classMap({
|
|
137
|
+
disabled: !!item.disabled,
|
|
138
|
+
selected,
|
|
139
|
+
})}"
|
|
140
|
+
${testId(viraMenuTestIds.item)}
|
|
141
|
+
title=${ifDefined(item.titleText || undefined)}
|
|
142
|
+
role="option"
|
|
143
|
+
${nav(state.internalNavController, { disabled })}
|
|
144
|
+
>
|
|
145
|
+
${innerTemplate}
|
|
146
|
+
</button>
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
125
149
|
});
|
|
126
150
|
return html `
|
|
127
151
|
${itemTemplates}
|
|
@@ -5,48 +5,53 @@ import { type HtmlInterpolation } from 'element-vir';
|
|
|
5
5
|
*
|
|
6
6
|
* @category Internal
|
|
7
7
|
*/
|
|
8
|
-
export type
|
|
8
|
+
export type ViraTableCells<Keys extends ViraTableKeys | undefined = undefined> = undefined extends Keys ? Record<PropertyKey, HtmlInterpolation> : Record<ArrayElement<Exclude<Keys, undefined>>['key'], HtmlInterpolation>;
|
|
9
9
|
/**
|
|
10
|
-
* An individual
|
|
10
|
+
* An individual key definition in {@link ViraTableKeys}. In default table orientation, this will
|
|
11
|
+
* define each column's key. In horizontal orientation, this will define each row's key.
|
|
11
12
|
*
|
|
12
13
|
* @category Internal
|
|
13
14
|
*/
|
|
14
|
-
export type
|
|
15
|
-
/** The key that cells must
|
|
15
|
+
export type ViraTableKey = Readonly<{
|
|
16
|
+
/** The key that cells must set a value to. */
|
|
16
17
|
key: PropertyKey;
|
|
17
18
|
} & PartialWithUndefined<{
|
|
18
19
|
/**
|
|
19
|
-
* This will be displayed in the header for this
|
|
20
|
-
*
|
|
20
|
+
* This will be displayed in the header for this key. If no `label` is provided, the `key`
|
|
21
|
+
* will be used.
|
|
21
22
|
*/
|
|
22
23
|
label: HtmlInterpolation;
|
|
23
|
-
/** If set to `true`, this
|
|
24
|
+
/** If set to `true`, all cells for this key will not be rendered. */
|
|
24
25
|
hide: boolean;
|
|
25
|
-
/**
|
|
26
|
+
/** In horizontal table orientation, this prevents this key's row from being clicked. */
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
/** If true, will be rendered as headers. */
|
|
26
29
|
isHeader: boolean;
|
|
27
30
|
}>>;
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
32
|
+
* All key definitions for a {@link ViraTableSetup} instance. In default table orientation, these
|
|
33
|
+
* will define each column. In horizontal orientation, this will define each row header.
|
|
30
34
|
*
|
|
31
35
|
* @category Internal
|
|
32
36
|
*/
|
|
33
|
-
export type
|
|
37
|
+
export type ViraTableKeys = ReadonlyArray<ViraTableKey>;
|
|
34
38
|
/**
|
|
35
|
-
* An individual
|
|
39
|
+
* An individual entry in {@link ViraTableSetup}. In default table orientation, this will be a row.
|
|
40
|
+
* In horizontal orientation, this will be a column.
|
|
36
41
|
*
|
|
37
42
|
* @category Internal
|
|
38
43
|
*/
|
|
39
|
-
export type
|
|
40
|
-
cells:
|
|
44
|
+
export type ViraTableEntry<Keys extends ViraTableKeys | undefined = undefined> = {
|
|
45
|
+
cells: ViraTableCells<Keys>;
|
|
41
46
|
} & PartialWithUndefined<{
|
|
42
47
|
/**
|
|
43
|
-
* If `true`, no actions will be fired from this
|
|
48
|
+
* If `true`, no actions will be fired from this entry (like clicks). No disable styles are
|
|
44
49
|
* applied.
|
|
45
50
|
*
|
|
46
51
|
* @default false
|
|
47
52
|
*/
|
|
48
53
|
disabled: boolean;
|
|
49
|
-
/** Optional: keep track of which
|
|
54
|
+
/** Optional: keep track of which entry is which by attaching an id to it. */
|
|
50
55
|
id: PropertyKey;
|
|
51
56
|
}>;
|
|
52
57
|
/**
|
|
@@ -55,15 +60,15 @@ export type ViraTableRow<Columns extends ViraTableColumns | undefined = undefine
|
|
|
55
60
|
* @category Internal
|
|
56
61
|
*/
|
|
57
62
|
export type ViraTableSetup = Readonly<{
|
|
58
|
-
/** The order of these
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
/** The order of these keys determines the order that they render in. */
|
|
64
|
+
keys: ViraTableKeys;
|
|
65
|
+
entries: ReadonlyArray<Readonly<ViraTableEntry>>;
|
|
61
66
|
}>;
|
|
62
67
|
/**
|
|
63
68
|
* Create a type-safe {@link ViraTableSetup} object to be used with the `ViraTable` element.
|
|
64
69
|
*
|
|
65
70
|
* @category Internal
|
|
66
71
|
*/
|
|
67
|
-
export declare function createTable<const
|
|
68
|
-
/** The order of these
|
|
69
|
-
|
|
72
|
+
export declare function createTable<const Keys extends ViraTableKeys>(
|
|
73
|
+
/** The order of these keys determines the order that they render in. */
|
|
74
|
+
keys: Readonly<Keys>, entries: ReadonlyArray<Readonly<ViraTableEntry<Keys>>>): ViraTableSetup;
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* @category Internal
|
|
5
5
|
*/
|
|
6
6
|
export function createTable(
|
|
7
|
-
/** The order of these
|
|
8
|
-
|
|
7
|
+
/** The order of these keys determines the order that they render in. */
|
|
8
|
+
keys, entries) {
|
|
9
9
|
return {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
keys,
|
|
11
|
+
entries,
|
|
12
12
|
};
|
|
13
13
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
2
|
import { type AttributeValues, type CSSResult } from 'element-vir';
|
|
3
|
-
import { type
|
|
3
|
+
import { type ViraTableEntry, type ViraTableSetup } from './create-table.js';
|
|
4
4
|
/**
|
|
5
5
|
* Element tagnames that have passthroughs setup for them in {@link ViraTable}.
|
|
6
6
|
*
|
|
@@ -22,11 +22,17 @@ export declare const ViraTable: import("element-vir").DeclarativeElementDefiniti
|
|
|
22
22
|
table: ViraTableSetup;
|
|
23
23
|
} & PartialWithUndefined<{
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Key headers are rendered on the left, rows become columns.
|
|
26
26
|
*
|
|
27
27
|
* @default false
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
horizontalOrientation: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Allow all rows to be clickable. Each row can override this for itself.
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
allowRowClicks: boolean;
|
|
30
36
|
/**
|
|
31
37
|
* Block the sticky table header.
|
|
32
38
|
*
|
|
@@ -34,13 +40,14 @@ export declare const ViraTable: import("element-vir").DeclarativeElementDefiniti
|
|
|
34
40
|
*/
|
|
35
41
|
preventStickyHeader: boolean;
|
|
36
42
|
/**
|
|
37
|
-
* Hide header row
|
|
43
|
+
* Hide header row (in default orientation) or column (in horizontal orientation)
|
|
44
|
+
* entirely.
|
|
38
45
|
*
|
|
39
46
|
* @default false
|
|
40
47
|
*/
|
|
41
|
-
|
|
48
|
+
hideKeyHeaders: boolean;
|
|
42
49
|
/**
|
|
43
|
-
* Pixel value of the header
|
|
50
|
+
* Pixel value of the header's sticky offset.
|
|
44
51
|
*
|
|
45
52
|
* @default 0
|
|
46
53
|
*/
|
|
@@ -51,7 +58,7 @@ export declare const ViraTable: import("element-vir").DeclarativeElementDefiniti
|
|
|
51
58
|
stylePassthrough: Readonly<PartialWithUndefined<Record<ViraTableElementsForPassthrough, CSSResult>>>;
|
|
52
59
|
}>>, {}, {
|
|
53
60
|
rowClick: import("element-vir").DefineEvent<{
|
|
54
|
-
|
|
61
|
+
entry: ViraTableEntry;
|
|
55
62
|
originalEvent: MouseEvent;
|
|
56
63
|
}>;
|
|
57
64
|
}, "vira-table-", "vira-table-", readonly []>;
|
|
@@ -54,65 +54,117 @@ export const ViraTable = defineViraElement()({
|
|
|
54
54
|
rowClick: defineElementEvent(),
|
|
55
55
|
},
|
|
56
56
|
render({ inputs, events, dispatch }) {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
if (
|
|
57
|
+
const rowTemplates = inputs.horizontalOrientation
|
|
58
|
+
? inputs.table.keys.map((key) => {
|
|
59
|
+
if (key.hide) {
|
|
60
60
|
return nothing;
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const cells = inputs.table.entries.map((entry) => {
|
|
63
|
+
const cellElement = key.isHeader ? 'th' : 'td';
|
|
64
|
+
return html `
|
|
65
|
+
<${cellElement}
|
|
66
|
+
${listen('click', (event) => {
|
|
67
|
+
if (isClickable) {
|
|
68
|
+
dispatch(new events.rowClick({ originalEvent: event, entry: entry }));
|
|
69
|
+
}
|
|
70
|
+
})}
|
|
71
|
+
${key.isHeader
|
|
72
|
+
? inputs.attributePassthrough?.th
|
|
73
|
+
? attributes(inputs.attributePassthrough.th)
|
|
74
|
+
: nothing
|
|
75
|
+
: inputs.attributePassthrough?.td
|
|
76
|
+
? attributes(inputs.attributePassthrough.td)
|
|
77
|
+
: nothing}
|
|
78
|
+
style=${key.isHeader
|
|
79
|
+
? ifDefined(inputs.stylePassthrough?.th)
|
|
80
|
+
: ifDefined(inputs.stylePassthrough?.td)}
|
|
81
|
+
>
|
|
82
|
+
${entry.cells[key.key]}
|
|
83
|
+
</${cellElement}>
|
|
84
|
+
`;
|
|
85
|
+
});
|
|
86
|
+
const isClickable = !!inputs.allowRowClicks && !key.disabled;
|
|
63
87
|
return html `
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
<tr
|
|
89
|
+
class=${classMap({
|
|
90
|
+
clickable: isClickable,
|
|
91
|
+
})}
|
|
92
|
+
${inputs.attributePassthrough?.tr
|
|
93
|
+
? attributes(inputs.attributePassthrough.tr)
|
|
94
|
+
: nothing}
|
|
95
|
+
style=${ifDefined(inputs.stylePassthrough?.tr)}
|
|
96
|
+
>
|
|
97
|
+
<th
|
|
98
|
+
${inputs.attributePassthrough?.th
|
|
99
|
+
? attributes(inputs.attributePassthrough.th)
|
|
100
|
+
: nothing}
|
|
101
|
+
style=${ifDefined(inputs.stylePassthrough?.th)}
|
|
102
|
+
>
|
|
103
|
+
${key.label}
|
|
104
|
+
</th>
|
|
105
|
+
${cells}
|
|
106
|
+
</tr>
|
|
107
|
+
`;
|
|
108
|
+
})
|
|
109
|
+
: inputs.table.entries.map((entry) => {
|
|
110
|
+
const cells = inputs.table.keys.map((key) => {
|
|
111
|
+
if (key.hide) {
|
|
112
|
+
return nothing;
|
|
113
|
+
}
|
|
114
|
+
const cellElement = key.isHeader ? 'th' : 'td';
|
|
115
|
+
return html `
|
|
116
|
+
<${cellElement}
|
|
117
|
+
${key.isHeader
|
|
118
|
+
? inputs.attributePassthrough?.th
|
|
119
|
+
? attributes(inputs.attributePassthrough.th)
|
|
120
|
+
: nothing
|
|
121
|
+
: inputs.attributePassthrough?.td
|
|
122
|
+
? attributes(inputs.attributePassthrough.td)
|
|
123
|
+
: nothing}
|
|
124
|
+
style=${key.isHeader
|
|
125
|
+
? ifDefined(inputs.stylePassthrough?.th)
|
|
126
|
+
: ifDefined(inputs.stylePassthrough?.td)}
|
|
127
|
+
>
|
|
128
|
+
${entry.cells[key.key]}
|
|
129
|
+
</${cellElement}>
|
|
130
|
+
`;
|
|
131
|
+
});
|
|
132
|
+
const isClickable = !!inputs.allowRowClicks && !entry.disabled;
|
|
133
|
+
return html `
|
|
134
|
+
<tr
|
|
135
|
+
class=${classMap({
|
|
136
|
+
clickable: isClickable,
|
|
137
|
+
})}
|
|
138
|
+
${inputs.attributePassthrough?.tr
|
|
139
|
+
? attributes(inputs.attributePassthrough.tr)
|
|
140
|
+
: nothing}
|
|
141
|
+
style=${ifDefined(inputs.stylePassthrough?.tr)}
|
|
142
|
+
${listen('click', (event) => {
|
|
143
|
+
if (isClickable) {
|
|
144
|
+
dispatch(new events.rowClick({ originalEvent: event, entry: entry }));
|
|
145
|
+
}
|
|
146
|
+
})}
|
|
147
|
+
>
|
|
148
|
+
${cells}
|
|
149
|
+
</tr>
|
|
150
|
+
`;
|
|
79
151
|
});
|
|
80
|
-
|
|
81
|
-
return html `
|
|
82
|
-
<tr
|
|
83
|
-
class=${classMap({
|
|
84
|
-
clickable: isClickable,
|
|
85
|
-
})}
|
|
86
|
-
${inputs.attributePassthrough?.tr
|
|
87
|
-
? attributes(inputs.attributePassthrough.tr)
|
|
88
|
-
: nothing}
|
|
89
|
-
style=${ifDefined(inputs.stylePassthrough?.tr)}
|
|
90
|
-
${listen('click', (event) => {
|
|
91
|
-
if (isClickable) {
|
|
92
|
-
dispatch(new events.rowClick({ originalEvent: event, row }));
|
|
93
|
-
}
|
|
94
|
-
})}
|
|
95
|
-
>
|
|
96
|
-
${cells}
|
|
97
|
-
</tr>
|
|
98
|
-
`;
|
|
99
|
-
});
|
|
100
|
-
const headerCells = inputs.hideHeaderRow
|
|
152
|
+
const headerCells = inputs.hideKeyHeaders || inputs.horizontalOrientation
|
|
101
153
|
? undefined
|
|
102
|
-
: inputs.table.
|
|
103
|
-
if (
|
|
154
|
+
: inputs.table.keys.map((key) => {
|
|
155
|
+
if (key.hide) {
|
|
104
156
|
return nothing;
|
|
105
157
|
}
|
|
106
158
|
return html `
|
|
107
|
-
|
|
108
|
-
|
|
159
|
+
<th
|
|
160
|
+
${inputs.attributePassthrough?.th
|
|
109
161
|
? attributes(inputs.attributePassthrough.th)
|
|
110
162
|
: nothing}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
163
|
+
style=${ifDefined(inputs.stylePassthrough?.th)}
|
|
164
|
+
>
|
|
165
|
+
${key.label}
|
|
166
|
+
</th>
|
|
167
|
+
`;
|
|
116
168
|
});
|
|
117
169
|
const headerRow = headerCells
|
|
118
170
|
? html `
|
|
@@ -125,11 +177,11 @@ export const ViraTable = defineViraElement()({
|
|
|
125
177
|
${headerCells}
|
|
126
178
|
</tr>
|
|
127
179
|
`
|
|
128
|
-
:
|
|
180
|
+
: undefined;
|
|
129
181
|
const theadStyles = css `
|
|
130
182
|
${inputs.stylePassthrough?.thead || css ``}
|
|
131
183
|
top: ${inputs.stickyOffset || 0}px;
|
|
132
|
-
${inputs.preventStickyHeader || inputs.
|
|
184
|
+
${inputs.preventStickyHeader || inputs.hideKeyHeaders
|
|
133
185
|
? css ``
|
|
134
186
|
: css `
|
|
135
187
|
position: sticky;
|
|
@@ -142,21 +194,25 @@ export const ViraTable = defineViraElement()({
|
|
|
142
194
|
: nothing}
|
|
143
195
|
style=${ifDefined(inputs.stylePassthrough?.table)}
|
|
144
196
|
>
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
197
|
+
${headerRow
|
|
198
|
+
? html `
|
|
199
|
+
<thead
|
|
200
|
+
${inputs.attributePassthrough?.thead
|
|
201
|
+
? attributes(inputs.attributePassthrough.thead)
|
|
202
|
+
: nothing}
|
|
203
|
+
style=${theadStyles}
|
|
204
|
+
>
|
|
205
|
+
${headerRow}
|
|
206
|
+
</thead>
|
|
207
|
+
`
|
|
148
208
|
: nothing}
|
|
149
|
-
style=${theadStyles}
|
|
150
|
-
>
|
|
151
|
-
${headerRow}
|
|
152
|
-
</thead>
|
|
153
209
|
<tbody
|
|
154
210
|
${inputs.attributePassthrough?.tbody
|
|
155
211
|
? attributes(inputs.attributePassthrough.tbody)
|
|
156
212
|
: nothing}
|
|
157
213
|
style=${ifDefined(inputs.stylePassthrough?.tbody)}
|
|
158
214
|
>
|
|
159
|
-
${
|
|
215
|
+
${rowTemplates}
|
|
160
216
|
</tbody>
|
|
161
217
|
</table>
|
|
162
218
|
`;
|
|
@@ -31,11 +31,6 @@ export declare const ViraDropdown: import("element-vir").DeclarativeElementDefin
|
|
|
31
31
|
* multiple.
|
|
32
32
|
*/
|
|
33
33
|
isMultiSelect: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Shows the selection quantity rather than a list of selections. Only used when
|
|
36
|
-
* `isMultiSelect` is `true`.
|
|
37
|
-
*/
|
|
38
|
-
showSelectionCount: boolean;
|
|
39
34
|
icon: ViraIconSvg;
|
|
40
35
|
selectionPrefix: string;
|
|
41
36
|
isDisabled: boolean;
|
|
@@ -128,11 +128,9 @@ export const ViraDropdown = defineViraElement()({
|
|
|
128
128
|
: nothing;
|
|
129
129
|
const selectionDisplay = shouldUsePlaceholder
|
|
130
130
|
? inputs.placeholder || ''
|
|
131
|
-
: inputs.isMultiSelect &&
|
|
131
|
+
: inputs.isMultiSelect && selectedOptions.length > 1
|
|
132
132
|
? `${selectedOptions.length} Selected`
|
|
133
|
-
:
|
|
134
|
-
? selectedOptions.map((item) => item.label).join(', ')
|
|
135
|
-
: selectedOptions[0]?.label || '';
|
|
133
|
+
: selectedOptions[0]?.label || '';
|
|
136
134
|
return html `
|
|
137
135
|
<${ViraMenuTrigger.assign({
|
|
138
136
|
items: inputs.options,
|
|
@@ -165,10 +163,7 @@ export const ViraDropdown = defineViraElement()({
|
|
|
165
163
|
class="selection-display ${classMap({
|
|
166
164
|
'using-placeholder': shouldUsePlaceholder,
|
|
167
165
|
})}"
|
|
168
|
-
title=${ifDefined(shouldUsePlaceholder
|
|
169
|
-
(inputs.isMultiSelect && inputs.showSelectionCount)
|
|
170
|
-
? undefined
|
|
171
|
-
: selectionDisplay)}
|
|
166
|
+
title=${ifDefined(shouldUsePlaceholder ? undefined : selectionDisplay)}
|
|
172
167
|
>
|
|
173
168
|
${prefixTemplate} ${selectionDisplay}
|
|
174
169
|
</span>
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
2
|
import { type SpaRoute, type SpaRouter } from 'spa-router-vir';
|
|
3
|
+
/**
|
|
4
|
+
* The route properties required for using {@link ViraLink} with a route.
|
|
5
|
+
*
|
|
6
|
+
* @category Internal
|
|
7
|
+
*/
|
|
8
|
+
export type ViraLinkRoute = Readonly<{
|
|
9
|
+
route: SpaRoute<any, any, any>;
|
|
10
|
+
router: Pick<SpaRouter<any, any, any>, 'createRouteUrl' | 'setRouteOnDirectNavigation'>;
|
|
11
|
+
scrollToTop?: boolean;
|
|
12
|
+
}>;
|
|
3
13
|
/**
|
|
4
14
|
* A hyperlink wrapper element that can be configured to emit route change events rather than just
|
|
5
15
|
* being a raw link.
|
|
@@ -21,11 +31,7 @@ export declare const ViraLink: import("element-vir").DeclarativeElementDefinitio
|
|
|
21
31
|
* A route that'll change that current page without navigating the window. If this property
|
|
22
32
|
* is provided for the inputs, don't provide a link property.
|
|
23
33
|
*/
|
|
24
|
-
route:
|
|
25
|
-
route: SpaRoute<any, any, any>;
|
|
26
|
-
router: Pick<SpaRouter<any, any, any>, "createRouteUrl" | "setRouteOnDirectNavigation">;
|
|
27
|
-
scrollToTop?: boolean;
|
|
28
|
-
};
|
|
34
|
+
route: ViraLinkRoute;
|
|
29
35
|
}, "link" | "route"> & PartialWithUndefined<{
|
|
30
36
|
aria?: {
|
|
31
37
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vira",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.15.0",
|
|
4
4
|
"description": "A simple and highly versatile design system using element-vir.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design",
|
|
@@ -38,21 +38,21 @@
|
|
|
38
38
|
"test:docs": "virmator docs check"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@augment-vir/assert": "^31.
|
|
42
|
-
"@augment-vir/common": "^31.
|
|
43
|
-
"@augment-vir/web": "^31.
|
|
41
|
+
"@augment-vir/assert": "^31.23.3",
|
|
42
|
+
"@augment-vir/common": "^31.23.3",
|
|
43
|
+
"@augment-vir/web": "^31.23.3",
|
|
44
44
|
"colorjs.io": "^0.5.2",
|
|
45
45
|
"date-vir": "^7.3.1",
|
|
46
46
|
"device-navigation": "^4.5.5",
|
|
47
47
|
"lit-css-vars": "^3.0.11",
|
|
48
48
|
"observavir": "^2.0.5",
|
|
49
49
|
"page-active": "^1.0.1",
|
|
50
|
-
"spa-router-vir": "^
|
|
50
|
+
"spa-router-vir": "^6.0.0",
|
|
51
51
|
"type-fest": "^4.41.0",
|
|
52
52
|
"typed-event-target": "^4.1.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@augment-vir/test": "^31.
|
|
55
|
+
"@augment-vir/test": "^31.23.3",
|
|
56
56
|
"@web/dev-server-esbuild": "^1.0.4",
|
|
57
57
|
"@web/test-runner": "^0.20.2",
|
|
58
58
|
"@web/test-runner-commands": "^0.9.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vite-tsconfig-paths": "^5.1.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"element-vir": "^25.
|
|
70
|
+
"element-vir": "^25.15.0"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=22"
|