fuma 0.5.1 → 1.0.1
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 +1 -1
- package/dist/private/Meta.svelte +32 -27
- package/dist/private/Meta.svelte.d.ts +1 -0
- package/dist/private/api.d.ts +1 -1
- package/dist/ui/badge/Badge.svelte +4 -3
- package/dist/ui/button/ButtonCopy.svelte +32 -26
- package/dist/ui/button/ButtonDelete.svelte +23 -21
- package/dist/ui/button/ButtonDelete.svelte.d.ts +1 -0
- package/dist/ui/card/Card.svelte +13 -10
- package/dist/ui/card/Card.svelte.d.ts +1 -0
- package/dist/ui/card/CardBasic.svelte +5 -4
- package/dist/ui/card/CardBasic.svelte.d.ts +1 -0
- package/dist/ui/card/CardCollapse.svelte +35 -31
- package/dist/ui/card/CardCollapse.svelte.d.ts +1 -0
- package/dist/ui/card/CardFullScreen.svelte +8 -6
- package/dist/ui/card/CardFullScreen.svelte.d.ts +3 -0
- package/dist/ui/card/CardLink.svelte +5 -4
- package/dist/ui/card/CardLink.svelte.d.ts +1 -0
- package/dist/ui/dialog/Dialog.svelte +41 -34
- package/dist/ui/dialog/Dialog.svelte.d.ts +1 -0
- package/dist/ui/dialog/DialogConfirm.svelte +6 -4
- package/dist/ui/dialog/DialogConfirm.svelte.d.ts +1 -0
- package/dist/ui/drawer/Drawer.svelte +47 -38
- package/dist/ui/drawer/Drawer.svelte.d.ts +16 -0
- package/dist/ui/form/Form.svelte +101 -83
- package/dist/ui/form/Form.svelte.d.ts +1 -0
- package/dist/ui/form/FormInput.svelte +12 -6
- package/dist/ui/form/FormInput.svelte.d.ts +30 -8
- package/dist/ui/form/FormSection.svelte +24 -17
- package/dist/ui/form/formInput.d.ts +7 -4
- package/dist/ui/icon/Icon.svelte +35 -32
- package/dist/ui/index.d.ts +0 -1
- package/dist/ui/index.js +0 -1
- package/dist/ui/input/FormControl.svelte +48 -36
- package/dist/ui/input/FormControl.svelte.d.ts +7 -9
- package/dist/ui/input/InputBoolean.svelte +29 -22
- package/dist/ui/input/InputBoolean.svelte.d.ts +5 -1
- package/dist/ui/input/InputCheckboxs.svelte +37 -34
- package/dist/ui/input/InputCheckboxs.svelte.d.ts +5 -1
- package/dist/ui/input/InputCheckboxsMenu.svelte +64 -47
- package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +5 -1
- package/dist/ui/input/InputCheckboxsTree.svelte +9 -6
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte +36 -28
- package/dist/ui/input/InputCombo.svelte +76 -65
- package/dist/ui/input/InputCombo.svelte.d.ts +5 -1
- package/dist/ui/input/InputDate.svelte +36 -29
- package/dist/ui/input/InputDateTime.svelte +37 -30
- package/dist/ui/input/InputImage.svelte +52 -45
- package/dist/ui/input/InputImage.svelte.d.ts +1 -0
- package/dist/ui/input/InputImagePreview.svelte +24 -20
- package/dist/ui/input/InputNumber.svelte +28 -22
- package/dist/ui/input/InputNumber.svelte.d.ts +1 -5
- package/dist/ui/input/InputOptionInParam.svelte +12 -10
- package/dist/ui/input/InputOptions.svelte +40 -34
- package/dist/ui/input/InputPassword.svelte +22 -18
- package/dist/ui/input/InputPassword.svelte.d.ts +5 -1
- package/dist/ui/input/InputRadio.svelte +51 -46
- package/dist/ui/input/InputRadio.svelte.d.ts +5 -1
- package/dist/ui/input/InputRelation.svelte +119 -111
- package/dist/ui/input/InputRelation.svelte.d.ts +6 -12
- package/dist/ui/input/InputRelations.svelte +94 -90
- package/dist/ui/input/InputRelations.svelte.d.ts +5 -12
- package/dist/ui/input/InputSearch.svelte +13 -10
- package/dist/ui/input/InputSelect.svelte +59 -46
- package/dist/ui/input/InputText.svelte +29 -28
- package/dist/ui/input/InputText.svelte.d.ts +0 -3
- package/dist/ui/input/InputTextarea.svelte +20 -19
- package/dist/ui/input/InputTextarea.svelte.d.ts +1 -5
- package/dist/ui/input/InputTime.svelte +43 -35
- package/dist/ui/input/RelationAfter.svelte +13 -9
- package/dist/ui/input/SelectorList.svelte +16 -12
- package/dist/ui/input/SelectorList.svelte.d.ts +4 -0
- package/dist/ui/input/textRich/InputTextRich.svelte +63 -54
- package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +5 -1
- package/dist/ui/input/textRich/SuggesionList.svelte +13 -9
- package/dist/ui/input/textRich/ToolMark.svelte +12 -9
- package/dist/ui/input/textRich/ToolMarkColor.svelte +16 -12
- package/dist/ui/input/textRich/ToolMarkLink.svelte +46 -38
- package/dist/ui/input/textRich/ToolMenu.svelte +34 -19
- package/dist/ui/input/textRich/ToolMenuAlign.svelte +13 -9
- package/dist/ui/input/textRich/ToolMenuInsert.svelte +12 -7
- package/dist/ui/input/textRich/ToolMenuNode.svelte +14 -10
- package/dist/ui/input/textRich/ToolsBar.svelte +17 -13
- package/dist/ui/login/Login.svelte +37 -31
- package/dist/ui/menu/ContextMenu.svelte +37 -31
- package/dist/ui/menu/ContextMenu.svelte.d.ts +1 -0
- package/dist/ui/menu/DropDown.svelte +92 -83
- package/dist/ui/menu/DropDown.svelte.d.ts +1 -0
- package/dist/ui/menu/DropDownMenu.svelte +25 -18
- package/dist/ui/menu/DropDownMenu.svelte.d.ts +1 -0
- package/dist/ui/mode/ToggleMode.svelte +19 -15
- package/dist/ui/mode/ToggleMode.svelte.d.ts +7 -1
- package/dist/ui/pagination/Pagination.svelte +9 -8
- package/dist/ui/placeholder/Placeholder.svelte +4 -3
- package/dist/ui/placeholder/Placeholder.svelte.d.ts +1 -0
- package/dist/ui/placeholder/PlaceholderImage.svelte +6 -4
- package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +1 -0
- package/dist/ui/range/RangePicker.svelte +76 -63
- package/dist/ui/range/RangePickerButton.svelte +43 -35
- package/dist/ui/table/Table.svelte +35 -28
- package/dist/ui/table/TableBody.svelte +18 -12
- package/dist/ui/table/TableCell.svelte +13 -10
- package/dist/ui/table/TableFieldsEdition.svelte +57 -51
- package/dist/ui/table/TableHead.svelte +19 -20
- package/dist/ui/table/TableViewSelect.svelte +50 -37
- package/dist/ui/table/cell/TableCellArray.svelte +5 -3
- package/dist/ui/table/cell/TableCellBoolean.svelte +4 -3
- package/dist/ui/table/cell/TableCellNumber.svelte +2 -1
- package/dist/ui/table/cell/TableCellString.svelte +5 -2
- package/dist/ui/table/head/TableHeadBoolean.svelte +6 -3
- package/dist/ui/table/head/TableHeadDate.svelte +54 -47
- package/dist/ui/table/head/TableHeadDefault.svelte +5 -2
- package/dist/ui/table/head/TableHeadNumber.svelte +65 -53
- package/dist/ui/table/head/TableHeadSelect.svelte +47 -41
- package/dist/ui/table/head/TableHeadString.svelte +14 -8
- package/dist/ui/tabs/Tabs.svelte +8 -5
- package/dist/ui/tabs/TabsIcon.svelte +31 -28
- package/package.json +32 -33
- package/dist/ui/slot/Slot.svelte +0 -35
- package/dist/ui/slot/Slot.svelte.d.ts +0 -22
- package/dist/ui/slot/Span.svelte +0 -4
- package/dist/ui/slot/Span.svelte.d.ts +0 -16
- package/dist/ui/slot/index.d.ts +0 -1
- package/dist/ui/slot/index.js +0 -1
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher } from 'svelte'
|
|
3
|
+
import { mdiUnfoldMoreHorizontal } from '@mdi/js'
|
|
4
|
+
|
|
5
|
+
import { Icon } from '../icon/index.js'
|
|
6
|
+
import { DropDown } from './index.js'
|
|
7
|
+
import { SelectorList } from '../input/index.js'
|
|
8
|
+
import { type Options, parseOptions } from '../../utils/options.js'
|
|
9
|
+
import type { TippyProps } from '../../utils/tippy.js'
|
|
10
|
+
|
|
11
|
+
export let options: Options
|
|
12
|
+
export let tippyProps: Partial<TippyProps> = {}
|
|
13
|
+
|
|
14
|
+
$: _options = parseOptions(options)
|
|
15
|
+
|
|
16
|
+
let trigger: HTMLDivElement
|
|
17
|
+
|
|
18
|
+
let dropDown: DropDown
|
|
19
|
+
const dispatch = createEventDispatcher<{ select: string }>()
|
|
20
|
+
|
|
21
|
+
function onSelect(index: number) {
|
|
22
|
+
const option = _options[index]
|
|
23
|
+
dispatch('select', option.value)
|
|
24
|
+
dropDown.hide()
|
|
25
|
+
}
|
|
19
26
|
</script>
|
|
20
27
|
|
|
21
28
|
<DropDown bind:this={dropDown} {tippyProps}>
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { browser } from '$app/environment'
|
|
3
|
+
import { ModeWatcher, toggleMode, mode } from 'mode-watcher'
|
|
4
|
+
|
|
5
|
+
import { Icon } from '../icon/index.js'
|
|
6
|
+
import { mdiWeatherNight, mdiWhiteBalanceSunny } from '@mdi/js'
|
|
7
|
+
|
|
8
|
+
let klass = ''
|
|
9
|
+
export { klass as class }
|
|
10
|
+
|
|
11
|
+
mode.subscribe((_mode) => {
|
|
12
|
+
if (!browser) return
|
|
13
|
+
const [html] = document.getElementsByTagName('html')
|
|
14
|
+
if (!html || !_mode) return
|
|
15
|
+
html.setAttribute('data-theme', _mode)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
$: path = $mode === 'light' ? mdiWhiteBalanceSunny : mdiWeatherNight
|
|
15
19
|
</script>
|
|
16
20
|
|
|
17
21
|
<ModeWatcher />
|
|
18
22
|
|
|
19
23
|
<slot {toggleMode} {path}>
|
|
20
|
-
<button class="btn btn-square btn-sm" on:click={toggleMode}>
|
|
24
|
+
<button class="btn btn-square btn-sm {klass}" on:click={toggleMode}>
|
|
21
25
|
<Icon {path} />
|
|
22
26
|
</button>
|
|
23
27
|
</slot>
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
import { toggleMode } from 'mode-watcher';
|
|
3
3
|
declare const __propDef: {
|
|
4
|
-
props:
|
|
4
|
+
props: {
|
|
5
|
+
class?: string | undefined;
|
|
6
|
+
children?: import("svelte").Snippet<[{
|
|
7
|
+
toggleMode: typeof toggleMode;
|
|
8
|
+
path: string;
|
|
9
|
+
}]> | undefined;
|
|
10
|
+
};
|
|
5
11
|
events: {
|
|
6
12
|
[evt: string]: CustomEvent<any>;
|
|
7
13
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { mdiChevronLeft, mdiChevronRight } from '@mdi/js'
|
|
3
|
+
import { Icon } from '../icon/index.js'
|
|
4
|
+
import { urlParam } from '../../store/index.js'
|
|
5
|
+
|
|
6
|
+
export let take = 20
|
|
7
|
+
|
|
8
|
+
$: skip = +($urlParam.get('skip') || 0)
|
|
9
|
+
$: _take = +($urlParam.get('take') || take)
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<div class="join">
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { mdiPlus } from '@mdi/js'
|
|
3
|
+
import { Icon } from '../icon/index.js'
|
|
4
|
+
|
|
5
|
+
export let x: number
|
|
6
|
+
export let y: number
|
|
5
7
|
</script>
|
|
6
8
|
|
|
7
9
|
<div style:width="{x}px" style:height="{y}px" class="rounded-lg bg-base-200 p-2">
|
|
@@ -1,68 +1,81 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export let
|
|
8
|
-
export let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount, onDestroy, createEventDispatcher } from 'svelte'
|
|
3
|
+
import type { Litepicker } from 'litepicker'
|
|
4
|
+
import type { Range, RangeAsDate, RangeDate } from './types.js'
|
|
5
|
+
import dayjs from 'dayjs'
|
|
6
|
+
|
|
7
|
+
export let numberOfMonths = 3
|
|
8
|
+
export let numberOfColumns = numberOfMonths
|
|
9
|
+
export let showWeekNumbers = true
|
|
10
|
+
export let range: RangeAsDate | undefined = undefined
|
|
11
|
+
export let minDate: Date | number | string | undefined = undefined
|
|
12
|
+
export let maxDate: Date | number | string | undefined = undefined
|
|
13
|
+
|
|
14
|
+
let startElement: HTMLInputElement
|
|
15
|
+
let endElement: HTMLInputElement
|
|
16
|
+
let picker: Litepicker
|
|
17
|
+
let parentEl: HTMLDivElement
|
|
18
|
+
const dispatch = createEventDispatcher<{ change: Range }>()
|
|
19
|
+
|
|
20
|
+
onMount(() => {
|
|
21
|
+
initTimePicker()
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
onDestroy(() => {
|
|
25
|
+
picker?.destroy()
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export function clear() {
|
|
29
|
+
picker?.clearSelection()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function initTimePicker() {
|
|
33
|
+
const _Litepicker = (await import('litepicker')).Litepicker
|
|
34
|
+
picker?.destroy()
|
|
35
|
+
picker = new _Litepicker({
|
|
36
|
+
element: startElement,
|
|
37
|
+
elementEnd: endElement,
|
|
38
|
+
// Nécéssaire pour traquer le theme
|
|
39
|
+
parentEl: parentEl,
|
|
40
|
+
inlineMode: true,
|
|
41
|
+
singleMode: false,
|
|
42
|
+
allowRepick: false,
|
|
43
|
+
lang: navigator.language,
|
|
44
|
+
numberOfMonths,
|
|
45
|
+
numberOfColumns,
|
|
46
|
+
showWeekNumbers,
|
|
47
|
+
minDate,
|
|
48
|
+
maxDate,
|
|
49
|
+
startDate: range?.start ? dayjs(range.start).toDate() : undefined,
|
|
50
|
+
endDate: range?.end ? dayjs(range.end).toDate() : undefined,
|
|
51
|
+
setup: (picker: Litepicker) => {
|
|
52
|
+
picker.on('selected', (date1: any, date2: any) => {
|
|
53
|
+
range = {
|
|
54
|
+
start: new Date(
|
|
55
|
+
`${getAbsoluteDate(date1.dateInstance)}T${getAbsoluteTime(range?.start)}`
|
|
56
|
+
),
|
|
57
|
+
end: new Date(
|
|
58
|
+
`${getAbsoluteDate(date2.dateInstance)}T${getAbsoluteTime(range?.end, '23:59:00')}`
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
dispatch('change', range)
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const getAbsoluteDate = (date: Date) =>
|
|
68
|
+
[date.getFullYear(), date.getMonth() + 1, date.getDate()]
|
|
69
|
+
.map((n) => n.toString().padStart(2, '0'))
|
|
70
|
+
.join('-')
|
|
71
|
+
|
|
72
|
+
const getAbsoluteTime = (date?: RangeDate, defaultTime = '00:00:00') => {
|
|
73
|
+
if (!date) return defaultTime
|
|
74
|
+
return dayjs(date).format('HH:mm:ss')
|
|
75
|
+
}
|
|
63
76
|
</script>
|
|
64
77
|
|
|
65
78
|
<input type="hidden" bind:this={startElement} />
|
|
66
79
|
<input type="hidden" bind:this={endElement} />
|
|
67
80
|
|
|
68
|
-
<div bind:this={parentEl}
|
|
81
|
+
<div bind:this={parentEl}></div>
|
|
@@ -1,38 +1,46 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { mdiCalendarMonthOutline } from '@mdi/js'
|
|
3
|
+
import { goto } from '$app/navigation'
|
|
4
|
+
import { slide } from 'svelte/transition'
|
|
5
|
+
|
|
6
|
+
import { urlParam } from '../../store/param.js'
|
|
7
|
+
import { formatRangeShort } from './format.js'
|
|
8
|
+
import { Icon } from '../icon/index.js'
|
|
9
|
+
import { DropDown } from '../menu/index.js'
|
|
10
|
+
import { InputTime } from '../input/index.js'
|
|
11
|
+
import { type RangeAsDate, RangePicker } from './index.js'
|
|
12
|
+
import { jsonParse } from '../../utils/jsonParse.js'
|
|
13
|
+
export let minDate: Date | number | string | undefined = undefined
|
|
14
|
+
export let maxDate: Date | number | string | undefined = undefined
|
|
15
|
+
|
|
16
|
+
let dropDown: DropDown
|
|
17
|
+
let rangePicker: RangePicker
|
|
18
|
+
|
|
19
|
+
export let key = 'range'
|
|
20
|
+
export let range: RangeAsDate = jsonParse<RangeAsDate>($urlParam.get(key), {
|
|
21
|
+
start: null,
|
|
22
|
+
end: null
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
$: isValidPeriod = !!range.start && !!range.end
|
|
26
|
+
|
|
27
|
+
function getLabel(_range?: Partial<RangeAsDate>) {
|
|
28
|
+
if (!_range || !_range.start || !_range.end) return ''
|
|
29
|
+
return formatRangeShort(_range as RangeAsDate)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function writeURL() {
|
|
33
|
+
const url =
|
|
34
|
+
!range.start && !range.end
|
|
35
|
+
? $urlParam.without(key)
|
|
36
|
+
: $urlParam.with({
|
|
37
|
+
[key]: JSON.stringify({
|
|
38
|
+
start: range.start?.toJSON(),
|
|
39
|
+
end: range.end?.toJSON()
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
return goto(url, { replaceState: true, noScroll: true })
|
|
43
|
+
}
|
|
36
44
|
</script>
|
|
37
45
|
|
|
38
46
|
<DropDown bind:this={dropDown} tippyProps={{ onHidden: writeURL }} class="max-h-full">
|
|
@@ -1,31 +1,38 @@
|
|
|
1
|
-
<script generics="Item extends {id: string}">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let
|
|
16
|
-
export
|
|
17
|
-
export let
|
|
18
|
-
export let
|
|
19
|
-
export let
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
<script lang="ts" generics="Item extends {id: string}">
|
|
2
|
+
import { afterNavigate } from '$app/navigation'
|
|
3
|
+
import { Placeholder } from '../placeholder/index.js'
|
|
4
|
+
import type { ComponentAndProps } from '../../utils/component.js'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
type TableField,
|
|
8
|
+
TableHead,
|
|
9
|
+
TableBody,
|
|
10
|
+
context,
|
|
11
|
+
createKeys,
|
|
12
|
+
syncFieldsWithParams
|
|
13
|
+
} from './index.js'
|
|
14
|
+
|
|
15
|
+
export let key = 'table'
|
|
16
|
+
export let fields: TableField<Item>[]
|
|
17
|
+
export let items: Item[]
|
|
18
|
+
export let slotAction: ((item: Item) => ComponentAndProps) | undefined = undefined
|
|
19
|
+
export let placholder = 'Aucun élément trouvé'
|
|
20
|
+
let klass = ''
|
|
21
|
+
export {klass as class}
|
|
22
|
+
export let classRow = ''
|
|
23
|
+
export let hideBody = false
|
|
24
|
+
export let onCreateField: (() => void) | undefined = undefined
|
|
25
|
+
|
|
26
|
+
const { KEY_FIELDS_VISIBLE, KEY_FIELDS_HIDDEN, KEY_FIELDS_ORDER } = createKeys(key)
|
|
27
|
+
context.set(key, {
|
|
28
|
+
KEY_FIELDS_VISIBLE,
|
|
29
|
+
KEY_FIELDS_HIDDEN,
|
|
30
|
+
KEY_FIELDS_ORDER
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const initFields = () => (fields = syncFieldsWithParams(key, fields))
|
|
34
|
+
initFields()
|
|
35
|
+
afterNavigate(initFields)
|
|
29
36
|
</script>
|
|
30
37
|
|
|
31
38
|
<div class="{klass} overflow-x-auto rounded-lg border bg-base-100" class:min-h-[320px]={!hideBody}>
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
<script generics="Item extends {id: string}">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
1
|
+
<script lang="ts" generics="Item extends {id: string}">
|
|
2
|
+
import { createEventDispatcher } from 'svelte'
|
|
3
|
+
|
|
4
|
+
import { TableCell, type TableField } from './index.js'
|
|
5
|
+
import type { ComponentAndProps } from '../../utils/component.js'
|
|
6
|
+
|
|
7
|
+
export let items: Item[]
|
|
8
|
+
export let fields: TableField<Item>[]
|
|
9
|
+
export let action: ((item: Item) => ComponentAndProps) | undefined = undefined
|
|
10
|
+
export let classRow = ''
|
|
11
|
+
|
|
12
|
+
const dispatch = createEventDispatcher<{ click: Item }>()
|
|
13
|
+
|
|
14
|
+
$: _fields = fields.filter((f) => f.$visible)
|
|
15
|
+
|
|
16
|
+
function handleClickRow(event: MouseEvent, item: Item) {
|
|
17
|
+
dispatch('click', item)
|
|
18
|
+
}
|
|
13
19
|
</script>
|
|
14
20
|
|
|
15
21
|
<tbody>
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
<script generics="Item extends {id: string}">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<script lang="ts" generics="Item extends {id: string}">
|
|
2
|
+
import {
|
|
3
|
+
TableCellArray,
|
|
4
|
+
TableCellBoolean,
|
|
5
|
+
TableCellNumber,
|
|
6
|
+
TableCellString
|
|
7
|
+
} from './cell/index.js'
|
|
8
|
+
import type { TableField } from './index.js'
|
|
9
|
+
|
|
10
|
+
export let item: Item
|
|
11
|
+
export let field: TableField<Item>
|
|
12
|
+
|
|
13
|
+
$: value = field.getCell(item)
|
|
11
14
|
</script>
|
|
12
15
|
|
|
13
16
|
{#if Array.isArray(value)}
|