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.
- package/CHANGELOG.md +16 -0
- package/esm/ROUTES.d.ts +2 -0
- package/esm/ROUTES.js +1 -0
- package/esm/api/index.d.ts +9 -0
- package/esm/api/index.js +3 -1
- package/esm/auth/AuthController.d.ts +12 -23
- package/esm/auth/AuthController.js +12 -31
- package/esm/auth/server/AuthController.server.d.ts +11 -11
- package/esm/auth/server/AuthController.server.js +99 -34
- package/esm/auth/server/handleGuard.d.ts +16 -0
- package/esm/auth/server/handleGuard.js +67 -0
- package/esm/auth/server/helperFirstly.d.ts +1 -1
- package/esm/auth/server/helperFirstly.js +1 -0
- package/esm/auth/server/index.d.ts +3 -1
- package/esm/auth/server/index.js +3 -1
- package/esm/auth/server/module.d.ts +105 -89
- package/esm/auth/server/module.js +55 -42
- package/esm/auth/server/providers/github.d.ts +4 -2
- package/esm/auth/server/providers/github.js +2 -2
- package/esm/auth/static/assets/Page-B0XXxe0N.d.ts +6 -0
- package/esm/auth/static/assets/Page-B0XXxe0N.js +1 -0
- package/esm/auth/static/assets/Page-DdKMiUZn.d.ts +6 -0
- package/esm/auth/static/assets/Page-DdKMiUZn.js +20 -0
- package/esm/auth/static/assets/Page-UV_hqY7I.d.ts +6 -0
- package/esm/auth/static/assets/Page-UV_hqY7I.js +1 -0
- package/esm/auth/static/assets/Page-mK42zGEw.css +1 -0
- package/esm/auth/static/assets/index-C9jzxOBu.d.ts +151 -0
- package/esm/auth/static/assets/index-C9jzxOBu.js +42 -0
- package/esm/auth/static/assets/index-DKWpA6v7.css +4 -0
- package/esm/auth/static/index.html +11 -11
- package/esm/auth/types.d.ts +26 -3
- package/esm/bin/cmd.js +423 -152
- package/esm/cellsBuildor.js +1 -1
- package/esm/common.d.ts +5 -0
- package/esm/common.js +8 -0
- package/esm/cron/server/index.js +1 -1
- package/esm/feedback/FeedbackController.js +58 -53
- package/esm/feedback/server/index.d.ts +6 -15
- package/esm/feedback/server/index.js +4 -5
- package/esm/feedback/types.d.ts +14 -0
- package/esm/feedback/types.js +4 -0
- package/esm/feedback/ui/DialogIssue.svelte +131 -119
- package/esm/feedback/ui/DialogIssue.svelte.d.ts +20 -18
- package/esm/feedback/ui/DialogIssues.svelte +108 -99
- package/esm/feedback/ui/DialogIssues.svelte.d.ts +20 -18
- package/esm/feedback/ui/DialogMilestones.svelte +40 -34
- package/esm/feedback/ui/DialogMilestones.svelte.d.ts +18 -16
- package/esm/feedback/ui/Feedback.svelte +11 -9
- package/esm/feedback/ui/Feedback.svelte.d.ts +16 -14
- package/esm/index.d.ts +2 -5
- package/esm/index.js +2 -8
- package/esm/mail/server/index.d.ts +9 -2
- package/esm/mail/server/index.js +3 -1
- package/esm/mail/templates/DefaultMail.svelte +81 -61
- package/esm/mail/templates/DefaultMail.svelte.d.ts +28 -26
- package/esm/server/index.d.ts +0 -0
- package/esm/server/index.js +1 -0
- package/esm/storeItem.d.ts +1 -4
- package/esm/storeItem.js +1 -1
- package/esm/storeList.d.ts +1 -4
- package/esm/sveltekit/server/index.d.ts +3 -9
- package/esm/sveltekit/server/index.js +3 -0
- package/esm/ui/Button.svelte +112 -89
- package/esm/ui/Button.svelte.d.ts +34 -24
- package/esm/ui/Clipboardable.svelte +24 -17
- package/esm/ui/Clipboardable.svelte.d.ts +34 -23
- package/esm/ui/Field.svelte +328 -285
- package/esm/ui/Field.svelte.d.ts +15 -8
- package/esm/ui/FieldGroup.svelte +112 -91
- package/esm/ui/FieldGroup.svelte.d.ts +17 -6
- package/esm/ui/Grid.svelte +322 -308
- package/esm/ui/Grid.svelte.d.ts +17 -6
- package/esm/ui/GridLoading.svelte +28 -27
- package/esm/ui/GridLoading.svelte.d.ts +19 -17
- package/esm/ui/GridPaginate.svelte +68 -61
- package/esm/ui/GridPaginate.svelte.d.ts +21 -19
- package/esm/ui/Icon.svelte +116 -80
- package/esm/ui/Icon.svelte.d.ts +52 -43
- package/esm/ui/Loading.svelte +10 -8
- package/esm/ui/Loading.svelte.d.ts +29 -18
- package/esm/ui/Tooltip.svelte +38 -35
- package/esm/ui/Tooltip.svelte.d.ts +30 -20
- package/esm/ui/dialog/DialogForm.svelte +70 -63
- package/esm/ui/dialog/DialogForm.svelte.d.ts +18 -16
- package/esm/ui/dialog/DialogManagement.svelte +74 -74
- package/esm/ui/dialog/DialogManagement.svelte.d.ts +22 -21
- package/esm/ui/dialog/DialogPrimitive.svelte +82 -76
- package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +35 -25
- package/esm/ui/dialog/FormEditAction.svelte +58 -50
- package/esm/ui/dialog/FormEditAction.svelte.d.ts +13 -6
- package/esm/ui/dialog/dialog.d.ts +1 -4
- package/esm/ui/internals/FieldContainer.svelte +24 -17
- package/esm/ui/internals/FieldContainer.svelte.d.ts +37 -28
- package/esm/ui/internals/Input.svelte +136 -102
- package/esm/ui/internals/Input.svelte.d.ts +34 -32
- package/esm/ui/internals/Textarea.svelte +60 -52
- package/esm/ui/internals/Textarea.svelte.d.ts +31 -28
- package/esm/ui/internals/select/MultiSelectMelt.svelte +243 -199
- package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +29 -27
- package/esm/ui/internals/select/SelectMelt.svelte +254 -219
- package/esm/ui/internals/select/SelectMelt.svelte.d.ts +34 -32
- package/esm/ui/internals/select/SelectRadio.svelte +39 -33
- package/esm/ui/internals/select/SelectRadio.svelte.d.ts +24 -22
- package/esm/ui/link/Link.svelte +25 -20
- package/esm/ui/link/Link.svelte.d.ts +31 -23
- package/esm/ui/link/LinkPlus.svelte +52 -51
- package/esm/ui/link/LinkPlus.svelte.d.ts +20 -18
- package/esm/vite/index.d.ts +2 -3
- package/esm/vite/index.js +33 -26
- package/package.json +16 -20
- package/esm/auth/static/assets/Page-Bb8bFlrP.d.ts +0 -4
- package/esm/auth/static/assets/Page-Bb8bFlrP.js +0 -1
- package/esm/auth/static/assets/Page-BxomFlZ8.d.ts +0 -4
- package/esm/auth/static/assets/Page-BxomFlZ8.js +0 -1
- package/esm/auth/static/assets/Page-CaIYu0-y.d.ts +0 -6
- package/esm/auth/static/assets/Page-CaIYu0-y.js +0 -19
- package/esm/auth/static/assets/Page-MkYglNtu.css +0 -1
- package/esm/auth/static/assets/index-Bl0Bk5u0.d.ts +0 -64
- package/esm/auth/static/assets/index-Bl0Bk5u0.js +0 -2
- package/esm/auth/static/assets/index-R27C_TlP.css +0 -4
package/esm/ui/Grid.svelte
CHANGED
|
@@ -1,316 +1,330 @@
|
|
|
1
|
-
<script generics="T extends Record<any, any>">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export let
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export let
|
|
33
|
-
export let
|
|
34
|
-
export let
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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>
|