@axel669/zephyr 0.2.0-beta.3 → 0.3.6
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/package.json +33 -33
- package/readme.md +63 -63
- package/src/async/button.md +27 -0
- package/src/async/button.svelte +29 -31
- package/src/async/load-zone.md +42 -0
- package/src/async/load-zone.svelte +22 -20
- package/src/composed/data-table/th.md +21 -0
- package/src/composed/data-table/th.svelte +61 -61
- package/src/composed/data-table.md +86 -85
- package/src/composed/data-table.svelte +199 -149
- package/src/composed/entry-button.md +44 -34
- package/src/composed/entry-button.svelte +31 -31
- package/src/composed/table-functions.js +13 -13
- package/src/composed/toast/message.svelte +56 -56
- package/src/composed/toast.md +45 -36
- package/src/composed/toast.svelte +70 -70
- package/src/control/button.md +41 -41
- package/src/control/button.svelte +27 -27
- package/src/control/input.md +87 -0
- package/src/control/input.svelte +109 -109
- package/src/control/label.md +48 -49
- package/src/control/label.svelte +38 -38
- package/src/control/link.md +50 -50
- package/src/control/link.svelte +32 -30
- package/src/control/radio.md +58 -58
- package/src/control/radio.svelte +28 -28
- package/src/control/select.md +70 -70
- package/src/control/select.svelte +64 -64
- package/src/control/tabs.md +47 -47
- package/src/control/tabs.svelte +43 -41
- package/src/control/toggle.md +61 -61
- package/src/control/toggle.svelte +49 -49
- package/src/data-display/avatar.md +36 -36
- package/src/data-display/avatar.svelte +25 -25
- package/src/data-display/badge.md +30 -30
- package/src/data-display/badge.svelte +14 -14
- package/src/data-display/chip.md +36 -36
- package/src/data-display/chip.svelte +28 -28
- package/src/data-display/details.md +42 -3
- package/src/data-display/details.svelte +25 -25
- package/src/data-display/popover.md +32 -32
- package/src/data-display/popover.svelte +25 -25
- package/src/data-display/progress.md +46 -46
- package/src/data-display/progress.svelte +27 -27
- package/src/data-display/table.md +59 -7
- package/src/data-display/table.svelte +38 -38
- package/src/data-display/tooltip.md +29 -29
- package/src/data-display/tooltip.svelte +17 -17
- package/src/dialogs/alert.md +42 -3
- package/src/dialogs/alert.svelte +34 -34
- package/src/dialogs/confirm.md +56 -3
- package/src/dialogs/confirm.svelte +45 -45
- package/src/functions.md +108 -83
- package/src/handler$.mjs +20 -20
- package/src/hash.js +14 -0
- package/src/index.mjs +53 -52
- package/src/info/icon.md +21 -21
- package/src/info/icon.svelte +9 -9
- package/src/info/notification.md +36 -36
- package/src/info/notification.svelte +16 -16
- package/src/info/titlebar.md +75 -75
- package/src/info/titlebar.svelte +18 -18
- package/src/info/toaster.md +26 -26
- package/src/info/toaster.svelte +14 -14
- package/src/inline-dialog.svelte +23 -23
- package/src/layout/dialog.md +43 -43
- package/src/layout/dialog.svelte +26 -26
- package/src/layout/drawer.md +70 -70
- package/src/layout/drawer.svelte +49 -49
- package/src/layout/flex.md +43 -43
- package/src/layout/flex.svelte +26 -24
- package/src/layout/grid.md +61 -61
- package/src/layout/grid.svelte +30 -28
- package/src/layout/modal.md +50 -50
- package/src/layout/modal.svelte +60 -60
- package/src/layout/paper.md +94 -94
- package/src/layout/paper.svelte +47 -47
- package/src/layout/screen.md +33 -33
- package/src/layout/screen.svelte +34 -34
- package/src/spinner/circle-spinner.svelte +15 -15
- package/src/spinner/hexagon-spinner.svelte +15 -15
- package/src/spinner/spinners.md +22 -3
- package/src/text.md +34 -34
- package/src/text.svelte +22 -22
- package/src/variant.mjs +12 -12
- package/src/wsx.mjs +24 -24
|
@@ -1,85 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
1
|
+
# DataTable
|
|
2
|
+
|
|
3
|
+
The DataTable is a more advanced way to show data on screen. Underneath is
|
|
4
|
+
a [Table](../data-display/table.md) component, but with additional functionality
|
|
5
|
+
for pagination, sorting, and fitering.
|
|
6
|
+
|
|
7
|
+
> If pagination is not needed, the DataTable may not be necessary as it will
|
|
8
|
+
> only be shortcutting data formatting at that point.
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
|
|
12
|
+
### color
|
|
13
|
+
Sets `$color`
|
|
14
|
+
|
|
15
|
+
### data
|
|
16
|
+
`Array`
|
|
17
|
+
|
|
18
|
+
The data to display. Each item in the array can be in either the same
|
|
19
|
+
format as the Table, or any kind of object if column format functions
|
|
20
|
+
are used.
|
|
21
|
+
|
|
22
|
+
### page
|
|
23
|
+
`Number`
|
|
24
|
+
|
|
25
|
+
The current page of data being viewed. Can be bound, or set to control
|
|
26
|
+
which page is displayed
|
|
27
|
+
|
|
28
|
+
### pageSize
|
|
29
|
+
`Number`
|
|
30
|
+
|
|
31
|
+
The number of items to show on each page. Default is 10.
|
|
32
|
+
|
|
33
|
+
### rowHeight
|
|
34
|
+
The height of each row. The component uses this to make empty rows the same
|
|
35
|
+
height as rows with data so that the pagination doesnt randomly resize the
|
|
36
|
+
visual area of the table.
|
|
37
|
+
|
|
38
|
+
## Slots
|
|
39
|
+
|
|
40
|
+
### header
|
|
41
|
+
A fragment that should contain the header cells for the table header. A standard
|
|
42
|
+
`th` can be used, but the [TH](./data-table/th.md) element from zephyr has
|
|
43
|
+
additional configuration to handle more complex header-related actions.
|
|
44
|
+
|
|
45
|
+
### row
|
|
46
|
+
A fragment that should use regular `td` elements to define how a row should be
|
|
47
|
+
layed out. The fragment will need `let:row` to access each row's data for
|
|
48
|
+
displaying it.
|
|
49
|
+
|
|
50
|
+
## Example
|
|
51
|
+
```svelte
|
|
52
|
+
<script>
|
|
53
|
+
import { DataTable, TH, sorts } from "@axel669/zephyr"
|
|
54
|
+
|
|
55
|
+
let page
|
|
56
|
+
const data = [
|
|
57
|
+
{ a: 1, b: 1 ** 2, c: 1 ** 3 },
|
|
58
|
+
{ a: 2, b: 2 ** 2, c: 2 ** 3 },
|
|
59
|
+
{ a: 3, b: 3 ** 2, c: 3 ** 3 },
|
|
60
|
+
{ a: 4, b: 4 ** 2, c: 4 ** 3 },
|
|
61
|
+
{ a: 5, b: 5 ** 2, c: 5 ** 3 },
|
|
62
|
+
{ a: 6, b: 6 ** 2, c: 6 ** 3 },
|
|
63
|
+
{ a: 7, b: 7 ** 2, c: 7 ** 3 },
|
|
64
|
+
{ a: 8, b: 8 ** 2, c: 8 ** 3 },
|
|
65
|
+
{ a: 9, b: 9 ** 2, c: 9 ** 3 },
|
|
66
|
+
{ a: 10, b: 10 ** 2, c: 10 ** 3 },
|
|
67
|
+
{ a: 11, b: 11 ** 2, c: 11 ** 3 },
|
|
68
|
+
{ a: 12, b: 12 ** 2, c: 12 ** 3 },
|
|
69
|
+
{ a: 13, b: 13 ** 2, c: 13 ** 3 },
|
|
70
|
+
]
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<DataTable {cols} {data} color="warning" pageSize={3} bind:page>
|
|
74
|
+
<svelte:fragment slot="header">
|
|
75
|
+
<TH sort={sorts.natural}>N</TH>
|
|
76
|
+
<th>Squared</th>
|
|
77
|
+
<th>Cubed</th>
|
|
78
|
+
</svelte:fragment>
|
|
79
|
+
|
|
80
|
+
<svelte:fragment slot="row" let:row>
|
|
81
|
+
<td>{row.a}</td>
|
|
82
|
+
<td>{row.b}</td>
|
|
83
|
+
<td>^3 = {row.c}</td>
|
|
84
|
+
</svelte:fragment>
|
|
85
|
+
</DataTable>
|
|
86
|
+
```
|
|
@@ -1,149 +1,199 @@
|
|
|
1
|
-
<svelte:options immutable />
|
|
2
|
-
|
|
3
|
-
<script context="module">
|
|
4
|
-
// find the first filter in the list that returns false
|
|
5
|
-
const applyFilters = (data, filters) => {
|
|
6
|
-
if (Array.isArray(data) === false) {
|
|
7
|
-
return null
|
|
8
|
-
}
|
|
9
|
-
return data.filter(
|
|
10
|
-
(row) => {
|
|
11
|
-
for (const [filter, value] of filters) {
|
|
12
|
-
if (filter(row, value) === false) {
|
|
13
|
-
return false
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return true
|
|
17
|
-
}
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
const sliceData = (data, page, pageSize, sortFunc) => {
|
|
21
|
-
if (data === null) {
|
|
22
|
-
return []
|
|
23
|
-
}
|
|
24
|
-
const sorted = data.sort(sortFunc)
|
|
25
|
-
return Array.from(
|
|
26
|
-
{ length: pageSize },
|
|
27
|
-
(_, i) => sorted[page * pageSize + i]
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
const noSort = {
|
|
31
|
-
direction: null,
|
|
32
|
-
func: (a, b) => 0,
|
|
33
|
-
base: null,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const dtContext = Symbol("table key")
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<script>
|
|
40
|
-
import { createEventDispatcher, setContext } from "svelte"
|
|
41
|
-
import { writable } from "svelte/store"
|
|
42
|
-
|
|
43
|
-
import Button from "../control/button.svelte"
|
|
44
|
-
import Icon from "../info/icon.svelte"
|
|
45
|
-
import Paper from "../layout/paper.svelte"
|
|
46
|
-
import Table from "../data-display/table.svelte"
|
|
47
|
-
import Text from "../text.svelte"
|
|
48
|
-
|
|
49
|
-
import Grid from "../layout/grid.svelte"
|
|
50
|
-
|
|
51
|
-
import wsx from "../wsx.mjs"
|
|
52
|
-
import { handler$, eventHandler$ } from "../handler$.mjs"
|
|
53
|
-
|
|
54
|
-
export let color = false
|
|
55
|
-
export let fillHeader = true
|
|
56
|
-
export let data
|
|
57
|
-
export let pageSize = 10
|
|
58
|
-
export let page = 0
|
|
59
|
-
export let rowHeight = "40px"
|
|
60
|
-
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
$:
|
|
69
|
-
$:
|
|
70
|
-
|
|
71
|
-
$:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
sorting
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
1
|
+
<svelte:options immutable />
|
|
2
|
+
|
|
3
|
+
<script context="module">
|
|
4
|
+
// find the first filter in the list that returns false
|
|
5
|
+
const applyFilters = (data, filters) => {
|
|
6
|
+
if (Array.isArray(data) === false) {
|
|
7
|
+
return null
|
|
8
|
+
}
|
|
9
|
+
return data.filter(
|
|
10
|
+
(row) => {
|
|
11
|
+
for (const [filter, value] of filters) {
|
|
12
|
+
if (filter(row, value) === false) {
|
|
13
|
+
return false
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return true
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
const sliceData = (data, page, pageSize, sortFunc) => {
|
|
21
|
+
if (data === null) {
|
|
22
|
+
return []
|
|
23
|
+
}
|
|
24
|
+
const sorted = data.sort(sortFunc)
|
|
25
|
+
return Array.from(
|
|
26
|
+
{ length: pageSize },
|
|
27
|
+
(_, i) => sorted[page * pageSize + i]
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
const noSort = {
|
|
31
|
+
direction: null,
|
|
32
|
+
func: (a, b) => 0,
|
|
33
|
+
base: null,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const dtContext = Symbol("table key")
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
import { createEventDispatcher, setContext } from "svelte"
|
|
41
|
+
import { writable } from "svelte/store"
|
|
42
|
+
|
|
43
|
+
import Button from "../control/button.svelte"
|
|
44
|
+
import Icon from "../info/icon.svelte"
|
|
45
|
+
import Paper from "../layout/paper.svelte"
|
|
46
|
+
import Table from "../data-display/table.svelte"
|
|
47
|
+
import Text from "../text.svelte"
|
|
48
|
+
|
|
49
|
+
import Grid from "../layout/grid.svelte"
|
|
50
|
+
|
|
51
|
+
import wsx from "../wsx.mjs"
|
|
52
|
+
import { handler$, eventHandler$ } from "../handler$.mjs"
|
|
53
|
+
|
|
54
|
+
export let color = false
|
|
55
|
+
export let fillHeader = true
|
|
56
|
+
export let data
|
|
57
|
+
export let pageSize = 10
|
|
58
|
+
export let page = 0
|
|
59
|
+
export let rowHeight = "40px"
|
|
60
|
+
export let scrollable = false
|
|
61
|
+
export let height = null
|
|
62
|
+
|
|
63
|
+
let sorting = noSort
|
|
64
|
+
let filters = new Map()
|
|
65
|
+
let filterFunctions = []
|
|
66
|
+
let jumpTarget = "1"
|
|
67
|
+
|
|
68
|
+
$: filteredData = applyFilters(data, filterFunctions)
|
|
69
|
+
$: rows = sliceData(filteredData, page, pageSize, sorting.func)
|
|
70
|
+
$: rowCount = filteredData?.length ?? 0
|
|
71
|
+
$: pageCount = Math.ceil(rowCount / pageSize)
|
|
72
|
+
$: maxPage = Math.max(pageCount - 1, 0)
|
|
73
|
+
$: jumpTarget = (page + 1).toString()
|
|
74
|
+
|
|
75
|
+
$: if (filteredData === null) {
|
|
76
|
+
console.warn("DataTable: data is not an array")
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const prev = () => page = Math.max(0, page - 1)
|
|
80
|
+
const next = () => page = Math.min(maxPage, page + 1)
|
|
81
|
+
|
|
82
|
+
const updateSort = (func) => {
|
|
83
|
+
if (sorting.base === func) {
|
|
84
|
+
if (sorting.direction === "desc") {
|
|
85
|
+
sorting = noSort
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
sorting = {
|
|
89
|
+
func: (a, b) => -func(a, b),
|
|
90
|
+
base: func,
|
|
91
|
+
direction: "desc"
|
|
92
|
+
}
|
|
93
|
+
return
|
|
94
|
+
}
|
|
95
|
+
sorting = {
|
|
96
|
+
func,
|
|
97
|
+
base: func,
|
|
98
|
+
direction: "asc",
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const updateFilter = (func, value) => {
|
|
102
|
+
if (func === null) {
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
filters.set(func, value)
|
|
106
|
+
filterFunctions = [
|
|
107
|
+
...filters.entries()
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const context = writable({})
|
|
112
|
+
$: $context = {
|
|
113
|
+
updateSort,
|
|
114
|
+
fillHeader,
|
|
115
|
+
sorting,
|
|
116
|
+
updateFilter,
|
|
117
|
+
}
|
|
118
|
+
setContext(dtContext, context)
|
|
119
|
+
|
|
120
|
+
const fire = createEventDispatcher()
|
|
121
|
+
const pass = handler$(
|
|
122
|
+
(row) => fire("row-click", row)
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
let scroller = null
|
|
126
|
+
$: if (scroller !== null && isNaN(page) === false) {
|
|
127
|
+
scroller.scrollTop = 0
|
|
128
|
+
}
|
|
129
|
+
const jump = (evt) => {
|
|
130
|
+
if (evt.type === "keypress" && evt.key !== "Enter") {
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
const target = parseInt(evt.target.value)
|
|
134
|
+
if (isNaN(target) === true) {
|
|
135
|
+
jumpTarget = (page + 1).toString()
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
page = Math.max(
|
|
139
|
+
Math.min(jumpTarget - 1, maxPage),
|
|
140
|
+
0
|
|
141
|
+
)
|
|
142
|
+
jumpTarget = (page + 1).toString()
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
$: content = {
|
|
146
|
+
"fl.cross": "stretch",
|
|
147
|
+
p: "0px",
|
|
148
|
+
gap: "0px",
|
|
149
|
+
over: (scrollable === true) ? "auto" : null,
|
|
150
|
+
}
|
|
151
|
+
$: header = {
|
|
152
|
+
"h.min": rowHeight,
|
|
153
|
+
y: "0px",
|
|
154
|
+
z: "+10",
|
|
155
|
+
pos: (scrollable === true) ? "sticky" : null,
|
|
156
|
+
}
|
|
157
|
+
</script>
|
|
158
|
+
|
|
159
|
+
<Paper {color} h={height}>
|
|
160
|
+
<ws-flex use:wsx={content} slot="content" bind:this={scroller}>
|
|
161
|
+
<Table data={rows} {color} {fillHeader} {...$$restProps} b.t.w="0px">
|
|
162
|
+
<tr use:wsx={header} slot="header">
|
|
163
|
+
<slot name="header">
|
|
164
|
+
<th>No Header Defined</th>
|
|
165
|
+
</slot>
|
|
166
|
+
</tr>
|
|
167
|
+
<tr ws-x="[h {rowHeight}]" slot="row" let:row>
|
|
168
|
+
<slot name="row" {row}>
|
|
169
|
+
<th>No Row Defined</th>
|
|
170
|
+
</slot>
|
|
171
|
+
</tr>
|
|
172
|
+
<tr ws-x="[h {rowHeight}]" slot="empty-row" />
|
|
173
|
+
</Table>
|
|
174
|
+
</ws-flex>
|
|
175
|
+
<Grid slot="footer" gr.cols="min-content min-content min-content 1fr"
|
|
176
|
+
rows="32px" b="1px solid @color" b.b.w="4px">
|
|
177
|
+
{#if pageCount > 0}
|
|
178
|
+
<Button on:click={prev} disabled={page === 0}>
|
|
179
|
+
<Icon name="arrow-big-left" />
|
|
180
|
+
</Button>
|
|
181
|
+
<Button on:click={next} disabled={page === maxPage}>
|
|
182
|
+
<Icon name="arrow-big-right" />
|
|
183
|
+
</Button>
|
|
184
|
+
<Text adorn t.ws="nowrap">
|
|
185
|
+
Page
|
|
186
|
+
<input ws-x="[b 1px solid @text-color-normal] [w 36px] [r 4px]
|
|
187
|
+
[h 24px] [bg.c transaprent] [t.a center] [m.l 4px] [m.r 4px]"
|
|
188
|
+
type="text" bind:value={jumpTarget}
|
|
189
|
+
on:keypress={jump} on:blur={jump} />
|
|
190
|
+
/ {pageCount}
|
|
191
|
+
</Text>
|
|
192
|
+
{:else}
|
|
193
|
+
<div ws-x="[col span 3] [p.l 4px]">
|
|
194
|
+
No data to show
|
|
195
|
+
</div>
|
|
196
|
+
{/if}
|
|
197
|
+
<slot name="action" />
|
|
198
|
+
</Grid>
|
|
199
|
+
</Paper>
|
|
@@ -1,34 +1,44 @@
|
|
|
1
|
-
# EntryButton
|
|
2
|
-
|
|
3
|
-
The EntryButton is a convenient way to display modals and screens over
|
|
4
|
-
content without needing to bind variables have lots of Modal elements in
|
|
5
|
-
addition to the buttons that show them.
|
|
6
|
-
|
|
7
|
-
## Props
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</
|
|
34
|
-
|
|
1
|
+
# EntryButton
|
|
2
|
+
|
|
3
|
+
The EntryButton is a convenient way to display modals and screens over
|
|
4
|
+
content without needing to bind variables have lots of Modal elements in
|
|
5
|
+
addition to the buttons that show them.
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
### component
|
|
10
|
+
The component to show when clicked
|
|
11
|
+
|
|
12
|
+
### props
|
|
13
|
+
The props to pass to the component when it is shown, or a function that
|
|
14
|
+
generates the props when called.
|
|
15
|
+
|
|
16
|
+
### this
|
|
17
|
+
The wrapper for the component. Default is [Modal](../layout/modal.md) but any
|
|
18
|
+
component that has the same interface as Modal will work.
|
|
19
|
+
|
|
20
|
+
## Events
|
|
21
|
+
|
|
22
|
+
### entry
|
|
23
|
+
When the component is closed the entry event is fired. The detail
|
|
24
|
+
property of the event will have the value from closing it.
|
|
25
|
+
|
|
26
|
+
## Example
|
|
27
|
+
```svelte
|
|
28
|
+
<script>
|
|
29
|
+
const propsFunc = () => ({
|
|
30
|
+
now: Date.now(),
|
|
31
|
+
rand: Math.random(),
|
|
32
|
+
})
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<EntryButton component={Subscreen} on:entry={console.log}>
|
|
36
|
+
Open Subscreen
|
|
37
|
+
</EntryButton>
|
|
38
|
+
<EntryButton component={CoolDialog} props={{ thing: true }} on:entry={console.log}>
|
|
39
|
+
Open Subscreen
|
|
40
|
+
</EntryButton>
|
|
41
|
+
<EntryButton this={CoolModal} component={CustomThing} on:entry={console.log} props={propsFunc}>
|
|
42
|
+
Open Subscreen
|
|
43
|
+
</EntryButton>
|
|
44
|
+
```
|