@statistikzh/leu 0.2.0 → 0.4.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/.github/workflows/deploy-github-pages.yaml +33 -0
- package/.storybook/main.js +27 -1
- package/.storybook/manager-head.html +1 -0
- package/.storybook/manager.js +9 -0
- package/.storybook/preview-head.html +1 -1
- package/.storybook/preview.js +59 -5
- package/.storybook/static/logo.svg +19 -0
- package/.storybook/theme.js +7 -0
- package/CHANGELOG.md +43 -0
- package/README.md +1 -1
- package/dist/Button.js +39 -30
- package/dist/ButtonGroup.js +5 -7
- package/dist/Checkbox.js +107 -88
- package/dist/CheckboxGroup.js +43 -38
- package/dist/{Chip-389013ff.js → Chip-dac7337d.js} +7 -2
- package/dist/ChipGroup.js +4 -6
- package/dist/ChipLink.js +6 -8
- package/dist/ChipRemovable.js +4 -7
- package/dist/ChipSelectable.js +10 -10
- package/dist/Dropdown.js +57 -27
- package/dist/Input.js +59 -43
- package/dist/Menu.js +2 -5
- package/dist/MenuItem.js +34 -17
- package/dist/Pagination.js +57 -55
- package/dist/Radio.js +13 -10
- package/dist/RadioGroup.js +43 -40
- package/dist/Select.js +57 -44
- package/dist/Table.js +147 -125
- package/dist/{defineElement-ba770aed.js → _rollupPluginBabelHelpers-20f659f4.js} +1 -15
- package/dist/defineElement-47d4f665.js +15 -0
- package/dist/index.js +29 -19
- package/dist/leu-button-group.js +7 -3
- package/dist/leu-button.js +6 -3
- package/dist/leu-checkbox-group.js +6 -3
- package/dist/leu-checkbox.js +6 -3
- package/dist/leu-chip-group.js +6 -3
- package/dist/leu-chip-link.js +7 -4
- package/dist/leu-chip-removable.js +7 -4
- package/dist/leu-chip-selectable.js +7 -4
- package/dist/leu-dropdown.js +13 -3
- package/dist/leu-input.js +7 -3
- package/dist/leu-menu-item.js +8 -3
- package/dist/leu-menu.js +6 -3
- package/dist/leu-pagination.js +8 -3
- package/dist/leu-popup-4bf6f1f4.js +216 -0
- package/dist/leu-radio-group.js +6 -3
- package/dist/leu-radio.js +6 -3
- package/dist/leu-select.js +14 -3
- package/dist/leu-table.js +9 -3
- package/package.json +29 -12
- package/scripts/generate-component/templates/[Name].js +0 -5
- package/scripts/generate-component/templates/[name].css +1 -1
- package/scripts/generate-component/templates/[namespace]-[name].js +5 -2
- package/src/components/accordion/Accordion.js +3 -9
- package/src/components/accordion/leu-accordion.js +5 -2
- package/src/components/accordion/stories/accordion.stories.js +7 -4
- package/src/components/accordion/test/accordion.test.js +92 -2
- package/src/components/breadcrumb/Breadcrumb.js +310 -0
- package/src/components/breadcrumb/breadcrumb.css +114 -0
- package/src/components/breadcrumb/leu-breadcrumb.js +6 -0
- package/src/components/breadcrumb/stories/breadcrumb.stories.js +73 -0
- package/src/components/breadcrumb/test/breadcrumb.test.js +141 -0
- package/src/components/button/Button.js +22 -27
- package/src/components/button/button.css +3 -3
- package/src/components/button/leu-button.js +5 -2
- package/src/components/button/stories/button.stories.js +58 -37
- package/src/components/button/test/button.test.js +112 -2
- package/src/components/button-group/ButtonGroup.js +1 -7
- package/src/components/button-group/leu-button-group.js +5 -2
- package/src/components/button-group/stories/button-group.stories.js +6 -0
- package/src/components/button-group/test/button-group.test.js +79 -3
- package/src/components/checkbox/Checkbox.js +9 -89
- package/src/components/checkbox/CheckboxGroup.js +9 -39
- package/src/components/checkbox/checkbox-group.css +29 -0
- package/src/components/checkbox/checkbox.css +76 -0
- package/src/components/checkbox/leu-checkbox-group.js +5 -2
- package/src/components/checkbox/leu-checkbox.js +5 -2
- package/src/components/checkbox/stories/checkbox-group.stories.js +44 -21
- package/src/components/checkbox/stories/checkbox.stories.js +7 -1
- package/src/components/checkbox/test/checkbox-group.test.js +124 -0
- package/src/components/checkbox/test/checkbox.test.js +72 -59
- package/src/components/chip/Chip.js +2 -1
- package/src/components/chip/ChipGroup.js +1 -6
- package/src/components/chip/ChipLink.js +2 -8
- package/src/components/chip/ChipRemovable.js +1 -6
- package/src/components/chip/ChipSelectable.js +4 -9
- package/src/components/chip/exports.js +4 -10
- package/src/components/chip/leu-chip-group.js +5 -2
- package/src/components/chip/leu-chip-link.js +5 -2
- package/src/components/chip/leu-chip-removable.js +5 -2
- package/src/components/chip/leu-chip-selectable.js +5 -2
- package/src/components/chip/stories/chip-group.stories.js +18 -6
- package/src/components/chip/stories/chip-link.stories.js +16 -4
- package/src/components/chip/stories/chip-removable.stories.js +15 -4
- package/src/components/chip/stories/chip-selectable.stories.js +13 -3
- package/src/components/chip/test/chip-group.test.js +124 -0
- package/src/components/chip/test/chip-link.test.js +58 -0
- package/src/components/chip/test/chip-removable.test.js +79 -0
- package/src/components/chip/test/chip-selectable.test.js +95 -0
- package/src/components/chip/test/chip.test.js +1 -1
- package/src/components/dropdown/Dropdown.js +53 -25
- package/src/components/dropdown/dropdown.css +1 -2
- package/src/components/dropdown/leu-dropdown.js +5 -2
- package/src/components/dropdown/stories/dropdown.stories.js +11 -5
- package/src/components/dropdown/test/dropdown.test.js +6 -6
- package/src/components/icon/icon.js +1 -1
- package/src/components/icon/test/icon.test.js +66 -0
- package/src/components/input/Input.js +33 -39
- package/src/components/input/input.css +9 -6
- package/src/components/input/leu-input.js +5 -2
- package/src/components/input/stories/input.stories.js +8 -2
- package/src/components/input/test/input.test.js +431 -4
- package/src/components/menu/Menu.js +0 -5
- package/src/components/menu/MenuItem.js +22 -15
- package/src/components/menu/leu-menu-item.js +5 -2
- package/src/components/menu/leu-menu.js +5 -2
- package/src/components/menu/menu-item.css +5 -2
- package/src/components/menu/stories/menu-item.stories.js +13 -4
- package/src/components/menu/stories/menu.stories.js +11 -5
- package/src/components/menu/test/menu-item.test.js +180 -0
- package/src/components/menu/test/menu.test.js +10 -2
- package/src/components/pagination/Pagination.js +53 -65
- package/src/components/pagination/leu-pagination.js +5 -2
- package/src/components/pagination/stories/pagination.stories.js +17 -9
- package/src/components/pagination/test/pagination.test.js +191 -5
- package/src/components/popup/Popup.js +200 -0
- package/src/components/popup/leu-popup.js +6 -0
- package/src/components/popup/popup.css +27 -0
- package/src/components/popup/stories/popup.stories.js +58 -0
- package/src/components/popup/test/popup.test.js +29 -0
- package/src/components/radio/Radio.js +5 -10
- package/src/components/radio/RadioGroup.js +7 -39
- package/src/components/radio/leu-radio-group.js +5 -2
- package/src/components/radio/leu-radio.js +5 -2
- package/src/components/radio/radio-group.css +29 -0
- package/src/components/radio/stories/radio-group.stories.js +38 -19
- package/src/components/radio/stories/radio.stories.js +7 -1
- package/src/components/radio/test/radio-group.test.js +86 -0
- package/src/components/radio/test/radio.test.js +108 -17
- package/src/components/select/Select.js +35 -32
- package/src/components/select/leu-select.js +5 -2
- package/src/components/select/select.css +13 -13
- package/src/components/select/stories/select.stories.js +15 -168
- package/src/components/select/test/fixtures.js +162 -0
- package/src/components/select/test/select.test.js +236 -12
- package/src/components/table/Table.js +48 -123
- package/src/components/table/leu-table.js +5 -2
- package/src/components/table/stories/table.stories.js +20 -10
- package/src/components/table/table.css +99 -0
- package/src/components/table/test/table.test.js +1 -1
- package/src/lib/utils.js +17 -0
- package/{web-dev-server-storybook.config.mjs → web-dev-server.config.mjs} +1 -2
- package/web-test-runner.config.mjs +15 -2
|
@@ -1,116 +1,30 @@
|
|
|
1
|
-
import { html,
|
|
1
|
+
import { html, LitElement, nothing } from "lit"
|
|
2
2
|
import { classMap } from "lit/directives/class-map.js"
|
|
3
3
|
import { styleMap } from "lit/directives/style-map.js"
|
|
4
4
|
import { createRef, ref } from "lit/directives/ref.js"
|
|
5
5
|
import { Icon } from "../icon/icon.js"
|
|
6
|
-
import
|
|
7
|
-
|
|
6
|
+
import "../pagination/leu-pagination.js"
|
|
7
|
+
|
|
8
|
+
import styles from "./table.css"
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @tagname leu-table
|
|
11
12
|
*/
|
|
12
13
|
export class LeuTable extends LitElement {
|
|
13
|
-
static styles =
|
|
14
|
-
:host {
|
|
15
|
-
position: relative;
|
|
16
|
-
display: block;
|
|
17
|
-
}
|
|
18
|
-
div.scroll {
|
|
19
|
-
display: inline-block;
|
|
20
|
-
width: 100%;
|
|
21
|
-
overflow: auto;
|
|
22
|
-
}
|
|
23
|
-
div.shadow {
|
|
24
|
-
position: absolute;
|
|
25
|
-
left: 0;
|
|
26
|
-
top: 0;
|
|
27
|
-
width: 100%;
|
|
28
|
-
height: 100%;
|
|
29
|
-
pointer-events: none;
|
|
30
|
-
z-index: 1;
|
|
31
|
-
}
|
|
32
|
-
div.pagination {
|
|
33
|
-
height: calc(100% - 66px);
|
|
34
|
-
}
|
|
35
|
-
table {
|
|
36
|
-
width: 100%;
|
|
37
|
-
border-spacing: 0;
|
|
38
|
-
color: rgb(0 0 0 / 60%);
|
|
39
|
-
font-size: 16px;
|
|
40
|
-
font-family: var(--leu-font-regular);
|
|
41
|
-
line-height: 1.5;
|
|
42
|
-
}
|
|
43
|
-
td {
|
|
44
|
-
padding: 12px;
|
|
45
|
-
}
|
|
46
|
-
th {
|
|
47
|
-
padding: 16px 16px 8px;
|
|
48
|
-
text-align: left;
|
|
49
|
-
font-size: 12px;
|
|
50
|
-
font-weight: normal;
|
|
51
|
-
font-family: var(--leu-font-black);
|
|
52
|
-
background: var(--table-even-row-bg);
|
|
53
|
-
}
|
|
54
|
-
td:first-child,
|
|
55
|
-
th:first-child {
|
|
56
|
-
left: 0;
|
|
57
|
-
background: inherit;
|
|
58
|
-
z-index: 1;
|
|
59
|
-
}
|
|
60
|
-
tr {
|
|
61
|
-
background: #fff;
|
|
62
|
-
}
|
|
63
|
-
tbody tr:nth-child(odd) {
|
|
64
|
-
background: var(--leu-color-black-5);
|
|
65
|
-
}
|
|
66
|
-
button {
|
|
67
|
-
background: none;
|
|
68
|
-
cursor: pointer;
|
|
69
|
-
line-height: 1.5;
|
|
70
|
-
padding: 0;
|
|
71
|
-
border: 0;
|
|
72
|
-
width: 100%;
|
|
73
|
-
display: flex;
|
|
74
|
-
align-items: flex-center;
|
|
75
|
-
font-size: inherit;
|
|
76
|
-
font-family: inherit;
|
|
77
|
-
}
|
|
78
|
-
thead svg {
|
|
79
|
-
display: inline-block;
|
|
80
|
-
color: var(--leu-color-accent-blue);
|
|
81
|
-
padding: 0;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
table.sticky td:first-child,
|
|
85
|
-
table.sticky th:first-child {
|
|
86
|
-
position: sticky;
|
|
87
|
-
}
|
|
88
|
-
div.shadow-left table.sticky td:first-child,
|
|
89
|
-
div.shadow-left table.sticky th:first-child {
|
|
90
|
-
box-shadow: 0 0 5px rgb(0 0 0 / 50%);
|
|
91
|
-
clip-path: inset(0 -15px 0 0);
|
|
92
|
-
}
|
|
93
|
-
div.shadow-left {
|
|
94
|
-
box-shadow: inset 5px 0 5px -5px rgb(0 0 0 / 50%);
|
|
95
|
-
}
|
|
96
|
-
div.shadow-right {
|
|
97
|
-
box-shadow: inset -5px 0 5px -5px rgb(0 0 0 / 50%);
|
|
98
|
-
}
|
|
99
|
-
`
|
|
14
|
+
static styles = styles
|
|
100
15
|
|
|
101
16
|
static properties = {
|
|
102
17
|
columns: { type: Array },
|
|
103
18
|
data: { type: Array },
|
|
104
|
-
firstColumnSticky: { type: Boolean },
|
|
105
|
-
|
|
106
|
-
sortIndex: { type: Number },
|
|
107
|
-
sortOrderAsc: { type: Boolean },
|
|
108
|
-
width: { type: Number },
|
|
109
|
-
|
|
110
|
-
_shadowLeft: {
|
|
111
|
-
_shadowRight: {
|
|
112
|
-
|
|
113
|
-
_max: { type: Number, state: true },
|
|
19
|
+
firstColumnSticky: { type: Boolean, reflect: true },
|
|
20
|
+
itemsPerPage: { type: Number, reflect: true },
|
|
21
|
+
sortIndex: { type: Number, reflect: true },
|
|
22
|
+
sortOrderAsc: { type: Boolean, reflect: true },
|
|
23
|
+
width: { type: Number, reflect: true },
|
|
24
|
+
|
|
25
|
+
_shadowLeft: { state: true },
|
|
26
|
+
_shadowRight: { state: true },
|
|
27
|
+
_page: { state: true },
|
|
114
28
|
}
|
|
115
29
|
|
|
116
30
|
constructor() {
|
|
@@ -122,7 +36,7 @@ export class LeuTable extends LitElement {
|
|
|
122
36
|
/** @type {boolean} */
|
|
123
37
|
this.firstColumnSticky = false
|
|
124
38
|
/** @type {number} */
|
|
125
|
-
this.
|
|
39
|
+
this.itemsPerPage = null
|
|
126
40
|
/** @type {number} */
|
|
127
41
|
this.sortIndex = null
|
|
128
42
|
/** @type {boolean} */
|
|
@@ -140,14 +54,31 @@ export class LeuTable extends LitElement {
|
|
|
140
54
|
this._shadowRight = false
|
|
141
55
|
/** @internal */
|
|
142
56
|
this._scrollRef = createRef()
|
|
57
|
+
|
|
143
58
|
/** @internal */
|
|
144
|
-
this.
|
|
145
|
-
|
|
146
|
-
this.
|
|
59
|
+
this._page = 1
|
|
60
|
+
|
|
61
|
+
this._resizeObserver = new ResizeObserver(() => {
|
|
62
|
+
this.shadowToggle(this._scrollRef.value)
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
disconnectedCallback() {
|
|
67
|
+
this._resizeObserver.disconnect()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
71
|
+
super.attributeChangedCallback(name, oldVal, newVal)
|
|
72
|
+
|
|
73
|
+
if (name === "itemsperpage" || name === "data") {
|
|
74
|
+
this._page = 1
|
|
75
|
+
}
|
|
147
76
|
}
|
|
148
77
|
|
|
149
78
|
firstUpdated() {
|
|
150
79
|
this.shadowToggle(this._scrollRef.value)
|
|
80
|
+
|
|
81
|
+
this._resizeObserver.observe(this._scrollRef.value)
|
|
151
82
|
}
|
|
152
83
|
|
|
153
84
|
shadowToggle(target) {
|
|
@@ -205,8 +136,11 @@ export class LeuTable extends LitElement {
|
|
|
205
136
|
}
|
|
206
137
|
|
|
207
138
|
get _data() {
|
|
208
|
-
return this.
|
|
209
|
-
? this._sortedData.slice(
|
|
139
|
+
return this.itemsPerPage && this.itemsPerPage > 0
|
|
140
|
+
? this._sortedData.slice(
|
|
141
|
+
(this._page - 1) * this.itemsPerPage,
|
|
142
|
+
this._page * this.itemsPerPage
|
|
143
|
+
)
|
|
210
144
|
: this._sortedData
|
|
211
145
|
}
|
|
212
146
|
|
|
@@ -219,13 +153,13 @@ export class LeuTable extends LitElement {
|
|
|
219
153
|
const shadowClassesLeft = {
|
|
220
154
|
shadow: true,
|
|
221
155
|
"shadow-left": !this.firstColumnSticky && this._shadowLeft,
|
|
222
|
-
pagination: this.
|
|
156
|
+
pagination: this.itemsPerPage > 0,
|
|
223
157
|
}
|
|
224
158
|
|
|
225
159
|
const shadowClassesRight = {
|
|
226
160
|
shadow: true,
|
|
227
161
|
"shadow-right": this._shadowRight,
|
|
228
|
-
pagination: this.
|
|
162
|
+
pagination: this.itemsPerPage > 0,
|
|
229
163
|
}
|
|
230
164
|
|
|
231
165
|
const stickyClass = {
|
|
@@ -274,18 +208,14 @@ export class LeuTable extends LitElement {
|
|
|
274
208
|
<div class=${classMap(shadowClassesRight)}></div>
|
|
275
209
|
</div>
|
|
276
210
|
|
|
277
|
-
${this.
|
|
211
|
+
${this.itemsPerPage > 0
|
|
278
212
|
? html`
|
|
279
213
|
<leu-pagination
|
|
280
|
-
.
|
|
281
|
-
.
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
this.
|
|
285
|
-
// after render
|
|
286
|
-
setTimeout(() => {
|
|
287
|
-
this.shadowToggle(this._scrollRef.value)
|
|
288
|
-
}, 0)
|
|
214
|
+
.numOfItems=${this._sortedData.length}
|
|
215
|
+
.itemsPerPage=${this.itemsPerPage}
|
|
216
|
+
page=${this._page}
|
|
217
|
+
@leu:pagechange=${(e) => {
|
|
218
|
+
this._page = e.detail.page
|
|
289
219
|
}}
|
|
290
220
|
>
|
|
291
221
|
</leu-pagination>
|
|
@@ -294,8 +224,3 @@ export class LeuTable extends LitElement {
|
|
|
294
224
|
`
|
|
295
225
|
}
|
|
296
226
|
}
|
|
297
|
-
|
|
298
|
-
export function defineTableElements() {
|
|
299
|
-
definePaginationElements()
|
|
300
|
-
defineElement("table", LeuTable)
|
|
301
|
-
}
|
|
@@ -4,15 +4,17 @@ import "../leu-table.js"
|
|
|
4
4
|
export default {
|
|
5
5
|
title: "Table",
|
|
6
6
|
component: "leu-table",
|
|
7
|
+
parameters: {
|
|
8
|
+
design: {
|
|
9
|
+
type: "figma",
|
|
10
|
+
url: "https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=316-2445&mode=design&t=lzVrtq8lxYVJU5TB-11",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
7
13
|
}
|
|
8
14
|
|
|
9
|
-
function Template({
|
|
15
|
+
function Template({ itemsPerPage }) {
|
|
10
16
|
return html`
|
|
11
|
-
<leu-table
|
|
12
|
-
id="table"
|
|
13
|
-
itemsOnAPage=${itemsOnAPage}
|
|
14
|
-
style="max-width:500px;"
|
|
15
|
-
></leu-table>
|
|
17
|
+
<leu-table id="table" itemsPerPage=${itemsPerPage}></leu-table>
|
|
16
18
|
<script>
|
|
17
19
|
{
|
|
18
20
|
const table = document.querySelector("leu-table[id=table]")
|
|
@@ -39,7 +41,10 @@ function Template({ itemsOnAPage }) {
|
|
|
39
41
|
value: (row) => row.menge,
|
|
40
42
|
style: (row) => {
|
|
41
43
|
return {
|
|
42
|
-
color:
|
|
44
|
+
color:
|
|
45
|
+
row.menge > 10
|
|
46
|
+
? "var(--leu-color-func-green)"
|
|
47
|
+
: "var(--leu-color-func-red)",
|
|
43
48
|
}
|
|
44
49
|
},
|
|
45
50
|
sort: {
|
|
@@ -96,7 +101,7 @@ function Template({ itemsOnAPage }) {
|
|
|
96
101
|
|
|
97
102
|
export const Regular = Template.bind({})
|
|
98
103
|
Regular.argTypes = {
|
|
99
|
-
|
|
104
|
+
itemsPerPage: { type: "number" },
|
|
100
105
|
columns: { table: { disable: true } },
|
|
101
106
|
data: { table: { disable: true } },
|
|
102
107
|
_columns: { table: { disable: true } },
|
|
@@ -108,9 +113,14 @@ Regular.argTypes = {
|
|
|
108
113
|
_sortArrowDown: { table: { disable: true } },
|
|
109
114
|
_sortArrowUp: { table: { disable: true } },
|
|
110
115
|
_scrollRef: { table: { disable: true } },
|
|
111
|
-
|
|
116
|
+
_itemsPerPage: { table: { disable: true } },
|
|
112
117
|
_sortedData: { table: { disable: true } },
|
|
113
118
|
}
|
|
114
119
|
Regular.args = {
|
|
115
|
-
|
|
120
|
+
itemsPerPage: null,
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export const Pagination = Template.bind({})
|
|
124
|
+
Pagination.args = {
|
|
125
|
+
itemsPerPage: 10,
|
|
116
126
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: block;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
div.scroll {
|
|
7
|
+
display: inline-block;
|
|
8
|
+
width: 100%;
|
|
9
|
+
overflow: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
div.shadow {
|
|
13
|
+
position: absolute;
|
|
14
|
+
left: 0;
|
|
15
|
+
top: 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
z-index: 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
div.pagination {
|
|
23
|
+
height: calc(100% - 66px);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
table {
|
|
27
|
+
width: 100%;
|
|
28
|
+
border-spacing: 0;
|
|
29
|
+
color: rgb(0 0 0 / 60%);
|
|
30
|
+
font-size: 16px;
|
|
31
|
+
font-family: var(--leu-font-regular);
|
|
32
|
+
line-height: 1.5;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
td {
|
|
36
|
+
padding: 12px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
th {
|
|
40
|
+
padding: 16px 16px 8px;
|
|
41
|
+
text-align: left;
|
|
42
|
+
font-size: 12px;
|
|
43
|
+
font-weight: normal;
|
|
44
|
+
font-family: var(--leu-font-black);
|
|
45
|
+
background: var(--table-even-row-bg);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
td:first-child,
|
|
49
|
+
th:first-child {
|
|
50
|
+
left: 0;
|
|
51
|
+
background: inherit;
|
|
52
|
+
z-index: 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
tr {
|
|
56
|
+
background: #fff;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
tbody tr:nth-child(odd) {
|
|
60
|
+
background: var(--leu-color-black-5);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
button {
|
|
64
|
+
background: none;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
line-height: 1.5;
|
|
67
|
+
padding: 0;
|
|
68
|
+
border: 0;
|
|
69
|
+
width: 100%;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: flex-center;
|
|
72
|
+
font-size: inherit;
|
|
73
|
+
font-family: inherit;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
thead svg {
|
|
77
|
+
display: inline-block;
|
|
78
|
+
color: var(--leu-color-accent-blue);
|
|
79
|
+
padding: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
table.sticky td:first-child,
|
|
83
|
+
table.sticky th:first-child {
|
|
84
|
+
position: sticky;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
div.shadow-left table.sticky td:first-child,
|
|
88
|
+
div.shadow-left table.sticky th:first-child {
|
|
89
|
+
box-shadow: 0 0 5px rgb(0 0 0 / 50%);
|
|
90
|
+
clip-path: inset(0 -15px 0 0);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
div.shadow-left {
|
|
94
|
+
box-shadow: inset 5px 0 5px -5px rgb(0 0 0 / 50%);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
div.shadow-right {
|
|
98
|
+
box-shadow: inset -5px 0 5px -5px rgb(0 0 0 / 50%);
|
|
99
|
+
}
|
package/src/lib/utils.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrap a Function to nsure that time-consuming tasks do not fire so often
|
|
3
|
+
* @param {Function} func - Your function
|
|
4
|
+
* @param {Number} timeout - Default is 500 ms
|
|
5
|
+
* @returns {Function} - Your function wrapped in a timeout function
|
|
6
|
+
*/
|
|
7
|
+
const debounce = function (func, timeout = 500) {
|
|
8
|
+
let timer = null
|
|
9
|
+
return (...args) => {
|
|
10
|
+
clearTimeout(timer)
|
|
11
|
+
timer = setTimeout(() => {
|
|
12
|
+
func.apply(this, args)
|
|
13
|
+
}, timeout)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { debounce }
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { fromRollup } from "@web/dev-server-rollup"
|
|
2
2
|
import rollupJson from "@rollup/plugin-json"
|
|
3
|
-
import { storybookPlugin } from "@web/dev-server-storybook"
|
|
4
3
|
|
|
5
4
|
import { plugins as rollupPlugins } from "./rollup.config.js"
|
|
6
5
|
|
|
@@ -15,5 +14,5 @@ export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
|
15
14
|
"**/custom-elements.json": "js",
|
|
16
15
|
"src/components/**/*.css": "js",
|
|
17
16
|
},
|
|
18
|
-
plugins: [
|
|
17
|
+
plugins: [...plugins, json()],
|
|
19
18
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { playwrightLauncher } from "@web/test-runner-playwright"
|
|
2
|
-
import { plugins as
|
|
2
|
+
import { plugins as wdsPlugins } from "./web-dev-server.config.mjs"
|
|
3
3
|
|
|
4
4
|
const filteredLogs = ["Running in dev mode", "lit-html is in dev mode"]
|
|
5
5
|
|
|
6
6
|
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
7
7
|
/** Test files to run */
|
|
8
8
|
files: "src/components/**/*.test.js",
|
|
9
|
-
plugins:
|
|
9
|
+
plugins: wdsPlugins,
|
|
10
10
|
mimeTypes: {
|
|
11
11
|
"src/components/**/*.css": "js",
|
|
12
12
|
},
|
|
@@ -45,5 +45,18 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
|
45
45
|
// playwrightLauncher({ product: "webkit" }),
|
|
46
46
|
],
|
|
47
47
|
|
|
48
|
+
testRunnerHtml: (testFramework) =>
|
|
49
|
+
`<html>
|
|
50
|
+
<head>
|
|
51
|
+
<meta charset="utf-8" />
|
|
52
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
53
|
+
<link rel="stylesheet" href="dist/theme.css" />
|
|
54
|
+
<link rel="stylesheet" href="https://www.web.statistik.zh.ch/leu/styles/fonts.css" />
|
|
55
|
+
</head>
|
|
56
|
+
<body>
|
|
57
|
+
<script type="module" src="${testFramework}"></script>
|
|
58
|
+
</body>
|
|
59
|
+
</html>`,
|
|
60
|
+
|
|
48
61
|
// See documentation for all available options
|
|
49
62
|
})
|