fuma 1.0.20 → 2.0.0
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/action/list/handlers.d.ts +2 -2
- package/dist/action/list/index.d.ts +2 -0
- package/dist/action/list/index.js +1 -0
- package/dist/action/list/trigger.d.ts +7 -1
- package/dist/action/list/trigger.js +2 -2
- package/dist/private/Meta.svelte +32 -27
- package/dist/private/Meta.svelte.d.ts +29 -17
- package/dist/private/api.d.ts +1 -1
- package/dist/private/store.d.ts +0 -1
- package/dist/server/parseFormData.d.ts +1 -1
- package/dist/server/parseQuery.d.ts +1 -1
- package/dist/server/sse.d.ts +0 -1
- package/dist/store/isSmallScreen.d.ts +0 -1
- package/dist/store/param.d.ts +0 -2
- package/dist/store/session.d.ts +0 -1
- package/dist/ui/badge/Badge.svelte +4 -3
- package/dist/ui/badge/Badge.svelte.d.ts +19 -15
- package/dist/ui/button/ButtonCopy.svelte +35 -32
- package/dist/ui/button/ButtonCopy.svelte.d.ts +23 -21
- package/dist/ui/button/ButtonDelete.svelte +23 -21
- package/dist/ui/button/ButtonDelete.svelte.d.ts +32 -20
- package/dist/ui/card/Card.svelte +13 -10
- package/dist/ui/card/Card.svelte.d.ts +39 -24
- package/dist/ui/card/CardBasic.svelte +5 -4
- package/dist/ui/card/CardBasic.svelte.d.ts +29 -18
- package/dist/ui/card/CardCollapse.svelte +35 -31
- package/dist/ui/card/CardCollapse.svelte.d.ts +37 -23
- package/dist/ui/card/CardFullScreen.svelte +8 -6
- package/dist/ui/card/CardFullScreen.svelte.d.ts +35 -20
- package/dist/ui/card/CardLink.svelte +5 -4
- package/dist/ui/card/CardLink.svelte.d.ts +29 -18
- package/dist/ui/dialog/Dialog.svelte +41 -34
- package/dist/ui/dialog/Dialog.svelte.d.ts +36 -23
- package/dist/ui/dialog/DialogConfirm.svelte +6 -4
- package/dist/ui/dialog/DialogConfirm.svelte.d.ts +33 -19
- package/dist/ui/drawer/Drawer.svelte +47 -38
- package/dist/ui/drawer/Drawer.svelte.d.ts +81 -46
- package/dist/ui/drawer/drawerFly.d.ts +0 -1
- package/dist/ui/drawer/layers.d.ts +0 -1
- package/dist/ui/form/Form.svelte +106 -87
- package/dist/ui/form/Form.svelte.d.ts +29 -16
- package/dist/ui/form/FormInput.svelte +12 -6
- package/dist/ui/form/FormSection.svelte +24 -17
- package/dist/ui/form/FormSection.svelte.d.ts +37 -25
- package/dist/ui/icon/Icon.svelte +35 -32
- package/dist/ui/icon/Icon.svelte.d.ts +25 -21
- 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 +32 -30
- package/dist/ui/input/InputBoolean.svelte +29 -22
- package/dist/ui/input/InputBoolean.svelte.d.ts +43 -35
- package/dist/ui/input/InputCheckboxs.svelte +37 -34
- package/dist/ui/input/InputCheckboxs.svelte.d.ts +54 -39
- package/dist/ui/input/InputCheckboxsMenu.svelte +64 -47
- package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +56 -41
- package/dist/ui/input/InputCheckboxsTree.svelte +9 -6
- package/dist/ui/input/InputCheckboxsTree.svelte.d.ts +22 -18
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte +36 -28
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte.d.ts +20 -16
- package/dist/ui/input/InputCombo.svelte +76 -65
- package/dist/ui/input/InputCombo.svelte.d.ts +55 -39
- package/dist/ui/input/InputDate.svelte +36 -29
- package/dist/ui/input/InputDate.svelte.d.ts +20 -16
- package/dist/ui/input/InputDateTime.svelte +37 -30
- package/dist/ui/input/InputDateTime.svelte.d.ts +20 -16
- package/dist/ui/input/InputImage.svelte +52 -45
- package/dist/ui/input/InputImage.svelte.d.ts +40 -27
- package/dist/ui/input/InputImagePreview.svelte +24 -20
- package/dist/ui/input/InputImagePreview.svelte.d.ts +25 -21
- package/dist/ui/input/InputNumber.svelte +28 -22
- package/dist/ui/input/InputNumber.svelte.d.ts +20 -20
- package/dist/ui/input/InputOptionInParam.svelte +12 -10
- package/dist/ui/input/InputOptionInParam.svelte.d.ts +21 -17
- package/dist/ui/input/InputOptions.svelte +40 -34
- package/dist/ui/input/InputOptions.svelte.d.ts +19 -15
- package/dist/ui/input/InputPassword.svelte +22 -18
- package/dist/ui/input/InputPassword.svelte.d.ts +43 -35
- package/dist/ui/input/InputRadio.svelte +51 -46
- package/dist/ui/input/InputRadio.svelte.d.ts +53 -38
- package/dist/ui/input/InputRelation.svelte +129 -112
- package/dist/ui/input/InputRelation.svelte.d.ts +39 -53
- package/dist/ui/input/InputRelations.svelte +96 -90
- package/dist/ui/input/InputRelations.svelte.d.ts +35 -37
- package/dist/ui/input/InputSearch.svelte +14 -11
- package/dist/ui/input/InputSearch.svelte.d.ts +25 -21
- package/dist/ui/input/InputSelect.svelte +59 -46
- package/dist/ui/input/InputSelect.svelte.d.ts +23 -19
- package/dist/ui/input/InputText.svelte +29 -28
- package/dist/ui/input/InputText.svelte.d.ts +41 -28
- package/dist/ui/input/InputTextarea.svelte +20 -19
- package/dist/ui/input/InputTextarea.svelte.d.ts +20 -20
- package/dist/ui/input/InputTime.svelte +43 -36
- package/dist/ui/input/InputTime.svelte.d.ts +21 -36
- package/dist/ui/input/RelationAfter.svelte +13 -9
- package/dist/ui/input/RelationAfter.svelte.d.ts +24 -20
- package/dist/ui/input/SelectorList.svelte +16 -12
- package/dist/ui/input/SelectorList.svelte.d.ts +29 -20
- package/dist/ui/input/textRich/InputTextRich.svelte +63 -59
- package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +36 -38
- package/dist/ui/input/textRich/SuggesionList.svelte +13 -9
- package/dist/ui/input/textRich/SuggesionList.svelte.d.ts +19 -15
- package/dist/ui/input/textRich/ToolMark.svelte +12 -9
- package/dist/ui/input/textRich/ToolMark.svelte.d.ts +22 -18
- package/dist/ui/input/textRich/ToolMarkColor.svelte +16 -12
- package/dist/ui/input/textRich/ToolMarkColor.svelte.d.ts +21 -17
- package/dist/ui/input/textRich/ToolMarkLink.svelte +46 -38
- package/dist/ui/input/textRich/ToolMarkLink.svelte.d.ts +18 -14
- package/dist/ui/input/textRich/ToolMenu.svelte +34 -19
- package/dist/ui/input/textRich/ToolMenu.svelte.d.ts +30 -26
- package/dist/ui/input/textRich/ToolMenuAlign.svelte +13 -9
- package/dist/ui/input/textRich/ToolMenuAlign.svelte.d.ts +18 -14
- package/dist/ui/input/textRich/ToolMenuInsert.svelte +12 -7
- package/dist/ui/input/textRich/ToolMenuInsert.svelte.d.ts +20 -16
- package/dist/ui/input/textRich/ToolMenuNode.svelte +14 -10
- package/dist/ui/input/textRich/ToolMenuNode.svelte.d.ts +18 -14
- package/dist/ui/input/textRich/ToolsBar.svelte +21 -14
- package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +19 -17
- package/dist/ui/input/textRich/suggestion.d.ts +0 -1
- package/dist/ui/login/Login.svelte +37 -31
- package/dist/ui/login/Login.svelte.d.ts +18 -14
- package/dist/ui/menu/ContextMenu.svelte +37 -31
- package/dist/ui/menu/ContextMenu.svelte.d.ts +38 -25
- package/dist/ui/menu/DropDown.svelte +92 -83
- package/dist/ui/menu/DropDown.svelte.d.ts +46 -33
- package/dist/ui/menu/DropDownMenu.svelte +25 -18
- package/dist/ui/menu/DropDownMenu.svelte.d.ts +30 -19
- package/dist/ui/mode/ToggleMode.svelte +28 -16
- package/dist/ui/mode/ToggleMode.svelte.d.ts +34 -17
- package/dist/ui/pagination/Pagination.svelte +9 -8
- package/dist/ui/pagination/Pagination.svelte.d.ts +18 -14
- package/dist/ui/placeholder/Placeholder.svelte +4 -3
- package/dist/ui/placeholder/Placeholder.svelte.d.ts +28 -17
- package/dist/ui/placeholder/PlaceholderImage.svelte +6 -4
- package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +28 -17
- package/dist/ui/range/RangePicker.svelte +76 -63
- package/dist/ui/range/RangePicker.svelte.d.ts +29 -24
- package/dist/ui/range/RangePickerButton.svelte +43 -35
- package/dist/ui/range/RangePickerButton.svelte.d.ts +21 -17
- package/dist/ui/table/Table.svelte +35 -28
- package/dist/ui/table/Table.svelte.d.ts +24 -19
- package/dist/ui/table/TableBody.svelte +18 -12
- package/dist/ui/table/TableBody.svelte.d.ts +20 -15
- package/dist/ui/table/TableCell.svelte +13 -10
- package/dist/ui/table/TableCell.svelte.d.ts +19 -14
- package/dist/ui/table/TableFieldsEdition.svelte +58 -52
- package/dist/ui/table/TableFieldsEdition.svelte.d.ts +20 -15
- package/dist/ui/table/TableHead.svelte +20 -21
- package/dist/ui/table/TableHead.svelte.d.ts +19 -14
- package/dist/ui/table/TableViewSelect.svelte +50 -37
- package/dist/ui/table/TableViewSelect.svelte.d.ts +27 -23
- package/dist/ui/table/cell/TableCellArray.svelte +5 -3
- package/dist/ui/table/cell/TableCellArray.svelte.d.ts +18 -14
- package/dist/ui/table/cell/TableCellBoolean.svelte +4 -3
- package/dist/ui/table/cell/TableCellBoolean.svelte.d.ts +18 -14
- package/dist/ui/table/cell/TableCellNumber.svelte +2 -1
- package/dist/ui/table/cell/TableCellNumber.svelte.d.ts +18 -14
- package/dist/ui/table/cell/TableCellString.svelte +5 -2
- package/dist/ui/table/cell/TableCellString.svelte.d.ts +19 -25
- package/dist/ui/table/field.d.ts +32 -40
- package/dist/ui/table/field.js +1 -1
- package/dist/ui/table/head/TableHeadBoolean.svelte +6 -3
- package/dist/ui/table/head/TableHeadBoolean.svelte.d.ts +18 -24
- package/dist/ui/table/head/TableHeadDate.svelte +61 -113
- package/dist/ui/table/head/TableHeadDate.svelte.d.ts +18 -24
- package/dist/ui/table/head/TableHeadDefault.svelte +5 -2
- package/dist/ui/table/head/TableHeadDefault.svelte.d.ts +18 -24
- package/dist/ui/table/head/TableHeadNumber.svelte +67 -76
- package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +18 -24
- package/dist/ui/table/head/TableHeadSelect.svelte +47 -41
- package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +21 -27
- package/dist/ui/table/head/TableHeadString.svelte +14 -8
- package/dist/ui/table/head/TableHeadString.svelte.d.ts +18 -24
- package/dist/ui/tabs/Tabs.svelte +8 -5
- package/dist/ui/tabs/Tabs.svelte.d.ts +19 -15
- package/dist/ui/tabs/TabsIcon.svelte +31 -28
- package/dist/ui/tabs/TabsIcon.svelte.d.ts +21 -17
- package/dist/utils/eventEmitter.d.ts +4 -4
- package/dist/utils/tippy.d.ts +1 -1
- package/dist/validation/form.d.ts +0 -1
- package/dist/validation/zod.d.ts +96 -162
- package/dist/validation/zod.js +2 -4
- package/package.json +134 -138
- package/dist/ui/form/FormInput.svelte.d.ts +0 -152
- package/dist/ui/form/formInput.d.ts +0 -90
- 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
- package/dist/ui/table/head/OrderButtons.svelte +0 -37
- package/dist/ui/table/head/OrderButtons.svelte.d.ts +0 -20
- package/dist/ui/table/head/index.d.ts +0 -19
|
@@ -1,77 +1,64 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let dropDown
|
|
18
|
-
let rangePicker
|
|
19
|
-
const initialValue = jsonParse(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
let range = {
|
|
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
|
-
function handleReset() {
|
|
57
|
-
isValidPeriod = false;
|
|
58
|
-
range.start = null;
|
|
59
|
-
range = { start: null, end: null };
|
|
60
|
-
dropDown.hide();
|
|
61
|
-
rangePicker.clear();
|
|
62
|
-
goto($urlParam.without(field.key, "skip", "take"), {
|
|
63
|
-
replaceState: true,
|
|
64
|
-
noScroll: true,
|
|
65
|
-
keepFocus: true
|
|
66
|
-
});
|
|
67
|
-
}
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { goto } from '$app/navigation'
|
|
3
|
+
import { page } from '$app/stores'
|
|
4
|
+
import { mdiCalendarFilterOutline } from '@mdi/js'
|
|
5
|
+
|
|
6
|
+
import { DropDown } from '../../menu/index.js'
|
|
7
|
+
import { InputTime } from '../../input/index.js'
|
|
8
|
+
import type { TableField } from '../index.js'
|
|
9
|
+
import { formatRange } from '../../range/format.js'
|
|
10
|
+
import { RangePicker } from '../../range/index.js'
|
|
11
|
+
import { urlParam } from '../../../store/param.js'
|
|
12
|
+
import { jsonParse } from '../../../utils/jsonParse.js'
|
|
13
|
+
import { Icon } from '../../icon/index.js'
|
|
14
|
+
|
|
15
|
+
export let field: Omit<TableField, 'getCell' | 'type'>
|
|
16
|
+
|
|
17
|
+
let dropDown: DropDown
|
|
18
|
+
let rangePicker: RangePicker
|
|
19
|
+
const initialValue = jsonParse<{ start?: string; end?: string }>(
|
|
20
|
+
$page.url.searchParams.get(field.key),
|
|
21
|
+
{}
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
let range = {
|
|
25
|
+
start: initialValue.start ? new Date(initialValue.start) : null,
|
|
26
|
+
end: initialValue.end ? new Date(initialValue.end) : null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
$: isValidPeriod = !!range.start && !!range.end
|
|
30
|
+
|
|
31
|
+
function handleSubmit() {
|
|
32
|
+
dropDown.hide()
|
|
33
|
+
if (!isValidPeriod) return
|
|
34
|
+
goto(
|
|
35
|
+
$urlParam.with(
|
|
36
|
+
{
|
|
37
|
+
[field.key]: JSON.stringify({
|
|
38
|
+
start: range.start?.toJSON(),
|
|
39
|
+
end: range.end?.toJSON()
|
|
40
|
+
})
|
|
41
|
+
},
|
|
42
|
+
'skip',
|
|
43
|
+
'take'
|
|
44
|
+
),
|
|
45
|
+
{ replaceState: true, noScroll: true }
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function handleReset() {
|
|
50
|
+
dropDown.hide()
|
|
51
|
+
range = { start: null, end: null }
|
|
52
|
+
rangePicker.clear()
|
|
53
|
+
goto($urlParam.without(field.key, 'skip', 'take'), { replaceState: true, noScroll: true })
|
|
54
|
+
}
|
|
68
55
|
</script>
|
|
69
56
|
|
|
70
57
|
<th class="p-1">
|
|
71
58
|
<DropDown
|
|
72
59
|
bind:this={dropDown}
|
|
60
|
+
on:mouseLeave={handleSubmit}
|
|
73
61
|
tippyProps={{ appendTo: () => document.body }}
|
|
74
|
-
hideOnNav={false}
|
|
75
62
|
class="max-h-none"
|
|
76
63
|
>
|
|
77
64
|
<button slot="activator" class="menu-item min-h-8 w-full flex-wrap gap-y-1">
|
|
@@ -87,64 +74,25 @@ function handleReset() {
|
|
|
87
74
|
{formatRange(range)}
|
|
88
75
|
</span>
|
|
89
76
|
{/if}
|
|
90
|
-
{#if order}
|
|
91
|
-
<Icon
|
|
92
|
-
path={order === 'asc' ? mdiSortClockAscendingOutline : mdiSortClockDescendingOutline}
|
|
93
|
-
size={18}
|
|
94
|
-
class="fill-primary"
|
|
95
|
-
/>
|
|
96
|
-
{/if}
|
|
97
77
|
</button>
|
|
98
78
|
|
|
99
|
-
{#if field.sortable !== false}
|
|
100
|
-
<OrderButtons
|
|
101
|
-
bind:order
|
|
102
|
-
on:change={() => {
|
|
103
|
-
updateUrl()
|
|
104
|
-
dropDown.hide()
|
|
105
|
-
}}
|
|
106
|
-
iconAsc={mdiSortClockAscendingOutline}
|
|
107
|
-
iconDesc={mdiSortClockDescendingOutline}
|
|
108
|
-
/>
|
|
109
|
-
{/if}
|
|
110
|
-
|
|
111
79
|
<form
|
|
112
|
-
on:submit|preventDefault={() => dropDown.hide()}
|
|
113
|
-
data-sveltekit-replacestate
|
|
114
80
|
class="flex flex-col font-normal"
|
|
115
|
-
|
|
81
|
+
on:submit|preventDefault={handleSubmit}
|
|
82
|
+
data-sveltekit-replacestate
|
|
116
83
|
>
|
|
117
|
-
<RangePicker
|
|
118
|
-
bind:this={rangePicker}
|
|
119
|
-
numberOfMonths={1}
|
|
120
|
-
on:change={({ detail: newRange }) => {
|
|
121
|
-
range = newRange
|
|
122
|
-
updateUrl()
|
|
123
|
-
}}
|
|
124
|
-
/>
|
|
84
|
+
<RangePicker bind:this={rangePicker} numberOfMonths={1} bind:range />
|
|
125
85
|
|
|
126
86
|
<input class="hidden" type="text" name="start" value={range.start?.toJSON()} />
|
|
127
87
|
<input class="hidden" type="text" name="end" value={range.end?.toJSON()} />
|
|
128
88
|
|
|
129
89
|
<div class="m-2 flex gap-2">
|
|
130
|
-
<InputTime
|
|
131
|
-
|
|
132
|
-
bind:value={range.start}
|
|
133
|
-
enhanceDisabled
|
|
134
|
-
class="grow"
|
|
135
|
-
on:input={updateUrl}
|
|
136
|
-
/>
|
|
137
|
-
<InputTime
|
|
138
|
-
label="Jusqu'à"
|
|
139
|
-
bind:value={range.end}
|
|
140
|
-
enhanceDisabled
|
|
141
|
-
class="grow"
|
|
142
|
-
on:input={updateUrl}
|
|
143
|
-
/>
|
|
90
|
+
<InputTime label="A partir de" bind:value={range.start} enhanceDisabled class="grow" />
|
|
91
|
+
<InputTime label="Jusqu'à" bind:value={range.end} enhanceDisabled class="grow" />
|
|
144
92
|
</div>
|
|
145
93
|
|
|
146
94
|
<div class="m-2 flex flex-row-reverse gap-2">
|
|
147
|
-
<button class="btn">
|
|
95
|
+
<button class="btn"> Valider </button>
|
|
148
96
|
<button class="btn btn-ghost" type="button" on:click={handleReset}>Effacer</button>
|
|
149
97
|
</div>
|
|
150
98
|
</form>
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { TableField } from '../index.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
8
12
|
};
|
|
9
|
-
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots(): {};
|
|
13
|
-
}
|
|
14
|
-
export type TableHeadDateProps<Item extends {
|
|
15
|
-
id: string;
|
|
16
|
-
}> = ReturnType<__sveltets_Render<Item>['props']>;
|
|
17
|
-
export type TableHeadDateEvents<Item extends {
|
|
18
|
-
id: string;
|
|
19
|
-
}> = ReturnType<__sveltets_Render<Item>['events']>;
|
|
20
|
-
export type TableHeadDateSlots<Item extends {
|
|
21
|
-
id: string;
|
|
22
|
-
}> = ReturnType<__sveltets_Render<Item>['slots']>;
|
|
23
|
-
export default class TableHeadDate<Item extends {
|
|
24
|
-
id: string;
|
|
25
|
-
}> extends SvelteComponent<TableHeadDateProps<Item>, TableHeadDateEvents<Item>, TableHeadDateSlots<Item>> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
26
14
|
}
|
|
27
|
-
|
|
15
|
+
declare const TableHeadDate: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
field: Omit<TableField, "getCell" | "type">;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type TableHeadDate = InstanceType<typeof TableHeadDate>;
|
|
21
|
+
export default TableHeadDate;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { TableField } from '../index.js'
|
|
3
|
+
import { tip } from '../../../action/tip.js'
|
|
4
|
+
|
|
5
|
+
export let field: TableField
|
|
3
6
|
</script>
|
|
4
7
|
|
|
5
8
|
<th use:tip={{ disable: !field.hint, content: field.hint }}>
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { TableField } from '../index.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
8
12
|
};
|
|
9
|
-
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots(): {};
|
|
13
|
-
}
|
|
14
|
-
export type TableHeadDefaultProps<Item extends {
|
|
15
|
-
id: string;
|
|
16
|
-
}> = ReturnType<__sveltets_Render<Item>['props']>;
|
|
17
|
-
export type TableHeadDefaultEvents<Item extends {
|
|
18
|
-
id: string;
|
|
19
|
-
}> = ReturnType<__sveltets_Render<Item>['events']>;
|
|
20
|
-
export type TableHeadDefaultSlots<Item extends {
|
|
21
|
-
id: string;
|
|
22
|
-
}> = ReturnType<__sveltets_Render<Item>['slots']>;
|
|
23
|
-
export default class TableHeadDefault<Item extends {
|
|
24
|
-
id: string;
|
|
25
|
-
}> extends SvelteComponent<TableHeadDefaultProps<Item>, TableHeadDefaultEvents<Item>, TableHeadDefaultSlots<Item>> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
26
14
|
}
|
|
27
|
-
|
|
15
|
+
declare const TableHeadDefault: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
field: TableField;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type TableHeadDefault = InstanceType<typeof TableHeadDefault>;
|
|
21
|
+
export default TableHeadDefault;
|
|
@@ -1,59 +1,68 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
|
|
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
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte'
|
|
3
|
+
import type { TippyInstance } from '../../../utils/tippy.js'
|
|
4
|
+
import debounce from 'debounce'
|
|
5
|
+
import { goto } from '$app/navigation'
|
|
6
|
+
import { page } from '$app/stores'
|
|
7
|
+
|
|
8
|
+
import { DropDown } from '../../menu/index.js'
|
|
9
|
+
import { InputNumber } from '../../input/index.js'
|
|
10
|
+
import { urlParam } from '../../../store/param.js'
|
|
11
|
+
import { jsonParse } from '../../../utils/jsonParse.js'
|
|
12
|
+
import type { TableField } from '../field.js'
|
|
13
|
+
import { mdiFilterMultipleOutline } from '@mdi/js'
|
|
14
|
+
import { Icon } from '../../icon/index.js'
|
|
15
|
+
|
|
16
|
+
export let field: TableField
|
|
17
|
+
|
|
18
|
+
let tip: TippyInstance
|
|
19
|
+
type Range = { min: number | undefined; max: number | undefined }
|
|
20
|
+
|
|
21
|
+
let { min, max } = initRange($page.url)
|
|
22
|
+
onMount(() => page.subscribe(({ url }) => ({ min, max } = initRange(url))))
|
|
23
|
+
|
|
24
|
+
function initRange({ searchParams }: URL) {
|
|
25
|
+
return jsonParse<Range>(searchParams.get(field.key), {
|
|
26
|
+
min: undefined,
|
|
27
|
+
max: undefined
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const udpateUrl = debounce(() => {
|
|
32
|
+
if (isDefined(min) || isDefined(max)) {
|
|
33
|
+
goto(
|
|
34
|
+
$urlParam.with(
|
|
35
|
+
{
|
|
36
|
+
[field.key]: JSON.stringify({
|
|
37
|
+
...(isDefined(min) ? { min } : {}),
|
|
38
|
+
...(isDefined(max) ? { max } : {})
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
'skip',
|
|
42
|
+
'take'
|
|
43
|
+
),
|
|
44
|
+
{
|
|
45
|
+
noScroll: true,
|
|
46
|
+
keepFocus: true
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
goto($urlParam.without(field.key, 'skip', 'take'), { noScroll: true, keepFocus: true })
|
|
52
|
+
}, 250)
|
|
53
|
+
|
|
54
|
+
function handleReset() {
|
|
55
|
+
min = undefined
|
|
56
|
+
max = undefined
|
|
57
|
+
tip.hide()
|
|
58
|
+
goto($urlParam.without(field.key, 'skip', 'take'), { noScroll: true, keepFocus: true })
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function isDefined(v: number | undefined | null): v is number {
|
|
62
|
+
return typeof v === 'number'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
$: isNegatifRange = isDefined(min) && isDefined(max) && max < min
|
|
57
66
|
</script>
|
|
58
67
|
|
|
59
68
|
<th class="p-1">
|
|
@@ -83,31 +92,13 @@ $:
|
|
|
83
92
|
{/if}
|
|
84
93
|
</span>
|
|
85
94
|
{/if}
|
|
86
|
-
{#if order}
|
|
87
|
-
<Icon
|
|
88
|
-
path={order === 'asc' ? mdiSortAscending : mdiSortDescending}
|
|
89
|
-
size={18}
|
|
90
|
-
class="fill-primary"
|
|
91
|
-
/>
|
|
92
|
-
{/if}
|
|
93
95
|
</button>
|
|
94
96
|
|
|
95
|
-
{#if field.sortable !== false}
|
|
96
|
-
<OrderButtons
|
|
97
|
-
bind:order
|
|
98
|
-
on:change={() => {
|
|
99
|
-
updateUrl()
|
|
100
|
-
tip.hide()
|
|
101
|
-
}}
|
|
102
|
-
/>
|
|
103
|
-
<div class="divider"></div>
|
|
104
|
-
<span class="p-1 py-1 text-sm font-semibold opacity-70">Filtre:</span>
|
|
105
|
-
{/if}
|
|
106
97
|
<form class="grid grid-cols-2 gap-2 p-1" on:submit|preventDefault={() => tip.hide()}>
|
|
107
|
-
<InputNumber bind:value={min} on:input={
|
|
98
|
+
<InputNumber bind:value={min} on:input={udpateUrl} input={{ placeholder: 'Min' }} />
|
|
108
99
|
<InputNumber
|
|
109
100
|
bind:value={max}
|
|
110
|
-
on:input={
|
|
101
|
+
on:input={udpateUrl}
|
|
111
102
|
hint={isNegatifRange ? 'Doit être plus grand' : ''}
|
|
112
103
|
input={{ placeholder: 'Max' }}
|
|
113
104
|
/>
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { TableField } from '../field.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
8
12
|
};
|
|
9
|
-
|
|
10
|
-
[evt: string]: CustomEvent<any>;
|
|
11
|
-
};
|
|
12
|
-
slots(): {};
|
|
13
|
-
}
|
|
14
|
-
export type TableHeadNumberProps<Item extends {
|
|
15
|
-
id: string;
|
|
16
|
-
}> = ReturnType<__sveltets_Render<Item>['props']>;
|
|
17
|
-
export type TableHeadNumberEvents<Item extends {
|
|
18
|
-
id: string;
|
|
19
|
-
}> = ReturnType<__sveltets_Render<Item>['events']>;
|
|
20
|
-
export type TableHeadNumberSlots<Item extends {
|
|
21
|
-
id: string;
|
|
22
|
-
}> = ReturnType<__sveltets_Render<Item>['slots']>;
|
|
23
|
-
export default class TableHeadNumber<Item extends {
|
|
24
|
-
id: string;
|
|
25
|
-
}> extends SvelteComponent<TableHeadNumberProps<Item>, TableHeadNumberEvents<Item>, TableHeadNumberSlots<Item>> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
26
14
|
}
|
|
27
|
-
|
|
15
|
+
declare const TableHeadNumber: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
field: TableField;
|
|
17
|
+
}, {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
}, {}, {}, string>;
|
|
20
|
+
type TableHeadNumber = InstanceType<typeof TableHeadNumber>;
|
|
21
|
+
export default TableHeadNumber;
|
|
@@ -1,44 +1,50 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
let
|
|
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
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { derived } from 'svelte/store'
|
|
3
|
+
import { page } from '$app/stores'
|
|
4
|
+
|
|
5
|
+
import { jsonParse } from '../../../utils/jsonParse.js'
|
|
6
|
+
import type { TableField } from '../index.js'
|
|
7
|
+
import { DropDown } from '../../menu/index.js'
|
|
8
|
+
import { Icon } from '../../icon/index.js'
|
|
9
|
+
import { type Options, parseOptions } from '../../../utils/options.js'
|
|
10
|
+
import { urlParam } from '../../../store/param.js'
|
|
11
|
+
import { mdiOrderBoolAscendingVariant } from '@mdi/js'
|
|
12
|
+
|
|
13
|
+
export let field: TableField
|
|
14
|
+
export let options: Options
|
|
15
|
+
export let multiSelect = false
|
|
16
|
+
export let placeholder = 'No option'
|
|
17
|
+
|
|
18
|
+
let _options = initOptions($page.url)
|
|
19
|
+
page.subscribe(({ url }) => (_options = initOptions(url)))
|
|
20
|
+
|
|
21
|
+
$: optionsActive = _options.filter((option) => option.isActive)
|
|
22
|
+
|
|
23
|
+
function initOptions({ searchParams }: URL) {
|
|
24
|
+
const selection = searchParams.get(field.key)
|
|
25
|
+
const selections = jsonParse<string[]>(searchParams.get(field.key), [])
|
|
26
|
+
|
|
27
|
+
function getActive(value: string) {
|
|
28
|
+
if (!multiSelect) return selection === value
|
|
29
|
+
return selections.includes(value)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return parseOptions(options).map((option) => ({
|
|
33
|
+
...option,
|
|
34
|
+
isActive: getActive(option.value)
|
|
35
|
+
}))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const getHref = derived(urlParam, (params) => (value: string) => {
|
|
39
|
+
const selections = jsonParse<string[]>(params.get(field.key), [])
|
|
40
|
+
if (!multiSelect) return params.toggle({ [field.key]: value }, 'skip', 'take')
|
|
41
|
+
if (selections.includes(value)) {
|
|
42
|
+
const newSelections = selections.filter((v) => v !== value)
|
|
43
|
+
if (!newSelections.length) return params.without(field.key)
|
|
44
|
+
return params.with({ [field.key]: JSON.stringify(newSelections) }, 'skip', 'take')
|
|
45
|
+
}
|
|
46
|
+
return params.with({ [field.key]: JSON.stringify([...selections, value]) }, 'skip', 'take')
|
|
47
|
+
})
|
|
42
48
|
</script>
|
|
43
49
|
|
|
44
50
|
<th class="p-1">
|