y200subcontrols 0.0.338 → 0.0.339
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/components/DataTable.svelte +4 -4
- package/dist/components/DataTablePaginator.svelte +31 -6
- package/dist/components/DataTablePaginator.svelte.d.ts +2 -1
- package/dist/components/LabeledSelect.svelte +24 -10
- package/dist/components/LabeledSelect.svelte.d.ts +2 -0
- package/package.json +1 -1
|
@@ -141,19 +141,19 @@ function closeAdvancedSearch() {
|
|
|
141
141
|
disabled={isBusy}
|
|
142
142
|
on:click={toggleAdvancedSearch}
|
|
143
143
|
type="button"
|
|
144
|
-
class="mx-1 w-
|
|
144
|
+
class="mx-1 w-9 h-9 bg-white border border-slate-300
|
|
145
145
|
text-slate-500
|
|
146
146
|
hover:bg-slate-100 rounded-full my-auto
|
|
147
147
|
disabled:bg-slate-100 disabled:text-slate-300
|
|
148
|
-
transition-all ease-in-out duration-150"
|
|
148
|
+
transition-all ease-in-out duration-150 flex"
|
|
149
149
|
>
|
|
150
150
|
<svg
|
|
151
151
|
xmlns="http://www.w3.org/2000/svg"
|
|
152
152
|
|
|
153
153
|
fill="currentColor"
|
|
154
|
-
class="w-
|
|
154
|
+
class="w-3 h-3 pointer-events-none inline-block {isAdvancedSearchOpen
|
|
155
155
|
? 'rotate-0'
|
|
156
|
-
: 'rotate-180'}
|
|
156
|
+
: 'rotate-180'} m-auto
|
|
157
157
|
transition-transform duration-150 ease-in-out"
|
|
158
158
|
viewBox="0 0 16 16"
|
|
159
159
|
>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
2
|
import LabeledFormInput from "./LabeledFormInput.svelte";
|
|
3
|
+
import LabeledSelect from "./LabeledSelect.svelte";
|
|
3
4
|
const dispatch = createEventDispatcher();
|
|
4
|
-
export let
|
|
5
|
+
export let recordsPerPageArray = [10, 25, 50, 100];
|
|
6
|
+
export let recordsPerPage = 10;
|
|
5
7
|
export let currentPage;
|
|
6
8
|
export let totalRecords;
|
|
7
9
|
let pagesCount = 0;
|
|
@@ -18,6 +20,15 @@ function handleCurrentPageChanged(event) {
|
|
|
18
20
|
currentPage = _currentPage - 1;
|
|
19
21
|
handlePageChanged();
|
|
20
22
|
}
|
|
23
|
+
function handleRecordsPerPageChanged(event) {
|
|
24
|
+
const target = event.target;
|
|
25
|
+
if (!target) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const value = Number(target.value);
|
|
29
|
+
recordsPerPage = value;
|
|
30
|
+
handlePageChanged();
|
|
31
|
+
}
|
|
21
32
|
function handlePageChanged() {
|
|
22
33
|
if (currentPage < 0) {
|
|
23
34
|
currentPage = 0;
|
|
@@ -25,17 +36,31 @@ function handlePageChanged() {
|
|
|
25
36
|
if (currentPage > pagesCount - 1) {
|
|
26
37
|
currentPage = pagesCount - 1;
|
|
27
38
|
}
|
|
28
|
-
dispatch("pagechanged",
|
|
39
|
+
dispatch("pagechanged", {
|
|
40
|
+
currentPage,
|
|
41
|
+
recordsPerPage
|
|
42
|
+
});
|
|
29
43
|
}
|
|
30
44
|
</script>
|
|
31
45
|
|
|
32
46
|
<div class="border border-slate-300 rounded flex p-2">
|
|
33
|
-
<div
|
|
47
|
+
<div class="my-auto flex space-x-2">
|
|
48
|
+
<label for="recordsPerPageSelect" class="text-sm my-auto text-slate-600">
|
|
49
|
+
Records per page
|
|
50
|
+
</label>
|
|
51
|
+
<LabeledSelect
|
|
52
|
+
value={recordsPerPage}
|
|
53
|
+
id="recordsPerPageSelect"
|
|
54
|
+
on:change={handleRecordsPerPageChanged}
|
|
55
|
+
>
|
|
56
|
+
{#each recordsPerPageArray as recperPage (recperPage)}
|
|
57
|
+
<option value={recperPage}>{recperPage}</option>
|
|
58
|
+
{/each}
|
|
59
|
+
</LabeledSelect>
|
|
60
|
+
</div>
|
|
34
61
|
|
|
35
62
|
<div class="ml-auto flex space-x-3">
|
|
36
|
-
|
|
37
|
-
Page
|
|
38
|
-
</span>
|
|
63
|
+
<span class="inline-block my-auto text-sm text-slate-500"> Page </span>
|
|
39
64
|
<div class="w-14">
|
|
40
65
|
<LabeledFormInput
|
|
41
66
|
numeric={true}
|
|
@@ -6,6 +6,7 @@ export let value = void 0;
|
|
|
6
6
|
export let name = void 0;
|
|
7
7
|
export let placeholder = void 0;
|
|
8
8
|
export let validationText = void 0;
|
|
9
|
+
export let theme = "teal";
|
|
9
10
|
export let input = void 0;
|
|
10
11
|
export let visible = true;
|
|
11
12
|
export let disabled = false;
|
|
@@ -51,8 +52,7 @@ onMount(() => {
|
|
|
51
52
|
{#if labelText}
|
|
52
53
|
<label
|
|
53
54
|
for={id}
|
|
54
|
-
class="mb-1 inline-block text-slate-600 dark:text-neutral-200"
|
|
55
|
-
bind:this={inputContainer}
|
|
55
|
+
class="mb-1 inline-block text-slate-600 dark:text-neutral-200"
|
|
56
56
|
>
|
|
57
57
|
{labelText}
|
|
58
58
|
{#if required}
|
|
@@ -60,7 +60,7 @@ onMount(() => {
|
|
|
60
60
|
{/if}
|
|
61
61
|
</label>
|
|
62
62
|
{/if}
|
|
63
|
-
<div class="relative">
|
|
63
|
+
<div class="relative" bind:this={inputContainer}>
|
|
64
64
|
<select
|
|
65
65
|
bind:this={select}
|
|
66
66
|
{disabled}
|
|
@@ -70,26 +70,40 @@ onMount(() => {
|
|
|
70
70
|
{placeholder}
|
|
71
71
|
{name}
|
|
72
72
|
on:change
|
|
73
|
-
class="border peer block w-full py-1
|
|
73
|
+
class="border peer block w-full py-1 pl-2 pr-10 rounded-md shadow-sm bg-white text-neutral-900
|
|
74
74
|
focus:outline-none focus:ring
|
|
75
75
|
placeholder:text-sm placeholder:font-thin
|
|
76
76
|
dark:bg-slate-900 dark:text-neutral-100 appearance-none
|
|
77
|
+
|
|
77
78
|
{!isValid
|
|
78
79
|
? 'border-pink-600 dark:border-pink-500 focus:ring-pink-600/20 dark:focus:ring-pink-600/40'
|
|
79
|
-
: 'dark:border-slate-600 border-slate-300
|
|
80
|
+
: 'dark:border-slate-600 border-slate-300'}
|
|
81
|
+
{isValid && theme === 'teal' ? ' focus:ring-teal-600/20 dark:focus:ring-teal-600/30' : ''}
|
|
80
82
|
"
|
|
81
83
|
>
|
|
82
84
|
<slot />
|
|
83
85
|
</select>
|
|
84
86
|
<span
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
class="absolute right-0 inset-y-0 w-8 flex text-slate-500 pointer-events-none
|
|
88
|
+
{theme === 'teal' ? 'peer-hover:text-teal-600 peer-focus:text-teal-600' : ''}
|
|
89
|
+
{theme === 'blue' ? 'peer-hover:text-blue-500 peer-focus:text-blue-500' : ''}
|
|
90
|
+
"
|
|
88
91
|
>
|
|
89
|
-
<
|
|
92
|
+
<svg
|
|
93
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
94
|
+
width="16"
|
|
95
|
+
height="16"
|
|
96
|
+
fill="currentColor"
|
|
97
|
+
class="w-4 h-4 block m-auto"
|
|
98
|
+
viewBox="0 0 16 16"
|
|
99
|
+
>
|
|
100
|
+
<path
|
|
101
|
+
fill-rule="evenodd"
|
|
102
|
+
d="M1.553 6.776a.5.5 0 0 1 .67-.223L8 9.44l5.776-2.888a.5.5 0 1 1 .448.894l-6 3a.5.5 0 0 1-.448 0l-6-3a.5.5 0 0 1-.223-.67"
|
|
103
|
+
/>
|
|
104
|
+
</svg>
|
|
90
105
|
</span>
|
|
91
106
|
</div>
|
|
92
|
-
|
|
93
107
|
|
|
94
108
|
{#if validationText && !isValid}
|
|
95
109
|
<div class="text-sm text-pink-600 dark:text-pink-500 my-2">
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ColorThemes } from './types.js';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
labelText?: string | undefined;
|
|
@@ -8,6 +9,7 @@ declare const __propDef: {
|
|
|
8
9
|
name?: string | undefined;
|
|
9
10
|
placeholder?: string | undefined;
|
|
10
11
|
validationText?: string | undefined;
|
|
12
|
+
theme?: ColorThemes;
|
|
11
13
|
input?: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | any | undefined;
|
|
12
14
|
visible?: boolean;
|
|
13
15
|
disabled?: boolean;
|