firstly 0.0.8 → 0.0.10
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 +17 -0
- package/esm/BaseEnum.d.ts +3 -14
- package/esm/BaseEnum.js +0 -4
- 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 +2 -3
- package/esm/api/index.js +4 -4
- package/esm/auth/RoleHelpers.d.ts +1 -1
- package/esm/auth/RoleHelpers.js +5 -3
- package/esm/auth/client/Auth.js +2 -2
- package/esm/auth/client/Entities.d.ts +2 -2
- package/esm/auth/client/Entities.js +5 -5
- package/esm/auth/client/index.d.ts +1 -1
- package/esm/auth/client/index.js +1 -1
- package/esm/auth/index.d.ts +2 -0
- package/esm/auth/index.js +23 -12
- package/esm/cellsBuildor.d.ts +4 -4
- package/esm/cellsBuildor.js +19 -6
- package/esm/feedback/FeedbackController.d.ts +1 -1
- package/esm/feedback/FeedbackController.js +0 -2
- package/esm/feedback/ui/DialogIssue.svelte +8 -8
- package/esm/handle/index.d.ts +0 -1
- package/esm/helper.d.ts +16 -14
- package/esm/helper.js +58 -2
- package/esm/index.d.ts +7 -3
- package/esm/index.js +1 -1
- package/esm/mail/index.js +15 -10
- package/esm/mail/templates/DefaultMail.svelte.d.ts +3 -3
- package/esm/storeItem.d.ts +1 -2
- package/esm/storeList.d.ts +4 -3
- package/esm/storeList.js +20 -10
- package/esm/ui/Clipboardable.svelte.d.ts +1 -1
- package/esm/ui/Field.svelte +9 -3
- package/esm/ui/Field.svelte.d.ts +3 -2
- package/esm/ui/FieldGroup.svelte +4 -2
- package/esm/ui/FieldGroup.svelte.d.ts +1 -1
- package/esm/ui/Grid.svelte +90 -20
- package/esm/ui/Grid.svelte.d.ts +6 -5
- package/esm/ui/GridLoading.svelte.d.ts +1 -1
- package/esm/ui/GridPaginate.svelte +6 -4
- 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.d.ts +2 -2
- package/esm/ui/dialog/DialogPrimitive.svelte +1 -5
- package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +3 -3
- package/esm/ui/dialog/dialog.d.ts +10 -8
- package/esm/ui/dialog/dialog.js +9 -10
- package/esm/ui/internals/FieldContainer.svelte.d.ts +6 -6
- package/esm/ui/internals/Input.svelte +10 -1
- package/esm/ui/internals/Input.svelte.d.ts +1 -1
- 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 +41 -29
- 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 +3 -3
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';
|
|
@@ -10,6 +9,7 @@ import { storeItem } from './storeItem.js';
|
|
|
10
9
|
import { storeList } from './storeList.js';
|
|
11
10
|
import { default as Button } from './ui/Button.svelte';
|
|
12
11
|
import { default as Clipboardable } from './ui/Clipboardable.svelte';
|
|
12
|
+
import type { dialog } from './ui/dialog/dialog.js';
|
|
13
13
|
import { default as DialogManagement } from './ui/dialog/DialogManagement.svelte';
|
|
14
14
|
import { default as FormEditAction } from './ui/dialog/FormEditAction.svelte';
|
|
15
15
|
import { default as Field } from './ui/Field.svelte';
|
|
@@ -43,7 +43,7 @@ export { FF_Entity } from './FF_Entity.js';
|
|
|
43
43
|
export { FF_LogToConsole } from './SqlDatabase/FF_LogToConsole.js';
|
|
44
44
|
export { BaseEnum } from './BaseEnum.js';
|
|
45
45
|
export { dialog } from './ui/dialog/dialog.js';
|
|
46
|
-
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, } from './helper.js';
|
|
46
|
+
export { getEntityDisplayValue, isError, getFieldLinkDisplayValue, getEnum, getEnums, upsert, onDelete, } from './helper.js';
|
|
47
47
|
export { buildWhere, getPlaceholder, buildSearchWhere, cellsBuildor, cellBuildor, fieldsOf, containsWords, } from './cellsBuildor.js';
|
|
48
48
|
export { storeItem };
|
|
49
49
|
export { storeList };
|
|
@@ -72,7 +72,11 @@ declare module 'remult' {
|
|
|
72
72
|
href?: (item: entityType) => string;
|
|
73
73
|
findOptionsForEdit?: ((entity: entityType) => FindOptionsBase<valueType>) | FindOptionsBase<valueType>;
|
|
74
74
|
findOptionsLimit?: number;
|
|
75
|
-
createOptionWhenNoResult?:
|
|
75
|
+
createOptionWhenNoResult?: {
|
|
76
|
+
onCreateRequest: (item: entityType, strCreateNew: string) => Parameters<typeof dialog.form>;
|
|
77
|
+
onSuccess: (entity: entityType, newItem: any) => Promise<void>;
|
|
78
|
+
onError?: () => void;
|
|
79
|
+
};
|
|
76
80
|
multiSelect?: boolean;
|
|
77
81
|
skipForDefaultField?: boolean;
|
|
78
82
|
}
|
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, upsert, 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 };
|
package/esm/mail/index.js
CHANGED
|
@@ -14,16 +14,21 @@ export const mailInit = async (nodemailer, o) => {
|
|
|
14
14
|
else {
|
|
15
15
|
try {
|
|
16
16
|
nodemailer.createTestAccount(globalOptions?.apiUrl ?? '', (err, account) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
if (account) {
|
|
18
|
+
globalOptions = { ...globalOptions, from: account.user };
|
|
19
|
+
transporter = nodemailer.createTransport({
|
|
20
|
+
host: account.smtp.host,
|
|
21
|
+
port: account.smtp.port,
|
|
22
|
+
secure: account.smtp.secure,
|
|
23
|
+
auth: {
|
|
24
|
+
user: account.user,
|
|
25
|
+
pass: account.pass,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
log.error("Error nodemailer.createTestAccount() can't be done.");
|
|
31
|
+
}
|
|
27
32
|
});
|
|
28
33
|
}
|
|
29
34
|
catch (error) {
|
|
@@ -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,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import type { FindOptions, Repository } from 'remult';
|
|
1
|
+
import type { FindOptions, GroupByOptions, MembersOnly, Repository } from 'remult';
|
|
3
2
|
type TheStoreList<T> = {
|
|
4
3
|
items: T[];
|
|
5
4
|
loading: boolean;
|
|
6
5
|
totalCount: number | undefined;
|
|
6
|
+
agg: any | undefined;
|
|
7
7
|
};
|
|
8
8
|
export type FF_FindOptions<T> = FindOptions<T> & {
|
|
9
9
|
withCount?: boolean;
|
|
10
10
|
withItems?: boolean;
|
|
11
|
+
aggregate?: GroupByOptions<T, (keyof MembersOnly<T>)[], any, any, any, any, any>;
|
|
11
12
|
};
|
|
12
13
|
/**
|
|
13
14
|
* @param repo remult repository to listen to
|
|
@@ -26,7 +27,7 @@ export type FF_FindOptions<T> = FindOptions<T> & {
|
|
|
26
27
|
export declare const storeList: <T>(repo: Repository<T>, initValues?: TheStoreList<T>) => {
|
|
27
28
|
subscribe: (this: void, run: import("svelte/store").Subscriber<TheStoreList<T>>, invalidate?: import("svelte/store").Invalidator<TheStoreList<T>> | undefined) => import("svelte/store").Unsubscriber;
|
|
28
29
|
manualSet: (info: TheStoreList<T>) => void;
|
|
29
|
-
fetch: (options?: FF_FindOptions<T>, onNewData?: (
|
|
30
|
+
fetch: (options?: FF_FindOptions<T>, onNewData?: (items?: T[], totalCount?: number) => void) => Promise<void>;
|
|
30
31
|
listen: (options?: FF_FindOptions<T>) => Promise<void>;
|
|
31
32
|
getRepo: () => Repository<T>;
|
|
32
33
|
};
|
package/esm/storeList.js
CHANGED
|
@@ -15,7 +15,7 @@ import { writable } from 'svelte/store';
|
|
|
15
15
|
* $: browser && tasks.listen(data.options)
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
|
-
export const storeList = (repo, initValues = { items: [], loading: true, totalCount: undefined }) => {
|
|
18
|
+
export const storeList = (repo, initValues = { items: [], loading: true, totalCount: undefined, agg: undefined }) => {
|
|
19
19
|
const { subscribe, set, update } = writable(initValues);
|
|
20
20
|
let unSub = null;
|
|
21
21
|
onDestroy(async () => {
|
|
@@ -43,27 +43,36 @@ export const storeList = (repo, initValues = { items: [], loading: true, totalCo
|
|
|
43
43
|
throw new Error(`xxx.fetch() withItems and withCount can't be both false!`);
|
|
44
44
|
}
|
|
45
45
|
else if (!withItems && withCount) {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
let optionsToUse = { where: options?.where };
|
|
47
|
+
if (options?.aggregate) {
|
|
48
|
+
optionsToUse = { ...options.aggregate, where: options?.where };
|
|
49
|
+
}
|
|
50
|
+
// const agg = await repo.aggregate({ ...options?.aggregate, where: options?.where })
|
|
51
|
+
const agg = await repo.aggregate(optionsToUse);
|
|
52
|
+
set({ loading: false, items: [], totalCount: agg.$count, agg });
|
|
48
53
|
if (onNewData) {
|
|
49
|
-
onNewData(undefined,
|
|
54
|
+
onNewData(undefined, agg.$count);
|
|
50
55
|
}
|
|
51
56
|
}
|
|
52
57
|
else if (withItems && !withCount) {
|
|
53
58
|
const items = await repo.find(options);
|
|
54
|
-
set({ loading: false, items, totalCount: undefined });
|
|
59
|
+
set({ loading: false, items, totalCount: undefined, agg: undefined });
|
|
55
60
|
if (onNewData) {
|
|
56
61
|
onNewData(items, undefined);
|
|
57
62
|
}
|
|
58
63
|
}
|
|
59
64
|
else {
|
|
60
|
-
|
|
65
|
+
let optionsToUse = { where: options?.where };
|
|
66
|
+
if (options?.aggregate) {
|
|
67
|
+
optionsToUse = { ...options.aggregate, where: options?.where };
|
|
68
|
+
}
|
|
69
|
+
const [items, agg] = await Promise.all([
|
|
61
70
|
repo.find({ ...options }),
|
|
62
|
-
repo.
|
|
71
|
+
repo.aggregate(optionsToUse),
|
|
63
72
|
]);
|
|
64
|
-
set({ loading: false, items, totalCount });
|
|
73
|
+
set({ loading: false, items, totalCount: agg.$count, agg });
|
|
65
74
|
if (onNewData) {
|
|
66
|
-
onNewData(items,
|
|
75
|
+
onNewData(items, agg.$count);
|
|
67
76
|
}
|
|
68
77
|
}
|
|
69
78
|
}
|
|
@@ -75,7 +84,8 @@ export const storeList = (repo, initValues = { items: [], loading: true, totalCo
|
|
|
75
84
|
const withCount = options?.withCount ?? false;
|
|
76
85
|
let totalCount = undefined;
|
|
77
86
|
if (withCount) {
|
|
78
|
-
|
|
87
|
+
const agg = await repo.aggregate({ where: options?.where });
|
|
88
|
+
totalCount = agg.$count;
|
|
79
89
|
}
|
|
80
90
|
update((c) => {
|
|
81
91
|
return { ...c, items: info.items, loading: false, ...(withCount ? { totalCount } : {}) };
|
|
@@ -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
|
@@ -101,7 +101,8 @@ const getLoadOptions = async (cellsValues2, str) => {
|
|
|
101
101
|
);
|
|
102
102
|
let totalCount = arr.length;
|
|
103
103
|
if (totalCount === limit) {
|
|
104
|
-
|
|
104
|
+
const agg = await metaTypeObj.repoTarget.aggregate({ where: findToUse.where });
|
|
105
|
+
totalCount = agg.$count;
|
|
105
106
|
}
|
|
106
107
|
if (!cell.field?.options.multiSelect) {
|
|
107
108
|
if (str === "" && getId() && !arr.find((r) => String(r.id) === String(getId()))) {
|
|
@@ -196,7 +197,7 @@ const calcSuffix = (value2) => {
|
|
|
196
197
|
on:issue={(e) => {
|
|
197
198
|
error = e.detail
|
|
198
199
|
}}
|
|
199
|
-
createOptionWhenNoResult={cell.field?.options.createOptionWhenNoResult}
|
|
200
|
+
createOptionWhenNoResult={!!cell.field?.options.createOptionWhenNoResult}
|
|
200
201
|
on:createRequest
|
|
201
202
|
/>
|
|
202
203
|
{/if}
|
|
@@ -237,7 +238,12 @@ const calcSuffix = (value2) => {
|
|
|
237
238
|
type="checkbox"
|
|
238
239
|
{...{ ...common(cell.field), required: undefined }}
|
|
239
240
|
class="checkbox"
|
|
240
|
-
|
|
241
|
+
checked={value}
|
|
242
|
+
on:input={(e) => {
|
|
243
|
+
// @ts-ignore
|
|
244
|
+
value = e.target.checked
|
|
245
|
+
dispatchSelected(value)
|
|
246
|
+
}}
|
|
241
247
|
/>
|
|
242
248
|
</div>
|
|
243
249
|
{:else if metaType.subKind === 'text' || metaType.subKind === 'email' || metaType.subKind === 'password' || metaType.subKind === 'dateOnly' || metaType.subKind === 'number'}
|
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;
|
package/esm/ui/FieldGroup.svelte
CHANGED
|
@@ -10,9 +10,11 @@ export let store;
|
|
|
10
10
|
export let focusKey = null;
|
|
11
11
|
const getError = (errors, field) => {
|
|
12
12
|
const fo = getRelationFieldInfo(field);
|
|
13
|
-
const keyToUse = fo?.options?.field
|
|
14
|
-
if (errors && errors[keyToUse]) {
|
|
13
|
+
const keyToUse = fo?.options?.field;
|
|
14
|
+
if (errors && keyToUse && errors[keyToUse]) {
|
|
15
15
|
return errors[keyToUse];
|
|
16
|
+
} else if (errors && errors[field.key]) {
|
|
17
|
+
return errors[field.key];
|
|
16
18
|
}
|
|
17
19
|
return void 0;
|
|
18
20
|
};
|
|
@@ -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
CHANGED
|
@@ -31,6 +31,7 @@ export let classes = {
|
|
|
31
31
|
};
|
|
32
32
|
export let orderBy = void 0;
|
|
33
33
|
export let orderByCols = void 0;
|
|
34
|
+
export let settingsLeft = false;
|
|
34
35
|
export let dicoNoResult = "Aucun r\xE9sultat !";
|
|
35
36
|
const dispatch = createEventDispatcher();
|
|
36
37
|
const sorting = (toSort, b) => {
|
|
@@ -62,19 +63,55 @@ const sortingIcon = (toSort, b, _orderBy) => {
|
|
|
62
63
|
const cellsToTake = (cells2) => {
|
|
63
64
|
return cells2.filter((c) => c.modeView !== "hide");
|
|
64
65
|
};
|
|
66
|
+
const classForRounding = (i) => {
|
|
67
|
+
if (settingsLeft && (withEdit || withDelete || withAdd)) {
|
|
68
|
+
if (i === 0) {
|
|
69
|
+
return "";
|
|
70
|
+
} else if (i === cells.length - 1) {
|
|
71
|
+
return "rounded-tr-lg";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (!settingsLeft && (withEdit || withDelete || withAdd)) {
|
|
75
|
+
if (i === 0) {
|
|
76
|
+
return "rounded-tl-lg";
|
|
77
|
+
} else if (i === cells.length - 1) {
|
|
78
|
+
return "";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (i === 0) {
|
|
82
|
+
return "rounded-tl-lg";
|
|
83
|
+
} else if (i === cells.length - 1) {
|
|
84
|
+
return "rounded-tr-lg";
|
|
85
|
+
}
|
|
86
|
+
};
|
|
65
87
|
</script>
|
|
66
88
|
|
|
67
89
|
<div class="overflow-x-auto">
|
|
68
90
|
<table class="table {classes.table}">
|
|
69
91
|
<thead>
|
|
70
92
|
<tr>
|
|
93
|
+
{#if settingsLeft && (withEdit || withDelete || withAdd)}
|
|
94
|
+
<th class="rounded-tl-lg">
|
|
95
|
+
<div class="flex justify-start">
|
|
96
|
+
{#if !withAdd}
|
|
97
|
+
<Icon data={LibIcon_Settings}></Icon>
|
|
98
|
+
{:else}
|
|
99
|
+
<Button
|
|
100
|
+
permission={store.getRepo().metadata.options.permissionApiInsert}
|
|
101
|
+
disabled={!store.getRepo().metadata.apiInsertAllowed()}
|
|
102
|
+
class="btn btn-square btn-ghost btn-xs"
|
|
103
|
+
on:click={() => dispatch('add', {})}
|
|
104
|
+
>
|
|
105
|
+
<Icon data={LibIcon_Add} />
|
|
106
|
+
</Button>
|
|
107
|
+
{/if}
|
|
108
|
+
</div>
|
|
109
|
+
</th>
|
|
110
|
+
{/if}
|
|
111
|
+
|
|
71
112
|
{#each cellsToTake(cells) as b, i}
|
|
72
113
|
{@const al = align(b.field, b.kind === 'slot')}
|
|
73
|
-
<th
|
|
74
|
-
class="{al}
|
|
75
|
-
{i === 0 ? 'rounded-tl-lg' : ''}
|
|
76
|
-
{i === cells.length - 1 && !withEdit && !withDelete ? 'rounded-tr-lg' : ''}"
|
|
77
|
-
>
|
|
114
|
+
<th class="{al} {classForRounding(i)}">
|
|
78
115
|
{#if b.headerSlot}
|
|
79
116
|
<slot name="header" field={b.field} />
|
|
80
117
|
{:else}
|
|
@@ -98,20 +135,22 @@ const cellsToTake = (cells2) => {
|
|
|
98
135
|
</th>
|
|
99
136
|
{/each}
|
|
100
137
|
|
|
101
|
-
{#if withEdit || withDelete || withAdd}
|
|
102
|
-
<th class="
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
138
|
+
{#if !settingsLeft && (withEdit || withDelete || withAdd)}
|
|
139
|
+
<th class="rounded-tr-lg">
|
|
140
|
+
<div class="flex justify-end">
|
|
141
|
+
{#if withAdd}
|
|
142
|
+
<Button
|
|
143
|
+
permission={store.getRepo().metadata.options.permissionApiInsert}
|
|
144
|
+
disabled={!store.getRepo().metadata.apiInsertAllowed()}
|
|
145
|
+
class="btn btn-square btn-ghost btn-xs"
|
|
146
|
+
on:click={() => dispatch('add', {})}
|
|
147
|
+
>
|
|
148
|
+
<Icon data={LibIcon_Add} />
|
|
149
|
+
</Button>
|
|
150
|
+
{:else}
|
|
151
|
+
<Icon data={LibIcon_Settings}></Icon>
|
|
152
|
+
{/if}
|
|
153
|
+
</div>
|
|
115
154
|
</th>
|
|
116
155
|
{/if}
|
|
117
156
|
</tr>
|
|
@@ -123,6 +162,34 @@ const cellsToTake = (cells2) => {
|
|
|
123
162
|
{:else}
|
|
124
163
|
{#each $store.items as row}
|
|
125
164
|
<tr on:click={() => dispatch('rowclick', row)} class="hover:bg-base-content/20">
|
|
165
|
+
<!-- BECARFULL THIS CODE IS DUPLICATED -->
|
|
166
|
+
{#if settingsLeft && (withEdit || withDelete)}
|
|
167
|
+
<td class="text-left">
|
|
168
|
+
<div class="flex justify-start gap-2">
|
|
169
|
+
{#if withEdit}
|
|
170
|
+
<Button
|
|
171
|
+
permission={store.getRepo().metadata.options.permissionApiUpdate}
|
|
172
|
+
disabled={!store.getRepo().metadata.apiUpdateAllowed()}
|
|
173
|
+
class="btn btn-square btn-ghost btn-xs"
|
|
174
|
+
on:click={() => dispatch('edit', row)}
|
|
175
|
+
>
|
|
176
|
+
<Icon data={LibIcon_Edit} />
|
|
177
|
+
</Button>
|
|
178
|
+
{/if}
|
|
179
|
+
{#if withDelete}
|
|
180
|
+
<Button
|
|
181
|
+
permission={store.getRepo().metadata.options.permissionApiDelete}
|
|
182
|
+
disabled={!store.getRepo().metadata.apiDeleteAllowed()}
|
|
183
|
+
class="btn btn-square btn-ghost btn-xs"
|
|
184
|
+
on:click={() => dispatch('delete', row)}
|
|
185
|
+
>
|
|
186
|
+
<Icon data={LibIcon_Delete} />
|
|
187
|
+
</Button>
|
|
188
|
+
{/if}
|
|
189
|
+
</div>
|
|
190
|
+
</td>
|
|
191
|
+
{/if}
|
|
192
|
+
|
|
126
193
|
{#each cellsToTake(cells) as b}
|
|
127
194
|
{@const metaType = getFieldMetaType(b.field)}
|
|
128
195
|
<td class={align(b.field, b.kind === 'slot')}>
|
|
@@ -153,6 +220,8 @@ const cellsToTake = (cells2) => {
|
|
|
153
220
|
href: b.field?.options?.href ? b.field?.options.href(row) : item?.href,
|
|
154
221
|
}}
|
|
155
222
|
/>
|
|
223
|
+
{:else if b.kind === 'baseItem'}
|
|
224
|
+
<LinkPlus item={row[metaType.field.key]} />
|
|
156
225
|
{:else if b.kind === 'field_link'}
|
|
157
226
|
{@const item = getFieldLinkDisplayValue(metaType.field, row)}
|
|
158
227
|
<LinkPlus {item} />
|
|
@@ -191,7 +260,8 @@ const cellsToTake = (cells2) => {
|
|
|
191
260
|
{/if}
|
|
192
261
|
</td>
|
|
193
262
|
{/each}
|
|
194
|
-
|
|
263
|
+
|
|
264
|
+
{#if !settingsLeft && (withEdit || withDelete)}
|
|
195
265
|
<td class="text-right">
|
|
196
266
|
<div class="flex justify-end gap-2">
|
|
197
267
|
{#if withEdit}
|
package/esm/ui/Grid.svelte.d.ts
CHANGED
|
@@ -6,16 +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
|
-
|
|
18
|
+
settingsLeft?: boolean;
|
|
19
|
+
dicoNoResult?: string;
|
|
19
20
|
};
|
|
20
21
|
events(): {
|
|
21
22
|
refresh: any;
|
|
@@ -24,9 +24,11 @@ $: canGoNext = isValidValue && needPaginate && pageDisplayed < Math.ceil((totalC
|
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
<FieldContainer {label} forId="paginate" classes={{ label: 'justify-end' }}>
|
|
27
|
-
<div class="flex items-center justify-end">
|
|
27
|
+
<div class="flex w-36 items-center justify-end">
|
|
28
28
|
{#if totalCount === undefined}
|
|
29
|
-
<Loading class="
|
|
29
|
+
<Loading class="ml-6 mr-2 h-3 w-1/6"></Loading>
|
|
30
|
+
<Loading class="mx-2 h-4 w-1/2"></Loading>
|
|
31
|
+
<Loading class="mx-2 h-3 w-1/6"></Loading>
|
|
30
32
|
{:else if !needPaginate}
|
|
31
33
|
<span class="text-primary justify-end px-2 font-bold">
|
|
32
34
|
{totalCount}
|
|
@@ -36,7 +38,7 @@ $: canGoNext = isValidValue && needPaginate && pageDisplayed < Math.ceil((totalC
|
|
|
36
38
|
<button
|
|
37
39
|
aria-label="left"
|
|
38
40
|
on:click={() => update('-')}
|
|
39
|
-
class="btn join-item {pageDisplayed === 1 ? 'btn-disabled' : ''}"
|
|
41
|
+
class="btn join-item p-1 {pageDisplayed === 1 ? 'btn-disabled' : ''}"
|
|
40
42
|
>
|
|
41
43
|
<Icon data={LibIcon_ChevronLeft} />
|
|
42
44
|
</button>
|
|
@@ -53,7 +55,7 @@ $: canGoNext = isValidValue && needPaginate && pageDisplayed < Math.ceil((totalC
|
|
|
53
55
|
<button
|
|
54
56
|
aria-label="right"
|
|
55
57
|
on:click={() => update('+')}
|
|
56
|
-
class="btn join-item {!canGoNext ? 'btn-disabled' : ''}"
|
|
58
|
+
class="btn join-item p-1 {!canGoNext ? 'btn-disabled' : ''}"
|
|
57
59
|
>
|
|
58
60
|
<Icon data={LibIcon_ChevronRight} />
|
|
59
61
|
</button>
|
|
@@ -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
|
};
|
|
@@ -40,11 +40,7 @@ function dispatchChange(_data) {
|
|
|
40
40
|
/>
|
|
41
41
|
<div
|
|
42
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`,
|
|
43
|
+
`border-base-content/60 bg-base-100 relative z-40 max-h-[90vh] overflow-auto rounded-xl border p-6 shadow-lg`,
|
|
48
44
|
classes.root,
|
|
49
45
|
)}
|
|
50
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>;
|
|
@@ -29,6 +29,15 @@ type ResultClose<entityType = any> = {
|
|
|
29
29
|
item?: entityType;
|
|
30
30
|
};
|
|
31
31
|
export type DialogType = 'custom' | 'confirm' | 'confirmDelete' | 'insert' | 'update' | 'view';
|
|
32
|
+
export type DialogFormType<entityType> = {
|
|
33
|
+
cells?: CellsInput<entityType>;
|
|
34
|
+
defaults?: Partial<entityType>;
|
|
35
|
+
classes?: DialogClasses;
|
|
36
|
+
noThrow?: boolean;
|
|
37
|
+
wDelete?: boolean;
|
|
38
|
+
topicPrefixText?: string;
|
|
39
|
+
focusKey?: string;
|
|
40
|
+
};
|
|
32
41
|
export type DialogMetaDataInternal<entityType = any> = DialogMetaData<entityType> & {
|
|
33
42
|
id: number;
|
|
34
43
|
type: DialogType;
|
|
@@ -37,14 +46,7 @@ export type DialogMetaDataInternal<entityType = any> = DialogMetaData<entityType
|
|
|
37
46
|
export declare const dialog: {
|
|
38
47
|
confirm: (topic: string, text: string, icon?: string) => Promise<ResultClose<any>>;
|
|
39
48
|
confirmDelete: (topic: string) => Promise<ResultClose<any>>;
|
|
40
|
-
form: <entityType>(type:
|
|
41
|
-
defaults?: Partial<entityType>;
|
|
42
|
-
classes?: DialogClasses;
|
|
43
|
-
noThrow?: boolean;
|
|
44
|
-
wDelete?: boolean;
|
|
45
|
-
topicPrefixText?: string;
|
|
46
|
-
focusKey?: string;
|
|
47
|
-
}) => Promise<ResultClose<any>>;
|
|
49
|
+
form: <entityType>(type: "insert" | "update" | "view", topic: string, repo: Repository<entityType>, settings: DialogFormType<entityType>) => Promise<ResultClose<any>>;
|
|
48
50
|
show: (dialog: DialogMetaData) => Promise<ResultClose<any>>;
|
|
49
51
|
close: (id: number, result: ResultClose) => void;
|
|
50
52
|
closeAll: () => void;
|