fuma 0.0.1

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 (242) hide show
  1. package/README.md +58 -0
  2. package/dist/Meta.svelte +55 -0
  3. package/dist/Meta.svelte.d.ts +20 -0
  4. package/dist/action/index.d.ts +4 -0
  5. package/dist/action/index.js +4 -0
  6. package/dist/action/list/handlers.d.ts +16 -0
  7. package/dist/action/list/handlers.js +92 -0
  8. package/dist/action/list/index.css +40 -0
  9. package/dist/action/list/index.d.ts +23 -0
  10. package/dist/action/list/index.js +44 -0
  11. package/dist/action/list/store.d.ts +3 -0
  12. package/dist/action/list/store.js +1 -0
  13. package/dist/action/list/style.d.ts +2 -0
  14. package/dist/action/list/style.js +14 -0
  15. package/dist/action/list/trigger.d.ts +12 -0
  16. package/dist/action/list/trigger.js +124 -0
  17. package/dist/action/list/utils.d.ts +18 -0
  18. package/dist/action/list/utils.js +68 -0
  19. package/dist/action/portal.d.ts +3 -0
  20. package/dist/action/portal.js +9 -0
  21. package/dist/action/selector.d.ts +15 -0
  22. package/dist/action/selector.js +71 -0
  23. package/dist/action/tip.d.ts +6 -0
  24. package/dist/action/tip.js +12 -0
  25. package/dist/index.d.ts +3 -0
  26. package/dist/index.js +3 -0
  27. package/dist/server/index.d.ts +5 -0
  28. package/dist/server/index.js +5 -0
  29. package/dist/server/json.d.ts +1 -0
  30. package/dist/server/json.js +16 -0
  31. package/dist/server/parseFormData.d.ts +20 -0
  32. package/dist/server/parseFormData.js +63 -0
  33. package/dist/server/parseQuery.d.ts +11 -0
  34. package/dist/server/parseQuery.js +15 -0
  35. package/dist/server/sse.d.ts +6 -0
  36. package/dist/server/sse.js +35 -0
  37. package/dist/server/try.d.ts +6 -0
  38. package/dist/server/try.js +31 -0
  39. package/dist/store/index.d.ts +2 -0
  40. package/dist/store/index.js +2 -0
  41. package/dist/store/isSmallScreen.d.ts +2 -0
  42. package/dist/store/isSmallScreen.js +14 -0
  43. package/dist/store/param.d.ts +24 -0
  44. package/dist/store/param.js +61 -0
  45. package/dist/store/session.d.ts +2 -0
  46. package/dist/store/session.js +13 -0
  47. package/dist/ui/ButtonCopy.svelte +18 -0
  48. package/dist/ui/ButtonCopy.svelte.d.ts +18 -0
  49. package/dist/ui/ButtonDelete.svelte +43 -0
  50. package/dist/ui/ButtonDelete.svelte.d.ts +22 -0
  51. package/dist/ui/Dialog.svelte +58 -0
  52. package/dist/ui/Dialog.svelte.d.ts +25 -0
  53. package/dist/ui/DialogConfirm.svelte +22 -0
  54. package/dist/ui/DialogConfirm.svelte.d.ts +21 -0
  55. package/dist/ui/Icon.svelte +46 -0
  56. package/dist/ui/Icon.svelte.d.ts +24 -0
  57. package/dist/ui/Pagination.svelte +28 -0
  58. package/dist/ui/Pagination.svelte.d.ts +16 -0
  59. package/dist/ui/Placeholder.svelte +11 -0
  60. package/dist/ui/Placeholder.svelte.d.ts +19 -0
  61. package/dist/ui/PlaceholderImage.svelte +14 -0
  62. package/dist/ui/PlaceholderImage.svelte.d.ts +19 -0
  63. package/dist/ui/card/Card.svelte +38 -0
  64. package/dist/ui/card/Card.svelte.d.ts +26 -0
  65. package/dist/ui/card/CardBasic.svelte +14 -0
  66. package/dist/ui/card/CardBasic.svelte.d.ts +20 -0
  67. package/dist/ui/card/CardCollapse.svelte +61 -0
  68. package/dist/ui/card/CardCollapse.svelte.d.ts +22 -0
  69. package/dist/ui/card/CardFullScreen.svelte +28 -0
  70. package/dist/ui/card/CardFullScreen.svelte.d.ts +23 -0
  71. package/dist/ui/card/CardLink.svelte +21 -0
  72. package/dist/ui/card/CardLink.svelte.d.ts +20 -0
  73. package/dist/ui/card/index.d.ts +5 -0
  74. package/dist/ui/card/index.js +5 -0
  75. package/dist/ui/index.d.ts +14 -0
  76. package/dist/ui/index.js +14 -0
  77. package/dist/ui/input/FormControl.svelte +53 -0
  78. package/dist/ui/input/FormControl.svelte.d.ts +30 -0
  79. package/dist/ui/input/InputBoolean.svelte +29 -0
  80. package/dist/ui/input/InputBoolean.svelte.d.ts +21 -0
  81. package/dist/ui/input/InputCheckboxs.svelte +68 -0
  82. package/dist/ui/input/InputCheckboxs.svelte.d.ts +41 -0
  83. package/dist/ui/input/InputCheckboxsMenu.svelte +93 -0
  84. package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +43 -0
  85. package/dist/ui/input/InputCheckboxsTree.svelte +15 -0
  86. package/dist/ui/input/InputCheckboxsTree.svelte.d.ts +21 -0
  87. package/dist/ui/input/InputCheckboxsTreeNodes.svelte +60 -0
  88. package/dist/ui/input/InputCheckboxsTreeNodes.svelte.d.ts +23 -0
  89. package/dist/ui/input/InputDate.svelte +26 -0
  90. package/dist/ui/input/InputDate.svelte.d.ts +19 -0
  91. package/dist/ui/input/InputDatetime.svelte +21 -0
  92. package/dist/ui/input/InputDatetime.svelte.d.ts +19 -0
  93. package/dist/ui/input/InputImage.svelte +107 -0
  94. package/dist/ui/input/InputImage.svelte.d.ts +35 -0
  95. package/dist/ui/input/InputImagePreview.svelte +56 -0
  96. package/dist/ui/input/InputImagePreview.svelte.d.ts +23 -0
  97. package/dist/ui/input/InputNumber.svelte +22 -0
  98. package/dist/ui/input/InputNumber.svelte.d.ts +23 -0
  99. package/dist/ui/input/InputOptionInParam.svelte +34 -0
  100. package/dist/ui/input/InputOptionInParam.svelte.d.ts +20 -0
  101. package/dist/ui/input/InputOptions.svelte +79 -0
  102. package/dist/ui/input/InputOptions.svelte.d.ts +17 -0
  103. package/dist/ui/input/InputPassword.svelte +21 -0
  104. package/dist/ui/input/InputPassword.svelte.d.ts +36 -0
  105. package/dist/ui/input/InputRadio.svelte +79 -0
  106. package/dist/ui/input/InputRadio.svelte.d.ts +40 -0
  107. package/dist/ui/input/InputRelation.svelte +114 -0
  108. package/dist/ui/input/InputRelation.svelte.d.ts +52 -0
  109. package/dist/ui/input/InputRelations.svelte +138 -0
  110. package/dist/ui/input/InputRelations.svelte.d.ts +49 -0
  111. package/dist/ui/input/InputSearch.svelte +43 -0
  112. package/dist/ui/input/InputSearch.svelte.d.ts +23 -0
  113. package/dist/ui/input/InputSelect.svelte +59 -0
  114. package/dist/ui/input/InputSelect.svelte.d.ts +26 -0
  115. package/dist/ui/input/InputText.svelte +32 -0
  116. package/dist/ui/input/InputText.svelte.d.ts +31 -0
  117. package/dist/ui/input/InputTextarea.svelte +20 -0
  118. package/dist/ui/input/InputTextarea.svelte.d.ts +23 -0
  119. package/dist/ui/input/InputTime.svelte +19 -0
  120. package/dist/ui/input/InputTime.svelte.d.ts +19 -0
  121. package/dist/ui/input/RelationAfter.svelte +42 -0
  122. package/dist/ui/input/RelationAfter.svelte.d.ts +22 -0
  123. package/dist/ui/input/SelectorList.svelte +46 -0
  124. package/dist/ui/input/SelectorList.svelte.d.ts +40 -0
  125. package/dist/ui/input/action.d.ts +13 -0
  126. package/dist/ui/input/action.js +56 -0
  127. package/dist/ui/input/index.d.ts +25 -0
  128. package/dist/ui/input/index.js +25 -0
  129. package/dist/ui/input/textRich/InputTextRich.svelte +58 -0
  130. package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +20 -0
  131. package/dist/ui/input/textRich/SuggesionList.svelte +21 -0
  132. package/dist/ui/input/textRich/SuggesionList.svelte.d.ts +19 -0
  133. package/dist/ui/input/textRich/ToolMark.svelte +19 -0
  134. package/dist/ui/input/textRich/ToolMark.svelte.d.ts +21 -0
  135. package/dist/ui/input/textRich/ToolMarkColor.svelte +32 -0
  136. package/dist/ui/input/textRich/ToolMarkColor.svelte.d.ts +19 -0
  137. package/dist/ui/input/textRich/ToolMarkLink.svelte +63 -0
  138. package/dist/ui/input/textRich/ToolMarkLink.svelte.d.ts +17 -0
  139. package/dist/ui/input/textRich/ToolMenu.svelte +50 -0
  140. package/dist/ui/input/textRich/ToolMenu.svelte.d.ts +29 -0
  141. package/dist/ui/input/textRich/ToolMenuAlign.svelte +46 -0
  142. package/dist/ui/input/textRich/ToolMenuAlign.svelte.d.ts +17 -0
  143. package/dist/ui/input/textRich/ToolMenuInsert.svelte +49 -0
  144. package/dist/ui/input/textRich/ToolMenuInsert.svelte.d.ts +19 -0
  145. package/dist/ui/input/textRich/ToolMenuNode.svelte +56 -0
  146. package/dist/ui/input/textRich/ToolMenuNode.svelte.d.ts +17 -0
  147. package/dist/ui/input/textRich/ToolsBar.svelte +60 -0
  148. package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +18 -0
  149. package/dist/ui/input/textRich/extensions.d.ts +2 -0
  150. package/dist/ui/input/textRich/extensions.js +62 -0
  151. package/dist/ui/input/textRich/indent.d.ts +13 -0
  152. package/dist/ui/input/textRich/indent.js +112 -0
  153. package/dist/ui/input/textRich/suggestion.d.ts +9 -0
  154. package/dist/ui/input/textRich/suggestion.js +56 -0
  155. package/dist/ui/input/types.d.ts +15 -0
  156. package/dist/ui/input/types.js +1 -0
  157. package/dist/ui/menu/ContextMenu.svelte +47 -0
  158. package/dist/ui/menu/ContextMenu.svelte.d.ts +28 -0
  159. package/dist/ui/menu/DropDown.svelte +110 -0
  160. package/dist/ui/menu/DropDown.svelte.d.ts +38 -0
  161. package/dist/ui/menu/dropdown.css +33 -0
  162. package/dist/ui/menu/index.d.ts +2 -0
  163. package/dist/ui/menu/index.js +2 -0
  164. package/dist/ui/period/PeriodPicker.svelte +53 -0
  165. package/dist/ui/period/PeriodPicker.svelte.d.ts +22 -0
  166. package/dist/ui/period/PeriodPickerButton.svelte +73 -0
  167. package/dist/ui/period/PeriodPickerButton.svelte.d.ts +14 -0
  168. package/dist/ui/period/index.d.ts +6 -0
  169. package/dist/ui/period/index.js +2 -0
  170. package/dist/ui/table/Table.svelte +42 -0
  171. package/dist/ui/table/Table.svelte.d.ts +39 -0
  172. package/dist/ui/table/TableBody.svelte +29 -0
  173. package/dist/ui/table/TableBody.svelte.d.ts +33 -0
  174. package/dist/ui/table/TableCell.svelte +27 -0
  175. package/dist/ui/table/TableCell.svelte.d.ts +28 -0
  176. package/dist/ui/table/TableFieldsEdition.svelte +122 -0
  177. package/dist/ui/table/TableFieldsEdition.svelte.d.ts +31 -0
  178. package/dist/ui/table/TableHead.svelte +31 -0
  179. package/dist/ui/table/TableHead.svelte.d.ts +29 -0
  180. package/dist/ui/table/TableViewSelect.svelte +127 -0
  181. package/dist/ui/table/TableViewSelect.svelte.d.ts +24 -0
  182. package/dist/ui/table/cell/TableCellArray.svelte +10 -0
  183. package/dist/ui/table/cell/TableCellArray.svelte.d.ts +16 -0
  184. package/dist/ui/table/cell/TableCellBoolean.svelte +12 -0
  185. package/dist/ui/table/cell/TableCellBoolean.svelte.d.ts +16 -0
  186. package/dist/ui/table/cell/TableCellNumber.svelte +6 -0
  187. package/dist/ui/table/cell/TableCellNumber.svelte.d.ts +16 -0
  188. package/dist/ui/table/cell/TableCellString.svelte +7 -0
  189. package/dist/ui/table/cell/TableCellString.svelte.d.ts +18 -0
  190. package/dist/ui/table/cell/index.d.ts +4 -0
  191. package/dist/ui/table/cell/index.js +4 -0
  192. package/dist/ui/table/context.d.ts +14 -0
  193. package/dist/ui/table/context.js +10 -0
  194. package/dist/ui/table/field.d.ts +79 -0
  195. package/dist/ui/table/field.js +29 -0
  196. package/dist/ui/table/head/TableHeadBoolean.svelte +12 -0
  197. package/dist/ui/table/head/TableHeadBoolean.svelte.d.ts +17 -0
  198. package/dist/ui/table/head/TableHeadDate.svelte +100 -0
  199. package/dist/ui/table/head/TableHeadDate.svelte.d.ts +17 -0
  200. package/dist/ui/table/head/TableHeadDefault.svelte +7 -0
  201. package/dist/ui/table/head/TableHeadDefault.svelte.d.ts +17 -0
  202. package/dist/ui/table/head/TableHeadNumber.svelte +80 -0
  203. package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +17 -0
  204. package/dist/ui/table/head/TableHeadSelect.svelte +75 -0
  205. package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +20 -0
  206. package/dist/ui/table/head/TableHeadString.svelte +35 -0
  207. package/dist/ui/table/head/TableHeadString.svelte.d.ts +17 -0
  208. package/dist/ui/table/head/index.d.ts +19 -0
  209. package/dist/ui/table/head/index.js +22 -0
  210. package/dist/ui/table/index.d.ts +10 -0
  211. package/dist/ui/table/index.js +10 -0
  212. package/dist/ui/table/server.d.ts +1 -0
  213. package/dist/ui/table/server.js +32 -0
  214. package/dist/ui/tabs/Tabs.svelte +28 -0
  215. package/dist/ui/tabs/Tabs.svelte.d.ts +18 -0
  216. package/dist/ui/tabs/TabsIcon.svelte +56 -0
  217. package/dist/ui/tabs/TabsIcon.svelte.d.ts +20 -0
  218. package/dist/ui/tabs/index.d.ts +8 -0
  219. package/dist/ui/tabs/index.js +2 -0
  220. package/dist/utils/avatar.d.ts +1 -0
  221. package/dist/utils/avatar.js +5 -0
  222. package/dist/utils/component.d.ts +7 -0
  223. package/dist/utils/component.js +3 -0
  224. package/dist/utils/formatRange.d.ts +8 -0
  225. package/dist/utils/formatRange.js +25 -0
  226. package/dist/utils/index.d.ts +7 -0
  227. package/dist/utils/index.js +7 -0
  228. package/dist/utils/jsonParse.d.ts +1 -0
  229. package/dist/utils/jsonParse.js +10 -0
  230. package/dist/utils/normalizePath.d.ts +1 -0
  231. package/dist/utils/normalizePath.js +11 -0
  232. package/dist/utils/options.d.ts +7 -0
  233. package/dist/utils/options.js +20 -0
  234. package/dist/utils/tippy.d.ts +5 -0
  235. package/dist/utils/tippy.js +4 -0
  236. package/dist/validation/form.d.ts +31 -0
  237. package/dist/validation/form.js +94 -0
  238. package/dist/validation/index.d.ts +2 -0
  239. package/dist/validation/index.js +2 -0
  240. package/dist/validation/zod.d.ts +338 -0
  241. package/dist/validation/zod.js +100 -0
  242. package/package.json +86 -0
@@ -0,0 +1,33 @@
1
+ .tippy-box[data-theme~='dropdown'] {
2
+ background: none;
3
+ color: initial;
4
+ }
5
+
6
+ .tippy-box[data-theme~='dropdown'] > .tippy-content {
7
+ padding: 0;
8
+ }
9
+
10
+ .tippy-box[data-theme~='dropdown'] > .tippy-arrow {
11
+ color: #e5e7eb;
12
+ }
13
+
14
+ .tippy-box[data-theme~='dropdown-border'] {
15
+ background: #fff;
16
+ color: initial;
17
+ border-width: 1px;
18
+ padding: 0.25rem;
19
+ border-radius: 0.5rem;
20
+ --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
21
+ --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color),
22
+ 0 4px 6px -4px var(--tw-shadow-color);
23
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000),
24
+ var(--tw-shadow);
25
+ }
26
+
27
+ .tippy-box[data-theme~='dropdown-border'] > .tippy-content {
28
+ padding: 0;
29
+ }
30
+
31
+ .tippy-box[data-theme~='dropdown-border'] > .tippy-arrow {
32
+ color: #e5e7eb;
33
+ }
@@ -0,0 +1,2 @@
1
+ export { default as DropDown } from './DropDown.svelte';
2
+ export { default as ContextMenu } from './ContextMenu.svelte';
@@ -0,0 +1,2 @@
1
+ export { default as DropDown } from './DropDown.svelte';
2
+ export { default as ContextMenu } from './ContextMenu.svelte';
@@ -0,0 +1,53 @@
1
+ <script>import { onMount, onDestroy, createEventDispatcher } from "svelte";
2
+ import dayjs from "dayjs";
3
+ export let numberOfMonths = 3;
4
+ export let numberOfColumns = numberOfMonths;
5
+ export let showWeekNumbers = true;
6
+ export let period = void 0;
7
+ let startElement;
8
+ let endElement;
9
+ let picker;
10
+ let parentEl;
11
+ const dispatch = createEventDispatcher();
12
+ onMount(() => {
13
+ initTimePicker();
14
+ });
15
+ onDestroy(() => {
16
+ picker?.destroy();
17
+ });
18
+ async function initTimePicker() {
19
+ const _Litepicker = (await import("litepicker")).Litepicker;
20
+ picker?.destroy();
21
+ picker = new _Litepicker({
22
+ element: startElement,
23
+ elementEnd: endElement,
24
+ // Nécéssaire pour traquer le theme
25
+ parentEl,
26
+ inlineMode: true,
27
+ singleMode: false,
28
+ allowRepick: false,
29
+ lang: navigator.language,
30
+ numberOfMonths,
31
+ numberOfColumns,
32
+ showWeekNumbers,
33
+ startDate: period?.start ? new Date(period.start) : "",
34
+ endDate: period?.end ? new Date(period.end) : "",
35
+ setup: (picker2) => {
36
+ picker2.on("selected", (date1, date2) => {
37
+ const start = dayjs(date1.dateInstance).format("YYYY-MM-DD");
38
+ const end = dayjs(date2.dateInstance).format("YYYY-MM-DD");
39
+ period = {
40
+ start,
41
+ end
42
+ };
43
+ dispatch("change", period);
44
+ });
45
+ }
46
+ });
47
+ }
48
+ </script>
49
+
50
+ <input type="hidden" bind:this={startElement} />
51
+ <input type="hidden" bind:this={endElement} />
52
+
53
+ <div bind:this={parentEl} />
@@ -0,0 +1,22 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { Period } from './index.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ numberOfMonths?: number | undefined;
6
+ numberOfColumns?: number | undefined;
7
+ showWeekNumbers?: boolean | undefined;
8
+ period?: Period | undefined;
9
+ };
10
+ events: {
11
+ change: CustomEvent<Period>;
12
+ } & {
13
+ [evt: string]: CustomEvent<any>;
14
+ };
15
+ slots: {};
16
+ };
17
+ export type PeriodPickerProps = typeof __propDef.props;
18
+ export type PeriodPickerEvents = typeof __propDef.events;
19
+ export type PeriodPickerSlots = typeof __propDef.slots;
20
+ export default class PeriodPicker extends SvelteComponent<PeriodPickerProps, PeriodPickerEvents, PeriodPickerSlots> {
21
+ }
22
+ export {};
@@ -0,0 +1,73 @@
1
+ <script>import { mdiCalendarMonthOutline, mdiClose } from "@mdi/js";
2
+ import { goto } from "$app/navigation";
3
+ import { page } from "$app/stores";
4
+ import { Icon, DropDown, InputTime, PeriodPicker } from "../index.js";
5
+ import { formatRange } from "../../utils/formatRange.js";
6
+ import { urlParam } from "../../store/param.js";
7
+ let dropDown;
8
+ const start = $page.url.searchParams.get("start")?.split("T") || [];
9
+ const end = $page.url.searchParams.get("end")?.split("T") || [];
10
+ let period = {
11
+ start: start[0] || "",
12
+ end: end[0] || ""
13
+ };
14
+ let time = {
15
+ start: start[1] || "00:00",
16
+ end: end[1] || "23:59"
17
+ };
18
+ $:
19
+ isValidPeriod = period.start && period.end && time.start && time.start;
20
+ function getLabel(_period, _time) {
21
+ if (!_period || !_period.start || !_period.end)
22
+ return "P\xE9riodes";
23
+ return formatRange({
24
+ start: /* @__PURE__ */ new Date(`${_period.start}T${_time.start}`),
25
+ end: /* @__PURE__ */ new Date(`${_period.end}T${_time.end}`)
26
+ });
27
+ }
28
+ function handleSubmit() {
29
+ dropDown.hide();
30
+ if (!isValidPeriod)
31
+ return;
32
+ goto(
33
+ $urlParam.with({
34
+ start: `${period.start}T${time.start || "00:00"}`,
35
+ end: `${period.end}T${time.end || "23:59"}`
36
+ }),
37
+ { replaceState: true, noScroll: true }
38
+ );
39
+ }
40
+ function handleReset() {
41
+ dropDown.hide();
42
+ period = { start: "", end: "" };
43
+ time = { start: "00:00", end: "23:59" };
44
+ goto($urlParam.without("start", "end"), { replaceState: true, noScroll: true });
45
+ }
46
+ </script>
47
+
48
+ <DropDown bind:this={dropDown} on:mouseLeave={handleSubmit} class="max-h-full">
49
+ <div slot="activator" class="join">
50
+ <button class="btn join-item btn-sm shrink flex-nowrap">
51
+ <Icon path={mdiCalendarMonthOutline} class="opacity-60" size={20} />
52
+ {getLabel(period, time)}
53
+ </button>
54
+ {#if isValidPeriod}
55
+ <button class="btn btn-square join-item btn-sm" on:click|preventDefault={handleReset}>
56
+ <Icon path={mdiClose} class="fill-base-content" />
57
+ </button>
58
+ {/if}
59
+ </div>
60
+
61
+ <form class="flex flex-col" on:submit|preventDefault={handleSubmit} data-sveltekit-replacestate>
62
+ <PeriodPicker numberOfMonths={1} bind:period />
63
+
64
+ <input class="hidden" type="text" name="start" value="{period.start}T{time.start || '00:00'}" />
65
+ <input class="hidden" type="text" name="end" value="{period.end}T{time.end || '23:59'}" />
66
+
67
+ <div class="flex gap-2 p-2">
68
+ <InputTime label="A partir de" bind:value={time.start} enhanceDisabled class="grow" />
69
+ <InputTime label="Jusqu'à" bind:value={time.end} enhanceDisabled class="grow" />
70
+ </div>
71
+ <button class="btn m-2"> Valider </button>
72
+ </form>
73
+ </DropDown>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type PeriodPickerButtonProps = typeof __propDef.props;
10
+ export type PeriodPickerButtonEvents = typeof __propDef.events;
11
+ export type PeriodPickerButtonSlots = typeof __propDef.slots;
12
+ export default class PeriodPickerButton extends SvelteComponent<PeriodPickerButtonProps, PeriodPickerButtonEvents, PeriodPickerButtonSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,6 @@
1
+ export type Period = {
2
+ start: string;
3
+ end: string;
4
+ };
5
+ export { default as PeriodPicker } from './PeriodPicker.svelte';
6
+ export { default as PeriodPickerButton } from './PeriodPickerButton.svelte';
@@ -0,0 +1,2 @@
1
+ export { default as PeriodPicker } from './PeriodPicker.svelte';
2
+ export { default as PeriodPickerButton } from './PeriodPickerButton.svelte';
@@ -0,0 +1,42 @@
1
+ <script>import { afterNavigate } from "$app/navigation";
2
+ import { Placeholder } from "../index.js";
3
+ import {
4
+ TableHead,
5
+ TableBody,
6
+ context,
7
+ createKeys,
8
+ syncFieldsWithParams
9
+ } from "./index.js";
10
+ export let key = "table";
11
+ export let fields;
12
+ export let items;
13
+ export let action = void 0;
14
+ export let placholder = "Aucun \xE9l\xE9ment trouv\xE9";
15
+ export let classRow = "";
16
+ export let hideBody = false;
17
+ export let onCreateField = void 0;
18
+ const { KEY_FIELDS_VISIBLE, KEY_FIELDS_HIDDEN, KEY_FIELDS_ORDER } = createKeys(key);
19
+ context.set(key, {
20
+ KEY_FIELDS_VISIBLE,
21
+ KEY_FIELDS_HIDDEN,
22
+ KEY_FIELDS_ORDER
23
+ });
24
+ const initFields = () => fields = syncFieldsWithParams(key, fields);
25
+ initFields();
26
+ afterNavigate(initFields);
27
+ </script>
28
+
29
+ <div class="overflow-x-auto rounded-lg border bg-base-100" class:min-h-[320px]={!hideBody}>
30
+ <table class="table relative">
31
+ <TableHead {fields} {key} {onCreateField} />
32
+ {#if !hideBody && items.length}
33
+ <TableBody {fields} {items} {action} {classRow} on:click />
34
+ {/if}
35
+ </table>
36
+
37
+ {#if hideBody && !items.length}
38
+ <Placeholder class="rounded-t-none">
39
+ {placholder}
40
+ </Placeholder>
41
+ {/if}
42
+ </div>
@@ -0,0 +1,39 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { ComponentAndProps } from '../../utils/component.js';
3
+ import { type TableField } from './index.js';
4
+ declare class __sveltets_Render<Item extends {
5
+ id: string;
6
+ }> {
7
+ props(): {
8
+ key?: string | undefined;
9
+ fields: TableField<Item>[];
10
+ items: Item[];
11
+ action?: ((item: Item) => ComponentAndProps) | undefined;
12
+ placholder?: string | undefined;
13
+ classRow?: string | undefined;
14
+ hideBody?: boolean | undefined;
15
+ onCreateField?: (() => void) | undefined;
16
+ };
17
+ events(): {
18
+ click: CustomEvent<{
19
+ id: string;
20
+ }>;
21
+ } & {
22
+ [evt: string]: CustomEvent<any>;
23
+ };
24
+ slots(): {};
25
+ }
26
+ export type TableProps<Item extends {
27
+ id: string;
28
+ }> = ReturnType<__sveltets_Render<Item>['props']>;
29
+ export type TableEvents<Item extends {
30
+ id: string;
31
+ }> = ReturnType<__sveltets_Render<Item>['events']>;
32
+ export type TableSlots<Item extends {
33
+ id: string;
34
+ }> = ReturnType<__sveltets_Render<Item>['slots']>;
35
+ export default class Table<Item extends {
36
+ id: string;
37
+ }> extends SvelteComponent<TableProps<Item>, TableEvents<Item>, TableSlots<Item>> {
38
+ }
39
+ export {};
@@ -0,0 +1,29 @@
1
+ <script>import { createEventDispatcher } from "svelte";
2
+ import { TableCell } from "../index.js";
3
+ export let items;
4
+ export let fields;
5
+ export let action = void 0;
6
+ export let classRow = "";
7
+ const dispatch = createEventDispatcher();
8
+ $:
9
+ _fields = fields.filter((f) => f.$visible);
10
+ function handleClickRow(event, item) {
11
+ dispatch("click", item);
12
+ }
13
+ </script>
14
+
15
+ <tbody>
16
+ {#each items as item (item.id)}
17
+ <tr class={classRow} on:click={(event) => handleClickRow(event, item)}>
18
+ {#each _fields as field (field.key)}
19
+ <TableCell {item} {field} />
20
+ {/each}
21
+ <td align="right">
22
+ {#if action}
23
+ {@const { component, props } = action(item)}
24
+ <svelte:component this={component} {...props} />
25
+ {/if}
26
+ </td>
27
+ </tr>
28
+ {/each}
29
+ </tbody>
@@ -0,0 +1,33 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type TableField } from '../index.js';
3
+ import type { ComponentAndProps } from '../../utils/component.js';
4
+ declare class __sveltets_Render<Item extends {
5
+ id: string;
6
+ }> {
7
+ props(): {
8
+ items: Item[];
9
+ fields: TableField<Item>[];
10
+ action?: ((item: Item) => ComponentAndProps) | undefined;
11
+ classRow?: string | undefined;
12
+ };
13
+ events(): {
14
+ click: CustomEvent<Item>;
15
+ } & {
16
+ [evt: string]: CustomEvent<any>;
17
+ };
18
+ slots(): {};
19
+ }
20
+ export type TableBodyProps<Item extends {
21
+ id: string;
22
+ }> = ReturnType<__sveltets_Render<Item>['props']>;
23
+ export type TableBodyEvents<Item extends {
24
+ id: string;
25
+ }> = ReturnType<__sveltets_Render<Item>['events']>;
26
+ export type TableBodySlots<Item extends {
27
+ id: string;
28
+ }> = ReturnType<__sveltets_Render<Item>['slots']>;
29
+ export default class TableBody<Item extends {
30
+ id: string;
31
+ }> extends SvelteComponent<TableBodyProps<Item>, TableBodyEvents<Item>, TableBodySlots<Item>> {
32
+ }
33
+ export {};
@@ -0,0 +1,27 @@
1
+ <script>import {
2
+ TableCellArray,
3
+ TableCellBoolean,
4
+ TableCellNumber,
5
+ TableCellString
6
+ } from "./cell/index.js";
7
+ export let item;
8
+ export let field;
9
+ $:
10
+ value = field.getCell(item);
11
+ </script>
12
+
13
+ {#if Array.isArray(value)}
14
+ <TableCellArray {value} />
15
+ {:else if typeof value === 'number'}
16
+ <TableCellNumber {value} />
17
+ {:else if typeof value === 'boolean'}
18
+ <TableCellBoolean {value} />
19
+ {:else if typeof value === 'string'}
20
+ <TableCellString {value} {field} />
21
+ {:else if value === undefined}
22
+ <td>-</td>
23
+ {:else}
24
+ <td>
25
+ <svelte:component this={value.component} {...value.props} />
26
+ </td>
27
+ {/if}
@@ -0,0 +1,28 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { TableField } from './index.js';
3
+ declare class __sveltets_Render<Item extends {
4
+ id: string;
5
+ }> {
6
+ props(): {
7
+ item: Item;
8
+ field: TableField<Item>;
9
+ };
10
+ events(): {} & {
11
+ [evt: string]: CustomEvent<any>;
12
+ };
13
+ slots(): {};
14
+ }
15
+ export type TableCellProps<Item extends {
16
+ id: string;
17
+ }> = ReturnType<__sveltets_Render<Item>['props']>;
18
+ export type TableCellEvents<Item extends {
19
+ id: string;
20
+ }> = ReturnType<__sveltets_Render<Item>['events']>;
21
+ export type TableCellSlots<Item extends {
22
+ id: string;
23
+ }> = ReturnType<__sveltets_Render<Item>['slots']>;
24
+ export default class TableCell<Item extends {
25
+ id: string;
26
+ }> extends SvelteComponent<TableCellProps<Item>, TableCellEvents<Item>, TableCellSlots<Item>> {
27
+ }
28
+ export {};
@@ -0,0 +1,122 @@
1
+ <script>import {
2
+ mdiCheck,
3
+ mdiCheckCircleOutline,
4
+ mdiCircleSmall,
5
+ mdiDotsHorizontal,
6
+ mdiDrag,
7
+ mdiPlus
8
+ } from "@mdi/js";
9
+ import { goto } from "$app/navigation";
10
+ import { page } from "$app/stores";
11
+ import { urlParam } from "../../store/param.js";
12
+ import { listEditable } from "../../action/list/index.js";
13
+ import { jsonParse } from "../../utils/jsonParse.js";
14
+ import { Icon, DropDown } from "../index.js";
15
+ import { context } from "./context.js";
16
+ export let fields;
17
+ export let key;
18
+ export let onCreateField = void 0;
19
+ let tip;
20
+ const { KEY_FIELDS_VISIBLE, KEY_FIELDS_HIDDEN, KEY_FIELDS_ORDER } = context.get(key);
21
+ function getFieldHref(field) {
22
+ if (field.locked)
23
+ return;
24
+ const url = toggleParam(field.visible ? KEY_FIELDS_HIDDEN : KEY_FIELDS_VISIBLE, field.key);
25
+ if (url.searchParams.has(field.key)) {
26
+ url.searchParams.delete(field.key);
27
+ url.searchParams.delete("skip");
28
+ url.searchParams.delete("take");
29
+ }
30
+ return url.pathname + url.search;
31
+ }
32
+ function toggleParam(paramKey, fieldKey) {
33
+ const url = new URL($page.url);
34
+ const fieldsKeys = jsonParse($page.url.searchParams.get(paramKey), []);
35
+ if (!fieldsKeys.includes(fieldKey))
36
+ fieldsKeys.push(fieldKey);
37
+ else
38
+ fieldsKeys.splice(fieldsKeys.indexOf(fieldKey), 1);
39
+ if (fieldsKeys.length)
40
+ url.searchParams.set(paramKey, JSON.stringify(fieldsKeys));
41
+ else
42
+ url.searchParams.delete(paramKey);
43
+ return url;
44
+ }
45
+ function handleReorder(newFieldsOrder) {
46
+ fields = newFieldsOrder;
47
+ const fieldsOrder = fields.map((f) => f.key);
48
+ const newUrl = $urlParam.with({ [KEY_FIELDS_ORDER]: JSON.stringify(fieldsOrder) });
49
+ goto(newUrl, { replaceState: true, noScroll: true, keepFocus: true });
50
+ }
51
+ </script>
52
+
53
+ <th class="sticky right-0 z-10 p-0 px-1" align="right">
54
+ <DropDown
55
+ bind:tip
56
+ hideOnNav={false}
57
+ class="max-h-none px-0"
58
+ tippyProps={{ appendTo: () => document.body, placement: 'bottom-end' }}
59
+ >
60
+ <button slot="activator" type="button" class="btn btn-square btn-ghost btn-sm backdrop-blur">
61
+ <Icon path={mdiDotsHorizontal} title="Définir les champs" />
62
+ </button>
63
+
64
+ {#if onCreateField}
65
+ <div class="bordered flex items-center gap-2 border-b pb-1 pl-2 pr-1">
66
+ <span class=" font-semibold opacity-70">Champs</span>
67
+ <button
68
+ type="button"
69
+ class="btn btn-square btn-sm ml-auto"
70
+ on:click={() => {
71
+ if (onCreateField) onCreateField()
72
+ tip.hide()
73
+ }}
74
+ >
75
+ <Icon path={mdiPlus} title="Ajouter un champ" />
76
+ </button>
77
+ </div>
78
+ {/if}
79
+
80
+ <div class="max-h-[500px] overflow-auto px-1 pt-1">
81
+ <div
82
+ use:listEditable={{
83
+ items: fields,
84
+ onChange: handleReorder,
85
+ dragElementsSelector: '.drag-button'
86
+ }}
87
+ >
88
+ {#each fields as field (field.key)}
89
+ <a
90
+ draggable="false"
91
+ href={getFieldHref(field)}
92
+ class="menu-item w-full"
93
+ class:disabled={field.locked}
94
+ data-sveltekit-keepfocus
95
+ data-sveltekit-replacestate
96
+ data-sveltekit-noscroll
97
+ >
98
+ {#if field.locked}
99
+ <Icon path={mdiCheck} class="fill-base-content/50" size={21} />
100
+ {:else if $urlParam.has(field.key)}
101
+ <Icon path={mdiCheckCircleOutline} class="fill-primary" size={21} />
102
+ {:else if field.$visible}
103
+ <Icon path={mdiCheck} class="fill-success" size={21} />
104
+ {:else}
105
+ <Icon path={mdiCircleSmall} class="fill-base-content/50" size={21} />
106
+ {/if}
107
+
108
+ <span>{field.label}</span>
109
+
110
+ <span
111
+ class="drag-button btn btn-square btn-ghost btn-xs ml-auto"
112
+ on:click|preventDefault
113
+ role="none"
114
+ >
115
+ <Icon path={mdiDrag} size={18} class="fill-base-content/80" />
116
+ </span>
117
+ </a>
118
+ {/each}
119
+ </div>
120
+ </div>
121
+ </DropDown>
122
+ </th>
@@ -0,0 +1,31 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type TableField } from '../index.js';
3
+ declare class __sveltets_Render<Item extends {
4
+ id: string;
5
+ }> {
6
+ props(): {
7
+ fields: TableField<Item>[];
8
+ key: string;
9
+ onCreateField?: (() => void) | undefined;
10
+ };
11
+ events(): {
12
+ click: MouseEvent;
13
+ } & {
14
+ [evt: string]: CustomEvent<any>;
15
+ };
16
+ slots(): {};
17
+ }
18
+ export type TableFieldsEditionProps<Item extends {
19
+ id: string;
20
+ }> = ReturnType<__sveltets_Render<Item>['props']>;
21
+ export type TableFieldsEditionEvents<Item extends {
22
+ id: string;
23
+ }> = ReturnType<__sveltets_Render<Item>['events']>;
24
+ export type TableFieldsEditionSlots<Item extends {
25
+ id: string;
26
+ }> = ReturnType<__sveltets_Render<Item>['slots']>;
27
+ export default class TableFieldsEdition<Item extends {
28
+ id: string;
29
+ }> extends SvelteComponent<TableFieldsEditionProps<Item>, TableFieldsEditionEvents<Item>, TableFieldsEditionSlots<Item>> {
30
+ }
31
+ export {};
@@ -0,0 +1,31 @@
1
+ <script>import { component } from "../../utils/component.js";
2
+ import { TableFieldsEdition } from "./index.js";
3
+ import { tableHeadComponent } from "./head/index.js";
4
+ import TableHeadDefault from "./head/TableHeadDefault.svelte";
5
+ export let fields;
6
+ export let key;
7
+ export let onCreateField = void 0;
8
+ function getComponent(field) {
9
+ if (field.type === "select" || field.type === "multiselect")
10
+ return tableHeadComponent(field.type, { options: field.options || [] })(field);
11
+ if (field.type)
12
+ return tableHeadComponent(field.type, {})(field);
13
+ if (!field.head)
14
+ return component(TableHeadDefault, { field });
15
+ if (typeof field.head === "function")
16
+ return field.head(field);
17
+ if (typeof field.head === "string")
18
+ return tableHeadComponent(field.head, {})(field);
19
+ return field.head;
20
+ }
21
+ </script>
22
+
23
+ <thead>
24
+ <tr class="shadow">
25
+ {#each fields.filter((f) => f.$visible) as field (field.key)}
26
+ {@const { component, props } = getComponent(field)}
27
+ <svelte:component this={component} {...props} />
28
+ {/each}
29
+ <TableFieldsEdition {fields} {key} {onCreateField} />
30
+ </tr>
31
+ </thead>
@@ -0,0 +1,29 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import { type TableField } from './index.js';
3
+ declare class __sveltets_Render<Item extends {
4
+ id: string;
5
+ }> {
6
+ props(): {
7
+ fields: TableField<Item>[];
8
+ key: string;
9
+ onCreateField?: (() => void) | undefined;
10
+ };
11
+ events(): {} & {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots(): {};
15
+ }
16
+ export type TableHeadProps<Item extends {
17
+ id: string;
18
+ }> = ReturnType<__sveltets_Render<Item>['props']>;
19
+ export type TableHeadEvents<Item extends {
20
+ id: string;
21
+ }> = ReturnType<__sveltets_Render<Item>['events']>;
22
+ export type TableHeadSlots<Item extends {
23
+ id: string;
24
+ }> = ReturnType<__sveltets_Render<Item>['slots']>;
25
+ export default class TableHead<Item extends {
26
+ id: string;
27
+ }> extends SvelteComponent<TableHeadProps<Item>, TableHeadEvents<Item>, TableHeadSlots<Item>> {
28
+ }
29
+ export {};