mountain-ui 1.0.2 → 1.0.3

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 (134) hide show
  1. package/README.md +10 -8
  2. package/index.js +23 -25
  3. package/package.json +4 -2
  4. package/src/lib/registry/entityRegistry/components/EntityButton.svelte +8 -8
  5. package/src/lib/registry/entityRegistry/components/EntityCard.svelte +14 -14
  6. package/src/lib/registry/entityRegistry/components/EntityForm.svelte +6 -6
  7. package/src/lib/registry/entityRegistry/components/FieldButton copy.svelte +4 -4
  8. package/src/lib/registry/entityRegistry/components/FieldButton.svelte +4 -4
  9. package/src/lib/registry/entityRegistry/components/FieldCard.svelte +18 -20
  10. package/src/lib/registry/entityRegistry/components/FieldIcon.svelte +33 -14
  11. package/src/lib/registry/entityRegistry/components/FieldInput.svelte +24 -13
  12. package/src/lib/registry/entityRegistry/components/FieldIsRequiredIcon.svelte +37 -15
  13. package/src/lib/registry/entityRegistry/components/FieldIsSecretIcon.svelte +27 -12
  14. package/src/lib/registry/entityRegistry/components/FieldIsUniqueIcon.svelte +31 -14
  15. package/src/lib/registry/entityRegistry/components/FormCtx.svelte +2 -4
  16. package/src/lib/registry/entityRegistry/components/LinkIcon.svelte +25 -13
  17. package/src/lib/registry/entityRegistry/createEntity.js +34 -36
  18. package/src/lib/registry/entityRegistry/registry.svelte.js +70 -112
  19. package/src/lib/registry/fieldTypeRegistry/components/FieldTypeButton.svelte +7 -6
  20. package/src/lib/registry/fieldTypeRegistry/components/FieldTypeCard.svelte +6 -5
  21. package/src/lib/registry/fieldTypeRegistry/components/FieldTypeIcon.svelte +5 -5
  22. package/src/lib/registry/fieldTypeRegistry/components/FieldTypeInput.svelte +5 -5
  23. package/src/lib/registry/fieldTypeRegistry/components/Label.svelte +6 -6
  24. package/src/lib/registry/fieldTypeRegistry/components/Line.svelte +1 -1
  25. package/src/lib/registry/fieldTypeRegistry/createFieldType.js +25 -25
  26. package/src/lib/registry/fieldTypeRegistry/fieldTypes/FieldTypeCard.svelte +7 -8
  27. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/Button.svelte +4 -6
  28. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/Card.svelte +2 -2
  29. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/Icon.svelte +12 -3
  30. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Lines/index.js +27 -26
  31. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/Button.svelte +4 -6
  32. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/Card.svelte +2 -2
  33. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/Icon.svelte +8 -2
  34. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/Input/Input.svelte +16 -17
  35. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/Input/LinkCard.svelte +32 -39
  36. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/Input/LinkCardSelection.svelte +44 -56
  37. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/Input/utils.js +19 -21
  38. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Link/index.js +26 -26
  39. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/Button.svelte +4 -6
  40. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/Card.svelte +2 -2
  41. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/Icon.svelte +13 -4
  42. package/src/lib/registry/fieldTypeRegistry/fieldTypes/Primary/index.js +26 -25
  43. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationColumn/Card.svelte +2 -2
  44. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationColumn/Icon.svelte +28 -7
  45. package/src/lib/registry/fieldTypeRegistry/fieldTypes/calculation/CalculationColumn/index.js +26 -26
  46. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/Card.svelte +2 -2
  47. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/Icon.svelte +8 -2
  48. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListCheckbox/index.js +26 -28
  49. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/Card.svelte +2 -2
  50. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/Icon.svelte +8 -2
  51. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/Input.svelte +49 -52
  52. package/src/lib/registry/fieldTypeRegistry/fieldTypes/list/ListRadio/index.js +41 -41
  53. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/Card.svelte +2 -2
  54. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/Icon.svelte +12 -3
  55. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/Input.svelte +7 -11
  56. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/NumberInt/index.js +30 -30
  57. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/FieldTypeInputFloat.svelte +1 -1
  58. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/Card.svelte +2 -2
  59. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/Icon.svelte +17 -5
  60. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/Input.svelte +9 -10
  61. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatDefault/index.js +30 -30
  62. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/Card.svelte +2 -2
  63. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/Icon.svelte +16 -4
  64. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/Input.svelte +9 -11
  65. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPercent/index.js +30 -30
  66. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/Card.svelte +2 -2
  67. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/Icon.svelte +12 -3
  68. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/Input.svelte +9 -11
  69. package/src/lib/registry/fieldTypeRegistry/fieldTypes/number/float/NumberFloatPrice/index.js +30 -30
  70. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/Card.svelte +2 -2
  71. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/Icon.svelte +24 -6
  72. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/Input.svelte +12 -5
  73. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/TextTextarea/index.js +26 -28
  74. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/FieldTypeInputText.svelte +0 -1
  75. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/Card.svelte +2 -2
  76. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/Icon.svelte +24 -6
  77. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/Input.svelte +7 -10
  78. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharDefault/index.js +26 -27
  79. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/Card.svelte +2 -2
  80. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/Icon.svelte +8 -2
  81. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/Input.svelte +7 -10
  82. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharEmail/index.js +26 -27
  83. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/Card.svelte +2 -2
  84. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/Icon.svelte +20 -5
  85. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/Input.svelte +35 -33
  86. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPassword/index.js +26 -27
  87. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/Card.svelte +2 -2
  88. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/Icon.svelte +4 -1
  89. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/Input.svelte +5 -8
  90. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharPhone/index.js +26 -27
  91. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/Card.svelte +2 -2
  92. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/Icon.svelte +20 -5
  93. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/Input.svelte +4 -7
  94. package/src/lib/registry/fieldTypeRegistry/fieldTypes/text/varchar/TextVarcharUrl/index.js +26 -27
  95. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/Card.svelte +2 -2
  96. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/Icon.svelte +36 -9
  97. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeCreatedAt/index.js +25 -27
  98. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/Card.svelte +2 -2
  99. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/Icon.svelte +40 -10
  100. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/Input.svelte +7 -10
  101. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDate/index.js +26 -28
  102. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/Card.svelte +2 -2
  103. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/Icon.svelte +36 -9
  104. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/Input.svelte +7 -10
  105. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDatetime/index.js +26 -28
  106. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/Card.svelte +2 -2
  107. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/Icon.svelte +40 -10
  108. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/Input.svelte +7 -10
  109. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeDay/index.js +26 -28
  110. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/Card.svelte +2 -2
  111. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/Icon.svelte +8 -2
  112. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/Input.svelte +7 -10
  113. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeHour/index.js +26 -28
  114. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/Card.svelte +2 -2
  115. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/Icon.svelte +40 -10
  116. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/Input.svelte +7 -10
  117. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonth/index.js +26 -28
  118. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/Card.svelte +2 -2
  119. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/Icon.svelte +40 -10
  120. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/Input.svelte +7 -10
  121. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeMonthOfYear/index.js +26 -28
  122. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/Card.svelte +2 -2
  123. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/Icon.svelte +36 -9
  124. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeUpdatedAt/index.js +25 -27
  125. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/Card.svelte +2 -2
  126. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/Icon.svelte +40 -10
  127. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/Input.svelte +7 -10
  128. package/src/lib/registry/fieldTypeRegistry/fieldTypes/time/TimeYear/index.js +26 -28
  129. package/src/lib/registry/fieldTypeRegistry/registerDefaultFieldTypes.js +58 -59
  130. package/src/lib/registry/fieldTypeRegistry/registry.svelte.js +30 -59
  131. package/src/routes/+layout.svelte +4 -4
  132. package/src/routes/global.css +172 -162
  133. package/src/routes/login/+page.svelte +58 -35
  134. package/src/routes/registry/fieldRegistry.svelte.js +17 -29
@@ -1,20 +1,32 @@
1
1
  <script>
2
- let {size = "24px", color="var(--font-1)"} = $props()
2
+ let { size = '24px', color = 'var(--font-1)' } = $props();
3
3
  </script>
4
4
 
5
- <svg style="--size:{size};--color:{color};" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
6
- <path d="M12.1998 17.3799C11.4998 17.3799 10.7898 17.1099 10.2598 16.5799C9.73977 16.0599 9.44977 15.3699 9.44977 14.6399C9.44977 13.9099 9.73977 13.2099 10.2598 12.6999L11.6697 11.2899C11.9597 10.9999 12.4397 10.9999 12.7297 11.2899C13.0197 11.5799 13.0197 12.0599 12.7297 12.3499L11.3198 13.7599C11.0798 13.9999 10.9498 14.3099 10.9498 14.6399C10.9498 14.9699 11.0798 15.2899 11.3198 15.5199C11.8098 16.0099 12.5998 16.0099 13.0898 15.5199L15.3098 13.2999C16.5798 12.0299 16.5798 9.96994 15.3098 8.69994C14.0398 7.42994 11.9798 7.42994 10.7098 8.69994L8.28973 11.1199C7.77973 11.6299 7.49976 12.2999 7.49976 13.0099C7.49976 13.7199 7.77973 14.3999 8.28973 14.8999C8.57973 15.1899 8.57973 15.6699 8.28973 15.9599C7.99973 16.2499 7.51974 16.2499 7.22974 15.9599C6.43974 15.1699 6.00977 14.1199 6.00977 12.9999C6.00977 11.8799 6.43974 10.8299 7.22974 10.0399L9.64978 7.61992C11.4998 5.76992 14.5198 5.76992 16.3698 7.61992C18.2198 9.46992 18.2198 12.4899 16.3698 14.3399L14.1498 16.5599C13.6098 17.1099 12.9098 17.3799 12.1998 17.3799Z" fill="#292D32"/>
7
- <path 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" fill="#292D32"/>
5
+ <svg
6
+ style="--size:{size};--color:{color};"
7
+ width="24"
8
+ height="24"
9
+ viewBox="0 0 24 24"
10
+ fill="none"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path
14
+ d="M12.1998 17.3799C11.4998 17.3799 10.7898 17.1099 10.2598 16.5799C9.73977 16.0599 9.44977 15.3699 9.44977 14.6399C9.44977 13.9099 9.73977 13.2099 10.2598 12.6999L11.6697 11.2899C11.9597 10.9999 12.4397 10.9999 12.7297 11.2899C13.0197 11.5799 13.0197 12.0599 12.7297 12.3499L11.3198 13.7599C11.0798 13.9999 10.9498 14.3099 10.9498 14.6399C10.9498 14.9699 11.0798 15.2899 11.3198 15.5199C11.8098 16.0099 12.5998 16.0099 13.0898 15.5199L15.3098 13.2999C16.5798 12.0299 16.5798 9.96994 15.3098 8.69994C14.0398 7.42994 11.9798 7.42994 10.7098 8.69994L8.28973 11.1199C7.77973 11.6299 7.49976 12.2999 7.49976 13.0099C7.49976 13.7199 7.77973 14.3999 8.28973 14.8999C8.57973 15.1899 8.57973 15.6699 8.28973 15.9599C7.99973 16.2499 7.51974 16.2499 7.22974 15.9599C6.43974 15.1699 6.00977 14.1199 6.00977 12.9999C6.00977 11.8799 6.43974 10.8299 7.22974 10.0399L9.64978 7.61992C11.4998 5.76992 14.5198 5.76992 16.3698 7.61992C18.2198 9.46992 18.2198 12.4899 16.3698 14.3399L14.1498 16.5599C13.6098 17.1099 12.9098 17.3799 12.1998 17.3799Z"
15
+ fill="#292D32"
16
+ />
17
+ <path
18
+ 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"
19
+ fill="#292D32"
20
+ />
8
21
  </svg>
9
22
 
10
-
11
23
  <style>
12
- svg {
13
- width: var(--size);
14
- height: auto;
15
- aspect-ratio: 1/1;
16
- }
17
- svg path {
18
- fill: var(--color);
19
- }
24
+ svg {
25
+ width: var(--size);
26
+ height: auto;
27
+ aspect-ratio: 1/1;
28
+ }
29
+ svg path {
30
+ fill: var(--color);
31
+ }
20
32
  </style>
@@ -1,40 +1,38 @@
1
-
2
1
  export function createEntity(config = {}) {
3
- const entity = {
4
- "id": null,
5
- "version": 1,
6
- "plural_name": "",
7
- "singular_name": "",
8
- "normalized_name": "",
9
- "slug": "",
10
- "symbol": "#",
11
- "can_be_created": true,
12
- "can_be_edited": true,
13
- "can_be_deleted": true,
14
- "is_locked": false,
15
- "updated_at": null,
16
- "created_at": null,
17
- "fields": [
18
- {
19
- "id": null,
20
- "link_to_field_id": null,
21
- "entity_id": null,
22
- "type": "primary",
23
- "name": "id",
24
- "normalized_name": "id",
25
- "is_locked": true,
26
- "is_required": false,
27
- "is_unique": true,
28
- "is_secret": false,
29
- "props": {}
30
- }
31
- ],
32
- };
2
+ const entity = {
3
+ id: null,
4
+ version: 1,
5
+ plural_name: '',
6
+ singular_name: '',
7
+ normalized_name: '',
8
+ slug: '',
9
+ symbol: '#',
10
+ can_be_created: true,
11
+ can_be_edited: true,
12
+ can_be_deleted: true,
13
+ is_locked: false,
14
+ updated_at: null,
15
+ created_at: null,
16
+ fields: [
17
+ {
18
+ id: null,
19
+ link_to_field_id: null,
20
+ entity_id: null,
21
+ type: 'primary',
22
+ name: 'id',
23
+ normalized_name: 'id',
24
+ is_locked: true,
25
+ is_required: false,
26
+ is_unique: true,
27
+ is_secret: false,
28
+ props: {}
29
+ }
30
+ ]
31
+ };
33
32
 
34
- Object.assign(entity, config);
33
+ Object.assign(entity, config);
35
34
 
36
- entity.getField = (id) =>
37
- entity.fields.find(field => field.id === id);
35
+ entity.getField = (id) => entity.fields.find((field) => field.id === id);
38
36
 
39
- return entity;
40
- }
37
+ return entity;
38
+ }
@@ -1,140 +1,98 @@
1
- import { writable, derived, get } from "svelte/store";
1
+ import { writable, derived, get } from 'svelte/store';
2
2
 
3
3
  function createEntityRegistry() {
4
+ const store = writable({});
4
5
 
5
- const store = writable({});
6
+ const all = derived(store, ($entities) => Object.values($entities));
6
7
 
7
- const all = derived(
8
- store,
9
- ($entities) => Object.values($entities)
10
- );
8
+ return {
9
+ subscribe: store.subscribe,
11
10
 
12
- return {
11
+ register(entity) {
12
+ store.update((entities) => ({
13
+ ...entities,
14
+ [entity.id]: entity
15
+ }));
16
+ },
13
17
 
14
- subscribe: store.subscribe,
18
+ unregister(id) {
19
+ store.update((entities) => {
20
+ const copy = { ...entities };
15
21
 
16
- register(entity) {
22
+ delete copy[id];
17
23
 
18
- store.update(entities => ({
19
- ...entities,
20
- [entity.id]: entity
21
- }));
24
+ return copy;
25
+ });
26
+ },
22
27
 
23
- },
28
+ get(id) {
29
+ return get(store)[id];
30
+ },
24
31
 
25
- unregister(id) {
32
+ select(id) {
33
+ return derived(store, ($entities) => $entities[id]);
34
+ },
26
35
 
27
- store.update(entities => {
36
+ getLinkedField(entityId, linkId) {
37
+ const entities = get(store);
28
38
 
29
- const copy = { ...entities };
39
+ // Si l'entité est connue, on cherche directement dedans
40
+ if (!entityId) return null;
30
41
 
31
- delete copy[id];
42
+ const entity = entities[entityId];
32
43
 
33
- return copy;
44
+ return entity.fields?.find((field) => field.props.linkId === linkId) ?? null;
45
+ },
46
+ getField(id, entityId = null) {
47
+ const entities = get(store);
34
48
 
35
- });
49
+ // Si l'entité est connue, on cherche directement dedans
50
+ if (entityId) {
51
+ const entity = entities[entityId];
36
52
 
37
- },
53
+ if (!entity) {
54
+ return null;
55
+ }
38
56
 
39
- get(id) {
57
+ return entity.fields?.find((field) => field.id === id) ?? null;
58
+ }
40
59
 
41
- return get(store)[id];
60
+ // Sinon on parcourt toutes les entités
61
+ for (const entity of Object.values(entities)) {
62
+ const field = entity.fields?.find((field) => field.id === id);
42
63
 
43
- },
64
+ if (field) {
65
+ return field;
66
+ }
67
+ }
44
68
 
45
- select(id) {
69
+ return null;
70
+ },
46
71
 
47
- return derived(
48
- store,
49
- ($entities) => $entities[id]
50
- );
72
+ selectField(id, entityId = null) {
73
+ return derived(store, ($entities) => {
74
+ if (entityId) {
75
+ const entity = $entities[entityId];
51
76
 
52
- },
77
+ return entity?.fields?.find((field) => field.id === id) ?? null;
78
+ }
53
79
 
54
- getLinkedField(entityId, linkId) {
80
+ for (const entity of Object.values($entities)) {
81
+ const field = entity.fields?.find((field) => field.id === id);
55
82
 
56
- const entities = get(store);
83
+ if (field) {
84
+ return field;
85
+ }
86
+ }
57
87
 
58
- // Si l'entité est connue, on cherche directement dedans
59
- if (!entityId) return null
60
-
61
- const entity = entities[entityId];
62
-
63
-
64
- return entity.fields?.find(field => field.props.linkId === linkId) ?? null;
65
- },
66
- getField(id, entityId = null) {
67
-
68
- const entities = get(store);
69
-
70
- // Si l'entité est connue, on cherche directement dedans
71
- if (entityId) {
72
-
73
- const entity = entities[entityId];
74
-
75
- if (!entity) {
76
- return null;
77
- }
78
-
79
- return entity.fields?.find(field => field.id === id) ?? null;
80
- }
81
-
82
-
83
- // Sinon on parcourt toutes les entités
84
- for (const entity of Object.values(entities)) {
85
-
86
- const field = entity.fields?.find(field => field.id === id);
87
-
88
- if (field) {
89
- return field;
90
- }
91
-
92
- }
93
-
94
- return null;
95
-
96
- },
97
-
98
- selectField(id, entityId = null) {
99
-
100
- return derived(
101
- store,
102
- ($entities) => {
103
-
104
- if (entityId) {
105
-
106
- const entity = $entities[entityId];
107
-
108
- return entity?.fields?.find(field => field.id === id) ?? null;
109
-
110
- }
111
-
112
-
113
- for (const entity of Object.values($entities)) {
114
-
115
- const field = entity.fields?.find(field => field.id === id);
116
-
117
- if (field) {
118
- return field;
119
- }
120
-
121
- }
122
-
123
- return null;
124
-
125
- }
126
- );
127
-
128
- },
129
-
130
- getAll() {
131
-
132
- return all;
133
-
134
- }
135
-
136
- };
88
+ return null;
89
+ });
90
+ },
137
91
 
92
+ getAll() {
93
+ return all;
94
+ }
95
+ };
138
96
  }
139
97
 
140
- export const entityRegistry = createEntityRegistry();
98
+ export const entityRegistry = createEntityRegistry();
@@ -1,12 +1,13 @@
1
1
  <script>
2
- import FieldButton from "../fieldTypes/FieldTypeButton.svelte";
3
- import { fieldTypeRegistry } from "../registry.svelte";
2
+ import FieldButton from '../fieldTypes/FieldTypeButton.svelte';
3
+ import { fieldTypeRegistry } from '../registry.svelte';
4
4
 
5
- let {type, variant="ghost", ...props} = $props()
5
+ let { type, variant = 'ghost', ...props } = $props();
6
6
 
7
- const field = fieldTypeRegistry.select(type)
7
+ const field = fieldTypeRegistry.select(type);
8
8
  </script>
9
9
 
10
10
  {#if $field}
11
- <svelte:component {variant} {...props} this={$field.components.button} {...$field}></svelte:component>
12
- {/if}
11
+ <svelte:component this={$field.components.button} {variant} {...props} {...$field}
12
+ ></svelte:component>
13
+ {/if}
@@ -1,11 +1,12 @@
1
1
  <script>
2
- import { fieldTypeRegistry } from "../registry.svelte";
2
+ import { fieldTypeRegistry } from '../registry.svelte';
3
3
 
4
- let {type, variant="ghost", ...props} = $props()
4
+ let { type, variant = 'ghost', ...props } = $props();
5
5
 
6
- const field = fieldTypeRegistry.select(type)
6
+ const field = fieldTypeRegistry.select(type);
7
7
  </script>
8
8
 
9
9
  {#if $field}
10
- <svelte:component {variant} {...props} this={$field.components.card} {...$field}></svelte:component>
11
- {/if}
10
+ <svelte:component this={$field.components.card} {variant} {...props} {...$field}
11
+ ></svelte:component>
12
+ {/if}
@@ -1,11 +1,11 @@
1
1
  <script>
2
- import { fieldTypeRegistry } from "../registry.svelte";
2
+ import { fieldTypeRegistry } from '../registry.svelte';
3
3
 
4
- let {type, ...props} = $props()
4
+ let { type, ...props } = $props();
5
5
 
6
- const field = fieldTypeRegistry.select(type)
6
+ const field = fieldTypeRegistry.select(type);
7
7
  </script>
8
8
 
9
9
  {#if $field && $field?.components?.icon}
10
- <svelte:component {...props} this={$field.components.icon} field={$field}></svelte:component>
11
- {/if}
10
+ <svelte:component this={$field.components.icon} {...props} field={$field}></svelte:component>
11
+ {/if}
@@ -1,11 +1,11 @@
1
1
  <script>
2
- import { fieldTypeRegistry } from "../registry.svelte";
2
+ import { fieldTypeRegistry } from '../registry.svelte';
3
3
 
4
- let {type, ...props} = $props()
4
+ let { type, ...props } = $props();
5
5
 
6
- const field = fieldTypeRegistry.select(type)
6
+ const field = fieldTypeRegistry.select(type);
7
7
  </script>
8
8
 
9
9
  {#if $field}
10
- <svelte:component {...props} this={$field.components.input} field={$field}></svelte:component>
11
- {/if}
10
+ <svelte:component this={$field.components.input} {...props} field={$field}></svelte:component>
11
+ {/if}
@@ -12,12 +12,12 @@
12
12
  {#if required}
13
13
  <FieldIsRequiredIcon size="12px"></FieldIsRequiredIcon>
14
14
  {/if}
15
- {#if unique}
16
- <FieldIsUniqueIcon size="12px"></FieldIsUniqueIcon>
17
- {/if}
18
- {#if secret}
19
- <FieldIsSecretIcon size="12px"></FieldIsSecretIcon>
20
- {/if}
15
+ {#if unique}
16
+ <FieldIsUniqueIcon size="12px"></FieldIsUniqueIcon>
17
+ {/if}
18
+ {#if secret}
19
+ <FieldIsSecretIcon size="12px"></FieldIsSecretIcon>
20
+ {/if}
21
21
  </span>
22
22
  </h4>
23
23
 
@@ -26,6 +26,6 @@
26
26
  }
27
27
  .line.compact {
28
28
  grid-template-columns: 1fr;
29
- border-bottom:initial;
29
+ border-bottom: initial;
30
30
  }
31
31
  </style>
@@ -1,34 +1,34 @@
1
1
  export function createFieldType(config) {
2
- return {
3
- type:"",
4
-
5
- category_path:[],
2
+ return {
3
+ type: '',
6
4
 
7
- label: "",
8
- description: "",
5
+ category_path: [],
9
6
 
10
- is_hidden:true,
7
+ label: '',
8
+ description: '',
11
9
 
12
- can_be_required:true,
13
- can_be_unique:true,
10
+ is_hidden: true,
14
11
 
15
- defaultProps:{},
12
+ can_be_required: true,
13
+ can_be_unique: true,
16
14
 
17
- components: {
18
- icon: null,
19
- button: null,
20
- card: null,
21
- input: null,
22
- cell: null,
23
- filter: null,
24
- properties: null
25
- },
15
+ defaultProps: {},
26
16
 
27
- formatter: (value) => value,
28
- parser: (value) => value,
17
+ components: {
18
+ icon: null,
19
+ button: null,
20
+ card: null,
21
+ input: null,
22
+ cell: null,
23
+ filter: null,
24
+ properties: null
25
+ },
29
26
 
30
- validate: () => true,
27
+ formatter: (value) => value,
28
+ parser: (value) => value,
31
29
 
32
- ...config
33
- };
34
- }
30
+ validate: () => true,
31
+
32
+ ...config
33
+ };
34
+ }
@@ -22,7 +22,7 @@
22
22
  display: flex;
23
23
  align-items: center;
24
24
  justify-content: space-between;
25
- padding: var(--pad-xl) var(--pad-xl) var(--pad-xl) 0;
25
+ padding: var(--pad-xl) var(--pad-xl) var(--pad-xl) 0;
26
26
  }
27
27
 
28
28
  .left {
@@ -30,12 +30,11 @@
30
30
  column-gap: var(--pad-xl);
31
31
  }
32
32
 
33
- .left :global(svg path) {
34
- fill: var(--font-2);
35
- }
36
-
37
- .text {
38
- text-align: left;
39
- }
33
+ .left :global(svg path) {
34
+ fill: var(--font-2);
35
+ }
40
36
 
37
+ .text {
38
+ text-align: left;
39
+ }
41
40
  </style>
@@ -1,10 +1,8 @@
1
1
  <script>
2
- import FieldTypeButton from "../FieldTypeButton.svelte";
3
- import Icon from "./Icon.svelte";
2
+ import FieldTypeButton from '../FieldTypeButton.svelte';
3
+ import Icon from './Icon.svelte';
4
4
 
5
- let {...props} = $props()
5
+ let { ...props } = $props();
6
6
  </script>
7
7
 
8
- <FieldTypeButton {...props}>
9
-
10
- </FieldTypeButton>
8
+ <FieldTypeButton {...props}></FieldTypeButton>
@@ -1,6 +1,6 @@
1
1
  <script>
2
- import FieldCard from "../FieldTypeCard.svelte";
3
- let {...props} = $props()
2
+ import FieldCard from '../FieldTypeCard.svelte';
3
+ let { ...props } = $props();
4
4
  </script>
5
5
 
6
6
  <FieldCard {...props}></FieldCard>
@@ -1,5 +1,14 @@
1
1
  <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M21 7.75H3C2.59 7.75 2.25 7.41 2.25 7C2.25 6.59 2.59 6.25 3 6.25H21C21.41 6.25 21.75 6.59 21.75 7C21.75 7.41 21.41 7.75 21 7.75Z" fill="#292D32"/>
3
- <path d="M21 12.75H3C2.59 12.75 2.25 12.41 2.25 12C2.25 11.59 2.59 11.25 3 11.25H21C21.41 11.25 21.75 11.59 21.75 12C21.75 12.41 21.41 12.75 21 12.75Z" fill="#292D32"/>
4
- <path d="M21 17.75H3C2.59 17.75 2.25 17.41 2.25 17C2.25 16.59 2.59 16.25 3 16.25H21C21.41 16.25 21.75 16.59 21.75 17C21.75 17.41 21.41 17.75 21 17.75Z" fill="#292D32"/>
2
+ <path
3
+ d="M21 7.75H3C2.59 7.75 2.25 7.41 2.25 7C2.25 6.59 2.59 6.25 3 6.25H21C21.41 6.25 21.75 6.59 21.75 7C21.75 7.41 21.41 7.75 21 7.75Z"
4
+ fill="#292D32"
5
+ />
6
+ <path
7
+ d="M21 12.75H3C2.59 12.75 2.25 12.41 2.25 12C2.25 11.59 2.59 11.25 3 11.25H21C21.41 11.25 21.75 11.59 21.75 12C21.75 12.41 21.41 12.75 21 12.75Z"
8
+ fill="#292D32"
9
+ />
10
+ <path
11
+ d="M21 17.75H3C2.59 17.75 2.25 17.41 2.25 17C2.25 16.59 2.59 16.25 3 16.25H21C21.41 16.25 21.75 16.59 21.75 17C21.75 17.41 21.41 17.75 21 17.75Z"
12
+ fill="#292D32"
13
+ />
5
14
  </svg>
@@ -1,37 +1,38 @@
1
- import { createFieldType } from "../../createFieldType";
1
+ import { createFieldType } from '../../createFieldType';
2
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"
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
7
 
8
8
  export default createFieldType({
9
- type: "lines",
9
+ type: 'lines',
10
10
 
11
- category_path: "",
11
+ category_path: '',
12
12
 
13
- label: "Lignes",
14
- description: "Liste de lignes de données, généralement utilisées pour représenter des sous-éléments ou des sous-formulaires.",
13
+ label: 'Lignes',
14
+ description:
15
+ 'Liste de lignes de données, généralement utilisées pour représenter des sous-éléments ou des sous-formulaires.',
15
16
 
16
- is_hidden: false,
17
+ is_hidden: false,
17
18
 
18
- can_be_required: true,
19
- can_be_unique: true,
19
+ can_be_required: true,
20
+ can_be_unique: true,
20
21
 
21
- props:{},
22
+ props: {},
22
23
 
23
- components: {
24
- icon: Icon,
25
- button: Button,
26
- card: Card,
27
- input: Input,
28
- cell: null,
29
- filter: null,
30
- properties: null
31
- },
24
+ components: {
25
+ icon: Icon,
26
+ button: Button,
27
+ card: Card,
28
+ input: Input,
29
+ cell: null,
30
+ filter: null,
31
+ properties: null
32
+ },
32
33
 
33
- formatter: (value) => value,
34
- parser: (value) => value,
34
+ formatter: (value) => value,
35
+ parser: (value) => value,
35
36
 
36
- validate: () => true,
37
- })
37
+ validate: () => true
38
+ });
@@ -1,10 +1,8 @@
1
1
  <script>
2
- import FieldTypeButton from "../FieldTypeButton.svelte";
3
- import Icon from "./Icon.svelte";
2
+ import FieldTypeButton from '../FieldTypeButton.svelte';
3
+ import Icon from './Icon.svelte';
4
4
 
5
- let {...props} = $props()
5
+ let { ...props } = $props();
6
6
  </script>
7
7
 
8
- <FieldTypeButton {...props}>
9
-
10
- </FieldTypeButton>
8
+ <FieldTypeButton {...props}></FieldTypeButton>
@@ -1,6 +1,6 @@
1
1
  <script>
2
- import FieldCard from "../FieldTypeCard.svelte";
3
- let {...props} = $props()
2
+ import FieldCard from '../FieldTypeCard.svelte';
3
+ let { ...props } = $props();
4
4
  </script>
5
5
 
6
6
  <FieldCard {...props}></FieldCard>