firstly 0.0.9 → 0.0.11
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/BaseEnum.d.ts +1 -1
- package/esm/FF_Entity.d.ts +1 -1
- package/esm/FF_Entity.js +7 -3
- package/esm/ROUTES.d.ts +2 -2
- package/esm/api/index.d.ts +0 -1
- package/esm/bin/cmd.js +10 -16
- package/esm/feedback/FeedbackController.d.ts +1 -1
- package/esm/feedback/ui/DialogIssue.svelte +4 -2
- package/esm/feedback/ui/DialogIssues.svelte +13 -4
- package/esm/feedback/ui/DialogMilestones.svelte +1 -1
- package/esm/feedback/ui/Feedback.svelte +3 -1
- package/esm/handle/index.d.ts +0 -1
- package/esm/helper.d.ts +15 -14
- package/esm/helper.js +41 -0
- package/esm/index.d.ts +1 -2
- package/esm/index.js +1 -1
- package/esm/mail/templates/DefaultMail.svelte.d.ts +3 -3
- package/esm/storeItem.d.ts +1 -2
- package/esm/storeList.d.ts +1 -2
- package/esm/ui/Button.svelte +1 -1
- package/esm/ui/Clipboardable.svelte.d.ts +1 -1
- package/esm/ui/Field.svelte +1 -1
- package/esm/ui/Field.svelte.d.ts +3 -2
- package/esm/ui/FieldGroup.svelte.d.ts +1 -1
- package/esm/ui/Grid.svelte.d.ts +6 -6
- package/esm/ui/GridLoading.svelte.d.ts +1 -1
- package/esm/ui/GridPaginate.svelte.d.ts +2 -2
- package/esm/ui/Icon.svelte.d.ts +3 -3
- package/esm/ui/Loading.svelte.d.ts +1 -1
- package/esm/ui/Tooltip.svelte +1 -1
- package/esm/ui/Tooltip.svelte.d.ts +2 -2
- package/esm/ui/dialog/DialogPrimitive.svelte +2 -2
- package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +3 -3
- package/esm/ui/dialog/dialog.d.ts +1 -1
- package/esm/ui/internals/FieldContainer.svelte.d.ts +6 -6
- package/esm/ui/internals/Input.svelte +3 -1
- package/esm/ui/internals/Input.svelte.d.ts +1 -1
- package/esm/ui/internals/Textarea.svelte +2 -2
- package/esm/ui/internals/Textarea.svelte.d.ts +2 -2
- package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +4 -4
- package/esm/ui/internals/select/SelectMelt.svelte.d.ts +7 -7
- package/esm/ui/internals/select/SelectRadio.svelte.d.ts +3 -3
- package/esm/ui/link/Link.svelte +1 -1
- package/esm/ui/link/Link.svelte.d.ts +2 -2
- package/esm/ui/link/LinkPlus.svelte.d.ts +2 -2
- package/esm/utils/transition.d.ts +0 -1
- package/esm/vite/index.js +2 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# firstly
|
|
2
2
|
|
|
3
|
+
## 0.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#56](https://github.com/jycouet/firstly/pull/56)
|
|
8
|
+
[`a1e8de0`](https://github.com/jycouet/firstly/commit/a1e8de0a8871b8f1aa6cd81ee20d24f6a3da4c3f)
|
|
9
|
+
Thanks [@jycouet](https://github.com/jycouet)! - export changeLog module and not changeLogs
|
|
10
|
+
|
|
11
|
+
## 0.0.10
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#51](https://github.com/jycouet/firstly/pull/51)
|
|
16
|
+
[`803023a`](https://github.com/jycouet/firstly/commit/803023a6257c0bfb9396bc0a7bd454bd1281e26c)
|
|
17
|
+
Thanks [@jycouet](https://github.com/jycouet)! - prepare 0.0.10
|
|
18
|
+
|
|
3
19
|
## 0.0.9
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/esm/BaseEnum.d.ts
CHANGED
package/esm/FF_Entity.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type EntityOptions } from 'remult';
|
|
2
|
-
export declare function FF_Entity<entityType>(key: string, options: EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType>): (target: any, info?: import("remult/src/remult3/remult3").ClassDecoratorContextStub<entityType extends infer T ? T extends entityType ? T extends new (...args: any) => any ?
|
|
2
|
+
export declare function FF_Entity<entityType>(key: string, options: EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType>): (target: any, info?: import("remult/src/remult3/remult3").ClassDecoratorContextStub<entityType extends infer T ? T extends entityType ? T extends new (...args: any) => any ? entityType : never : never : never> | undefined) => any;
|
package/esm/FF_Entity.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Entity } from 'remult';
|
|
1
|
+
import { Entity, isBackend } from 'remult';
|
|
2
2
|
import { recordDeleted, recordSaved } from './changeLog';
|
|
3
3
|
const toAllow = (permission) => {
|
|
4
4
|
if (permission) {
|
|
@@ -24,7 +24,9 @@ export function FF_Entity(key, options) {
|
|
|
24
24
|
// Don't log changes
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
|
|
27
|
+
if (isBackend()) {
|
|
28
|
+
await recordSaved(entity, e, options.changeLog);
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
},
|
|
30
32
|
deleted: async (entity, e) => {
|
|
@@ -33,7 +35,9 @@ export function FF_Entity(key, options) {
|
|
|
33
35
|
// Don't log changes
|
|
34
36
|
}
|
|
35
37
|
else {
|
|
36
|
-
|
|
38
|
+
if (isBackend()) {
|
|
39
|
+
await recordDeleted(entity, e, options.changeLog);
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
},
|
|
39
43
|
});
|
package/esm/ROUTES.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ type ParamValue = string | number | undefined;
|
|
|
7
7
|
/**
|
|
8
8
|
* Append search params to a string
|
|
9
9
|
*/
|
|
10
|
-
export declare const appendSp: (sp?: Record<string, ParamValue | ParamValue[]>, prefix?:
|
|
10
|
+
export declare const appendSp: (sp?: Record<string, ParamValue | ParamValue[]>, prefix?: "?" | "&") => string;
|
|
11
11
|
/**
|
|
12
12
|
* get the current search params
|
|
13
13
|
*
|
|
@@ -41,7 +41,7 @@ declare const AllObjs: {
|
|
|
41
41
|
};
|
|
42
42
|
type AllTypes = typeof AllObjs;
|
|
43
43
|
export type Routes = keyof AllTypes extends `${string}/${infer Route}` ? `/${Route}` : keyof AllTypes;
|
|
44
|
-
export declare const routes:
|
|
44
|
+
export declare const routes: Routes[];
|
|
45
45
|
/**
|
|
46
46
|
* To be used like this:
|
|
47
47
|
* ```ts
|
package/esm/api/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types=".pnpm/@sveltejs+kit@2.5.24_@sveltejs+vite-plugin-svelte@3.1.2_svelte@4.2.18_vite@5.4.1_@types+node@_lnml5jetshdinsnlj53joqxhde/node_modules/@sveltejs/kit" />
|
|
2
1
|
import type { Handle, RequestEvent } from '@sveltejs/kit';
|
|
3
2
|
import { type ClassType } from 'remult';
|
|
4
3
|
import type { RemultServerOptions } from 'remult/server';
|
package/esm/bin/cmd.js
CHANGED
|
@@ -121,21 +121,11 @@ module.exports = {
|
|
|
121
121
|
`import { FF_Role } from 'firstly'
|
|
122
122
|
import { firstly } from 'firstly/api'
|
|
123
123
|
import { auth } from 'firstly/auth'
|
|
124
|
+
import { changeLog } from 'firstly/changeLog'
|
|
124
125
|
import { Log } from '@kitql/helpers'
|
|
125
126
|
|
|
126
127
|
import { task } from './modules/task'
|
|
127
128
|
|
|
128
|
-
//----------------------------------------
|
|
129
|
-
// To switch to postgres (1/2)
|
|
130
|
-
//----------------------------------------
|
|
131
|
-
// import { createPostgresConnection } from 'remult/postgres'
|
|
132
|
-
// import { DATABASE_URL } from '$env/static/private'
|
|
133
|
-
|
|
134
|
-
//----------------------------------------
|
|
135
|
-
// To enable OAuth via Github (1/2)
|
|
136
|
-
//----------------------------------------
|
|
137
|
-
// import { github } from 'firstly/auth/providers'
|
|
138
|
-
|
|
139
129
|
/**
|
|
140
130
|
* Your roles, use them in your app !
|
|
141
131
|
*/
|
|
@@ -150,7 +140,10 @@ export const log = new Log('${pkg.name}')
|
|
|
150
140
|
|
|
151
141
|
export const api = firstly({
|
|
152
142
|
//----------------------------------------
|
|
153
|
-
// To switch to postgres
|
|
143
|
+
// To switch to postgres
|
|
144
|
+
// NEEDS ON TOP OF THE FILE:
|
|
145
|
+
// import { createPostgresConnection } from 'remult/postgres'
|
|
146
|
+
// import { DATABASE_URL } from '$env/static/private'
|
|
154
147
|
//----------------------------------------
|
|
155
148
|
// dataProvider: await createPostgresConnection({
|
|
156
149
|
// connectionString: DATABASE_URL,
|
|
@@ -174,8 +167,10 @@ export const api = firstly({
|
|
|
174
167
|
|
|
175
168
|
oAuths: [
|
|
176
169
|
//----------------------------------------
|
|
177
|
-
// To enable OAuth via Github
|
|
170
|
+
// To enable OAuth via Github
|
|
178
171
|
// Instructions by hovering the method \`github\`
|
|
172
|
+
// NEEDS ON TOP OF THE FILE:
|
|
173
|
+
// import { github } from 'firstly/auth/providers'
|
|
179
174
|
//----------------------------------------
|
|
180
175
|
// github(),
|
|
181
176
|
],
|
|
@@ -200,10 +195,9 @@ export const api = firstly({
|
|
|
200
195
|
},
|
|
201
196
|
|
|
202
197
|
//----------------------------------------
|
|
203
|
-
//
|
|
204
|
-
// To enable it, replace @Entity by @FF_Entity in your entities
|
|
198
|
+
// Replace @Entity by @FF_Entity in your entities to enable changeLog on this entity
|
|
205
199
|
//----------------------------------------
|
|
206
|
-
|
|
200
|
+
changeLog(),
|
|
207
201
|
],
|
|
208
202
|
})
|
|
209
203
|
`,
|
|
@@ -91,7 +91,7 @@ const disableButton = (issueNumber2, title2, content2) => {
|
|
|
91
91
|
<span class="badge badge-warning">En attente de réponse de TA part 😉, oui 🫵!</span>
|
|
92
92
|
{/if}
|
|
93
93
|
{#if issueNumber}
|
|
94
|
-
<button on:click={update} class="divider"></button>
|
|
94
|
+
<button on:click={update} aria-label="Actualiser" class="divider"></button>
|
|
95
95
|
{/if}
|
|
96
96
|
|
|
97
97
|
{#if issue?.state === 'CLOSED'}
|
|
@@ -102,7 +102,9 @@ const disableButton = (issueNumber2, title2, content2) => {
|
|
|
102
102
|
{#if issueNumber === null}
|
|
103
103
|
<Field cell={cellBuildor(repo(FilterEntity), 'title')} bind:value={title} />
|
|
104
104
|
{/if}
|
|
105
|
-
<Textarea
|
|
105
|
+
<Textarea
|
|
106
|
+
bind:value={content}
|
|
107
|
+
placeholder="Un peu de détail c'est pas mal... Fais toi Plaiz' (Tu as même le droit d'utiliser le format markdown!)"
|
|
106
108
|
></Textarea>
|
|
107
109
|
<div class="flex justify-between">
|
|
108
110
|
{#if issueNumber}
|
|
@@ -45,7 +45,7 @@ onMount(async () => {
|
|
|
45
45
|
on:click={async () => {
|
|
46
46
|
await dialog.show({
|
|
47
47
|
component: DialogIssue,
|
|
48
|
-
classes: { root: 'overflow-auto w-
|
|
48
|
+
classes: { root: 'overflow-auto w-[80vh] h-[80vh]' },
|
|
49
49
|
props: { issueNumber: null, milestoneId },
|
|
50
50
|
detail: {
|
|
51
51
|
caption: 'Nouveau Feedback',
|
|
@@ -64,10 +64,10 @@ onMount(async () => {
|
|
|
64
64
|
on:click={async () => {
|
|
65
65
|
await dialog.show({
|
|
66
66
|
component: DialogIssue,
|
|
67
|
-
classes: { root: 'overflow-auto w-
|
|
67
|
+
classes: { root: 'overflow-auto w-[80vh] h-[80vh]' },
|
|
68
68
|
props: { issueNumber: issue.number, milestoneId },
|
|
69
69
|
detail: {
|
|
70
|
-
caption: issue.titleHTML,
|
|
70
|
+
caption: '#' + issue.number + ' - ' + issue.titleHTML,
|
|
71
71
|
icon: { data: issue.state === 'OPEN' ? LibIcon_Search : LibIcon_Check },
|
|
72
72
|
},
|
|
73
73
|
})
|
|
@@ -77,6 +77,9 @@ onMount(async () => {
|
|
|
77
77
|
>
|
|
78
78
|
<div class="flex w-full justify-center justify-items-center text-left">
|
|
79
79
|
<div class="flex-grow">
|
|
80
|
+
<span class="text-base-content/60 mr-2 inline-block w-8 text-right text-xs italic"
|
|
81
|
+
>#{issue.number}</span
|
|
82
|
+
>
|
|
80
83
|
{@html issue.titleHTML}
|
|
81
84
|
</div>
|
|
82
85
|
{#if issue.highlight}
|
|
@@ -90,7 +93,13 @@ onMount(async () => {
|
|
|
90
93
|
<Loading class="h-12"></Loading>
|
|
91
94
|
<Loading class="h-12"></Loading>
|
|
92
95
|
{:else}
|
|
93
|
-
<p
|
|
96
|
+
<div class="flex flex-col items-center justify-center p-8 text-center text-gray-500">
|
|
97
|
+
<div class="mb-4">
|
|
98
|
+
<Icon data={LibIcon_Search} size="4rem"></Icon>
|
|
99
|
+
</div>
|
|
100
|
+
<p class="text-lg font-medium">Aucun feedback <b>{issueState}</b> pour le moment</p>
|
|
101
|
+
<p class="mt-2 text-sm">Soyez le premier à donner votre avis sur cette version !</p>
|
|
102
|
+
</div>
|
|
94
103
|
{/if}
|
|
95
104
|
{/each}
|
|
96
105
|
</div>
|
|
@@ -18,7 +18,7 @@ onMount(async () => {
|
|
|
18
18
|
on:click={() =>
|
|
19
19
|
dialog.show({
|
|
20
20
|
component: DialogIssues,
|
|
21
|
-
classes: { root: 'overflow-auto w-
|
|
21
|
+
classes: { root: 'overflow-auto w-[85vh] h-[85vh]' },
|
|
22
22
|
props: { milestoneNumber: milestone.number, milestoneId: milestone.id },
|
|
23
23
|
detail: { caption: milestone.title },
|
|
24
24
|
})}
|
|
@@ -3,10 +3,12 @@ import DialogMilestones from "./DialogMilestones.svelte";
|
|
|
3
3
|
const list = async () => {
|
|
4
4
|
await dialog.show({
|
|
5
5
|
component: DialogMilestones,
|
|
6
|
-
classes: { root: "overflow-auto w-
|
|
6
|
+
classes: { root: "overflow-auto w-[90vh] h-[90vh]" },
|
|
7
7
|
detail: { caption: "Feedback" }
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<button class="text-secondary" on:click={list}>Feedback</button>
|
|
13
|
+
|
|
14
|
+
<!-- <span class="h-9/12 hidden w-9/12"></span> -->
|
package/esm/handle/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types=".pnpm/@sveltejs+kit@2.5.24_@sveltejs+vite-plugin-svelte@3.1.2_svelte@4.2.18_vite@5.4.1_@types+node@_lnml5jetshdinsnlj53joqxhde/node_modules/@sveltejs/kit" />
|
|
2
1
|
import type { Handle } from '@sveltejs/kit';
|
|
3
2
|
import type { RemultSveltekitServer } from 'remult/remult-sveltekit';
|
|
4
3
|
import type { Module } from '../api';
|
package/esm/helper.d.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import type { ClassType, ErrorInfo, FieldMetadata, Repository } from 'remult';
|
|
1
|
+
import type { ClassType, ErrorInfo, FieldMetadata, LifecycleEvent, Repository } from 'remult';
|
|
2
2
|
import type { BaseEnum, BaseItem } from './index.js';
|
|
3
3
|
export declare function isError<T>(object: any): object is ErrorInfo<T>;
|
|
4
4
|
export declare const getFirstInterestingField: <Entity>(repo: Repository<Entity>) => FieldMetadata<any, Entity>;
|
|
5
5
|
export declare const getEntityDisplayValue: <Entity>(repo: Repository<Entity>, row: Entity) => BaseItem;
|
|
6
|
-
export declare const getFieldLinkDisplayValue: (field: FieldMetadata, row: any) =>
|
|
7
|
-
id: string;
|
|
8
|
-
captionSub?: string | (string | undefined)[] | undefined;
|
|
9
|
-
href?: string | undefined;
|
|
10
|
-
repo?: Repository<any> | undefined;
|
|
11
|
-
sub?: {
|
|
12
|
-
captionPre?: string | undefined;
|
|
13
|
-
repo?: Repository<any> | undefined;
|
|
14
|
-
item?: any;
|
|
15
|
-
} | undefined;
|
|
16
|
-
} & {
|
|
6
|
+
export declare const getFieldLinkDisplayValue: (field: FieldMetadata, row: any) => BaseItem & {
|
|
17
7
|
href: string;
|
|
18
8
|
};
|
|
19
9
|
export declare const getEntityDisplayValueFromField: (field: FieldMetadata, row: any) => BaseItem & {
|
|
@@ -43,6 +33,17 @@ type MetaTypeSlot = {
|
|
|
43
33
|
export type FieldMetaType = MetaTypeRelation | MetaTypeEnum | MetaTypePrimitive | MetaTypeSlot;
|
|
44
34
|
export declare const getFieldMetaType: (field?: FieldMetadata) => FieldMetaType;
|
|
45
35
|
export declare const displayWithDefaultAndSuffix: (field: FieldMetadata<any, any> | undefined, value: any) => string;
|
|
46
|
-
export declare const getEnum: <T extends BaseEnum
|
|
47
|
-
export declare const getEnums: <T extends BaseEnum
|
|
36
|
+
export declare const getEnum: <T extends BaseEnum>(baseEnum: ClassType<T>, id: string | undefined | null) => T | undefined;
|
|
37
|
+
export declare const getEnums: <T extends BaseEnum>(baseEnum: ClassType<T>) => T[];
|
|
38
|
+
/**
|
|
39
|
+
* To be used like:
|
|
40
|
+
* ```ts
|
|
41
|
+
* \@Entity('tasks', {
|
|
42
|
+
* async deleting(item, e) {
|
|
43
|
+
* await onDelete(item, e, 'prevent')
|
|
44
|
+
* },
|
|
45
|
+
* }
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const onDelete: <T>(item: T, e: LifecycleEvent<T>, mode?: "prevent" | "cascade") => Promise<void>;
|
|
48
49
|
export {};
|
package/esm/helper.js
CHANGED
|
@@ -118,3 +118,44 @@ export const getEnum = (baseEnum, id) => {
|
|
|
118
118
|
export const getEnums = (baseEnum) => {
|
|
119
119
|
return getValueList(baseEnum) || [];
|
|
120
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
* To be used like:
|
|
123
|
+
* ```ts
|
|
124
|
+
* \@Entity('tasks', {
|
|
125
|
+
* async deleting(item, e) {
|
|
126
|
+
* await onDelete(item, e, 'prevent')
|
|
127
|
+
* },
|
|
128
|
+
* }
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export const onDelete = async (item, e, mode = 'prevent') => {
|
|
132
|
+
const toManies = e.repository.fields
|
|
133
|
+
.toArray()
|
|
134
|
+
.map((f) => {
|
|
135
|
+
return {
|
|
136
|
+
f: f,
|
|
137
|
+
fi: getRelationFieldInfo(f),
|
|
138
|
+
};
|
|
139
|
+
})
|
|
140
|
+
.filter((f) => f.fi?.type === 'toMany');
|
|
141
|
+
const checks = await Promise.all(toManies.map(async (f_fi) => {
|
|
142
|
+
// @ts-ignore
|
|
143
|
+
const count = await e.repository.relations(item)[f_fi.f.key].count();
|
|
144
|
+
return { ...f_fi, count };
|
|
145
|
+
}));
|
|
146
|
+
const nonEmptyRelations = checks.filter((check) => check.count > 0);
|
|
147
|
+
if (nonEmptyRelations.length > 0) {
|
|
148
|
+
if (mode === 'prevent') {
|
|
149
|
+
const relationNames = nonEmptyRelations.map((r) => r.f.caption).join(', ');
|
|
150
|
+
throw Error(`Can't with existing: ${relationNames}`);
|
|
151
|
+
}
|
|
152
|
+
else if (mode === 'cascade') {
|
|
153
|
+
nonEmptyRelations.forEach(async (r) => {
|
|
154
|
+
const where = Object.entries(r.fi?.getFields().fields ?? {}).map(([key, value]) => {
|
|
155
|
+
return { [key]: item[value] };
|
|
156
|
+
});
|
|
157
|
+
await r.fi?.toRepo.deleteMany({ where });
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
package/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types=".pnpm/@sveltejs+kit@2.5.24_@sveltejs+vite-plugin-svelte@3.1.2_svelte@4.2.18_vite@5.4.1_@types+node@_lnml5jetshdinsnlj53joqxhde/node_modules/@sveltejs/kit" />
|
|
2
1
|
import type { RequestEvent } from '@sveltejs/kit';
|
|
3
2
|
import type { FindOptionsBase } from 'remult';
|
|
4
3
|
import { Log } from '@kitql/helpers';
|
|
@@ -44,7 +43,7 @@ export { FF_Entity } from './FF_Entity.js';
|
|
|
44
43
|
export { FF_LogToConsole } from './SqlDatabase/FF_LogToConsole.js';
|
|
45
44
|
export { BaseEnum } from './BaseEnum.js';
|
|
46
45
|
export { dialog } from './ui/dialog/dialog.js';
|
|
47
|
-
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, } from './helper.js';
|
|
46
|
+
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, onDelete, } from './helper.js';
|
|
48
47
|
export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, containsWords, } from './cellsBuildor.js';
|
|
49
48
|
export { storeItem };
|
|
50
49
|
export { storeList };
|
package/esm/index.js
CHANGED
|
@@ -36,7 +36,7 @@ export { FF_Entity } from './FF_Entity.js';
|
|
|
36
36
|
export { FF_LogToConsole } from './SqlDatabase/FF_LogToConsole.js';
|
|
37
37
|
export { BaseEnum } from './BaseEnum.js';
|
|
38
38
|
export { dialog } from './ui/dialog/dialog.js';
|
|
39
|
-
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, } from './helper.js';
|
|
39
|
+
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, onDelete, } from './helper.js';
|
|
40
40
|
export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, containsWords, } from './cellsBuildor.js';
|
|
41
41
|
export { storeItem };
|
|
42
42
|
export { storeList };
|
|
@@ -5,13 +5,13 @@ declare const __propDef: {
|
|
|
5
5
|
title: string | undefined;
|
|
6
6
|
sections?: {
|
|
7
7
|
text: string;
|
|
8
|
-
highlighted?: boolean
|
|
8
|
+
highlighted?: boolean;
|
|
9
9
|
cta?: {
|
|
10
10
|
text: string;
|
|
11
11
|
link: string;
|
|
12
12
|
} | undefined;
|
|
13
|
-
}[]
|
|
14
|
-
brandColor?: string
|
|
13
|
+
}[];
|
|
14
|
+
brandColor?: string;
|
|
15
15
|
};
|
|
16
16
|
events: {
|
|
17
17
|
[evt: string]: CustomEvent<any>;
|
package/esm/storeItem.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
1
|
import type { ErrorInfo, FindOptions, Repository } from 'remult';
|
|
3
2
|
type TheStoreItem<T> = {
|
|
4
3
|
item: T | undefined;
|
|
@@ -17,7 +16,7 @@ export declare const storeItem: <T>(repo: Repository<T>, initValues?: TheStoreIt
|
|
|
17
16
|
* store.fetch(id)
|
|
18
17
|
* ```
|
|
19
18
|
*/
|
|
20
|
-
fetch: (id: Parameters<Repository<T>[
|
|
19
|
+
fetch: (id: Parameters<Repository<T>["findId"]>[0], options?: FindOptions<T>, onNewData?: (item: T) => void) => Promise<void>;
|
|
21
20
|
/**
|
|
22
21
|
* `.save()` will `update` or `insert` the current item.
|
|
23
22
|
*/
|
package/esm/storeList.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
1
|
import type { FindOptions, GroupByOptions, MembersOnly, Repository } from 'remult';
|
|
3
2
|
type TheStoreList<T> = {
|
|
4
3
|
items: T[];
|
|
@@ -28,7 +27,7 @@ export type FF_FindOptions<T> = FindOptions<T> & {
|
|
|
28
27
|
export declare const storeList: <T>(repo: Repository<T>, initValues?: TheStoreList<T>) => {
|
|
29
28
|
subscribe: (this: void, run: import("svelte/store").Subscriber<TheStoreList<T>>, invalidate?: import("svelte/store").Invalidator<TheStoreList<T>> | undefined) => import("svelte/store").Unsubscriber;
|
|
30
29
|
manualSet: (info: TheStoreList<T>) => void;
|
|
31
|
-
fetch: (options?: FF_FindOptions<T>, onNewData?: (
|
|
30
|
+
fetch: (options?: FF_FindOptions<T>, onNewData?: (items?: T[], totalCount?: number) => void) => Promise<void>;
|
|
32
31
|
listen: (options?: FF_FindOptions<T>) => Promise<void>;
|
|
33
32
|
getRepo: () => Repository<T>;
|
|
34
33
|
};
|
package/esm/ui/Button.svelte
CHANGED
|
@@ -6,7 +6,7 @@ declare const __propDef: {
|
|
|
6
6
|
*
|
|
7
7
|
* Don't put this on an input, if not, when a user will select the input via the mouse, this clipboard will be copied (usually you wanted to paste)!
|
|
8
8
|
*/ value: string | null;
|
|
9
|
-
class?: string
|
|
9
|
+
class?: string;
|
|
10
10
|
};
|
|
11
11
|
events: {
|
|
12
12
|
[evt: string]: CustomEvent<any>;
|
package/esm/ui/Field.svelte
CHANGED
|
@@ -138,7 +138,7 @@ const calcSuffix = (value2) => {
|
|
|
138
138
|
label={cell?.header ?? cell.field?.caption ?? cell.field?.key}
|
|
139
139
|
required={!cell.field?.allowNull && mode === 'edit' && metaType.subKind !== 'checkbox'}
|
|
140
140
|
{error}
|
|
141
|
-
classes={{ slot: metaType.subKind === 'textarea' ? 'h-
|
|
141
|
+
classes={{ slot: metaType.subKind === 'textarea' ? 'h-24 items-start' : '' }}
|
|
142
142
|
>
|
|
143
143
|
{@const clearableComputed =
|
|
144
144
|
cell.clearable || clearable || (mode === 'filtre' && clearable === undefined)}
|
package/esm/ui/Field.svelte.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
3
|
import { type Cell } from '../';
|
|
3
4
|
declare class __sveltets_Render<T extends Record<any, any>> {
|
|
4
5
|
props(): {
|
|
5
6
|
[x: string]: any;
|
|
6
7
|
cell: Cell<T>;
|
|
7
|
-
value?:
|
|
8
|
+
value?: HTMLInputAttributes["value"];
|
|
8
9
|
cellsValues?: any;
|
|
9
10
|
withDedounce?: boolean | undefined;
|
|
10
11
|
error?: string | undefined;
|
|
11
|
-
mode?: "
|
|
12
|
+
mode?: ("edit" | "view" | "filtre") | undefined;
|
|
12
13
|
focus?: boolean | undefined;
|
|
13
14
|
clearable?: boolean | undefined;
|
|
14
15
|
disabled?: boolean | undefined;
|
|
@@ -4,7 +4,7 @@ import { type StoreItem } from '../';
|
|
|
4
4
|
import type { Cell } from '../cellsBuildor';
|
|
5
5
|
declare class __sveltets_Render<T extends Record<any, any>> {
|
|
6
6
|
props(): {
|
|
7
|
-
mode?:
|
|
7
|
+
mode?: "view" | "edit" | "filtre";
|
|
8
8
|
cells: Cell<T>[];
|
|
9
9
|
store: StoreItem<T>;
|
|
10
10
|
focusKey?: string | null | undefined;
|
package/esm/ui/Grid.svelte.d.ts
CHANGED
|
@@ -6,17 +6,17 @@ declare class __sveltets_Render<T extends Record<any, any>> {
|
|
|
6
6
|
props(): {
|
|
7
7
|
cells: Cell<T>[];
|
|
8
8
|
store: StoreList<T>;
|
|
9
|
-
withAdd?: boolean
|
|
10
|
-
withEdit?: boolean
|
|
11
|
-
withDelete?: boolean
|
|
12
|
-
loadingRows?: number
|
|
9
|
+
withAdd?: boolean;
|
|
10
|
+
withEdit?: boolean;
|
|
11
|
+
withDelete?: boolean;
|
|
12
|
+
loadingRows?: number;
|
|
13
13
|
classes?: {
|
|
14
14
|
table: string;
|
|
15
15
|
} | undefined;
|
|
16
16
|
orderBy?: EntityOrderBy<T> | undefined;
|
|
17
17
|
orderByCols?: true | (keyof T)[] | undefined;
|
|
18
|
-
settingsLeft?: boolean
|
|
19
|
-
dicoNoResult?: string
|
|
18
|
+
settingsLeft?: boolean;
|
|
19
|
+
dicoNoResult?: string;
|
|
20
20
|
};
|
|
21
21
|
events(): {
|
|
22
22
|
refresh: any;
|
|
@@ -2,10 +2,10 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
import './LibIcon';
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
|
-
label?: string
|
|
5
|
+
label?: string;
|
|
6
6
|
pageDisplayed: number;
|
|
7
7
|
totalCount?: number | undefined | null;
|
|
8
|
-
pageSize?: number
|
|
8
|
+
pageSize?: number;
|
|
9
9
|
};
|
|
10
10
|
events: {
|
|
11
11
|
[evt: string]: CustomEvent<any>;
|
package/esm/ui/Icon.svelte.d.ts
CHANGED
|
@@ -16,14 +16,14 @@ declare const __propDef: {
|
|
|
16
16
|
* import Woman from "virtual:icons/mdi/account-tie-woman";
|
|
17
17
|
* <Icon data={mdiAccountTieWoman} style="background-color: blue;" size={"4rem"}></Icon>
|
|
18
18
|
* ```
|
|
19
|
-
*/ data?: string | string[]
|
|
20
|
-
size?: string | number
|
|
19
|
+
*/ data?: string | string[];
|
|
20
|
+
size?: string | number;
|
|
21
21
|
caption?: string | undefined;
|
|
22
22
|
/**
|
|
23
23
|
* By default, svg are not rendered on the server side.
|
|
24
24
|
* But the size will be respected to not have glitch on the client side when the icon is coming.
|
|
25
25
|
* @default false
|
|
26
|
-
*/ ssr?: boolean
|
|
26
|
+
*/ ssr?: boolean;
|
|
27
27
|
class?: string | string[] | undefined;
|
|
28
28
|
style?: string | string[] | undefined;
|
|
29
29
|
};
|
package/esm/ui/Tooltip.svelte
CHANGED
|
@@ -37,10 +37,10 @@ function dispatchChange(_data) {
|
|
|
37
37
|
use:$overlay.action
|
|
38
38
|
class="bg-base-300/80 fixed inset-0 z-40 blur-sm"
|
|
39
39
|
transition:fade={{ duration: 150 }}
|
|
40
|
-
|
|
40
|
+
></div>
|
|
41
41
|
<div
|
|
42
42
|
class={tw(
|
|
43
|
-
`border-base-content/60 bg-base-100 relative z-40 max-h-[90vh] overflow-
|
|
43
|
+
`border-base-content/60 bg-base-100 relative z-40 max-h-[90vh] overflow-auto rounded-xl border p-6 shadow-lg`,
|
|
44
44
|
classes.root,
|
|
45
45
|
)}
|
|
46
46
|
transition:flyAndScale={{
|
|
@@ -3,10 +3,10 @@ import { type BaseItemLight } from '../../';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
detail?: BaseItemLight | undefined;
|
|
6
|
-
open?: boolean
|
|
6
|
+
open?: boolean;
|
|
7
7
|
classes?: {
|
|
8
|
-
root?: string
|
|
9
|
-
}
|
|
8
|
+
root?: string;
|
|
9
|
+
};
|
|
10
10
|
};
|
|
11
11
|
events: {
|
|
12
12
|
change: CustomEvent<any>;
|
|
@@ -46,7 +46,7 @@ export type DialogMetaDataInternal<entityType = any> = DialogMetaData<entityType
|
|
|
46
46
|
export declare const dialog: {
|
|
47
47
|
confirm: (topic: string, text: string, icon?: string) => Promise<ResultClose<any>>;
|
|
48
48
|
confirmDelete: (topic: string) => Promise<ResultClose<any>>;
|
|
49
|
-
form: <entityType>(type:
|
|
49
|
+
form: <entityType>(type: "insert" | "update" | "view", topic: string, repo: Repository<entityType>, settings: DialogFormType<entityType>) => Promise<ResultClose<any>>;
|
|
50
50
|
show: (dialog: DialogMetaData) => Promise<ResultClose<any>>;
|
|
51
51
|
close: (id: number, result: ResultClose) => void;
|
|
52
52
|
closeAll: () => void;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { SvelteComponent } from "svelte";
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
|
-
label?: string
|
|
4
|
+
label?: string;
|
|
5
5
|
forId: string;
|
|
6
|
-
required?: boolean
|
|
7
|
-
error?: string
|
|
6
|
+
required?: boolean;
|
|
7
|
+
error?: string;
|
|
8
8
|
/**
|
|
9
9
|
* example usage for paginate
|
|
10
10
|
* classes={{ label: 'justify-end' }}
|
|
11
11
|
*/ classes?: {
|
|
12
|
-
label?: string
|
|
13
|
-
slot?: string
|
|
14
|
-
}
|
|
12
|
+
label?: string;
|
|
13
|
+
slot?: string;
|
|
14
|
+
};
|
|
15
15
|
};
|
|
16
16
|
events: {
|
|
17
17
|
[evt: string]: CustomEvent<any>;
|
|
@@ -33,7 +33,9 @@ const handleInput = (e) => {
|
|
|
33
33
|
const target = e.target;
|
|
34
34
|
if ($$restProps.type === "number") {
|
|
35
35
|
if (e.data === "." || e.data === ",") {
|
|
36
|
-
|
|
36
|
+
value = target.value.toString().replaceAll(",", ".");
|
|
37
|
+
} else if (target.value === "") {
|
|
38
|
+
value = null;
|
|
37
39
|
} else {
|
|
38
40
|
value = target.value.toString().replaceAll(",", ".");
|
|
39
41
|
}
|
|
@@ -3,7 +3,7 @@ import type { HTMLInputAttributes } from 'svelte/elements';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
|
-
value?: HTMLInputAttributes[
|
|
6
|
+
value?: HTMLInputAttributes["value"];
|
|
7
7
|
focus?: boolean | undefined;
|
|
8
8
|
withDedounce?: boolean | undefined;
|
|
9
9
|
class?: string | undefined | null;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { scrollbar } from "../../theme";
|
|
3
3
|
export let name = null;
|
|
4
4
|
export let id = "";
|
|
5
|
-
export let rows =
|
|
5
|
+
export let rows = 4;
|
|
6
6
|
export let placeholder = "";
|
|
7
7
|
export let focus = false;
|
|
8
8
|
export let value = "";
|
|
@@ -57,5 +57,5 @@ function dispatchInput(value2) {
|
|
|
57
57
|
// @ts-ignore
|
|
58
58
|
dispatchInput(e.target.value)
|
|
59
59
|
}}
|
|
60
|
-
|
|
60
|
+
></textarea>
|
|
61
61
|
{/if}
|
|
@@ -2,7 +2,7 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
-
name?: string | null | undefined;
|
|
5
|
+
name?: (string | null) | undefined;
|
|
6
6
|
id?: string | undefined;
|
|
7
7
|
rows?: number | undefined;
|
|
8
8
|
placeholder?: string | undefined;
|
|
@@ -10,7 +10,7 @@ declare const __propDef: {
|
|
|
10
10
|
value?: string | undefined;
|
|
11
11
|
readonly?: boolean | undefined;
|
|
12
12
|
error?: false | undefined;
|
|
13
|
-
align?:
|
|
13
|
+
align?: (`left` | `right`) | undefined;
|
|
14
14
|
};
|
|
15
15
|
events: {
|
|
16
16
|
input: CustomEvent<any>;
|
|
@@ -3,15 +3,15 @@ import { type BaseItem } from '../../..';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
id: string;
|
|
6
|
-
disabled?: boolean
|
|
7
|
-
placeholder?: string
|
|
8
|
-
items?: BaseItem[]
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
items?: BaseItem[];
|
|
9
9
|
loadOptions?: ((str: string) => Promise<{
|
|
10
10
|
items: BaseItem[];
|
|
11
11
|
totalCount: number;
|
|
12
12
|
}>) | undefined;
|
|
13
13
|
values?: string[] | undefined;
|
|
14
|
-
clearable?: boolean
|
|
14
|
+
clearable?: boolean;
|
|
15
15
|
};
|
|
16
16
|
events: {
|
|
17
17
|
selected: CustomEvent<any>;
|
|
@@ -3,18 +3,18 @@ import { type BaseItem } from '../../../';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
id: string;
|
|
6
|
-
disabled?: boolean
|
|
7
|
-
placeholder?: string
|
|
8
|
-
items?: BaseItem[]
|
|
9
|
-
focus?: boolean
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
items?: BaseItem[];
|
|
9
|
+
focus?: boolean;
|
|
10
10
|
loadOptions?: ((str: string) => Promise<{
|
|
11
11
|
items: BaseItem[];
|
|
12
12
|
totalCount: number;
|
|
13
13
|
}>) | undefined;
|
|
14
14
|
value?: string | undefined;
|
|
15
|
-
clearable?: boolean
|
|
16
|
-
createOptionWhenNoResult?: boolean
|
|
17
|
-
default_select_if_one_item?: boolean
|
|
15
|
+
clearable?: boolean;
|
|
16
|
+
createOptionWhenNoResult?: boolean;
|
|
17
|
+
default_select_if_one_item?: boolean;
|
|
18
18
|
};
|
|
19
19
|
events: {
|
|
20
20
|
selected: CustomEvent<any>;
|
|
@@ -3,9 +3,9 @@ import type { BaseItem } from '../../../';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
id: string;
|
|
6
|
-
disabled?: boolean
|
|
7
|
-
placeholder?: string
|
|
8
|
-
items?: BaseItem[]
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
items?: BaseItem[];
|
|
9
9
|
value?: string | number | undefined;
|
|
10
10
|
};
|
|
11
11
|
events: {
|
package/esm/ui/link/Link.svelte
CHANGED
|
@@ -7,7 +7,7 @@ export { className as class };
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<a
|
|
10
|
-
class={`${daisy[kind]} link no-underline hover:underline ${className ?? ''}`}
|
|
10
|
+
class={`${daisy[kind]} link inline-block text-left no-underline hover:underline ${className ?? ''}`}
|
|
11
11
|
{href}
|
|
12
12
|
rel="noopener"
|
|
13
13
|
{target}
|
|
@@ -4,8 +4,8 @@ declare const __propDef: {
|
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
6
|
href: string;
|
|
7
|
-
target?: HTMLAnchorAttributes[
|
|
8
|
-
kind?: "info" | "ghost" | undefined;
|
|
7
|
+
target?: HTMLAnchorAttributes["target"];
|
|
8
|
+
kind?: ("info" | "ghost") | undefined;
|
|
9
9
|
class?: string | undefined | null;
|
|
10
10
|
};
|
|
11
11
|
events: {
|
|
@@ -3,8 +3,8 @@ import { type BaseItemLight } from '../..';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
item: BaseItemLight | undefined;
|
|
6
|
-
noIcon?: boolean
|
|
7
|
-
captionSubStyle?: "
|
|
6
|
+
noIcon?: boolean;
|
|
7
|
+
captionSubStyle?: "under" | "inline" | "none";
|
|
8
8
|
};
|
|
9
9
|
events: {
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
package/esm/vite/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export function firstly(options) {
|
|
|
29
29
|
});
|
|
30
30
|
},
|
|
31
31
|
},
|
|
32
|
+
// @ts-ignore
|
|
32
33
|
...kitRoutes({
|
|
33
34
|
...(options?.kitRoutes ?? {}),
|
|
34
35
|
...{
|
|
@@ -40,6 +41,7 @@ export function firstly(options) {
|
|
|
40
41
|
},
|
|
41
42
|
},
|
|
42
43
|
}),
|
|
44
|
+
// @ts-ignore
|
|
43
45
|
...stripper({
|
|
44
46
|
decorators: ['BackendMethod'],
|
|
45
47
|
hard: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firstly",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Firstly, an opinionated Remult setup!",
|
|
6
6
|
"repository": {
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@sveltejs/kit": ">=1.0.0 <3.0.0",
|
|
17
|
-
"remult": "
|
|
17
|
+
"remult": "2.7.27",
|
|
18
18
|
"svelte": ">=4.2.18"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@clack/prompts": "^0.7.0",
|
|
22
22
|
"@kitql/internals": "0.9.9",
|
|
23
23
|
"@mdi/js": "^7.4.47",
|
|
24
|
-
"@melt-ui/svelte": "^0.
|
|
24
|
+
"@melt-ui/svelte": "^0.84.0",
|
|
25
25
|
"@types/nodemailer": "^6.4.15",
|
|
26
26
|
"arctic": "^1.8.0",
|
|
27
27
|
"clsx": "^2.1.1",
|
|
28
28
|
"cron": "^3.1.7",
|
|
29
|
-
"daisyui": "^4.12.
|
|
29
|
+
"daisyui": "^4.12.14",
|
|
30
30
|
"esm-env": "^1.0.0",
|
|
31
31
|
"lucia": "^3.2.0",
|
|
32
32
|
"nodemailer": "^6.9.13",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"types": "./esm/feedback/index.d.ts",
|
|
82
82
|
"default": "./esm/feedback/index.js"
|
|
83
83
|
},
|
|
84
|
-
"./
|
|
85
|
-
"types": "./esm/
|
|
86
|
-
"default": "./esm/
|
|
84
|
+
"./changeLog": {
|
|
85
|
+
"types": "./esm/changeLog/index.d.ts",
|
|
86
|
+
"default": "./esm/changeLog/index.js"
|
|
87
87
|
},
|
|
88
88
|
"./mail": {
|
|
89
89
|
"types": "./esm/mail/index.d.ts",
|