firstly 0.0.1 → 0.0.2
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 +8 -0
- package/LICENSE +18 -0
- package/README.md +12 -0
- package/esm/KitBaseEnum.d.ts +35 -0
- package/esm/KitBaseEnum.js +32 -0
- package/esm/KitEntity.d.ts +2 -0
- package/esm/KitEntity.js +24 -0
- package/esm/KitFields.d.ts +10 -0
- package/esm/KitFields.js +196 -0
- package/esm/ROUTES.d.ts +88 -0
- package/esm/ROUTES.js +98 -0
- package/esm/SqlDatabase/LogToConsoleCustom.d.ts +1 -0
- package/esm/SqlDatabase/LogToConsoleCustom.js +102 -0
- package/esm/api/index.d.ts +42 -0
- package/esm/api/index.js +97 -0
- package/esm/auth/Adapter.d.ts +10 -0
- package/esm/auth/Adapter.js +54 -0
- package/esm/auth/AuthController.d.ts +59 -0
- package/esm/auth/AuthController.js +434 -0
- package/esm/auth/Entities.d.ts +39 -0
- package/esm/auth/Entities.js +154 -0
- package/esm/auth/RoleController.d.ts +14 -0
- package/esm/auth/RoleController.js +57 -0
- package/esm/auth/helper.d.ts +1 -0
- package/esm/auth/helper.js +7 -0
- package/esm/auth/index.d.ts +153 -0
- package/esm/auth/index.js +279 -0
- package/esm/auth/providers/github.d.ts +25 -0
- package/esm/auth/providers/github.js +51 -0
- package/esm/auth/providers/index.d.ts +3 -0
- package/esm/auth/providers/index.js +26 -0
- package/esm/auth/providers/strava.d.ts +25 -0
- package/esm/auth/providers/strava.js +51 -0
- package/esm/auth/static/assets/Page-BMFREPjF.d.ts +5 -0
- package/esm/auth/static/assets/Page-BMFREPjF.js +18 -0
- package/esm/auth/static/assets/Page-BMOLAIFx.d.ts +5 -0
- package/esm/auth/static/assets/Page-BMOLAIFx.js +1 -0
- package/esm/auth/static/assets/Page-BwHye0GW.d.ts +5 -0
- package/esm/auth/static/assets/Page-BwHye0GW.js +1 -0
- package/esm/auth/static/assets/Page-gV58jf2r.css +1 -0
- package/esm/auth/static/assets/index-CKmKKRRL.d.ts +53 -0
- package/esm/auth/static/assets/index-CKmKKRRL.js +2 -0
- package/esm/auth/static/assets/index-R27C_TlP.css +4 -0
- package/esm/auth/static/favicon.svg +79 -0
- package/esm/auth/static/index.html +14 -0
- package/esm/auth/types.d.ts +33 -0
- package/esm/auth/types.js +1 -0
- package/esm/bin/cmd.d.ts +1 -0
- package/esm/bin/cmd.js +408 -0
- package/esm/changeLog/index.d.ts +55 -0
- package/esm/changeLog/index.js +179 -0
- package/esm/cron/index.d.ts +60 -0
- package/esm/cron/index.js +102 -0
- package/esm/feedback/FeedbackController.d.ts +30 -0
- package/esm/feedback/FeedbackController.js +313 -0
- package/esm/feedback/index.d.ts +18 -0
- package/esm/feedback/index.js +14 -0
- package/esm/feedback/ui/DialogIssue.svelte +102 -0
- package/esm/feedback/ui/DialogIssue.svelte.d.ts +20 -0
- package/esm/feedback/ui/DialogIssues.svelte +91 -0
- package/esm/feedback/ui/DialogIssues.svelte.d.ts +20 -0
- package/esm/feedback/ui/DialogMilestones.svelte +38 -0
- package/esm/feedback/ui/DialogMilestones.svelte.d.ts +18 -0
- package/esm/feedback/ui/Feedback.svelte +12 -0
- package/esm/feedback/ui/Feedback.svelte.d.ts +16 -0
- package/esm/formats/dates.d.ts +18 -0
- package/esm/formats/dates.js +35 -0
- package/esm/formats/index.d.ts +4 -0
- package/esm/formats/index.js +3 -0
- package/esm/formats/numbers.d.ts +4 -0
- package/esm/formats/numbers.js +34 -0
- package/esm/formats/strings.d.ts +11 -0
- package/esm/formats/strings.js +109 -0
- package/esm/handle/index.d.ts +7 -0
- package/esm/handle/index.js +40 -0
- package/esm/helper.d.ts +50 -0
- package/esm/helper.js +118 -0
- package/esm/index.d.ts +103 -0
- package/esm/index.js +42 -0
- package/esm/kitCellsBuildor.d.ts +45 -0
- package/esm/kitCellsBuildor.js +105 -0
- package/esm/kitStoreItem.d.ts +28 -0
- package/esm/kitStoreItem.js +170 -0
- package/esm/kitStoreList.d.ts +33 -0
- package/esm/kitStoreList.js +98 -0
- package/esm/mail/index.d.ts +11 -0
- package/esm/mail/index.js +51 -0
- package/esm/theme.d.ts +4 -0
- package/esm/theme.js +4 -0
- package/esm/ui/Button.svelte +102 -0
- package/esm/ui/Button.svelte.d.ts +27 -0
- package/esm/ui/Clipboardable.svelte +19 -0
- package/esm/ui/Clipboardable.svelte.d.ts +25 -0
- package/esm/ui/Field.svelte +288 -0
- package/esm/ui/Field.svelte.d.ts +29 -0
- package/esm/ui/FieldGroup.svelte +91 -0
- package/esm/ui/FieldGroup.svelte.d.ts +30 -0
- package/esm/ui/Grid.svelte +246 -0
- package/esm/ui/Grid.svelte.d.ts +46 -0
- package/esm/ui/GridLoading.svelte +32 -0
- package/esm/ui/GridLoading.svelte.d.ts +20 -0
- package/esm/ui/GridPaginate.svelte +66 -0
- package/esm/ui/GridPaginate.svelte.d.ts +22 -0
- package/esm/ui/Icon.svelte +86 -0
- package/esm/ui/Icon.svelte.d.ts +46 -0
- package/esm/ui/LibIcon.d.ts +23 -0
- package/esm/ui/LibIcon.js +28 -0
- package/esm/ui/Loading.svelte +11 -0
- package/esm/ui/Loading.svelte.d.ts +20 -0
- package/esm/ui/Tooltip.svelte +42 -0
- package/esm/ui/Tooltip.svelte.d.ts +22 -0
- package/esm/ui/dialog/DialogForm.svelte +70 -0
- package/esm/ui/dialog/DialogForm.svelte.d.ts +19 -0
- package/esm/ui/dialog/DialogManagement.svelte +87 -0
- package/esm/ui/dialog/DialogManagement.svelte.d.ts +25 -0
- package/esm/ui/dialog/DialogPrimitive.svelte +89 -0
- package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +28 -0
- package/esm/ui/dialog/FormEditAction.svelte +54 -0
- package/esm/ui/dialog/FormEditAction.svelte.d.ts +24 -0
- package/esm/ui/dialog/dialog.d.ts +51 -0
- package/esm/ui/dialog/dialog.js +98 -0
- package/esm/ui/index.d.ts +5 -0
- package/esm/ui/index.js +19 -0
- package/esm/ui/internals/FieldContainer.svelte +22 -0
- package/esm/ui/internals/FieldContainer.svelte.d.ts +30 -0
- package/esm/ui/internals/Input.svelte +98 -0
- package/esm/ui/internals/Input.svelte.d.ts +35 -0
- package/esm/ui/internals/Textarea.svelte +61 -0
- package/esm/ui/internals/Textarea.svelte.d.ts +30 -0
- package/esm/ui/internals/select/MultiSelectMelt.svelte +217 -0
- package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +30 -0
- package/esm/ui/internals/select/SelectMelt.svelte +238 -0
- package/esm/ui/internals/select/SelectMelt.svelte.d.ts +35 -0
- package/esm/ui/internals/select/SelectRadio.svelte +37 -0
- package/esm/ui/internals/select/SelectRadio.svelte.d.ts +25 -0
- package/esm/ui/link/Link.svelte +28 -0
- package/esm/ui/link/Link.svelte.d.ts +25 -0
- package/esm/ui/link/LinkPlus.svelte +44 -0
- package/esm/ui/link/LinkPlus.svelte.d.ts +21 -0
- package/esm/utils/tailwind.d.ts +2 -0
- package/esm/utils/tailwind.js +3 -0
- package/esm/utils/transition.d.ts +10 -0
- package/esm/utils/transition.js +33 -0
- package/esm/utils/types.d.ts +17 -0
- package/esm/utils/types.js +17 -0
- package/esm/virtual/Customer.d.ts +4 -0
- package/esm/virtual/Customer.js +24 -0
- package/esm/virtual/FilterEntity.d.ts +7 -0
- package/esm/virtual/FilterEntity.js +34 -0
- package/esm/virtual/StateDemoEnum.d.ts +9 -0
- package/esm/virtual/StateDemoEnum.js +42 -0
- package/esm/virtual/UIEntity.d.ts +16 -0
- package/esm/virtual/UIEntity.js +84 -0
- package/esm/vite/index.d.ts +8 -0
- package/esm/vite/index.js +47 -0
- package/package.json +94 -10
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script>import { createTooltip } from "@melt-ui/svelte";
|
|
2
|
+
import { fade } from "svelte/transition";
|
|
3
|
+
export let text = "";
|
|
4
|
+
export let hideTooltip = false;
|
|
5
|
+
const {
|
|
6
|
+
elements: { trigger, content, arrow },
|
|
7
|
+
states: { open }
|
|
8
|
+
} = createTooltip({
|
|
9
|
+
positioning: {
|
|
10
|
+
placement: "top"
|
|
11
|
+
},
|
|
12
|
+
openDelay: 0,
|
|
13
|
+
closeDelay: 0,
|
|
14
|
+
closeOnPointerDown: false,
|
|
15
|
+
forceVisible: true,
|
|
16
|
+
escapeBehavior: "close",
|
|
17
|
+
group: true
|
|
18
|
+
// disableHoverableContent: true,
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<button type="button" class="trigger" {...$trigger} use:trigger aria-label="Add">
|
|
23
|
+
<slot />
|
|
24
|
+
</button>
|
|
25
|
+
<!-- {hideTooltip} -->
|
|
26
|
+
{#if $open && !hideTooltip && (text || $$slots.tooltip)}
|
|
27
|
+
<div
|
|
28
|
+
{...$content}
|
|
29
|
+
use:content
|
|
30
|
+
transition:fade={{ duration: 100 }}
|
|
31
|
+
class="bg-base-300 z-30 rounded-lg ring-1 ring-black"
|
|
32
|
+
>
|
|
33
|
+
<div {...$arrow} use:arrow />
|
|
34
|
+
<div class="px-4 py-1">
|
|
35
|
+
{#if $$slots.tooltip}
|
|
36
|
+
<slot name="tooltip" />
|
|
37
|
+
{:else}
|
|
38
|
+
{text}
|
|
39
|
+
{/if}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
{/if}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
text?: string | undefined;
|
|
5
|
+
hideTooltip?: boolean | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {
|
|
11
|
+
default: {};
|
|
12
|
+
tooltip: {};
|
|
13
|
+
};
|
|
14
|
+
exports?: {} | undefined;
|
|
15
|
+
bindings?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
export type TooltipProps = typeof __propDef.props;
|
|
18
|
+
export type TooltipEvents = typeof __propDef.events;
|
|
19
|
+
export type TooltipSlots = typeof __propDef.slots;
|
|
20
|
+
export default class Tooltip extends SvelteComponent<TooltipProps, TooltipEvents, TooltipSlots> {
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script>import { FieldGroup, kitStoreItem } from "../..";
|
|
2
|
+
import { kitCellsBuildor } from "../../kitCellsBuildor";
|
|
3
|
+
import { dialog } from "./dialog";
|
|
4
|
+
import DialogPrimitive from "./DialogPrimitive.svelte";
|
|
5
|
+
import FormEditAction from "./FormEditAction.svelte";
|
|
6
|
+
export let toShow;
|
|
7
|
+
$:
|
|
8
|
+
cells = kitCellsBuildor(toShow.repo, toShow.cells);
|
|
9
|
+
$:
|
|
10
|
+
store = toShow.store ?? kitStoreItem(toShow.repo);
|
|
11
|
+
$: {
|
|
12
|
+
if (toShow.type === "update" || toShow.type === "view") {
|
|
13
|
+
store.set({ item: toShow.defaults, errors: {}, loading: false, globalError: void 0 });
|
|
14
|
+
} else {
|
|
15
|
+
store.create(toShow.defaults ?? {});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const onCreate = (e) => {
|
|
19
|
+
dialog.close(toShow.id, { success: true, item: e.detail });
|
|
20
|
+
};
|
|
21
|
+
let isLoading = false;
|
|
22
|
+
const onInsert = async () => {
|
|
23
|
+
isLoading = true;
|
|
24
|
+
try {
|
|
25
|
+
const result = await store.save();
|
|
26
|
+
if (result) {
|
|
27
|
+
dialog.close(toShow.id, { success: true, item: result });
|
|
28
|
+
}
|
|
29
|
+
} catch (e) {
|
|
30
|
+
if (!toShow.noThrow) {
|
|
31
|
+
throw e;
|
|
32
|
+
}
|
|
33
|
+
} finally {
|
|
34
|
+
isLoading = false;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const onDelete = async () => {
|
|
38
|
+
const res = await dialog.confirmDelete("");
|
|
39
|
+
if (res.success) {
|
|
40
|
+
await store.delete();
|
|
41
|
+
dialog.close(toShow.id, { success: true, item: $store.item });
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<DialogPrimitive
|
|
47
|
+
detail={toShow.detail}
|
|
48
|
+
open
|
|
49
|
+
classes={{ root: toShow.classes?.root }}
|
|
50
|
+
on:change={() => dialog.close(toShow.id, { success: false })}
|
|
51
|
+
>
|
|
52
|
+
<form on:submit|preventDefault={onInsert}>
|
|
53
|
+
<div class="grid {toShow.classes?.formGrid ?? ''} gap-4 pb-4">
|
|
54
|
+
<FieldGroup
|
|
55
|
+
{cells}
|
|
56
|
+
{store}
|
|
57
|
+
mode={toShow.type === 'view' ? 'view' : 'edit'}
|
|
58
|
+
on:createRequest={onCreate}
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<FormEditAction
|
|
63
|
+
type={toShow.type}
|
|
64
|
+
wDelete={toShow.wDelete}
|
|
65
|
+
{store}
|
|
66
|
+
on:delete={onDelete}
|
|
67
|
+
textCreate={toShow.topicPrefixText}
|
|
68
|
+
></FormEditAction>
|
|
69
|
+
</form>
|
|
70
|
+
</DialogPrimitive>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type DialogMetaDataInternal } from './dialog';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
toShow: DialogMetaDataInternal;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type DialogFormProps = typeof __propDef.props;
|
|
15
|
+
export type DialogFormEvents = typeof __propDef.events;
|
|
16
|
+
export type DialogFormSlots = typeof __propDef.slots;
|
|
17
|
+
export default class DialogForm extends SvelteComponent<DialogFormProps, DialogFormEvents, DialogFormSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Button from '../Button.svelte'
|
|
3
|
+
import { dialog } from './dialog'
|
|
4
|
+
import DialogForm from './DialogForm.svelte'
|
|
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.component && toShow.children}
|
|
43
|
+
<DialogPrimitive
|
|
44
|
+
detail={toShow.detail}
|
|
45
|
+
open
|
|
46
|
+
on:change={() => dialog.close(toShow.id, { success: false })}
|
|
47
|
+
>
|
|
48
|
+
<svelte:component this={toShow.component} {...toShow.props} dialogId={toShow.id}>
|
|
49
|
+
{#if toShow.children}
|
|
50
|
+
{@html toShow.children}
|
|
51
|
+
{/if}
|
|
52
|
+
</svelte:component>
|
|
53
|
+
</DialogPrimitive>
|
|
54
|
+
{:else if toShow.component}
|
|
55
|
+
<DialogPrimitive
|
|
56
|
+
detail={toShow.detail}
|
|
57
|
+
open
|
|
58
|
+
classes={{ root: toShow.classes?.root }}
|
|
59
|
+
on:change={() => dialog.close(toShow.id, { success: false })}
|
|
60
|
+
>
|
|
61
|
+
<svelte:component this={toShow.component} {...toShow.props} dialogId={toShow.id}
|
|
62
|
+
></svelte:component>
|
|
63
|
+
</DialogPrimitive>
|
|
64
|
+
{:else}
|
|
65
|
+
<DialogPrimitive
|
|
66
|
+
detail={toShow.detail}
|
|
67
|
+
open
|
|
68
|
+
on:change={() => dialog.close(toShow.id, { success: false })}
|
|
69
|
+
>
|
|
70
|
+
<div class="grid gap-2">
|
|
71
|
+
<p>Hey 🫵 developer, you are missing a few things 🤡!</p>
|
|
72
|
+
<p>Or use use one of the custom built in dialog like</p>
|
|
73
|
+
|
|
74
|
+
<pre class="bg-base-300 mt-2 p-2 text-xs">{`await dialog.confirmDelete('The Car')`}</pre>
|
|
75
|
+
|
|
76
|
+
<p>Or pass you own component</p>
|
|
77
|
+
<pre class="bg-base-300 mt-2 p-2 text-xs">{`await dialog.show({
|
|
78
|
+
detail: { caption: 'Interlocuteur' },
|
|
79
|
+
component: CreateCarForm,
|
|
80
|
+
props: { isEdit: false },
|
|
81
|
+
})`}</pre>
|
|
82
|
+
|
|
83
|
+
<p>Good luck 🚀</p>
|
|
84
|
+
</div>
|
|
85
|
+
</DialogPrimitive>
|
|
86
|
+
{/if}
|
|
87
|
+
{/each}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} DialogManagementProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} DialogManagementEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} DialogManagementSlots */
|
|
4
|
+
export default class DialogManagement extends SvelteComponent<{
|
|
5
|
+
[x: string]: never;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type DialogManagementProps = typeof __propDef.props;
|
|
11
|
+
export type DialogManagementEvents = typeof __propDef.events;
|
|
12
|
+
export type DialogManagementSlots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponent } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: never;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
exports?: undefined;
|
|
23
|
+
bindings?: undefined;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<script>import { createDialog } from "@melt-ui/svelte";
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import { fade } from "svelte/transition";
|
|
4
|
+
import { LibIcon_Cross, tw } from "../../";
|
|
5
|
+
import { flyAndScale } from "../../utils/transition";
|
|
6
|
+
import Icon from "../Icon.svelte";
|
|
7
|
+
import LinkPlus from "../link/LinkPlus.svelte";
|
|
8
|
+
export let detail = void 0;
|
|
9
|
+
export let open = false;
|
|
10
|
+
export let classes = {};
|
|
11
|
+
const {
|
|
12
|
+
elements: { trigger, overlay, content, title: localTitle, description, close, portalled },
|
|
13
|
+
states: { open: localOpen }
|
|
14
|
+
} = createDialog({
|
|
15
|
+
forceVisible: true,
|
|
16
|
+
defaultOpen: open,
|
|
17
|
+
closeOnOutsideClick: false,
|
|
18
|
+
onOpenChange: (open2) => {
|
|
19
|
+
dispatchChange("yop there");
|
|
20
|
+
return open2.next;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const dispatch = createEventDispatcher();
|
|
24
|
+
function dispatchChange(_data) {
|
|
25
|
+
dispatch("change", _data);
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<div
|
|
30
|
+
{...$portalled}
|
|
31
|
+
use:$portalled.action
|
|
32
|
+
class="fixed top-0 z-50 flex h-full w-full items-center justify-center"
|
|
33
|
+
>
|
|
34
|
+
{#if $localOpen}
|
|
35
|
+
<div
|
|
36
|
+
{...$overlay}
|
|
37
|
+
use:$overlay.action
|
|
38
|
+
class="bg-base-300/80 fixed inset-0 z-40 blur-sm"
|
|
39
|
+
transition:fade={{ duration: 150 }}
|
|
40
|
+
/>
|
|
41
|
+
<div
|
|
42
|
+
class={tw(
|
|
43
|
+
`border-base-content/60
|
|
44
|
+
bg-base-100
|
|
45
|
+
relative z-40 max-h-[90vh] overflow-visible rounded-xl
|
|
46
|
+
border p-6
|
|
47
|
+
shadow-lg`,
|
|
48
|
+
classes.root,
|
|
49
|
+
)}
|
|
50
|
+
transition:flyAndScale={{
|
|
51
|
+
duration: 150,
|
|
52
|
+
y: 8,
|
|
53
|
+
start: 0.96,
|
|
54
|
+
}}
|
|
55
|
+
{...$content}
|
|
56
|
+
use:$content.action
|
|
57
|
+
>
|
|
58
|
+
<div class="left-0 top-0 mb-4 w-full">
|
|
59
|
+
<h2 {...$localTitle} use:$localTitle.action class="m-0 text-lg font-medium">
|
|
60
|
+
<div class="flex items-center justify-between gap-4">
|
|
61
|
+
<LinkPlus item={detail}></LinkPlus>
|
|
62
|
+
<button
|
|
63
|
+
{...$close}
|
|
64
|
+
use:$close.action
|
|
65
|
+
aria-label="close"
|
|
66
|
+
class="btn btn-circle btn-outline btn-lg
|
|
67
|
+
h-max min-h-0 w-max border-none"
|
|
68
|
+
>
|
|
69
|
+
<Icon data={LibIcon_Cross}></Icon>
|
|
70
|
+
</button>
|
|
71
|
+
</div>
|
|
72
|
+
</h2>
|
|
73
|
+
</div>
|
|
74
|
+
|
|
75
|
+
<div class="flex h-full min-w-[25rem] flex-col gap-4">
|
|
76
|
+
<!-- FIXME: ERMIN? overflow? -->
|
|
77
|
+
<!-- <div class="overflow-y-auto"> -->
|
|
78
|
+
<slot />
|
|
79
|
+
|
|
80
|
+
{#if $$slots.actions}
|
|
81
|
+
<div class="mt-2 flex items-end justify-end">
|
|
82
|
+
<slot name="actions" />
|
|
83
|
+
</div>
|
|
84
|
+
{/if}
|
|
85
|
+
<!-- </div> -->
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
{/if}
|
|
89
|
+
</div>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import { type KitBaseItemLight } from '../../';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
detail?: KitBaseItemLight | undefined;
|
|
6
|
+
open?: boolean | undefined;
|
|
7
|
+
classes?: {
|
|
8
|
+
root?: string | undefined;
|
|
9
|
+
} | undefined;
|
|
10
|
+
};
|
|
11
|
+
events: {
|
|
12
|
+
change: CustomEvent<any>;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {
|
|
17
|
+
default: {};
|
|
18
|
+
actions: {};
|
|
19
|
+
};
|
|
20
|
+
exports?: {} | undefined;
|
|
21
|
+
bindings?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type DialogPrimitiveProps = typeof __propDef.props;
|
|
24
|
+
export type DialogPrimitiveEvents = typeof __propDef.events;
|
|
25
|
+
export type DialogPrimitiveSlots = typeof __propDef.slots;
|
|
26
|
+
export default class DialogPrimitive extends SvelteComponent<DialogPrimitiveProps, DialogPrimitiveEvents, DialogPrimitiveSlots> {
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script generics="T extends any">import { createEventDispatcher } from "svelte";
|
|
2
|
+
import Button from "../Button.svelte";
|
|
3
|
+
import Icon from "../Icon.svelte";
|
|
4
|
+
import { LibIcon_Add, LibIcon_Check, LibIcon_Delete } from "../LibIcon";
|
|
5
|
+
export let store;
|
|
6
|
+
export let type;
|
|
7
|
+
export let wDelete = false;
|
|
8
|
+
export let textCreate = "Cr\xE9er";
|
|
9
|
+
const dispatch = createEventDispatcher();
|
|
10
|
+
function dispatchDelete() {
|
|
11
|
+
dispatch("delete");
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div class="mt-2 flex items-center justify-between">
|
|
16
|
+
{#if type === 'update'}
|
|
17
|
+
<div class="flex items-center justify-start">
|
|
18
|
+
{#if wDelete}
|
|
19
|
+
<Button
|
|
20
|
+
type="button"
|
|
21
|
+
on:click={dispatchDelete}
|
|
22
|
+
class="btn-outline btn-error mr-4 text-white"
|
|
23
|
+
isLoading={$store.loading}
|
|
24
|
+
>
|
|
25
|
+
<Icon data={LibIcon_Delete} />
|
|
26
|
+
</Button>
|
|
27
|
+
{/if}
|
|
28
|
+
|
|
29
|
+
<div>
|
|
30
|
+
{#if $store.globalError}
|
|
31
|
+
<span class="text-error text-xs">{$store.globalError}</span>
|
|
32
|
+
{/if}
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<Button class="text-white" {...$$restProps} isLoading={$store.loading}>
|
|
37
|
+
<Icon data={LibIcon_Check} />
|
|
38
|
+
<p>Sauvegarder</p>
|
|
39
|
+
</Button>
|
|
40
|
+
{/if}
|
|
41
|
+
|
|
42
|
+
{#if type === 'insert'}
|
|
43
|
+
<div>
|
|
44
|
+
{#if $store.globalError}
|
|
45
|
+
<span class="text-error text-xs">{$store.globalError}</span>
|
|
46
|
+
{/if}
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<Button class="text-white" {...$$restProps} isLoading={$store.loading}>
|
|
50
|
+
<Icon data={LibIcon_Add} />
|
|
51
|
+
<p>{textCreate}</p>
|
|
52
|
+
</Button>
|
|
53
|
+
{/if}
|
|
54
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { KitStoreItem } from '../..';
|
|
3
|
+
import type { DialogType } from './dialog';
|
|
4
|
+
declare class __sveltets_Render<T extends any> {
|
|
5
|
+
props(): {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
store: KitStoreItem<T>;
|
|
8
|
+
type: DialogType;
|
|
9
|
+
wDelete?: boolean | undefined;
|
|
10
|
+
textCreate?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
events(): {
|
|
13
|
+
delete: CustomEvent<any>;
|
|
14
|
+
} & {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
};
|
|
17
|
+
slots(): {};
|
|
18
|
+
}
|
|
19
|
+
export type FormEditActionProps<T extends any> = ReturnType<__sveltets_Render<T>['props']>;
|
|
20
|
+
export type FormEditActionEvents<T extends any> = ReturnType<__sveltets_Render<T>['events']>;
|
|
21
|
+
export type FormEditActionSlots<T extends any> = ReturnType<__sveltets_Render<T>['slots']>;
|
|
22
|
+
export default class FormEditAction<T extends any> extends SvelteComponent<FormEditActionProps<T>, FormEditActionEvents<T>, FormEditActionSlots<T>> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { SvelteComponent } from 'svelte';
|
|
2
|
+
import type { Repository } from 'remult';
|
|
3
|
+
import { type KitBaseItemLight, type KitCellsInput, type KitStoreItem } from '../../';
|
|
4
|
+
export type DialogClasses = {
|
|
5
|
+
/**
|
|
6
|
+
* for example `overflow-auto` to have a scrollbar in the dialog
|
|
7
|
+
*/
|
|
8
|
+
root?: string;
|
|
9
|
+
formGrid?: FormGrid;
|
|
10
|
+
};
|
|
11
|
+
export type FormGrid = 'grid-cols-1' | 'grid-cols-2' | 'grid-cols-3' | 'grid-cols-4' | 'grid-cols-1 lg:grid-cols-4';
|
|
12
|
+
export type DialogMetaData<entityType = any> = {
|
|
13
|
+
detail?: KitBaseItemLight;
|
|
14
|
+
repo?: Repository<entityType>;
|
|
15
|
+
store?: KitStoreItem<entityType>;
|
|
16
|
+
cells?: KitCellsInput<entityType>;
|
|
17
|
+
defaults?: Partial<entityType>;
|
|
18
|
+
classes?: DialogClasses;
|
|
19
|
+
component?: new (...args: any[]) => SvelteComponent;
|
|
20
|
+
props?: any;
|
|
21
|
+
children?: any;
|
|
22
|
+
noThrow?: boolean;
|
|
23
|
+
wDelete?: boolean;
|
|
24
|
+
topicPrefixText?: string;
|
|
25
|
+
};
|
|
26
|
+
type ResultClose<entityType = any> = {
|
|
27
|
+
success: boolean;
|
|
28
|
+
item?: entityType;
|
|
29
|
+
};
|
|
30
|
+
export type DialogType = 'custom' | 'confirm' | 'confirmDelete' | 'insert' | 'update' | 'view';
|
|
31
|
+
export type DialogMetaDataInternal<entityType = any> = DialogMetaData<entityType> & {
|
|
32
|
+
id: number;
|
|
33
|
+
type: DialogType;
|
|
34
|
+
resolve: (result: ResultClose) => void;
|
|
35
|
+
};
|
|
36
|
+
export declare const dialog: {
|
|
37
|
+
confirm: (topic: string, text: string, icon?: string) => Promise<ResultClose<any>>;
|
|
38
|
+
confirmDelete: (topic: string) => Promise<ResultClose<any>>;
|
|
39
|
+
form: <entityType>(type: 'insert' | 'update' | 'view', topic: string, repo: Repository<entityType>, cells: KitCellsInput<entityType>, options?: {
|
|
40
|
+
defaults?: Partial<entityType>;
|
|
41
|
+
classes?: DialogClasses;
|
|
42
|
+
noThrow?: boolean;
|
|
43
|
+
wDelete?: boolean;
|
|
44
|
+
topicPrefixText?: string;
|
|
45
|
+
}) => Promise<ResultClose<any>>;
|
|
46
|
+
show: (dialog: DialogMetaData) => Promise<ResultClose<any>>;
|
|
47
|
+
close: (id: number, result: ResultClose) => void;
|
|
48
|
+
closeAll: () => void;
|
|
49
|
+
subscribe: (this: void, run: import("svelte/store").Subscriber<DialogMetaDataInternal<any>[]>, invalidate?: import("svelte/store").Invalidator<DialogMetaDataInternal<any>[]> | undefined) => import("svelte/store").Unsubscriber;
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { writable } from 'svelte/store';
|
|
2
|
+
import { LibIcon_Add, LibIcon_Delete, LibIcon_Edit, LibIcon_Search, } from '../../';
|
|
3
|
+
const createDialogManagement = () => {
|
|
4
|
+
const { subscribe, update } = writable([]);
|
|
5
|
+
// internal...
|
|
6
|
+
const show = (dialog, type) => {
|
|
7
|
+
let resolve;
|
|
8
|
+
const promise = new Promise((res) => {
|
|
9
|
+
resolve = res;
|
|
10
|
+
});
|
|
11
|
+
update((dialogs) => {
|
|
12
|
+
return [...dialogs, { ...dialog, id: dialogs.length + 1, resolve, type }];
|
|
13
|
+
});
|
|
14
|
+
return promise;
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
confirm: (topic, text, icon) => {
|
|
18
|
+
const detail = {
|
|
19
|
+
detail: {
|
|
20
|
+
caption: 'Confirmez',
|
|
21
|
+
icon: { data: icon },
|
|
22
|
+
},
|
|
23
|
+
children: `
|
|
24
|
+
<p>
|
|
25
|
+
${topic}
|
|
26
|
+
<br />
|
|
27
|
+
${text}
|
|
28
|
+
</p>
|
|
29
|
+
`,
|
|
30
|
+
};
|
|
31
|
+
return show(detail, 'confirm');
|
|
32
|
+
},
|
|
33
|
+
confirmDelete: (topic) => {
|
|
34
|
+
const detail = {
|
|
35
|
+
detail: {
|
|
36
|
+
caption: 'Supprimer',
|
|
37
|
+
icon: { data: LibIcon_Delete },
|
|
38
|
+
},
|
|
39
|
+
children: topic
|
|
40
|
+
? `<p>Confirmez vous la suppression de: <br />- <b>${topic}</b> ?</p>`
|
|
41
|
+
: 'Confirmer la suppression ?',
|
|
42
|
+
};
|
|
43
|
+
return show(detail, 'confirmDelete');
|
|
44
|
+
},
|
|
45
|
+
// FIXME JYC: refactor this (no need repo? options?)
|
|
46
|
+
form: (type, topic, repo, cells, options) => {
|
|
47
|
+
const topicPrefixText = options?.topicPrefixText
|
|
48
|
+
? options?.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,
|
|
64
|
+
defaults: options?.defaults,
|
|
65
|
+
classes: options?.classes,
|
|
66
|
+
noThrow: options?.noThrow,
|
|
67
|
+
wDelete: options?.wDelete,
|
|
68
|
+
topicPrefixText,
|
|
69
|
+
};
|
|
70
|
+
return show(detail, type);
|
|
71
|
+
},
|
|
72
|
+
show: (dialog) => {
|
|
73
|
+
return show(dialog, 'custom');
|
|
74
|
+
},
|
|
75
|
+
// next step, give a result typed!
|
|
76
|
+
close: (id, result) => {
|
|
77
|
+
update((dialogs) => {
|
|
78
|
+
dialogs.forEach((dialog) => {
|
|
79
|
+
if (dialog.id === id) {
|
|
80
|
+
dialog.resolve(result);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return dialogs.filter((dialog) => dialog.id !== id);
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
// usefull on navigation you want to close all popups
|
|
87
|
+
closeAll: () => {
|
|
88
|
+
update((dialogs) => {
|
|
89
|
+
dialogs.forEach((dialog) => {
|
|
90
|
+
dialog.resolve({ success: false });
|
|
91
|
+
});
|
|
92
|
+
return [];
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
subscribe,
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export const dialog = createDialogManagement();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FieldMetadata } from 'remult';
|
|
2
|
+
import type { KitCell } from '../';
|
|
3
|
+
export type Align = 'text-left' | 'text-center' | 'text-right';
|
|
4
|
+
export declare const align: (f?: FieldMetadata, isSlot?: boolean) => Align;
|
|
5
|
+
export declare const getAligns: (cells: KitCell<any>[], withAction: boolean) => Align[];
|
package/esm/ui/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const align = (f, isSlot) => {
|
|
2
|
+
if (isSlot) {
|
|
3
|
+
return 'text-center';
|
|
4
|
+
}
|
|
5
|
+
if (f?.inputType === 'number') {
|
|
6
|
+
return 'text-right';
|
|
7
|
+
}
|
|
8
|
+
else if (f?.inputType === 'date' || f?.inputType === 'dateOnly') {
|
|
9
|
+
return 'text-center';
|
|
10
|
+
}
|
|
11
|
+
return 'text-left';
|
|
12
|
+
};
|
|
13
|
+
export const getAligns = (cells, withAction) => {
|
|
14
|
+
const cols = [...cells.map((c) => align(c.field, c.kind === 'slot'))];
|
|
15
|
+
if (withAction) {
|
|
16
|
+
cols.push('text-right');
|
|
17
|
+
}
|
|
18
|
+
return cols;
|
|
19
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script>import { tw } from "../../utils/tailwind";
|
|
2
|
+
export let label = "label";
|
|
3
|
+
export let forId;
|
|
4
|
+
export let required = false;
|
|
5
|
+
export let error = "";
|
|
6
|
+
export let classes = {};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<div class="form-control w-full">
|
|
10
|
+
<label for={forId} class={tw(`label flex gap-1 px-2 pb-1`, classes.label)}>
|
|
11
|
+
<span class="label-text text-base-content/60 pl-2 text-xs">
|
|
12
|
+
{label}{required ? ' *' : ''}
|
|
13
|
+
</span>
|
|
14
|
+
{#if error}
|
|
15
|
+
<!-- TODO hover popup if too long? -->
|
|
16
|
+
<span class="label-text-alt text-error truncate">{error}</span>
|
|
17
|
+
{/if}
|
|
18
|
+
</label>
|
|
19
|
+
<div class={tw('grid h-12 w-full', classes.slot)}>
|
|
20
|
+
<slot />
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|