firstly 0.0.14 → 0.0.16-next.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/CHANGELOG.md +16 -0
- package/esm/ROUTES.d.ts +10 -2
- package/esm/ROUTES.js +5 -1
- package/esm/auth/Entities.js +1 -0
- package/esm/auth/server/AuthController.server.js +2 -1
- package/esm/auth/server/handleAuth.js +2 -1
- package/esm/auth/server/handleGuard.d.ts +10 -4
- package/esm/auth/server/handleGuard.js +8 -41
- package/esm/auth/server/module.d.ts +29 -1
- package/esm/auth/server/module.js +4 -1
- package/esm/auth/static/assets/{Page-UV_hqY7I.d.ts → Page-BgIgl-Te.d.ts} +2 -2
- package/esm/auth/static/assets/{Page-UV_hqY7I.js → Page-BgIgl-Te.js} +1 -1
- package/esm/auth/static/assets/{Page-DdKMiUZn.d.ts → Page-HDnoBhpE.d.ts} +2 -2
- package/esm/auth/static/assets/{Page-DdKMiUZn.js → Page-HDnoBhpE.js} +5 -5
- package/esm/auth/static/assets/{Page-B0XXxe0N.d.ts → Page-f5pC21Yg.d.ts} +2 -2
- package/esm/auth/static/assets/{Page-B0XXxe0N.js → Page-f5pC21Yg.js} +1 -1
- package/esm/auth/static/assets/{index-C9jzxOBu.js → index-DAjei0Ie.js} +2 -2
- package/esm/auth/static/index.html +4 -4
- package/esm/auth/types.d.ts +1 -0
- package/esm/bin/cmd.js +16 -16
- package/esm/changeLog/server/index.d.ts +1 -1
- package/esm/changeLog/server/index.js +1 -1
- package/esm/cron/server/index.d.ts +1 -1
- package/esm/cron/server/index.js +1 -1
- package/esm/feedback/server/index.d.ts +1 -1
- package/esm/feedback/server/index.js +1 -1
- package/esm/helper.d.ts +1 -1
- package/esm/helper.js +4 -3
- package/esm/index.d.ts +5 -3
- package/esm/index.js +5 -3
- package/esm/mail/server/index.d.ts +2 -2
- package/esm/mail/server/index.js +7 -4
- package/esm/server/index.d.ts +49 -0
- package/esm/server/index.js +109 -1
- package/esm/svelte/FF_Cell.svelte +104 -0
- package/esm/svelte/FF_Cell.svelte.d.ts +24 -0
- package/esm/svelte/FF_Cell_Caption.svelte +20 -0
- package/esm/svelte/FF_Cell_Caption.svelte.d.ts +24 -0
- package/esm/svelte/FF_Cell_Display.svelte +61 -0
- package/esm/svelte/FF_Cell_Display.svelte.d.ts +22 -0
- package/esm/svelte/FF_Cell_Edit.svelte +104 -0
- package/esm/svelte/FF_Cell_Edit.svelte.d.ts +25 -0
- package/esm/svelte/FF_Cell_Error.svelte +20 -0
- package/esm/svelte/FF_Cell_Error.svelte.d.ts +24 -0
- package/esm/svelte/FF_Cell_Hint.svelte +20 -0
- package/esm/svelte/FF_Cell_Hint.svelte.d.ts +24 -0
- package/esm/svelte/FF_Config.svelte +29 -0
- package/esm/svelte/FF_Config.svelte.d.ts +9 -0
- package/esm/svelte/FF_Display.svelte +51 -0
- package/esm/svelte/FF_Display.svelte.d.ts +22 -0
- package/esm/svelte/FF_Edit.svelte +104 -0
- package/esm/svelte/FF_Edit.svelte.d.ts +25 -0
- package/esm/svelte/FF_Error.svelte +23 -0
- package/esm/svelte/FF_Error.svelte.d.ts +22 -0
- package/esm/svelte/FF_Field.svelte +62 -0
- package/esm/svelte/FF_Field.svelte.d.ts +22 -0
- package/esm/svelte/FF_Form.svelte +156 -0
- package/esm/svelte/FF_Form.svelte.d.ts +30 -0
- package/esm/svelte/FF_Grid.svelte +257 -0
- package/esm/svelte/FF_Grid.svelte.d.ts +31 -0
- package/esm/svelte/FF_Hint.svelte +21 -0
- package/esm/svelte/FF_Hint.svelte.d.ts +22 -0
- package/esm/svelte/FF_Label.svelte +23 -0
- package/esm/svelte/FF_Label.svelte.d.ts +22 -0
- package/esm/svelte/FF_Layout.svelte +62 -0
- package/esm/svelte/FF_Layout.svelte.d.ts +24 -0
- package/esm/svelte/FF_Repo.svelte.d.ts +69 -0
- package/esm/svelte/FF_Repo.svelte.js +170 -0
- package/esm/svelte/actions/intersection.d.ts +6 -0
- package/esm/svelte/actions/intersection.js +17 -0
- package/esm/svelte/class/SP.svelte.d.ts +61 -0
- package/esm/svelte/class/SP.svelte.js +412 -0
- package/esm/svelte/customField.d.ts +69 -0
- package/esm/svelte/customField.js +4 -0
- package/esm/svelte/dialog/DialogManagement.svelte +101 -0
- package/esm/svelte/dialog/DialogManagement.svelte.d.ts +18 -0
- package/esm/svelte/dialog/DialogPrimitive.svelte +157 -0
- package/esm/svelte/dialog/DialogPrimitive.svelte.d.ts +38 -0
- package/esm/svelte/dialog/dialog.d.ts +58 -0
- package/esm/svelte/dialog/dialog.js +130 -0
- package/esm/svelte/ff_Config.svelte.d.ts +91 -0
- package/esm/svelte/ff_Config.svelte.js +111 -0
- package/esm/svelte/firstly.css +14 -0
- package/esm/svelte/helpers/debounce.d.ts +1 -0
- package/esm/svelte/helpers/debounce.js +7 -0
- package/esm/svelte/helpers.d.ts +29 -0
- package/esm/svelte/helpers.js +38 -0
- package/esm/svelte/index.d.ts +32 -0
- package/esm/svelte/index.js +29 -0
- package/esm/svelte/tryCatch.d.ts +12 -0
- package/esm/svelte/tryCatch.js +18 -0
- package/esm/sveltekit/server/index.d.ts +1 -1
- package/esm/sveltekit/server/index.js +1 -1
- package/esm/ui/Field.svelte +1 -1
- package/esm/ui/Grid.svelte +8 -2
- package/esm/ui/Grid2.svelte +354 -0
- package/esm/ui/Grid2.svelte.d.ts +58 -0
- package/esm/ui/GridLoading.svelte +33 -8
- package/esm/ui/GridLoading.svelte.d.ts +1 -0
- package/esm/ui/GridPaginate.svelte +0 -3
- package/esm/ui/GridPaginate.svelte.d.ts +0 -1
- package/esm/ui/GridPaginate2.svelte +25 -0
- package/esm/ui/GridPaginate2.svelte.d.ts +7 -0
- package/esm/ui/dialog/dialog.d.ts +3 -1
- package/esm/ui/dialog/dialog.js +2 -0
- package/esm/ui/link/LinkPlus.svelte +8 -6
- package/package.json +28 -13
- package/esm/api/index.d.ts +0 -49
- package/esm/api/index.js +0 -109
- /package/esm/auth/static/assets/{index-C9jzxOBu.d.ts → index-DAjei0Ie.d.ts} +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
import type { FieldMetadata } from 'remult';
|
|
3
|
+
export type FieldMode = 'edit' | 'display';
|
|
4
|
+
export type CustomFieldDefaultProps<valueType = unknown, entityType = unknown> = {
|
|
5
|
+
uid?: string;
|
|
6
|
+
field: FieldMetadata<valueType, entityType>;
|
|
7
|
+
value: valueType;
|
|
8
|
+
error?: string;
|
|
9
|
+
};
|
|
10
|
+
type ComponentObject<valueType = unknown, entityType = unknown> = {
|
|
11
|
+
component: Component<CustomFieldDefaultProps<valueType, entityType>>;
|
|
12
|
+
props?: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
export type CustomFieldComponent<valueType = unknown, entityType = unknown> = ComponentObject<valueType, entityType>['component'] | ComponentObject<valueType, entityType>;
|
|
15
|
+
export declare function isComponentObject<valueType = unknown, entityType = unknown>(value: CustomFieldComponent<valueType, entityType>): value is ComponentObject<valueType, entityType>;
|
|
16
|
+
type DynamicFieldDefaultProps<valueType = unknown, entityType = unknown> = CustomFieldDefaultProps<valueType, entityType> & {
|
|
17
|
+
mode: FieldMode;
|
|
18
|
+
};
|
|
19
|
+
export type DynamicCustomField = <valueType = unknown, entityType = unknown>(infos: DynamicFieldDefaultProps<valueType, entityType>) => CustomFieldComponent<valueType, entityType> | undefined;
|
|
20
|
+
export type getLayout<entityType = unknown> = (o?: {
|
|
21
|
+
key?: string;
|
|
22
|
+
type?: Layout['type'];
|
|
23
|
+
}) => Layout<entityType> | undefined;
|
|
24
|
+
export type getLayoutStrict<entityType = unknown> = (o?: {
|
|
25
|
+
key?: string;
|
|
26
|
+
type?: Layout['type'];
|
|
27
|
+
}) => Layout<entityType>;
|
|
28
|
+
export type Layout<entityType = unknown> = {
|
|
29
|
+
key: string;
|
|
30
|
+
type: 'grid' | 'detail' | 'tab' | 'accordion';
|
|
31
|
+
groups: FieldGroup<entityType>[];
|
|
32
|
+
};
|
|
33
|
+
export type FieldGroup<entityType = unknown> = {
|
|
34
|
+
key: string;
|
|
35
|
+
fields: FieldMetadata<unknown, entityType>[];
|
|
36
|
+
caption?: string;
|
|
37
|
+
hint?: string;
|
|
38
|
+
class?: string;
|
|
39
|
+
};
|
|
40
|
+
export type CellMetadata<valueType = unknown, entityType = unknown> = {
|
|
41
|
+
key?: string;
|
|
42
|
+
caption?: string;
|
|
43
|
+
/** if nothing, it's just a "group" */
|
|
44
|
+
type?: 'form';
|
|
45
|
+
mode?: 'display' | 'edit';
|
|
46
|
+
field?: FieldMetadata<valueType, entityType>;
|
|
47
|
+
value?: valueType;
|
|
48
|
+
ui?: {
|
|
49
|
+
component?: {
|
|
50
|
+
caption?: 'show' | 'hide' | 'remove';
|
|
51
|
+
label?: 'show' | 'hide' | 'remove';
|
|
52
|
+
error?: 'show' | 'hide' | 'remove';
|
|
53
|
+
edit?: CustomFieldComponent<valueType, entityType>;
|
|
54
|
+
hint?: 'show' | 'hide' | 'remove';
|
|
55
|
+
display?: CustomFieldComponent<valueType, entityType>;
|
|
56
|
+
};
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
step?: string | number | undefined;
|
|
59
|
+
hint?: string;
|
|
60
|
+
mobile?: Style;
|
|
61
|
+
} & Style;
|
|
62
|
+
cells?: CellMetadata<valueType, entityType>[];
|
|
63
|
+
};
|
|
64
|
+
type Style = {
|
|
65
|
+
width?: number;
|
|
66
|
+
marginLeft?: number;
|
|
67
|
+
marginRight?: number;
|
|
68
|
+
};
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { FF_Form } from '../'
|
|
3
|
+
import Button from '../../ui/Button.svelte'
|
|
4
|
+
import { dialog } from './dialog'
|
|
5
|
+
import DialogPrimitive from './DialogPrimitive.svelte'
|
|
6
|
+
|
|
7
|
+
$: dialogSorted = $dialog.sort((a, b) => a.id - b.id)
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
{#each dialogSorted as toShow}
|
|
11
|
+
{#if toShow.type === 'confirm'}
|
|
12
|
+
<DialogPrimitive
|
|
13
|
+
detail={toShow.detail}
|
|
14
|
+
open
|
|
15
|
+
on:change={() => dialog.close(toShow.id, { success: false })}
|
|
16
|
+
>
|
|
17
|
+
{@html toShow.children}
|
|
18
|
+
<svelte:fragment slot="actions">
|
|
19
|
+
<Button class="text-white" on:click={() => dialog.close(toShow.id, { success: true })}
|
|
20
|
+
>Confirmer</Button
|
|
21
|
+
>
|
|
22
|
+
</svelte:fragment>
|
|
23
|
+
</DialogPrimitive>
|
|
24
|
+
{:else if toShow.type === 'confirmDelete'}
|
|
25
|
+
<DialogPrimitive
|
|
26
|
+
detail={toShow.detail}
|
|
27
|
+
open
|
|
28
|
+
on:change={() => dialog.close(toShow.id, { success: false })}
|
|
29
|
+
>
|
|
30
|
+
{@html toShow.children}
|
|
31
|
+
<svelte:fragment slot="actions">
|
|
32
|
+
<Button
|
|
33
|
+
class="btn-outline btn-error"
|
|
34
|
+
on:click={() => dialog.close(toShow.id, { success: true })}
|
|
35
|
+
>
|
|
36
|
+
Confirmer
|
|
37
|
+
</Button>
|
|
38
|
+
</svelte:fragment>
|
|
39
|
+
</DialogPrimitive>
|
|
40
|
+
<!-- {:else if toShow.type === 'insert' || toShow.type === 'update' || toShow.type === 'view'}
|
|
41
|
+
<DialogForm {toShow}></DialogForm> -->
|
|
42
|
+
{:else if toShow.type === 'fform'}
|
|
43
|
+
<DialogPrimitive
|
|
44
|
+
detail={toShow.detail}
|
|
45
|
+
open
|
|
46
|
+
classes={{ root: toShow.classes?.root }}
|
|
47
|
+
on:change={() => dialog.close(toShow.id, { success: false })}
|
|
48
|
+
>
|
|
49
|
+
<FF_Form
|
|
50
|
+
r={toShow.r!}
|
|
51
|
+
show={{ title: false }}
|
|
52
|
+
defaults={toShow.defaults}
|
|
53
|
+
onSaved={(item) => dialog.close(toShow.id, { success: true, item })}
|
|
54
|
+
></FF_Form>
|
|
55
|
+
</DialogPrimitive>
|
|
56
|
+
{:else if toShow.component && toShow.children}
|
|
57
|
+
<DialogPrimitive
|
|
58
|
+
detail={toShow.detail}
|
|
59
|
+
open
|
|
60
|
+
on:change={() => dialog.close(toShow.id, { success: false })}
|
|
61
|
+
>
|
|
62
|
+
<svelte:component this={toShow.component} {...toShow.props} dialogId={toShow.id}>
|
|
63
|
+
{#if toShow.children}
|
|
64
|
+
{@html toShow.children}
|
|
65
|
+
{/if}
|
|
66
|
+
</svelte:component>
|
|
67
|
+
</DialogPrimitive>
|
|
68
|
+
{:else if toShow.component}
|
|
69
|
+
<DialogPrimitive
|
|
70
|
+
detail={toShow.detail}
|
|
71
|
+
open
|
|
72
|
+
classes={{ root: toShow.classes?.root }}
|
|
73
|
+
on:change={() => dialog.close(toShow.id, { success: false })}
|
|
74
|
+
>
|
|
75
|
+
<svelte:component this={toShow.component} {...toShow.props} dialogId={toShow.id}
|
|
76
|
+
></svelte:component>
|
|
77
|
+
</DialogPrimitive>
|
|
78
|
+
{:else}
|
|
79
|
+
<DialogPrimitive
|
|
80
|
+
detail={toShow.detail}
|
|
81
|
+
open
|
|
82
|
+
on:change={() => dialog.close(toShow.id, { success: false })}
|
|
83
|
+
>
|
|
84
|
+
<div class="grid gap-2">
|
|
85
|
+
<p>Hey 🫵 developer, you are missing a few things 🤡!</p>
|
|
86
|
+
<p>Or use use one of the custom built in dialog like</p>
|
|
87
|
+
|
|
88
|
+
<pre class="bg-base-300 mt-2 p-2 text-xs">await dialog.confirmDelete('The Car')</pre>
|
|
89
|
+
|
|
90
|
+
<p>Or pass you own component</p>
|
|
91
|
+
<pre class="bg-base-300 mt-2 p-2 text-xs">{`await dialog.show({
|
|
92
|
+
detail: { caption: 'Interlocuteur' },
|
|
93
|
+
component: CreateCarForm,
|
|
94
|
+
props: { isEdit: false },
|
|
95
|
+
})`}</pre>
|
|
96
|
+
|
|
97
|
+
<p>Good luck 🚀</p>
|
|
98
|
+
</div>
|
|
99
|
+
</DialogPrimitive>
|
|
100
|
+
{/if}
|
|
101
|
+
{/each}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
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> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const DialogManagement: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type DialogManagement = InstanceType<typeof DialogManagement>;
|
|
18
|
+
export default DialogManagement;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createDialog } from '@melt-ui/svelte'
|
|
3
|
+
import { createEventDispatcher } from 'svelte'
|
|
4
|
+
import { fade } from 'svelte/transition'
|
|
5
|
+
|
|
6
|
+
import { LibIcon_Cross, type BaseItemLight } from '../../'
|
|
7
|
+
import Icon from '../../ui/Icon.svelte'
|
|
8
|
+
import LinkPlus from '../../ui/link/LinkPlus.svelte'
|
|
9
|
+
import { flyAndScale } from '../../utils/transition'
|
|
10
|
+
|
|
11
|
+
export let detail: BaseItemLight | undefined = undefined
|
|
12
|
+
export let open: boolean = false
|
|
13
|
+
export let classes: { root?: string } = {}
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
elements: { trigger, overlay, content, title: localTitle, description, close, portalled },
|
|
17
|
+
states: { open: localOpen },
|
|
18
|
+
} = createDialog({
|
|
19
|
+
forceVisible: true,
|
|
20
|
+
defaultOpen: open,
|
|
21
|
+
closeOnOutsideClick: false,
|
|
22
|
+
onOpenChange: (open) => {
|
|
23
|
+
dispatchChange('yop there')
|
|
24
|
+
return open.next
|
|
25
|
+
},
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const dispatch = createEventDispatcher()
|
|
29
|
+
|
|
30
|
+
function dispatchChange(_data: any) {
|
|
31
|
+
dispatch('change', _data)
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div {...$portalled} use:$portalled.action data-ff-dialog-root class={classes.root}>
|
|
36
|
+
{#if $localOpen}
|
|
37
|
+
<div
|
|
38
|
+
{...$overlay}
|
|
39
|
+
use:$overlay.action
|
|
40
|
+
data-ff-dialog-overlay
|
|
41
|
+
transition:fade={{ duration: 150 }}
|
|
42
|
+
></div>
|
|
43
|
+
<div
|
|
44
|
+
data-ff-dialog-content
|
|
45
|
+
transition:flyAndScale={{
|
|
46
|
+
duration: 150,
|
|
47
|
+
y: 8,
|
|
48
|
+
start: 0.96,
|
|
49
|
+
}}
|
|
50
|
+
{...$content}
|
|
51
|
+
use:$content.action
|
|
52
|
+
>
|
|
53
|
+
<div data-ff-dialog-header>
|
|
54
|
+
<h2 {...$localTitle} use:$localTitle.action data-ff-dialog-title>
|
|
55
|
+
<div data-ff-dialog-header-content>
|
|
56
|
+
<LinkPlus item={detail}></LinkPlus>
|
|
57
|
+
<button {...$close} use:$close.action aria-label="close" data-ff-dialog-close>
|
|
58
|
+
<Icon data={LibIcon_Cross}></Icon>
|
|
59
|
+
</button>
|
|
60
|
+
</div>
|
|
61
|
+
</h2>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<div data-ff-dialog-body>
|
|
65
|
+
<slot />
|
|
66
|
+
|
|
67
|
+
{#if $$slots.actions}
|
|
68
|
+
<div data-ff-dialog-actions>
|
|
69
|
+
<slot name="actions" />
|
|
70
|
+
</div>
|
|
71
|
+
{/if}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
{/if}
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<style>
|
|
78
|
+
[data-ff-dialog-root] {
|
|
79
|
+
position: fixed;
|
|
80
|
+
top: 0;
|
|
81
|
+
z-index: 50;
|
|
82
|
+
display: flex;
|
|
83
|
+
height: 100%;
|
|
84
|
+
width: 100%;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[data-ff-dialog-overlay] {
|
|
90
|
+
position: fixed;
|
|
91
|
+
inset: 0;
|
|
92
|
+
z-index: 40;
|
|
93
|
+
background-color: var(--ff-dialog-overlay);
|
|
94
|
+
-webkit-backdrop-filter: blur(2px);
|
|
95
|
+
backdrop-filter: blur(2px);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
[data-ff-dialog-content] {
|
|
99
|
+
position: relative;
|
|
100
|
+
z-index: 40;
|
|
101
|
+
max-height: 90vh;
|
|
102
|
+
overflow: auto;
|
|
103
|
+
border-radius: 0.75rem;
|
|
104
|
+
border: 1px solid rgb(20 20 20 / 0.6);
|
|
105
|
+
background-color: var(--ff-dialog-content);
|
|
106
|
+
padding: 1.5rem;
|
|
107
|
+
box-shadow:
|
|
108
|
+
0 10px 15px -3px rgb(0 0 0 / 0.1),
|
|
109
|
+
0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
[data-ff-dialog-header] {
|
|
113
|
+
width: 100%;
|
|
114
|
+
margin-bottom: 1rem;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
[data-ff-dialog-title] {
|
|
118
|
+
margin: 0;
|
|
119
|
+
font-size: 1.125rem;
|
|
120
|
+
line-height: 1.75rem;
|
|
121
|
+
font-weight: 500;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
[data-ff-dialog-header-content] {
|
|
125
|
+
display: flex;
|
|
126
|
+
align-items: center;
|
|
127
|
+
justify-content: space-between;
|
|
128
|
+
gap: 1rem;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
[data-ff-dialog-close] {
|
|
132
|
+
display: inline-flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
justify-content: center;
|
|
135
|
+
height: 2.5rem;
|
|
136
|
+
width: 2.5rem;
|
|
137
|
+
min-height: 0;
|
|
138
|
+
border-radius: 9999px;
|
|
139
|
+
border: none;
|
|
140
|
+
background-color: transparent;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
[data-ff-dialog-body] {
|
|
144
|
+
display: flex;
|
|
145
|
+
height: 100%;
|
|
146
|
+
min-width: 25rem;
|
|
147
|
+
flex-direction: column;
|
|
148
|
+
gap: 1rem;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
[data-ff-dialog-actions] {
|
|
152
|
+
margin-top: 0.5rem;
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: flex-end;
|
|
155
|
+
justify-content: flex-end;
|
|
156
|
+
}
|
|
157
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type BaseItemLight } from '../../';
|
|
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;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
16
|
+
default: any;
|
|
17
|
+
} ? Props extends Record<string, never> ? any : {
|
|
18
|
+
children?: any;
|
|
19
|
+
} : {});
|
|
20
|
+
declare const DialogPrimitive: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
21
|
+
detail?: BaseItemLight | undefined;
|
|
22
|
+
open?: boolean;
|
|
23
|
+
classes?: {
|
|
24
|
+
root?: string;
|
|
25
|
+
};
|
|
26
|
+
}, {
|
|
27
|
+
default: {};
|
|
28
|
+
actions: {};
|
|
29
|
+
}>, {
|
|
30
|
+
change: CustomEvent<any>;
|
|
31
|
+
} & {
|
|
32
|
+
[evt: string]: CustomEvent<any>;
|
|
33
|
+
}, {
|
|
34
|
+
default: {};
|
|
35
|
+
actions: {};
|
|
36
|
+
}, {}, string>;
|
|
37
|
+
type DialogPrimitive = InstanceType<typeof DialogPrimitive>;
|
|
38
|
+
export default DialogPrimitive;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { SvelteComponent } from 'svelte';
|
|
2
|
+
import { type Repository } from 'remult';
|
|
3
|
+
import { type BaseItemLight, type CellsInput, type StoreItem } from '../../';
|
|
4
|
+
import type { FF_Repo } from '../../svelte';
|
|
5
|
+
export type DialogClasses = {
|
|
6
|
+
/**
|
|
7
|
+
* for example `overflow-auto` to have a scrollbar in the dialog
|
|
8
|
+
*/
|
|
9
|
+
root?: string;
|
|
10
|
+
formGrid?: FormGrid;
|
|
11
|
+
};
|
|
12
|
+
export type FormGrid = 'grid-cols-1' | 'grid-cols-2' | 'grid-cols-3' | 'grid-cols-4' | 'grid-cols-1 lg:grid-cols-4';
|
|
13
|
+
export type DialogMetaData<entityType = any> = {
|
|
14
|
+
detail?: BaseItemLight;
|
|
15
|
+
repo?: Repository<entityType>;
|
|
16
|
+
store?: StoreItem<entityType>;
|
|
17
|
+
cells?: CellsInput<entityType>;
|
|
18
|
+
defaults?: Partial<entityType>;
|
|
19
|
+
classes?: DialogClasses;
|
|
20
|
+
component?: new (...args: any[]) => SvelteComponent;
|
|
21
|
+
props?: any;
|
|
22
|
+
children?: any;
|
|
23
|
+
reThrow?: boolean;
|
|
24
|
+
wDelete?: boolean;
|
|
25
|
+
focusKey?: string;
|
|
26
|
+
topicPrefixText?: string;
|
|
27
|
+
r?: FF_Repo<entityType>;
|
|
28
|
+
};
|
|
29
|
+
type ResultClose<entityType = any> = {
|
|
30
|
+
success: boolean;
|
|
31
|
+
item?: entityType;
|
|
32
|
+
};
|
|
33
|
+
export type DialogType = 'custom' | 'confirm' | 'confirmDelete' | 'fform';
|
|
34
|
+
export type DialogFormType<entityType> = {
|
|
35
|
+
cells?: CellsInput<entityType>;
|
|
36
|
+
defaults?: Partial<entityType>;
|
|
37
|
+
classes?: DialogClasses;
|
|
38
|
+
reThrow?: boolean;
|
|
39
|
+
wDelete?: boolean;
|
|
40
|
+
topicPrefixText?: string;
|
|
41
|
+
focusKey?: string;
|
|
42
|
+
};
|
|
43
|
+
export type DialogMetaDataInternal<entityType = any> = DialogMetaData<entityType> & {
|
|
44
|
+
id: number;
|
|
45
|
+
type: DialogType;
|
|
46
|
+
resolve: (result: ResultClose) => void;
|
|
47
|
+
};
|
|
48
|
+
export declare const dialog: {
|
|
49
|
+
confirm: (topic: string, text: string, icon?: string) => Promise<ResultClose<any>>;
|
|
50
|
+
confirmDelete: (topic: string) => Promise<ResultClose<any>>;
|
|
51
|
+
form: <entityType>(type: "insert" | "update" | "view", topic: string, repo: Repository<entityType>, settings: DialogFormType<entityType>) => Promise<ResultClose<any>>;
|
|
52
|
+
fform: <entityType>(r: FF_Repo<entityType>, settings: DialogFormType<entityType>) => Promise<ResultClose<any>>;
|
|
53
|
+
show: (dialog: DialogMetaData) => Promise<ResultClose<any>>;
|
|
54
|
+
close: (id: number, result: ResultClose) => void;
|
|
55
|
+
closeAll: () => void;
|
|
56
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<DialogMetaDataInternal<any>[]>, invalidate?: () => void) => import("svelte/store").Unsubscriber;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { writable } from 'svelte/store';
|
|
2
|
+
import {} from 'remult';
|
|
3
|
+
import { LibIcon_Add, LibIcon_Delete, LibIcon_Edit, LibIcon_Search, } from '../../';
|
|
4
|
+
const createDialogManagement = () => {
|
|
5
|
+
const { subscribe, update } = writable([]);
|
|
6
|
+
// internal...
|
|
7
|
+
const show = (dialog, type) => {
|
|
8
|
+
let resolve;
|
|
9
|
+
const promise = new Promise((res) => {
|
|
10
|
+
resolve = res;
|
|
11
|
+
});
|
|
12
|
+
update((dialogs) => {
|
|
13
|
+
return [...dialogs, { ...dialog, id: dialogs.length + 1, resolve, type }];
|
|
14
|
+
});
|
|
15
|
+
return promise;
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
confirm: (topic, text, icon) => {
|
|
19
|
+
const detail = {
|
|
20
|
+
detail: {
|
|
21
|
+
caption: 'Confirmez',
|
|
22
|
+
icon: { data: icon },
|
|
23
|
+
},
|
|
24
|
+
children: `
|
|
25
|
+
<p>
|
|
26
|
+
${topic}
|
|
27
|
+
<br />
|
|
28
|
+
${text}
|
|
29
|
+
</p>
|
|
30
|
+
`,
|
|
31
|
+
};
|
|
32
|
+
return show(detail, 'confirm');
|
|
33
|
+
},
|
|
34
|
+
confirmDelete: (topic) => {
|
|
35
|
+
const detail = {
|
|
36
|
+
detail: {
|
|
37
|
+
caption: 'Supprimer',
|
|
38
|
+
icon: { data: LibIcon_Delete },
|
|
39
|
+
},
|
|
40
|
+
children: topic
|
|
41
|
+
? `<p>Confirmez vous la suppression de: <br />- <b>${topic}</b> ?</p>`
|
|
42
|
+
: 'Confirmer la suppression ?',
|
|
43
|
+
};
|
|
44
|
+
return show(detail, 'confirmDelete');
|
|
45
|
+
},
|
|
46
|
+
form: (type, topic, repo, settings) => {
|
|
47
|
+
const topicPrefixText = settings?.topicPrefixText
|
|
48
|
+
? settings?.topicPrefixText + ' '
|
|
49
|
+
: type === 'insert'
|
|
50
|
+
? `Créer `
|
|
51
|
+
: type === 'update'
|
|
52
|
+
? 'Modifier '
|
|
53
|
+
: 'Détail ';
|
|
54
|
+
const detail = {
|
|
55
|
+
detail: {
|
|
56
|
+
caption: (topicPrefixText + topic).trim(),
|
|
57
|
+
icon: {
|
|
58
|
+
data: type === 'insert' ? LibIcon_Add : type === 'update' ? LibIcon_Edit : LibIcon_Search,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
repo,
|
|
62
|
+
// store,
|
|
63
|
+
cells: settings.cells ?? [],
|
|
64
|
+
defaults: settings?.defaults,
|
|
65
|
+
classes: settings?.classes,
|
|
66
|
+
reThrow: settings?.reThrow,
|
|
67
|
+
wDelete: settings?.wDelete,
|
|
68
|
+
focusKey: settings?.focusKey,
|
|
69
|
+
topicPrefixText,
|
|
70
|
+
};
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
return show(detail, type);
|
|
73
|
+
},
|
|
74
|
+
fform: (r, settings) => {
|
|
75
|
+
// const topicPrefixText = settings?.topicPrefixText
|
|
76
|
+
// ? settings?.topicPrefixText + ' '
|
|
77
|
+
// : type === 'insert'
|
|
78
|
+
// ? `Créer `
|
|
79
|
+
// : type === 'update'
|
|
80
|
+
// ? 'Modifier '
|
|
81
|
+
// : 'Détail '
|
|
82
|
+
const detail = {
|
|
83
|
+
detail: {
|
|
84
|
+
caption: r.metadata.caption,
|
|
85
|
+
icon: {
|
|
86
|
+
data: LibIcon_Edit,
|
|
87
|
+
// data: type === 'insert' ? LibIcon_Add : type === 'update' ? LibIcon_Edit : LibIcon_Search,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
// repo,
|
|
91
|
+
// store,
|
|
92
|
+
cells: settings.cells ?? [],
|
|
93
|
+
defaults: settings?.defaults,
|
|
94
|
+
classes: settings?.classes,
|
|
95
|
+
reThrow: settings?.reThrow,
|
|
96
|
+
wDelete: settings?.wDelete,
|
|
97
|
+
focusKey: settings?.focusKey,
|
|
98
|
+
r,
|
|
99
|
+
// topicPrefixText,
|
|
100
|
+
};
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
return show(detail, 'fform');
|
|
103
|
+
},
|
|
104
|
+
show: (dialog) => {
|
|
105
|
+
return show(dialog, 'custom');
|
|
106
|
+
},
|
|
107
|
+
// next step, give a result typed!
|
|
108
|
+
close: (id, result) => {
|
|
109
|
+
update((dialogs) => {
|
|
110
|
+
dialogs.forEach((dialog) => {
|
|
111
|
+
if (dialog.id === id) {
|
|
112
|
+
dialog.resolve(result);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return dialogs.filter((dialog) => dialog.id !== id);
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
// usefull on navigation you want to close all popups
|
|
119
|
+
closeAll: () => {
|
|
120
|
+
update((dialogs) => {
|
|
121
|
+
dialogs.forEach((dialog) => {
|
|
122
|
+
dialog.resolve({ success: false });
|
|
123
|
+
});
|
|
124
|
+
return [];
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
subscribe,
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export const dialog = createDialogManagement();
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { DynamicCustomField } from '.';
|
|
2
|
+
export interface Config {
|
|
3
|
+
theme: Theme;
|
|
4
|
+
dynamicCustomField?: DynamicCustomField;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Theme
|
|
8
|
+
*/
|
|
9
|
+
export interface FieldTheme {
|
|
10
|
+
root?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
container?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface LabelTheme {
|
|
15
|
+
root?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ErrorTheme {
|
|
18
|
+
root?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface EditTheme {
|
|
21
|
+
select?: string;
|
|
22
|
+
checkbox?: string;
|
|
23
|
+
input?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface HintTheme {
|
|
26
|
+
root?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GridTheme {
|
|
29
|
+
root?: string;
|
|
30
|
+
header?: string;
|
|
31
|
+
headerCell?: string;
|
|
32
|
+
row?: string;
|
|
33
|
+
rowCell?: string;
|
|
34
|
+
actions?: string;
|
|
35
|
+
actionButton?: string;
|
|
36
|
+
actionsColumn?: string;
|
|
37
|
+
actionsHeader?: string;
|
|
38
|
+
loadMoreButton?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface FormTheme {
|
|
41
|
+
root?: string;
|
|
42
|
+
groups?: string;
|
|
43
|
+
fields?: string;
|
|
44
|
+
actions?: string;
|
|
45
|
+
submitButton?: string;
|
|
46
|
+
cancelButton?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface DisplayTheme {
|
|
49
|
+
checkbox?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface Theme {
|
|
52
|
+
root?: string;
|
|
53
|
+
field?: FieldTheme;
|
|
54
|
+
label?: LabelTheme;
|
|
55
|
+
error?: ErrorTheme;
|
|
56
|
+
hint?: HintTheme;
|
|
57
|
+
edit?: EditTheme;
|
|
58
|
+
grid?: GridTheme;
|
|
59
|
+
form?: FormTheme;
|
|
60
|
+
display?: DisplayTheme;
|
|
61
|
+
}
|
|
62
|
+
export declare const defaultTheme: Theme;
|
|
63
|
+
export declare const emptyTheme: Theme;
|
|
64
|
+
export declare const daisyTheme: Theme;
|
|
65
|
+
export type FullyDefinedTheme = {
|
|
66
|
+
root: string;
|
|
67
|
+
field: FieldTheme;
|
|
68
|
+
label: LabelTheme;
|
|
69
|
+
error: ErrorTheme;
|
|
70
|
+
hint: HintTheme;
|
|
71
|
+
edit: EditTheme;
|
|
72
|
+
grid: GridTheme;
|
|
73
|
+
form: FormTheme;
|
|
74
|
+
display: DisplayTheme;
|
|
75
|
+
};
|
|
76
|
+
export declare class FF_Theme {
|
|
77
|
+
#private;
|
|
78
|
+
constructor(initialTheme?: Theme);
|
|
79
|
+
setTheme(theme: Theme): void;
|
|
80
|
+
getTheme(): FullyDefinedTheme;
|
|
81
|
+
getClasses<K extends keyof FullyDefinedTheme>(key: K, classes: Partial<FullyDefinedTheme[K]>): FullyDefinedTheme[K];
|
|
82
|
+
}
|
|
83
|
+
export declare function getThemeContext(): FF_Theme;
|
|
84
|
+
export declare function setTheme(theme: Theme): void;
|
|
85
|
+
export declare function getTheme(): FullyDefinedTheme;
|
|
86
|
+
export declare function getClasses<K extends keyof FullyDefinedTheme>(key: K, classes: Partial<FullyDefinedTheme[K]>): FullyDefinedTheme[K];
|
|
87
|
+
/**
|
|
88
|
+
* Dynamic Custom Field
|
|
89
|
+
*/
|
|
90
|
+
export declare function setDynamicCustomField(fn?: DynamicCustomField): void;
|
|
91
|
+
export declare function getDynamicCustomField(): DynamicCustomField | undefined;
|