@bexis2/bexis2-core-ui 0.0.26 → 0.0.27

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/README.md CHANGED
@@ -1,9 +1,57 @@
1
1
  # bexis-core-ui
2
2
 
3
- ## new in version 0.0.26
3
+ ## v0.0.27
4
4
 
5
- ## Updates
5
+ ### add
6
+ #### components
7
+ - Table
8
+ - TableFilter
9
+ - cloumnFilter
10
+ - searchFilter
11
+
12
+ #### types
13
+ - TableConfig
14
+ - Columns
15
+ - Column
16
+ - Input
17
+
18
+ <hr/>
19
+
20
+ ## v0.0.26
21
+
22
+ ### updates
6
23
 
7
24
  - fix bugs in checkbox list
8
25
  - fix bugs in multi select
9
26
 
27
+ <hr/>
28
+
29
+ ## v0.0.25
30
+
31
+ ### adds
32
+ #### components
33
+ - Spinner
34
+ - FileUploader
35
+ - FileInfo
36
+ - FileIcon
37
+ -
38
+ #### types
39
+ - FileUploaderModel
40
+
41
+ <hr/>
42
+
43
+ ## v0.0.23
44
+
45
+ ### updates
46
+ - update bexis 2 theme
47
+
48
+ ### adds
49
+ - Checkbox
50
+ - CheckboxKVPList
51
+ - CheckboxList
52
+ - DateInput
53
+ - DropdownKVP
54
+ - MultiSelect
55
+ - NumberInput
56
+ - TextArea
57
+ - TextInput
@@ -71,98 +71,98 @@ const popupFeatured = {
71
71
  placement: "bottom-start"
72
72
  };
73
73
  const type = typeof $values[0];
74
- </script>
75
-
76
- <form class="">
77
- <button
78
- class:variant-filled-primary={active}
79
- class="btn w-max p-2"
80
- type="button"
81
- use:popup={popupFeatured}
82
- >
83
- <Fa icon={faFilter} size="12" />
84
- </button>
85
-
86
- <div data-popup={`${popupId}`}>
87
- <div class="card p-3 absolute grid gap-2 shadow-lg z-10 w-min">
88
- <button
89
- class="btn variant-filled-primary btn-sm"
90
- type="submit"
91
- on:click={() => {
92
- firstOption = 'isequal';
93
- firstValue = undefined;
94
- secondOption = 'isequal';
95
- secondValue = undefined;
96
-
97
- $filterValue = [firstOption, firstValue, secondOption, secondValue];
98
- active = false;
99
- }}>Clear Filter</button
100
- >
101
-
102
- <label for="" class="label normal-case text-sm">Show rows with value that</label>
103
- <div class="grid gap-2 w-full">
104
- <select
105
- class="select border border-primary-500 text-sm p-1"
106
- aria-label="Show rows with value that"
107
- bind:value={firstOption}
108
- on:click|stopPropagation
109
- >
110
- {#each options[type] as option (option)}
111
- <option value={option.value}>{option.label}</option>
112
- {/each}
113
- </select>
114
- {#if type === 'number'}
115
- <input
116
- type="number"
117
- class="input p-1 border border-primary-500"
118
- bind:value={firstValue}
119
- on:click|stopPropagation
120
- />
121
- {:else}
122
- <input
123
- type="text"
124
- class="input p-1 border border-primary-500"
125
- bind:value={firstValue}
126
- on:click|stopPropagation
127
- />
128
- {/if}
129
- </div>
130
- <label for="" class="label normal-case">And</label>
131
- <div class="grid gap-2 w-max">
132
- <select
133
- class="select border border-primary-500 text-sm p-1"
134
- aria-label="Show rows with value that"
135
- bind:value={secondOption}
136
- on:click|stopPropagation
137
- >
138
- {#each options[type] as option (option)}
139
- <option value={option.value}>{option.label}</option>
140
- {/each}
141
- </select>
142
- {#if type === 'number'}
143
- <input
144
- type="number"
145
- class="input p-1 border border-primary-500"
146
- bind:value={secondValue}
147
- on:click|stopPropagation
148
- />
149
- {:else}
150
- <input
151
- type="text"
152
- class="input p-1 border border-primary-500"
153
- bind:value={secondValue}
154
- on:click|stopPropagation
155
- />
156
- {/if}
157
- </div>
158
- <button
159
- class="btn variant-filled-primary btn-sm"
160
- type="submit"
161
- on:click={() => {
162
- active = firstValue?.toString().length > 0 || secondValue?.toString().length > 0;
163
- $filterValue = [firstOption, firstValue, secondOption, secondValue];
164
- }}>Submit</button
165
- >
166
- </div>
167
- </div>
168
- </form>
74
+ </script>
75
+
76
+ <form class="">
77
+ <button
78
+ class:variant-filled-primary={active}
79
+ class="btn w-max p-2"
80
+ type="button"
81
+ use:popup={popupFeatured}
82
+ >
83
+ <Fa icon={faFilter} size="12" />
84
+ </button>
85
+
86
+ <div data-popup={`${popupId}`}>
87
+ <div class="card p-3 absolute grid gap-2 shadow-lg z-10 w-min">
88
+ <button
89
+ class="btn variant-filled-primary btn-sm"
90
+ type="submit"
91
+ on:click|preventDefault={() => {
92
+ firstOption = 'isequal';
93
+ firstValue = undefined;
94
+ secondOption = 'isequal';
95
+ secondValue = undefined;
96
+
97
+ $filterValue = [firstOption, firstValue, secondOption, secondValue];
98
+ active = false;
99
+ }}>Clear Filter</button
100
+ >
101
+
102
+ <label for="" class="label normal-case text-sm">Show rows with value that</label>
103
+ <div class="grid gap-2 w-full">
104
+ <select
105
+ class="select border border-primary-500 text-sm p-1"
106
+ aria-label="Show rows with value that"
107
+ bind:value={firstOption}
108
+ on:click|stopPropagation
109
+ >
110
+ {#each options[type] as option (option)}
111
+ <option value={option.value}>{option.label}</option>
112
+ {/each}
113
+ </select>
114
+ {#if type === 'number'}
115
+ <input
116
+ type="number"
117
+ class="input p-1 border border-primary-500"
118
+ bind:value={firstValue}
119
+ on:click|stopPropagation
120
+ />
121
+ {:else}
122
+ <input
123
+ type="text"
124
+ class="input p-1 border border-primary-500"
125
+ bind:value={firstValue}
126
+ on:click|stopPropagation
127
+ />
128
+ {/if}
129
+ </div>
130
+ <label for="" class="label normal-case">And</label>
131
+ <div class="grid gap-2 w-max">
132
+ <select
133
+ class="select border border-primary-500 text-sm p-1"
134
+ aria-label="Show rows with value that"
135
+ bind:value={secondOption}
136
+ on:click|stopPropagation
137
+ >
138
+ {#each options[type] as option (option)}
139
+ <option value={option.value}>{option.label}</option>
140
+ {/each}
141
+ </select>
142
+ {#if type === 'number'}
143
+ <input
144
+ type="number"
145
+ class="input p-1 border border-primary-500"
146
+ bind:value={secondValue}
147
+ on:click|stopPropagation
148
+ />
149
+ {:else}
150
+ <input
151
+ type="text"
152
+ class="input p-1 border border-primary-500"
153
+ bind:value={secondValue}
154
+ on:click|stopPropagation
155
+ />
156
+ {/if}
157
+ </div>
158
+ <button
159
+ class="btn variant-filled-primary btn-sm"
160
+ type="submit"
161
+ on:click|preventDefault={() => {
162
+ active = firstValue?.toString().length > 0 || secondValue?.toString().length > 0;
163
+ $filterValue = [firstOption, firstValue, secondOption, secondValue];
164
+ }}>Submit</button
165
+ >
166
+ </div>
167
+ </div>
168
+ </form>
@@ -20,41 +20,41 @@ $:
20
20
  goToNextPageDisabled = !$hasNextPage;
21
21
  $:
22
22
  goToPreviousPageDisabled = !$hasPreviousPage;
23
- </script>
24
-
25
- <div class="flex justify-center gap-1">
26
- <button
27
- class="btn btn-sm variant-filled-primary"
28
- on:click={goToFirstPage}
29
- disabled={goToFirstPageDisabled}
30
- >
31
- <Fa icon={faAnglesLeft} /></button
32
- >
33
- <button
34
- class="btn btn-sm variant-filled-primary"
35
- on:click={goToPreviousPage}
36
- disabled={goToPreviousPageDisabled}><Fa icon={faAngleLeft} /></button
37
- >
38
-
39
- <select
40
- name="pageSize"
41
- id="pageSize"
42
- class="select btn btn-sm variant-filled-primary w-min font-bold"
43
- bind:value={$pageSize}
44
- >
45
- {#each pageSizes as size}
46
- <option value={size}>{size}</option>
47
- {/each}
48
- </select>
49
-
50
- <button
51
- class="btn btn-sm variant-filled-primary"
52
- on:click={goToNextPage}
53
- disabled={goToNextPageDisabled}><Fa icon={faAngleRight} /></button
54
- >
55
- <button
56
- class="btn btn-sm variant-filled-primary"
57
- on:click={goToLastPage}
58
- disabled={goToLastPageDisabled}><Fa icon={faAnglesRight} /></button
59
- >
60
- </div>
23
+ </script>
24
+
25
+ <div class="flex justify-center gap-1">
26
+ <button
27
+ class="btn btn-sm variant-filled-primary"
28
+ on:click|preventDefault={goToFirstPage}
29
+ disabled={goToFirstPageDisabled}
30
+ >
31
+ <Fa icon={faAnglesLeft} /></button
32
+ >
33
+ <button
34
+ class="btn btn-sm variant-filled-primary"
35
+ on:click|preventDefault={goToPreviousPage}
36
+ disabled={goToPreviousPageDisabled}><Fa icon={faAngleLeft} /></button
37
+ >
38
+
39
+ <select
40
+ name="pageSize"
41
+ id="pageSize"
42
+ class="select btn btn-sm variant-filled-primary w-min font-bold"
43
+ bind:value={$pageSize}
44
+ >
45
+ {#each pageSizes as size}
46
+ <option value={size}>{size}</option>
47
+ {/each}
48
+ </select>
49
+
50
+ <button
51
+ class="btn btn-sm variant-filled-primary"
52
+ on:click|preventDefault={goToNextPage}
53
+ disabled={goToNextPageDisabled}><Fa icon={faAngleRight} /></button
54
+ >
55
+ <button
56
+ class="btn btn-sm variant-filled-primary"
57
+ on:click|preventDefault={goToLastPage}
58
+ disabled={goToLastPageDisabled}><Fa icon={faAnglesRight} /></button
59
+ >
60
+ </div>
@@ -0,0 +1,30 @@
1
+ <script>
2
+ export let showOnPx = 150;
3
+ let hidden = true;
4
+
5
+ function goTop() {
6
+ document.body.scrollIntoView();
7
+ }
8
+
9
+ function scrollContainer() {
10
+ return document.documentElement || document.body;
11
+ }
12
+
13
+ function handleOnScroll() {
14
+ if (!scrollContainer()) {
15
+ return;
16
+ }
17
+
18
+ if (scrollContainer().scrollTop > showOnPx) {
19
+ hidden = false;
20
+ } else {
21
+ hidden = true;
22
+ }
23
+ }
24
+ </script>
25
+
26
+ <svelte:window on:scroll={handleOnScroll} />
27
+
28
+ <div class="w-full items-center">
29
+ <button class="btn ring back-to-top" on:click={goTop} class:hidden >Back to top</button>
30
+ </div>
@@ -0,0 +1,23 @@
1
+ /** @typedef {typeof __propDef.props} BackToTopProps */
2
+ /** @typedef {typeof __propDef.events} BackToTopEvents */
3
+ /** @typedef {typeof __propDef.slots} BackToTopSlots */
4
+ export default class BackToTop extends SvelteComponentTyped<{
5
+ showOnPx?: number | undefined;
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {}> {
9
+ }
10
+ export type BackToTopProps = typeof __propDef.props;
11
+ export type BackToTopEvents = typeof __propDef.events;
12
+ export type BackToTopSlots = typeof __propDef.slots;
13
+ import { SvelteComponentTyped } from "svelte";
14
+ declare const __propDef: {
15
+ props: {
16
+ showOnPx?: number | undefined;
17
+ };
18
+ events: {
19
+ [evt: string]: CustomEvent<any>;
20
+ };
21
+ slots: {};
22
+ };
23
+ export {};
@@ -0,0 +1,3 @@
1
+ <div class="px-5 grid gap-5">
2
+ <slot/>
3
+ </div>
@@ -0,0 +1,27 @@
1
+ /** @typedef {typeof __propDef.props} PageProps */
2
+ /** @typedef {typeof __propDef.events} PageEvents */
3
+ /** @typedef {typeof __propDef.slots} PageSlots */
4
+ export default class Page extends SvelteComponentTyped<{
5
+ [x: string]: never;
6
+ }, {
7
+ [evt: string]: CustomEvent<any>;
8
+ }, {
9
+ default: {};
10
+ }> {
11
+ }
12
+ export type PageProps = typeof __propDef.props;
13
+ export type PageEvents = typeof __propDef.events;
14
+ export type PageSlots = typeof __propDef.slots;
15
+ import { SvelteComponentTyped } from "svelte";
16
+ declare const __propDef: {
17
+ props: {
18
+ [x: string]: never;
19
+ };
20
+ events: {
21
+ [evt: string]: CustomEvent<any>;
22
+ };
23
+ slots: {
24
+ default: {};
25
+ };
26
+ };
27
+ export {};
@@ -60,17 +60,17 @@
60
60
  --color-success-700: 56 136 50; /* ⬅ #388832 */
61
61
  --color-success-800: 45 109 40; /* ⬅ #2d6d28 */
62
62
  --color-success-900: 37 89 33; /* ⬅ #255921 */
63
- /* warning | #ef4444 */
64
- --color-warning-50: 253 227 227; /* ⬅ #fde3e3 */
65
- --color-warning-100: 252 218 218; /* ⬅ #fcdada */
66
- --color-warning-200: 251 208 208; /* ⬅ #fbd0d0 */
67
- --color-warning-300: 249 180 180; /* ⬅ #f9b4b4 */
68
- --color-warning-400: 244 124 124; /* ⬅ #f47c7c */
69
- --color-warning-500: 239 68 68; /* ⬅ #ef4444 */
70
- --color-warning-600: 215 61 61; /* ⬅ #d73d3d */
71
- --color-warning-700: 179 51 51; /* ⬅ #b33333 */
72
- --color-warning-800: 143 41 41; /* ⬅ #8f2929 */
73
- --color-warning-900: 117 33 33; /* ⬅ #752121 */
63
+ /* warning | #EAB308 */
64
+ --color-warning-50: 252 244 218; /* ⬅ #fcf4da */
65
+ --color-warning-100: 251 240 206; /* ⬅ #fbf0ce */
66
+ --color-warning-200: 250 236 193; /* ⬅ #faecc1 */
67
+ --color-warning-300: 247 225 156; /* ⬅ #f7e19c */
68
+ --color-warning-400: 240 202 82; /* ⬅ #f0ca52 */
69
+ --color-warning-500: 234 179 8; /* ⬅ #EAB308 */
70
+ --color-warning-600: 211 161 7; /* ⬅ #d3a107 */
71
+ --color-warning-700: 176 134 6; /* ⬅ #b08606 */
72
+ --color-warning-800: 140 107 5; /* ⬅ #8c6b05 */
73
+ --color-warning-900: 115 88 4; /* ⬅ #735804 */
74
74
  /* error | #FF0000 */
75
75
  --color-error-50: 255 217 217; /* ⬅ #ffd9d9 */
76
76
  --color-error-100: 255 204 204; /* ⬅ #ffcccc */
@@ -82,15 +82,16 @@
82
82
  --color-error-700: 191 0 0; /* ⬅ #bf0000 */
83
83
  --color-error-800: 153 0 0; /* ⬅ #990000 */
84
84
  --color-error-900: 125 0 0; /* ⬅ #7d0000 */
85
- /* surface | #dddddd */
86
- --color-surface-50: 250 250 250; /* ⬅ #fafafa */
87
- --color-surface-100: 248 248 248; /* ⬅ #f8f8f8 */
88
- --color-surface-200: 247 247 247; /* ⬅ #f7f7f7 */
89
- --color-surface-300: 241 241 241; /* ⬅ #f1f1f1 */
90
- --color-surface-400: 231 231 231; /* ⬅ #e7e7e7 */
91
- --color-surface-500: 221 221 221; /* ⬅ #dddddd */
92
- --color-surface-600: 199 199 199; /* ⬅ #c7c7c7 */
93
- --color-surface-700: 166 166 166; /* ⬅ #a6a6a6 */
94
- --color-surface-800: 133 133 133; /* ⬅ #858585 */
95
- --color-surface-900: 108 108 108; /* ⬅ #6c6c6c */
96
- }
85
+ /* surface | #dddddd */
86
+ --color-surface-50: 250 250 250; /* ⬅ #fafafa */
87
+ --color-surface-100: 248 248 248; /* ⬅ #f8f8f8 */
88
+ --color-surface-200: 247 247 247; /* ⬅ #f7f7f7 */
89
+ --color-surface-300: 241 241 241; /* ⬅ #f1f1f1 */
90
+ --color-surface-400: 231 231 231; /* ⬅ #e7e7e7 */
91
+ --color-surface-500: 221 221 221; /* ⬅ #dddddd */
92
+ --color-surface-600: 199 199 199; /* ⬅ #c7c7c7 */
93
+ --color-surface-700: 166 166 166; /* ⬅ #a6a6a6 */
94
+ --color-surface-800: 133 133 133; /* ⬅ #858585 */
95
+ --color-surface-900: 80 80 80; /* ⬅ #6c6c6c */
96
+
97
+ }
package/dist/index.d.ts CHANGED
@@ -13,9 +13,15 @@ import MultiSelect from './components/form/MultiSelect.svelte';
13
13
  import NumberInput from './components/form/NumberInput.svelte';
14
14
  import TextInput from './components/form/TextInput.svelte';
15
15
  import TextArea from './components/form/TextArea.svelte';
16
+ import Table from './components/Table/Table.svelte';
17
+ import TableFilter from './components/Table/TableFilter.svelte';
18
+ import { columnFilter, searchFilter } from './components/Table/filter';
19
+ import type { TableConfig, Columns, Column } from './models/Models';
16
20
  export { Checkbox, CheckboxKVPList, CheckboxList, DateInput, DropdownKVP, MultiSelect, NumberInput, TextArea, TextInput };
17
21
  export { FileInfo, FileIcon, FileUploader };
18
22
  export { ListView, TableView, Spinner };
19
23
  export { Api } from './services/Api.js';
20
24
  export { host, username, password, setApiConfig } from './stores/apistore.js';
21
- export type { user, FileUploaderModel } from './models/Models.js';
25
+ export type { user, Input, FileUploaderModel } from './models/Models.js';
26
+ export { Table, TableFilter, columnFilter, searchFilter };
27
+ export type { TableConfig, Columns, Column };
package/dist/index.js CHANGED
@@ -14,6 +14,9 @@ import MultiSelect from './components/form/MultiSelect.svelte';
14
14
  import NumberInput from './components/form/NumberInput.svelte';
15
15
  import TextInput from './components/form/TextInput.svelte';
16
16
  import TextArea from './components/form/TextArea.svelte';
17
+ import Table from './components/Table/Table.svelte';
18
+ import TableFilter from './components/Table/TableFilter.svelte';
19
+ import { columnFilter, searchFilter } from './components/Table/filter';
17
20
  //Form
18
21
  export { Checkbox, CheckboxKVPList, CheckboxList, DateInput, DropdownKVP, MultiSelect, NumberInput, TextArea, TextInput };
19
22
  //File
@@ -23,3 +26,5 @@ export { ListView, TableView, Spinner };
23
26
  //Api
24
27
  export { Api } from './services/Api.js';
25
28
  export { host, username, password, setApiConfig } from './stores/apistore.js';
29
+ // Table
30
+ export { Table, TableFilter, columnFilter, searchFilter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite dev --host",
@@ -1,176 +1,176 @@
1
- <script lang="ts">
2
- import Fa from 'svelte-fa/src/fa.svelte';
3
- import { faFilter } from '@fortawesome/free-solid-svg-icons';
4
- import { popup } from '@skeletonlabs/skeleton';
5
- import type { PopupSettings } from '@skeletonlabs/skeleton';
6
-
7
- export let filterValue;
8
- export let values;
9
- export let id;
10
- export let tableId;
11
-
12
- let firstOption;
13
- let firstValue;
14
- let secondOption;
15
- let secondValue;
16
- let active = false;
17
-
18
- const options = {
19
- number: [
20
- {
21
- value: 'isequal',
22
- label: 'Is equal to'
23
- },
24
- {
25
- value: 'isgreaterorequal',
26
- label: 'Is greater than or equal to'
27
- },
28
- {
29
- value: 'isgreater',
30
- label: 'Is greater than'
31
- },
32
- {
33
- value: 'islessorequal',
34
- label: 'Is less than or equal to'
35
- },
36
- {
37
- value: 'isless',
38
- label: 'Is less than'
39
- },
40
- {
41
- value: 'isnotequal',
42
- label: 'Is not equal to'
43
- }
44
- ],
45
- string: [
46
- {
47
- value: 'isequal',
48
- label: 'Is equal to'
49
- },
50
- {
51
- value: 'isnotequal',
52
- label: 'Is not equal to'
53
- },
54
- {
55
- value: 'starts',
56
- label: 'Starts with'
57
- },
58
- {
59
- value: 'contains',
60
- label: 'Contains'
61
- },
62
- {
63
- value: 'notcontains',
64
- label: 'Does not contain'
65
- },
66
- {
67
- value: 'ends',
68
- label: 'Ends with'
69
- }
70
- ]
71
- };
72
-
73
- const popupId = `${tableId}-${id}`;
74
-
75
- const popupFeatured: PopupSettings = {
76
- event: 'click',
77
- target: popupId,
78
- placement: 'bottom-start'
79
- };
80
-
81
- const type = typeof $values[0];
82
- </script>
83
-
84
- <form class="">
85
- <button
86
- class:variant-filled-primary={active}
87
- class="btn w-max p-2"
88
- type="button"
89
- use:popup={popupFeatured}
90
- >
91
- <Fa icon={faFilter} size="12" />
92
- </button>
93
-
94
- <div data-popup={`${popupId}`}>
95
- <div class="card p-3 absolute grid gap-2 shadow-lg z-10 w-min">
96
- <button
97
- class="btn variant-filled-primary btn-sm"
98
- type="submit"
99
- on:click={() => {
100
- firstOption = 'isequal';
101
- firstValue = undefined;
102
- secondOption = 'isequal';
103
- secondValue = undefined;
104
-
105
- $filterValue = [firstOption, firstValue, secondOption, secondValue];
106
- active = false;
107
- }}>Clear Filter</button
108
- >
109
-
110
- <label for="" class="label normal-case text-sm">Show rows with value that</label>
111
- <div class="grid gap-2 w-full">
112
- <select
113
- class="select border border-primary-500 text-sm p-1"
114
- aria-label="Show rows with value that"
115
- bind:value={firstOption}
116
- on:click|stopPropagation
117
- >
118
- {#each options[type] as option (option)}
119
- <option value={option.value}>{option.label}</option>
120
- {/each}
121
- </select>
122
- {#if type === 'number'}
123
- <input
124
- type="number"
125
- class="input p-1 border border-primary-500"
126
- bind:value={firstValue}
127
- on:click|stopPropagation
128
- />
129
- {:else}
130
- <input
131
- type="text"
132
- class="input p-1 border border-primary-500"
133
- bind:value={firstValue}
134
- on:click|stopPropagation
135
- />
136
- {/if}
137
- </div>
138
- <label for="" class="label normal-case">And</label>
139
- <div class="grid gap-2 w-max">
140
- <select
141
- class="select border border-primary-500 text-sm p-1"
142
- aria-label="Show rows with value that"
143
- bind:value={secondOption}
144
- on:click|stopPropagation
145
- >
146
- {#each options[type] as option (option)}
147
- <option value={option.value}>{option.label}</option>
148
- {/each}
149
- </select>
150
- {#if type === 'number'}
151
- <input
152
- type="number"
153
- class="input p-1 border border-primary-500"
154
- bind:value={secondValue}
155
- on:click|stopPropagation
156
- />
157
- {:else}
158
- <input
159
- type="text"
160
- class="input p-1 border border-primary-500"
161
- bind:value={secondValue}
162
- on:click|stopPropagation
163
- />
164
- {/if}
165
- </div>
166
- <button
167
- class="btn variant-filled-primary btn-sm"
168
- type="submit"
169
- on:click={() => {
170
- active = firstValue?.toString().length > 0 || secondValue?.toString().length > 0;
171
- $filterValue = [firstOption, firstValue, secondOption, secondValue];
172
- }}>Submit</button
173
- >
174
- </div>
175
- </div>
176
- </form>
1
+ <script lang="ts">
2
+ import Fa from 'svelte-fa/src/fa.svelte';
3
+ import { faFilter } from '@fortawesome/free-solid-svg-icons';
4
+ import { popup } from '@skeletonlabs/skeleton';
5
+ import type { PopupSettings } from '@skeletonlabs/skeleton';
6
+
7
+ export let filterValue;
8
+ export let values;
9
+ export let id;
10
+ export let tableId;
11
+
12
+ let firstOption;
13
+ let firstValue;
14
+ let secondOption;
15
+ let secondValue;
16
+ let active = false;
17
+
18
+ const options = {
19
+ number: [
20
+ {
21
+ value: 'isequal',
22
+ label: 'Is equal to'
23
+ },
24
+ {
25
+ value: 'isgreaterorequal',
26
+ label: 'Is greater than or equal to'
27
+ },
28
+ {
29
+ value: 'isgreater',
30
+ label: 'Is greater than'
31
+ },
32
+ {
33
+ value: 'islessorequal',
34
+ label: 'Is less than or equal to'
35
+ },
36
+ {
37
+ value: 'isless',
38
+ label: 'Is less than'
39
+ },
40
+ {
41
+ value: 'isnotequal',
42
+ label: 'Is not equal to'
43
+ }
44
+ ],
45
+ string: [
46
+ {
47
+ value: 'isequal',
48
+ label: 'Is equal to'
49
+ },
50
+ {
51
+ value: 'isnotequal',
52
+ label: 'Is not equal to'
53
+ },
54
+ {
55
+ value: 'starts',
56
+ label: 'Starts with'
57
+ },
58
+ {
59
+ value: 'contains',
60
+ label: 'Contains'
61
+ },
62
+ {
63
+ value: 'notcontains',
64
+ label: 'Does not contain'
65
+ },
66
+ {
67
+ value: 'ends',
68
+ label: 'Ends with'
69
+ }
70
+ ]
71
+ };
72
+
73
+ const popupId = `${tableId}-${id}`;
74
+
75
+ const popupFeatured: PopupSettings = {
76
+ event: 'click',
77
+ target: popupId,
78
+ placement: 'bottom-start'
79
+ };
80
+
81
+ const type = typeof $values[0];
82
+ </script>
83
+
84
+ <form class="">
85
+ <button
86
+ class:variant-filled-primary={active}
87
+ class="btn w-max p-2"
88
+ type="button"
89
+ use:popup={popupFeatured}
90
+ >
91
+ <Fa icon={faFilter} size="12" />
92
+ </button>
93
+
94
+ <div data-popup={`${popupId}`}>
95
+ <div class="card p-3 absolute grid gap-2 shadow-lg z-10 w-min">
96
+ <button
97
+ class="btn variant-filled-primary btn-sm"
98
+ type="submit"
99
+ on:click|preventDefault={() => {
100
+ firstOption = 'isequal';
101
+ firstValue = undefined;
102
+ secondOption = 'isequal';
103
+ secondValue = undefined;
104
+
105
+ $filterValue = [firstOption, firstValue, secondOption, secondValue];
106
+ active = false;
107
+ }}>Clear Filter</button
108
+ >
109
+
110
+ <label for="" class="label normal-case text-sm">Show rows with value that</label>
111
+ <div class="grid gap-2 w-full">
112
+ <select
113
+ class="select border border-primary-500 text-sm p-1"
114
+ aria-label="Show rows with value that"
115
+ bind:value={firstOption}
116
+ on:click|stopPropagation
117
+ >
118
+ {#each options[type] as option (option)}
119
+ <option value={option.value}>{option.label}</option>
120
+ {/each}
121
+ </select>
122
+ {#if type === 'number'}
123
+ <input
124
+ type="number"
125
+ class="input p-1 border border-primary-500"
126
+ bind:value={firstValue}
127
+ on:click|stopPropagation
128
+ />
129
+ {:else}
130
+ <input
131
+ type="text"
132
+ class="input p-1 border border-primary-500"
133
+ bind:value={firstValue}
134
+ on:click|stopPropagation
135
+ />
136
+ {/if}
137
+ </div>
138
+ <label for="" class="label normal-case">And</label>
139
+ <div class="grid gap-2 w-max">
140
+ <select
141
+ class="select border border-primary-500 text-sm p-1"
142
+ aria-label="Show rows with value that"
143
+ bind:value={secondOption}
144
+ on:click|stopPropagation
145
+ >
146
+ {#each options[type] as option (option)}
147
+ <option value={option.value}>{option.label}</option>
148
+ {/each}
149
+ </select>
150
+ {#if type === 'number'}
151
+ <input
152
+ type="number"
153
+ class="input p-1 border border-primary-500"
154
+ bind:value={secondValue}
155
+ on:click|stopPropagation
156
+ />
157
+ {:else}
158
+ <input
159
+ type="text"
160
+ class="input p-1 border border-primary-500"
161
+ bind:value={secondValue}
162
+ on:click|stopPropagation
163
+ />
164
+ {/if}
165
+ </div>
166
+ <button
167
+ class="btn variant-filled-primary btn-sm"
168
+ type="submit"
169
+ on:click|preventDefault={() => {
170
+ active = firstValue?.toString().length > 0 || secondValue?.toString().length > 0;
171
+ $filterValue = [firstOption, firstValue, secondOption, secondValue];
172
+ }}>Submit</button
173
+ >
174
+ </div>
175
+ </div>
176
+ </form>
@@ -1,61 +1,61 @@
1
- <script lang="ts">
2
- import Fa from 'svelte-fa/src/fa.svelte';
3
- import {
4
- faAnglesRight,
5
- faAngleRight,
6
- faAnglesLeft,
7
- faAngleLeft
8
- } from '@fortawesome/free-solid-svg-icons';
9
-
10
- export let pageConfig;
11
- export let pageSizes;
12
-
13
- const { pageIndex, pageCount, pageSize, hasNextPage, hasPreviousPage } = pageConfig;
14
-
15
- const goToFirstPage = () => ($pageIndex = 0);
16
- const goToLastPage = () => ($pageIndex = $pageCount - 1);
17
- const goToNextPage = () => ($pageIndex += 1);
18
- const goToPreviousPage = () => ($pageIndex -= 1);
19
-
20
- $: goToFirstPageDisabled = !$pageIndex;
21
- $: goToLastPageDisabled = $pageIndex == $pageCount - 1;
22
- $: goToNextPageDisabled = !$hasNextPage;
23
- $: goToPreviousPageDisabled = !$hasPreviousPage;
24
- </script>
25
-
26
- <div class="flex justify-center gap-1">
27
- <button
28
- class="btn btn-sm variant-filled-primary"
29
- on:click={goToFirstPage}
30
- disabled={goToFirstPageDisabled}
31
- >
32
- <Fa icon={faAnglesLeft} /></button
33
- >
34
- <button
35
- class="btn btn-sm variant-filled-primary"
36
- on:click={goToPreviousPage}
37
- disabled={goToPreviousPageDisabled}><Fa icon={faAngleLeft} /></button
38
- >
39
-
40
- <select
41
- name="pageSize"
42
- id="pageSize"
43
- class="select btn btn-sm variant-filled-primary w-min font-bold"
44
- bind:value={$pageSize}
45
- >
46
- {#each pageSizes as size}
47
- <option value={size}>{size}</option>
48
- {/each}
49
- </select>
50
-
51
- <button
52
- class="btn btn-sm variant-filled-primary"
53
- on:click={goToNextPage}
54
- disabled={goToNextPageDisabled}><Fa icon={faAngleRight} /></button
55
- >
56
- <button
57
- class="btn btn-sm variant-filled-primary"
58
- on:click={goToLastPage}
59
- disabled={goToLastPageDisabled}><Fa icon={faAnglesRight} /></button
60
- >
61
- </div>
1
+ <script lang="ts">
2
+ import Fa from 'svelte-fa/src/fa.svelte';
3
+ import {
4
+ faAnglesRight,
5
+ faAngleRight,
6
+ faAnglesLeft,
7
+ faAngleLeft
8
+ } from '@fortawesome/free-solid-svg-icons';
9
+
10
+ export let pageConfig;
11
+ export let pageSizes;
12
+
13
+ const { pageIndex, pageCount, pageSize, hasNextPage, hasPreviousPage } = pageConfig;
14
+
15
+ const goToFirstPage = () => ($pageIndex = 0);
16
+ const goToLastPage = () => ($pageIndex = $pageCount - 1);
17
+ const goToNextPage = () => ($pageIndex += 1);
18
+ const goToPreviousPage = () => ($pageIndex -= 1);
19
+
20
+ $: goToFirstPageDisabled = !$pageIndex;
21
+ $: goToLastPageDisabled = $pageIndex == $pageCount - 1;
22
+ $: goToNextPageDisabled = !$hasNextPage;
23
+ $: goToPreviousPageDisabled = !$hasPreviousPage;
24
+ </script>
25
+
26
+ <div class="flex justify-center gap-1">
27
+ <button
28
+ class="btn btn-sm variant-filled-primary"
29
+ on:click|preventDefault={goToFirstPage}
30
+ disabled={goToFirstPageDisabled}
31
+ >
32
+ <Fa icon={faAnglesLeft} /></button
33
+ >
34
+ <button
35
+ class="btn btn-sm variant-filled-primary"
36
+ on:click|preventDefault={goToPreviousPage}
37
+ disabled={goToPreviousPageDisabled}><Fa icon={faAngleLeft} /></button
38
+ >
39
+
40
+ <select
41
+ name="pageSize"
42
+ id="pageSize"
43
+ class="select btn btn-sm variant-filled-primary w-min font-bold"
44
+ bind:value={$pageSize}
45
+ >
46
+ {#each pageSizes as size}
47
+ <option value={size}>{size}</option>
48
+ {/each}
49
+ </select>
50
+
51
+ <button
52
+ class="btn btn-sm variant-filled-primary"
53
+ on:click|preventDefault={goToNextPage}
54
+ disabled={goToNextPageDisabled}><Fa icon={faAngleRight} /></button
55
+ >
56
+ <button
57
+ class="btn btn-sm variant-filled-primary"
58
+ on:click|preventDefault={goToLastPage}
59
+ disabled={goToLastPageDisabled}><Fa icon={faAnglesRight} /></button
60
+ >
61
+ </div>
@@ -0,0 +1,30 @@
1
+ <script>
2
+ export let showOnPx = 150;
3
+ let hidden = true;
4
+
5
+ function goTop() {
6
+ document.body.scrollIntoView();
7
+ }
8
+
9
+ function scrollContainer() {
10
+ return document.documentElement || document.body;
11
+ }
12
+
13
+ function handleOnScroll() {
14
+ if (!scrollContainer()) {
15
+ return;
16
+ }
17
+
18
+ if (scrollContainer().scrollTop > showOnPx) {
19
+ hidden = false;
20
+ } else {
21
+ hidden = true;
22
+ }
23
+ }
24
+ </script>
25
+
26
+ <svelte:window on:scroll={handleOnScroll} />
27
+
28
+ <div class="w-full items-center">
29
+ <button class="btn ring back-to-top" on:click={goTop} class:hidden >Back to top</button>
30
+ </div>
@@ -0,0 +1,3 @@
1
+ <div class="px-5 grid gap-5">
2
+ <slot/>
3
+ </div>
@@ -60,17 +60,17 @@
60
60
  --color-success-700: 56 136 50; /* ⬅ #388832 */
61
61
  --color-success-800: 45 109 40; /* ⬅ #2d6d28 */
62
62
  --color-success-900: 37 89 33; /* ⬅ #255921 */
63
- /* warning | #ef4444 */
64
- --color-warning-50: 253 227 227; /* ⬅ #fde3e3 */
65
- --color-warning-100: 252 218 218; /* ⬅ #fcdada */
66
- --color-warning-200: 251 208 208; /* ⬅ #fbd0d0 */
67
- --color-warning-300: 249 180 180; /* ⬅ #f9b4b4 */
68
- --color-warning-400: 244 124 124; /* ⬅ #f47c7c */
69
- --color-warning-500: 239 68 68; /* ⬅ #ef4444 */
70
- --color-warning-600: 215 61 61; /* ⬅ #d73d3d */
71
- --color-warning-700: 179 51 51; /* ⬅ #b33333 */
72
- --color-warning-800: 143 41 41; /* ⬅ #8f2929 */
73
- --color-warning-900: 117 33 33; /* ⬅ #752121 */
63
+ /* warning | #EAB308 */
64
+ --color-warning-50: 252 244 218; /* ⬅ #fcf4da */
65
+ --color-warning-100: 251 240 206; /* ⬅ #fbf0ce */
66
+ --color-warning-200: 250 236 193; /* ⬅ #faecc1 */
67
+ --color-warning-300: 247 225 156; /* ⬅ #f7e19c */
68
+ --color-warning-400: 240 202 82; /* ⬅ #f0ca52 */
69
+ --color-warning-500: 234 179 8; /* ⬅ #EAB308 */
70
+ --color-warning-600: 211 161 7; /* ⬅ #d3a107 */
71
+ --color-warning-700: 176 134 6; /* ⬅ #b08606 */
72
+ --color-warning-800: 140 107 5; /* ⬅ #8c6b05 */
73
+ --color-warning-900: 115 88 4; /* ⬅ #735804 */
74
74
  /* error | #FF0000 */
75
75
  --color-error-50: 255 217 217; /* ⬅ #ffd9d9 */
76
76
  --color-error-100: 255 204 204; /* ⬅ #ffcccc */
@@ -82,15 +82,16 @@
82
82
  --color-error-700: 191 0 0; /* ⬅ #bf0000 */
83
83
  --color-error-800: 153 0 0; /* ⬅ #990000 */
84
84
  --color-error-900: 125 0 0; /* ⬅ #7d0000 */
85
- /* surface | #dddddd */
86
- --color-surface-50: 250 250 250; /* ⬅ #fafafa */
87
- --color-surface-100: 248 248 248; /* ⬅ #f8f8f8 */
88
- --color-surface-200: 247 247 247; /* ⬅ #f7f7f7 */
89
- --color-surface-300: 241 241 241; /* ⬅ #f1f1f1 */
90
- --color-surface-400: 231 231 231; /* ⬅ #e7e7e7 */
91
- --color-surface-500: 221 221 221; /* ⬅ #dddddd */
92
- --color-surface-600: 199 199 199; /* ⬅ #c7c7c7 */
93
- --color-surface-700: 166 166 166; /* ⬅ #a6a6a6 */
94
- --color-surface-800: 133 133 133; /* ⬅ #858585 */
95
- --color-surface-900: 108 108 108; /* ⬅ #6c6c6c */
96
- }
85
+ /* surface | #dddddd */
86
+ --color-surface-50: 250 250 250; /* ⬅ #fafafa */
87
+ --color-surface-100: 248 248 248; /* ⬅ #f8f8f8 */
88
+ --color-surface-200: 247 247 247; /* ⬅ #f7f7f7 */
89
+ --color-surface-300: 241 241 241; /* ⬅ #f1f1f1 */
90
+ --color-surface-400: 231 231 231; /* ⬅ #e7e7e7 */
91
+ --color-surface-500: 221 221 221; /* ⬅ #dddddd */
92
+ --color-surface-600: 199 199 199; /* ⬅ #c7c7c7 */
93
+ --color-surface-700: 166 166 166; /* ⬅ #a6a6a6 */
94
+ --color-surface-800: 133 133 133; /* ⬅ #858585 */
95
+ --color-surface-900: 80 80 80; /* ⬅ #6c6c6c */
96
+
97
+ }
package/src/lib/index.ts CHANGED
@@ -1,45 +1,58 @@
1
- // Reexport your entry components here
2
- import ListView from './components/ListView.svelte';
3
- import TableView from './TableView.svelte';
4
-
5
- import FileIcon from './components/file/FileIcon.svelte';
6
- import FileInfo from './components/file/FileInfo.svelte';
7
- import FileUploader from './components/file/FileUploader.svelte';
8
-
9
- import Spinner from './components/spinner/Spinner.svelte';
10
-
11
- import Checkbox from './components/form/Checkbox.svelte';
12
- import CheckboxKVPList from './components/form/CheckboxKvPList.svelte';
13
- import CheckboxList from './components/form/CheckboxList.svelte';
14
- import DateInput from './components/form/DateInput.svelte';
15
- import DropdownKVP from './components/form/DropdownKvP.svelte';
16
- import MultiSelect from './components/form/MultiSelect.svelte';
17
- import NumberInput from './components/form/NumberInput.svelte';
18
- import TextInput from './components/form/TextInput.svelte';
19
- import TextArea from './components/form/TextArea.svelte';
20
-
21
- //Form
22
- export {
23
- Checkbox,
24
- CheckboxKVPList,
25
- CheckboxList,
26
- DateInput,
27
- DropdownKVP,
28
- MultiSelect,
29
- NumberInput,
30
- TextArea,
31
- TextInput
32
- };
33
-
34
- //File
35
- export { FileInfo, FileIcon, FileUploader };
36
-
37
- //others
38
- export { ListView, TableView, Spinner };
39
-
40
- //Api
41
- export { Api } from './services/Api.js';
42
- export { host, username, password, setApiConfig } from './stores/apistore.js';
43
-
44
- //Type
45
- export type { user, FileUploaderModel } from './models/Models.js';
1
+ // Reexport your entry components here
2
+ import ListView from './components/ListView.svelte';
3
+ import TableView from './TableView.svelte';
4
+
5
+ import FileIcon from './components/file/FileIcon.svelte';
6
+ import FileInfo from './components/file/FileInfo.svelte';
7
+ import FileUploader from './components/file/FileUploader.svelte';
8
+
9
+ import Spinner from './components/spinner/Spinner.svelte';
10
+
11
+ import Checkbox from './components/form/Checkbox.svelte';
12
+ import CheckboxKVPList from './components/form/CheckboxKvPList.svelte';
13
+ import CheckboxList from './components/form/CheckboxList.svelte';
14
+ import DateInput from './components/form/DateInput.svelte';
15
+ import DropdownKVP from './components/form/DropdownKvP.svelte';
16
+ import MultiSelect from './components/form/MultiSelect.svelte';
17
+ import NumberInput from './components/form/NumberInput.svelte';
18
+ import TextInput from './components/form/TextInput.svelte';
19
+ import TextArea from './components/form/TextArea.svelte';
20
+
21
+ import Table from './components/Table/Table.svelte';
22
+ import TableFilter from './components/Table/TableFilter.svelte';
23
+ import { columnFilter, searchFilter } from './components/Table/filter';
24
+ import type { TableConfig, Columns, Column } from './models/Models';
25
+
26
+ //Form
27
+ export {
28
+ Checkbox,
29
+ CheckboxKVPList,
30
+ CheckboxList,
31
+ DateInput,
32
+ DropdownKVP,
33
+ MultiSelect,
34
+ NumberInput,
35
+ TextArea,
36
+ TextInput
37
+ };
38
+
39
+ //File
40
+ export { FileInfo, FileIcon, FileUploader };
41
+
42
+ //others
43
+ export { ListView, TableView, Spinner };
44
+
45
+ //Api
46
+ export { Api } from './services/Api.js';
47
+ export { host, username, password, setApiConfig } from './stores/apistore.js';
48
+
49
+ //Type
50
+ export type {
51
+ user,
52
+ Input,
53
+ FileUploaderModel
54
+ } from './models/Models.js';
55
+
56
+ // Table
57
+ export { Table, TableFilter, columnFilter, searchFilter };
58
+ export type { TableConfig, Columns, Column };