firstly 0.0.1 → 0.0.2

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.
Files changed (156) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +18 -0
  3. package/README.md +12 -0
  4. package/esm/KitBaseEnum.d.ts +35 -0
  5. package/esm/KitBaseEnum.js +32 -0
  6. package/esm/KitEntity.d.ts +2 -0
  7. package/esm/KitEntity.js +24 -0
  8. package/esm/KitFields.d.ts +10 -0
  9. package/esm/KitFields.js +196 -0
  10. package/esm/ROUTES.d.ts +88 -0
  11. package/esm/ROUTES.js +98 -0
  12. package/esm/SqlDatabase/LogToConsoleCustom.d.ts +1 -0
  13. package/esm/SqlDatabase/LogToConsoleCustom.js +102 -0
  14. package/esm/api/index.d.ts +42 -0
  15. package/esm/api/index.js +97 -0
  16. package/esm/auth/Adapter.d.ts +10 -0
  17. package/esm/auth/Adapter.js +54 -0
  18. package/esm/auth/AuthController.d.ts +59 -0
  19. package/esm/auth/AuthController.js +434 -0
  20. package/esm/auth/Entities.d.ts +39 -0
  21. package/esm/auth/Entities.js +154 -0
  22. package/esm/auth/RoleController.d.ts +14 -0
  23. package/esm/auth/RoleController.js +57 -0
  24. package/esm/auth/helper.d.ts +1 -0
  25. package/esm/auth/helper.js +7 -0
  26. package/esm/auth/index.d.ts +153 -0
  27. package/esm/auth/index.js +279 -0
  28. package/esm/auth/providers/github.d.ts +25 -0
  29. package/esm/auth/providers/github.js +51 -0
  30. package/esm/auth/providers/index.d.ts +3 -0
  31. package/esm/auth/providers/index.js +26 -0
  32. package/esm/auth/providers/strava.d.ts +25 -0
  33. package/esm/auth/providers/strava.js +51 -0
  34. package/esm/auth/static/assets/Page-BMFREPjF.d.ts +5 -0
  35. package/esm/auth/static/assets/Page-BMFREPjF.js +18 -0
  36. package/esm/auth/static/assets/Page-BMOLAIFx.d.ts +5 -0
  37. package/esm/auth/static/assets/Page-BMOLAIFx.js +1 -0
  38. package/esm/auth/static/assets/Page-BwHye0GW.d.ts +5 -0
  39. package/esm/auth/static/assets/Page-BwHye0GW.js +1 -0
  40. package/esm/auth/static/assets/Page-gV58jf2r.css +1 -0
  41. package/esm/auth/static/assets/index-CKmKKRRL.d.ts +53 -0
  42. package/esm/auth/static/assets/index-CKmKKRRL.js +2 -0
  43. package/esm/auth/static/assets/index-R27C_TlP.css +4 -0
  44. package/esm/auth/static/favicon.svg +79 -0
  45. package/esm/auth/static/index.html +14 -0
  46. package/esm/auth/types.d.ts +33 -0
  47. package/esm/auth/types.js +1 -0
  48. package/esm/bin/cmd.d.ts +1 -0
  49. package/esm/bin/cmd.js +408 -0
  50. package/esm/changeLog/index.d.ts +55 -0
  51. package/esm/changeLog/index.js +179 -0
  52. package/esm/cron/index.d.ts +60 -0
  53. package/esm/cron/index.js +102 -0
  54. package/esm/feedback/FeedbackController.d.ts +30 -0
  55. package/esm/feedback/FeedbackController.js +313 -0
  56. package/esm/feedback/index.d.ts +18 -0
  57. package/esm/feedback/index.js +14 -0
  58. package/esm/feedback/ui/DialogIssue.svelte +102 -0
  59. package/esm/feedback/ui/DialogIssue.svelte.d.ts +20 -0
  60. package/esm/feedback/ui/DialogIssues.svelte +91 -0
  61. package/esm/feedback/ui/DialogIssues.svelte.d.ts +20 -0
  62. package/esm/feedback/ui/DialogMilestones.svelte +38 -0
  63. package/esm/feedback/ui/DialogMilestones.svelte.d.ts +18 -0
  64. package/esm/feedback/ui/Feedback.svelte +12 -0
  65. package/esm/feedback/ui/Feedback.svelte.d.ts +16 -0
  66. package/esm/formats/dates.d.ts +18 -0
  67. package/esm/formats/dates.js +35 -0
  68. package/esm/formats/index.d.ts +4 -0
  69. package/esm/formats/index.js +3 -0
  70. package/esm/formats/numbers.d.ts +4 -0
  71. package/esm/formats/numbers.js +34 -0
  72. package/esm/formats/strings.d.ts +11 -0
  73. package/esm/formats/strings.js +109 -0
  74. package/esm/handle/index.d.ts +7 -0
  75. package/esm/handle/index.js +40 -0
  76. package/esm/helper.d.ts +50 -0
  77. package/esm/helper.js +118 -0
  78. package/esm/index.d.ts +103 -0
  79. package/esm/index.js +42 -0
  80. package/esm/kitCellsBuildor.d.ts +45 -0
  81. package/esm/kitCellsBuildor.js +105 -0
  82. package/esm/kitStoreItem.d.ts +28 -0
  83. package/esm/kitStoreItem.js +170 -0
  84. package/esm/kitStoreList.d.ts +33 -0
  85. package/esm/kitStoreList.js +98 -0
  86. package/esm/mail/index.d.ts +11 -0
  87. package/esm/mail/index.js +51 -0
  88. package/esm/theme.d.ts +4 -0
  89. package/esm/theme.js +4 -0
  90. package/esm/ui/Button.svelte +102 -0
  91. package/esm/ui/Button.svelte.d.ts +27 -0
  92. package/esm/ui/Clipboardable.svelte +19 -0
  93. package/esm/ui/Clipboardable.svelte.d.ts +25 -0
  94. package/esm/ui/Field.svelte +288 -0
  95. package/esm/ui/Field.svelte.d.ts +29 -0
  96. package/esm/ui/FieldGroup.svelte +91 -0
  97. package/esm/ui/FieldGroup.svelte.d.ts +30 -0
  98. package/esm/ui/Grid.svelte +246 -0
  99. package/esm/ui/Grid.svelte.d.ts +46 -0
  100. package/esm/ui/GridLoading.svelte +32 -0
  101. package/esm/ui/GridLoading.svelte.d.ts +20 -0
  102. package/esm/ui/GridPaginate.svelte +66 -0
  103. package/esm/ui/GridPaginate.svelte.d.ts +22 -0
  104. package/esm/ui/Icon.svelte +86 -0
  105. package/esm/ui/Icon.svelte.d.ts +46 -0
  106. package/esm/ui/LibIcon.d.ts +23 -0
  107. package/esm/ui/LibIcon.js +28 -0
  108. package/esm/ui/Loading.svelte +11 -0
  109. package/esm/ui/Loading.svelte.d.ts +20 -0
  110. package/esm/ui/Tooltip.svelte +42 -0
  111. package/esm/ui/Tooltip.svelte.d.ts +22 -0
  112. package/esm/ui/dialog/DialogForm.svelte +70 -0
  113. package/esm/ui/dialog/DialogForm.svelte.d.ts +19 -0
  114. package/esm/ui/dialog/DialogManagement.svelte +87 -0
  115. package/esm/ui/dialog/DialogManagement.svelte.d.ts +25 -0
  116. package/esm/ui/dialog/DialogPrimitive.svelte +89 -0
  117. package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +28 -0
  118. package/esm/ui/dialog/FormEditAction.svelte +54 -0
  119. package/esm/ui/dialog/FormEditAction.svelte.d.ts +24 -0
  120. package/esm/ui/dialog/dialog.d.ts +51 -0
  121. package/esm/ui/dialog/dialog.js +98 -0
  122. package/esm/ui/index.d.ts +5 -0
  123. package/esm/ui/index.js +19 -0
  124. package/esm/ui/internals/FieldContainer.svelte +22 -0
  125. package/esm/ui/internals/FieldContainer.svelte.d.ts +30 -0
  126. package/esm/ui/internals/Input.svelte +98 -0
  127. package/esm/ui/internals/Input.svelte.d.ts +35 -0
  128. package/esm/ui/internals/Textarea.svelte +61 -0
  129. package/esm/ui/internals/Textarea.svelte.d.ts +30 -0
  130. package/esm/ui/internals/select/MultiSelectMelt.svelte +217 -0
  131. package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +30 -0
  132. package/esm/ui/internals/select/SelectMelt.svelte +238 -0
  133. package/esm/ui/internals/select/SelectMelt.svelte.d.ts +35 -0
  134. package/esm/ui/internals/select/SelectRadio.svelte +37 -0
  135. package/esm/ui/internals/select/SelectRadio.svelte.d.ts +25 -0
  136. package/esm/ui/link/Link.svelte +28 -0
  137. package/esm/ui/link/Link.svelte.d.ts +25 -0
  138. package/esm/ui/link/LinkPlus.svelte +44 -0
  139. package/esm/ui/link/LinkPlus.svelte.d.ts +21 -0
  140. package/esm/utils/tailwind.d.ts +2 -0
  141. package/esm/utils/tailwind.js +3 -0
  142. package/esm/utils/transition.d.ts +10 -0
  143. package/esm/utils/transition.js +33 -0
  144. package/esm/utils/types.d.ts +17 -0
  145. package/esm/utils/types.js +17 -0
  146. package/esm/virtual/Customer.d.ts +4 -0
  147. package/esm/virtual/Customer.js +24 -0
  148. package/esm/virtual/FilterEntity.d.ts +7 -0
  149. package/esm/virtual/FilterEntity.js +34 -0
  150. package/esm/virtual/StateDemoEnum.d.ts +9 -0
  151. package/esm/virtual/StateDemoEnum.js +42 -0
  152. package/esm/virtual/UIEntity.d.ts +16 -0
  153. package/esm/virtual/UIEntity.js +84 -0
  154. package/esm/vite/index.d.ts +8 -0
  155. package/esm/vite/index.js +47 -0
  156. package/package.json +94 -10
@@ -0,0 +1,246 @@
1
+ <script generics="T extends Record<any, any>">import { createEventDispatcher } from "svelte";
2
+ import {
3
+ displayWithDefaultAndSuffix,
4
+ getEntityDisplayValue,
5
+ getEntityDisplayValueFromField,
6
+ getFieldLinkDisplayValue,
7
+ getFieldMetaType
8
+ } from "../helper.js";
9
+ import { LibIcon_Delete, LibIcon_Edit } from "../index.js";
10
+ import Button from "./Button.svelte";
11
+ import Clipboardable from "./Clipboardable.svelte";
12
+ import GridLoading from "./GridLoading.svelte";
13
+ import Icon from "./Icon.svelte";
14
+ import { align, getAligns } from "./index.js";
15
+ import {
16
+ LibIcon_Add,
17
+ LibIcon_Settings,
18
+ LibIcon_Sort,
19
+ LibIcon_SortAsc,
20
+ LibIcon_SortDesc
21
+ } from "./LibIcon.js";
22
+ import LinkPlus from "./link/LinkPlus.svelte";
23
+ export let cells;
24
+ export let store;
25
+ export let withAdd = false;
26
+ export let withEdit = false;
27
+ export let withDelete = false;
28
+ export let loadingRows = 5;
29
+ export let classes = {
30
+ table: "table-pin-rows table-pin-cols"
31
+ };
32
+ export let orderBy = void 0;
33
+ export let orderByCols = void 0;
34
+ export let dicoNoResult = "Aucun r\xE9sultat !";
35
+ const dispatch = createEventDispatcher();
36
+ const sorting = (toSort, b) => {
37
+ if (!toSort) {
38
+ return;
39
+ }
40
+ if (orderBy === void 0) {
41
+ orderBy = { [b.field.key]: "asc" };
42
+ } else if (orderBy[b.field.key] === "asc") {
43
+ orderBy = { [b.field.key]: "desc" };
44
+ } else if (orderBy[b.field.key] === void 0) {
45
+ orderBy = { [b.field.key]: "asc" };
46
+ } else {
47
+ orderBy = void 0;
48
+ }
49
+ };
50
+ const sortingIcon = (toSort, b, _orderBy) => {
51
+ if (!toSort) {
52
+ return;
53
+ }
54
+ if (_orderBy && _orderBy[b.field.key] === "asc") {
55
+ return { data: LibIcon_SortAsc, class: "text-primary" };
56
+ }
57
+ if (_orderBy && _orderBy[b.field.key] === "desc") {
58
+ return { data: LibIcon_SortDesc, class: "text-primary" };
59
+ }
60
+ return { data: LibIcon_Sort };
61
+ };
62
+ const cellsToTake = (cells2) => {
63
+ return cells2.filter((c) => c.modeView !== "hide");
64
+ };
65
+ </script>
66
+
67
+ <div class="overflow-x-auto">
68
+ <table class="table {classes.table}">
69
+ <thead>
70
+ <tr>
71
+ {#each cellsToTake(cells) as b, i}
72
+ {@const al = align(b.field, b.kind === 'slot')}
73
+ <th
74
+ class="{al}
75
+ {i === 0 ? 'rounded-tl-lg' : ''}
76
+ {i === cells.length - 1 && !withEdit && !withDelete ? 'rounded-tr-lg' : ''}"
77
+ >
78
+ {#if b.headerSlot}
79
+ <slot name="header" field={b.field} />
80
+ {:else}
81
+ {@const toSort =
82
+ orderByCols === true || (orderByCols && orderByCols.includes(b.field?.key))}
83
+ {#if toSort}
84
+ <button
85
+ class="flex items-center justify-between gap-2"
86
+ disabled={!toSort}
87
+ on:click={() => sorting(toSort ?? false, b)}
88
+ >
89
+ {b.header ?? b.field?.caption}
90
+ {#if toSort}
91
+ <Icon {...sortingIcon(toSort ?? false, b, orderBy)}></Icon>
92
+ {/if}
93
+ </button>
94
+ {:else}
95
+ {b.header ?? b.field?.caption}
96
+ {/if}
97
+ {/if}
98
+ </th>
99
+ {/each}
100
+
101
+ {#if withEdit || withDelete || withAdd}
102
+ <th class="flex justify-end rounded-tr-lg">
103
+ {#if withAdd}
104
+ <Button
105
+ permission={store.getRepo().metadata.options.permissionApiInsert}
106
+ disabled={!store.getRepo().metadata.apiInsertAllowed()}
107
+ class="btn btn-square btn-ghost btn-xs"
108
+ on:click={() => dispatch('add', {})}
109
+ >
110
+ <Icon data={LibIcon_Add} />
111
+ </Button>
112
+ {:else}
113
+ <Icon data={LibIcon_Settings}></Icon>
114
+ {/if}
115
+ </th>
116
+ {/if}
117
+ </tr>
118
+ </thead>
119
+ <tbody>
120
+ <!-- Show loading only if there is no items and loading is true, like this on an update, there will be no jump -->
121
+ {#if $store.items.length === 0 && $store.loading && store.getRepo().metadata.apiReadAllowed}
122
+ <GridLoading columns={getAligns(cells, withEdit || withDelete)} {loadingRows} />
123
+ {:else}
124
+ {#each $store.items as row}
125
+ <tr on:click={() => dispatch('rowclick', row)} class="hover:bg-base-content/20">
126
+ {#each cellsToTake(cells) as b}
127
+ {@const metaType = getFieldMetaType(b.field)}
128
+ <td class={align(b.field, b.kind === 'slot')}>
129
+ {#if metaType.kind === 'slot' || b.kind === 'slot'}
130
+ <slot name="cell" {row} field={b.field} cell={b} />
131
+ {:else if b.kind === 'component'}
132
+ {#if b.component}
133
+ <div class={b.class}>
134
+ <svelte:component
135
+ this={b.component}
136
+ {...b.props}
137
+ {...b.rowToProps ? b.rowToProps(row) : {}}
138
+ on:refresh
139
+ ></svelte:component>
140
+ </div>
141
+ {:else}
142
+ <pre>Col: {b.col}</pre>
143
+ <pre class="bg-error">Component prop needed !</pre>
144
+ {/if}
145
+ {:else if metaType.kind === 'relation'}
146
+ {@const item = getEntityDisplayValue(
147
+ metaType.repoTarget,
148
+ row[metaType.field.key],
149
+ )}
150
+ <LinkPlus
151
+ item={{
152
+ ...item,
153
+ href: b.field?.options?.href ? b.field?.options.href(row) : item?.href,
154
+ }}
155
+ />
156
+ {:else if b.kind === 'field_link'}
157
+ {@const item = getFieldLinkDisplayValue(metaType.field, row)}
158
+ <LinkPlus {item} />
159
+ {:else if b.kind === 'entity_link'}
160
+ {@const item = getEntityDisplayValueFromField(metaType.field, row)}
161
+ <LinkPlus {item} />
162
+ {:else if metaType.kind === 'enum'}
163
+ {#if metaType.subKind === 'single'}
164
+ <LinkPlus item={row[metaType.field.key]}></LinkPlus>
165
+ {:else if metaType.subKind === 'multi'}
166
+ <!-- {@const t = metaType.field.displayValue(row)} -->
167
+ {#each row[metaType.field.key] as enumVal}
168
+ <div>
169
+ {enumVal.caption}
170
+ </div>
171
+ {/each}
172
+ {/if}
173
+ {:else if metaType.subKind === 'checkbox'}
174
+ {@const t = metaType.field.displayValue(row)}
175
+ {t === 'true' ? 'Oui' : 'Non'}
176
+ {:else}
177
+ {@const t = displayWithDefaultAndSuffix(metaType.field, row[metaType.field.key])}
178
+ {#if b.clipboardable}
179
+ <Clipboardable value={t}>
180
+ <!-- 20 is a cool value ! -->
181
+ <span class={t.length < 20 ? 'text-nowrap' : ''}>
182
+ {t}
183
+ </span>
184
+ </Clipboardable>
185
+ {:else}
186
+ <!-- 20 is a cool value ! -->
187
+ <span class={t.length < 20 ? 'text-nowrap' : ''}>
188
+ {t}
189
+ </span>
190
+ {/if}
191
+ {/if}
192
+ </td>
193
+ {/each}
194
+ {#if withEdit || withDelete}
195
+ <td class="text-right">
196
+ <div class="flex justify-end gap-2">
197
+ {#if withEdit}
198
+ <Button
199
+ permission={store.getRepo().metadata.options.permissionApiUpdate}
200
+ disabled={!store.getRepo().metadata.apiUpdateAllowed()}
201
+ class="btn btn-square btn-ghost btn-xs"
202
+ on:click={() => dispatch('edit', row)}
203
+ >
204
+ <Icon data={LibIcon_Edit} />
205
+ </Button>
206
+ {/if}
207
+ {#if withDelete}
208
+ <Button
209
+ permission={store.getRepo().metadata.options.permissionApiDelete}
210
+ disabled={!store.getRepo().metadata.apiDeleteAllowed()}
211
+ class="btn btn-square btn-ghost btn-xs"
212
+ on:click={() => dispatch('delete', row)}
213
+ >
214
+ <Icon data={LibIcon_Delete} />
215
+ </Button>
216
+ {/if}
217
+ </div>
218
+ </td>
219
+ {/if}
220
+ </tr>
221
+ {:else}
222
+ {#if !store.getRepo().metadata.apiReadAllowed}
223
+ <tr>
224
+ <td
225
+ colspan={getAligns(cells, withEdit || withDelete).length}
226
+ class="text-center py-12"
227
+ >
228
+ Vous n'avez pas la permission pour ces données!
229
+ </td>
230
+ </tr>
231
+ {:else if dicoNoResult}
232
+ <tr>
233
+ <td
234
+ colspan={getAligns(cells, withEdit || withDelete).length}
235
+ class="text-center py-12"
236
+ >
237
+ {dicoNoResult}
238
+ </td>
239
+ </tr>
240
+ {/if}
241
+ {/each}
242
+ <slot name="extra" />
243
+ {/if}
244
+ </tbody>
245
+ </table>
246
+ </div>
@@ -0,0 +1,46 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { EntityOrderBy } from 'remult';
3
+ import { type KitStoreList } from '../index.js';
4
+ import type { KitCell } from '../kitCellsBuildor.js';
5
+ declare class __sveltets_Render<T extends Record<any, any>> {
6
+ props(): {
7
+ cells: KitCell<T>[];
8
+ store: KitStoreList<T>;
9
+ withAdd?: boolean | undefined;
10
+ withEdit?: boolean | undefined;
11
+ withDelete?: boolean | undefined;
12
+ loadingRows?: number | undefined;
13
+ classes?: {
14
+ table: string;
15
+ } | undefined;
16
+ orderBy?: EntityOrderBy<T> | undefined;
17
+ orderByCols?: true | (keyof T)[] | undefined;
18
+ dicoNoResult?: string | undefined;
19
+ };
20
+ events(): {
21
+ refresh: any;
22
+ add: CustomEvent<any>;
23
+ rowclick: CustomEvent<any>;
24
+ edit: CustomEvent<any>;
25
+ delete: CustomEvent<any>;
26
+ } & {
27
+ [evt: string]: CustomEvent<any>;
28
+ };
29
+ slots(): {
30
+ header: {
31
+ field: import("remult").FieldMetadata<any, T> | undefined;
32
+ };
33
+ cell: {
34
+ row: T;
35
+ field: import("remult").FieldMetadata<any, T> | undefined;
36
+ cell: KitCell<T>;
37
+ };
38
+ extra: {};
39
+ };
40
+ }
41
+ export type GridProps<T extends Record<any, any>> = ReturnType<__sveltets_Render<T>['props']>;
42
+ export type GridEvents<T extends Record<any, any>> = ReturnType<__sveltets_Render<T>['events']>;
43
+ export type GridSlots<T extends Record<any, any>> = ReturnType<__sveltets_Render<T>['slots']>;
44
+ export default class Grid<T extends Record<any, any>> extends SvelteComponent<GridProps<T>, GridEvents<T>, GridSlots<T>> {
45
+ }
46
+ export {};
@@ -0,0 +1,32 @@
1
+ <script>import { tw } from "../utils/tailwind";
2
+ import Loading from "./Loading.svelte";
3
+ export let columns;
4
+ export let loadingRows = 5;
5
+ let size = ["", "w-1/2", "w-1/3", "w-1/4", "w-1/5", "w-1/6"];
6
+ </script>
7
+
8
+ <!-- Do 10 rows -->
9
+ {#each new Array(loadingRows) as _row, r}
10
+ <tr>
11
+ {#each columns as column, c}
12
+ <td class="{column} ">
13
+ <div class={tw('flex justify-between', column === 'text-right' && 'flex-row-reverse')}>
14
+ {#if column === 'text-center'}
15
+ <div></div>
16
+ {/if}
17
+ <Loading
18
+ class={tw(
19
+ `h-4`,
20
+ size[
21
+ parseInt(
22
+ (((r + 1) * (c + 1) * Math.random() * size.length) % size.length).toString(),
23
+ )
24
+ ],
25
+ )}
26
+ />
27
+ <div></div>
28
+ </div>
29
+ </td>
30
+ {/each}
31
+ </tr>
32
+ {/each}
@@ -0,0 +1,20 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { Align } from './index.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ columns: Align[];
6
+ loadingRows?: number | undefined;
7
+ };
8
+ events: {
9
+ [evt: string]: CustomEvent<any>;
10
+ };
11
+ slots: {};
12
+ exports?: {} | undefined;
13
+ bindings?: string | undefined;
14
+ };
15
+ export type GridLoadingProps = typeof __propDef.props;
16
+ export type GridLoadingEvents = typeof __propDef.events;
17
+ export type GridLoadingSlots = typeof __propDef.slots;
18
+ export default class GridLoading extends SvelteComponent<GridLoadingProps, GridLoadingEvents, GridLoadingSlots> {
19
+ }
20
+ export {};
@@ -0,0 +1,66 @@
1
+ <script>import Icon from "./Icon.svelte";
2
+ import FieldContainer from "./internals/FieldContainer.svelte";
3
+ import "./LibIcon";
4
+ import { LibIcon_ChevronLeft, LibIcon_ChevronRight } from "./LibIcon";
5
+ import Loading from "./Loading.svelte";
6
+ export let label = "Pagination";
7
+ export let page;
8
+ export let totalCount = void 0;
9
+ export let pageSize = 25;
10
+ const update = (op) => {
11
+ if (op === "+") {
12
+ if (canGoNext) {
13
+ page = page + 1;
14
+ }
15
+ } else {
16
+ if (page > 1) {
17
+ page = page - 1;
18
+ }
19
+ }
20
+ };
21
+ $:
22
+ isValidValue = totalCount !== void 0 && totalCount !== null;
23
+ $:
24
+ needPaginate = isValidValue && (totalCount ?? 0) > pageSize;
25
+ $:
26
+ canGoNext = isValidValue && needPaginate && page < Math.ceil((totalCount ?? 0) / pageSize);
27
+ </script>
28
+
29
+ <FieldContainer {label} forId="paginate" classes={{ label: 'justify-end' }}>
30
+ <div class="flex items-center justify-end">
31
+ {#if totalCount === undefined}
32
+ <Loading class="mx-2 h-8 w-1/2"></Loading>
33
+ {:else if !needPaginate}
34
+ <span class="text-primary justify-end px-2 font-bold">
35
+ {totalCount}
36
+ </span>
37
+ {:else}
38
+ <div class="join">
39
+ <button
40
+ aria-label="left"
41
+ on:click={() => update('-')}
42
+ class="btn join-item {page === 1 ? 'btn-disabled' : ''}"
43
+ >
44
+ <Icon data={LibIcon_ChevronLeft} />
45
+ </button>
46
+ {#if isValidValue}
47
+ <button aria-label="current" class="btn join-item px-0">
48
+ <span class="text-primary font-bold">{totalCount}</span>
49
+ <span class="text-[0.55rem] italic"
50
+ >({page} / {Math.ceil((totalCount ?? 0) / pageSize)})</span
51
+ >
52
+ </button>
53
+ {:else}
54
+ <button aria-label="loading" class="btn join-item animate-pulse">.....</button>
55
+ {/if}
56
+ <button
57
+ aria-label="right"
58
+ on:click={() => update('+')}
59
+ class="btn join-item {!canGoNext ? 'btn-disabled' : ''}"
60
+ >
61
+ <Icon data={LibIcon_ChevronRight} />
62
+ </button>
63
+ </div>
64
+ {/if}
65
+ </div>
66
+ </FieldContainer>
@@ -0,0 +1,22 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import './LibIcon';
3
+ declare const __propDef: {
4
+ props: {
5
+ label?: string | undefined;
6
+ page: number;
7
+ totalCount?: number | undefined | null;
8
+ pageSize?: number | undefined;
9
+ };
10
+ events: {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots: {};
14
+ exports?: {} | undefined;
15
+ bindings?: string | undefined;
16
+ };
17
+ export type GridPaginateProps = typeof __propDef.props;
18
+ export type GridPaginateEvents = typeof __propDef.events;
19
+ export type GridPaginateSlots = typeof __propDef.slots;
20
+ export default class GridPaginate extends SvelteComponent<GridPaginateProps, GridPaginateEvents, GridPaginateSlots> {
21
+ }
22
+ export {};
@@ -0,0 +1,86 @@
1
+ <script>import { BROWSER } from "esm-env";
2
+ import "./LibIcon";
3
+ import { LibIcon_Empty } from "./LibIcon";
4
+ export let data = "";
5
+ export let size = "1.5rem";
6
+ export let caption = void 0;
7
+ const rmvWarning = caption;
8
+ export let ssr = false;
9
+ let className = "";
10
+ export { className as class };
11
+ export let style = "";
12
+ let width = size;
13
+ let height = size;
14
+ let viewBox = "0 0 24 24";
15
+ let svg = "";
16
+ let path = "";
17
+ $:
18
+ if (typeof data === "string") {
19
+ if (data.toLowerCase().includes("<svg")) {
20
+ svg = data.replace(/width="[^"]*"/, `width="${width}"`).replace(/height="[^"]*"/, `height="${height}"`);
21
+ } else {
22
+ path = data;
23
+ }
24
+ } else {
25
+ path = data;
26
+ }
27
+ const getInfoProps = (props, i = 0) => {
28
+ if (Array.isArray(props)) {
29
+ return props[i] ?? "";
30
+ }
31
+ return props ?? "";
32
+ };
33
+ </script>
34
+
35
+ {#if BROWSER || ssr}
36
+ {#if svg || $$slots.default}
37
+ <span
38
+ class={getInfoProps(className)}
39
+ style={getInfoProps(style)}
40
+ style:width
41
+ style:height
42
+ role={'img'}
43
+ on:click
44
+ >
45
+ <slot>
46
+ {@html svg ?? ''}
47
+ </slot>
48
+ </span>
49
+ {:else}
50
+ <svg
51
+ {width}
52
+ {height}
53
+ {viewBox}
54
+ class={getInfoProps(className)}
55
+ style={getInfoProps(style)}
56
+ role={'img'}
57
+ on:click
58
+ >
59
+ {#each Array.isArray(path) ? path : [path] as d, i}
60
+ <path
61
+ {d}
62
+ fill="currentColor"
63
+ class={getInfoProps(className, i)}
64
+ style={getInfoProps(style, i)}
65
+ />
66
+ {/each}
67
+ </svg>
68
+ {/if}
69
+ {:else}
70
+ <svg
71
+ {width}
72
+ {height}
73
+ {viewBox}
74
+ class={getInfoProps(className)}
75
+ style={getInfoProps(style)}
76
+ role={'img'}
77
+ on:click
78
+ >
79
+ <path
80
+ d={LibIcon_Empty}
81
+ fill="currentColor"
82
+ class={getInfoProps(className)}
83
+ style={getInfoProps(style)}
84
+ />
85
+ </svg>
86
+ {/if}
@@ -0,0 +1,46 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import './LibIcon';
3
+ declare const __propDef: {
4
+ props: {
5
+ /**
6
+ * directly <svg ... /> or d of <path ... />
7
+ *
8
+ * with \@mdi/js
9
+ * ```js
10
+ * import { mdiAccountTieWoman } from "@mdi/js";
11
+ * <Icon data={mdiAccountTieWoman} style="background-color: blue;" size={"4rem"}></Icon>
12
+ * ```
13
+ *
14
+ * with \@iconify-json/mdi && unplugin-icons with Icons({ compiler: "raw" })
15
+ * ```js
16
+ * import Woman from "virtual:icons/mdi/account-tie-woman";
17
+ * <Icon data={mdiAccountTieWoman} style="background-color: blue;" size={"4rem"}></Icon>
18
+ * ```
19
+ */ data?: string | string[] | undefined;
20
+ size?: string | number | undefined;
21
+ caption?: string | undefined;
22
+ /**
23
+ * By default, svg are not rendered on the server side.
24
+ * But the size will be respected to not have glitch on the client side when the icon is coming.
25
+ * @default false
26
+ */ ssr?: boolean | undefined;
27
+ class?: string | string[] | undefined;
28
+ style?: string | string[] | undefined;
29
+ };
30
+ events: {
31
+ click: MouseEvent;
32
+ } & {
33
+ [evt: string]: CustomEvent<any>;
34
+ };
35
+ slots: {
36
+ default: {};
37
+ };
38
+ exports?: {} | undefined;
39
+ bindings?: string | undefined;
40
+ };
41
+ export type IconProps = typeof __propDef.props;
42
+ export type IconEvents = typeof __propDef.events;
43
+ export type IconSlots = typeof __propDef.slots;
44
+ export default class Icon extends SvelteComponent<IconProps, IconEvents, IconSlots> {
45
+ }
46
+ export {};
@@ -0,0 +1,23 @@
1
+ export declare const LibIcon_Empty = "";
2
+ export declare const LibIcon_Forbidden: string;
3
+ export declare const LibIcon_ChevronDown: string;
4
+ export declare const LibIcon_ChevronUp: string;
5
+ export declare const LibIcon_ChevronLeft: string;
6
+ export declare const LibIcon_ChevronRight: string;
7
+ export declare const LibIcon_Search: string;
8
+ export declare const LibIcon_Check: string;
9
+ export declare const LibIcon_MultiCheck: string;
10
+ export declare const LibIcon_Add: string;
11
+ export declare const LibIcon_MultiAdd: string;
12
+ export declare const LibIcon_Edit: string;
13
+ export declare const LibIcon_Delete: string;
14
+ export declare const LibIcon_Cross: string;
15
+ export declare const LibIcon_Save: string;
16
+ export declare const LibIcon_Man: string;
17
+ export declare const LibIcon_Woman: string;
18
+ export declare const LibIcon_Send: string;
19
+ export declare const LibIcon_Load: string;
20
+ export declare const LibIcon_Settings: string;
21
+ export declare const LibIcon_Sort: string;
22
+ export declare const LibIcon_SortAsc: string;
23
+ export declare const LibIcon_SortDesc: string;
@@ -0,0 +1,28 @@
1
+ // Lib Icons
2
+ // https://icones.js.org/ and https://pictogrammers.com/library/mdi/
3
+ // Lib or App let's not grow to much here !
4
+ // TODO : check code spliting...
5
+ import { mdiAccountTie, mdiAccountTieWoman, mdiCancel, mdiCheck, mdiCheckAll, mdiChevronDown, mdiChevronLeft, mdiChevronRight, mdiChevronUp, mdiCloseCircleOutline, mdiCogOutline, mdiContentSaveEdit, mdiDelete, mdiLoading, mdiMagnify, mdiPencil, mdiPlusBoxMultiple, mdiPlusCircle, mdiSend, mdiSort, mdiSortReverseVariant, mdiSortVariant, } from '@mdi/js';
6
+ export const LibIcon_Empty = ``;
7
+ export const LibIcon_Forbidden = mdiCancel;
8
+ export const LibIcon_ChevronDown = mdiChevronDown;
9
+ export const LibIcon_ChevronUp = mdiChevronUp;
10
+ export const LibIcon_ChevronLeft = mdiChevronLeft;
11
+ export const LibIcon_ChevronRight = mdiChevronRight;
12
+ export const LibIcon_Search = mdiMagnify;
13
+ export const LibIcon_Check = mdiCheck;
14
+ export const LibIcon_MultiCheck = mdiCheckAll;
15
+ export const LibIcon_Add = mdiPlusCircle;
16
+ export const LibIcon_MultiAdd = mdiPlusBoxMultiple;
17
+ export const LibIcon_Edit = mdiPencil;
18
+ export const LibIcon_Delete = mdiDelete;
19
+ export const LibIcon_Cross = mdiCloseCircleOutline;
20
+ export const LibIcon_Save = mdiContentSaveEdit;
21
+ export const LibIcon_Man = mdiAccountTie;
22
+ export const LibIcon_Woman = mdiAccountTieWoman;
23
+ export const LibIcon_Send = mdiSend;
24
+ export const LibIcon_Load = mdiLoading;
25
+ export const LibIcon_Settings = mdiCogOutline;
26
+ export const LibIcon_Sort = mdiSort;
27
+ export const LibIcon_SortAsc = mdiSortReverseVariant;
28
+ export const LibIcon_SortDesc = mdiSortVariant;
@@ -0,0 +1,11 @@
1
+ <script>import { tw } from "../utils/tailwind";
2
+ export { extraClass as class };
3
+ let extraClass = "";
4
+ </script>
5
+
6
+ <!-- To fix one capa & cadb are on the same css -->
7
+ <div
8
+ class={tw('skeleton bg-base-content/20 flex h-4 w-full items-center justify-center', extraClass)}
9
+ >
10
+ <slot />
11
+ </div>
@@ -0,0 +1,20 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ class?: string | undefined;
5
+ };
6
+ events: {
7
+ [evt: string]: CustomEvent<any>;
8
+ };
9
+ slots: {
10
+ default: {};
11
+ };
12
+ exports?: {} | undefined;
13
+ bindings?: string | undefined;
14
+ };
15
+ export type LoadingProps = typeof __propDef.props;
16
+ export type LoadingEvents = typeof __propDef.events;
17
+ export type LoadingSlots = typeof __propDef.slots;
18
+ export default class Loading extends SvelteComponent<LoadingProps, LoadingEvents, LoadingSlots> {
19
+ }
20
+ export {};