mountain-ui 1.0.36 → 1.0.38
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/index.d.ts +5 -5
- package/index.js +5 -5
- package/package.json +1 -1
- package/src/lib/registry/entityRegistry/components/EntityForm.svelte +1 -0
- package/src/lib/registry/entityRegistry/registry.svelte.js +17 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/Input.svelte +1 -0
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/Input/Input.svelte +17 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/View.svelte +1 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/View.svelte +1 -1
- package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/View.svelte +1 -1
- package/src/lib/registry/projectRegistry/components/ProjectButton.svelte +14 -0
- package/src/lib/registry/projectRegistry/components/ProjectCard.svelte +43 -0
- package/src/lib/registry/projectRegistry/components/ProjectDropdown.svelte +117 -0
- package/src/lib/registry/projectRegistry/createProject.js +17 -0
- package/src/lib/registry/projectRegistry/registry.svelte.js +50 -0
- package/src/lib/registry/viewEntriesProfilRegistery/components/CreateViewEntriesProfilDialog.svelte +17 -0
- package/src/lib/registry/viewEntriesProfilRegistery/components/ViewEntriesProfilButton.svelte +51 -0
- package/src/lib/registry/viewEntriesProfilRegistery/components/ViewEntriesProfilComponent.svelte +32 -0
- package/src/lib/registry/viewEntriesProfilRegistery/components/ViewEntriesProfilDropdown.svelte +60 -0
- package/src/lib/registry/viewEntriesProfilRegistery/createViewEntriesProfil.js +15 -0
- package/src/lib/registry/viewEntriesProfilRegistery/registerDefaultViewEntriesProfils.js +13 -0
- package/src/lib/registry/viewEntriesProfilRegistery/registry.svelte.js +48 -0
- package/src/lib/registry/{viewTypeRegistry/components/ViewTypeButton.svelte → viewEntriesTypeRegistry/components/ViewEntriesTypeButton.svelte} +5 -4
- package/src/lib/registry/{viewTypeRegistry/components/ViewTypeComponent.svelte → viewEntriesTypeRegistry/components/ViewEntriesTypeComponent.svelte} +4 -4
- package/src/lib/registry/viewEntriesTypeRegistry/components/ViewEntriesTypeDropdown.svelte +32 -0
- package/src/lib/registry/viewEntriesTypeRegistry/components/ViewEntriesTypeIcon.svelte +9 -0
- package/src/lib/registry/viewEntriesTypeRegistry/createViewEntriesType.js +17 -0
- package/src/lib/registry/viewEntriesTypeRegistry/registerDefaultViewEntriesTypes.js +7 -0
- package/src/lib/registry/viewEntriesTypeRegistry/registry.svelte.js +44 -0
- package/src/lib/registry/{viewTypeRegistry/viewTypes → viewEntriesTypeRegistry/viewEntriesTypes}/Table/component/StructureTable.svelte +11 -4
- package/src/lib/registry/viewEntriesTypeRegistry/viewEntriesTypes/Table/index.js +14 -0
- package/src/routes/+layout.svelte +613 -598
- package/src/routes/+page.svelte +3 -3
- package/src/routes/exemple/+layout.svelte +44 -0
- package/src/routes/exemple/+page.svelte +0 -0
- package/src/routes/exemple/[project_normalized_name]/+layout.svelte +100 -0
- package/src/routes/exemple/[project_normalized_name]/[entity_slug]/+layout.svelte +44 -0
- package/src/routes/exemple/[project_normalized_name]/[entity_slug]/+page.svelte +182 -0
- package/src/routes/exemple/[project_normalized_name]/[entity_slug]/[entry_id]/+page.svelte +25 -0
- package/src/routes/exemple/[project_normalized_name]/[entity_slug]/create/+page.svelte +45 -0
- package/src/routes/exemple/[project_normalized_name]/home/+page.svelte +1 -0
- package/src/lib/registry/viewTypeRegistry/createViewType.js +0 -17
- package/src/lib/registry/viewTypeRegistry/registerDefaultViewTypes.js +0 -7
- package/src/lib/registry/viewTypeRegistry/registry.svelte.js +0 -44
- package/src/lib/registry/viewTypeRegistry/viewTypes/Table/component/Component copy.svelte +0 -11
- package/src/lib/registry/viewTypeRegistry/viewTypes/Table/index.js +0 -14
- /package/src/lib/registry/{viewTypeRegistry/viewTypes → viewEntriesTypeRegistry/viewEntriesTypes}/Table/Icon.svelte +0 -0
- /package/src/lib/registry/{viewTypeRegistry/viewTypes → viewEntriesTypeRegistry/viewEntriesTypes}/Table/component/Component.svelte +0 -0
package/src/routes/+page.svelte
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
import FieldTypeTableView from '$lib/registry/fieldTypeRegistry/components/FieldTypeTableView.svelte';
|
|
16
16
|
import FieldTypeView from '$lib/registry/fieldTypeRegistry/components/FieldTypeView.svelte';
|
|
17
17
|
import { fieldTypeRegistry } from '$lib/registry/fieldTypeRegistry/registry.svelte';
|
|
18
|
-
import ViewTypeComponent from '$lib/registry/
|
|
19
|
-
import { viewTypeRegistry } from '$lib/registry/
|
|
18
|
+
import ViewTypeComponent from '$lib/registry/viewEntriesTypeRegistry/components/ViewEntriesTypeComponent.svelte';
|
|
19
|
+
import { viewTypeRegistry } from '$lib/registry/viewEntriesTypeRegistry/registry.svelte';
|
|
20
20
|
import { onMount } from 'svelte';
|
|
21
21
|
|
|
22
22
|
const entities = entityRegistry.getAll();
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
<h3>Vues</h3>
|
|
122
122
|
<div class="view">
|
|
123
123
|
<h3>{tableView.name}</h3>
|
|
124
|
-
|
|
124
|
+
<ViewTypeComponent type="table" entityId={82}></ViewTypeComponent>
|
|
125
125
|
</div>
|
|
126
126
|
<h3>Entré</h3>
|
|
127
127
|
<div class="entry">
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { page } from '$app/stores';
|
|
3
|
+
import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
|
|
4
|
+
import ProjectDropdown from '$lib/registry/projectRegistry/components/ProjectDropdown.svelte';
|
|
5
|
+
import { projectRegistry } from '$lib/registry/projectRegistry/registry.svelte';
|
|
6
|
+
|
|
7
|
+
let {children} = $props()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
function getHref(project) {
|
|
12
|
+
return "/exemple/" + project.normalized_name + "/home"
|
|
13
|
+
}
|
|
14
|
+
function isActive(project) {
|
|
15
|
+
return project.normalized_name === $page.params.project_normalized_name
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<nav class="top-bar">
|
|
21
|
+
<h3>Mountain UI</h3>
|
|
22
|
+
<div class="project-selector">
|
|
23
|
+
<ProjectDropdown projectId={projectRegistry.getFromNormalizedName($page.params.project_normalized_name)?.id ?? null} hubHref="/exemple" {getHref} {isActive}></ProjectDropdown>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
</nav>
|
|
27
|
+
{@render children()}
|
|
28
|
+
|
|
29
|
+
<style>
|
|
30
|
+
.top-bar {
|
|
31
|
+
position: sticky;
|
|
32
|
+
top: 0px;
|
|
33
|
+
width: 100%;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: space-between;
|
|
37
|
+
flex-shrink: 0;
|
|
38
|
+
padding: var(--pad-s);
|
|
39
|
+
border-bottom: 1px solid var(--stroke);
|
|
40
|
+
}
|
|
41
|
+
.project-selector {
|
|
42
|
+
width: min(100%, 300px);
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
File without changes
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { afterNavigate, beforeNavigate } from '$app/navigation';
|
|
3
|
+
import { page } from '$app/stores';
|
|
4
|
+
import EntityButton from '$lib/registry/entityRegistry/components/EntityButton.svelte';
|
|
5
|
+
import { createEntity } from '$lib/registry/entityRegistry/createEntity';
|
|
6
|
+
import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
|
|
7
|
+
import { init, RotativeLoader, sendRequest } from 'hamzus-ui';
|
|
8
|
+
import { onMount } from 'svelte';
|
|
9
|
+
|
|
10
|
+
let { children } = $props();
|
|
11
|
+
|
|
12
|
+
let loading = $state(true);
|
|
13
|
+
|
|
14
|
+
const entities = entityRegistry.getAll();
|
|
15
|
+
|
|
16
|
+
beforeNavigate((test) => {
|
|
17
|
+
if (test.from.params.project_normalized_name === test.to.params.project_normalized_name) return
|
|
18
|
+
|
|
19
|
+
loading = true;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterNavigate(getData);
|
|
23
|
+
|
|
24
|
+
onMount(getData);
|
|
25
|
+
|
|
26
|
+
async function getData() {
|
|
27
|
+
console.log(loading);
|
|
28
|
+
|
|
29
|
+
if (loading === false) return
|
|
30
|
+
// set le projet
|
|
31
|
+
init({
|
|
32
|
+
requestWithCredentials: true,
|
|
33
|
+
on401: async () => {
|
|
34
|
+
const response = await sendRequest({
|
|
35
|
+
path: '/refresh-session'
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (!response || response.statusType === 'error') {
|
|
39
|
+
// si il est pas encore dans la page de login on redirige
|
|
40
|
+
const path = '/login';
|
|
41
|
+
|
|
42
|
+
window.location.href = defaultUnlogged;
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
replayAfter401: true,
|
|
46
|
+
addData: () => {
|
|
47
|
+
return {
|
|
48
|
+
__project_normalized_name: $page.params.project_normalized_name
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
entityRegistry.unregisterAll();
|
|
54
|
+
|
|
55
|
+
// recuperer les entités du projet
|
|
56
|
+
const requestStructures = await sendRequest({
|
|
57
|
+
path: '/get-all-entities'
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
for (const entity of requestStructures.data) {
|
|
61
|
+
entityRegistry.register(createEntity(entity));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
loading = false;
|
|
65
|
+
}
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
<div class="entities">
|
|
69
|
+
{#each $entities as entity}
|
|
70
|
+
<EntityButton
|
|
71
|
+
id={entity.id}
|
|
72
|
+
href={entity.slug}
|
|
73
|
+
variant={entity.slug === $page.params.entity_slug ? 'secondary' : 'ghost'}
|
|
74
|
+
></EntityButton>
|
|
75
|
+
{/each}
|
|
76
|
+
</div>
|
|
77
|
+
{#if loading}
|
|
78
|
+
<div class="loader">
|
|
79
|
+
<RotativeLoader></RotativeLoader>
|
|
80
|
+
</div>
|
|
81
|
+
{:else}
|
|
82
|
+
{@render children()}
|
|
83
|
+
{/if}
|
|
84
|
+
|
|
85
|
+
<style>
|
|
86
|
+
.entities {
|
|
87
|
+
width: 100%;
|
|
88
|
+
height: 40px;
|
|
89
|
+
position: sticky;
|
|
90
|
+
top: 43px;
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
column-gap: var(--pad-m);
|
|
94
|
+
padding: var(--pad-s);
|
|
95
|
+
border-bottom: 1px solid var(--stroke);
|
|
96
|
+
overflow-x: auto;
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
background-color: var(--bg-1);
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { afterNavigate, beforeNavigate } from '$app/navigation';
|
|
3
|
+
import { page } from '$app/stores';
|
|
4
|
+
import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
|
|
5
|
+
import { RotativeLoader } from 'hamzus-ui';
|
|
6
|
+
import { onMount } from 'svelte';
|
|
7
|
+
|
|
8
|
+
let {children} = $props()
|
|
9
|
+
|
|
10
|
+
let loading = $state(true);
|
|
11
|
+
|
|
12
|
+
let entityNotFound = $state(false);
|
|
13
|
+
|
|
14
|
+
beforeNavigate((page) => {
|
|
15
|
+
if (page.from.params.entity_slug === page.to.params.entity_slug) return
|
|
16
|
+
entityNotFound = false
|
|
17
|
+
loading = true;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
afterNavigate(getData);
|
|
21
|
+
|
|
22
|
+
onMount(getData);
|
|
23
|
+
|
|
24
|
+
function getData() {
|
|
25
|
+
if (loading === false) return
|
|
26
|
+
|
|
27
|
+
if (!entityRegistry.getFromSlug($page.params.entity_slug)) entityNotFound = true
|
|
28
|
+
|
|
29
|
+
loading = false;
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
{#if loading}
|
|
34
|
+
<div class="loader">
|
|
35
|
+
<RotativeLoader></RotativeLoader>
|
|
36
|
+
</div>
|
|
37
|
+
{:else if entityNotFound}
|
|
38
|
+
<div class="not-found">
|
|
39
|
+
<h3>Entité introuvable !</h3>
|
|
40
|
+
<p>L'entité n'a pas peu être trouvé !</p>
|
|
41
|
+
</div>
|
|
42
|
+
{:else}
|
|
43
|
+
{@render children()}
|
|
44
|
+
{/if}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { beforeNavigate, goto } from '$app/navigation';
|
|
3
|
+
import { page } from '$app/stores';
|
|
4
|
+
import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
|
|
5
|
+
import ViewEntriesProfilComponent from '$lib/registry/viewEntriesProfilRegistery/components/ViewEntriesProfilComponent.svelte';
|
|
6
|
+
import ViewEntriesProfilDropdown from '$lib/registry/viewEntriesProfilRegistery/components/ViewEntriesProfilDropdown.svelte';
|
|
7
|
+
import { createViewEntriesProfil } from '$lib/registry/viewEntriesProfilRegistery/createViewEntriesProfil';
|
|
8
|
+
import { registerDefaultViewProfil } from '$lib/registry/viewEntriesProfilRegistery/registerDefaultViewEntriesProfils';
|
|
9
|
+
import { viewEntriesProfilRegistry } from '$lib/registry/viewEntriesProfilRegistery/registry.svelte';
|
|
10
|
+
import ViewEntriesTypeDropdown from '$lib/registry/viewEntriesTypeRegistry/components/ViewEntriesTypeDropdown.svelte';
|
|
11
|
+
import { Button, DropdownMenu, IconButton, sendRequest } from 'hamzus-ui';
|
|
12
|
+
import { onMount } from 'svelte';
|
|
13
|
+
|
|
14
|
+
const targetEntity = $derived(entityRegistry.getFromSlug($page.params.entity_slug));
|
|
15
|
+
|
|
16
|
+
let targetViewId = $state(null);
|
|
17
|
+
|
|
18
|
+
let viewProps = $state({});
|
|
19
|
+
|
|
20
|
+
beforeNavigate(() => {
|
|
21
|
+
targetViewId = null;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
onMount(loadAllViewEntriesProfil);
|
|
25
|
+
|
|
26
|
+
async function loadAllViewEntriesProfil() {
|
|
27
|
+
viewEntriesProfilRegistry.unregisterAll();
|
|
28
|
+
|
|
29
|
+
registerDefaultViewProfil();
|
|
30
|
+
|
|
31
|
+
const request = await sendRequest({
|
|
32
|
+
path: '/get-all-views-from-entity-id',
|
|
33
|
+
data: {
|
|
34
|
+
entityId: targetEntity.id
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
let defaultView = 0;
|
|
39
|
+
|
|
40
|
+
for (const viewProfil of request.data) {
|
|
41
|
+
console.log(viewProfil);
|
|
42
|
+
|
|
43
|
+
if (viewProfil.is_default) {
|
|
44
|
+
defaultView = viewProfil.id;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
viewEntriesProfilRegistry.register(
|
|
48
|
+
createViewEntriesProfil({
|
|
49
|
+
id: viewProfil.id,
|
|
50
|
+
is_default: viewProfil.is_default,
|
|
51
|
+
name: viewProfil.name,
|
|
52
|
+
type: 'table',
|
|
53
|
+
props: viewProfil.props
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
targetViewId = defaultView;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function onChange(id) {
|
|
62
|
+
targetViewId = id;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function handleClick(data) {
|
|
66
|
+
console.log();
|
|
67
|
+
goto(
|
|
68
|
+
`/exemple/${$page.params.project_normalized_name}/${$page.params.entity_slug}/${data.id.props.value.flat}`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function onChangeProps(props) {
|
|
73
|
+
viewProps = props;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function handleCreateViewProfil(name) {
|
|
77
|
+
console.log(viewProps);
|
|
78
|
+
|
|
79
|
+
const request = await sendRequest({
|
|
80
|
+
path: '/create-view',
|
|
81
|
+
data: {
|
|
82
|
+
entityId: targetEntity.id,
|
|
83
|
+
defaultProps: JSON.stringify(viewProps),
|
|
84
|
+
name
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async function handleDesableDefault() {
|
|
89
|
+
const request = await sendRequest({
|
|
90
|
+
path: '/desable-default-view',
|
|
91
|
+
data: {
|
|
92
|
+
entityId: targetEntity.id
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
loadAllViewEntriesProfil();
|
|
97
|
+
}
|
|
98
|
+
async function handleDeleteViewProfil(id) {
|
|
99
|
+
const request = await sendRequest({
|
|
100
|
+
path: '/delete-view',
|
|
101
|
+
data: {
|
|
102
|
+
viewId: id
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
loadAllViewEntriesProfil();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function handleSetAsDefaultViewProfil(id) {
|
|
110
|
+
const request = await sendRequest({
|
|
111
|
+
path: '/set-as-default-view',
|
|
112
|
+
data: {
|
|
113
|
+
viewId: id
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
loadAllViewEntriesProfil();
|
|
118
|
+
}
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<div class="top-bar">
|
|
122
|
+
<h4>{targetEntity.plural_name}</h4>
|
|
123
|
+
<div class="view-profil-selector">
|
|
124
|
+
<ViewEntriesProfilDropdown
|
|
125
|
+
{onChange}
|
|
126
|
+
id={targetViewId}
|
|
127
|
+
onCreate={handleCreateViewProfil}
|
|
128
|
+
onDesableAsDefault={handleDesableDefault}
|
|
129
|
+
onSetAsDefault={handleSetAsDefaultViewProfil}
|
|
130
|
+
onDelete={handleDeleteViewProfil}
|
|
131
|
+
></ViewEntriesProfilDropdown>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
{#if targetViewId !== null && targetEntity}
|
|
135
|
+
<ViewEntriesProfilComponent
|
|
136
|
+
id={targetViewId}
|
|
137
|
+
entityId={targetEntity.id}
|
|
138
|
+
onClick={handleClick}
|
|
139
|
+
{onChangeProps}
|
|
140
|
+
>
|
|
141
|
+
<div slot="actions">
|
|
142
|
+
<DropdownMenu.Root direction="bottom">
|
|
143
|
+
<DropdownMenu.Trigger slot="trigger">
|
|
144
|
+
<IconButton size="26px" variant="outline"
|
|
145
|
+
><svg
|
|
146
|
+
width="24"
|
|
147
|
+
height="24"
|
|
148
|
+
viewBox="0 0 24 24"
|
|
149
|
+
fill="none"
|
|
150
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
151
|
+
>
|
|
152
|
+
<path
|
|
153
|
+
d="M11.9995 16.8001C11.2995 16.8001 10.5995 16.5301 10.0695 16.0001L3.54953 9.48014C3.25953 9.19014 3.25953 8.71014 3.54953 8.42014C3.83953 8.13014 4.31953 8.13014 4.60953 8.42014L11.1295 14.9401C11.6095 15.4201 12.3895 15.4201 12.8695 14.9401L19.3895 8.42014C19.6795 8.13014 20.1595 8.13014 20.4495 8.42014C20.7395 8.71014 20.7395 9.19014 20.4495 9.48014L13.9295 16.0001C13.3995 16.5301 12.6995 16.8001 11.9995 16.8001Z"
|
|
154
|
+
fill="#292D32"
|
|
155
|
+
/>
|
|
156
|
+
</svg>
|
|
157
|
+
</IconButton>
|
|
158
|
+
</DropdownMenu.Trigger>
|
|
159
|
+
<DropdownMenu.Content slot="content" width="250px">
|
|
160
|
+
<Button href="/exemple/{$page.params.project_normalized_name}/{$page.params.entity_slug}/create" variant="ghost" style="width:100%;">
|
|
161
|
+
<h5>créer</h5>
|
|
162
|
+
</Button>
|
|
163
|
+
<Button variant="ghost" style="width:100%;">
|
|
164
|
+
<h5>importer</h5>
|
|
165
|
+
</Button>
|
|
166
|
+
</DropdownMenu.Content>
|
|
167
|
+
</DropdownMenu.Root>
|
|
168
|
+
</div>
|
|
169
|
+
</ViewEntriesProfilComponent>
|
|
170
|
+
{/if}
|
|
171
|
+
|
|
172
|
+
<style>
|
|
173
|
+
.top-bar {
|
|
174
|
+
position: sticky;
|
|
175
|
+
top: 0px;
|
|
176
|
+
display: flex;
|
|
177
|
+
align-items: center;
|
|
178
|
+
justify-content: space-between;
|
|
179
|
+
padding: var(--pad-s);
|
|
180
|
+
border-bottom: 1px solid var(--stroke);
|
|
181
|
+
}
|
|
182
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { page } from "$app/stores";
|
|
3
|
+
import EntityPage from "$lib/registry/entityRegistry/components/EntityPage.svelte";
|
|
4
|
+
import { entityRegistry } from "$lib/registry/entityRegistry/registry.svelte";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const entity = $derived(entityRegistry.getFromSlug($page.params.entity_slug))
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
{#if entity}
|
|
11
|
+
<div class="page">
|
|
12
|
+
<EntityPage entityId={entity.id} entryId={$page.params.entry_id}></EntityPage>
|
|
13
|
+
</div>
|
|
14
|
+
{/if}
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
|
|
18
|
+
.page {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
align-items: center;
|
|
22
|
+
width: 100%;
|
|
23
|
+
padding: 60px var(--pad-m);
|
|
24
|
+
}
|
|
25
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { page } from "$app/stores";
|
|
3
|
+
import EntityForm from "$lib/registry/entityRegistry/components/EntityForm.svelte";
|
|
4
|
+
import { entityRegistry } from "$lib/registry/entityRegistry/registry.svelte";
|
|
5
|
+
import { sendRequest, toast } from "hamzus-ui";
|
|
6
|
+
import path from "path";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const entity = $derived(entityRegistry.getFromSlug($page.params.entity_slug))
|
|
10
|
+
|
|
11
|
+
async function handleSubmit(ctx) {
|
|
12
|
+
const request = await sendRequest({
|
|
13
|
+
path:"/create-entry",
|
|
14
|
+
data:{
|
|
15
|
+
...ctx,
|
|
16
|
+
entity_id:entity.id
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
if (request.statusType === "error") {
|
|
21
|
+
toast.error({
|
|
22
|
+
title:"Erreur !",
|
|
23
|
+
description:request.message
|
|
24
|
+
})
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
{#if entity}
|
|
31
|
+
<div class="page">
|
|
32
|
+
<EntityForm onSubmit={handleSubmit} entityId={entity.id}></EntityForm>
|
|
33
|
+
</div>
|
|
34
|
+
{/if}
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
|
|
38
|
+
.page {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: column;
|
|
41
|
+
align-items: center;
|
|
42
|
+
width: 100%;
|
|
43
|
+
padding: 60px var(--pad-m);
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<h3>home</h3>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export function createViewType(config = {}) {
|
|
2
|
-
const viewType = {
|
|
3
|
-
type:"",
|
|
4
|
-
name:"",
|
|
5
|
-
description:"",
|
|
6
|
-
components : {
|
|
7
|
-
component:null,
|
|
8
|
-
icon:null,
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
Object.assign(viewType, config);
|
|
13
|
-
|
|
14
|
-
// viewType.get = () => "test";
|
|
15
|
-
|
|
16
|
-
return viewType;
|
|
17
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { writable, derived, get } from 'svelte/store';
|
|
2
|
-
|
|
3
|
-
function createViewTypeRegistry() {
|
|
4
|
-
const store = writable({});
|
|
5
|
-
|
|
6
|
-
const all = derived(store, ($viewTypes) => Object.values($viewTypes));
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
subscribe: store.subscribe,
|
|
10
|
-
|
|
11
|
-
register(viewType) {
|
|
12
|
-
store.update((viewTypes) => ({
|
|
13
|
-
...viewTypes,
|
|
14
|
-
[viewType.type]: viewType
|
|
15
|
-
}));
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
unregister(type) {
|
|
19
|
-
store.update((viewTypes) => {
|
|
20
|
-
const copy = { ...viewTypes };
|
|
21
|
-
|
|
22
|
-
delete copy[type];
|
|
23
|
-
|
|
24
|
-
return copy;
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
get(type) {
|
|
29
|
-
return get(store)[type];
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
select(type) {
|
|
33
|
-
return derived(store, ($viewTypes) => $viewTypes[type]);
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
getAll() {
|
|
39
|
-
return all;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export const viewTypeRegistry = createViewTypeRegistry();
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import { page } from '$app/stores';
|
|
3
|
-
import { Button, DropdownMenu, IconButton } from 'hamzus-ui';
|
|
4
|
-
import StructureTable from './StructureTable.svelte';
|
|
5
|
-
|
|
6
|
-
let { structureId = 0, columns = [], defaultProps = null, ...props } = $props();
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<StructureTable bind:defaultProps structureColumns={columns} {structureId} {...props}>
|
|
10
|
-
<slot slot="actions" name="actions"></slot>
|
|
11
|
-
</StructureTable>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createViewType } from '../../createViewType';
|
|
2
|
-
|
|
3
|
-
import Icon from '../Table/Icon.svelte';
|
|
4
|
-
import Component from '../Table/component/Component.svelte';
|
|
5
|
-
|
|
6
|
-
export default createViewType({
|
|
7
|
-
type: "table",
|
|
8
|
-
name: "Tableau",
|
|
9
|
-
description: "",
|
|
10
|
-
components: {
|
|
11
|
-
component: Component,
|
|
12
|
-
icon: Icon,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
File without changes
|