mountain-ui 1.0.137 → 1.0.138
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/package.json +1 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/files/FilesImage/Button.svelte +8 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/files/FilesImage/Card.svelte +6 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/files/FilesImage/Icon.svelte +10 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/files/FilesImage/ImageUpload.svelte +120 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/files/FilesImage/Input.svelte +206 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/files/FilesImage/TableView.svelte +13 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/files/FilesImage/View.svelte +18 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/files/FilesImage/index.js +43 -0
- package/src/lib/registry/fieldTypeRegistry/registerDefaultFieldTypes.js +4 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mountain-ui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.138",
|
|
5
5
|
"description": "A comprehensive UI component library for ERP systems with field types, entities, and registry management built with Svelte",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "index.js",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M12 22.75C6.07 22.75 1.25 17.93 1.25 12C1.25 6.07 6.07 1.25 12 1.25C17.93 1.25 22.75 6.07 22.75 12C22.75 17.93 17.93 22.75 12 22.75ZM12 2.75C6.9 2.75 2.75 6.9 2.75 12C2.75 17.1 6.9 21.25 12 21.25C17.1 21.25 21.25 17.1 21.25 12C21.25 6.9 17.1 2.75 12 2.75Z"
|
|
4
|
+
fill="#292D32"
|
|
5
|
+
/>
|
|
6
|
+
<path
|
|
7
|
+
d="M10.5795 15.5801C10.3795 15.5801 10.1895 15.5001 10.0495 15.3601L7.21945 12.5301C6.92945 12.2401 6.92945 11.7601 7.21945 11.4701C7.50945 11.1801 7.98945 11.1801 8.27945 11.4701L10.5795 13.7701L15.7195 8.6301C16.0095 8.3401 16.4895 8.3401 16.7795 8.6301C17.0695 8.9201 17.0695 9.4001 16.7795 9.6901L11.1095 15.3601C10.9695 15.5001 10.7795 15.5801 10.5795 15.5801Z"
|
|
8
|
+
fill="#292D32"
|
|
9
|
+
/>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { AlertCard, Button, sendRequest, toast } from 'hamzus-ui';
|
|
3
|
+
import { projectRegistry } from 'mountain-ui';
|
|
4
|
+
|
|
5
|
+
// URL de base de ton API (à adapter)
|
|
6
|
+
let {
|
|
7
|
+
onChange = (fileId) => {},
|
|
8
|
+
fileId = null
|
|
9
|
+
} = $props()
|
|
10
|
+
|
|
11
|
+
let fileInput;
|
|
12
|
+
let imageUrl = null;
|
|
13
|
+
let isUploading = $state(false);
|
|
14
|
+
let errorMessage = $state(null);
|
|
15
|
+
|
|
16
|
+
async function handleFileChange(event) {
|
|
17
|
+
const file = event.target.files?.[0];
|
|
18
|
+
if (!file) return;
|
|
19
|
+
|
|
20
|
+
errorMessage = null;
|
|
21
|
+
fileId = null;
|
|
22
|
+
imageUrl = null;
|
|
23
|
+
isUploading = true;
|
|
24
|
+
|
|
25
|
+
const request = await sendRequest({
|
|
26
|
+
path: '/upload-image',
|
|
27
|
+
data: {
|
|
28
|
+
file
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (request.statusType === 'error') {
|
|
33
|
+
toast.error({
|
|
34
|
+
title: 'Erreur !',
|
|
35
|
+
description: request.message
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
fileId = request.data.id;
|
|
41
|
+
|
|
42
|
+
isUploading = false;
|
|
43
|
+
|
|
44
|
+
onChange(fileId);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function resetInput() {
|
|
48
|
+
fileId = null;
|
|
49
|
+
imageUrl = null;
|
|
50
|
+
errorMessage = null;
|
|
51
|
+
if (fileInput) fileInput.value = '';
|
|
52
|
+
|
|
53
|
+
onChange(null);
|
|
54
|
+
}
|
|
55
|
+
function openFilePicker() {
|
|
56
|
+
fileInput.click();
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<div class="upload-container">
|
|
61
|
+
<input
|
|
62
|
+
type="file"
|
|
63
|
+
accept="image/*"
|
|
64
|
+
bind:this={fileInput}
|
|
65
|
+
on:change={handleFileChange}
|
|
66
|
+
disabled={isUploading}
|
|
67
|
+
style="display: none;"
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
<Button onClick={openFilePicker} loading={isUploading} variant="secondary" style="width:100%;">
|
|
71
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
72
|
+
<path d="M22.0005 13.9001V16.1901C22.0005 19.8301 19.8305 22.0001 16.1905 22.0001H7.81055C5.26055 22.0001 3.42055 20.9301 2.56055 19.0301L2.67055 18.9501L7.59055 15.6501C8.39055 15.1101 9.52055 15.1701 10.2305 15.7901L10.5705 16.0701C11.3505 16.7401 12.6105 16.7401 13.3905 16.0701L17.5505 12.5001C18.3305 11.8301 19.5905 11.8301 20.3705 12.5001L22.0005 13.9001Z" fill="#292D32"/>
|
|
73
|
+
<path opacity="0.4" d="M20.97 8H18.03C16.76 8 16 7.24 16 5.97V3.03C16 2.63 16.08 2.29 16.22 2C16.21 2 16.2 2 16.19 2H7.81C4.17 2 2 4.17 2 7.81V16.19C2 17.28 2.19 18.23 2.56 19.03L2.67 18.95L7.59 15.65C8.39 15.11 9.52 15.17 10.23 15.79L10.57 16.07C11.35 16.74 12.61 16.74 13.39 16.07L17.55 12.5C18.33 11.83 19.59 11.83 20.37 12.5L22 13.9V7.81C22 7.8 22 7.79 22 7.78C21.71 7.92 21.37 8 20.97 8Z" fill="#292D32"/>
|
|
74
|
+
<path d="M8.99914 10.3801C10.3136 10.3801 11.3791 9.31456 11.3791 8.00012C11.3791 6.68568 10.3136 5.62012 8.99914 5.62012C7.6847 5.62012 6.61914 6.68568 6.61914 8.00012C6.61914 9.31456 7.6847 10.3801 8.99914 10.3801Z" fill="#292D32"/>
|
|
75
|
+
<path d="M20.97 8H18.03C16.76 8 16 7.24 16 5.97V3.03C16 1.76 16.76 1 18.03 1H20.97C22.24 1 23 1.76 23 3.03V5.97C23 7.24 22.24 8 20.97 8ZM21.19 4.69C21.07 4.57 20.91 4.51 20.75 4.51C20.59 4.51 20.43 4.57 20.31 4.69L20.13 4.87V2.63C20.13 2.28 19.85 2 19.5 2C19.15 2 18.87 2.28 18.87 2.63V4.87L18.69 4.69C18.45 4.45 18.05 4.45 17.81 4.69C17.57 4.93 17.57 5.33 17.81 5.57L19.06 6.82C19.11 6.87 19.18 6.91 19.25 6.94C19.27 6.95 19.29 6.95 19.31 6.96C19.36 6.98 19.41 6.99 19.47 6.99C19.49 6.99 19.51 6.99 19.53 6.99C19.6 6.99 19.66 6.98 19.73 6.95C19.74 6.95 19.74 6.95 19.75 6.95C19.82 6.92 19.88 6.88 19.93 6.83C19.94 6.82 19.94 6.82 19.95 6.82L21.2 5.57C21.44 5.33 21.44 4.93 21.19 4.69Z" fill="#292D32"/>
|
|
76
|
+
</svg>
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<h5>attacher une image</h5>
|
|
80
|
+
</Button>
|
|
81
|
+
|
|
82
|
+
{#if errorMessage}
|
|
83
|
+
<AlertCard>{errorMessage}</AlertCard>
|
|
84
|
+
{/if}
|
|
85
|
+
|
|
86
|
+
{#if fileId}
|
|
87
|
+
<div class="preview">
|
|
88
|
+
<img src="{import.meta.env.VITE_API_URL}/get-image?__project_normalized_name={projectRegistry.getTargetProject().normalized_name}&fileId={fileId}" alt="Fichier uploadé" />
|
|
89
|
+
<Button variant="ghost" style="width:100%;" onClick={resetInput}>
|
|
90
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
91
|
+
<path opacity="0.4" d="M20.46 3.54L3.54 20.46C2.54 19.46 2 18.01 2 16.19V7.81C2 4.17 4.17 2 7.81 2H16.19C18.01 2 19.46 2.54 20.46 3.54Z" fill="#292D32"/>
|
|
92
|
+
<path opacity="0.4" d="M21.9993 7.81014V13.9001L20.3693 12.5001C19.5893 11.8301 18.3293 11.8301 17.5493 12.5001L13.3893 16.0701C12.6793 16.6801 11.5593 16.7401 10.7793 16.2201L21.6093 5.39014C21.7493 5.77014 21.8493 6.17014 21.9093 6.60014C21.9693 6.98014 21.9993 7.39014 21.9993 7.81014Z" fill="#292D32"/>
|
|
93
|
+
<path d="M22.0006 13.9001V16.1901C22.0006 19.8301 19.8306 22.0001 16.1906 22.0001H7.81063C7.39062 22.0001 6.98063 21.9701 6.60063 21.9101C6.17063 21.8501 5.77062 21.7501 5.39062 21.6101L10.7806 16.2201C11.5606 16.7401 12.6806 16.6801 13.3906 16.0701L17.5506 12.5001C18.3306 11.8301 19.5906 11.8301 20.3706 12.5001L22.0006 13.9001Z" fill="#292D32"/>
|
|
94
|
+
<path d="M21.7709 2.22988C21.4709 1.92988 20.9809 1.92988 20.6809 2.22988L2.23086 20.6899C1.93086 20.9899 1.93086 21.4799 2.23086 21.7799C2.38086 21.9199 2.57086 21.9999 2.77086 21.9999C2.97086 21.9999 3.16086 21.9199 3.31086 21.7699L21.7709 3.30988C22.0809 3.00988 22.0809 2.52988 21.7709 2.22988Z" fill="#292D32"/>
|
|
95
|
+
<path d="M7.99914 10.3801C9.31358 10.3801 10.3791 9.31456 10.3791 8.00012C10.3791 6.68568 9.31358 5.62012 7.99914 5.62012C6.6847 5.62012 5.61914 6.68568 5.61914 8.00012C5.61914 9.31456 6.6847 10.3801 7.99914 10.3801Z" fill="#292D32"/>
|
|
96
|
+
</svg>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<h5>déttacher</h5>
|
|
100
|
+
</Button>
|
|
101
|
+
</div>
|
|
102
|
+
{/if}
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<style>
|
|
106
|
+
.upload-container {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
row-gap: var(--pad-s);
|
|
110
|
+
padding: var(--pad-s);
|
|
111
|
+
border-radius: var(--radius-l);
|
|
112
|
+
border: 1px solid var(--bg-2);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
img {
|
|
116
|
+
max-width: 100%;
|
|
117
|
+
border-radius: 8px;
|
|
118
|
+
border: 1px solid var(--stroke);
|
|
119
|
+
}
|
|
120
|
+
</style>
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { projectRegistry } from '$lib/registry/projectRegistry/registry.svelte';
|
|
3
|
+
import Label from '../../../components/Label.svelte';
|
|
4
|
+
import Line from '../../../components/Line.svelte';
|
|
5
|
+
import { Button, DropdownMenu, IconButton, Tag } from 'hamzus-ui';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
value = $bindable(''),
|
|
9
|
+
onChange = () => {},
|
|
10
|
+
name = '',
|
|
11
|
+
label = '',
|
|
12
|
+
compact = false,
|
|
13
|
+
unique = false,
|
|
14
|
+
secret = false,
|
|
15
|
+
required = false,
|
|
16
|
+
...props
|
|
17
|
+
} = $props();
|
|
18
|
+
|
|
19
|
+
const files = $derived(JSON.parse(value));
|
|
20
|
+
|
|
21
|
+
const targetProject = projectRegistry.getTargetProject();
|
|
22
|
+
|
|
23
|
+
let fileInput;
|
|
24
|
+
|
|
25
|
+
let isUploading = $state(false);
|
|
26
|
+
|
|
27
|
+
async function handleFileChange(event) {
|
|
28
|
+
const file = event.target.files?.[0];
|
|
29
|
+
if (!file) return;
|
|
30
|
+
|
|
31
|
+
isUploading = true;
|
|
32
|
+
|
|
33
|
+
const request = await sendRequest({
|
|
34
|
+
path: '/upload-image',
|
|
35
|
+
data: {
|
|
36
|
+
file
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if (request.statusType === 'error') {
|
|
41
|
+
isUploading = false;
|
|
42
|
+
toast.error({
|
|
43
|
+
title: 'Erreur !',
|
|
44
|
+
description: request.message
|
|
45
|
+
});
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
fileId = request.data.id;
|
|
50
|
+
|
|
51
|
+
isUploading = false;
|
|
52
|
+
|
|
53
|
+
addFieldId(fileId)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function addFieldId(fieldId) {
|
|
57
|
+
let decodedValue = JSON.parse(value ?? '[]');
|
|
58
|
+
|
|
59
|
+
if (decodedValue.includes(fieldId)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
decodedValue.push(fieldId);
|
|
64
|
+
|
|
65
|
+
value = JSON.stringify(decodedValue);
|
|
66
|
+
|
|
67
|
+
onChange(value)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function removeFieldId(fieldId) {
|
|
71
|
+
let decodedValue = JSON.parse(value ?? '[]');
|
|
72
|
+
|
|
73
|
+
decodedValue = decodedValue.filter((fID) => fID !== fieldId);
|
|
74
|
+
|
|
75
|
+
value = JSON.stringify(decodedValue);
|
|
76
|
+
|
|
77
|
+
onChange(value)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function openFilePicker() {
|
|
81
|
+
fileInput.click();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function resetInput(params) {
|
|
85
|
+
value = "[]"
|
|
86
|
+
|
|
87
|
+
if (fileInput) fileInput.value = '';
|
|
88
|
+
|
|
89
|
+
onChange(null);
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<Line {compact}>
|
|
94
|
+
<Label {unique} {secret} {label} {required}></Label>
|
|
95
|
+
<div class="choices">
|
|
96
|
+
<input
|
|
97
|
+
type="file"
|
|
98
|
+
accept="image/*"
|
|
99
|
+
bind:this={fileInput}
|
|
100
|
+
on:change={handleFileChange}
|
|
101
|
+
disabled={isUploading}
|
|
102
|
+
style="display: none;"
|
|
103
|
+
/>
|
|
104
|
+
|
|
105
|
+
<div class="images">
|
|
106
|
+
{#each files as fileId}
|
|
107
|
+
<div class="image">
|
|
108
|
+
<img
|
|
109
|
+
src="{import.meta.env
|
|
110
|
+
.VITE_API_URL}/get-image?__project_normalized_name={targetProject.normalized_name}&fileId={fileId}"
|
|
111
|
+
/>
|
|
112
|
+
<IconButton onClick={()=>{removeFieldId(fileId)}} loading={isUploading} variant="secondary" size="24px">
|
|
113
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
114
|
+
<path opacity="0.4" d="M20.46 3.54L3.54 20.46C2.54 19.46 2 18.01 2 16.19V7.81C2 4.17 4.17 2 7.81 2H16.19C18.01 2 19.46 2.54 20.46 3.54Z" fill="#292D32"/>
|
|
115
|
+
<path opacity="0.4" d="M21.9993 7.81014V13.9001L20.3693 12.5001C19.5893 11.8301 18.3293 11.8301 17.5493 12.5001L13.3893 16.0701C12.6793 16.6801 11.5593 16.7401 10.7793 16.2201L21.6093 5.39014C21.7493 5.77014 21.8493 6.17014 21.9093 6.60014C21.9693 6.98014 21.9993 7.39014 21.9993 7.81014Z" fill="#292D32"/>
|
|
116
|
+
<path d="M22.0006 13.9001V16.1901C22.0006 19.8301 19.8306 22.0001 16.1906 22.0001H7.81063C7.39062 22.0001 6.98063 21.9701 6.60063 21.9101C6.17063 21.8501 5.77062 21.7501 5.39062 21.6101L10.7806 16.2201C11.5606 16.7401 12.6806 16.6801 13.3906 16.0701L17.5506 12.5001C18.3306 11.8301 19.5906 11.8301 20.3706 12.5001L22.0006 13.9001Z" fill="#292D32"/>
|
|
117
|
+
<path d="M21.7709 2.22988C21.4709 1.92988 20.9809 1.92988 20.6809 2.22988L2.23086 20.6899C1.93086 20.9899 1.93086 21.4799 2.23086 21.7799C2.38086 21.9199 2.57086 21.9999 2.77086 21.9999C2.97086 21.9999 3.16086 21.9199 3.31086 21.7699L21.7709 3.30988C22.0809 3.00988 22.0809 2.52988 21.7709 2.22988Z" fill="#292D32"/>
|
|
118
|
+
<path d="M7.99914 10.3801C9.31358 10.3801 10.3791 9.31456 10.3791 8.00012C10.3791 6.68568 9.31358 5.62012 7.99914 5.62012C6.6847 5.62012 5.61914 6.68568 5.61914 8.00012C5.61914 9.31456 6.6847 10.3801 7.99914 10.3801Z" fill="#292D32"/>
|
|
119
|
+
</svg>
|
|
120
|
+
</IconButton>
|
|
121
|
+
</div>
|
|
122
|
+
{/each}
|
|
123
|
+
<Button
|
|
124
|
+
onClick={openFilePicker}
|
|
125
|
+
loading={isUploading}
|
|
126
|
+
variant="secondary"
|
|
127
|
+
style="width:100%;"
|
|
128
|
+
>
|
|
129
|
+
<svg
|
|
130
|
+
width="24"
|
|
131
|
+
height="24"
|
|
132
|
+
viewBox="0 0 24 24"
|
|
133
|
+
fill="none"
|
|
134
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
135
|
+
>
|
|
136
|
+
<path
|
|
137
|
+
d="M22.0005 13.9001V16.1901C22.0005 19.8301 19.8305 22.0001 16.1905 22.0001H7.81055C5.26055 22.0001 3.42055 20.9301 2.56055 19.0301L2.67055 18.9501L7.59055 15.6501C8.39055 15.1101 9.52055 15.1701 10.2305 15.7901L10.5705 16.0701C11.3505 16.7401 12.6105 16.7401 13.3905 16.0701L17.5505 12.5001C18.3305 11.8301 19.5905 11.8301 20.3705 12.5001L22.0005 13.9001Z"
|
|
138
|
+
fill="#292D32"
|
|
139
|
+
/>
|
|
140
|
+
<path
|
|
141
|
+
opacity="0.4"
|
|
142
|
+
d="M20.97 8H18.03C16.76 8 16 7.24 16 5.97V3.03C16 2.63 16.08 2.29 16.22 2C16.21 2 16.2 2 16.19 2H7.81C4.17 2 2 4.17 2 7.81V16.19C2 17.28 2.19 18.23 2.56 19.03L2.67 18.95L7.59 15.65C8.39 15.11 9.52 15.17 10.23 15.79L10.57 16.07C11.35 16.74 12.61 16.74 13.39 16.07L17.55 12.5C18.33 11.83 19.59 11.83 20.37 12.5L22 13.9V7.81C22 7.8 22 7.79 22 7.78C21.71 7.92 21.37 8 20.97 8Z"
|
|
143
|
+
fill="#292D32"
|
|
144
|
+
/>
|
|
145
|
+
<path
|
|
146
|
+
d="M8.99914 10.3801C10.3136 10.3801 11.3791 9.31456 11.3791 8.00012C11.3791 6.68568 10.3136 5.62012 8.99914 5.62012C7.6847 5.62012 6.61914 6.68568 6.61914 8.00012C6.61914 9.31456 7.6847 10.3801 8.99914 10.3801Z"
|
|
147
|
+
fill="#292D32"
|
|
148
|
+
/>
|
|
149
|
+
<path
|
|
150
|
+
d="M20.97 8H18.03C16.76 8 16 7.24 16 5.97V3.03C16 1.76 16.76 1 18.03 1H20.97C22.24 1 23 1.76 23 3.03V5.97C23 7.24 22.24 8 20.97 8ZM21.19 4.69C21.07 4.57 20.91 4.51 20.75 4.51C20.59 4.51 20.43 4.57 20.31 4.69L20.13 4.87V2.63C20.13 2.28 19.85 2 19.5 2C19.15 2 18.87 2.28 18.87 2.63V4.87L18.69 4.69C18.45 4.45 18.05 4.45 17.81 4.69C17.57 4.93 17.57 5.33 17.81 5.57L19.06 6.82C19.11 6.87 19.18 6.91 19.25 6.94C19.27 6.95 19.29 6.95 19.31 6.96C19.36 6.98 19.41 6.99 19.47 6.99C19.49 6.99 19.51 6.99 19.53 6.99C19.6 6.99 19.66 6.98 19.73 6.95C19.74 6.95 19.74 6.95 19.75 6.95C19.82 6.92 19.88 6.88 19.93 6.83C19.94 6.82 19.94 6.82 19.95 6.82L21.2 5.57C21.44 5.33 21.44 4.93 21.19 4.69Z"
|
|
151
|
+
fill="#292D32"
|
|
152
|
+
/>
|
|
153
|
+
</svg>
|
|
154
|
+
|
|
155
|
+
<h5>attacher une image</h5>
|
|
156
|
+
</Button>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</Line>
|
|
160
|
+
|
|
161
|
+
<style>
|
|
162
|
+
.choices {
|
|
163
|
+
display: flex;
|
|
164
|
+
flex-direction: column;
|
|
165
|
+
row-gap: var(--pad-m);
|
|
166
|
+
padding: var(--pad-m);
|
|
167
|
+
background-color: var(--bg-2);
|
|
168
|
+
border-radius: var(--radius-m);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.choices:has(input:user-invalid) {
|
|
172
|
+
border: 1px solid var(--red);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.images {
|
|
176
|
+
display: flex;
|
|
177
|
+
flex-direction: column;
|
|
178
|
+
row-gap: var(--pad-xs);
|
|
179
|
+
width: 100%;
|
|
180
|
+
padding: var(--pad-s);
|
|
181
|
+
border: 1px solid var(--stroke);
|
|
182
|
+
border-radius: var(--radius-m);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.image {
|
|
186
|
+
display: flex;
|
|
187
|
+
align-items: center;
|
|
188
|
+
height: 34px;
|
|
189
|
+
width: 100%;
|
|
190
|
+
column-gap: var(--pad-m);
|
|
191
|
+
padding: var(--pad-xs);
|
|
192
|
+
border-radius: var(--radius-l);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.image:hover {
|
|
196
|
+
background-color: var(--bg-blur);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.image img {
|
|
200
|
+
height: 26px;
|
|
201
|
+
width: 100%;
|
|
202
|
+
object-fit: cover;
|
|
203
|
+
border-radius: var(--radius-xl);
|
|
204
|
+
overflow: clip;
|
|
205
|
+
}
|
|
206
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import ViewText from '../../../components/ViewText.svelte';
|
|
3
|
+
import { Tag } from 'hamzus-ui';
|
|
4
|
+
|
|
5
|
+
let {value, choices} = $props()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
{#if value && value.formated}
|
|
9
|
+
{@const data = choices.filter((el) => el.value === value.formated)[0]}
|
|
10
|
+
<Tag label={value.formated} color={data.color.replace('--', '')}></Tag>
|
|
11
|
+
{:else}
|
|
12
|
+
<ViewText>-</ViewText>
|
|
13
|
+
{/if}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import Label from '../../../components/Label.svelte';
|
|
3
|
+
import LineView from '../../../components/LineView.svelte';
|
|
4
|
+
import ViewText from '../../../components/ViewText.svelte';
|
|
5
|
+
import { Tag } from 'hamzus-ui';
|
|
6
|
+
|
|
7
|
+
let {value, choices, compact, unique, secret, label, required } = $props()
|
|
8
|
+
</script>
|
|
9
|
+
<LineView {compact}>
|
|
10
|
+
<Label {unique} {secret} {label} {required}></Label>
|
|
11
|
+
{#if value && value.formated}
|
|
12
|
+
{@const data = choices.filter((el) => el.value === value.formated)[0]}
|
|
13
|
+
<Tag label={value.formated} color={data.color.replace('--', '')}></Tag>
|
|
14
|
+
{:else}
|
|
15
|
+
<ViewText>-</ViewText>
|
|
16
|
+
{/if}
|
|
17
|
+
|
|
18
|
+
</LineView>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createFieldType } from '../../../createFieldType.js';
|
|
2
|
+
|
|
3
|
+
import Icon from './Icon.svelte';
|
|
4
|
+
import Button from './Button.svelte';
|
|
5
|
+
import Card from './Card.svelte';
|
|
6
|
+
import Input from './Input.svelte';
|
|
7
|
+
import TableView from './TableView.svelte';
|
|
8
|
+
import View from './View.svelte';
|
|
9
|
+
|
|
10
|
+
export default createFieldType({
|
|
11
|
+
type: 'files-image',
|
|
12
|
+
|
|
13
|
+
category_path: 'files',
|
|
14
|
+
|
|
15
|
+
label: 'Images',
|
|
16
|
+
description: 'Images multiple.',
|
|
17
|
+
|
|
18
|
+
is_hidden: false,
|
|
19
|
+
|
|
20
|
+
defaultProps: {},
|
|
21
|
+
|
|
22
|
+
can_be_required: false,
|
|
23
|
+
can_be_unique: false,
|
|
24
|
+
|
|
25
|
+
components: {
|
|
26
|
+
icon: Icon,
|
|
27
|
+
button: Button,
|
|
28
|
+
card: Card,
|
|
29
|
+
input: Input,
|
|
30
|
+
tableView: TableView,
|
|
31
|
+
view: View,
|
|
32
|
+
filter: null,
|
|
33
|
+
properties: null
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
tableAttributes: (props) => {},
|
|
37
|
+
|
|
38
|
+
allowBindings:["files-image"],
|
|
39
|
+
formatter: (value) => value,
|
|
40
|
+
parser: (value) => value,
|
|
41
|
+
|
|
42
|
+
validate: () => true
|
|
43
|
+
});
|
|
@@ -28,6 +28,7 @@ import TimeCreatedAt from './fieldTypes/time/TimeCreatedAt';
|
|
|
28
28
|
import TimeHour from './fieldTypes/time/TimeHour';
|
|
29
29
|
import MoneyCurrency from './fieldTypes/money/MoneyCurrency';
|
|
30
30
|
import LocalisationLand from './fieldTypes/localisation/LocalisationLand';
|
|
31
|
+
import FilesImage from './fieldTypes/files/FilesImage';
|
|
31
32
|
|
|
32
33
|
let isLoaded = false;
|
|
33
34
|
|
|
@@ -76,6 +77,9 @@ export function registerDefaultFieldTypes() {
|
|
|
76
77
|
|
|
77
78
|
// localisation
|
|
78
79
|
fieldTypeRegistry.register(LocalisationLand);
|
|
80
|
+
|
|
81
|
+
// files
|
|
82
|
+
fieldTypeRegistry.register(FilesImage);
|
|
79
83
|
|
|
80
84
|
isLoaded = true
|
|
81
85
|
}
|