firstly 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/esm/SqlDatabase/FF_LogToConsole.js +9 -14
- package/esm/carbone/CarboneController.js +2 -1
- package/esm/changeLog/index.d.ts +0 -10
- package/esm/{internals → core}/BaseEnum.d.ts +1 -1
- package/esm/core/FF_Entity.js +5 -0
- package/esm/core/helper.d.ts +2 -0
- package/esm/core/helper.js +3 -0
- package/esm/core/index.d.ts +0 -0
- package/esm/core/index.js +5 -0
- package/esm/core/tailwind.d.ts +21 -0
- package/esm/core/tailwind.js +22 -0
- package/esm/core/tryCatch.d.ts +44 -0
- package/esm/core/tryCatch.js +34 -0
- package/esm/cron/server/index.js +1 -1
- package/esm/feedback/FeedbackController.js +3 -2
- package/esm/feedback/index.d.ts +7 -2
- package/esm/feedback/index.js +1 -2
- package/esm/feedback/server/index.d.ts +0 -5
- package/esm/feedback/server/index.js +1 -1
- package/esm/formats/strings.js +2 -2
- package/esm/index.d.ts +16 -0
- package/esm/index.js +13 -0
- package/esm/svelte/FF_Repo.svelte.d.ts +9 -2
- package/esm/svelte/FF_Repo.svelte.js +40 -17
- package/esm/svelte/class/SP.svelte.js +14 -2
- package/esm/svelte/helpers/debounce.js +1 -1
- package/esm/svelte/index.d.ts +2 -24
- package/esm/svelte/index.js +2 -22
- package/esm/{ui → svelte/ui}/Icon.svelte +1 -1
- package/esm/virtual/StateDemoEnum.d.ts +3 -3
- package/esm/virtual/StateDemoEnum.js +3 -3
- package/esm/virtual/UIEntity.js +1 -2
- package/package.json +8 -39
- package/esm/auth/AuthController.d.ts +0 -58
- package/esm/auth/AuthController.js +0 -114
- package/esm/auth/Entities.d.ts +0 -47
- package/esm/auth/Entities.js +0 -182
- package/esm/auth/README.md +0 -3
- package/esm/auth/index.d.ts +0 -5
- package/esm/auth/index.js +0 -5
- package/esm/auth/server/AuthController.server.d.ts +0 -58
- package/esm/auth/server/AuthController.server.js +0 -518
- package/esm/auth/server/handleAuth.d.ts +0 -4
- package/esm/auth/server/handleAuth.js +0 -142
- package/esm/auth/server/handleGuard.d.ts +0 -22
- package/esm/auth/server/handleGuard.js +0 -34
- package/esm/auth/server/helperDb.d.ts +0 -10
- package/esm/auth/server/helperDb.js +0 -56
- package/esm/auth/server/helperFirstly.d.ts +0 -1
- package/esm/auth/server/helperFirstly.js +0 -9
- package/esm/auth/server/helperOslo.d.ts +0 -7
- package/esm/auth/server/helperOslo.js +0 -24
- package/esm/auth/server/helperRemultServer.d.ts +0 -5
- package/esm/auth/server/helperRemultServer.js +0 -44
- package/esm/auth/server/helperRole.d.ts +0 -19
- package/esm/auth/server/helperRole.js +0 -57
- package/esm/auth/server/index.d.ts +0 -8
- package/esm/auth/server/index.js +0 -8
- package/esm/auth/server/module.d.ts +0 -300
- package/esm/auth/server/module.js +0 -230
- package/esm/auth/server/providers/github.d.ts +0 -33
- package/esm/auth/server/providers/github.js +0 -87
- package/esm/auth/server/providers/helperProvider.d.ts +0 -1
- package/esm/auth/server/providers/helperProvider.js +0 -25
- package/esm/auth/static/assets/Page-BHW08QWz.css +0 -1
- package/esm/auth/static/assets/Page-BRNWcY5Z.d.ts +0 -2
- package/esm/auth/static/assets/Page-BRNWcY5Z.js +0 -1
- package/esm/auth/static/assets/Page-CFcEsGK8.d.ts +0 -2
- package/esm/auth/static/assets/Page-CFcEsGK8.js +0 -7
- package/esm/auth/static/assets/Page-tLVs5slF.d.ts +0 -2
- package/esm/auth/static/assets/Page-tLVs5slF.js +0 -1
- package/esm/auth/static/assets/index-D38rqu4x.d.ts +0 -201
- package/esm/auth/static/assets/index-D38rqu4x.js +0 -2
- package/esm/auth/static/assets/index-DKWpA6v7.css +0 -4
- package/esm/auth/static/favicon.svg +0 -79
- package/esm/auth/static/index.html +0 -13
- package/esm/auth/types.d.ts +0 -73
- package/esm/bin/cmd.d.ts +0 -1
- package/esm/bin/cmd.js +0 -793
- package/esm/feedback/ui/DialogIssue.svelte +0 -149
- package/esm/feedback/ui/DialogIssue.svelte.d.ts +0 -22
- package/esm/feedback/ui/DialogIssues.svelte +0 -114
- package/esm/feedback/ui/DialogIssues.svelte.d.ts +0 -22
- package/esm/feedback/ui/DialogMilestones.svelte +0 -43
- package/esm/feedback/ui/DialogMilestones.svelte.d.ts +0 -20
- package/esm/feedback/ui/Feedback.svelte +0 -16
- package/esm/feedback/ui/Feedback.svelte.d.ts +0 -18
- package/esm/internals/FF_Entity.d.ts +0 -2
- package/esm/internals/FF_Entity.js +0 -21
- package/esm/internals/FF_Fields.d.ts +0 -11
- package/esm/internals/FF_Fields.js +0 -144
- package/esm/internals/cellsBuildor.d.ts +0 -47
- package/esm/internals/cellsBuildor.js +0 -140
- package/esm/internals/helper.d.ts +0 -49
- package/esm/internals/helper.js +0 -162
- package/esm/internals/index.d.ts +0 -82
- package/esm/internals/index.js +0 -45
- package/esm/internals/storeItem.d.ts +0 -28
- package/esm/internals/storeItem.js +0 -176
- package/esm/internals/storeList.d.ts +0 -34
- package/esm/internals/storeList.js +0 -108
- package/esm/internals/theme.d.ts +0 -4
- package/esm/internals/theme.js +0 -4
- package/esm/server/index.d.ts +0 -52
- package/esm/server/index.js +0 -87
- package/esm/svelte/FF_Cell.svelte +0 -103
- package/esm/svelte/FF_Cell.svelte.d.ts +0 -33
- package/esm/svelte/FF_Cell_Caption.svelte +0 -20
- package/esm/svelte/FF_Cell_Caption.svelte.d.ts +0 -31
- package/esm/svelte/FF_Cell_Display.svelte +0 -61
- package/esm/svelte/FF_Cell_Display.svelte.d.ts +0 -29
- package/esm/svelte/FF_Cell_Edit.svelte +0 -104
- package/esm/svelte/FF_Cell_Edit.svelte.d.ts +0 -32
- package/esm/svelte/FF_Cell_Error.svelte +0 -20
- package/esm/svelte/FF_Cell_Error.svelte.d.ts +0 -31
- package/esm/svelte/FF_Cell_Hint.svelte +0 -20
- package/esm/svelte/FF_Cell_Hint.svelte.d.ts +0 -31
- package/esm/svelte/FF_Config.svelte +0 -29
- package/esm/svelte/FF_Config.svelte.d.ts +0 -9
- package/esm/svelte/FF_Form.svelte +0 -155
- package/esm/svelte/FF_Form.svelte.d.ts +0 -37
- package/esm/svelte/FF_Grid.svelte +0 -257
- package/esm/svelte/FF_Grid.svelte.d.ts +0 -37
- package/esm/svelte/FF_Layout.svelte +0 -62
- package/esm/svelte/FF_Layout.svelte.d.ts +0 -31
- package/esm/svelte/actions/intersection.d.ts +0 -6
- package/esm/svelte/actions/intersection.js +0 -17
- package/esm/svelte/customField.d.ts +0 -69
- package/esm/svelte/customField.js +0 -4
- package/esm/svelte/dialog/DialogManagement.svelte +0 -98
- package/esm/svelte/dialog/DialogManagement.svelte.d.ts +0 -18
- package/esm/svelte/dialog/DialogPrimitive.svelte +0 -156
- package/esm/svelte/dialog/DialogPrimitive.svelte.d.ts +0 -38
- package/esm/svelte/dialog/dialog.d.ts +0 -58
- package/esm/svelte/dialog/dialog.js +0 -130
- package/esm/svelte/ff_Config.svelte.d.ts +0 -91
- package/esm/svelte/ff_Config.svelte.js +0 -111
- package/esm/svelte/firstly.css +0 -14
- package/esm/svelte/helpers.d.ts +0 -30
- package/esm/svelte/helpers.js +0 -38
- package/esm/svelte/tryCatch.d.ts +0 -12
- package/esm/svelte/tryCatch.js +0 -18
- package/esm/sveltekit/server/index.d.ts +0 -5
- package/esm/sveltekit/server/index.js +0 -24
- package/esm/ui/Button.svelte +0 -138
- package/esm/ui/Button.svelte.d.ts +0 -13
- package/esm/ui/Clipboardable.svelte +0 -25
- package/esm/ui/Clipboardable.svelte.d.ts +0 -12
- package/esm/ui/Field.svelte +0 -382
- package/esm/ui/Field.svelte.d.ts +0 -40
- package/esm/ui/FieldGroup.svelte +0 -117
- package/esm/ui/FieldGroup.svelte.d.ts +0 -44
- package/esm/ui/Grid.svelte +0 -265
- package/esm/ui/Grid.svelte.d.ts +0 -57
- package/esm/ui/Grid2.svelte +0 -293
- package/esm/ui/Grid2.svelte.d.ts +0 -57
- package/esm/ui/GridLoading.svelte +0 -58
- package/esm/ui/GridLoading.svelte.d.ts +0 -23
- package/esm/ui/GridPaginate.svelte +0 -69
- package/esm/ui/GridPaginate.svelte.d.ts +0 -23
- package/esm/ui/GridPaginate2.svelte +0 -25
- package/esm/ui/GridPaginate2.svelte.d.ts +0 -7
- package/esm/ui/Loading.svelte +0 -16
- package/esm/ui/Loading.svelte.d.ts +0 -31
- package/esm/ui/Tooltip.svelte +0 -45
- package/esm/ui/Tooltip.svelte.d.ts +0 -32
- package/esm/ui/dialog/DialogForm.svelte +0 -76
- package/esm/ui/dialog/DialogForm.svelte.d.ts +0 -21
- package/esm/ui/dialog/DialogManagement.svelte +0 -96
- package/esm/ui/dialog/DialogManagement.svelte.d.ts +0 -26
- package/esm/ui/dialog/DialogPrimitive.svelte +0 -90
- package/esm/ui/dialog/DialogPrimitive.svelte.d.ts +0 -38
- package/esm/ui/dialog/FormEditAction.svelte +0 -62
- package/esm/ui/dialog/FormEditAction.svelte.d.ts +0 -31
- package/esm/ui/dialog/dialog.d.ts +0 -60
- package/esm/ui/dialog/dialog.js +0 -100
- package/esm/ui/index.d.ts +0 -6
- package/esm/ui/index.js +0 -20
- package/esm/ui/internals/FieldContainer.svelte +0 -39
- package/esm/ui/internals/FieldContainer.svelte.d.ts +0 -18
- package/esm/ui/internals/Input.svelte +0 -143
- package/esm/ui/internals/Input.svelte.d.ts +0 -37
- package/esm/ui/internals/Textarea.svelte +0 -66
- package/esm/ui/internals/Textarea.svelte.d.ts +0 -33
- package/esm/ui/internals/select/MultiSelectMelt.svelte +0 -260
- package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +0 -32
- package/esm/ui/internals/select/Select2.svelte +0 -88
- package/esm/ui/internals/select/Select2.svelte.d.ts +0 -12
- package/esm/ui/internals/select/SelectMelt.svelte +0 -280
- package/esm/ui/internals/select/SelectMelt.svelte.d.ts +0 -40
- package/esm/ui/internals/select/SelectRadio.svelte +0 -43
- package/esm/ui/internals/select/SelectRadio.svelte.d.ts +0 -27
- package/esm/ui/link/Link.svelte +0 -33
- package/esm/ui/link/Link.svelte.d.ts +0 -33
- package/esm/ui/link/LinkPlus.svelte +0 -63
- package/esm/ui/link/LinkPlus.svelte.d.ts +0 -9
- package/esm/utils/tailwind.d.ts +0 -2
- package/esm/utils/tailwind.js +0 -3
- package/esm/utils/transition.d.ts +0 -9
- package/esm/utils/transition.js +0 -33
- package/esm/utils/types.js +0 -1
- /package/esm/{internals → core}/BaseEnum.js +0 -0
- /package/esm/{internals → core}/common.d.ts +0 -0
- /package/esm/{internals → core}/common.js +0 -0
- /package/esm/{utils → core}/types.d.ts +0 -0
- /package/esm/{auth → core}/types.js +0 -0
- /package/esm/{ui → svelte/ui}/Icon.svelte.d.ts +0 -0
- /package/esm/{ui → svelte/ui}/LibIcon.d.ts +0 -0
- /package/esm/{ui → svelte/ui}/LibIcon.js +0 -0
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { writable } from 'svelte/store';
|
|
2
|
-
import {} from 'remult';
|
|
3
|
-
import { LibIcon_Add, LibIcon_Delete, LibIcon_Edit, LibIcon_Search, } from '../../internals';
|
|
4
|
-
const createDialogManagement = () => {
|
|
5
|
-
const { subscribe, update } = writable([]);
|
|
6
|
-
// internal...
|
|
7
|
-
const show = (dialog, type) => {
|
|
8
|
-
let resolve;
|
|
9
|
-
const promise = new Promise((res) => {
|
|
10
|
-
resolve = res;
|
|
11
|
-
});
|
|
12
|
-
update((dialogs) => {
|
|
13
|
-
return [...dialogs, { ...dialog, id: dialogs.length + 1, resolve, type }];
|
|
14
|
-
});
|
|
15
|
-
return promise;
|
|
16
|
-
};
|
|
17
|
-
return {
|
|
18
|
-
confirm: (topic, text, icon) => {
|
|
19
|
-
const detail = {
|
|
20
|
-
detail: {
|
|
21
|
-
caption: 'A Confirmer',
|
|
22
|
-
icon: { data: icon },
|
|
23
|
-
},
|
|
24
|
-
children: `
|
|
25
|
-
<p>
|
|
26
|
-
${topic}
|
|
27
|
-
<br />
|
|
28
|
-
${text}
|
|
29
|
-
</p>
|
|
30
|
-
`,
|
|
31
|
-
};
|
|
32
|
-
return show(detail, 'confirm');
|
|
33
|
-
},
|
|
34
|
-
confirmDelete: (topic) => {
|
|
35
|
-
const detail = {
|
|
36
|
-
detail: {
|
|
37
|
-
caption: 'A Supprimer',
|
|
38
|
-
icon: { data: LibIcon_Delete },
|
|
39
|
-
},
|
|
40
|
-
children: topic
|
|
41
|
-
? `<p>Confirmez vous la suppression de: <br />- <b>${topic}</b> ?</p>`
|
|
42
|
-
: 'Confirmer la suppression ?',
|
|
43
|
-
};
|
|
44
|
-
return show(detail, 'confirmDelete');
|
|
45
|
-
},
|
|
46
|
-
form: (type, topic, repo, settings) => {
|
|
47
|
-
const topicPrefixText = settings?.topicPrefixText
|
|
48
|
-
? settings?.topicPrefixText + ' '
|
|
49
|
-
: type === 'insert'
|
|
50
|
-
? `Créer `
|
|
51
|
-
: type === 'update'
|
|
52
|
-
? 'Modifier '
|
|
53
|
-
: 'Détail ';
|
|
54
|
-
const detail = {
|
|
55
|
-
detail: {
|
|
56
|
-
caption: (topicPrefixText + topic).trim(),
|
|
57
|
-
icon: {
|
|
58
|
-
data: type === 'insert' ? LibIcon_Add : type === 'update' ? LibIcon_Edit : LibIcon_Search,
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
repo,
|
|
62
|
-
// store,
|
|
63
|
-
cells: settings.cells ?? [],
|
|
64
|
-
defaults: settings?.defaults,
|
|
65
|
-
classes: settings?.classes,
|
|
66
|
-
reThrow: settings?.reThrow,
|
|
67
|
-
wDelete: settings?.wDelete,
|
|
68
|
-
focusKey: settings?.focusKey,
|
|
69
|
-
topicPrefixText,
|
|
70
|
-
};
|
|
71
|
-
// @ts-ignore
|
|
72
|
-
return show(detail, type);
|
|
73
|
-
},
|
|
74
|
-
fform: (r, settings) => {
|
|
75
|
-
// const topicPrefixText = settings?.topicPrefixText
|
|
76
|
-
// ? settings?.topicPrefixText + ' '
|
|
77
|
-
// : type === 'insert'
|
|
78
|
-
// ? `Créer `
|
|
79
|
-
// : type === 'update'
|
|
80
|
-
// ? 'Modifier '
|
|
81
|
-
// : 'Détail '
|
|
82
|
-
const detail = {
|
|
83
|
-
detail: {
|
|
84
|
-
caption: r.metadata.caption,
|
|
85
|
-
icon: {
|
|
86
|
-
data: LibIcon_Edit,
|
|
87
|
-
// data: type === 'insert' ? LibIcon_Add : type === 'update' ? LibIcon_Edit : LibIcon_Search,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
// repo,
|
|
91
|
-
// store,
|
|
92
|
-
cells: settings.cells ?? [],
|
|
93
|
-
defaults: settings?.defaults,
|
|
94
|
-
classes: settings?.classes,
|
|
95
|
-
reThrow: settings?.reThrow,
|
|
96
|
-
wDelete: settings?.wDelete,
|
|
97
|
-
focusKey: settings?.focusKey,
|
|
98
|
-
r,
|
|
99
|
-
// topicPrefixText,
|
|
100
|
-
};
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
return show(detail, 'fform');
|
|
103
|
-
},
|
|
104
|
-
show: (dialog) => {
|
|
105
|
-
return show(dialog, 'custom');
|
|
106
|
-
},
|
|
107
|
-
// next step, give a result typed!
|
|
108
|
-
close: (id, result) => {
|
|
109
|
-
update((dialogs) => {
|
|
110
|
-
dialogs.forEach((dialog) => {
|
|
111
|
-
if (dialog.id === id) {
|
|
112
|
-
dialog.resolve(result);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
return dialogs.filter((dialog) => dialog.id !== id);
|
|
116
|
-
});
|
|
117
|
-
},
|
|
118
|
-
// usefull on navigation you want to close all popups
|
|
119
|
-
closeAll: () => {
|
|
120
|
-
update((dialogs) => {
|
|
121
|
-
dialogs.forEach((dialog) => {
|
|
122
|
-
dialog.resolve({ success: false });
|
|
123
|
-
});
|
|
124
|
-
return [];
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
subscribe,
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
export const dialog = createDialogManagement();
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { DynamicCustomField } from '.';
|
|
2
|
-
export interface Config {
|
|
3
|
-
theme: Theme;
|
|
4
|
-
dynamicCustomField?: DynamicCustomField;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Theme
|
|
8
|
-
*/
|
|
9
|
-
export interface FieldTheme {
|
|
10
|
-
root?: string;
|
|
11
|
-
error?: string;
|
|
12
|
-
container?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface LabelTheme {
|
|
15
|
-
root?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface ErrorTheme {
|
|
18
|
-
root?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface EditTheme {
|
|
21
|
-
select?: string;
|
|
22
|
-
checkbox?: string;
|
|
23
|
-
input?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface HintTheme {
|
|
26
|
-
root?: string;
|
|
27
|
-
}
|
|
28
|
-
export interface GridTheme {
|
|
29
|
-
root?: string;
|
|
30
|
-
header?: string;
|
|
31
|
-
headerCell?: string;
|
|
32
|
-
row?: string;
|
|
33
|
-
rowCell?: string;
|
|
34
|
-
actions?: string;
|
|
35
|
-
actionButton?: string;
|
|
36
|
-
actionsColumn?: string;
|
|
37
|
-
actionsHeader?: string;
|
|
38
|
-
loadMoreButton?: string;
|
|
39
|
-
}
|
|
40
|
-
export interface FormTheme {
|
|
41
|
-
root?: string;
|
|
42
|
-
groups?: string;
|
|
43
|
-
fields?: string;
|
|
44
|
-
actions?: string;
|
|
45
|
-
submitButton?: string;
|
|
46
|
-
cancelButton?: string;
|
|
47
|
-
}
|
|
48
|
-
export interface DisplayTheme {
|
|
49
|
-
checkbox?: string;
|
|
50
|
-
}
|
|
51
|
-
export interface Theme {
|
|
52
|
-
root?: string;
|
|
53
|
-
field?: FieldTheme;
|
|
54
|
-
label?: LabelTheme;
|
|
55
|
-
error?: ErrorTheme;
|
|
56
|
-
hint?: HintTheme;
|
|
57
|
-
edit?: EditTheme;
|
|
58
|
-
grid?: GridTheme;
|
|
59
|
-
form?: FormTheme;
|
|
60
|
-
display?: DisplayTheme;
|
|
61
|
-
}
|
|
62
|
-
export declare const defaultTheme: Theme;
|
|
63
|
-
export declare const emptyTheme: Theme;
|
|
64
|
-
export declare const daisyTheme: Theme;
|
|
65
|
-
export type FullyDefinedTheme = {
|
|
66
|
-
root: string;
|
|
67
|
-
field: FieldTheme;
|
|
68
|
-
label: LabelTheme;
|
|
69
|
-
error: ErrorTheme;
|
|
70
|
-
hint: HintTheme;
|
|
71
|
-
edit: EditTheme;
|
|
72
|
-
grid: GridTheme;
|
|
73
|
-
form: FormTheme;
|
|
74
|
-
display: DisplayTheme;
|
|
75
|
-
};
|
|
76
|
-
export declare class FF_Theme {
|
|
77
|
-
#private;
|
|
78
|
-
constructor(initialTheme?: Theme);
|
|
79
|
-
setTheme(theme: Theme): void;
|
|
80
|
-
getTheme(): FullyDefinedTheme;
|
|
81
|
-
getClasses<K extends keyof FullyDefinedTheme>(key: K, classes: Partial<FullyDefinedTheme[K]>): FullyDefinedTheme[K];
|
|
82
|
-
}
|
|
83
|
-
export declare function getThemeContext(): FF_Theme;
|
|
84
|
-
export declare function setTheme(theme: Theme): void;
|
|
85
|
-
export declare function getTheme(): FullyDefinedTheme;
|
|
86
|
-
export declare function getClasses<K extends keyof FullyDefinedTheme>(key: K, classes: Partial<FullyDefinedTheme[K]>): FullyDefinedTheme[K];
|
|
87
|
-
/**
|
|
88
|
-
* Dynamic Custom Field
|
|
89
|
-
*/
|
|
90
|
-
export declare function setDynamicCustomField(fn?: DynamicCustomField): void;
|
|
91
|
-
export declare function getDynamicCustomField(): DynamicCustomField | undefined;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { getContext, setContext } from 'svelte';
|
|
2
|
-
import { deepMerge } from '.';
|
|
3
|
-
const THEME_KEY = 'firstly:theme';
|
|
4
|
-
const DYNAMIC_CUSTOM_FIELD_KEY = 'firstly:dynamicCustomField';
|
|
5
|
-
export const defaultTheme = {
|
|
6
|
-
field: {},
|
|
7
|
-
label: {},
|
|
8
|
-
error: {},
|
|
9
|
-
hint: {},
|
|
10
|
-
edit: {},
|
|
11
|
-
grid: {},
|
|
12
|
-
form: {
|
|
13
|
-
actions: 'ff-form-actions',
|
|
14
|
-
},
|
|
15
|
-
display: {},
|
|
16
|
-
};
|
|
17
|
-
export const emptyTheme = {
|
|
18
|
-
field: {},
|
|
19
|
-
label: {},
|
|
20
|
-
error: {},
|
|
21
|
-
hint: {},
|
|
22
|
-
edit: {},
|
|
23
|
-
grid: {},
|
|
24
|
-
form: {},
|
|
25
|
-
display: {},
|
|
26
|
-
};
|
|
27
|
-
export const daisyTheme = {
|
|
28
|
-
field: {
|
|
29
|
-
root: '',
|
|
30
|
-
error: '',
|
|
31
|
-
},
|
|
32
|
-
label: {
|
|
33
|
-
root: '',
|
|
34
|
-
},
|
|
35
|
-
error: {
|
|
36
|
-
root: 'text-error',
|
|
37
|
-
},
|
|
38
|
-
hint: {
|
|
39
|
-
root: 'italic text-sm',
|
|
40
|
-
},
|
|
41
|
-
edit: {
|
|
42
|
-
checkbox: 'checkbox',
|
|
43
|
-
input: 'input',
|
|
44
|
-
select: 'select',
|
|
45
|
-
},
|
|
46
|
-
grid: {
|
|
47
|
-
root: 'table',
|
|
48
|
-
actions: 'flex gap-2 justify-end',
|
|
49
|
-
actionButton: 'text-xs',
|
|
50
|
-
actionsColumn: 'text-right',
|
|
51
|
-
actionsHeader: 'text-right',
|
|
52
|
-
},
|
|
53
|
-
form: {
|
|
54
|
-
root: '',
|
|
55
|
-
fields: '',
|
|
56
|
-
groups: '', // grid grid-cols-1
|
|
57
|
-
actions: 'flex justify-end gap-2 mt-4',
|
|
58
|
-
submitButton: 'btn btn-primary',
|
|
59
|
-
cancelButton: 'btn',
|
|
60
|
-
},
|
|
61
|
-
display: {
|
|
62
|
-
checkbox: 'checkbox',
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
export class FF_Theme {
|
|
66
|
-
#theme = $state(emptyTheme);
|
|
67
|
-
constructor(initialTheme = emptyTheme) {
|
|
68
|
-
this.setTheme(initialTheme);
|
|
69
|
-
}
|
|
70
|
-
setTheme(theme) {
|
|
71
|
-
this.#theme = deepMerge(emptyTheme, theme);
|
|
72
|
-
setContext(THEME_KEY, this);
|
|
73
|
-
}
|
|
74
|
-
getTheme() {
|
|
75
|
-
return deepMerge(emptyTheme, this.#theme);
|
|
76
|
-
}
|
|
77
|
-
getClasses(key, classes) {
|
|
78
|
-
const lvl = this.getTheme()[key];
|
|
79
|
-
return deepMerge(lvl, classes);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
export function getThemeContext() {
|
|
83
|
-
return getContext(THEME_KEY) || new FF_Theme();
|
|
84
|
-
}
|
|
85
|
-
export function setTheme(theme) {
|
|
86
|
-
const themeContext = getContext(THEME_KEY);
|
|
87
|
-
if (themeContext) {
|
|
88
|
-
themeContext.setTheme(theme);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
const newTheme = new FF_Theme(theme);
|
|
92
|
-
setContext(THEME_KEY, newTheme);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
export function getTheme() {
|
|
96
|
-
const themeContext = getThemeContext();
|
|
97
|
-
return themeContext.getTheme();
|
|
98
|
-
}
|
|
99
|
-
export function getClasses(key, classes) {
|
|
100
|
-
const themeContext = getThemeContext();
|
|
101
|
-
return themeContext.getClasses(key, classes);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Dynamic Custom Field
|
|
105
|
-
*/
|
|
106
|
-
export function setDynamicCustomField(fn) {
|
|
107
|
-
setContext(DYNAMIC_CUSTOM_FIELD_KEY, fn);
|
|
108
|
-
}
|
|
109
|
-
export function getDynamicCustomField() {
|
|
110
|
-
return getContext(DYNAMIC_CUSTOM_FIELD_KEY);
|
|
111
|
-
}
|
package/esm/svelte/firstly.css
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
* {
|
|
2
|
-
--ff-spacing: 0.5rem;
|
|
3
|
-
|
|
4
|
-
--ff-dialog-overlay: red;
|
|
5
|
-
--ff-dialog-content: blue;
|
|
6
|
-
|
|
7
|
-
@media screen and (max-width: 40rem) {
|
|
8
|
-
--ff-spacing: 0.15rem;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/* [data-ff-cells] > [data-ff-cell][data-ff-cells] {
|
|
13
|
-
padding: var(--ff-spacing) 0;
|
|
14
|
-
} */
|
package/esm/svelte/helpers.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { FieldMetadata, FieldOptions } from 'remult';
|
|
2
|
-
export declare function deepMerge<T>(target: T, source: Partial<T>): T;
|
|
3
|
-
export declare function overwriteOptions<valueType = unknown, entityType = unknown>(field: FieldMetadata<valueType, entityType>, options: FieldOptions<entityType, valueType>): {
|
|
4
|
-
options: FieldOptions<unknown, unknown>;
|
|
5
|
-
valueType: any;
|
|
6
|
-
key: entityType extends object ? keyof entityType & string : string;
|
|
7
|
-
caption: string;
|
|
8
|
-
label: string;
|
|
9
|
-
dbName: string;
|
|
10
|
-
inputType: string;
|
|
11
|
-
allowNull: boolean;
|
|
12
|
-
target: import("remult").ClassType<valueType>;
|
|
13
|
-
getDbName(): Promise<string>;
|
|
14
|
-
isServerExpression: boolean;
|
|
15
|
-
dbReadOnly: boolean;
|
|
16
|
-
valueConverter: Required<import("remult").ValueConverter<valueType>>;
|
|
17
|
-
displayValue(item: Partial<entityType>): string;
|
|
18
|
-
apiUpdateAllowed(item?: Partial<entityType> | undefined): boolean;
|
|
19
|
-
includedInApi(item?: Partial<entityType> | undefined): boolean;
|
|
20
|
-
toInput(value: valueType, inputType?: string): string;
|
|
21
|
-
fromInput(inputValue: string, inputType?: string): valueType;
|
|
22
|
-
};
|
|
23
|
-
type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
24
|
-
/** You MUST add the T type to the function call
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* isOfType<ComponentObject>(obj, 'component')
|
|
28
|
-
*/
|
|
29
|
-
export declare function isOfType<T, U = unknown>(value: T | U, property: keyof NoInfer<T> & string): value is T;
|
|
30
|
-
export {};
|
package/esm/svelte/helpers.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export function deepMerge(target, source) {
|
|
2
|
-
const result = { ...target };
|
|
3
|
-
if (source && typeof source === 'object' && !Array.isArray(source)) {
|
|
4
|
-
Object.keys(source).forEach((key) => {
|
|
5
|
-
const sourceValue = source[key];
|
|
6
|
-
const targetValue = target[key];
|
|
7
|
-
if (sourceValue &&
|
|
8
|
-
typeof sourceValue === 'object' &&
|
|
9
|
-
!Array.isArray(sourceValue) &&
|
|
10
|
-
targetValue &&
|
|
11
|
-
typeof targetValue === 'object' &&
|
|
12
|
-
!Array.isArray(targetValue)) {
|
|
13
|
-
// If both values are objects, recursively merge them
|
|
14
|
-
result[key] = deepMerge(targetValue, sourceValue);
|
|
15
|
-
}
|
|
16
|
-
else if (sourceValue !== undefined) {
|
|
17
|
-
// Otherwise, just assign the source value
|
|
18
|
-
result[key] = sourceValue;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
export function overwriteOptions(field, options) {
|
|
25
|
-
return {
|
|
26
|
-
...field,
|
|
27
|
-
// @ts-expect-error
|
|
28
|
-
options: deepMerge(field.options, options),
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
/** You MUST add the T type to the function call
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* isOfType<ComponentObject>(obj, 'component')
|
|
35
|
-
*/
|
|
36
|
-
export function isOfType(value, property) {
|
|
37
|
-
return typeof value === 'object' && value !== null && property in value;
|
|
38
|
-
}
|
package/esm/svelte/tryCatch.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type Success<T> = {
|
|
2
|
-
data: T;
|
|
3
|
-
error: null;
|
|
4
|
-
};
|
|
5
|
-
type Failure<E> = {
|
|
6
|
-
data: null;
|
|
7
|
-
error: E;
|
|
8
|
-
};
|
|
9
|
-
type Result<T, E = Error> = Success<T> | Failure<E>;
|
|
10
|
-
export declare function tryCatch<T, E = Error>(promise: Promise<T>): Promise<Result<T, E>>;
|
|
11
|
-
export declare function tryCatchSync<T, E = Error>(func: () => T): Result<T, E>;
|
|
12
|
-
export {};
|
package/esm/svelte/tryCatch.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export async function tryCatch(promise) {
|
|
2
|
-
try {
|
|
3
|
-
const data = await promise;
|
|
4
|
-
return { data, error: null };
|
|
5
|
-
}
|
|
6
|
-
catch (error) {
|
|
7
|
-
return { data: null, error: error };
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
export function tryCatchSync(func) {
|
|
11
|
-
try {
|
|
12
|
-
const data = func();
|
|
13
|
-
return { data, error: null };
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
return { data: null, error: error };
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { remult } from 'remult';
|
|
2
|
-
import { ModuleFF } from '../../server';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated will be done directly in remult when modules will be in 😉
|
|
5
|
-
*/
|
|
6
|
-
export const sveltekit = () => {
|
|
7
|
-
return new ModuleFF({
|
|
8
|
-
name: 'sveltekit',
|
|
9
|
-
priority: -779,
|
|
10
|
-
entities: [],
|
|
11
|
-
controllers: [],
|
|
12
|
-
initRequest: async (kitEvent, op) => {
|
|
13
|
-
remult.context.setHeaders = (headers) => {
|
|
14
|
-
kitEvent.setHeaders(headers);
|
|
15
|
-
};
|
|
16
|
-
remult.context.setCookie = (name, value, opts) => {
|
|
17
|
-
kitEvent.cookies.set(name, value, opts);
|
|
18
|
-
};
|
|
19
|
-
remult.context.deleteCookie = (name, opts) => {
|
|
20
|
-
kitEvent.cookies.delete(name, opts);
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
};
|
package/esm/ui/Button.svelte
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { createTooltip } from '@melt-ui/svelte'
|
|
3
|
-
import type { Action } from 'svelte/action'
|
|
4
|
-
import { fade, fly } from 'svelte/transition'
|
|
5
|
-
|
|
6
|
-
import { remult } from 'remult'
|
|
7
|
-
|
|
8
|
-
import { BaseEnum, tw } from '../internals'
|
|
9
|
-
|
|
10
|
-
// TODO: extend HTMLButtonAttributes ?
|
|
11
|
-
interface Props {
|
|
12
|
-
isLoading?: boolean
|
|
13
|
-
permission?: BaseEnum[] | BaseEnum | undefined
|
|
14
|
-
tooltip?: import('svelte').Snippet
|
|
15
|
-
class?: string
|
|
16
|
-
children?: import('svelte').Snippet
|
|
17
|
-
disabled?: boolean | null
|
|
18
|
-
[key: string]: any
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let {
|
|
22
|
-
isLoading = false,
|
|
23
|
-
class: className = '',
|
|
24
|
-
permission = undefined,
|
|
25
|
-
children,
|
|
26
|
-
tooltip,
|
|
27
|
-
disabled: disabledProp,
|
|
28
|
-
...rest
|
|
29
|
-
}: Props = $props()
|
|
30
|
-
|
|
31
|
-
let permissionDisabled = $state(false)
|
|
32
|
-
let disabled = $derived(disabledProp || permissionDisabled || isLoading)
|
|
33
|
-
|
|
34
|
-
// let's trigger the annimation if it's more than 200ms
|
|
35
|
-
let triggerAnnimation = $state(false)
|
|
36
|
-
$effect(() => {
|
|
37
|
-
isLoading &&
|
|
38
|
-
setTimeout(() => {
|
|
39
|
-
if (isLoading) {
|
|
40
|
-
triggerAnnimation = true
|
|
41
|
-
}
|
|
42
|
-
}, 200)
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
let updates = (param: { permission: BaseEnum[] | BaseEnum | undefined }) => {
|
|
46
|
-
if (param && param.permission) {
|
|
47
|
-
permissionDisabled = !remult.isAllowed(
|
|
48
|
-
Array.isArray(param.permission) ? param.permission.map((c) => c.id) : param.permission.id,
|
|
49
|
-
)
|
|
50
|
-
if (permissionDisabled) {
|
|
51
|
-
disabledWhy = `Vous n'avez pas la permission: ${Array.isArray(param.permission) ? param.permission.map((c) => `"${c.caption}"`).join(' ou ') : `"${param.permission.caption}"`}`
|
|
52
|
-
} else {
|
|
53
|
-
disabledWhy = ''
|
|
54
|
-
}
|
|
55
|
-
} else {
|
|
56
|
-
permissionDisabled = false
|
|
57
|
-
disabledWhy = ''
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
let disabledWhy = $state('')
|
|
62
|
-
const isAllowed: Action<HTMLElement, { permission: BaseEnum[] | BaseEnum | undefined }> = (
|
|
63
|
-
node,
|
|
64
|
-
param,
|
|
65
|
-
) => {
|
|
66
|
-
// the node has been mounted in the DOM
|
|
67
|
-
// @ts-ignore
|
|
68
|
-
updates(param)
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
update(param) {
|
|
72
|
-
// the value of `bar` has changed
|
|
73
|
-
updates(param)
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
destroy() {
|
|
77
|
-
// the node has been removed from the DOM
|
|
78
|
-
},
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const {
|
|
83
|
-
elements: { trigger, content, arrow },
|
|
84
|
-
states: { open },
|
|
85
|
-
} = createTooltip({
|
|
86
|
-
positioning: {
|
|
87
|
-
placement: 'top',
|
|
88
|
-
},
|
|
89
|
-
openDelay: 0,
|
|
90
|
-
closeDelay: 0,
|
|
91
|
-
closeOnPointerDown: false,
|
|
92
|
-
forceVisible: true,
|
|
93
|
-
escapeBehavior: 'close',
|
|
94
|
-
group: true,
|
|
95
|
-
})
|
|
96
|
-
</script>
|
|
97
|
-
|
|
98
|
-
<button
|
|
99
|
-
{...$trigger}
|
|
100
|
-
use:trigger
|
|
101
|
-
use:isAllowed={{ permission }}
|
|
102
|
-
{...rest}
|
|
103
|
-
class={tw(['btn', className])}
|
|
104
|
-
{disabled}
|
|
105
|
-
>
|
|
106
|
-
<!-- btn-outline -->
|
|
107
|
-
{@render children?.()}
|
|
108
|
-
{#if triggerAnnimation && isLoading}
|
|
109
|
-
<div in:fly={{ x: -20 }}>
|
|
110
|
-
<span class="loading loading-spinner"></span>
|
|
111
|
-
</div>
|
|
112
|
-
{/if}
|
|
113
|
-
</button>
|
|
114
|
-
|
|
115
|
-
{#if $open && (disabledWhy || tooltip)}
|
|
116
|
-
<div
|
|
117
|
-
{...$content}
|
|
118
|
-
use:content
|
|
119
|
-
transition:fade={{ duration: 100 }}
|
|
120
|
-
class="z-30 rounded-lg bg-base-300 ring-1 ring-black"
|
|
121
|
-
>
|
|
122
|
-
<div {...$arrow} use:arrow></div>
|
|
123
|
-
<div class="px-4 py-1">
|
|
124
|
-
{#if tooltip}
|
|
125
|
-
{@render tooltip?.()}
|
|
126
|
-
{:else}
|
|
127
|
-
{disabledWhy}
|
|
128
|
-
{/if}
|
|
129
|
-
</div>
|
|
130
|
-
</div>
|
|
131
|
-
{/if}
|
|
132
|
-
|
|
133
|
-
<style>
|
|
134
|
-
.btn[disabled] {
|
|
135
|
-
pointer-events: all;
|
|
136
|
-
cursor: not-allowed;
|
|
137
|
-
}
|
|
138
|
-
</style>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BaseEnum } from '../internals';
|
|
2
|
-
interface Props {
|
|
3
|
-
isLoading?: boolean;
|
|
4
|
-
permission?: BaseEnum[] | BaseEnum | undefined;
|
|
5
|
-
tooltip?: import('svelte').Snippet;
|
|
6
|
-
class?: string;
|
|
7
|
-
children?: import('svelte').Snippet;
|
|
8
|
-
disabled?: boolean | null;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
12
|
-
type Button = ReturnType<typeof Button>;
|
|
13
|
-
export default Button;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
interface Props {
|
|
3
|
-
/**
|
|
4
|
-
* @param value to set in the clipboard if not null. *
|
|
5
|
-
* 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)!
|
|
6
|
-
*/
|
|
7
|
-
value: string | null
|
|
8
|
-
class?: string
|
|
9
|
-
children?: import('svelte').Snippet
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
let { value, class: extraClass = '', children }: Props = $props()
|
|
13
|
-
|
|
14
|
-
async function clip(_value: string | null) {
|
|
15
|
-
if (_value) {
|
|
16
|
-
try {
|
|
17
|
-
await navigator.clipboard.writeText(_value)
|
|
18
|
-
} catch (error) {}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<button onclick={() => clip(value)} class={`text-left ${value ? 'cursor-copy' : ''} ${extraClass}`}>
|
|
24
|
-
{@render children?.()}
|
|
25
|
-
</button>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
interface Props {
|
|
2
|
-
/**
|
|
3
|
-
* @param value to set in the clipboard if not null. *
|
|
4
|
-
* 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)!
|
|
5
|
-
*/
|
|
6
|
-
value: string | null;
|
|
7
|
-
class?: string;
|
|
8
|
-
children?: import('svelte').Snippet;
|
|
9
|
-
}
|
|
10
|
-
declare const Clipboardable: import("svelte").Component<Props, {}, "">;
|
|
11
|
-
type Clipboardable = ReturnType<typeof Clipboardable>;
|
|
12
|
-
export default Clipboardable;
|