firstly 0.2.0 → 0.2.1
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 +10 -0
- package/esm/auth/server/AuthController.server.js +32 -12
- package/esm/auth/static/assets/Page-BRNWcY5Z.js +1 -0
- package/esm/auth/static/assets/Page-CFcEsGK8.d.ts +2 -0
- package/esm/auth/static/assets/Page-CFcEsGK8.js +7 -0
- package/esm/auth/static/assets/Page-tLVs5slF.js +1 -0
- package/esm/auth/static/assets/index-D38rqu4x.d.ts +201 -0
- package/esm/auth/static/assets/index-D38rqu4x.js +2 -0
- package/esm/auth/static/index.html +1 -1
- package/esm/bin/cmd.js +2 -2
- package/esm/feedback/FeedbackController.d.ts +6 -2
- package/esm/feedback/FeedbackController.js +145 -143
- package/esm/feedback/server/index.d.ts +2 -2
- package/esm/feedback/server/index.js +3 -3
- package/esm/feedback/types.d.ts +5 -0
- package/esm/feedback/ui/DialogIssue.svelte +5 -5
- package/esm/feedback/ui/DialogIssues.svelte +5 -5
- package/esm/feedback/ui/DialogMilestones.svelte +1 -1
- package/esm/internals/BaseEnum.d.ts +1 -0
- package/esm/internals/FF_Fields.d.ts +4 -3
- package/esm/internals/FF_Fields.js +14 -55
- package/esm/internals/cellsBuildor.d.ts +2 -1
- package/esm/internals/index.d.ts +6 -7
- package/esm/internals/storeItem.d.ts +1 -0
- package/esm/mail/server/index.d.ts +8 -2
- package/esm/mail/server/index.js +35 -7
- package/esm/server/index.d.ts +1 -1
- package/esm/svelte/FF_Cell.svelte +3 -5
- package/esm/svelte/FF_Cell.svelte.d.ts +4 -2
- package/esm/svelte/FF_Form.svelte +4 -5
- package/esm/svelte/FF_Grid.svelte +2 -2
- package/esm/svelte/FF_Layout.svelte +3 -3
- package/esm/svelte/dialog/DialogManagement.svelte +2 -5
- package/esm/svelte/dialog/DialogPrimitive.svelte +1 -2
- package/esm/svelte/dialog/dialog.js +2 -2
- package/esm/svelte/ff_Config.svelte.js +2 -2
- package/esm/svelte/index.d.ts +2 -7
- package/esm/svelte/index.js +2 -7
- package/esm/ui/Button.svelte +38 -22
- package/esm/ui/Button.svelte.d.ts +10 -34
- package/esm/ui/Clipboardable.svelte +13 -17
- package/esm/ui/Clipboardable.svelte.d.ts +9 -33
- package/esm/ui/Field.svelte +38 -8
- package/esm/ui/FieldGroup.svelte.d.ts +1 -1
- package/esm/ui/Grid.svelte +11 -82
- package/esm/ui/Grid.svelte.d.ts +0 -1
- package/esm/ui/Grid2.svelte +25 -86
- package/esm/ui/Grid2.svelte.d.ts +1 -2
- package/esm/ui/GridPaginate.svelte +1 -1
- package/esm/ui/GridPaginate2.svelte +2 -2
- package/esm/ui/Icon.svelte +2 -18
- package/esm/ui/Icon.svelte.d.ts +0 -2
- package/esm/ui/LibIcon.js +2 -2
- package/esm/ui/Loading.svelte +1 -1
- package/esm/ui/dialog/DialogManagement.svelte +14 -5
- package/esm/ui/dialog/DialogPrimitive.svelte +3 -3
- package/esm/ui/dialog/FormEditAction.svelte +4 -4
- package/esm/ui/dialog/dialog.d.ts +5 -2
- package/esm/ui/dialog/dialog.js +2 -2
- package/esm/ui/index.d.ts +1 -0
- package/esm/ui/index.js +1 -0
- package/esm/ui/internals/FieldContainer.svelte +25 -14
- package/esm/ui/internals/FieldContainer.svelte.d.ts +9 -30
- package/esm/ui/internals/Input.svelte.d.ts +1 -1
- package/esm/ui/internals/Textarea.svelte +2 -5
- package/esm/ui/internals/select/MultiSelectMelt.svelte +6 -4
- package/esm/ui/internals/select/Select2.svelte +88 -0
- package/esm/ui/internals/select/Select2.svelte.d.ts +12 -0
- package/esm/ui/internals/select/SelectMelt.svelte +5 -5
- package/esm/ui/internals/select/SelectRadio.svelte +1 -1
- package/esm/ui/link/Link.svelte +1 -1
- package/esm/ui/link/LinkPlus.svelte +9 -5
- package/esm/ui/link/LinkPlus.svelte.d.ts +5 -19
- package/esm/virtual/Customer.js +1 -2
- package/esm/virtual/UIEntity.js +9 -5
- package/package.json +7 -8
- package/esm/auth/static/assets/Page-9Ytj29NS.js +0 -1
- package/esm/auth/static/assets/Page-C1pM-UDt.d.ts +0 -2
- package/esm/auth/static/assets/Page-C1pM-UDt.js +0 -20
- package/esm/auth/static/assets/Page-CPz6KCw_.js +0 -1
- package/esm/auth/static/assets/index-AoBb9Ds5.d.ts +0 -232
- package/esm/auth/static/assets/index-AoBb9Ds5.js +0 -2
- package/esm/svelte/FF_Display.svelte +0 -51
- package/esm/svelte/FF_Display.svelte.d.ts +0 -29
- package/esm/svelte/FF_Edit.svelte +0 -104
- package/esm/svelte/FF_Edit.svelte.d.ts +0 -32
- package/esm/svelte/FF_Error.svelte +0 -23
- package/esm/svelte/FF_Error.svelte.d.ts +0 -29
- package/esm/svelte/FF_Field.svelte +0 -62
- package/esm/svelte/FF_Field.svelte.d.ts +0 -29
- package/esm/svelte/FF_Hint.svelte +0 -21
- package/esm/svelte/FF_Hint.svelte.d.ts +0 -29
- package/esm/svelte/FF_Label.svelte +0 -23
- package/esm/svelte/FF_Label.svelte.d.ts +0 -29
- /package/esm/auth/static/assets/{Page-CPz6KCw_.d.ts → Page-BRNWcY5Z.d.ts} +0 -0
- /package/esm/auth/static/assets/{Page-9Ytj29NS.d.ts → Page-tLVs5slF.d.ts} +0 -0
package/esm/internals/index.d.ts
CHANGED
|
@@ -18,20 +18,19 @@ import { default as Link } from '../ui/link/Link.svelte';
|
|
|
18
18
|
import { default as LinkPlus } from '../ui/link/LinkPlus.svelte';
|
|
19
19
|
import { default as Loading } from '../ui/Loading.svelte';
|
|
20
20
|
import { default as Tooltip } from '../ui/Tooltip.svelte';
|
|
21
|
-
import type { BaseEnum, BaseItem, FF_Icon } from './BaseEnum.js';
|
|
22
|
-
import type { CellsInput
|
|
21
|
+
import type { BaseEnum, BaseItem, BaseItemLight, FF_Icon } from './BaseEnum.js';
|
|
22
|
+
import type { CellsInput } from './cellsBuildor.js';
|
|
23
23
|
import { FF_Role } from './common.js';
|
|
24
|
-
import { storeItem } from './storeItem.js';
|
|
24
|
+
import { storeItem, type StoreItem } from './storeItem.js';
|
|
25
25
|
import { storeList } from './storeList.js';
|
|
26
26
|
export { Field, FormEditAction, Grid, Grid2, GridPaginate, GridPaginate2, FieldGroup, Icon, Link, LinkPlus, Loading, Button, Tooltip, DialogManagement, FieldContainer, SelectMelt, Clipboardable, };
|
|
27
27
|
export type { BaseEnumOptions } from './BaseEnum.js';
|
|
28
|
-
export type { BaseItem };
|
|
29
|
-
export type BaseItemLight = Partial<BaseItem>;
|
|
28
|
+
export type { BaseItem, BaseItemLight };
|
|
30
29
|
export type { DialogMetaDataInternal } from '../ui/dialog/dialog.js';
|
|
31
|
-
export type CellsInput
|
|
30
|
+
export type { CellsInput };
|
|
32
31
|
export type { Cell, VisibilityMode } from './cellsBuildor.js';
|
|
33
32
|
export type { FF_FindOptions } from './storeList.js';
|
|
34
|
-
export type StoreItem
|
|
33
|
+
export type { StoreItem };
|
|
35
34
|
export type StoreList<T> = ReturnType<typeof storeList<T>>;
|
|
36
35
|
export type { ResolvedType, UnArray, RecursivePartial } from '../utils/types.js';
|
|
37
36
|
export { FF_Fields } from './FF_Fields.js';
|
|
@@ -29,8 +29,14 @@ export type MailOptions = GlobalEasyOptions & {
|
|
|
29
29
|
defaults?: DefaultOptions;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
declare let transporter: ReturnType<typeof typeNodemailer.createTransport>;
|
|
33
32
|
export type SendMail = typeof sendMail;
|
|
33
|
+
export type SendMailResult = {
|
|
34
|
+
data: SMTPTransport.SentMessageInfo;
|
|
35
|
+
error?: undefined;
|
|
36
|
+
} | {
|
|
37
|
+
error: any;
|
|
38
|
+
data?: undefined;
|
|
39
|
+
};
|
|
34
40
|
export declare const sendMail: (
|
|
35
41
|
/** usefull for logs, it has NO impact on the mail itself */
|
|
36
42
|
topic: string, easyOptions: GlobalEasyOptions & {
|
|
@@ -46,6 +52,6 @@ topic: string, easyOptions: GlobalEasyOptions & {
|
|
|
46
52
|
}[];
|
|
47
53
|
}, options?: {
|
|
48
54
|
nodemailer?: MailOptions['nodemailer'];
|
|
49
|
-
}) =>
|
|
55
|
+
}) => Promise<SendMailResult>;
|
|
50
56
|
export declare const mail: (o?: MailOptions) => Module<unknown>;
|
|
51
57
|
export {};
|
package/esm/mail/server/index.js
CHANGED
|
@@ -99,10 +99,10 @@ export const sendMail = async (topic, easyOptions, options) => {
|
|
|
99
99
|
}
|
|
100
100
|
try {
|
|
101
101
|
if (!globalOptions?.nodemailer?.transport) {
|
|
102
|
-
const
|
|
102
|
+
const data = await transporter.sendMail({ ...nodemailerOptions.defaults });
|
|
103
103
|
log.error(`${magenta(`[${topic}]`)} - ⚠️ ${red(`mail not configured`)} ⚠️
|
|
104
104
|
We are still nice and generated you an email preview link (the mail we not really sent):
|
|
105
|
-
👉 ${cyan(String(nodemailer.getTestMessageUrl(
|
|
105
|
+
👉 ${cyan(String(nodemailer.getTestMessageUrl(data)))}
|
|
106
106
|
|
|
107
107
|
To really send mails, check out the doc ${white(`https://firstly.fun/modules/mail`)}.
|
|
108
108
|
`);
|
|
@@ -113,10 +113,10 @@ export const sendMail = async (topic, easyOptions, options) => {
|
|
|
113
113
|
topic,
|
|
114
114
|
metadata,
|
|
115
115
|
});
|
|
116
|
-
return
|
|
116
|
+
return { data };
|
|
117
117
|
}
|
|
118
118
|
else {
|
|
119
|
-
const
|
|
119
|
+
const data = await transporter.sendMail({ ...nodemailerOptions.defaults });
|
|
120
120
|
log.success(`${magenta(`[${topic}]`)} - Sent to ${typeof nodemailerOptions.defaults?.to === 'string' ? green(nodemailerOptions.defaults?.to) : nodemailerOptions.defaults?.to}`);
|
|
121
121
|
await repo(mailEntities.Mail).insert({
|
|
122
122
|
status: 'sent',
|
|
@@ -125,7 +125,7 @@ export const sendMail = async (topic, easyOptions, options) => {
|
|
|
125
125
|
topic,
|
|
126
126
|
metadata,
|
|
127
127
|
});
|
|
128
|
-
return
|
|
128
|
+
return { data };
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
catch (error) {
|
|
@@ -138,15 +138,43 @@ ${cyan(JSON.stringify(globalOptions?.nodemailer?.transport, null, 2))}
|
|
|
138
138
|
else {
|
|
139
139
|
log.error(`${magenta(`[${topic}]`)} - Error`, error);
|
|
140
140
|
}
|
|
141
|
+
// TODO
|
|
142
|
+
// Build comprehensive error info for JSON storage
|
|
143
|
+
const errorInfoJSON = {
|
|
144
|
+
message: error instanceof Error ? error.message : String(error),
|
|
145
|
+
name: error instanceof Error ? error.name : 'Unknown',
|
|
146
|
+
// stack: error instanceof Error ? error.stack : undefined,
|
|
147
|
+
code: error?.code,
|
|
148
|
+
errno: error?.errno,
|
|
149
|
+
syscall: error?.syscall,
|
|
150
|
+
hostname: error?.hostname,
|
|
151
|
+
port: error?.port,
|
|
152
|
+
address: error?.address,
|
|
153
|
+
response: error?.response,
|
|
154
|
+
responseCode: error?.responseCode,
|
|
155
|
+
command: error?.command,
|
|
156
|
+
// Capture any other enumerable properties
|
|
157
|
+
...Object.getOwnPropertyNames(error).reduce((acc, key) => {
|
|
158
|
+
if (!['message', 'name', 'stack'].includes(key)) {
|
|
159
|
+
try {
|
|
160
|
+
acc[key] = error[key];
|
|
161
|
+
}
|
|
162
|
+
catch (e) {
|
|
163
|
+
// Ignore properties that can't be accessed
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return acc;
|
|
167
|
+
}, {}),
|
|
168
|
+
};
|
|
141
169
|
await repo(mailEntities.Mail).insert({
|
|
142
170
|
status: 'error',
|
|
143
|
-
errorInfo: JSON.stringify(
|
|
171
|
+
errorInfo: JSON.stringify(errorInfoJSON),
|
|
144
172
|
to: JSON.stringify(to),
|
|
145
173
|
html: easyOptionsToUse.saveHtml ? html : '',
|
|
146
174
|
topic,
|
|
147
175
|
metadata,
|
|
148
176
|
});
|
|
149
|
-
|
|
177
|
+
return { error };
|
|
150
178
|
}
|
|
151
179
|
};
|
|
152
180
|
const mailModule = new Module({
|
package/esm/server/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare class ModuleFF {
|
|
|
27
27
|
modulesFF?: ModuleFF[];
|
|
28
28
|
constructor(input: ModuleInput);
|
|
29
29
|
}
|
|
30
|
-
type Options = RemultServerOptions<RequestEvent<Partial<Record<string, string>>,
|
|
30
|
+
type Options = RemultServerOptions<RequestEvent<Partial<Record<string, string>>, any>> & {
|
|
31
31
|
/** @deprecated use `remult` modules instead */
|
|
32
32
|
modulesFF?: ModuleFF[] | undefined;
|
|
33
33
|
};
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
cell: CellMetadata<valueType, entityType>
|
|
14
14
|
r?: FF_Repo<entityType>
|
|
15
15
|
class?: string
|
|
16
|
+
value?: valueType
|
|
17
|
+
error?: string
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
let props: Props<valueType, entityType> = $props()
|
|
20
|
+
let { value = $bindable(), error, ...props }: Props<valueType, entityType> = $props()
|
|
20
21
|
|
|
21
22
|
// let classes = $derived(getClasses('field', props.classes))
|
|
22
23
|
|
|
@@ -25,9 +26,6 @@
|
|
|
25
26
|
let hint = $derived(props.cell.field?.options.ui?.hint ?? props.cell.ui?.hint)
|
|
26
27
|
// @ts-ignore
|
|
27
28
|
let ui = $derived(deepMerge(props.cell.field?.options.ui ?? {}, props.cell.ui ?? {}))
|
|
28
|
-
|
|
29
|
-
let error = ''
|
|
30
|
-
let value: any = $state('')
|
|
31
29
|
</script>
|
|
32
30
|
|
|
33
31
|
<!-- Snippets sections -->
|
|
@@ -4,11 +4,13 @@ interface Props<valueType = unknown, entityType = unknown> {
|
|
|
4
4
|
cell: CellMetadata<valueType, entityType>;
|
|
5
5
|
r?: FF_Repo<entityType>;
|
|
6
6
|
class?: string;
|
|
7
|
+
value?: valueType;
|
|
8
|
+
error?: string;
|
|
7
9
|
}
|
|
8
10
|
declare function $$render<valueType = unknown, entityType = unknown>(): {
|
|
9
11
|
props: Props<valueType, entityType>;
|
|
10
12
|
exports: {};
|
|
11
|
-
bindings: "";
|
|
13
|
+
bindings: "value";
|
|
12
14
|
slots: {};
|
|
13
15
|
events: {};
|
|
14
16
|
};
|
|
@@ -16,7 +18,7 @@ declare class __sveltets_Render<valueType = unknown, entityType = unknown> {
|
|
|
16
18
|
props(): ReturnType<typeof $$render<valueType, entityType>>['props'];
|
|
17
19
|
events(): ReturnType<typeof $$render<valueType, entityType>>['events'];
|
|
18
20
|
slots(): ReturnType<typeof $$render<valueType, entityType>>['slots'];
|
|
19
|
-
bindings(): "";
|
|
21
|
+
bindings(): "value";
|
|
20
22
|
exports(): {};
|
|
21
23
|
}
|
|
22
24
|
interface $$IsomorphicComponent {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" generics="entityType = unknown">
|
|
2
2
|
import { EntityError, getEntityRef } from 'remult'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { FF_Cell, getClasses } from './'
|
|
5
5
|
import type { FF_Repo, FieldGroup, FormTheme } from './'
|
|
6
6
|
|
|
7
7
|
const default_uid = $props.id()
|
|
@@ -91,11 +91,10 @@
|
|
|
91
91
|
{/if}
|
|
92
92
|
<div data-ff-form-fields class="{classes?.fields} {group.class}">
|
|
93
93
|
{#each group.fields as field}
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
{field}
|
|
94
|
+
<FF_Cell
|
|
95
|
+
cell={{ field, mode: 'edit' }}
|
|
97
96
|
bind:value={valuesToUse[field.key as keyof entityType]}
|
|
98
|
-
error={errors[field.key]}
|
|
97
|
+
error={errors[field.key ?? '']}
|
|
99
98
|
/>
|
|
100
99
|
{/each}
|
|
101
100
|
</div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import Icon from '../ui/Icon.svelte'
|
|
5
5
|
import { LibIcon_Add, LibIcon_Delete, LibIcon_Edit } from '../ui/LibIcon'
|
|
6
|
-
import { dialog,
|
|
6
|
+
import { dialog, FF_Cell_Display, FF_Repo, getClasses, type GridTheme } from './'
|
|
7
7
|
|
|
8
8
|
interface Props<entityType> {
|
|
9
9
|
// uid?: string
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
<tr data-ff-grid-row class={classes?.row}>
|
|
101
101
|
{#each fields as f (f.key)}
|
|
102
102
|
<td data-ff-grid-row-cell class="{classes?.rowCell} td-{f.inputType}">
|
|
103
|
-
<
|
|
103
|
+
<FF_Cell_Display field={f} value={item[f.key as keyof entityType]}></FF_Cell_Display>
|
|
104
104
|
</td>
|
|
105
105
|
{/each}
|
|
106
106
|
{#if showActions}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
{:else if layoutToUse.type === 'grid'}
|
|
29
29
|
<FF_Grid {r}></FF_Grid>
|
|
30
30
|
{:else if layoutToUse.type === 'tab'}
|
|
31
|
-
<div role="tablist" class="tabs tabs
|
|
31
|
+
<div role="tablist" class="tabs-lift tabs">
|
|
32
32
|
{#each layoutToUse.groups ?? [] as group (group.key)}
|
|
33
33
|
<input
|
|
34
34
|
type="radio"
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
onchange={() => (selectedThing = group.key)}
|
|
40
40
|
aria-label={group.caption}
|
|
41
41
|
/>
|
|
42
|
-
<div role="tabpanel" class="tab-content
|
|
42
|
+
<div role="tabpanel" class="tab-content border-base-300 bg-base-100 p-6">
|
|
43
43
|
<FF_Form {r} groups={[group]} show={{ title: false }}></FF_Form>
|
|
44
44
|
</div>
|
|
45
45
|
{/each}
|
|
46
46
|
</div>
|
|
47
47
|
{:else if layoutToUse.type === 'accordion'}
|
|
48
48
|
{#each layoutToUse.groups ?? [] as group (group.key)}
|
|
49
|
-
<div class="collapse bg-base-100">
|
|
49
|
+
<div class="collapse-arrow collapse bg-base-100">
|
|
50
50
|
<input
|
|
51
51
|
type="radio"
|
|
52
52
|
name="my-accordion"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
>
|
|
17
17
|
{@html toShow.children}
|
|
18
18
|
<svelte:fragment slot="actions">
|
|
19
|
-
<Button class="text-white"
|
|
19
|
+
<Button class="text-white" onclick={() => dialog.close(toShow.id, { success: true })}
|
|
20
20
|
>Confirmer</Button
|
|
21
21
|
>
|
|
22
22
|
</svelte:fragment>
|
|
@@ -29,10 +29,7 @@
|
|
|
29
29
|
>
|
|
30
30
|
{@html toShow.children}
|
|
31
31
|
<svelte:fragment slot="actions">
|
|
32
|
-
<Button
|
|
33
|
-
class="btn-outline btn-error"
|
|
34
|
-
on:click={() => dialog.close(toShow.id, { success: true })}
|
|
35
|
-
>
|
|
32
|
+
<Button class="btn-error" onclick={() => dialog.close(toShow.id, { success: true })}>
|
|
36
33
|
Confirmer
|
|
37
34
|
</Button>
|
|
38
35
|
</svelte:fragment>
|
|
@@ -18,7 +18,7 @@ const createDialogManagement = () => {
|
|
|
18
18
|
confirm: (topic, text, icon) => {
|
|
19
19
|
const detail = {
|
|
20
20
|
detail: {
|
|
21
|
-
caption: '
|
|
21
|
+
caption: 'A Confirmer',
|
|
22
22
|
icon: { data: icon },
|
|
23
23
|
},
|
|
24
24
|
children: `
|
|
@@ -34,7 +34,7 @@ const createDialogManagement = () => {
|
|
|
34
34
|
confirmDelete: (topic) => {
|
|
35
35
|
const detail = {
|
|
36
36
|
detail: {
|
|
37
|
-
caption: 'Supprimer',
|
|
37
|
+
caption: 'A Supprimer',
|
|
38
38
|
icon: { data: LibIcon_Delete },
|
|
39
39
|
},
|
|
40
40
|
children: topic
|
package/esm/svelte/index.d.ts
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import type { CellMetadata, getLayout } from './customField';
|
|
2
|
+
import { default as FF_Cell_Display } from './FF_Cell_Display.svelte';
|
|
2
3
|
import { default as FF_Cell } from './FF_Cell.svelte';
|
|
3
4
|
import { default as FF_Config } from './FF_Config.svelte';
|
|
4
|
-
import { default as FF_Display } from './FF_Display.svelte';
|
|
5
|
-
import { default as FF_Edit } from './FF_Edit.svelte';
|
|
6
|
-
import { default as FF_Error } from './FF_Error.svelte';
|
|
7
|
-
import { default as FF_Field } from './FF_Field.svelte';
|
|
8
5
|
import { default as FF_Form } from './FF_Form.svelte';
|
|
9
6
|
import { default as FF_Grid } from './FF_Grid.svelte';
|
|
10
|
-
import { default as FF_Hint } from './FF_Hint.svelte';
|
|
11
|
-
import { default as FF_Label } from './FF_Label.svelte';
|
|
12
7
|
import { default as FF_Layout } from './FF_Layout.svelte';
|
|
13
8
|
export type { FieldTheme, FormTheme, GridTheme, Theme, EditTheme, DisplayTheme, } from './ff_Config.svelte.js';
|
|
14
9
|
export { getDynamicCustomField, getTheme, setDynamicCustomField, setTheme, getClasses, daisyTheme, defaultTheme, emptyTheme, FF_Theme, } from './ff_Config.svelte.js';
|
|
15
|
-
export { FF_Grid, FF_Form,
|
|
10
|
+
export { FF_Grid, FF_Form, FF_Config, FF_Layout, FF_Cell, FF_Cell_Display };
|
|
16
11
|
export type { DynamicCustomField, FieldGroup } from './customField';
|
|
17
12
|
export { FF_Repo } from './FF_Repo.svelte.js';
|
|
18
13
|
export { tryCatch, tryCatchSync } from './tryCatch';
|
package/esm/svelte/index.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
+
import { default as FF_Cell_Display } from './FF_Cell_Display.svelte';
|
|
1
2
|
import { default as FF_Cell } from './FF_Cell.svelte';
|
|
2
3
|
import { default as FF_Config } from './FF_Config.svelte';
|
|
3
|
-
import { default as FF_Display } from './FF_Display.svelte';
|
|
4
|
-
import { default as FF_Edit } from './FF_Edit.svelte';
|
|
5
|
-
import { default as FF_Error } from './FF_Error.svelte';
|
|
6
|
-
import { default as FF_Field } from './FF_Field.svelte';
|
|
7
4
|
import { default as FF_Form } from './FF_Form.svelte';
|
|
8
5
|
import { default as FF_Grid } from './FF_Grid.svelte';
|
|
9
|
-
import { default as FF_Hint } from './FF_Hint.svelte';
|
|
10
|
-
import { default as FF_Label } from './FF_Label.svelte';
|
|
11
6
|
import { default as FF_Layout } from './FF_Layout.svelte';
|
|
12
7
|
export { getDynamicCustomField, getTheme, setDynamicCustomField, setTheme, getClasses, daisyTheme, defaultTheme, emptyTheme, FF_Theme, } from './ff_Config.svelte.js';
|
|
13
|
-
export { FF_Grid, FF_Form,
|
|
8
|
+
export { FF_Grid, FF_Form, FF_Config, FF_Layout, FF_Cell, FF_Cell_Display };
|
|
14
9
|
export { FF_Repo } from './FF_Repo.svelte.js';
|
|
15
10
|
export { tryCatch, tryCatchSync } from './tryCatch';
|
|
16
11
|
export { overwriteOptions, deepMerge, isOfType } from './helpers';
|
package/esm/ui/Button.svelte
CHANGED
|
@@ -7,24 +7,40 @@
|
|
|
7
7
|
|
|
8
8
|
import { BaseEnum, tw } from '../internals'
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
}
|
|
13
20
|
|
|
14
|
-
|
|
21
|
+
let {
|
|
22
|
+
isLoading = false,
|
|
23
|
+
class: className = '',
|
|
24
|
+
permission = undefined,
|
|
25
|
+
children,
|
|
26
|
+
tooltip,
|
|
27
|
+
disabled: disabledProp,
|
|
28
|
+
...rest
|
|
29
|
+
}: Props = $props()
|
|
15
30
|
|
|
16
|
-
let permissionDisabled = false
|
|
17
|
-
|
|
31
|
+
let permissionDisabled = $state(false)
|
|
32
|
+
let disabled = $derived(disabledProp || permissionDisabled || isLoading)
|
|
18
33
|
|
|
19
34
|
// let's trigger the annimation if it's more than 200ms
|
|
20
|
-
let triggerAnnimation = false
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
let triggerAnnimation = $state(false)
|
|
36
|
+
$effect(() => {
|
|
37
|
+
isLoading &&
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
if (isLoading) {
|
|
40
|
+
triggerAnnimation = true
|
|
41
|
+
}
|
|
42
|
+
}, 200)
|
|
43
|
+
})
|
|
28
44
|
|
|
29
45
|
let updates = (param: { permission: BaseEnum[] | BaseEnum | undefined }) => {
|
|
30
46
|
if (param && param.permission) {
|
|
@@ -42,7 +58,7 @@
|
|
|
42
58
|
}
|
|
43
59
|
}
|
|
44
60
|
|
|
45
|
-
let disabledWhy = ''
|
|
61
|
+
let disabledWhy = $state('')
|
|
46
62
|
const isAllowed: Action<HTMLElement, { permission: BaseEnum[] | BaseEnum | undefined }> = (
|
|
47
63
|
node,
|
|
48
64
|
param,
|
|
@@ -81,14 +97,14 @@
|
|
|
81
97
|
|
|
82
98
|
<button
|
|
83
99
|
{...$trigger}
|
|
100
|
+
use:trigger
|
|
84
101
|
use:isAllowed={{ permission }}
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
class={tw(['btn text-white', disabled ? '' : 'btn-primary', className])}
|
|
102
|
+
{...rest}
|
|
103
|
+
class={tw(['btn', className])}
|
|
88
104
|
{disabled}
|
|
89
105
|
>
|
|
90
106
|
<!-- btn-outline -->
|
|
91
|
-
|
|
107
|
+
{@render children?.()}
|
|
92
108
|
{#if triggerAnnimation && isLoading}
|
|
93
109
|
<div in:fly={{ x: -20 }}>
|
|
94
110
|
<span class="loading loading-spinner"></span>
|
|
@@ -96,7 +112,7 @@
|
|
|
96
112
|
{/if}
|
|
97
113
|
</button>
|
|
98
114
|
|
|
99
|
-
{#if $open && (disabledWhy ||
|
|
115
|
+
{#if $open && (disabledWhy || tooltip)}
|
|
100
116
|
<div
|
|
101
117
|
{...$content}
|
|
102
118
|
use:content
|
|
@@ -105,8 +121,8 @@
|
|
|
105
121
|
>
|
|
106
122
|
<div {...$arrow} use:arrow></div>
|
|
107
123
|
<div class="px-4 py-1">
|
|
108
|
-
{#if
|
|
109
|
-
|
|
124
|
+
{#if tooltip}
|
|
125
|
+
{@render tooltip?.()}
|
|
110
126
|
{:else}
|
|
111
127
|
{disabledWhy}
|
|
112
128
|
{/if}
|
|
@@ -1,37 +1,13 @@
|
|
|
1
1
|
import { BaseEnum } from '../internals';
|
|
2
|
-
interface
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
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;
|
|
14
10
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} ? Props extends Record<string, never> ? any : {
|
|
18
|
-
children?: any;
|
|
19
|
-
} : {});
|
|
20
|
-
declare const Button: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
21
|
-
[x: string]: any;
|
|
22
|
-
isLoading?: boolean | undefined;
|
|
23
|
-
class?: string | undefined | null | undefined;
|
|
24
|
-
permission?: BaseEnum<any> | BaseEnum<any>[] | undefined;
|
|
25
|
-
}, {
|
|
26
|
-
default: {};
|
|
27
|
-
tooltip: {};
|
|
28
|
-
}>, {
|
|
29
|
-
click: MouseEvent;
|
|
30
|
-
} & {
|
|
31
|
-
[evt: string]: CustomEvent<any>;
|
|
32
|
-
}, {
|
|
33
|
-
default: {};
|
|
34
|
-
tooltip: {};
|
|
35
|
-
}, {}, string>;
|
|
36
|
-
type Button = InstanceType<typeof Button>;
|
|
11
|
+
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type Button = ReturnType<typeof Button>;
|
|
37
13
|
export default Button;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
}
|
|
9
11
|
|
|
10
|
-
let extraClass = ''
|
|
12
|
+
let { value, class: extraClass = '', children }: Props = $props()
|
|
11
13
|
|
|
12
14
|
async function clip(_value: string | null) {
|
|
13
15
|
if (_value) {
|
|
@@ -18,12 +20,6 @@
|
|
|
18
20
|
}
|
|
19
21
|
</script>
|
|
20
22
|
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
on:keyup={() => {}}
|
|
25
|
-
on:click={() => clip(value)}
|
|
26
|
-
class={`${value ? 'cursor-copy' : ''} ${extraClass}`}
|
|
27
|
-
>
|
|
28
|
-
<slot />
|
|
29
|
-
</span>
|
|
23
|
+
<button onclick={() => clip(value)} class={`text-left ${value ? 'cursor-copy' : ''} ${extraClass}`}>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</button>
|
|
@@ -1,36 +1,12 @@
|
|
|
1
|
-
interface
|
|
2
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
15
|
-
default: any;
|
|
16
|
-
} ? Props extends Record<string, never> ? any : {
|
|
17
|
-
children?: any;
|
|
18
|
-
} : {});
|
|
19
|
-
declare const Clipboardable: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
1
|
+
interface Props {
|
|
20
2
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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;
|
|
25
7
|
class?: string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
}, {
|
|
31
|
-
default: {};
|
|
32
|
-
}, {
|
|
33
|
-
class: string;
|
|
34
|
-
}, string>;
|
|
35
|
-
type Clipboardable = InstanceType<typeof Clipboardable>;
|
|
8
|
+
children?: import('svelte').Snippet;
|
|
9
|
+
}
|
|
10
|
+
declare const Clipboardable: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Clipboardable = ReturnType<typeof Clipboardable>;
|
|
36
12
|
export default Clipboardable;
|