fuma 1.0.20 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/README.md +1 -1
  2. package/dist/action/list/handlers.d.ts +2 -2
  3. package/dist/action/list/index.d.ts +2 -0
  4. package/dist/action/list/index.js +1 -0
  5. package/dist/action/list/trigger.d.ts +7 -1
  6. package/dist/action/list/trigger.js +2 -2
  7. package/dist/private/Meta.svelte +32 -27
  8. package/dist/private/Meta.svelte.d.ts +29 -17
  9. package/dist/private/api.d.ts +1 -1
  10. package/dist/private/store.d.ts +0 -1
  11. package/dist/server/parseFormData.d.ts +1 -1
  12. package/dist/server/parseQuery.d.ts +1 -1
  13. package/dist/server/sse.d.ts +0 -1
  14. package/dist/store/isSmallScreen.d.ts +0 -1
  15. package/dist/store/param.d.ts +0 -2
  16. package/dist/store/session.d.ts +0 -1
  17. package/dist/ui/badge/Badge.svelte +4 -3
  18. package/dist/ui/badge/Badge.svelte.d.ts +19 -15
  19. package/dist/ui/button/ButtonCopy.svelte +35 -32
  20. package/dist/ui/button/ButtonCopy.svelte.d.ts +23 -21
  21. package/dist/ui/button/ButtonDelete.svelte +23 -21
  22. package/dist/ui/button/ButtonDelete.svelte.d.ts +32 -20
  23. package/dist/ui/card/Card.svelte +13 -10
  24. package/dist/ui/card/Card.svelte.d.ts +39 -24
  25. package/dist/ui/card/CardBasic.svelte +5 -4
  26. package/dist/ui/card/CardBasic.svelte.d.ts +29 -18
  27. package/dist/ui/card/CardCollapse.svelte +35 -31
  28. package/dist/ui/card/CardCollapse.svelte.d.ts +37 -23
  29. package/dist/ui/card/CardFullScreen.svelte +8 -6
  30. package/dist/ui/card/CardFullScreen.svelte.d.ts +35 -20
  31. package/dist/ui/card/CardLink.svelte +5 -4
  32. package/dist/ui/card/CardLink.svelte.d.ts +29 -18
  33. package/dist/ui/dialog/Dialog.svelte +41 -34
  34. package/dist/ui/dialog/Dialog.svelte.d.ts +36 -23
  35. package/dist/ui/dialog/DialogConfirm.svelte +6 -4
  36. package/dist/ui/dialog/DialogConfirm.svelte.d.ts +33 -19
  37. package/dist/ui/drawer/Drawer.svelte +47 -38
  38. package/dist/ui/drawer/Drawer.svelte.d.ts +81 -46
  39. package/dist/ui/drawer/drawerFly.d.ts +0 -1
  40. package/dist/ui/drawer/layers.d.ts +0 -1
  41. package/dist/ui/form/Form.svelte +106 -87
  42. package/dist/ui/form/Form.svelte.d.ts +29 -16
  43. package/dist/ui/form/FormInput.svelte +12 -6
  44. package/dist/ui/form/FormSection.svelte +24 -17
  45. package/dist/ui/form/FormSection.svelte.d.ts +37 -25
  46. package/dist/ui/icon/Icon.svelte +35 -32
  47. package/dist/ui/icon/Icon.svelte.d.ts +25 -21
  48. package/dist/ui/index.d.ts +0 -1
  49. package/dist/ui/index.js +0 -1
  50. package/dist/ui/input/FormControl.svelte +48 -36
  51. package/dist/ui/input/FormControl.svelte.d.ts +32 -30
  52. package/dist/ui/input/InputBoolean.svelte +29 -22
  53. package/dist/ui/input/InputBoolean.svelte.d.ts +43 -35
  54. package/dist/ui/input/InputCheckboxs.svelte +37 -34
  55. package/dist/ui/input/InputCheckboxs.svelte.d.ts +54 -39
  56. package/dist/ui/input/InputCheckboxsMenu.svelte +64 -47
  57. package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +56 -41
  58. package/dist/ui/input/InputCheckboxsTree.svelte +9 -6
  59. package/dist/ui/input/InputCheckboxsTree.svelte.d.ts +22 -18
  60. package/dist/ui/input/InputCheckboxsTreeNodes.svelte +36 -28
  61. package/dist/ui/input/InputCheckboxsTreeNodes.svelte.d.ts +20 -16
  62. package/dist/ui/input/InputCombo.svelte +76 -65
  63. package/dist/ui/input/InputCombo.svelte.d.ts +55 -39
  64. package/dist/ui/input/InputDate.svelte +36 -29
  65. package/dist/ui/input/InputDate.svelte.d.ts +20 -16
  66. package/dist/ui/input/InputDateTime.svelte +37 -30
  67. package/dist/ui/input/InputDateTime.svelte.d.ts +20 -16
  68. package/dist/ui/input/InputImage.svelte +52 -45
  69. package/dist/ui/input/InputImage.svelte.d.ts +40 -27
  70. package/dist/ui/input/InputImagePreview.svelte +24 -20
  71. package/dist/ui/input/InputImagePreview.svelte.d.ts +25 -21
  72. package/dist/ui/input/InputNumber.svelte +28 -22
  73. package/dist/ui/input/InputNumber.svelte.d.ts +20 -20
  74. package/dist/ui/input/InputOptionInParam.svelte +12 -10
  75. package/dist/ui/input/InputOptionInParam.svelte.d.ts +21 -17
  76. package/dist/ui/input/InputOptions.svelte +40 -34
  77. package/dist/ui/input/InputOptions.svelte.d.ts +19 -15
  78. package/dist/ui/input/InputPassword.svelte +22 -18
  79. package/dist/ui/input/InputPassword.svelte.d.ts +43 -35
  80. package/dist/ui/input/InputRadio.svelte +51 -46
  81. package/dist/ui/input/InputRadio.svelte.d.ts +53 -38
  82. package/dist/ui/input/InputRelation.svelte +129 -112
  83. package/dist/ui/input/InputRelation.svelte.d.ts +39 -53
  84. package/dist/ui/input/InputRelations.svelte +96 -90
  85. package/dist/ui/input/InputRelations.svelte.d.ts +35 -37
  86. package/dist/ui/input/InputSearch.svelte +14 -11
  87. package/dist/ui/input/InputSearch.svelte.d.ts +25 -21
  88. package/dist/ui/input/InputSelect.svelte +59 -46
  89. package/dist/ui/input/InputSelect.svelte.d.ts +23 -19
  90. package/dist/ui/input/InputText.svelte +29 -28
  91. package/dist/ui/input/InputText.svelte.d.ts +41 -28
  92. package/dist/ui/input/InputTextarea.svelte +20 -19
  93. package/dist/ui/input/InputTextarea.svelte.d.ts +20 -20
  94. package/dist/ui/input/InputTime.svelte +43 -36
  95. package/dist/ui/input/InputTime.svelte.d.ts +21 -36
  96. package/dist/ui/input/RelationAfter.svelte +13 -9
  97. package/dist/ui/input/RelationAfter.svelte.d.ts +24 -20
  98. package/dist/ui/input/SelectorList.svelte +16 -12
  99. package/dist/ui/input/SelectorList.svelte.d.ts +29 -20
  100. package/dist/ui/input/textRich/InputTextRich.svelte +63 -59
  101. package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +36 -38
  102. package/dist/ui/input/textRich/SuggesionList.svelte +13 -9
  103. package/dist/ui/input/textRich/SuggesionList.svelte.d.ts +19 -15
  104. package/dist/ui/input/textRich/ToolMark.svelte +12 -9
  105. package/dist/ui/input/textRich/ToolMark.svelte.d.ts +22 -18
  106. package/dist/ui/input/textRich/ToolMarkColor.svelte +16 -12
  107. package/dist/ui/input/textRich/ToolMarkColor.svelte.d.ts +21 -17
  108. package/dist/ui/input/textRich/ToolMarkLink.svelte +46 -38
  109. package/dist/ui/input/textRich/ToolMarkLink.svelte.d.ts +18 -14
  110. package/dist/ui/input/textRich/ToolMenu.svelte +34 -19
  111. package/dist/ui/input/textRich/ToolMenu.svelte.d.ts +30 -26
  112. package/dist/ui/input/textRich/ToolMenuAlign.svelte +13 -9
  113. package/dist/ui/input/textRich/ToolMenuAlign.svelte.d.ts +18 -14
  114. package/dist/ui/input/textRich/ToolMenuInsert.svelte +12 -7
  115. package/dist/ui/input/textRich/ToolMenuInsert.svelte.d.ts +20 -16
  116. package/dist/ui/input/textRich/ToolMenuNode.svelte +14 -10
  117. package/dist/ui/input/textRich/ToolMenuNode.svelte.d.ts +18 -14
  118. package/dist/ui/input/textRich/ToolsBar.svelte +21 -14
  119. package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +19 -17
  120. package/dist/ui/input/textRich/suggestion.d.ts +0 -1
  121. package/dist/ui/login/Login.svelte +37 -31
  122. package/dist/ui/login/Login.svelte.d.ts +18 -14
  123. package/dist/ui/menu/ContextMenu.svelte +37 -31
  124. package/dist/ui/menu/ContextMenu.svelte.d.ts +38 -25
  125. package/dist/ui/menu/DropDown.svelte +92 -83
  126. package/dist/ui/menu/DropDown.svelte.d.ts +46 -33
  127. package/dist/ui/menu/DropDownMenu.svelte +25 -18
  128. package/dist/ui/menu/DropDownMenu.svelte.d.ts +30 -19
  129. package/dist/ui/mode/ToggleMode.svelte +28 -16
  130. package/dist/ui/mode/ToggleMode.svelte.d.ts +34 -17
  131. package/dist/ui/pagination/Pagination.svelte +9 -8
  132. package/dist/ui/pagination/Pagination.svelte.d.ts +18 -14
  133. package/dist/ui/placeholder/Placeholder.svelte +4 -3
  134. package/dist/ui/placeholder/Placeholder.svelte.d.ts +28 -17
  135. package/dist/ui/placeholder/PlaceholderImage.svelte +6 -4
  136. package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +28 -17
  137. package/dist/ui/range/RangePicker.svelte +76 -63
  138. package/dist/ui/range/RangePicker.svelte.d.ts +29 -24
  139. package/dist/ui/range/RangePickerButton.svelte +43 -35
  140. package/dist/ui/range/RangePickerButton.svelte.d.ts +21 -17
  141. package/dist/ui/table/Table.svelte +35 -28
  142. package/dist/ui/table/Table.svelte.d.ts +24 -19
  143. package/dist/ui/table/TableBody.svelte +18 -12
  144. package/dist/ui/table/TableBody.svelte.d.ts +20 -15
  145. package/dist/ui/table/TableCell.svelte +13 -10
  146. package/dist/ui/table/TableCell.svelte.d.ts +19 -14
  147. package/dist/ui/table/TableFieldsEdition.svelte +58 -52
  148. package/dist/ui/table/TableFieldsEdition.svelte.d.ts +20 -15
  149. package/dist/ui/table/TableHead.svelte +20 -21
  150. package/dist/ui/table/TableHead.svelte.d.ts +19 -14
  151. package/dist/ui/table/TableViewSelect.svelte +50 -37
  152. package/dist/ui/table/TableViewSelect.svelte.d.ts +27 -23
  153. package/dist/ui/table/cell/TableCellArray.svelte +5 -3
  154. package/dist/ui/table/cell/TableCellArray.svelte.d.ts +18 -14
  155. package/dist/ui/table/cell/TableCellBoolean.svelte +4 -3
  156. package/dist/ui/table/cell/TableCellBoolean.svelte.d.ts +18 -14
  157. package/dist/ui/table/cell/TableCellNumber.svelte +2 -1
  158. package/dist/ui/table/cell/TableCellNumber.svelte.d.ts +18 -14
  159. package/dist/ui/table/cell/TableCellString.svelte +5 -2
  160. package/dist/ui/table/cell/TableCellString.svelte.d.ts +19 -25
  161. package/dist/ui/table/field.d.ts +32 -40
  162. package/dist/ui/table/field.js +1 -1
  163. package/dist/ui/table/head/TableHeadBoolean.svelte +6 -3
  164. package/dist/ui/table/head/TableHeadBoolean.svelte.d.ts +18 -24
  165. package/dist/ui/table/head/TableHeadDate.svelte +61 -113
  166. package/dist/ui/table/head/TableHeadDate.svelte.d.ts +18 -24
  167. package/dist/ui/table/head/TableHeadDefault.svelte +5 -2
  168. package/dist/ui/table/head/TableHeadDefault.svelte.d.ts +18 -24
  169. package/dist/ui/table/head/TableHeadNumber.svelte +67 -76
  170. package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +18 -24
  171. package/dist/ui/table/head/TableHeadSelect.svelte +47 -41
  172. package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +21 -27
  173. package/dist/ui/table/head/TableHeadString.svelte +14 -8
  174. package/dist/ui/table/head/TableHeadString.svelte.d.ts +18 -24
  175. package/dist/ui/tabs/Tabs.svelte +8 -5
  176. package/dist/ui/tabs/Tabs.svelte.d.ts +19 -15
  177. package/dist/ui/tabs/TabsIcon.svelte +31 -28
  178. package/dist/ui/tabs/TabsIcon.svelte.d.ts +21 -17
  179. package/dist/utils/eventEmitter.d.ts +4 -4
  180. package/dist/utils/tippy.d.ts +1 -1
  181. package/dist/validation/form.d.ts +0 -1
  182. package/dist/validation/zod.d.ts +96 -162
  183. package/dist/validation/zod.js +2 -4
  184. package/package.json +134 -138
  185. package/dist/ui/form/FormInput.svelte.d.ts +0 -152
  186. package/dist/ui/form/formInput.d.ts +0 -90
  187. package/dist/ui/slot/Slot.svelte +0 -35
  188. package/dist/ui/slot/Slot.svelte.d.ts +0 -22
  189. package/dist/ui/slot/Span.svelte +0 -4
  190. package/dist/ui/slot/Span.svelte.d.ts +0 -16
  191. package/dist/ui/slot/index.d.ts +0 -1
  192. package/dist/ui/slot/index.js +0 -1
  193. package/dist/ui/table/head/OrderButtons.svelte +0 -37
  194. package/dist/ui/table/head/OrderButtons.svelte.d.ts +0 -20
  195. package/dist/ui/table/head/index.d.ts +0 -19
@@ -1,38 +1,54 @@
1
- <script>import { goto } from "$app/navigation";
2
- import { page } from "$app/stores";
3
- import { mdiClose } from "@mdi/js";
4
- import { urlParam } from "../../store/index.js";
5
- import { jsonParse, parseOptions } from "../../utils/index.js";
6
- import { Icon } from "../icon/index.js";
7
- import { DropDown } from "../menu/index.js";
8
- import { FormControl } from "./index.js";
9
- $:
10
- ({
11
- input,
12
- value: _value,
13
- options: _1,
14
- class: klass,
15
- label,
16
- right,
17
- btnClass,
18
- badgePrimary,
19
- ...props
20
- } = $$props);
21
- export let key;
22
- export let options;
23
- export let value = _value || jsonParse($page.url.searchParams.get(key), []);
24
- let dropdown;
25
- $:
26
- _options = parseOptions(options);
27
- async function writeUrl() {
28
- const url = value?.length ? $urlParam.with({ [key]: JSON.stringify(value) }) : $urlParam.without(key);
29
- return goto(url, { replaceState: true, noScroll: true });
30
- }
31
- function handleReset() {
32
- dropdown.hide();
33
- value = [];
34
- goto($urlParam.without(key), { replaceState: true });
35
- }
1
+ <script lang="ts">
2
+ import { goto } from '$app/navigation'
3
+ import { page } from '$app/stores'
4
+ import { mdiClose } from '@mdi/js'
5
+
6
+ import { urlParam } from '../../store/index.js'
7
+ import { jsonParse, type Options, parseOptions } from '../../utils/index.js'
8
+ import { Icon } from '../icon/index.js'
9
+ import { DropDown } from '../menu/index.js'
10
+ import { FormControl, type InputProps } from './index.js'
11
+
12
+ type $$Props = InputProps<string[]> & {
13
+ key: string
14
+ options: Options
15
+ right?: boolean
16
+ btnClass?: string
17
+ badgePrimary?: boolean
18
+ }
19
+ $: ({
20
+ input,
21
+ value: _value,
22
+ options: _1,
23
+ class: klass,
24
+ label,
25
+ right,
26
+ btnClass,
27
+ badgePrimary,
28
+ ...props
29
+ } = $$props as $$Props)
30
+
31
+ export let key: string
32
+ export let options: Options
33
+ export let value: string[] | null | undefined =
34
+ _value || jsonParse($page.url.searchParams.get(key), [])
35
+
36
+ let dropdown: DropDown
37
+
38
+ $: _options = parseOptions(options)
39
+
40
+ async function writeUrl() {
41
+ const url = value?.length
42
+ ? $urlParam.with({ [key]: JSON.stringify(value) })
43
+ : $urlParam.without(key)
44
+ return goto(url, { replaceState: true, noScroll: true })
45
+ }
46
+
47
+ function handleReset() {
48
+ dropdown.hide()
49
+ value = []
50
+ goto($urlParam.without(key), { replaceState: true })
51
+ }
36
52
  </script>
37
53
 
38
54
  <input type="hidden" name={key} value={JSON.stringify(value)} />
@@ -65,22 +81,23 @@ function handleReset() {
65
81
  {#each _options as option, index (option.value)}
66
82
  <FormControl
67
83
  {...props}
68
- let:key
69
84
  label={option.label}
70
85
  prefixFor={index}
71
86
  class="flex-row-reverse items-center justify-end gap-2 whitespace-nowrap"
72
87
  >
73
- <input
74
- bind:group={value}
75
- on:input
76
- on:focus
77
- on:blur
78
- value={option.value}
79
- type="checkbox"
80
- id="{index}{key}"
81
- class="checkbox"
82
- {...input}
83
- />
88
+ {#snippet children({ key })}
89
+ <input
90
+ bind:group={value}
91
+ on:input
92
+ on:focus
93
+ on:blur
94
+ value={option.value}
95
+ type="checkbox"
96
+ id="{index}{key}"
97
+ class="checkbox"
98
+ {...input}
99
+ />
100
+ {/snippet}
84
101
  </FormControl>
85
102
  {:else}
86
103
  <div class="px-3 py-2 rounded opacity-70">Aucun élément</div>
@@ -1,44 +1,59 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import { type Options } from '../../utils/index.js';
3
- declare const __propDef: {
4
- props: {
5
- class?: string | undefined;
6
- classLabel?: string | undefined;
7
- key?: string | undefined;
8
- label?: string | import("svelte").ComponentType | import("../../utils/index.js").ComponentAndProps | undefined;
9
- error?: string | undefined;
10
- hint?: string | undefined;
11
- prefix?: string | number | undefined;
12
- prefixFor?: string | number | undefined;
13
- enhanceDisabled?: boolean | undefined;
14
- labelPosition?: ("top" | "left" | "right") | undefined;
15
- } & {
16
- input?: import("svelte/elements.js").HTMLInputAttributes | undefined;
17
- inputElement?: HTMLInputElement | undefined;
18
- classWrapper?: string | undefined;
19
- value?: string[] | null | undefined;
20
- bindWithParams?: boolean | undefined;
21
- } & {
22
- key: string;
23
- options: Options;
24
- right?: boolean | undefined;
25
- btnClass?: string | undefined;
26
- badgePrimary?: boolean | undefined;
27
- };
28
- events: {
29
- input: Event;
30
- focus: FocusEvent;
31
- blur: FocusEvent;
32
- } & {
33
- [evt: string]: CustomEvent<any>;
2
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
34
12
  };
35
- slots: {
36
- label: {};
37
- };
38
- };
39
- export type InputCheckboxsMenuProps = typeof __propDef.props;
40
- export type InputCheckboxsMenuEvents = typeof __propDef.events;
41
- export type InputCheckboxsMenuSlots = typeof __propDef.slots;
42
- export default class InputCheckboxsMenu extends SvelteComponent<InputCheckboxsMenuProps, InputCheckboxsMenuEvents, InputCheckboxsMenuSlots> {
13
+ z_$$bindings?: Bindings;
43
14
  }
44
- export {};
15
+ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
16
+ default: any;
17
+ } ? Props extends Record<string, never> ? any : {
18
+ children?: any;
19
+ } : {});
20
+ declare const InputCheckboxsMenu: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
21
+ class?: string;
22
+ classLabel?: string;
23
+ key?: string;
24
+ label?: import("svelte").Snippet | string;
25
+ labelAppend?: import("svelte").Snippet | null;
26
+ error?: string;
27
+ hint?: string;
28
+ prefix?: string | number;
29
+ prefixFor?: string | number;
30
+ enhanceDisabled?: boolean;
31
+ labelPosition?: "top" | "left" | "right";
32
+ children?: import("svelte").Snippet<[{
33
+ key: string;
34
+ }]> | undefined;
35
+ } & {
36
+ input?: import("svelte/elements").HTMLInputAttributes;
37
+ inputElement?: HTMLInputElement;
38
+ classWrapper?: string;
39
+ value?: string[] | null | undefined;
40
+ bindWithParams?: boolean;
41
+ } & {
42
+ key: string;
43
+ options: Options;
44
+ right?: boolean;
45
+ btnClass?: string;
46
+ badgePrimary?: boolean;
47
+ }, {
48
+ label: {};
49
+ }>, {
50
+ input: Event;
51
+ focus: FocusEvent;
52
+ blur: FocusEvent;
53
+ } & {
54
+ [evt: string]: CustomEvent<any>;
55
+ }, {
56
+ label: {};
57
+ }, {}, string>;
58
+ type InputCheckboxsMenu = InstanceType<typeof InputCheckboxsMenu>;
59
+ export default InputCheckboxsMenu;
@@ -1,9 +1,12 @@
1
- <script>import InputCheckboxsTreeNodes, {
2
- } from "./InputCheckboxsTreeNodes.svelte";
3
- export let label;
4
- export let options;
5
- let klass = "";
6
- export { klass as class };
1
+ <script lang="ts">
2
+ import InputCheckboxsTreeNodes, {
3
+ type OptionsNode
4
+ } from './InputCheckboxsTreeNodes.svelte'
5
+
6
+ export let label: string
7
+ export let options: OptionsNode
8
+ let klass = ''
9
+ export { klass as class }
7
10
  </script>
8
11
 
9
12
  <div class={klass}>
@@ -1,21 +1,25 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import { type OptionsNode } from './InputCheckboxsTreeNodes.svelte';
3
- declare const __propDef: {
4
- props: {
5
- label: string;
6
- options: OptionsNode;
7
- class?: string | undefined;
2
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
+ $$bindings?: Bindings;
5
+ } & Exports;
6
+ (internal: unknown, props: Props & {
7
+ $$events?: Events;
8
+ $$slots?: Slots;
9
+ }): Exports & {
10
+ $set?: any;
11
+ $on?: any;
8
12
  };
9
- events: {
10
- [evt: string]: CustomEvent<any>;
11
- };
12
- slots: {
13
- label_append: {};
14
- };
15
- };
16
- export type InputCheckboxsTreeProps = typeof __propDef.props;
17
- export type InputCheckboxsTreeEvents = typeof __propDef.events;
18
- export type InputCheckboxsTreeSlots = typeof __propDef.slots;
19
- export default class InputCheckboxsTree extends SvelteComponent<InputCheckboxsTreeProps, InputCheckboxsTreeEvents, InputCheckboxsTreeSlots> {
13
+ z_$$bindings?: Bindings;
20
14
  }
21
- export {};
15
+ declare const InputCheckboxsTree: $$__sveltets_2_IsomorphicComponent<{
16
+ label: string;
17
+ options: OptionsNode;
18
+ class?: string;
19
+ }, {
20
+ [evt: string]: CustomEvent<any>;
21
+ }, {
22
+ label_append: {};
23
+ }, {}, string>;
24
+ type InputCheckboxsTree = InstanceType<typeof InputCheckboxsTree>;
25
+ export default InputCheckboxsTree;
@@ -1,31 +1,39 @@
1
- <script context="module"></script>
1
+ <script lang="ts" context="module">
2
+ export type OptionsNode = Record<
3
+ string,
4
+ { label: string; value?: boolean; options?: OptionsNode }
5
+ >
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import { createEventDispatcher } from 'svelte'
10
+ import { InputBoolean } from './index.js'
11
+ export let options: OptionsNode
12
+
13
+ type Events = { setTrue: void }
14
+ const dispatch = createEventDispatcher<Events>()
15
+
16
+ function handleChange(newValue: boolean, option: OptionsNode[string]) {
17
+ if (newValue === true) dispatch('setTrue')
18
+ else if (option.options) {
19
+ option.options = setFalse(option.options)
20
+ }
21
+ }
2
22
 
3
- <script>import { createEventDispatcher } from "svelte";
4
- import { InputBoolean } from "./index.js";
5
- export let options;
6
- const dispatch = createEventDispatcher();
7
- function handleChange(newValue, option) {
8
- if (newValue === true)
9
- dispatch("setTrue");
10
- else if (option.options) {
11
- option.options = setFalse(option.options);
12
- }
13
- }
14
- function setFalse(_options) {
15
- if (!_options)
16
- return void 0;
17
- return Object.entries(_options).reduce(
18
- (acc, [key, opt]) => ({
19
- ...acc,
20
- [key]: {
21
- label: opt.label,
22
- value: false,
23
- options: setFalse(opt.options)
24
- }
25
- }),
26
- {}
27
- );
28
- }
23
+ function setFalse(_options?: OptionsNode): OptionsNode | undefined {
24
+ if (!_options) return undefined
25
+ return Object.entries(_options).reduce<OptionsNode>(
26
+ (acc, [key, opt]) => ({
27
+ ...acc,
28
+ [key]: {
29
+ label: opt.label,
30
+ value: false,
31
+ options: setFalse(opt.options)
32
+ }
33
+ }),
34
+ {}
35
+ )
36
+ }
29
37
  </script>
30
38
 
31
39
  {#each Object.keys(options) as key (key)}
@@ -43,7 +51,7 @@ function setFalse(_options) {
43
51
  <div
44
52
  style:height="{24 + index * 36}px"
45
53
  class="t-0 bordered absolute w-3 rounded-bl-lg border-b-2 border-l-2"
46
- />
54
+ ></div>
47
55
  {/each}
48
56
  </div>
49
57
  <div>
@@ -1,23 +1,27 @@
1
- import { SvelteComponent } from "svelte";
2
1
  export type OptionsNode = Record<string, {
3
2
  label: string;
4
3
  value?: boolean;
5
4
  options?: OptionsNode;
6
5
  }>;
7
- declare const __propDef: {
8
- props: {
9
- options: OptionsNode;
6
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
7
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
8
+ $$bindings?: Bindings;
9
+ } & Exports;
10
+ (internal: unknown, props: Props & {
11
+ $$events?: Events;
12
+ $$slots?: Slots;
13
+ }): Exports & {
14
+ $set?: any;
15
+ $on?: any;
10
16
  };
11
- events: {
12
- setTrue: CustomEvent<void>;
13
- } & {
14
- [evt: string]: CustomEvent<any>;
15
- };
16
- slots: {};
17
- };
18
- export type InputCheckboxsTreeNodesProps = typeof __propDef.props;
19
- export type InputCheckboxsTreeNodesEvents = typeof __propDef.events;
20
- export type InputCheckboxsTreeNodesSlots = typeof __propDef.slots;
21
- export default class InputCheckboxsTreeNodes extends SvelteComponent<InputCheckboxsTreeNodesProps, InputCheckboxsTreeNodesEvents, InputCheckboxsTreeNodesSlots> {
17
+ z_$$bindings?: Bindings;
22
18
  }
23
- export {};
19
+ declare const InputCheckboxsTreeNodes: $$__sveltets_2_IsomorphicComponent<{
20
+ options: OptionsNode;
21
+ }, {
22
+ setTrue: CustomEvent<void>;
23
+ } & {
24
+ [evt: string]: CustomEvent<any>;
25
+ }, {}, {}, string>;
26
+ type InputCheckboxsTreeNodes = InstanceType<typeof InputCheckboxsTreeNodes>;
27
+ export default InputCheckboxsTreeNodes;
@@ -1,74 +1,85 @@
1
- <script>import { createEventDispatcher, tick } from "svelte";
2
- import { parseOptions } from "../../utils/options.js";
3
- import { FormControl, SelectorList } from "./index.js";
4
- import { DropDown } from "../menu/index.js";
5
- import { Icon } from "../icon/index.js";
6
- $:
7
- ({ input, value: _value, options, tippyProps, ...props } = $$props);
8
- $:
9
- ({ class: inputClass, ...inputProps } = input || {});
10
- export let value = _value;
11
- export let inputElement = void 0;
12
- let focusIndex = 0;
13
- let searchValue = "";
14
- const dispatch = createEventDispatcher();
15
- let filteredOptions = [];
16
- $:
17
- _options = parseOptions(options);
18
- $:
19
- selectedOption = _options.find((opt) => opt.value === value);
20
- function filterOptions(value2) {
21
- const reg = new RegExp(value2, "i");
22
- filteredOptions = _options.filter((opt) => opt.label.match(reg) || opt.value.match(reg)).map((opt) => ({ id: opt.value, ...opt }));
23
- }
24
- export async function clear() {
25
- searchValue = "";
26
- value = "";
27
- filterOptions("");
28
- await tick();
29
- inputElement?.focus();
30
- }
31
- async function select(index = focusIndex) {
32
- value = _options[index].value;
33
- dispatch("input", value);
34
- }
1
+ <script lang="ts">
2
+ import { createEventDispatcher, tick } from 'svelte'
3
+
4
+ import type { InputProps } from './types.js'
5
+ import type { TippyProps } from '../../utils/tippy.js'
6
+ import { type Options, type Option, parseOptions } from '../../utils/options.js'
7
+ import { FormControl, SelectorList } from './index.js'
8
+ import { DropDown } from '../menu/index.js'
9
+ import { Icon } from '../icon/index.js'
10
+
11
+ type $$Props = InputProps & { options: Options; tippyProps?: TippyProps }
12
+ $: ({ input, value: _value, options, tippyProps, ...props } = $$props as $$Props)
13
+ $: ({ class: inputClass, ...inputProps } = input || {})
14
+ export let value = _value
15
+ export let inputElement: HTMLInputElement | undefined = undefined
16
+
17
+ let focusIndex = 0
18
+ let searchValue = ''
19
+
20
+ const dispatch = createEventDispatcher<{ input: string }>()
21
+ let filteredOptions: (Option & { id: string })[] = []
22
+ $: _options = parseOptions(options)
23
+ $: selectedOption = _options.find((opt) => opt.value === value)
24
+
25
+ function filterOptions(value: string) {
26
+ const reg = new RegExp(value, 'i')
27
+ filteredOptions = _options
28
+ .filter((opt) => opt.label.match(reg) || opt.value.match(reg))
29
+ .map((opt) => ({ id: opt.value, ...opt }))
30
+ }
31
+
32
+ export async function clear() {
33
+ searchValue = ''
34
+ value = ''
35
+ filterOptions('')
36
+ await tick()
37
+ inputElement?.focus()
38
+ }
39
+
40
+ async function select(index = focusIndex) {
41
+ value = _options[index].value
42
+ dispatch('input', value)
43
+ }
35
44
  </script>
36
45
 
37
46
  <DropDown {tippyProps}>
38
47
  <div class="contents" slot="activator">
39
- <FormControl {...props} let:key>
40
- <div class="flex grow gap-2" class:hidden={selectedOption}>
41
- <div class="relative flex grow items-center gap-2">
42
- <input
43
- type="text"
44
- id={key}
45
- bind:this={inputElement}
46
- bind:value={searchValue}
47
- on:focus={() => filterOptions('')}
48
- on:blur={() => (searchValue = '')}
49
- on:input={(e) => filterOptions(e.currentTarget.value)}
50
- autocomplete="off"
51
- class="input input-bordered grow {inputClass || {}}"
52
- {...inputProps}
53
- />
48
+ <FormControl {...props}>
49
+ {#snippet children({ key })}
50
+ <div class="flex grow gap-2" class:hidden={selectedOption}>
51
+ <div class="relative flex grow items-center gap-2">
52
+ <input
53
+ type="text"
54
+ id={key}
55
+ bind:this={inputElement}
56
+ bind:value={searchValue}
57
+ on:focus={() => filterOptions('')}
58
+ on:blur={() => (searchValue = '')}
59
+ on:input={(e) => filterOptions(e.currentTarget.value)}
60
+ autocomplete="off"
61
+ class="input input-bordered grow {inputClass || {}}"
62
+ {...inputProps}
63
+ />
64
+ </div>
65
+ <slot name="append" />
54
66
  </div>
55
- <slot name="append" />
56
- </div>
57
67
 
58
- {#if selectedOption}
59
- <button
60
- type="button"
61
- class="flex h-12 items-center gap-2 rounded-lg border pl-4 pr-2"
62
- on:click={clear}
63
- on:focus={clear}
64
- >
65
- {#if selectedOption.icon}
66
- <Icon path={selectedOption.icon} size={21} class="opacity-70" />
67
- {/if}
68
- <span>{selectedOption.label}</span>
69
- </button>
70
- <input type="hidden" name={key} value={selectedOption.value} />
71
- {/if}
68
+ {#if selectedOption}
69
+ <button
70
+ type="button"
71
+ class="flex h-12 items-center gap-2 rounded-lg border pl-4 pr-2"
72
+ on:click={clear}
73
+ on:focus={clear}
74
+ >
75
+ {#if selectedOption.icon}
76
+ <Icon path={selectedOption.icon} size={21} class="opacity-70" />
77
+ {/if}
78
+ <span>{selectedOption.label}</span>
79
+ </button>
80
+ <input type="hidden" name={key} value={selectedOption.value} />
81
+ {/if}
82
+ {/snippet}
72
83
  </FormControl>
73
84
  </div>
74
85
 
@@ -1,43 +1,59 @@
1
- import { SvelteComponent } from "svelte";
2
1
  import type { TippyProps } from '../../utils/tippy.js';
3
2
  import { type Options } from '../../utils/options.js';
4
- declare const __propDef: {
5
- props: {
6
- clear?: (() => Promise<void>) | undefined;
7
- } & {
8
- class?: string | undefined;
9
- classLabel?: string | undefined;
10
- key?: string | undefined;
11
- label?: string | import("svelte").ComponentType | import("../..").ComponentAndProps | undefined;
12
- error?: string | undefined;
13
- hint?: string | undefined;
14
- prefix?: string | number | undefined;
15
- prefixFor?: string | number | undefined;
16
- enhanceDisabled?: boolean | undefined;
17
- labelPosition?: ("top" | "left" | "right") | undefined;
18
- } & {
19
- input?: import("svelte/elements").HTMLInputAttributes | undefined;
20
- inputElement?: HTMLInputElement | undefined;
21
- classWrapper?: string | undefined;
22
- value?: string | null | undefined;
23
- bindWithParams?: boolean | undefined;
24
- } & {
25
- options: Options;
26
- tippyProps?: TippyProps | undefined;
3
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
4
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
5
+ $$bindings?: Bindings;
6
+ } & Exports;
7
+ (internal: unknown, props: Props & {
8
+ $$events?: Events;
9
+ $$slots?: Slots;
10
+ }): Exports & {
11
+ $set?: any;
12
+ $on?: any;
27
13
  };
28
- events: {
29
- input: CustomEvent<string>;
30
- } & {
31
- [evt: string]: CustomEvent<any>;
32
- };
33
- slots: {
34
- append: {};
35
- };
36
- };
37
- export type InputComboProps = typeof __propDef.props;
38
- export type InputComboEvents = typeof __propDef.events;
39
- export type InputComboSlots = typeof __propDef.slots;
40
- export default class InputCombo extends SvelteComponent<InputComboProps, InputComboEvents, InputComboSlots> {
41
- get clear(): () => Promise<void>;
14
+ z_$$bindings?: Bindings;
42
15
  }
43
- export {};
16
+ type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
17
+ default: any;
18
+ } ? Props extends Record<string, never> ? any : {
19
+ children?: any;
20
+ } : {});
21
+ declare const InputCombo: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
22
+ clear?: () => Promise<void>;
23
+ } & {
24
+ class?: string;
25
+ classLabel?: string;
26
+ key?: string;
27
+ label?: import("svelte").Snippet | string;
28
+ labelAppend?: import("svelte").Snippet | null;
29
+ error?: string;
30
+ hint?: string;
31
+ prefix?: string | number;
32
+ prefixFor?: string | number;
33
+ enhanceDisabled?: boolean;
34
+ labelPosition?: "top" | "left" | "right";
35
+ children?: import("svelte").Snippet<[{
36
+ key: string;
37
+ }]> | undefined;
38
+ } & {
39
+ input?: import("svelte/elements").HTMLInputAttributes;
40
+ inputElement?: HTMLInputElement;
41
+ classWrapper?: string;
42
+ value?: string | null | undefined;
43
+ bindWithParams?: boolean;
44
+ } & {
45
+ options: Options;
46
+ tippyProps?: TippyProps;
47
+ }, {
48
+ append: {};
49
+ }>, {
50
+ input: CustomEvent<string>;
51
+ } & {
52
+ [evt: string]: CustomEvent<any>;
53
+ }, {
54
+ append: {};
55
+ }, {
56
+ clear: () => Promise<void>;
57
+ }, string>;
58
+ type InputCombo = InstanceType<typeof InputCombo>;
59
+ export default InputCombo;