firstly 0.0.12 → 0.0.14

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 (120) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/esm/ROUTES.d.ts +2 -0
  3. package/esm/ROUTES.js +1 -0
  4. package/esm/api/index.d.ts +9 -0
  5. package/esm/api/index.js +3 -1
  6. package/esm/auth/AuthController.d.ts +12 -23
  7. package/esm/auth/AuthController.js +12 -31
  8. package/esm/auth/server/AuthController.server.d.ts +11 -11
  9. package/esm/auth/server/AuthController.server.js +99 -34
  10. package/esm/auth/server/handleGuard.d.ts +16 -0
  11. package/esm/auth/server/handleGuard.js +67 -0
  12. package/esm/auth/server/helperFirstly.d.ts +1 -1
  13. package/esm/auth/server/helperFirstly.js +1 -0
  14. package/esm/auth/server/index.d.ts +3 -1
  15. package/esm/auth/server/index.js +3 -1
  16. package/esm/auth/server/module.d.ts +105 -89
  17. package/esm/auth/server/module.js +55 -42
  18. package/esm/auth/server/providers/github.d.ts +4 -2
  19. package/esm/auth/server/providers/github.js +2 -2
  20. package/esm/auth/static/assets/Page-B0XXxe0N.d.ts +6 -0
  21. package/esm/auth/static/assets/Page-B0XXxe0N.js +1 -0
  22. package/esm/auth/static/assets/Page-DdKMiUZn.d.ts +6 -0
  23. package/esm/auth/static/assets/Page-DdKMiUZn.js +20 -0
  24. package/esm/auth/static/assets/Page-UV_hqY7I.d.ts +6 -0
  25. package/esm/auth/static/assets/Page-UV_hqY7I.js +1 -0
  26. package/esm/auth/static/assets/Page-mK42zGEw.css +1 -0
  27. package/esm/auth/static/assets/index-C9jzxOBu.d.ts +151 -0
  28. package/esm/auth/static/assets/index-C9jzxOBu.js +42 -0
  29. package/esm/auth/static/assets/index-DKWpA6v7.css +4 -0
  30. package/esm/auth/static/index.html +11 -11
  31. package/esm/auth/types.d.ts +26 -3
  32. package/esm/bin/cmd.js +423 -152
  33. package/esm/cellsBuildor.js +1 -1
  34. package/esm/common.d.ts +5 -0
  35. package/esm/common.js +8 -0
  36. package/esm/cron/server/index.js +1 -1
  37. package/esm/feedback/FeedbackController.js +58 -53
  38. package/esm/feedback/server/index.d.ts +6 -15
  39. package/esm/feedback/server/index.js +4 -5
  40. package/esm/feedback/types.d.ts +14 -0
  41. package/esm/feedback/types.js +4 -0
  42. package/esm/feedback/ui/DialogIssue.svelte +131 -119
  43. package/esm/feedback/ui/DialogIssue.svelte.d.ts +20 -18
  44. package/esm/feedback/ui/DialogIssues.svelte +108 -99
  45. package/esm/feedback/ui/DialogIssues.svelte.d.ts +20 -18
  46. package/esm/feedback/ui/DialogMilestones.svelte +40 -34
  47. package/esm/feedback/ui/DialogMilestones.svelte.d.ts +18 -16
  48. package/esm/feedback/ui/Feedback.svelte +11 -9
  49. package/esm/feedback/ui/Feedback.svelte.d.ts +16 -14
  50. package/esm/index.d.ts +2 -5
  51. package/esm/index.js +2 -8
  52. package/esm/mail/server/index.d.ts +9 -2
  53. package/esm/mail/server/index.js +3 -1
  54. package/esm/mail/templates/DefaultMail.svelte +81 -61
  55. package/esm/mail/templates/DefaultMail.svelte.d.ts +28 -26
  56. package/esm/server/index.d.ts +0 -0
  57. package/esm/server/index.js +1 -0
  58. package/esm/storeItem.d.ts +1 -4
  59. package/esm/storeItem.js +1 -1
  60. package/esm/storeList.d.ts +1 -4
  61. package/esm/sveltekit/server/index.d.ts +3 -9
  62. package/esm/sveltekit/server/index.js +3 -0
  63. package/esm/ui/Button.svelte +112 -89
  64. package/esm/ui/Button.svelte.d.ts +34 -24
  65. package/esm/ui/Clipboardable.svelte +24 -17
  66. package/esm/ui/Clipboardable.svelte.d.ts +34 -23
  67. package/esm/ui/Field.svelte +328 -285
  68. package/esm/ui/Field.svelte.d.ts +15 -8
  69. package/esm/ui/FieldGroup.svelte +112 -91
  70. package/esm/ui/FieldGroup.svelte.d.ts +17 -6
  71. package/esm/ui/Grid.svelte +322 -308
  72. package/esm/ui/Grid.svelte.d.ts +17 -6
  73. package/esm/ui/GridLoading.svelte +28 -27
  74. package/esm/ui/GridLoading.svelte.d.ts +19 -17
  75. package/esm/ui/GridPaginate.svelte +68 -61
  76. package/esm/ui/GridPaginate.svelte.d.ts +21 -19
  77. package/esm/ui/Icon.svelte +116 -80
  78. package/esm/ui/Icon.svelte.d.ts +52 -43
  79. package/esm/ui/Loading.svelte +10 -8
  80. package/esm/ui/Loading.svelte.d.ts +29 -18
  81. package/esm/ui/Tooltip.svelte +38 -35
  82. package/esm/ui/Tooltip.svelte.d.ts +30 -20
  83. package/esm/ui/dialog/DialogForm.svelte +70 -63
  84. package/esm/ui/dialog/DialogForm.svelte.d.ts +18 -16
  85. package/esm/ui/dialog/DialogManagement.svelte +74 -74
  86. package/esm/ui/dialog/DialogManagement.svelte.d.ts +22 -21
  87. package/esm/ui/dialog/DialogPrimitive.svelte +82 -76
  88. package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +35 -25
  89. package/esm/ui/dialog/FormEditAction.svelte +58 -50
  90. package/esm/ui/dialog/FormEditAction.svelte.d.ts +13 -6
  91. package/esm/ui/dialog/dialog.d.ts +1 -4
  92. package/esm/ui/internals/FieldContainer.svelte +24 -17
  93. package/esm/ui/internals/FieldContainer.svelte.d.ts +37 -28
  94. package/esm/ui/internals/Input.svelte +136 -102
  95. package/esm/ui/internals/Input.svelte.d.ts +34 -32
  96. package/esm/ui/internals/Textarea.svelte +60 -52
  97. package/esm/ui/internals/Textarea.svelte.d.ts +31 -28
  98. package/esm/ui/internals/select/MultiSelectMelt.svelte +243 -199
  99. package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +29 -27
  100. package/esm/ui/internals/select/SelectMelt.svelte +254 -219
  101. package/esm/ui/internals/select/SelectMelt.svelte.d.ts +34 -32
  102. package/esm/ui/internals/select/SelectRadio.svelte +39 -33
  103. package/esm/ui/internals/select/SelectRadio.svelte.d.ts +24 -22
  104. package/esm/ui/link/Link.svelte +25 -20
  105. package/esm/ui/link/Link.svelte.d.ts +31 -23
  106. package/esm/ui/link/LinkPlus.svelte +52 -51
  107. package/esm/ui/link/LinkPlus.svelte.d.ts +20 -18
  108. package/esm/vite/index.d.ts +2 -3
  109. package/esm/vite/index.js +33 -26
  110. package/package.json +16 -20
  111. package/esm/auth/static/assets/Page-Bb8bFlrP.d.ts +0 -4
  112. package/esm/auth/static/assets/Page-Bb8bFlrP.js +0 -1
  113. package/esm/auth/static/assets/Page-BxomFlZ8.d.ts +0 -4
  114. package/esm/auth/static/assets/Page-BxomFlZ8.js +0 -1
  115. package/esm/auth/static/assets/Page-CaIYu0-y.d.ts +0 -6
  116. package/esm/auth/static/assets/Page-CaIYu0-y.js +0 -19
  117. package/esm/auth/static/assets/Page-MkYglNtu.css +0 -1
  118. package/esm/auth/static/assets/index-Bl0Bk5u0.d.ts +0 -64
  119. package/esm/auth/static/assets/index-Bl0Bk5u0.js +0 -2
  120. package/esm/auth/static/assets/index-R27C_TlP.css +0 -4
@@ -1,316 +1,330 @@
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 settingsLeft = false;
35
- export let dicoNoResult = "Aucun r\xE9sultat !";
36
- const dispatch = createEventDispatcher();
37
- const sorting = (toSort, b) => {
38
- if (!toSort) {
39
- return;
40
- }
41
- if (orderBy === void 0) {
42
- orderBy = { [b.field.key]: "asc" };
43
- } else if (orderBy[b.field.key] === "asc") {
44
- orderBy = { [b.field.key]: "desc" };
45
- } else if (orderBy[b.field.key] === void 0) {
46
- orderBy = { [b.field.key]: "asc" };
47
- } else {
48
- orderBy = void 0;
49
- }
50
- };
51
- const sortingIcon = (toSort, b, _orderBy) => {
52
- if (!toSort) {
53
- return;
54
- }
55
- if (_orderBy && _orderBy[b.field.key] === "asc") {
56
- return { data: LibIcon_SortAsc, class: "text-primary" };
57
- }
58
- if (_orderBy && _orderBy[b.field.key] === "desc") {
59
- return { data: LibIcon_SortDesc, class: "text-primary" };
60
- }
61
- return { data: LibIcon_Sort };
62
- };
63
- const cellsToTake = (cells2) => {
64
- return cells2.filter((c) => c.modeView !== "hide");
65
- };
66
- const classForRounding = (i) => {
67
- if (settingsLeft && (withEdit || withDelete || withAdd)) {
68
- if (i === 0) {
69
- return "";
70
- } else if (i === cells.length - 1) {
71
- return "rounded-tr-lg";
72
- }
73
- }
74
- if (!settingsLeft && (withEdit || withDelete || withAdd)) {
75
- if (i === 0) {
76
- return "rounded-tl-lg";
77
- } else if (i === cells.length - 1) {
78
- return "";
79
- }
80
- }
81
- if (i === 0) {
82
- return "rounded-tl-lg";
83
- } else if (i === cells.length - 1) {
84
- return "rounded-tr-lg";
85
- }
86
- };
1
+ <script lang="ts" generics="T extends Record<any, any>">
2
+ import { createEventDispatcher } from 'svelte'
3
+
4
+ import type { EntityOrderBy } from 'remult'
5
+
6
+ import type { Cell } from '../cellsBuildor.js'
7
+ import {
8
+ displayWithDefaultAndSuffix,
9
+ getEntityDisplayValue,
10
+ getEntityDisplayValueFromField,
11
+ getFieldLinkDisplayValue,
12
+ getFieldMetaType,
13
+ } from '../helper.js'
14
+ import { LibIcon_Delete, LibIcon_Edit, type StoreList } from '../index.js'
15
+ import Button from './Button.svelte'
16
+ import Clipboardable from './Clipboardable.svelte'
17
+ import GridLoading from './GridLoading.svelte'
18
+ import Icon from './Icon.svelte'
19
+ import { align, getAligns } from './index.js'
20
+ import {
21
+ LibIcon_Add,
22
+ LibIcon_Settings,
23
+ LibIcon_Sort,
24
+ LibIcon_SortAsc,
25
+ LibIcon_SortDesc,
26
+ } from './LibIcon.js'
27
+ import LinkPlus from './link/LinkPlus.svelte'
28
+
29
+ export let cells: Cell<T>[]
30
+ export let store: StoreList<T>
31
+
32
+ export let withAdd = false
33
+ export let withEdit = false
34
+ export let withDelete = false
35
+
36
+ export let loadingRows = 5
37
+
38
+ export let classes = {
39
+ table: 'table-pin-rows table-pin-cols',
40
+ }
41
+ export let orderBy: EntityOrderBy<T> | undefined = undefined
42
+ export let orderByCols: (keyof T)[] | true | undefined = undefined
43
+ export let settingsLeft = false
44
+
45
+ export let dicoNoResult = 'Aucun résultat !'
46
+
47
+ const dispatch = createEventDispatcher()
48
+
49
+ const sorting = (toSort: boolean, b: Cell<T>) => {
50
+ if (!toSort) {
51
+ return
52
+ }
53
+ if (orderBy === undefined) {
54
+ // @ts-ignore
55
+ orderBy = { [b.field.key]: 'asc' }
56
+ // @ts-ignore
57
+ } else if (orderBy[b.field.key] === 'asc') {
58
+ // @ts-ignore
59
+ orderBy = { [b.field.key]: 'desc' }
60
+ // @ts-ignore
61
+ } else if (orderBy[b.field.key] === undefined) {
62
+ // @ts-ignore
63
+ orderBy = { [b.field.key]: 'asc' }
64
+ } else {
65
+ orderBy = undefined
66
+ }
67
+ }
68
+
69
+ const sortingIcon = (toSort: boolean, b: Cell<T>, _orderBy: EntityOrderBy<T> | undefined) => {
70
+ if (!toSort) {
71
+ return
72
+ }
73
+ // @ts-ignore
74
+ if (_orderBy && _orderBy[b.field.key] === 'asc') {
75
+ return { data: LibIcon_SortAsc, class: 'text-primary' }
76
+ }
77
+ // @ts-ignore
78
+ if (_orderBy && _orderBy[b.field.key] === 'desc') {
79
+ return { data: LibIcon_SortDesc, class: 'text-primary' }
80
+ }
81
+ return { data: LibIcon_Sort }
82
+ }
83
+
84
+ const cellsToTake = (cells: Cell<T>[]) => {
85
+ return cells.filter((c) => c.modeView !== 'hide')
86
+ }
87
+
88
+ const classForRounding = (i: number) => {
89
+ if (settingsLeft && (withEdit || withDelete || withAdd)) {
90
+ if (i === 0) {
91
+ return ''
92
+ } else if (i === cells.length - 1) {
93
+ return 'rounded-tr-lg'
94
+ }
95
+ }
96
+
97
+ if (!settingsLeft && (withEdit || withDelete || withAdd)) {
98
+ if (i === 0) {
99
+ return 'rounded-tl-lg'
100
+ } else if (i === cells.length - 1) {
101
+ return ''
102
+ }
103
+ }
104
+
105
+ if (i === 0) {
106
+ return 'rounded-tl-lg'
107
+ } else if (i === cells.length - 1) {
108
+ return 'rounded-tr-lg'
109
+ }
110
+ }
87
111
  </script>
88
112
 
89
113
  <div class="overflow-x-auto">
90
- <table class="table {classes.table}">
91
- <thead>
92
- <tr>
93
- {#if settingsLeft && (withEdit || withDelete || withAdd)}
94
- <th class="rounded-tl-lg">
95
- <div class="flex justify-start">
96
- {#if !withAdd}
97
- <Icon data={LibIcon_Settings}></Icon>
98
- {:else}
99
- <Button
100
- permission={store.getRepo().metadata.options.permissionApiInsert}
101
- disabled={!store.getRepo().metadata.apiInsertAllowed()}
102
- class="btn btn-square btn-ghost btn-xs"
103
- on:click={() => dispatch('add', {})}
104
- >
105
- <Icon data={LibIcon_Add} />
106
- </Button>
107
- {/if}
108
- </div>
109
- </th>
110
- {/if}
114
+ <table class="table {classes.table}">
115
+ <thead>
116
+ <tr>
117
+ {#if settingsLeft && (withEdit || withDelete || withAdd)}
118
+ <th class="rounded-tl-lg">
119
+ <div class="flex justify-start">
120
+ {#if !withAdd}
121
+ <Icon data={LibIcon_Settings}></Icon>
122
+ {:else}
123
+ <Button
124
+ permission={store.getRepo().metadata.options.permissionApiInsert}
125
+ disabled={!store.getRepo().metadata.apiInsertAllowed()}
126
+ class="btn btn-square btn-ghost btn-xs"
127
+ on:click={() => dispatch('add', {})}
128
+ >
129
+ <Icon data={LibIcon_Add} />
130
+ </Button>
131
+ {/if}
132
+ </div>
133
+ </th>
134
+ {/if}
111
135
 
112
- {#each cellsToTake(cells) as b, i}
113
- {@const al = align(b.field, b.kind === 'slot')}
114
- <th class="{al} {classForRounding(i)}">
115
- {#if b.headerSlot}
116
- <slot name="header" field={b.field} />
117
- {:else}
118
- {@const toSort =
119
- orderByCols === true || (orderByCols && orderByCols.includes(b.field?.key))}
120
- {#if toSort}
121
- <button
122
- class="flex items-center justify-between gap-2"
123
- disabled={!toSort}
124
- on:click={() => sorting(toSort ?? false, b)}
125
- >
126
- {b.header ?? b.field?.caption}
127
- {#if toSort}
128
- <Icon {...sortingIcon(toSort ?? false, b, orderBy)}></Icon>
129
- {/if}
130
- </button>
131
- {:else}
132
- {b.header ?? b.field?.caption}
133
- {/if}
134
- {/if}
135
- </th>
136
- {/each}
136
+ {#each cellsToTake(cells) as b, i}
137
+ {@const al = align(b.field, b.kind === 'slot')}
138
+ <th class="{al} {classForRounding(i)}">
139
+ {#if b.headerSlot}
140
+ <slot name="header" field={b.field} />
141
+ {:else}
142
+ {@const toSort = orderByCols === true || (orderByCols && orderByCols.includes(b.field?.key))}
143
+ {#if toSort}
144
+ <button
145
+ class="flex items-center justify-between gap-2"
146
+ disabled={!toSort}
147
+ on:click={() => sorting(toSort ?? false, b)}
148
+ >
149
+ {b.header ?? b.field?.caption}
150
+ {#if toSort}
151
+ <Icon {...sortingIcon(toSort ?? false, b, orderBy)}></Icon>
152
+ {/if}
153
+ </button>
154
+ {:else}
155
+ {b.header ?? b.field?.caption}
156
+ {/if}
157
+ {/if}
158
+ </th>
159
+ {/each}
137
160
 
138
- {#if !settingsLeft && (withEdit || withDelete || withAdd)}
139
- <th class="rounded-tr-lg">
140
- <div class="flex justify-end">
141
- {#if withAdd}
142
- <Button
143
- permission={store.getRepo().metadata.options.permissionApiInsert}
144
- disabled={!store.getRepo().metadata.apiInsertAllowed()}
145
- class="btn btn-square btn-ghost btn-xs"
146
- on:click={() => dispatch('add', {})}
147
- >
148
- <Icon data={LibIcon_Add} />
149
- </Button>
150
- {:else}
151
- <Icon data={LibIcon_Settings}></Icon>
152
- {/if}
153
- </div>
154
- </th>
155
- {/if}
156
- </tr>
157
- </thead>
158
- <tbody>
159
- <!-- Show loading only if there is no items and loading is true, like this on an update, there will be no jump -->
160
- {#if $store.items.length === 0 && $store.loading && store.getRepo().metadata.apiReadAllowed}
161
- <GridLoading columns={getAligns(cells, withEdit || withDelete)} {loadingRows} />
162
- {:else}
163
- {#each $store.items as row}
164
- <tr on:click={() => dispatch('rowclick', row)} class="hover:bg-base-content/20">
165
- <!-- BECARFULL THIS CODE IS DUPLICATED -->
166
- {#if settingsLeft && (withEdit || withDelete)}
167
- <td class="text-left">
168
- <div class="flex justify-start gap-2">
169
- {#if withEdit}
170
- <Button
171
- permission={store.getRepo().metadata.options.permissionApiUpdate}
172
- disabled={!store.getRepo().metadata.apiUpdateAllowed()}
173
- class="btn btn-square btn-ghost btn-xs"
174
- on:click={() => dispatch('edit', row)}
175
- >
176
- <Icon data={LibIcon_Edit} />
177
- </Button>
178
- {/if}
179
- {#if withDelete}
180
- <Button
181
- permission={store.getRepo().metadata.options.permissionApiDelete}
182
- disabled={!store.getRepo().metadata.apiDeleteAllowed()}
183
- class="btn btn-square btn-ghost btn-xs"
184
- on:click={() => dispatch('delete', row)}
185
- >
186
- <Icon data={LibIcon_Delete} />
187
- </Button>
188
- {/if}
189
- </div>
190
- </td>
191
- {/if}
161
+ {#if !settingsLeft && (withEdit || withDelete || withAdd)}
162
+ <th class="rounded-tr-lg">
163
+ <div class="flex justify-end">
164
+ {#if withAdd}
165
+ <Button
166
+ permission={store.getRepo().metadata.options.permissionApiInsert}
167
+ disabled={!store.getRepo().metadata.apiInsertAllowed()}
168
+ class="btn btn-square btn-ghost btn-xs"
169
+ on:click={() => dispatch('add', {})}
170
+ >
171
+ <Icon data={LibIcon_Add} />
172
+ </Button>
173
+ {:else}
174
+ <Icon data={LibIcon_Settings}></Icon>
175
+ {/if}
176
+ </div>
177
+ </th>
178
+ {/if}
179
+ </tr>
180
+ </thead>
181
+ <tbody>
182
+ <!-- Show loading only if there is no items and loading is true, like this on an update, there will be no jump -->
183
+ {#if $store.items.length === 0 && $store.loading && store.getRepo().metadata.apiReadAllowed}
184
+ <GridLoading columns={getAligns(cells, withEdit || withDelete)} {loadingRows} />
185
+ {:else}
186
+ {#each $store.items as row}
187
+ <tr on:click={() => dispatch('rowclick', row)} class="hover:bg-base-content/20">
188
+ <!-- BECARFULL THIS CODE IS DUPLICATED -->
189
+ {#if settingsLeft && (withEdit || withDelete)}
190
+ <td class="text-left">
191
+ <div class="flex justify-start gap-2">
192
+ {#if withEdit}
193
+ <Button
194
+ permission={store.getRepo().metadata.options.permissionApiUpdate}
195
+ disabled={!store.getRepo().metadata.apiUpdateAllowed()}
196
+ class="btn btn-square btn-ghost btn-xs"
197
+ on:click={() => dispatch('edit', row)}
198
+ >
199
+ <Icon data={LibIcon_Edit} />
200
+ </Button>
201
+ {/if}
202
+ {#if withDelete}
203
+ <Button
204
+ permission={store.getRepo().metadata.options.permissionApiDelete}
205
+ disabled={!store.getRepo().metadata.apiDeleteAllowed()}
206
+ class="btn btn-square btn-ghost btn-xs"
207
+ on:click={() => dispatch('delete', row)}
208
+ >
209
+ <Icon data={LibIcon_Delete} />
210
+ </Button>
211
+ {/if}
212
+ </div>
213
+ </td>
214
+ {/if}
192
215
 
193
- {#each cellsToTake(cells) as b}
194
- {@const metaType = getFieldMetaType(b.field)}
195
- <td class={align(b.field, b.kind === 'slot')}>
196
- {#if metaType.kind === 'slot' || b.kind === 'slot'}
197
- <slot name="cell" {row} field={b.field} cell={b} />
198
- {:else if b.kind === 'component'}
199
- {#if b.component}
200
- <div class={b.class}>
201
- <svelte:component
202
- this={b.component}
203
- {...b.props}
204
- {...b.rowToProps ? b.rowToProps(row) : {}}
205
- on:refresh
206
- ></svelte:component>
207
- </div>
208
- {:else}
209
- <pre>Col: {b.col}</pre>
210
- <pre class="bg-error">Component prop needed !</pre>
211
- {/if}
212
- {:else if metaType.kind === 'relation'}
213
- {@const item = getEntityDisplayValue(
214
- metaType.repoTarget,
215
- row[metaType.field.key],
216
- )}
217
- <LinkPlus
218
- item={{
219
- ...item,
220
- href: b.field?.options?.href ? b.field?.options.href(row) : item?.href,
221
- }}
222
- />
223
- {:else if b.kind === 'baseItem'}
224
- <LinkPlus item={row[metaType.field.key]} />
225
- {:else if b.kind === 'field_link'}
226
- {@const item = getFieldLinkDisplayValue(metaType.field, row)}
227
- <LinkPlus {item} />
228
- {:else if b.kind === 'entity_link'}
229
- {@const item = getEntityDisplayValueFromField(metaType.field, row)}
230
- <LinkPlus {item} />
231
- {:else if metaType.kind === 'enum'}
232
- {#if metaType.subKind === 'single'}
233
- <LinkPlus item={row[metaType.field.key]}></LinkPlus>
234
- {:else if metaType.subKind === 'multi'}
235
- <!-- {@const t = metaType.field.displayValue(row)} -->
236
- {#each row[metaType.field.key] as enumVal}
237
- <div>
238
- {enumVal.caption}
239
- </div>
240
- {/each}
241
- {/if}
242
- {:else if metaType.subKind === 'checkbox'}
243
- {@const t = metaType.field.displayValue(row)}
244
- {t === 'true' ? 'Oui' : 'Non'}
245
- {:else}
246
- {@const t = displayWithDefaultAndSuffix(metaType.field, row[metaType.field.key])}
247
- {#if b.clipboardable}
248
- <Clipboardable value={t}>
249
- <!-- 20 is a cool value ! -->
250
- <span class={t.length < 20 ? 'text-nowrap' : ''}>
251
- {t}
252
- </span>
253
- </Clipboardable>
254
- {:else}
255
- <!-- 20 is a cool value ! -->
256
- <span class={t.length < 20 ? 'text-nowrap' : ''}>
257
- {t}
258
- </span>
259
- {/if}
260
- {/if}
261
- </td>
262
- {/each}
216
+ {#each cellsToTake(cells) as b}
217
+ {@const metaType = getFieldMetaType(b.field)}
218
+ <td class={align(b.field, b.kind === 'slot')}>
219
+ {#if metaType.kind === 'slot' || b.kind === 'slot'}
220
+ <slot name="cell" {row} field={b.field} cell={b} />
221
+ {:else if b.kind === 'component'}
222
+ {#if b.component}
223
+ <div class={b.class}>
224
+ <svelte:component
225
+ this={b.component}
226
+ {...b.props}
227
+ {...b.rowToProps ? b.rowToProps(row) : {}}
228
+ on:refresh
229
+ ></svelte:component>
230
+ </div>
231
+ {:else}
232
+ <pre>Col: {b.col}</pre>
233
+ <pre class="bg-error">Component prop needed !</pre>
234
+ {/if}
235
+ {:else if metaType.kind === 'relation'}
236
+ {@const item = getEntityDisplayValue(metaType.repoTarget, row[metaType.field.key])}
237
+ <LinkPlus
238
+ item={{
239
+ ...item,
240
+ href: b.field?.options?.href ? b.field?.options.href(row) : item?.href,
241
+ }}
242
+ />
243
+ {:else if b.kind === 'baseItem'}
244
+ <LinkPlus item={row[metaType.field.key]} />
245
+ {:else if b.kind === 'field_link'}
246
+ {@const item = getFieldLinkDisplayValue(metaType.field, row)}
247
+ <LinkPlus {item} />
248
+ {:else if b.kind === 'entity_link'}
249
+ {@const item = getEntityDisplayValueFromField(metaType.field, row)}
250
+ <LinkPlus {item} />
251
+ {:else if metaType.kind === 'enum'}
252
+ {#if metaType.subKind === 'single'}
253
+ <LinkPlus item={row[metaType.field.key]}></LinkPlus>
254
+ {:else if metaType.subKind === 'multi'}
255
+ <!-- {@const t = metaType.field.displayValue(row)} -->
256
+ {#each row[metaType.field.key] as enumVal}
257
+ <div>
258
+ {enumVal.caption}
259
+ </div>
260
+ {/each}
261
+ {/if}
262
+ {:else if metaType.subKind === 'checkbox'}
263
+ {@const t = metaType.field.displayValue(row)}
264
+ {t === 'true' ? 'Oui' : 'Non'}
265
+ {:else}
266
+ {@const t = displayWithDefaultAndSuffix(metaType.field, row[metaType.field.key])}
267
+ {#if b.clipboardable}
268
+ <Clipboardable value={t}>
269
+ <!-- 20 is a cool value ! -->
270
+ <span class={t.length < 20 ? 'text-nowrap' : ''}>
271
+ {t}
272
+ </span>
273
+ </Clipboardable>
274
+ {:else}
275
+ <!-- 20 is a cool value ! -->
276
+ <span class={t.length < 20 ? 'text-nowrap' : ''}>
277
+ {t}
278
+ </span>
279
+ {/if}
280
+ {/if}
281
+ </td>
282
+ {/each}
263
283
 
264
- {#if !settingsLeft && (withEdit || withDelete)}
265
- <td class="text-right">
266
- <div class="flex justify-end gap-2">
267
- {#if withEdit}
268
- <Button
269
- permission={store.getRepo().metadata.options.permissionApiUpdate}
270
- disabled={!store.getRepo().metadata.apiUpdateAllowed()}
271
- class="btn btn-square btn-ghost btn-xs"
272
- on:click={() => dispatch('edit', row)}
273
- >
274
- <Icon data={LibIcon_Edit} />
275
- </Button>
276
- {/if}
277
- {#if withDelete}
278
- <Button
279
- permission={store.getRepo().metadata.options.permissionApiDelete}
280
- disabled={!store.getRepo().metadata.apiDeleteAllowed()}
281
- class="btn btn-square btn-ghost btn-xs"
282
- on:click={() => dispatch('delete', row)}
283
- >
284
- <Icon data={LibIcon_Delete} />
285
- </Button>
286
- {/if}
287
- </div>
288
- </td>
289
- {/if}
290
- </tr>
291
- {:else}
292
- {#if !store.getRepo().metadata.apiReadAllowed}
293
- <tr>
294
- <td
295
- colspan={getAligns(cells, withEdit || withDelete).length}
296
- class="text-center py-12"
297
- >
298
- Vous n'avez pas la permission pour ces données!
299
- </td>
300
- </tr>
301
- {:else if dicoNoResult}
302
- <tr>
303
- <td
304
- colspan={getAligns(cells, withEdit || withDelete).length}
305
- class="text-center py-12"
306
- >
307
- {dicoNoResult}
308
- </td>
309
- </tr>
310
- {/if}
311
- {/each}
312
- <slot name="extra" />
313
- {/if}
314
- </tbody>
315
- </table>
284
+ {#if !settingsLeft && (withEdit || withDelete)}
285
+ <td class="text-right">
286
+ <div class="flex justify-end gap-2">
287
+ {#if withEdit}
288
+ <Button
289
+ permission={store.getRepo().metadata.options.permissionApiUpdate}
290
+ disabled={!store.getRepo().metadata.apiUpdateAllowed()}
291
+ class="btn btn-square btn-ghost btn-xs"
292
+ on:click={() => dispatch('edit', row)}
293
+ >
294
+ <Icon data={LibIcon_Edit} />
295
+ </Button>
296
+ {/if}
297
+ {#if withDelete}
298
+ <Button
299
+ permission={store.getRepo().metadata.options.permissionApiDelete}
300
+ disabled={!store.getRepo().metadata.apiDeleteAllowed()}
301
+ class="btn btn-square btn-ghost btn-xs"
302
+ on:click={() => dispatch('delete', row)}
303
+ >
304
+ <Icon data={LibIcon_Delete} />
305
+ </Button>
306
+ {/if}
307
+ </div>
308
+ </td>
309
+ {/if}
310
+ </tr>
311
+ {:else}
312
+ {#if !store.getRepo().metadata.apiReadAllowed}
313
+ <tr>
314
+ <td colspan={getAligns(cells, withEdit || withDelete).length} class="text-center py-12">
315
+ Vous n'avez pas la permission pour ces données!
316
+ </td>
317
+ </tr>
318
+ {:else if dicoNoResult}
319
+ <tr>
320
+ <td colspan={getAligns(cells, withEdit || withDelete).length} class="text-center py-12">
321
+ {dicoNoResult}
322
+ </td>
323
+ </tr>
324
+ {/if}
325
+ {/each}
326
+ <slot name="extra" />
327
+ {/if}
328
+ </tbody>
329
+ </table>
316
330
  </div>