mountain-ui 1.0.55 → 1.0.56

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.
Files changed (67) hide show
  1. package/index.d.ts +2 -0
  2. package/index.js +2 -0
  3. package/package.json +1 -1
  4. package/src/lib/components/Nothing.svelte +26 -0
  5. package/src/lib/registry/entityRegistry/components/EntitiesSelector.svelte +41 -0
  6. package/src/lib/registry/entityRegistry/components/EntityCard.svelte +2 -2
  7. package/src/lib/registry/entityRegistry/components/EntityFieldContainer.svelte +13 -0
  8. package/src/lib/registry/entityRegistry/components/EntityForm.svelte +141 -75
  9. package/src/lib/registry/entityRegistry/components/EntityPage.svelte +5 -147
  10. package/src/lib/registry/entityRegistry/components/EntryForm.svelte +102 -0
  11. package/src/lib/registry/entityRegistry/components/EntryPage.svelte +155 -0
  12. package/src/lib/registry/entityRegistry/components/FieldBinding.svelte +90 -0
  13. package/src/lib/registry/entityRegistry/components/FieldRow.svelte +71 -0
  14. package/src/lib/registry/entityRegistry/createEntity.js +6 -0
  15. package/src/lib/registry/entityRegistry/utils.js +15 -0
  16. package/src/lib/registry/entryActionRegistry/components/EntryActionButton.svelte +21 -0
  17. package/src/lib/registry/entryActionRegistry/components/EntryActionsButtons.svelte +18 -0
  18. package/src/lib/registry/entryActionRegistry/createEntryActionType.js +17 -0
  19. package/src/lib/registry/entryActionRegistry/registry.svelte.js +48 -0
  20. package/src/lib/registry/entryActionTypeRegistry/components/EntryActionProperties.svelte +42 -0
  21. package/src/lib/registry/entryActionTypeRegistry/components/EntryActionTypeCard.svelte +11 -0
  22. package/src/lib/registry/entryActionTypeRegistry/createEntryActionType.js +24 -0
  23. package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/Card.svelte +20 -0
  24. package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/Properties.svelte +147 -0
  25. package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/component/Binding.svelte +103 -0
  26. package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/component/BindingClone.svelte +103 -0
  27. package/src/lib/registry/entryActionTypeRegistry/entryActionTypes/PrefillNewEntry/index.js +77 -0
  28. package/src/lib/registry/entryActionTypeRegistry/registerDefaultEntryActionTypes.js +7 -0
  29. package/src/lib/registry/entryActionTypeRegistry/registry.svelte.js +48 -0
  30. package/src/lib/registry/fieldTypeRegistry/createFieldType.js +8 -0
  31. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/index.js +52 -0
  32. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/index.js +3 -0
  33. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/index.js +1 -0
  34. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationColumn/index.js +2 -0
  35. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationLine/index.js +2 -0
  36. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/index.js +1 -0
  37. package/src/lib/registry/fieldTypeRegistry/fieldTypes/localisation/LocalisationLand/index.js +2 -0
  38. package/src/lib/registry/fieldTypeRegistry/fieldTypes/money/MoneyCurrency/index.js +2 -0
  39. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/index.js +1 -0
  40. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/index.js +2 -0
  41. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/index.js +1 -0
  42. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/index.js +1 -0
  43. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/index.js +2 -0
  44. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/index.js +2 -0
  45. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/index.js +1 -0
  46. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/index.js +1 -0
  47. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/index.js +1 -0
  48. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/index.js +1 -0
  49. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/index.js +1 -0
  50. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/index.js +1 -0
  51. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/index.js +2 -1
  52. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/index.js +1 -0
  53. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/index.js +1 -0
  54. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/index.js +1 -0
  55. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/index.js +1 -0
  56. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/index.js +1 -0
  57. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/index.js +1 -0
  58. package/src/lib/registry/viewEntriesProfilRegistery/components/ViewEntriesProfilButton.svelte +1 -1
  59. package/src/lib/registry/viewEntriesProfilRegistery/components/ViewEntriesProfilComponent.svelte +1 -1
  60. package/src/routes/exemple/[project_normalized_name]/+layout.svelte +16 -2
  61. package/src/routes/exemple/[project_normalized_name]/[entity_slug]/[entry_id]/+page.svelte +70 -16
  62. package/src/routes/exemple/[project_normalized_name]/[entity_slug]/create/+page.svelte +19 -3
  63. package/src/routes/exemple/[project_normalized_name]/actions/+page.svelte +62 -0
  64. package/src/routes/exemple/[project_normalized_name]/entities/+layout.svelte +5 -0
  65. package/src/routes/exemple/[project_normalized_name]/entities/+page.svelte +70 -0
  66. package/src/routes/exemple/[project_normalized_name]/entities/[entity_id]/+page.svelte +8 -0
  67. package/src/routes/exemple/[project_normalized_name]/entities/create/+page.svelte +6 -0
@@ -33,6 +33,8 @@ export default createFieldType({
33
33
  properties: null
34
34
  },
35
35
 
36
+ allowBindings:["text"],
37
+
36
38
  formatter: (value) => value,
37
39
  parser: (value) => value,
38
40
 
@@ -33,6 +33,7 @@ export default createFieldType({
33
33
  properties: null
34
34
  },
35
35
 
36
+ allowBindings:["text"],
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
38
39
 
@@ -33,6 +33,7 @@ export default createFieldType({
33
33
  properties: null
34
34
  },
35
35
 
36
+ allowBindings:["text"],
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
38
39
 
@@ -33,6 +33,7 @@ export default createFieldType({
33
33
  properties: null
34
34
  },
35
35
 
36
+ allowBindings:["text"],
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
38
39
 
@@ -33,6 +33,7 @@ export default createFieldType({
33
33
  properties: null
34
34
  },
35
35
 
36
+ allowBindings:["text"],
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
38
39
 
@@ -32,6 +32,7 @@ export default createFieldType({
32
32
  properties: null
33
33
  },
34
34
 
35
+ allowBindings:["time-datetime"],
35
36
  formatter: (value) => value,
36
37
  parser: (value) => value,
37
38
 
@@ -32,6 +32,7 @@ export default createFieldType({
32
32
  filter: null,
33
33
  properties: null
34
34
  },
35
+ allowBindings:["time-date"],
35
36
 
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
@@ -32,7 +32,8 @@ export default createFieldType({
32
32
  filter: null,
33
33
  properties: null
34
34
  },
35
-
35
+
36
+ allowBindings:["time-datetime"],
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
38
39
 
@@ -33,6 +33,7 @@ export default createFieldType({
33
33
  properties: null
34
34
  },
35
35
 
36
+ allowBindings:["time-day"],
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
38
39
 
@@ -33,6 +33,7 @@ export default createFieldType({
33
33
  properties: null
34
34
  },
35
35
 
36
+ allowBindings:["time-hour"],
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
38
39
 
@@ -33,6 +33,7 @@ export default createFieldType({
33
33
  properties: null
34
34
  },
35
35
 
36
+ allowBindings:["time-month"],
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
38
39
 
@@ -33,6 +33,7 @@ export default createFieldType({
33
33
  properties: null
34
34
  },
35
35
 
36
+ allowBindings:["time-month_of_year"],
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
38
39
 
@@ -32,6 +32,7 @@ export default createFieldType({
32
32
  properties: null
33
33
  },
34
34
 
35
+ allowBindings:["time-datetime"],
35
36
  formatter: (value) => value,
36
37
  parser: (value) => value,
37
38
 
@@ -33,6 +33,7 @@ export default createFieldType({
33
33
  properties: null
34
34
  },
35
35
 
36
+ allowBindings:["time-year"],
36
37
  formatter: (value) => value,
37
38
  parser: (value) => value,
38
39
 
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  import { Button } from 'hamzus-ui';
3
3
  import { viewEntriesProfilRegistry } from '../registry.svelte';
4
- import ViewEntriesTypeIcon from '$lib/registry/viewEntriesTypeRegistry/components/ViewEntriesTypeIcon.svelte';
4
+ import ViewEntriesTypeIcon from '../../viewEntriesTypeRegistry/components/ViewEntriesTypeIcon.svelte';
5
5
 
6
6
  let { id, variant = 'ghost', ...props } = $props();
7
7
 
@@ -1,7 +1,7 @@
1
1
  <script>
2
2
  import { Button, RotativeLoader } from 'hamzus-ui';
3
3
  import { viewEntriesProfilRegistry } from '../registry.svelte';
4
- import ViewEntriesTypeComponent from '$lib/registry/viewEntriesTypeRegistry/components/ViewEntriesTypeComponent.svelte';
4
+ import ViewEntriesTypeComponent from '../../viewEntriesTypeRegistry/components/ViewEntriesTypeComponent.svelte';
5
5
 
6
6
  let { id, ...props } = $props();
7
7
 
@@ -4,7 +4,7 @@
4
4
  import EntityButton from '$lib/registry/entityRegistry/components/EntityButton.svelte';
5
5
  import { createEntity } from '$lib/registry/entityRegistry/createEntity';
6
6
  import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
7
- import { init, RotativeLoader, sendRequest } from 'hamzus-ui';
7
+ import { IconButton, init, RotativeLoader, sendRequest } from 'hamzus-ui';
8
8
  import { onMount } from 'svelte';
9
9
 
10
10
  let { children } = $props();
@@ -14,6 +14,7 @@
14
14
  const entities = entityRegistry.getAll();
15
15
 
16
16
  beforeNavigate((test) => {
17
+ if (!test.to) return
17
18
  if (test.from.params.project_normalized_name === test.to.params.project_normalized_name) return
18
19
 
19
20
  loading = true;
@@ -66,10 +67,23 @@
66
67
  </script>
67
68
 
68
69
  <div class="entities">
70
+ <IconButton href="/exemple/{$page.params.project_normalized_name}/entities" variant="secondary">
71
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
72
+ <path d="M11.9994 22.75C11.9394 22.75 11.8794 22.74 11.8294 22.73C11.7694 22.72 11.7094 22.69 11.6494 22.66L9.43938 21.56C9.06938 21.37 8.91937 20.92 9.09937 20.55C9.28937 20.18 9.73938 20.03 10.1094 20.21L11.2494 20.78V19.22C11.2494 18.81 11.5894 18.47 11.9994 18.47C12.4094 18.47 12.7494 18.81 12.7494 19.22V20.78L13.8894 20.21C14.2594 20.03 14.7094 20.18 14.8994 20.55C15.0894 20.92 14.9394 21.37 14.5594 21.56L12.3494 22.66C12.2894 22.69 12.2294 22.71 12.1694 22.73C12.1094 22.74 12.0594 22.75 11.9994 22.75ZM18.6694 19.42C18.3994 19.42 18.1294 19.27 17.9994 19.01C17.8094 18.64 17.9594 18.19 18.3394 18L20.1494 17.1V14.79C20.1494 14.38 20.4894 14.04 20.8994 14.04C21.3094 14.04 21.6494 14.38 21.6494 14.79V17.57C21.6494 17.85 21.4894 18.11 21.2394 18.24L19.0194 19.35C18.8894 19.39 18.7794 19.42 18.6694 19.42ZM5.32938 19.42C5.21938 19.42 5.09937 19.39 4.99937 19.34L2.77937 18.23C2.52937 18.1 2.36938 17.84 2.36938 17.56V14.78C2.36938 14.37 2.70938 14.03 3.11938 14.03C3.52938 14.03 3.86938 14.37 3.86938 14.78V17.09L5.67937 17.99C6.04937 18.18 6.19937 18.63 6.01937 19C5.86937 19.26 5.60938 19.42 5.32938 19.42ZM11.9994 14.42C11.5894 14.42 11.2494 14.08 11.2494 13.67V11.36L9.43938 10.46C9.06938 10.27 8.91937 9.82004 9.09937 9.45004C9.28937 9.08004 9.73938 8.93004 10.1094 9.11004L11.9994 10.05L13.8894 9.11004C14.2594 8.93004 14.7094 9.07004 14.8994 9.45004C15.0894 9.83004 14.9394 10.27 14.5594 10.46L12.7494 11.36V13.67C12.7494 14.08 12.4094 14.42 11.9994 14.42ZM20.8894 9.97004C20.4794 9.97004 20.1394 9.63004 20.1394 9.22004V7.66005L18.9994 8.23004C18.6294 8.42004 18.1794 8.27004 17.9894 7.89004C17.7994 7.52004 17.9494 7.07005 18.3294 6.88005L19.2094 6.44004L18.3294 6.00004C17.9594 5.81004 17.8094 5.36005 17.9894 4.99005C18.1794 4.62005 18.6294 4.47004 18.9994 4.65004L21.2094 5.75004C21.2294 5.76004 21.2594 5.77003 21.2794 5.79003C21.3394 5.82003 21.3894 5.87004 21.4394 5.92004C21.4694 5.96004 21.4994 6.00003 21.5294 6.04003C21.5694 6.11003 21.5994 6.18004 21.6194 6.26004C21.6294 6.32004 21.6394 6.38003 21.6394 6.43003V6.44004V9.20004C21.6394 9.64004 21.2994 9.97004 20.8894 9.97004ZM3.10938 9.97004C2.69938 9.97004 2.35938 9.63004 2.35938 9.22004V6.46005V6.45004C2.35938 6.39004 2.36937 6.33004 2.37937 6.28004C2.39937 6.20004 2.42938 6.13004 2.46938 6.06004C2.49938 6.01004 2.52937 5.97003 2.56937 5.93003C2.60937 5.89003 2.65937 5.85005 2.70937 5.82005C2.72937 5.81005 2.75937 5.79004 2.77937 5.78004L4.98937 4.68003C5.35937 4.50003 5.80937 4.64005 5.99937 5.02005C6.18937 5.40005 6.03938 5.84004 5.65938 6.03004L4.77937 6.47004L5.65938 6.91005C6.02938 7.10005 6.17937 7.55004 5.99937 7.92004C5.80937 8.29004 5.36937 8.44004 4.98937 8.26004L3.84937 7.69004V9.25004C3.85937 9.64004 3.52937 9.97004 3.10938 9.97004ZM14.2194 3.86004C14.1094 3.86004 13.9894 3.83004 13.8894 3.78004L11.9994 2.84004L10.1094 3.78004C9.73938 3.97004 9.28937 3.82004 9.09937 3.44004C8.90937 3.07004 9.05938 2.62003 9.43938 2.43003L11.6594 1.32005C11.8694 1.21005 12.1194 1.21005 12.3294 1.32005L14.5494 2.43003C14.9194 2.62003 15.0694 3.07004 14.8894 3.44004C14.7594 3.71004 14.4994 3.86004 14.2194 3.86004Z" fill="#292D32"/>
73
+ </svg>
74
+
75
+ </IconButton>
76
+ <IconButton href="/exemple/{$page.params.project_normalized_name}/actions" variant="secondary">
77
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
78
+ <path d="M9.99057 22.7499C9.79057 22.7499 9.63057 22.7099 9.51057 22.6599C9.11057 22.5099 8.43057 22.0199 8.43057 20.4699V14.0199H6.09057C4.75057 14.0199 4.27057 13.3899 4.10057 13.0199C3.93057 12.6399 3.78057 11.8699 4.66057 10.8599L12.2306 2.25988C13.2506 1.09988 14.0806 1.17988 14.4806 1.32988C14.8806 1.47988 15.5606 1.96988 15.5606 3.51988V9.96988H17.9006C19.2406 9.96988 19.7206 10.5999 19.8906 10.9699C20.0606 11.3499 20.2106 12.1199 19.3306 13.1299L11.7606 21.7299C11.0506 22.5399 10.4306 22.7499 9.99057 22.7499ZM13.9306 2.73988C13.9006 2.77988 13.6906 2.87988 13.3606 3.25988L5.79057 11.8599C5.51057 12.1799 5.47057 12.3799 5.47057 12.4199C5.49057 12.4299 5.67057 12.5299 6.09057 12.5299H9.18057C9.59057 12.5299 9.93057 12.8699 9.93057 13.2799V20.4799C9.93057 20.9799 10.0206 21.1999 10.0606 21.2599C10.0906 21.2199 10.3006 21.1199 10.6306 20.7399L18.2006 12.1399C18.4806 11.8199 18.5206 11.6199 18.5206 11.5799C18.5006 11.5699 18.3206 11.4699 17.9006 11.4699H14.8106C14.4006 11.4699 14.0606 11.1299 14.0606 10.7199V3.51988C14.0706 3.01988 13.9706 2.80988 13.9306 2.73988Z" fill="#292D32"/>
79
+ </svg>
80
+
81
+
82
+ </IconButton>
69
83
  {#each $entities as entity}
70
84
  <EntityButton
71
85
  id={entity.id}
72
- href={entity.slug}
86
+ href="/exemple/{$page.params.project_normalized_name}/{entity.slug}"
73
87
  variant={entity.slug === $page.params.entity_slug ? 'secondary' : 'ghost'}
74
88
  ></EntityButton>
75
89
  {/each}
@@ -1,25 +1,79 @@
1
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";
2
+ import { page } from '$app/stores';
3
+ import EntryPage from '$lib/registry/entityRegistry/components/EntryPage.svelte';
4
+ import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
5
+ import EntryActionsButtons from '$lib/registry/entryActionRegistry/components/EntryActionsButtons.svelte';
6
+ import { createEntryAction } from '$lib/registry/entryActionRegistry/createEntryActionType';
7
+ import { entryActionRegistry } from '$lib/registry/entryActionRegistry/registry.svelte';
8
+ import { registerDefaultEntryActionTypes } from '$lib/registry/entryActionTypeRegistry/registerDefaultEntryActionTypes';
9
+ import { entryActionTypeRegistry } from '$lib/registry/entryActionTypeRegistry/registry.svelte';
10
+ import { Button, sendRequest } from 'hamzus-ui';
11
+ import { onMount } from 'svelte';
5
12
 
13
+ const entity = $derived(entityRegistry.getFromSlug($page.params.entity_slug));
14
+
15
+ let ctx = $state(null);
16
+
17
+ let flatCtx = $state(null);
18
+
19
+ $effect(() => {
20
+ if (!ctx) return;
21
+ let newFlatCtx = {};
22
+
23
+ for (const [key, value] of Object.entries(ctx)) {
24
+ newFlatCtx[key] = value.flat;
25
+ }
26
+
27
+ flatCtx = { ...newFlatCtx };
28
+ });
29
+
30
+ onMount(async () => {
31
+ registerDefaultEntryActionTypes();
32
+
33
+ const request = await sendRequest({
34
+ path: '/get-all-entry-actions-from-entity-id',
35
+ data: {
36
+ entityId: entity.id
37
+ }
38
+ });
39
+
40
+ console.log(request);
41
+
42
+ entryActionRegistry.unregisterAll();
43
+
44
+ for (const entryAction of request.data) {
45
+ entryActionRegistry.register(
46
+ createEntryAction({
47
+ id: entryAction.id,
48
+ name: entryAction.name,
49
+ type: entryAction.type,
50
+ props: entryAction.props
51
+ })
52
+ );
53
+ }
54
+
55
+ });
6
56
 
7
- const entity = $derived(entityRegistry.getFromSlug($page.params.entity_slug))
8
57
  </script>
9
58
 
10
59
  {#if entity}
11
- <div class="page">
12
- <EntityPage entityId={entity.id} entryId={$page.params.entry_id}></EntityPage>
13
- </div>
60
+ <div class="page">
61
+ <EntryPage bind:ctx entityId={entity.id} entryId={$page.params.entry_id}>
62
+ <div>
63
+ {#if flatCtx}
64
+ <EntryActionsButtons entityId={entity.id} entry={flatCtx}></EntryActionsButtons>
65
+ {/if}
66
+ </div>
67
+ </EntryPage>
68
+ </div>
14
69
  {/if}
15
70
 
16
71
  <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>
72
+ .page {
73
+ display: flex;
74
+ flex-direction: column;
75
+ align-items: center;
76
+ width: 100%;
77
+ padding: 60px var(--pad-m);
78
+ }
79
+ </style>
@@ -1,13 +1,29 @@
1
1
  <script>
2
2
  import { page } from "$app/stores";
3
- import EntityForm from "$lib/registry/entityRegistry/components/EntityForm.svelte";
3
+ import EntryForm from "$lib/registry/entityRegistry/components/EntryForm.svelte";
4
4
  import { entityRegistry } from "$lib/registry/entityRegistry/registry.svelte";
5
5
  import { sendRequest, toast } from "hamzus-ui";
6
6
  import path from "path";
7
+ import { onMount } from "svelte";
7
8
 
8
9
 
9
10
  const entity = $derived(entityRegistry.getFromSlug($page.params.entity_slug))
10
11
 
12
+ let ctx = $state(null)
13
+
14
+ onMount(()=>{
15
+ const ctxPrefill = $page.url.searchParams.get('prefill');
16
+
17
+ if (ctxPrefill) {
18
+ ctx = JSON.parse(ctxPrefill)
19
+ console.log(ctx);
20
+
21
+ return
22
+ }
23
+
24
+ ctx = {}
25
+ })
26
+
11
27
  async function handleSubmit(ctx) {
12
28
  const request = await sendRequest({
13
29
  path:"/create-entry",
@@ -27,9 +43,9 @@
27
43
  }
28
44
  </script>
29
45
 
30
- {#if entity}
46
+ {#if entity && ctx}
31
47
  <div class="page">
32
- <EntityForm onSubmit={handleSubmit} entityId={entity.id}></EntityForm>
48
+ <EntryForm {ctx} onSubmit={handleSubmit} entityId={entity.id}></EntryForm>
33
49
  </div>
34
50
  {/if}
35
51
 
@@ -0,0 +1,62 @@
1
+ <script>
2
+ import EntryActionProperties from '$lib/registry/entryActionTypeRegistry/components/EntryActionProperties.svelte';
3
+ import EntryActionTypeCard from '$lib/registry/entryActionTypeRegistry/components/EntryActionTypeCard.svelte';
4
+ import { registerDefaultEntryActionTypes } from '$lib/registry/entryActionTypeRegistry/registerDefaultEntryActionTypes';
5
+ import { entryActionTypeRegistry } from '$lib/registry/entryActionTypeRegistry/registry.svelte';
6
+ import { Button, sendRequest } from 'hamzus-ui';
7
+ import { onMount } from 'svelte';
8
+
9
+ onMount(() => {
10
+ registerDefaultEntryActionTypes();
11
+ });
12
+
13
+ let entityId = $state(null);
14
+ let name = $state('');
15
+ let props = $state(null);
16
+
17
+ let isLoading = $state(false);
18
+
19
+ const entryActionTypes = entryActionTypeRegistry.getAll();
20
+
21
+ async function handleCreate() {
22
+ isLoading = true;
23
+ console.log(entityId);
24
+
25
+ const request = await sendRequest({
26
+ path: '/create-action',
27
+ data: {
28
+ entityId,
29
+ type: 'prefill-new-entry',
30
+ name,
31
+ props: JSON.stringify(props)
32
+ }
33
+ });
34
+
35
+ isLoading = false;
36
+ }
37
+ </script>
38
+
39
+ <div class="form">
40
+ {#if $entryActionTypes}
41
+ {#each $entryActionTypes as entryActionType}
42
+ <EntryActionTypeCard type={entryActionType.type}></EntryActionTypeCard>
43
+ {/each}
44
+ {/if}
45
+
46
+ <EntryActionProperties bind:props bind:name bind:entityId entryActionType={'prefill-new-entry'}
47
+ ></EntryActionProperties>
48
+
49
+ <Button onClick={handleCreate} loading={isLoading}>
50
+ <h5>créer</h5>
51
+ </Button>
52
+ </div>
53
+
54
+ <style>
55
+ .form {
56
+ display: flex;
57
+ flex-direction: column;
58
+ width: 100%;
59
+ padding: var(--pad-m);
60
+ row-gap: var(--pad-m);
61
+ }
62
+ </style>
@@ -0,0 +1,5 @@
1
+ <script>
2
+
3
+ </script>
4
+
5
+ <slot/>
@@ -0,0 +1,70 @@
1
+ <script>
2
+ import { page } from '$app/stores';
3
+ import Nothing from '$lib/components/Nothing.svelte';
4
+ import EntityCard from '$lib/registry/entityRegistry/components/EntityCard.svelte';
5
+ import { entityRegistry } from '$lib/registry/entityRegistry/registry.svelte';
6
+ import { Button } from 'hamzus-ui';
7
+
8
+ const entities = entityRegistry.getAll();
9
+ </script>
10
+ <div class="title">
11
+ <h3>Entités</h3>
12
+ <Button href="/exemple/{$page.params.project_normalized_name}/entities/create">
13
+ <h5>créer</h5>
14
+ </Button>
15
+ </div>
16
+ {#if $entities.length <= 0}
17
+ <Nothing title="Aucune entité" description="Il n y a aucune entité actuellement !">
18
+ <svg
19
+ slot="top"
20
+ width="24"
21
+ height="24"
22
+ viewBox="0 0 24 24"
23
+ fill="none"
24
+ xmlns="http://www.w3.org/2000/svg"
25
+ >
26
+ <path
27
+ d="M7 8H4C2.9 8 2 7.1 2 6V4C2 2.9 2.9 2 4 2H7C8.1 2 9 2.9 9 4V6C9 7.1 8.1 8 7 8Z"
28
+ fill="#292D32"
29
+ />
30
+ <path
31
+ d="M20.8 7H17.2C16.54 7 16 6.45999 16 5.79999V4.20001C16 3.54001 16.54 3 17.2 3H20.8C21.46 3 22 3.54001 22 4.20001V5.79999C22 6.45999 21.46 7 20.8 7Z"
32
+ fill="#292D32"
33
+ />
34
+ <path
35
+ d="M20.8 14.5H17.2C16.54 14.5 16 13.96 16 13.3V11.7C16 11.04 16.54 10.5 17.2 10.5H20.8C21.46 10.5 22 11.04 22 11.7V13.3C22 13.96 21.46 14.5 20.8 14.5Z"
36
+ fill="#292D32"
37
+ />
38
+ <path
39
+ opacity="0.37"
40
+ d="M16 13.25C16.41 13.25 16.75 12.91 16.75 12.5C16.75 12.09 16.41 11.75 16 11.75H13.25V5.75H16C16.41 5.75 16.75 5.41 16.75 5C16.75 4.59 16.41 4.25 16 4.25H9C8.59 4.25 8.25 4.59 8.25 5C8.25 5.41 8.59 5.75 9 5.75H11.75V18C11.75 19.52 12.98 20.75 14.5 20.75H16C16.41 20.75 16.75 20.41 16.75 20C16.75 19.59 16.41 19.25 16 19.25H14.5C13.81 19.25 13.25 18.69 13.25 18V13.25H16Z"
41
+ fill="#292D32"
42
+ />
43
+ <path
44
+ d="M20.8 22H17.2C16.54 22 16 21.46 16 20.8V19.2C16 18.54 16.54 18 17.2 18H20.8C21.46 18 22 18.54 22 19.2V20.8C22 21.46 21.46 22 20.8 22Z"
45
+ fill="#292D32"
46
+ />
47
+ </svg>
48
+ </Nothing>
49
+ {:else}
50
+ <div class="entities">
51
+ {#each $entities as entity}
52
+ <EntityCard variant="secondary" style="width:100%;" id={entity.id}></EntityCard>
53
+ {/each}
54
+ </div>
55
+ {/if}
56
+
57
+ <style>
58
+ .title {
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: space-between;
62
+ padding: var(--pad-m);
63
+ }
64
+ .entities {
65
+ display: grid;
66
+ grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
67
+ gap: var(--pad-m);
68
+ padding: var(--pad-xxl);
69
+ }
70
+ </style>
@@ -0,0 +1,8 @@
1
+ <script>
2
+ import { page } from "$app/stores";
3
+ import EntityPage from "$lib/registry/entityRegistry/components/EntityPage.svelte";
4
+
5
+
6
+ </script>
7
+
8
+ <EntityPage entityId={$page.params.entity_id}></EntityPage>
@@ -0,0 +1,6 @@
1
+ <script>
2
+ import EntityForm from "$lib/registry/entityRegistry/components/EntityForm.svelte";
3
+
4
+ </script>
5
+
6
+ <EntityForm></EntityForm>