@bexis2/bexis2-core-ui 0.2.14 → 0.2.16

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,4 +1,15 @@
1
1
  # bexis-core-ui
2
+ ## v0.2.16
3
+ - Table
4
+ - width - fit to screen
5
+ - Cell - drag to change the height
6
+ - define a height to scroll the content
7
+ - header allways on top whie scrolling
8
+
9
+ ## v0.2.15
10
+ - Page - centered -> min width defined
11
+ - MultiSelect -> add clearable
12
+
2
13
  ## v0.2.14
3
14
  - change fileUploaderModel to FileUploaderType
4
15
  - remove AllFilesReadable, AsciiFileReaderInfo & LastModification from fileuploaderType
@@ -8,7 +8,7 @@ import {
8
8
  addTableFilter
9
9
  } from "svelte-headless-table/plugins";
10
10
  import { computePosition, autoUpdate, offset, shift, flip, arrow } from "@floating-ui/dom";
11
- import { storePopup } from "@skeletonlabs/skeleton";
11
+ import { SlideToggle, storePopup } from "@skeletonlabs/skeleton";
12
12
  storePopup.set({ computePosition, autoUpdate, offset, shift, flip, arrow });
13
13
  import TableFilter from "./TableFilter.svelte";
14
14
  import TablePagination from "./TablePagination.svelte";
@@ -18,10 +18,12 @@ let {
18
18
  id: tableId,
19
19
  data,
20
20
  columns,
21
+ height = null,
21
22
  optionsComponent,
22
23
  defaultPageSize = 10,
23
24
  pageSizes = [5, 10, 15, 20]
24
25
  } = config;
26
+ let fitToScreen = true;
25
27
  const dispatch = createEventDispatcher();
26
28
  const actionDispatcher = (obj) => dispatch("action", obj);
27
29
  const table = createTable(data, {
@@ -128,88 +130,101 @@ if (optionsComponent !== void 0) {
128
130
  const createdTableColumns = table.createColumns(tableColumns);
129
131
  const { headerRows, pageRows, tableAttrs, tableBodyAttrs, pluginStates } = table.createViewModel(createdTableColumns);
130
132
  const { filterValue } = pluginStates.tableFilter;
131
- </script>
132
-
133
- <div class="grid gap-2">
134
- <div class="table-container">
135
- {#if $data.length > 0}
136
- <input
137
- class="input p-2 mb-2 border border-primary-500"
138
- type="text"
139
- bind:value={$filterValue}
140
- placeholder="Search rows..."
141
- />
142
- {/if}
143
- <table {...$tableAttrs} class="table table-compact bg-tertiary-200">
144
- <thead>
145
- {#each $headerRows as headerRow (headerRow.id)}
146
- <Subscribe
147
- rowAttrs={headerRow.attrs()}
148
- let:rowAttrs
149
- rowProps={headerRow.props()}
150
- let:rowProps
151
- >
152
- <tr {...rowAttrs} class="bg-primary-300">
153
- {#each headerRow.cells as cell (cell.id)}
154
- <Subscribe attrs={cell.attrs()} props={cell.props()} let:props let:attrs>
155
- <th scope="col" class="!p-2 w-min" {...attrs}>
156
- <div class="flex w-full justify-between items-center">
157
- <div class="flex gap-1">
158
- <span
159
- class:underline={props.sort.order}
160
- class:normal-case={cell.id !== cell.label}
161
- class:cursor-pointer={!props.sort.disabled}
162
- on:click={props.sort.toggle}
163
- on:keydown={props.sort.toggle}
164
- >
165
- {cell.render()}
166
- </span>
167
- <div class="w-2">
168
- {#if props.sort.order === 'asc'}
169
-
170
- {:else if props.sort.order === 'desc'}
171
-
172
- {/if}
173
- </div>
174
- </div>
175
- {#if cell.isData()}
176
- {#if props.colFilter?.render}
177
- <div>
178
- <Render of={props.colFilter.render} />
179
- </div>
180
- {/if}
181
- {/if}
182
- </div>
183
- </th>
184
- </Subscribe>
185
- {/each}
186
- </tr>
187
- </Subscribe>
188
- {:else}
189
- <p class="items-center justify-center flex w-full p-10 italic">Nothing to show here.</p>
190
- {/each}
191
- </thead>
192
-
193
- <tbody class="" {...$tableBodyAttrs}>
194
- {#each $pageRows as row (row.id)}
195
- <Subscribe rowAttrs={row.attrs()} let:rowAttrs>
196
- <tr {...rowAttrs}>
197
- {#each row.cells as cell (cell?.id)}
198
- <Subscribe attrs={cell.attrs()} let:attrs>
199
- <td {...attrs} class="!p-2 w-min">
200
- <div class="flex items-center w-full h-full table-cell-fit">
201
- <Render of={cell.render()} />
202
- </div>
203
- </td>
204
- </Subscribe>
205
- {/each}
206
- </tr>
207
- </Subscribe>
208
- {/each}
209
- </tbody>
210
- </table>
211
- </div>
212
- {#if $data.length > 0}
213
- <TablePagination pageConfig={pluginStates.page} {pageSizes} />
214
- {/if}
215
- </div>
133
+ </script>
134
+
135
+ <div class="grid gap-2 overflow-auto" class:w-max={!fitToScreen} class:w-full={fitToScreen}>
136
+ <div class="table-container">
137
+ {#if $data.length > 0}
138
+ <input
139
+ class="input p-2 mb-2 border border-primary-500"
140
+ type="text"
141
+ bind:value={$filterValue}
142
+ placeholder="Search rows..."
143
+ />
144
+ {/if}
145
+ <SlideToggle
146
+ name="slider-label"
147
+ active="bg-primary-500"
148
+ size="sm"
149
+ checked={fitToScreen}
150
+ on:change={() => (fitToScreen = !fitToScreen)}>Fit to screen</SlideToggle
151
+ >
152
+
153
+ <div class="overflow-auto" style="height: {height}px">
154
+ <table {...$tableAttrs} class="table table-compact bg-tertiary-200 overflow-clip">
155
+ <thead class={height != null ? `sticky top-0` : ''}>
156
+ {#each $headerRows as headerRow (headerRow.id)}
157
+ <Subscribe
158
+ rowAttrs={headerRow.attrs()}
159
+ let:rowAttrs
160
+ rowProps={headerRow.props()}
161
+ let:rowProps
162
+ >
163
+ <tr {...rowAttrs} class="bg-primary-300">
164
+ {#each headerRow.cells as cell (cell.id)}
165
+ <Subscribe attrs={cell.attrs()} props={cell.props()} let:props let:attrs>
166
+ <th scope="col" class="!p-2 w-min" {...attrs}>
167
+ <div class="flex w-full justify-between items-center">
168
+ <div class="flex gap-1 whitespace-pre-wrap">
169
+ <span
170
+ class:underline={props.sort.order}
171
+ class:normal-case={cell.id !== cell.label}
172
+ class:cursor-pointer={!props.sort.disabled}
173
+ on:click={props.sort.toggle}
174
+ on:keydown={props.sort.toggle}
175
+ >
176
+ {cell.render()}
177
+ </span>
178
+ <div class="w-2">
179
+ {#if props.sort.order === 'asc'}
180
+
181
+ {:else if props.sort.order === 'desc'}
182
+
183
+ {/if}
184
+ </div>
185
+ </div>
186
+ {#if cell.isData()}
187
+ {#if props.colFilter?.render}
188
+ <div class="">
189
+ <Render of={props.colFilter.render} />
190
+ </div>
191
+ {/if}
192
+ {/if}
193
+ </div>
194
+ </th>
195
+ </Subscribe>
196
+ {/each}
197
+ </tr>
198
+ </Subscribe>
199
+ {:else}
200
+ <p class="items-center justify-center flex w-full p-10 italic">Nothing to show here.</p>
201
+ {/each}
202
+ </thead>
203
+
204
+ <tbody class="overflow-auto" {...$tableBodyAttrs}>
205
+ {#each $pageRows as row (row.id)}
206
+ <Subscribe rowAttrs={row.attrs()} let:rowAttrs>
207
+ <tr {...rowAttrs}>
208
+ {#each row.cells as cell (cell?.id)}
209
+ <Subscribe attrs={cell.attrs()} let:attrs>
210
+ <td {...attrs} class="!p-2 w-max focus:resize">
211
+ <div
212
+ class="flex items-center h-max overflow-x-auto resize-none hover:resize"
213
+ class:max-w-md={!fitToScreen}
214
+ >
215
+ <Render of={cell.render()} />
216
+ </div>
217
+ </td>
218
+ </Subscribe>
219
+ {/each}
220
+ </tr>
221
+ </Subscribe>
222
+ {/each}
223
+ </tbody>
224
+ </table>
225
+ </div>
226
+ </div>
227
+ {#if $data.length > 0}
228
+ <TablePagination pageConfig={pluginStates.page} {pageSizes} />
229
+ {/if}
230
+ </div>
@@ -115,8 +115,8 @@ if (type === "object") {
115
115
  <Fa icon={faFilter} size="12" />
116
116
  </button>
117
117
 
118
- <div data-popup={`${popupId}`}>
119
- <div class="card p-3 absolute grid gap-2 shadow-lg z-10 w-min bg-base-100">
118
+ <div data-popup={`${popupId}`} class="z-50">
119
+ <div class="card p-3 grid gap-2 shadow-lg w-min bg-base-100">
120
120
  <button
121
121
  class="btn variant-filled-primary btn-sm"
122
122
  type="button"
@@ -20,6 +20,7 @@
20
20
  export let invalid = false;
21
21
  export let loading = false;
22
22
  export let help = false;
23
+ export let clearable = true;
23
24
 
24
25
  let isLoaded = false;
25
26
 
@@ -150,6 +151,7 @@
150
151
  {placeholder}
151
152
  hasError={invalid}
152
153
  {loading}
154
+ {clearable}
153
155
  on:change
154
156
  on:input
155
157
  on:focus
@@ -18,6 +18,7 @@ export default class MultiSelect extends SvelteComponentTyped<{
18
18
  complexSource?: boolean | undefined;
19
19
  placeholder?: string | undefined;
20
20
  loading?: boolean | undefined;
21
+ clearable?: boolean | undefined;
21
22
  }, {
22
23
  change: CustomEvent<any>;
23
24
  input: CustomEvent<any>;
@@ -54,6 +55,7 @@ declare const __propDef: {
54
55
  complexSource?: boolean | undefined;
55
56
  placeholder?: string | undefined;
56
57
  loading?: boolean | undefined;
58
+ clearable?: boolean | undefined;
57
59
  };
58
60
  events: {
59
61
  change: CustomEvent<any>;
@@ -24,59 +24,59 @@ onMount(async () => {
24
24
  breadcrumbStore.clean();
25
25
  breadcrumbStore.addItem({ label: title, link: window.location.pathname });
26
26
  });
27
- </script>
28
-
29
- <AppShell>
30
- <!--header-->
31
- <svelte:fragment slot="header">
32
- <AppBar padding="0" spacing="space-y-0" background="white">
33
- <svelte:fragment slot="headline">
34
- <Header />
35
- {#if true}
36
- <Menu />
37
- {/if}
38
-
39
- <div class="grid grid-cols-2">
40
- <Breadcrumb {title} />
41
- <Docs {links} {note} />
42
- </div>
43
- </svelte:fragment>
44
- </AppBar>
45
- </svelte:fragment>
46
-
47
- <svelte:fragment slot="footer">
48
- <Footer />
49
- </svelte:fragment>
50
-
51
- <slot name="description" />
52
-
53
- <div class="flex flex-initial space-x-5">
54
- {#if $$slots.left}
55
- <div class="p-5 flex-shrink-0 w-96 w-min-96 border-y border-solid border-surface-500">
56
- <slot name="left" />
57
- </div>
58
- {/if}
59
-
60
- {#if contentLayoutType === pageContentLayoutType.center}
61
- <div class="flex justify-center w-screen">
62
- <div class="max-w-7xl p-5 space-y-5 border-y border-solid border-surface-500">
63
- <slot />
64
- </div>
65
- </div>
66
- {/if}
67
-
68
- {#if contentLayoutType === pageContentLayoutType.full}
69
- <div class="p-5 space-y-5 border-y border-solid border-surface-500 w-screen">
70
- <slot />
71
- </div>
72
- {/if}
73
-
74
- {#if $$slots.right}
75
- <div class=" p-5 flex-shrink-0 w-96 border-y border-solid border-surface-500">
76
- <slot name="right" />
77
- </div>
78
- {/if}
79
- </div>
80
-
81
- <HelpPopUp active={help} />
82
- </AppShell>
27
+ </script>
28
+
29
+ <AppShell>
30
+ <!--header-->
31
+ <svelte:fragment slot="header">
32
+ <AppBar padding="0" spacing="space-y-0" background="white">
33
+ <svelte:fragment slot="headline">
34
+ <Header />
35
+ {#if true}
36
+ <Menu />
37
+ {/if}
38
+
39
+ <div class="grid grid-cols-2">
40
+ <Breadcrumb {title} />
41
+ <Docs {links} {note} />
42
+ </div>
43
+ </svelte:fragment>
44
+ </AppBar>
45
+ </svelte:fragment>
46
+
47
+ <svelte:fragment slot="footer">
48
+ <Footer />
49
+ </svelte:fragment>
50
+
51
+ <slot name="description" />
52
+
53
+ <div class="flex flex-initial space-x-5">
54
+ {#if $$slots.left}
55
+ <div class="p-5 flex-shrink-0 w-96 w-min-96 border-y border-solid border-surface-500">
56
+ <slot name="left" />
57
+ </div>
58
+ {/if}
59
+
60
+ {#if contentLayoutType === pageContentLayoutType.center}
61
+ <div class="flex justify-center w-screen">
62
+ <div class="w-full max-w-7xl p-5 space-y-5 border-y border-solid border-surface-500">
63
+ <slot />
64
+ </div>
65
+ </div>
66
+ {/if}
67
+
68
+ {#if contentLayoutType === pageContentLayoutType.full}
69
+ <div class="p-5 space-y-5 border-y border-solid border-surface-500 w-screen">
70
+ <slot />
71
+ </div>
72
+ {/if}
73
+
74
+ {#if $$slots.right}
75
+ <div class=" p-5 flex-shrink-0 w-96 border-y border-solid border-surface-500">
76
+ <slot name="right" />
77
+ </div>
78
+ {/if}
79
+ </div>
80
+
81
+ <HelpPopUp active={help} />
82
+ </AppShell>
@@ -81,6 +81,7 @@ export interface Columns {
81
81
  export interface TableConfig<T> {
82
82
  id: string;
83
83
  data: Writable<T[]>;
84
+ height?: null | number;
84
85
  columns?: Columns;
85
86
  pageSizes?: number[];
86
87
  defaultPageSize?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite dev",