@gandalan/weblibs 1.5.8 → 1.5.9

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/index.js CHANGED
@@ -8,11 +8,14 @@ export { createAuthManager, fluentIdasAuthManager } from "./api/fluentAuthManage
8
8
  export { fetchEnvConfig } from "./api/fluentEnvUtils";
9
9
  export { restClient } from "./api/fluentRestClient";
10
10
 
11
+ // re-export all modules from the ui folder as named exports
12
+ export * from "./ui/index.js";
13
+
11
14
  /**
12
15
  * @typedef {Object} NeherApp3Module
13
16
  * @property {string} moduleName
14
17
  * @property {(app: NeherApp3) => void} setup
15
- * @property {(node : HTMLElement, props : *) => function} mount Must return an unmount function
18
+ * @property {(node : HTMLElement, props : NeherApp3Props) => function} mount Must return an unmount function
16
19
  * @property {string?} embedUrl
17
20
  */
18
21
 
@@ -37,6 +40,7 @@ export { restClient } from "./api/fluentRestClient";
37
40
  * @property {string} url - Relative URL to use for routes
38
41
  * @property {string} text - Display text
39
42
  * @property {string} [parent] - Parent menu item (optional). If not set, the item will be added to the top level menu.
43
+ * @property {boolean} [hidden] - If true, the menu item will not be displayed
40
44
  */
41
45
 
42
46
  /**
@@ -45,3 +49,11 @@ export { restClient } from "./api/fluentRestClient";
45
49
  * @global
46
50
  */
47
51
  globalThis.neherapp3 = globalThis.neherapp3 || {};
52
+
53
+ /**
54
+ * @typedef {Object} NeherApp3Props
55
+ * @property {import("./api/fluentApi").FluentApi} api
56
+ * @property {import("./api/fluentAuthManager").FluentAuthManager} authManager
57
+ * @property {import("./api/fluentApi").FluentApi} idas
58
+ */
59
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "1.5.8",
3
+ "version": "1.5.9",
4
4
  "description": "WebLibs for Gandalan JS/TS projects",
5
5
  "keywords": [
6
6
  "gandalan"
package/ui/Grid.svelte ADDED
@@ -0,0 +1,44 @@
1
+ <script>
2
+ let {
3
+ data,
4
+ hideCols = [],
5
+ onclick=(row, col) => {},
6
+ dataCell = defaultDataCell,
7
+ headerCell = defaultHeaderCell
8
+ } = $props();
9
+ </script>
10
+
11
+ {#if data.length}
12
+ <table class="w-full">
13
+ <thead>
14
+ <tr>
15
+ {#each Object.keys(data[0]) as key}
16
+ {#if hideCols.indexOf(key) === -1}
17
+ <th>{@render headerCell(key)}</th>
18
+ {/if}
19
+ {/each}
20
+ </tr>
21
+ </thead>
22
+ <tbody class="overflow-auto">
23
+ {#each data as row}
24
+ <tr class="hover:bg-gray-300" class:cursor-pointer={onclick}>
25
+ {#each Object.keys(data[0]) as key}
26
+ {#if hideCols.indexOf(key) === -1}
27
+ <td onclick={(e) => { e.preventDefault(); onclick(row, key); }}>{@render dataCell(row[key])}</td>
28
+ {/if}
29
+ {/each}
30
+ </tr>
31
+ {/each}
32
+ </tbody>
33
+ </table>
34
+ {:else}
35
+ <progress>Loading</progress>
36
+ {/if}
37
+
38
+ {#snippet defaultHeaderCell(content)}
39
+ <b>{content}</b>
40
+ {/snippet}
41
+
42
+ {#snippet defaultDataCell(content)}
43
+ {content}
44
+ {/snippet}
package/ui/css/app.css ADDED
@@ -0,0 +1,9 @@
1
+ @import "tailwindcss";
2
+
3
+ h1 { @apply text-2xl font-bold flex items-center; }
4
+ h1 img { @apply pr-3 h-6; }
5
+ button { @apply bg-gray-200 border border-gray-300 text-black px-2 py-2 rounded-md hover:bg-white; }
6
+ input { @apply border border-gray-300 text-black px-2 py-2 rounded-md; }
7
+ table { @apply w-full; }
8
+ th { @apply border border-gray-300 p-1 text-left bg-[#868686] text-white font-normal sticky top-0; }
9
+ td { @apply border border-gray-300 text-black p-1; }
package/ui/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import Grid from "./Grid.svelte";
2
+
3
+ export { Grid };
package/jsconfig.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "allowJs": true,
4
- /**
5
- * Typecheck JS in `.svelte` and `.js` files by default.
6
- * Disable this if you'd like to use dynamic types.
7
- */
8
- "checkJs": false, // Default: true
9
- "esModuleInterop": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "resolveJsonModule": true,
12
- "skipLibCheck": true,
13
- "lib": [ "ES6" ],
14
- /**
15
- * To have warnings / errors of the Svelte compiler at the
16
- * correct position, enable source maps by default.
17
- */
18
- "sourceMap": true,
19
- "strict": true
20
- }
21
- }