fuma 2.0.3 → 2.0.5

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 (58) hide show
  1. package/dist/ui/button/ButtonCopy.svelte +5 -2
  2. package/dist/ui/button/ButtonCopy.svelte.d.ts +2 -0
  3. package/dist/ui/form/Form.svelte +2 -2
  4. package/dist/ui/input/FormControl.svelte +3 -3
  5. package/dist/ui/input/InputSearch.svelte +34 -22
  6. package/dist/ui/input/InputSearch.svelte.d.ts +10 -8
  7. package/dist/ui/input/InputText.svelte +22 -9
  8. package/dist/ui/input/InputText.svelte.d.ts +7 -21
  9. package/dist/ui/input/InputTime.svelte +3 -2
  10. package/dist/ui/input/InputTime.svelte.d.ts +25 -2
  11. package/dist/ui/input/textRich/InputTextRich.svelte +5 -0
  12. package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +11 -1
  13. package/dist/ui/input/textRich/ToolsBar.svelte +1 -4
  14. package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +2 -0
  15. package/dist/ui/menu/DropDown.svelte +5 -5
  16. package/dist/ui/menu/DropDown.svelte.d.ts +12 -4
  17. package/dist/ui/range/RangePicker.svelte +2 -2
  18. package/dist/ui/range/RangePicker.svelte.d.ts +2 -2
  19. package/dist/ui/range/RangePickerButton.svelte +7 -4
  20. package/dist/ui/range/RangePickerButton.svelte.d.ts +4 -2
  21. package/dist/ui/table/Table.svelte +27 -13
  22. package/dist/ui/table/Table.svelte.d.ts +20 -28
  23. package/dist/ui/table/TableBody.svelte +21 -21
  24. package/dist/ui/table/TableBody.svelte.d.ts +19 -25
  25. package/dist/ui/table/TableCell.svelte +14 -15
  26. package/dist/ui/table/TableCell.svelte.d.ts +16 -21
  27. package/dist/ui/table/TableFieldsEdition.svelte +2 -2
  28. package/dist/ui/table/TableHead.svelte +32 -20
  29. package/dist/ui/table/TableHead.svelte.d.ts +7 -32
  30. package/dist/ui/table/cell/TableCellArray.svelte +5 -8
  31. package/dist/ui/table/cell/TableCellArray.svelte.d.ts +5 -20
  32. package/dist/ui/table/cell/TableCellBoolean.svelte +3 -2
  33. package/dist/ui/table/cell/TableCellBoolean.svelte.d.ts +5 -19
  34. package/dist/ui/table/cell/TableCellNumber.svelte +2 -2
  35. package/dist/ui/table/cell/TableCellNumber.svelte.d.ts +5 -19
  36. package/dist/ui/table/cell/TableCellString.svelte +5 -5
  37. package/dist/ui/table/cell/TableCellString.svelte.d.ts +25 -19
  38. package/dist/ui/table/field.d.ts +26 -58
  39. package/dist/ui/table/field.js +6 -7
  40. package/dist/ui/table/head/OrderButtons.svelte +40 -0
  41. package/dist/ui/table/head/OrderButtons.svelte.d.ts +24 -0
  42. package/dist/ui/table/head/TableHeadBoolean.svelte +2 -2
  43. package/dist/ui/table/head/TableHeadBoolean.svelte.d.ts +28 -17
  44. package/dist/ui/table/head/TableHeadDate.svelte +91 -25
  45. package/dist/ui/table/head/TableHeadDate.svelte.d.ts +5 -19
  46. package/dist/ui/table/head/TableHeadDefault.svelte +1 -2
  47. package/dist/ui/table/head/TableHeadDefault.svelte.d.ts +4 -18
  48. package/dist/ui/table/head/TableHeadNumber.svelte +33 -12
  49. package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +28 -17
  50. package/dist/ui/table/head/TableHeadSelect.svelte +2 -2
  51. package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +31 -20
  52. package/dist/ui/table/head/TableHeadString.svelte +9 -9
  53. package/dist/ui/table/head/TableHeadString.svelte.d.ts +4 -18
  54. package/dist/ui/table/head/index.d.ts +6 -0
  55. package/dist/ui/table/head/index.js +6 -22
  56. package/dist/validation/zod.d.ts +8 -0
  57. package/dist/validation/zod.js +4 -2
  58. package/package.json +8 -8
@@ -2,6 +2,7 @@
2
2
  import { mdiClipboardTextOutline } from '@mdi/js'
3
3
  import { toast } from 'svelte-sonner'
4
4
  import { Icon } from '../icon/index.js'
5
+ import { createEventDispatcher } from 'svelte'
5
6
  let valueOrGetValue: string | (() => Promise<string>)
6
7
  export { valueOrGetValue as value }
7
8
  export let title = ''
@@ -12,6 +13,7 @@
12
13
  export { klass as class }
13
14
 
14
15
  let isLoading = false
16
+ const disptach = createEventDispatcher<{ success: void }>()
15
17
 
16
18
  async function loadValue(): Promise<string> {
17
19
  if (typeof valueOrGetValue === 'string') return valueOrGetValue
@@ -27,6 +29,7 @@
27
29
  .writeText(value)
28
30
  .then(() => {
29
31
  toast.success(successMessage)
32
+ disptach('success')
30
33
  })
31
34
  .catch((error) => {
32
35
  toast.error(error)
@@ -36,10 +39,10 @@
36
39
 
37
40
  <div class="relative">
38
41
  {#if isLoading}
39
- <span class="loading loading-spinner absolute left-1 top-1 scale-125 opacity-25"></span>
42
+ <span class="loading loading-spinner absolute top-1 left-1 scale-125 opacity-25"></span>
40
43
  {/if}
41
44
  <button
42
- class="{klass} btn btn-sm {label ? '' : 'btn-square'}"
45
+ class={klass ? klass : `btn btn-sm ${label ? '' : ' btn-square'}`}
43
46
  on:click|preventDefault={handleClick}
44
47
  class:btn-disabled={isLoading}
45
48
  >
@@ -19,6 +19,8 @@ declare const ButtonCopy: $$__sveltets_2_IsomorphicComponent<{
19
19
  successMessage?: string;
20
20
  class?: string;
21
21
  }, {
22
+ success: CustomEvent<void>;
23
+ } & {
22
24
  [evt: string]: CustomEvent<any>;
23
25
  }, {}, {}, string>;
24
26
  type ButtonCopy = InstanceType<typeof ButtonCopy>;
@@ -116,12 +116,12 @@
116
116
  use:enhance
117
117
  on:input={handleInput}
118
118
  >
119
- <slot />
120
-
121
119
  {#if data?.id}
122
120
  <input type="hidden" name="id" value={data.id} />
123
121
  {/if}
124
122
 
123
+ <slot />
124
+
125
125
  {#each fields as groupFields, groupIndex}
126
126
  {@const section = sections[groupIndex] || {}}
127
127
  {#if !getBoolean(section?.hide)(data)}
@@ -49,7 +49,7 @@
49
49
  >
50
50
  {#if label}
51
51
  <label for="{prefixFor}{_key}" class="label cursor-pointer {classLabel}">
52
- <span class="label-text">
52
+ <span class="py-1.5 text-xs font-extrabold">
53
53
  {#if typeof label === 'string'}
54
54
  {label}
55
55
  {:else}
@@ -67,11 +67,11 @@
67
67
 
68
68
  {#if error}
69
69
  <label for="{prefixFor}{_key}" class="label" transition:slide>
70
- <span class="label-text-alt text-warning">{error}</span>
70
+ <span class="text-warning text-xs font-extrabold">{error}</span>
71
71
  </label>
72
72
  {:else if hint}
73
73
  <label for="{prefixFor}{_key}" class="label" transition:slide>
74
- <span class="label-text-alt text-neutral">{hint}</span>
74
+ <span class="text-neutral text-xs font-extrabold">{hint}</span>
75
75
  </label>
76
76
  {/if}
77
77
  </div>
@@ -1,16 +1,27 @@
1
1
  <script lang="ts">
2
2
  import { mdiClose } from '@mdi/js'
3
3
  import { browser } from '$app/environment'
4
- import { page } from '$app/stores'
4
+ import { page } from '$app/state'
5
5
  import { Icon } from '../icon/index.js'
6
6
  import { InputText } from './index.js'
7
7
 
8
- let klass = ''
9
- export { klass as class }
10
- export let key = 'search'
11
- export let value = $page.url.searchParams.get(key) || ''
8
+ let {
9
+ class: klass = '',
10
+ key = 'search',
11
+ value = page.url.searchParams.get(key) || '',
12
+ oninput,
13
+ onclear,
14
+ onkeydown
15
+ }: {
16
+ class?: string
17
+ key?: string
18
+ value?: string
19
+ oninput?: (value: string) => void
20
+ onclear?: () => void
21
+ onkeydown?: (event: KeyboardEvent) => void
22
+ } = $props()
12
23
 
13
- let inputElement: HTMLInputElement
24
+ let inputElement = $state<HTMLInputElement>()
14
25
  </script>
15
26
 
16
27
  <InputText
@@ -18,9 +29,8 @@
18
29
  bind:inputElement
19
30
  bind:value
20
31
  on:blur
21
- on:blur
22
- on:input
23
- on:keydown
32
+ on:input={() => oninput?.(value)}
33
+ on:keydown={(e) => onkeydown?.(e)}
24
34
  on:keyup
25
35
  bindWithParams
26
36
  input={{
@@ -31,17 +41,19 @@
31
41
  }}
32
42
  classWrapper="relative {klass}"
33
43
  >
34
- <button
35
- slot="append"
36
- class="btn btn-square btn-sm absolute right-0"
37
- class:hidden={!browser}
38
- style:scale={!!value ? 0.75 : 0}
39
- on:click={() => {
40
- value = ''
41
- inputElement.dispatchEvent(new Event('input', { bubbles: true }))
42
- }}
43
- tabindex={!!value ? 0 : -1}
44
- >
45
- <Icon path={mdiClose} />
46
- </button>
44
+ {#snippet append()}
45
+ <button
46
+ class="btn btn-square btn-sm absolute right-0"
47
+ class:hidden={!browser}
48
+ style:scale={!!value ? 0.75 : 0}
49
+ onclick={() => {
50
+ value = ''
51
+ oninput?.(value)
52
+ onclear?.()
53
+ }}
54
+ tabindex={!!value ? 0 : -1}
55
+ >
56
+ <Icon path={mdiClose} />
57
+ </button>
58
+ {/snippet}
47
59
  </InputText>
@@ -1,3 +1,11 @@
1
+ type $$ComponentProps = {
2
+ class?: string;
3
+ key?: string;
4
+ value?: string;
5
+ oninput?: (value: string) => void;
6
+ onclear?: () => void;
7
+ onkeydown?: (event: KeyboardEvent) => void;
8
+ };
1
9
  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> {
2
10
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
11
  $$bindings?: Bindings;
@@ -11,17 +19,11 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
11
19
  };
12
20
  z_$$bindings?: Bindings;
13
21
  }
14
- declare const InputSearch: $$__sveltets_2_IsomorphicComponent<{
15
- class?: string;
16
- key?: string;
17
- value?: string;
18
- }, {
22
+ declare const InputSearch: $$__sveltets_2_IsomorphicComponent<$$ComponentProps, {
19
23
  blur: FocusEvent;
20
- input: Event;
21
- keydown: KeyboardEvent;
22
24
  keyup: KeyboardEvent;
23
25
  } & {
24
26
  [evt: string]: CustomEvent<any>;
25
- }, {}, {}, string>;
27
+ }, {}, {}, "">;
26
28
  type InputSearch = InstanceType<typeof InputSearch>;
27
29
  export default InputSearch;
@@ -1,17 +1,31 @@
1
1
  <script lang="ts">
2
+ import type { Snippet } from 'svelte'
2
3
  import { FormControl, bindValueWithParams, type InputProps } from './index.js'
3
4
 
4
- type $$Props = InputProps
5
- $: ({ input, value: _value, classWrapper, bindWithParams, ...props } = $$props as $$Props)
6
- $: ({ class: inputClass, ...inputProps } = input || {})
7
- export let value = _value
8
- export let inputElement: HTMLInputElement | undefined = undefined
5
+ let {
6
+ input,
7
+ value = $bindable(),
8
+ classWrapper,
9
+ bindWithParams,
10
+ inputElement = $bindable(),
11
+ prepend,
12
+ append,
13
+ ...controlProps
14
+ }: InputProps & {
15
+ prepend?: Snippet<[value: string | null | undefined]>
16
+ append?: Snippet<[value: string | null | undefined]>
17
+ } = $props()
18
+
19
+ let inputProps = $derived({
20
+ ...input,
21
+ class: `input input-bordered w-full ${input?.class || ''}`
22
+ })
9
23
  </script>
10
24
 
11
- <FormControl {...props} enhanceDisabled={props.enhanceDisabled || bindWithParams} let:key>
25
+ <FormControl {...controlProps} enhanceDisabled={controlProps.enhanceDisabled || bindWithParams}>
12
26
  {#snippet children({ key })}
13
27
  <div class={classWrapper}>
14
- <slot name="prepend" {value} />
28
+ {@render prepend?.(value)}
15
29
  <input
16
30
  bind:value
17
31
  on:input
@@ -24,10 +38,9 @@
24
38
  type="text"
25
39
  name={key}
26
40
  id={key}
27
- class="input input-bordered w-full {inputClass || ''}"
28
41
  {...inputProps}
29
42
  />
30
- <slot name="append" {value} />
43
+ {@render append?.(value)}
31
44
  </div>
32
45
  {/snippet}
33
46
  </FormControl>
@@ -1,4 +1,9 @@
1
+ import type { Snippet } from 'svelte';
1
2
  import { type InputProps } from './index.js';
3
+ type $$ComponentProps = InputProps & {
4
+ prepend?: Snippet<[value: string | null | undefined]>;
5
+ append?: Snippet<[value: string | null | undefined]>;
6
+ };
2
7
  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
8
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
9
  $$bindings?: Bindings;
@@ -12,19 +17,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
12
17
  };
13
18
  z_$$bindings?: Bindings;
14
19
  }
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 InputText: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<InputProps, {
21
- prepend: {
22
- value: string | null | undefined;
23
- };
24
- append: {
25
- value: string | null | undefined;
26
- };
27
- }>, {
20
+ declare const InputText: $$__sveltets_2_IsomorphicComponent<$$ComponentProps, {
28
21
  input: Event;
29
22
  focus: FocusEvent;
30
23
  blur: FocusEvent;
@@ -32,13 +25,6 @@ declare const InputText: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_Props
32
25
  keyup: KeyboardEvent;
33
26
  } & {
34
27
  [evt: string]: CustomEvent<any>;
35
- }, {
36
- prepend: {
37
- value: string | null | undefined;
38
- };
39
- append: {
40
- value: string | null | undefined;
41
- };
42
- }, {}, string>;
28
+ }, {}, {}, "value" | "inputElement">;
43
29
  type InputText = InstanceType<typeof InputText>;
44
30
  export default InputText;
@@ -3,10 +3,11 @@
3
3
  import type { HTMLInputAttributes, FormEventHandler } from 'svelte/elements'
4
4
  import { FormControl, type InputProps } from './index.js'
5
5
  import dayjs from 'dayjs'
6
- type $$Props = InputProps<Date>
6
+ type $$Props = InputProps<Date> & { getDefaultDate?: () => Date }
7
7
 
8
8
  export let value: Date | null | undefined = undefined
9
9
  export let input: HTMLInputAttributes = {}
10
+ export let getDefaultDate = () => new Date(0)
10
11
 
11
12
  $: ({ class: inputClass = '', ...inputProps } = input)
12
13
 
@@ -19,7 +20,7 @@
19
20
 
20
21
  function getDateTime(v: string | null | undefined): Date | null | undefined {
21
22
  if (!v) return value
22
- const date = new Date(value || 0)
23
+ const date = value ? new Date(value) : getDefaultDate()
23
24
  const dateString = [
24
25
  date.getFullYear().toString(),
25
26
  (date.getMonth() + 1).toString().padStart(2, '0'),
@@ -1,4 +1,4 @@
1
- import { type InputProps } from './index.js';
1
+ import type { HTMLInputAttributes } from 'svelte/elements';
2
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
3
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
4
  $$bindings?: Bindings;
@@ -12,7 +12,30 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
12
12
  };
13
13
  z_$$bindings?: Bindings;
14
14
  }
15
- declare const InputTime: $$__sveltets_2_IsomorphicComponent<InputProps<Date>, {
15
+ declare const InputTime: $$__sveltets_2_IsomorphicComponent<{
16
+ class?: string;
17
+ classLabel?: string;
18
+ key?: string;
19
+ label?: import("svelte").Snippet | string;
20
+ labelAppend?: import("svelte").Snippet | null;
21
+ error?: string;
22
+ hint?: string;
23
+ prefix?: string | number;
24
+ prefixFor?: string | number;
25
+ enhanceDisabled?: boolean;
26
+ labelPosition?: "top" | "left" | "right";
27
+ children?: import("svelte").Snippet<[{
28
+ key: string;
29
+ }]> | undefined;
30
+ } & {
31
+ input?: HTMLInputAttributes;
32
+ inputElement?: HTMLInputElement;
33
+ classWrapper?: string;
34
+ value?: Date | null | undefined;
35
+ bindWithParams?: boolean;
36
+ } & {
37
+ getDefaultDate?: () => Date;
38
+ }, {
16
39
  focus: FocusEvent;
17
40
  blur: FocusEvent;
18
41
  input: CustomEvent<Date | null>;
@@ -25,6 +25,11 @@
25
25
  }
26
26
  })
27
27
 
28
+ export function setImage(image: { src: string; alt: string }) {
29
+ if (!editor) return false
30
+ return editor.commands.setImage(image)
31
+ }
32
+
28
33
  function initEditor() {
29
34
  const valueAsHtml = !value.startsWith('{') && value !== 'null'
30
35
  editor = new Editor({
@@ -12,6 +12,11 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
12
12
  z_$$bindings?: Bindings;
13
13
  }
14
14
  declare const InputTextRich: $$__sveltets_2_IsomorphicComponent<{
15
+ setImage?: (image: {
16
+ src: string;
17
+ alt: string;
18
+ }) => boolean;
19
+ } & {
15
20
  class?: string;
16
21
  classLabel?: string;
17
22
  key?: string;
@@ -33,6 +38,11 @@ declare const InputTextRich: $$__sveltets_2_IsomorphicComponent<{
33
38
  change: CustomEvent<void>;
34
39
  } & {
35
40
  [evt: string]: CustomEvent<any>;
36
- }, {}, {}, string>;
41
+ }, {}, {
42
+ setImage: (image: {
43
+ src: string;
44
+ alt: string;
45
+ }) => boolean;
46
+ }, string>;
37
47
  type InputTextRich = InstanceType<typeof InputTextRich>;
38
48
  export default InputTextRich;
@@ -56,9 +56,6 @@
56
56
 
57
57
  <div class="mx-1 my-auto h-6 border border-y-0 border-l-0"></div>
58
58
 
59
- <ToolMenuInsert
60
- {editor}
61
- on:insertMedia={() => toast.warning('TODO: import SelectMedia like benev.io')}
62
- />
59
+ <ToolMenuInsert {editor} on:insertMedia />
63
60
  </div>
64
61
  </div>
@@ -16,6 +16,8 @@ declare const ToolsBar: $$__sveltets_2_IsomorphicComponent<{
16
16
  editor: Editor;
17
17
  class?: string;
18
18
  }, {
19
+ insertMedia: CustomEvent<void>;
20
+ } & {
19
21
  [evt: string]: CustomEvent<any>;
20
22
  }, {}, {}, string>;
21
23
  type ToolsBar = InstanceType<typeof ToolsBar>;
@@ -97,23 +97,23 @@
97
97
  {#if !disable}
98
98
  <div class={classWrapper}>
99
99
  <div class={classActivator} bind:this={activator}>
100
- <slot name="activator" />
100
+ <slot name="activator" {tip} />
101
101
  </div>
102
102
 
103
103
  <div class="hidden">
104
104
  <div
105
- class="{klass} max-h-80 overflow-auto rounded-lg border bg-base-100 p-1 shadow-lg"
105
+ class="{klass} bg-base-100 max-h-80 overflow-auto rounded-lg border p-1 shadow-lg"
106
106
  bind:this={content}
107
107
  >
108
- <slot />
108
+ <slot {tip} />
109
109
  </div>
110
110
  </div>
111
111
  </div>
112
112
  {:else}
113
113
  <div class={classWrapper}>
114
- <slot name="activator" />
114
+ <slot name="activator" {tip} />
115
115
  <div class="{klass} mt-2">
116
- <slot />
116
+ <slot {tip} />
117
117
  </div>
118
118
  </div>
119
119
  {/if}
@@ -35,13 +35,21 @@ declare const DropDown: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsW
35
35
  show?: () => void;
36
36
  setTippyProps?: (props: Partial<TippyProps>) => void;
37
37
  }, {
38
- activator: {};
39
- default: {};
38
+ activator: {
39
+ tip: TippyInstance<TippyProps> | undefined;
40
+ };
41
+ default: {
42
+ tip: TippyInstance<TippyProps> | undefined;
43
+ };
40
44
  }>, {
41
45
  [evt: string]: CustomEvent<any>;
42
46
  }, {
43
- activator: {};
44
- default: {};
47
+ activator: {
48
+ tip: TippyInstance<TippyProps> | undefined;
49
+ };
50
+ default: {
51
+ tip: TippyInstance<TippyProps> | undefined;
52
+ };
45
53
  }, {
46
54
  hide: () => void;
47
55
  show: () => void;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { onMount, onDestroy, createEventDispatcher } from 'svelte'
3
3
  import type { Litepicker } from 'litepicker'
4
- import type { Range, RangeAsDate, RangeDate } from './types.js'
4
+ import type { RangeAsDate, RangeDate } from './types.js'
5
5
  import dayjs from 'dayjs'
6
6
 
7
7
  export let numberOfMonths = 3
@@ -15,7 +15,7 @@
15
15
  let endElement: HTMLInputElement
16
16
  let picker: Litepicker
17
17
  let parentEl: HTMLDivElement
18
- const dispatch = createEventDispatcher<{ change: Range }>()
18
+ const dispatch = createEventDispatcher<{ change: RangeAsDate }>()
19
19
 
20
20
  onMount(() => {
21
21
  initTimePicker()
@@ -1,4 +1,4 @@
1
- import type { Range, RangeAsDate } from './types.js';
1
+ import type { RangeAsDate } from './types.js';
2
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
3
  new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
4
  $$bindings?: Bindings;
@@ -21,7 +21,7 @@ declare const RangePicker: $$__sveltets_2_IsomorphicComponent<{
21
21
  maxDate?: Date | number | string | undefined;
22
22
  clear?: () => void;
23
23
  }, {
24
- change: CustomEvent<Range>;
24
+ change: CustomEvent<RangeAsDate>;
25
25
  } & {
26
26
  [evt: string]: CustomEvent<any>;
27
27
  }, {}, {
@@ -10,17 +10,20 @@
10
10
  import { InputTime } from '../input/index.js'
11
11
  import { type RangeAsDate, RangePicker } from './index.js'
12
12
  import { jsonParse } from '../../utils/jsonParse.js'
13
- export let minDate: Date | number | string | undefined = undefined
14
- export let maxDate: Date | number | string | undefined = undefined
15
13
 
16
14
  let dropDown: DropDown
17
15
  let rangePicker: RangePicker
16
+ let klass = ''
18
17
 
19
18
  export let key = 'range'
20
19
  export let range: RangeAsDate = jsonParse<RangeAsDate>($urlParam.get(key), {
21
20
  start: null,
22
21
  end: null
23
22
  })
23
+ export let minDate: Date | number | string | undefined = undefined
24
+ export let maxDate: Date | number | string | undefined = undefined
25
+ export { klass as class }
26
+ export let classLabel = ''
24
27
 
25
28
  $: isValidPeriod = !!range.start && !!range.end
26
29
 
@@ -44,12 +47,12 @@
44
47
  </script>
45
48
 
46
49
  <DropDown bind:this={dropDown} tippyProps={{ onHidden: writeURL }} class="max-h-full">
47
- <button slot="activator" class="btn btn-sm">
50
+ <button slot="activator" class="min-width-0 btn btn-sm flex-nowrap {klass}">
48
51
  <Icon path={mdiCalendarMonthOutline} class="opacity-60" size={20} />
49
52
  {#if isValidPeriod}
50
53
  <span
51
54
  transition:slide={{ axis: 'x', duration: 200 }}
52
- class="whitespace-nowrap text-xs font-medium opacity-80"
55
+ class="whitespace-nowrap text-xs font-medium opacity-80 {classLabel}"
53
56
  >
54
57
  {getLabel(range)}
55
58
  </span>
@@ -13,10 +13,12 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
13
13
  z_$$bindings?: Bindings;
14
14
  }
15
15
  declare const RangePickerButton: $$__sveltets_2_IsomorphicComponent<{
16
- minDate?: Date | number | string | undefined;
17
- maxDate?: Date | number | string | undefined;
18
16
  key?: string;
19
17
  range?: RangeAsDate;
18
+ minDate?: Date | number | string | undefined;
19
+ maxDate?: Date | number | string | undefined;
20
+ class?: string;
21
+ classLabel?: string;
20
22
  }, {
21
23
  [evt: string]: CustomEvent<any>;
22
24
  }, {}, {}, string>;
@@ -1,27 +1,41 @@
1
- <script lang="ts" generics="Item extends {id: string | number}">
1
+ <script lang="ts" generics="Item extends ItemBase">
2
2
  import { afterNavigate } from '$app/navigation'
3
3
  import { Placeholder } from '../placeholder/index.js'
4
- import type { ComponentAndProps } from '../../utils/component.js'
5
4
 
6
5
  import {
7
6
  type TableField,
7
+ type ItemBase,
8
8
  TableHead,
9
9
  TableBody,
10
10
  context,
11
11
  createKeys,
12
12
  syncFieldsWithParams
13
13
  } from './index.js'
14
+ import type { Snippet } from 'svelte'
14
15
 
15
- export let key = 'table'
16
- export let fields: TableField<Item>[]
17
- export let items: Item[]
18
- export let slotAction: ((item: Item) => ComponentAndProps) | undefined = undefined
19
- export let placholder = 'Aucun élément trouvé'
20
- let klass = ''
21
- export { klass as class }
22
- export let classRow = ''
23
- export let hideBody = false
24
- export let onCreateField: (() => void) | undefined = undefined
16
+ let {
17
+ key = 'table',
18
+ fields,
19
+ items,
20
+ actions,
21
+ placholder = 'placholder',
22
+ class: klass,
23
+ classRow,
24
+ hideBody = false,
25
+ onCreateField,
26
+ onclick
27
+ }: {
28
+ key?: string
29
+ fields: TableField<Item>[]
30
+ items: Item[]
31
+ actions?: Snippet<[item: Item]>
32
+ placholder?: string
33
+ class?: string
34
+ classRow?: string
35
+ hideBody?: boolean
36
+ onCreateField?: () => void
37
+ onclick?: (item?: Item) => void
38
+ } = $props()
25
39
 
26
40
  const { KEY_FIELDS_VISIBLE, KEY_FIELDS_HIDDEN, KEY_FIELDS_ORDER } = createKeys(key)
27
41
  context.set(key, {
@@ -39,7 +53,7 @@
39
53
  <table class="relative table">
40
54
  <TableHead {fields} {key} {onCreateField} />
41
55
  {#if !hideBody && items.length}
42
- <TableBody {fields} {items} action={slotAction} {classRow} on:click />
56
+ <TableBody {fields} {items} {actions} {classRow} {onclick} />
43
57
  {/if}
44
58
  </table>
45
59