firstly 0.2.0 → 0.3.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 +23 -0
- package/esm/bin/cmd.js +3 -158
- package/esm/changeLog/index.d.ts +1 -6
- 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 +2 -1
- package/esm/internals/FF_Entity.js +1 -17
- 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/cellsBuildor.js +5 -4
- package/esm/internals/index.d.ts +7 -12
- package/esm/internals/storeItem.d.ts +12 -20
- package/esm/internals/storeItem.js +20 -6
- 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/FF_Repo.svelte.d.ts +9 -0
- package/esm/svelte/FF_Repo.svelte.js +39 -0
- package/esm/svelte/class/SP.svelte.js +14 -2
- 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 +34 -66
- package/esm/ui/Button.svelte.d.ts +9 -35
- package/esm/ui/Clipboardable.svelte +13 -17
- package/esm/ui/Clipboardable.svelte.d.ts +9 -33
- package/esm/ui/Field.svelte +48 -9
- package/esm/ui/FieldGroup.svelte.d.ts +1 -1
- package/esm/ui/Grid.svelte +13 -87
- package/esm/ui/Grid.svelte.d.ts +0 -1
- package/esm/ui/Grid2.svelte +26 -90
- 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 +10 -8
- package/esm/ui/internals/select/MultiSelectMelt.svelte.d.ts +1 -1
- 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 +33 -24
- package/esm/ui/internals/select/SelectMelt.svelte.d.ts +1 -1
- package/esm/ui/internals/select/SelectRadio.svelte +2 -2
- package/esm/ui/internals/select/SelectRadio.svelte.d.ts +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 +11 -25
- 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 -498
- 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-9Ytj29NS.d.ts +0 -2
- package/esm/auth/static/assets/Page-9Ytj29NS.js +0 -1
- package/esm/auth/static/assets/Page-BHW08QWz.css +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_.d.ts +0 -2
- 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/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/auth/types.js +0 -1
- 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/ui/Button.svelte
CHANGED
|
@@ -1,67 +1,40 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { createTooltip } from '@melt-ui/svelte'
|
|
3
|
-
import type { Action } from 'svelte/action'
|
|
4
3
|
import { fade, fly } from 'svelte/transition'
|
|
5
4
|
|
|
6
|
-
import {
|
|
5
|
+
import { tw } from '../internals'
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let permissionDisabled = false
|
|
17
|
-
$: disabled = $$restProps.disabled || permissionDisabled || isLoading
|
|
18
|
-
|
|
19
|
-
// let's trigger the annimation if it's more than 200ms
|
|
20
|
-
let triggerAnnimation = false
|
|
21
|
-
$: isLoading &&
|
|
22
|
-
setTimeout(() => {
|
|
23
|
-
if (isLoading) {
|
|
24
|
-
// eslint-disable-next-line
|
|
25
|
-
triggerAnnimation = true
|
|
26
|
-
}
|
|
27
|
-
}, 200)
|
|
28
|
-
|
|
29
|
-
let updates = (param: { permission: BaseEnum[] | BaseEnum | undefined }) => {
|
|
30
|
-
if (param && param.permission) {
|
|
31
|
-
permissionDisabled = !remult.isAllowed(
|
|
32
|
-
Array.isArray(param.permission) ? param.permission.map((c) => c.id) : param.permission.id,
|
|
33
|
-
)
|
|
34
|
-
if (permissionDisabled) {
|
|
35
|
-
disabledWhy = `Vous n'avez pas la permission: ${Array.isArray(param.permission) ? param.permission.map((c) => `"${c.caption}"`).join(' ou ') : `"${param.permission.caption}"`}`
|
|
36
|
-
} else {
|
|
37
|
-
disabledWhy = ''
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
permissionDisabled = false
|
|
41
|
-
disabledWhy = ''
|
|
42
|
-
}
|
|
7
|
+
// TODO: extend HTMLButtonAttributes ?
|
|
8
|
+
interface Props {
|
|
9
|
+
isLoading?: boolean
|
|
10
|
+
tooltip?: import('svelte').Snippet
|
|
11
|
+
class?: string
|
|
12
|
+
children?: import('svelte').Snippet
|
|
13
|
+
disabled?: boolean | null
|
|
14
|
+
[key: string]: any
|
|
43
15
|
}
|
|
44
16
|
|
|
45
|
-
let
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
17
|
+
let {
|
|
18
|
+
isLoading = false,
|
|
19
|
+
class: className = '',
|
|
20
|
+
children,
|
|
21
|
+
tooltip,
|
|
22
|
+
disabled: disabledProp,
|
|
23
|
+
...rest
|
|
24
|
+
}: Props = $props()
|
|
53
25
|
|
|
54
|
-
|
|
55
|
-
update(param) {
|
|
56
|
-
// the value of `bar` has changed
|
|
57
|
-
updates(param)
|
|
58
|
-
},
|
|
26
|
+
let disabled = $derived(disabledProp || isLoading)
|
|
59
27
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
28
|
+
// let's trigger the annimation if it's more than 200ms
|
|
29
|
+
let triggerAnnimation = $state(false)
|
|
30
|
+
$effect(() => {
|
|
31
|
+
isLoading &&
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
if (isLoading) {
|
|
34
|
+
triggerAnnimation = true
|
|
35
|
+
}
|
|
36
|
+
}, 200)
|
|
37
|
+
})
|
|
65
38
|
|
|
66
39
|
const {
|
|
67
40
|
elements: { trigger, content, arrow },
|
|
@@ -81,14 +54,13 @@
|
|
|
81
54
|
|
|
82
55
|
<button
|
|
83
56
|
{...$trigger}
|
|
84
|
-
use:
|
|
85
|
-
|
|
86
|
-
{
|
|
87
|
-
class={tw(['btn text-white', disabled ? '' : 'btn-primary', className])}
|
|
57
|
+
use:trigger
|
|
58
|
+
{...rest}
|
|
59
|
+
class={tw(['btn', className])}
|
|
88
60
|
{disabled}
|
|
89
61
|
>
|
|
90
62
|
<!-- btn-outline -->
|
|
91
|
-
|
|
63
|
+
{@render children?.()}
|
|
92
64
|
{#if triggerAnnimation && isLoading}
|
|
93
65
|
<div in:fly={{ x: -20 }}>
|
|
94
66
|
<span class="loading loading-spinner"></span>
|
|
@@ -96,7 +68,7 @@
|
|
|
96
68
|
{/if}
|
|
97
69
|
</button>
|
|
98
70
|
|
|
99
|
-
{#if $open &&
|
|
71
|
+
{#if $open && tooltip}
|
|
100
72
|
<div
|
|
101
73
|
{...$content}
|
|
102
74
|
use:content
|
|
@@ -105,11 +77,7 @@
|
|
|
105
77
|
>
|
|
106
78
|
<div {...$arrow} use:arrow></div>
|
|
107
79
|
<div class="px-4 py-1">
|
|
108
|
-
{
|
|
109
|
-
<slot name="tooltip" />
|
|
110
|
-
{:else}
|
|
111
|
-
{disabledWhy}
|
|
112
|
-
{/if}
|
|
80
|
+
{@render tooltip?.()}
|
|
113
81
|
</div>
|
|
114
82
|
</div>
|
|
115
83
|
{/if}
|
|
@@ -1,37 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
$$slots?: Slots;
|
|
9
|
-
}): Exports & {
|
|
10
|
-
$set?: any;
|
|
11
|
-
$on?: any;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
1
|
+
interface Props {
|
|
2
|
+
isLoading?: boolean;
|
|
3
|
+
tooltip?: import('svelte').Snippet;
|
|
4
|
+
class?: string;
|
|
5
|
+
children?: import('svelte').Snippet;
|
|
6
|
+
disabled?: boolean | null;
|
|
7
|
+
[key: string]: any;
|
|
14
8
|
}
|
|
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>;
|
|
9
|
+
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Button = ReturnType<typeof Button>;
|
|
37
11
|
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;
|
package/esm/ui/Field.svelte
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { HTMLInputAttributes } from 'svelte/elements'
|
|
4
4
|
|
|
5
5
|
import { type FieldMetadata, type FindOptions } from 'remult'
|
|
6
|
+
import { midTrim } from '@kitql/helpers'
|
|
6
7
|
|
|
7
8
|
import { suffixWithS } from '../formats/strings'
|
|
8
9
|
import { type BaseItem, type Cell } from '../internals'
|
|
@@ -23,8 +24,11 @@
|
|
|
23
24
|
import SelectRadio from './internals/select/SelectRadio.svelte'
|
|
24
25
|
import Textarea from './internals/Textarea.svelte'
|
|
25
26
|
import { LibIcon_Eye, LibIcon_EyeOff } from './LibIcon'
|
|
27
|
+
import Link from './link/Link.svelte'
|
|
26
28
|
import LinkPlus from './link/LinkPlus.svelte'
|
|
27
29
|
|
|
30
|
+
// import Select2 from './internals/select/Select2.svelte'
|
|
31
|
+
|
|
28
32
|
export let cell: Cell<T>
|
|
29
33
|
export let value: HTMLInputAttributes['value'] = undefined
|
|
30
34
|
|
|
@@ -163,7 +167,16 @@
|
|
|
163
167
|
}
|
|
164
168
|
}
|
|
165
169
|
|
|
166
|
-
|
|
170
|
+
const items = arr.map((r) => getEntityDisplayValue(metaTypeObj.repoTarget, r))
|
|
171
|
+
|
|
172
|
+
// Add "nobody" option at the beginning for filters if configured
|
|
173
|
+
// @ts-ignore
|
|
174
|
+
const filterNobodyLabel = cell.field?.options.filterNobodyLabel
|
|
175
|
+
if (mode === 'filtre' && filterNobodyLabel && str === '') {
|
|
176
|
+
items.unshift({ id: null, caption: filterNobodyLabel })
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return { items, totalCount }
|
|
167
180
|
}
|
|
168
181
|
|
|
169
182
|
const getMultiValues = (value: any) => {
|
|
@@ -203,9 +216,15 @@
|
|
|
203
216
|
{@const clearableComputed =
|
|
204
217
|
cell.clearable || clearable || (mode === 'filtre' && clearable === undefined)}
|
|
205
218
|
{#if isViewMode(mode, cell.field)}
|
|
206
|
-
<span class="
|
|
219
|
+
<span class="flex items-center pr-4 pl-2">
|
|
207
220
|
{#if cell.field?.inputType === 'checkbox'}
|
|
208
|
-
<input
|
|
221
|
+
<input
|
|
222
|
+
type="checkbox"
|
|
223
|
+
{...common(cell.field)}
|
|
224
|
+
class="checkbox ml-2 border-base-content/60"
|
|
225
|
+
disabled
|
|
226
|
+
checked={value}
|
|
227
|
+
/>
|
|
209
228
|
{:else if metaType.kind === 'relation'}
|
|
210
229
|
{@const item = getEntityDisplayValue(metaType.repoTarget, value)}
|
|
211
230
|
<div class={tw('flex items-center gap-4', 'h-12', 'pl-2')}>
|
|
@@ -219,10 +238,23 @@
|
|
|
219
238
|
{/if}
|
|
220
239
|
<Clipboardable value={v}>{v}</Clipboardable>
|
|
221
240
|
</div>
|
|
241
|
+
{:else if metaType.subKind === 'link'}
|
|
242
|
+
<div class="ml-2 flex h-12 max-w-sm items-center gap-4 truncate">
|
|
243
|
+
{#if value}
|
|
244
|
+
<Link href={value} target="_blank" isExternal
|
|
245
|
+
>{midTrim(value.replaceAll('https://', '').replaceAll('www.', ''), {
|
|
246
|
+
len: 38,
|
|
247
|
+
midStr: ' ... ',
|
|
248
|
+
})}</Link
|
|
249
|
+
>
|
|
250
|
+
{:else}
|
|
251
|
+
<span class="text-base-content/30">-</span>
|
|
252
|
+
{/if}
|
|
253
|
+
</div>
|
|
222
254
|
{:else}
|
|
223
255
|
{@const v = displayWithDefaultAndSuffix(cell.field, value)}
|
|
224
256
|
<div
|
|
225
|
-
class="ml-2 flex h-12 w-full items-center {metaType.subKind === 'number' ? 'justify-end' : ''}"
|
|
257
|
+
class="ml-2 pb-2 flex h-12 w-full items-center {metaType.subKind === 'number' ? 'justify-end' : ''}"
|
|
226
258
|
>
|
|
227
259
|
<Clipboardable value={v}>{v}</Clipboardable>
|
|
228
260
|
</div>
|
|
@@ -273,6 +305,13 @@
|
|
|
273
305
|
on:selected={(e) => dispatchSelected(e.detail)}
|
|
274
306
|
/>
|
|
275
307
|
{:else}
|
|
308
|
+
<!-- <Select2
|
|
309
|
+
{...common(cell.field, true)}
|
|
310
|
+
clearable={clearableComputed}
|
|
311
|
+
items={metaType.values}
|
|
312
|
+
value={value?.id || value}
|
|
313
|
+
onChange={(e) => dispatchSelected(metaType.values.find((v) => v.id === e))}
|
|
314
|
+
/> -->
|
|
276
315
|
<SelectMelt
|
|
277
316
|
{focus}
|
|
278
317
|
{...common(cell.field, true)}
|
|
@@ -286,7 +325,7 @@
|
|
|
286
325
|
/>
|
|
287
326
|
{/if}
|
|
288
327
|
{:else if metaType.subKind === 'checkbox'}
|
|
289
|
-
<div class="grid content-center items-center pl-4">
|
|
328
|
+
<div class="grid content-center items-center pl-4 pb-2">
|
|
290
329
|
<input
|
|
291
330
|
type="checkbox"
|
|
292
331
|
{...{ ...common(cell.field), required: undefined }}
|
|
@@ -299,20 +338,20 @@
|
|
|
299
338
|
}}
|
|
300
339
|
/>
|
|
301
340
|
</div>
|
|
302
|
-
{:else if metaType.subKind === 'text' || metaType.subKind === 'email' || metaType.subKind === 'password' || metaType.subKind === '
|
|
303
|
-
<div class="input
|
|
341
|
+
{:else if metaType.subKind === 'text' || metaType.subKind === 'email' || metaType.subKind === 'password' || metaType.subKind === 'date' || metaType.subKind === 'number' || metaType.subKind === 'textpsd' || metaType.subKind === 'link'}
|
|
342
|
+
<div class="input inline-flex w-full items-center pl-2">
|
|
304
343
|
<Input
|
|
305
344
|
{focus}
|
|
306
345
|
{...common(cell.field)}
|
|
307
346
|
autocomplete="off"
|
|
308
347
|
class={tw(
|
|
309
|
-
`join-item w-full
|
|
348
|
+
`join-item w-full placeholder:text-base-content/30`,
|
|
310
349
|
metaType.subKind === 'number' && 'text-end',
|
|
311
350
|
)}
|
|
312
351
|
style={cell.field?.inputType === 'textpsd' && textpsdVisible === false
|
|
313
352
|
? 'filter: blur(0.2rem)'
|
|
314
353
|
: ''}
|
|
315
|
-
type={metaType.subKind.replaceAll('
|
|
354
|
+
type={metaType.subKind.replaceAll('textpsd', 'text').replaceAll('link', 'text')}
|
|
316
355
|
value={toInput(cell.field, value)}
|
|
317
356
|
{withDedounce}
|
|
318
357
|
on:input={(e) => {
|
|
@@ -3,7 +3,7 @@ import { type StoreItem } from '../internals';
|
|
|
3
3
|
import type { Cell } from '../internals/cellsBuildor';
|
|
4
4
|
declare class __sveltets_Render<T extends Record<any, any>> {
|
|
5
5
|
props(): {
|
|
6
|
-
mode?: "
|
|
6
|
+
mode?: "view" | "edit" | "filtre";
|
|
7
7
|
cells: Cell<T>[];
|
|
8
8
|
store: StoreItem<T>;
|
|
9
9
|
focusKey?: string | null | undefined;
|
package/esm/ui/Grid.svelte
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import Clipboardable from './Clipboardable.svelte'
|
|
17
17
|
import GridLoading from './GridLoading.svelte'
|
|
18
18
|
import Icon from './Icon.svelte'
|
|
19
|
-
import { align, getAligns } from './index.js'
|
|
19
|
+
import { align, baseTable, getAligns } from './index.js'
|
|
20
20
|
import {
|
|
21
21
|
LibIcon_Add,
|
|
22
22
|
LibIcon_Settings,
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
export let loadingRows = 5
|
|
37
37
|
|
|
38
38
|
export let classes = {
|
|
39
|
-
table: 'table-pin-rows table-pin-cols',
|
|
39
|
+
// table: 'table-pin-rows table-pin-cols',
|
|
40
|
+
table: '',
|
|
40
41
|
}
|
|
41
42
|
export let orderBy: EntityOrderBy<T> | undefined = undefined
|
|
42
43
|
export let orderByCols: (keyof T)[] | true | undefined = undefined
|
|
43
|
-
export let settingsLeft = false
|
|
44
44
|
|
|
45
45
|
export let dicoNoResult = 'Aucun résultat !'
|
|
46
46
|
|
|
@@ -84,58 +84,15 @@
|
|
|
84
84
|
const cellsToTake = (cells: Cell<T>[]) => {
|
|
85
85
|
return cells.filter((c) => c.modeView !== 'hide')
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
const classForRounding = (i: number) => {
|
|
89
|
-
if (settingsLeft && (withEdit || withDelete || withAdd)) {
|
|
90
|
-
if (i === 0) {
|
|
91
|
-
return ''
|
|
92
|
-
} else if (i === cells.length - 1) {
|
|
93
|
-
return 'rounded-tr-lg'
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (!settingsLeft && (withEdit || withDelete || withAdd)) {
|
|
98
|
-
if (i === 0) {
|
|
99
|
-
return 'rounded-tl-lg'
|
|
100
|
-
} else if (i === cells.length - 1) {
|
|
101
|
-
return ''
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (i === 0) {
|
|
106
|
-
return 'rounded-tl-lg'
|
|
107
|
-
} else if (i === cells.length - 1) {
|
|
108
|
-
return 'rounded-tr-lg'
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
87
|
</script>
|
|
112
88
|
|
|
113
89
|
<div class="overflow-x-auto">
|
|
114
|
-
<table class="table {classes.table}
|
|
90
|
+
<table class="table {classes.table} {baseTable}">
|
|
115
91
|
<thead>
|
|
116
92
|
<tr>
|
|
117
|
-
{#if settingsLeft && (withEdit || withDelete || withAdd)}
|
|
118
|
-
<th class="rounded-tl-lg">
|
|
119
|
-
<div class="flex justify-start">
|
|
120
|
-
{#if !withAdd}
|
|
121
|
-
<Icon data={LibIcon_Settings}></Icon>
|
|
122
|
-
{:else}
|
|
123
|
-
<Button
|
|
124
|
-
permission={store.getRepo().metadata.options.permissionApiInsert}
|
|
125
|
-
disabled={!store.getRepo().metadata.apiInsertAllowed()}
|
|
126
|
-
class="btn btn-square btn-ghost btn-xs"
|
|
127
|
-
on:click={() => dispatch('add', {})}
|
|
128
|
-
>
|
|
129
|
-
<Icon data={LibIcon_Add} />
|
|
130
|
-
</Button>
|
|
131
|
-
{/if}
|
|
132
|
-
</div>
|
|
133
|
-
</th>
|
|
134
|
-
{/if}
|
|
135
|
-
|
|
136
93
|
{#each cellsToTake(cells) as b, i}
|
|
137
94
|
{@const al = align(b.field, b.kind === 'slot')}
|
|
138
|
-
<th class=
|
|
95
|
+
<th class={al}>
|
|
139
96
|
{#if b.headerSlot}
|
|
140
97
|
<slot name="header" field={b.field} />
|
|
141
98
|
{:else}
|
|
@@ -158,15 +115,14 @@
|
|
|
158
115
|
</th>
|
|
159
116
|
{/each}
|
|
160
117
|
|
|
161
|
-
{#if
|
|
162
|
-
<th class="
|
|
118
|
+
{#if withEdit || withDelete || withAdd}
|
|
119
|
+
<th class="">
|
|
163
120
|
<div class="flex justify-end">
|
|
164
121
|
{#if withAdd}
|
|
165
122
|
<Button
|
|
166
|
-
permission={store.getRepo().metadata.options.permissionApiInsert}
|
|
167
123
|
disabled={!store.getRepo().metadata.apiInsertAllowed()}
|
|
168
124
|
class="btn btn-square btn-ghost btn-xs"
|
|
169
|
-
|
|
125
|
+
onclick={() => dispatch('add', {})}
|
|
170
126
|
>
|
|
171
127
|
<Icon data={LibIcon_Add} />
|
|
172
128
|
</Button>
|
|
@@ -185,34 +141,6 @@
|
|
|
185
141
|
{:else}
|
|
186
142
|
{#each $store.items as row}
|
|
187
143
|
<tr on:click={() => dispatch('rowclick', row)} class="hover:bg-base-content/20">
|
|
188
|
-
<!-- BECARFULL THIS CODE IS DUPLICATED -->
|
|
189
|
-
{#if settingsLeft && (withEdit || withDelete)}
|
|
190
|
-
<td class="text-left">
|
|
191
|
-
<div class="flex justify-start gap-2">
|
|
192
|
-
{#if withEdit}
|
|
193
|
-
<Button
|
|
194
|
-
permission={store.getRepo().metadata.options.permissionApiUpdate}
|
|
195
|
-
disabled={!store.getRepo().metadata.apiUpdateAllowed()}
|
|
196
|
-
class="btn btn-square btn-ghost btn-xs"
|
|
197
|
-
on:click={() => dispatch('edit', row)}
|
|
198
|
-
>
|
|
199
|
-
<Icon data={LibIcon_Edit} />
|
|
200
|
-
</Button>
|
|
201
|
-
{/if}
|
|
202
|
-
{#if withDelete}
|
|
203
|
-
<Button
|
|
204
|
-
permission={store.getRepo().metadata.options.permissionApiDelete}
|
|
205
|
-
disabled={!store.getRepo().metadata.apiDeleteAllowed()}
|
|
206
|
-
class="btn btn-square btn-ghost btn-xs"
|
|
207
|
-
on:click={() => dispatch('delete', row)}
|
|
208
|
-
>
|
|
209
|
-
<Icon data={LibIcon_Delete} />
|
|
210
|
-
</Button>
|
|
211
|
-
{/if}
|
|
212
|
-
</div>
|
|
213
|
-
</td>
|
|
214
|
-
{/if}
|
|
215
|
-
|
|
216
144
|
{#each cellsToTake(cells) as b}
|
|
217
145
|
{@const metaType = getFieldMetaType(b.field)}
|
|
218
146
|
<td class={align(b.field, b.kind === 'slot')}>
|
|
@@ -274,38 +202,36 @@
|
|
|
274
202
|
<Clipboardable value={t}>
|
|
275
203
|
<!-- 20 is a cool value ! -->
|
|
276
204
|
<span class={t.length < 20 ? 'text-nowrap' : ''}>
|
|
277
|
-
{t}
|
|
205
|
+
{@html t}
|
|
278
206
|
</span>
|
|
279
207
|
</Clipboardable>
|
|
280
208
|
{:else}
|
|
281
209
|
<!-- 20 is a cool value ! -->
|
|
282
210
|
<span class={t.length < 20 ? 'text-nowrap' : ''}>
|
|
283
|
-
{t}
|
|
211
|
+
{@html t}
|
|
284
212
|
</span>
|
|
285
213
|
{/if}
|
|
286
214
|
{/if}
|
|
287
215
|
</td>
|
|
288
216
|
{/each}
|
|
289
217
|
|
|
290
|
-
{#if
|
|
218
|
+
{#if withEdit || withDelete}
|
|
291
219
|
<td class="text-right">
|
|
292
220
|
<div class="flex justify-end gap-2">
|
|
293
221
|
{#if withEdit}
|
|
294
222
|
<Button
|
|
295
|
-
permission={store.getRepo().metadata.options.permissionApiUpdate}
|
|
296
223
|
disabled={!store.getRepo().metadata.apiUpdateAllowed()}
|
|
297
224
|
class="btn btn-square btn-ghost btn-xs"
|
|
298
|
-
|
|
225
|
+
onclick={() => dispatch('edit', row)}
|
|
299
226
|
>
|
|
300
227
|
<Icon data={LibIcon_Edit} />
|
|
301
228
|
</Button>
|
|
302
229
|
{/if}
|
|
303
230
|
{#if withDelete}
|
|
304
231
|
<Button
|
|
305
|
-
permission={store.getRepo().metadata.options.permissionApiDelete}
|
|
306
232
|
disabled={!store.getRepo().metadata.apiDeleteAllowed()}
|
|
307
233
|
class="btn btn-square btn-ghost btn-xs"
|
|
308
|
-
|
|
234
|
+
onclick={() => dispatch('delete', row)}
|
|
309
235
|
>
|
|
310
236
|
<Icon data={LibIcon_Delete} />
|
|
311
237
|
</Button>
|
package/esm/ui/Grid.svelte.d.ts
CHANGED