fuma 2.0.50 → 2.1.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.
- package/dist/action/index.d.ts +2 -5
- package/dist/action/index.js +2 -5
- package/dist/action/list/handlers.d.ts +6 -6
- package/dist/action/list/handlers.js +6 -5
- package/dist/action/list/index.d.ts +1 -1
- package/dist/action/list/index.js +11 -5
- package/dist/action/list/trigger.js +6 -2
- package/dist/action/list/utils.js +1 -1
- package/dist/action/tip.js +2 -2
- package/dist/command/command.svelte.d.ts +16 -0
- package/dist/command/command.svelte.js +68 -0
- package/dist/command/index.d.ts +1 -0
- package/dist/command/index.js +1 -0
- package/dist/data.d.ts +87 -0
- package/dist/data.js +51 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/input/InputBoolean.svelte +107 -0
- package/dist/input/InputBoolean.svelte.d.ts +12 -0
- package/dist/input/InputNumber.svelte +33 -0
- package/dist/input/InputNumber.svelte.d.ts +10 -0
- package/dist/input/InputRadio.svelte +56 -0
- package/dist/input/InputRadio.svelte.d.ts +11 -0
- package/dist/input/InputRange.svelte +30 -0
- package/dist/input/InputRange.svelte.d.ts +10 -0
- package/dist/input/InputRelation.svelte +119 -0
- package/dist/input/InputRelation.svelte.d.ts +39 -0
- package/dist/input/InputSelect.svelte +113 -0
- package/dist/input/InputSelect.svelte.d.ts +37 -0
- package/dist/input/InputSelectNative.svelte +56 -0
- package/dist/input/InputSelectNative.svelte.d.ts +12 -0
- package/dist/input/InputString.svelte +48 -0
- package/dist/input/InputString.svelte.d.ts +11 -0
- package/dist/input/InputTextarea.svelte +47 -0
- package/dist/input/InputTextarea.svelte.d.ts +11 -0
- package/dist/input/Issues.svelte +21 -0
- package/dist/input/Issues.svelte.d.ts +7 -0
- package/dist/input/index.d.ts +11 -0
- package/dist/input/index.js +10 -0
- package/dist/input/type.d.ts +5 -0
- package/dist/popover/Popover.svelte +50 -0
- package/dist/popover/index.d.ts +2 -0
- package/dist/popover/index.js +2 -0
- package/dist/popover/popover.svelte.d.ts +26 -0
- package/dist/popover/popover.svelte.js +101 -0
- package/dist/remote/useForm.d.ts +6 -0
- package/dist/remote/useForm.js +22 -0
- package/dist/search/Spans.svelte +15 -0
- package/dist/search/Spans.svelte.d.ts +7 -0
- package/dist/search/index.d.ts +2 -0
- package/dist/search/index.js +2 -0
- package/dist/search/search.js +96 -0
- package/dist/server/index.d.ts +0 -4
- package/dist/server/index.js +0 -4
- package/dist/server/parseQuery.js +1 -1
- package/dist/server/sse.js +4 -4
- package/dist/server/table.js +1 -1
- package/dist/state/index.d.ts +1 -0
- package/dist/state/index.js +1 -0
- package/dist/state/param.svelte.d.ts +17 -0
- package/dist/state/param.svelte.js +64 -0
- package/dist/ui/button/ButtonDelete.svelte +49 -28
- package/dist/ui/button/ButtonDelete.svelte.d.ts +12 -31
- package/dist/ui/button/index.d.ts +0 -1
- package/dist/ui/button/index.js +0 -1
- package/dist/ui/copy/ButtonCopy.svelte +43 -0
- package/dist/ui/copy/ButtonCopy.svelte.d.ts +17 -0
- package/dist/ui/copy/index.d.ts +2 -0
- package/dist/ui/copy/index.js +2 -0
- package/dist/ui/copy/useCopy.svelte.d.ts +10 -0
- package/dist/ui/copy/useCopy.svelte.js +36 -0
- package/dist/ui/dialog/Dialog.svelte +56 -26
- package/dist/ui/dialog/Dialog.svelte.d.ts +14 -35
- package/dist/ui/dialog/index.d.ts +0 -1
- package/dist/ui/dialog/index.js +0 -1
- package/dist/ui/drawer/Drawer.svelte +53 -45
- package/dist/ui/drawer/Drawer.svelte.d.ts +8 -63
- package/dist/ui/drawer/drawerFly.js +1 -1
- package/dist/ui/drawer/useLayer.svelte.d.ts +5 -0
- package/dist/ui/drawer/useLayer.svelte.js +33 -0
- package/dist/ui/index.d.ts +4 -12
- package/dist/ui/index.js +4 -12
- package/dist/ui/menu/ContextMenu.svelte +27 -26
- package/dist/ui/menu/ContextMenu.svelte.d.ts +9 -35
- package/dist/ui/menu/DropDown.svelte +44 -26
- package/dist/ui/menu/DropDown.svelte.d.ts +18 -43
- package/dist/ui/menu/DropDownMenu.svelte +51 -41
- package/dist/ui/menu/DropDownMenu.svelte.d.ts +7 -29
- package/dist/ui/menu/dropdown.css +4 -4
- package/dist/ui/menu/index.d.ts +1 -1
- package/dist/ui/menu/index.js +2 -1
- package/dist/ui/mode/ToggleMode.svelte +25 -14
- package/dist/ui/mode/ToggleMode.svelte.d.ts +10 -35
- package/dist/ui/mode/index.d.ts +1 -1
- package/dist/ui/mode/index.js +1 -1
- package/dist/ui/mode/useMode.svelte.d.ts +8 -0
- package/dist/ui/mode/useMode.svelte.js +40 -0
- package/dist/ui/pagination/Pagination.svelte +18 -14
- package/dist/ui/pagination/Pagination.svelte.d.ts +4 -18
- package/dist/ui/range/RangePicker.svelte +3 -2
- package/dist/ui/range/RangePickerButton.svelte +49 -37
- package/dist/ui/range/RangePickerButton.svelte.d.ts +7 -21
- package/dist/ui/range/index.d.ts +1 -1
- package/dist/ui/range/index.js +1 -1
- package/dist/ui/table/Table.svelte +17 -24
- package/dist/ui/table/Table.svelte.d.ts +3 -3
- package/dist/ui/table/TableBody.svelte +1 -1
- package/dist/ui/table/TableBody.svelte.d.ts +1 -1
- package/dist/ui/table/TableFieldsEdition.svelte +90 -78
- package/dist/ui/table/TableFieldsEdition.svelte.d.ts +14 -13
- package/dist/ui/table/TableHead.svelte +1 -1
- package/dist/ui/table/TableViewSelect.svelte +71 -70
- package/dist/ui/table/TableViewSelect.svelte.d.ts +10 -23
- package/dist/ui/table/cell/TableCellArray.svelte +2 -2
- package/dist/ui/table/cell/TableCellBoolean.svelte +3 -4
- package/dist/ui/table/cell/index.d.ts +1 -1
- package/dist/ui/table/cell/index.js +1 -1
- package/dist/ui/table/field.d.ts +7 -7
- package/dist/ui/table/head/OrderButtons.svelte +18 -13
- package/dist/ui/table/head/OrderButtons.svelte.d.ts +11 -23
- package/dist/ui/table/head/TableHeadBoolean.svelte +3 -3
- package/dist/ui/table/head/TableHeadDate.svelte +40 -56
- package/dist/ui/table/head/TableHeadDate.svelte.d.ts +1 -1
- package/dist/ui/table/head/TableHeadDefault.svelte +2 -1
- package/dist/ui/table/head/TableHeadNumber.svelte +93 -108
- package/dist/ui/table/head/TableHeadNumber.svelte.d.ts +13 -10
- package/dist/ui/table/head/TableHeadSelect.svelte +55 -52
- package/dist/ui/table/head/TableHeadSelect.svelte.d.ts +13 -10
- package/dist/ui/table/head/TableHeadString.svelte +28 -34
- package/dist/ui/table/head/index.d.ts +3 -3
- package/dist/ui/table/head/index.js +3 -3
- package/dist/ui/table/index.d.ts +5 -5
- package/dist/ui/table/index.js +4 -5
- package/dist/utils/csv.js +1 -1
- package/dist/utils/eventEmitter.d.ts +2 -2
- package/dist/utils/eventEmitter.js +18 -11
- package/dist/utils/index.d.ts +4 -6
- package/dist/utils/index.js +4 -6
- package/dist/utils/normalizePath.js +1 -1
- package/dist/utils/options.d.ts +6 -5
- package/dist/utils/options.js +3 -2
- package/dist/utils/tippy.d.ts +1 -1
- package/dist/utils/tippy.js +1 -1
- package/dist/validation/index.d.ts +0 -1
- package/dist/validation/index.js +0 -1
- package/dist/validation/zod.d.ts +12 -393
- package/dist/validation/zod.js +22 -82
- package/package.json +115 -134
- package/dist/action/heightScreen.d.ts +0 -10
- package/dist/action/heightScreen.js +0 -24
- package/dist/action/portal.d.ts +0 -3
- package/dist/action/portal.js +0 -9
- package/dist/action/selector.d.ts +0 -15
- package/dist/action/selector.js +0 -71
- package/dist/api/client.d.ts +0 -3
- package/dist/api/client.js +0 -24
- package/dist/api/config.d.ts +0 -46
- package/dist/api/config.js +0 -7
- package/dist/api/index.d.ts +0 -3
- package/dist/api/index.js +0 -3
- package/dist/api/server.d.ts +0 -11
- package/dist/api/server.js +0 -17
- package/dist/private/Meta.svelte +0 -16
- package/dist/private/Meta.svelte.d.ts +0 -30
- package/dist/private/api.d.ts +0 -61
- package/dist/private/api.js +0 -10
- package/dist/private/constant.d.ts +0 -14
- package/dist/private/constant.js +0 -6
- package/dist/private/model.d.ts +0 -70
- package/dist/private/model.js +0 -25
- package/dist/private/prisma.d.ts +0 -2
- package/dist/private/prisma.js +0 -2
- package/dist/private/store.d.ts +0 -1
- package/dist/private/store.js +0 -2
- package/dist/server/auth.d.ts +0 -12
- package/dist/server/auth.js +0 -15
- package/dist/server/formAction.d.ts +0 -13
- package/dist/server/formAction.js +0 -8
- package/dist/server/json.d.ts +0 -1
- package/dist/server/json.js +0 -16
- package/dist/server/parseFormData.d.ts +0 -10
- package/dist/server/parseFormData.js +0 -85
- package/dist/server/try.d.ts +0 -9
- package/dist/server/try.js +0 -41
- package/dist/store/index.d.ts +0 -2
- package/dist/store/index.js +0 -2
- package/dist/store/isSmallScreen.d.ts +0 -1
- package/dist/store/isSmallScreen.js +0 -14
- package/dist/store/param.d.ts +0 -22
- package/dist/store/param.js +0 -61
- package/dist/store/session.d.ts +0 -1
- package/dist/store/session.js +0 -13
- package/dist/ui/badge/Badge.svelte +0 -9
- package/dist/ui/badge/Badge.svelte.d.ts +0 -21
- package/dist/ui/badge/index.d.ts +0 -1
- package/dist/ui/badge/index.js +0 -1
- package/dist/ui/button/ButtonCopy.svelte +0 -59
- package/dist/ui/button/ButtonCopy.svelte.d.ts +0 -27
- package/dist/ui/card/Card.svelte +0 -43
- package/dist/ui/card/Card.svelte.d.ts +0 -41
- package/dist/ui/card/CardBasic.svelte +0 -15
- package/dist/ui/card/CardBasic.svelte.d.ts +0 -31
- package/dist/ui/card/CardCollapse.svelte +0 -71
- package/dist/ui/card/CardCollapse.svelte.d.ts +0 -39
- package/dist/ui/card/CardFullScreen.svelte +0 -31
- package/dist/ui/card/CardFullScreen.svelte.d.ts +0 -38
- package/dist/ui/card/CardLink.svelte +0 -22
- package/dist/ui/card/CardLink.svelte.d.ts +0 -31
- package/dist/ui/card/index.d.ts +0 -5
- package/dist/ui/card/index.js +0 -5
- package/dist/ui/context.d.ts +0 -6
- package/dist/ui/context.js +0 -12
- package/dist/ui/dialog/DialogConfirm.svelte +0 -24
- package/dist/ui/dialog/DialogConfirm.svelte.d.ts +0 -35
- package/dist/ui/drawer/layers.d.ts +0 -7
- package/dist/ui/drawer/layers.js +0 -68
- package/dist/ui/form/Form.svelte +0 -168
- package/dist/ui/form/Form.svelte.d.ts +0 -62
- package/dist/ui/form/FormInput.svelte +0 -15
- package/dist/ui/form/FormSection.svelte +0 -78
- package/dist/ui/form/FormSection.svelte.d.ts +0 -39
- package/dist/ui/form/form.d.ts +0 -37
- package/dist/ui/form/form.js +0 -57
- package/dist/ui/form/formInput.js +0 -33
- package/dist/ui/form/index.d.ts +0 -3
- package/dist/ui/form/index.js +0 -3
- package/dist/ui/icon/Icon.svelte +0 -53
- package/dist/ui/icon/Icon.svelte.d.ts +0 -29
- package/dist/ui/icon/index.d.ts +0 -1
- package/dist/ui/icon/index.js +0 -1
- package/dist/ui/input/FormControl.svelte +0 -77
- package/dist/ui/input/FormControl.svelte.d.ts +0 -34
- package/dist/ui/input/InputBoolean.svelte +0 -33
- package/dist/ui/input/InputBoolean.svelte.d.ts +0 -46
- package/dist/ui/input/InputCheckboxs.svelte +0 -71
- package/dist/ui/input/InputCheckboxs.svelte.d.ts +0 -57
- package/dist/ui/input/InputCheckboxsMenu.svelte +0 -106
- package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +0 -59
- package/dist/ui/input/InputCheckboxsTree.svelte +0 -18
- package/dist/ui/input/InputCheckboxsTree.svelte.d.ts +0 -25
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte +0 -68
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte.d.ts +0 -27
- package/dist/ui/input/InputCombo.svelte +0 -99
- package/dist/ui/input/InputCombo.svelte.d.ts +0 -59
- package/dist/ui/input/InputDate.svelte +0 -47
- package/dist/ui/input/InputDate.svelte.d.ts +0 -46
- package/dist/ui/input/InputDateTime.svelte +0 -41
- package/dist/ui/input/InputDateTime.svelte.d.ts +0 -23
- package/dist/ui/input/InputImage.svelte +0 -116
- package/dist/ui/input/InputImage.svelte.d.ts +0 -48
- package/dist/ui/input/InputImagePreview.svelte +0 -60
- package/dist/ui/input/InputImagePreview.svelte.d.ts +0 -27
- package/dist/ui/input/InputNumber.svelte +0 -31
- package/dist/ui/input/InputNumber.svelte.d.ts +0 -23
- package/dist/ui/input/InputOptionInParam.svelte +0 -36
- package/dist/ui/input/InputOptionInParam.svelte.d.ts +0 -24
- package/dist/ui/input/InputOptions.svelte +0 -85
- package/dist/ui/input/InputOptions.svelte.d.ts +0 -21
- package/dist/ui/input/InputPassword.svelte +0 -25
- package/dist/ui/input/InputPassword.svelte.d.ts +0 -45
- package/dist/ui/input/InputRadio.svelte +0 -84
- package/dist/ui/input/InputRadio.svelte.d.ts +0 -56
- package/dist/ui/input/InputRelation.svelte +0 -171
- package/dist/ui/input/InputRelation.svelte.d.ts +0 -76
- package/dist/ui/input/InputRelations.svelte +0 -166
- package/dist/ui/input/InputRelations.svelte.d.ts +0 -55
- package/dist/ui/input/InputSearch.svelte +0 -59
- package/dist/ui/input/InputSearch.svelte.d.ts +0 -29
- package/dist/ui/input/InputSelect.svelte +0 -84
- package/dist/ui/input/InputSelect.svelte.d.ts +0 -29
- package/dist/ui/input/InputText.svelte +0 -46
- package/dist/ui/input/InputText.svelte.d.ts +0 -30
- package/dist/ui/input/InputTextarea.svelte +0 -23
- package/dist/ui/input/InputTextarea.svelte.d.ts +0 -23
- package/dist/ui/input/InputTime.svelte +0 -47
- package/dist/ui/input/InputTime.svelte.d.ts +0 -46
- package/dist/ui/input/RelationAfter.svelte +0 -34
- package/dist/ui/input/RelationAfter.svelte.d.ts +0 -26
- package/dist/ui/input/SelectorList.svelte +0 -50
- package/dist/ui/input/SelectorList.svelte.d.ts +0 -49
- package/dist/ui/input/action.d.ts +0 -13
- package/dist/ui/input/action.js +0 -56
- package/dist/ui/input/index.d.ts +0 -26
- package/dist/ui/input/index.js +0 -26
- package/dist/ui/input/textRich/InputTextRich.svelte +0 -72
- package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +0 -48
- package/dist/ui/input/textRich/SuggesionList.svelte +0 -25
- package/dist/ui/input/textRich/SuggesionList.svelte.d.ts +0 -23
- package/dist/ui/input/textRich/ToolMark.svelte +0 -22
- package/dist/ui/input/textRich/ToolMark.svelte.d.ts +0 -25
- package/dist/ui/input/textRich/ToolMarkColor.svelte +0 -36
- package/dist/ui/input/textRich/ToolMarkColor.svelte.d.ts +0 -23
- package/dist/ui/input/textRich/ToolMarkLink.svelte +0 -72
- package/dist/ui/input/textRich/ToolMarkLink.svelte.d.ts +0 -21
- package/dist/ui/input/textRich/ToolMenu.svelte +0 -66
- package/dist/ui/input/textRich/ToolMenu.svelte.d.ts +0 -33
- package/dist/ui/input/textRich/ToolMenuAlign.svelte +0 -50
- package/dist/ui/input/textRich/ToolMenuAlign.svelte.d.ts +0 -21
- package/dist/ui/input/textRich/ToolMenuInsert.svelte +0 -54
- package/dist/ui/input/textRich/ToolMenuInsert.svelte.d.ts +0 -23
- package/dist/ui/input/textRich/ToolMenuNode.svelte +0 -60
- package/dist/ui/input/textRich/ToolMenuNode.svelte.d.ts +0 -21
- package/dist/ui/input/textRich/ToolsBar.svelte +0 -61
- package/dist/ui/input/textRich/ToolsBar.svelte.d.ts +0 -24
- package/dist/ui/input/textRich/extensions.d.ts +0 -2
- package/dist/ui/input/textRich/extensions.js +0 -62
- package/dist/ui/input/textRich/indent.d.ts +0 -13
- package/dist/ui/input/textRich/indent.js +0 -112
- package/dist/ui/input/textRich/index.d.ts +0 -3
- package/dist/ui/input/textRich/index.js +0 -3
- package/dist/ui/input/textRich/suggestion.d.ts +0 -7
- package/dist/ui/input/textRich/suggestion.js +0 -55
- package/dist/ui/input/textRich/tiptapParser.d.ts +0 -4
- package/dist/ui/input/textRich/tiptapParser.js +0 -29
- package/dist/ui/input/types.d.ts +0 -15
- package/dist/ui/input/types.js +0 -1
- package/dist/ui/login/Login.svelte +0 -99
- package/dist/ui/login/Login.svelte.d.ts +0 -20
- package/dist/ui/login/index.d.ts +0 -1
- package/dist/ui/login/index.js +0 -1
- package/dist/ui/placeholder/Placeholder.svelte +0 -12
- package/dist/ui/placeholder/Placeholder.svelte.d.ts +0 -30
- package/dist/ui/placeholder/PlaceholderImage.svelte +0 -16
- package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +0 -30
- package/dist/ui/placeholder/index.d.ts +0 -2
- package/dist/ui/placeholder/index.js +0 -2
- package/dist/ui/table/type.d.ts +0 -2
- package/dist/ui/tabs/Tabs.svelte +0 -32
- package/dist/ui/tabs/Tabs.svelte.d.ts +0 -22
- package/dist/ui/tabs/TabsIcon.svelte +0 -60
- package/dist/ui/tabs/TabsIcon.svelte.d.ts +0 -24
- package/dist/ui/tabs/index.d.ts +0 -8
- package/dist/ui/tabs/index.js +0 -2
- package/dist/utils/avatar.d.ts +0 -1
- package/dist/utils/avatar.js +0 -5
- package/dist/utils/component.d.ts +0 -6
- package/dist/utils/component.js +0 -3
- package/dist/validation/form.d.ts +0 -34
- package/dist/validation/form.js +0 -103
- /package/dist/{ui/table → input}/type.js +0 -0
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { TippyProps } from '../../utils/tippy.js';
|
|
2
|
-
import { type Options } from '../../utils/options.js';
|
|
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;
|
|
13
|
-
};
|
|
14
|
-
z_$$bindings?: Bindings;
|
|
15
|
-
}
|
|
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;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { createEventDispatcher } from 'svelte'
|
|
3
|
-
import type { FormEventHandler, HTMLInputAttributes } from 'svelte/elements'
|
|
4
|
-
import dayjs from 'dayjs'
|
|
5
|
-
|
|
6
|
-
import { FormControl, type InputProps } from './index.js'
|
|
7
|
-
import { USE_COERCE_DATE } from '../../utils/constant.js'
|
|
8
|
-
|
|
9
|
-
type $$Props = InputProps<Date | null | undefined> & { noPreserveTime?: boolean }
|
|
10
|
-
export let value: Date | null | undefined = undefined
|
|
11
|
-
export let input: HTMLInputAttributes = {}
|
|
12
|
-
export let noPreserveTime = false
|
|
13
|
-
$: ({ class: inputClass = '', ...inputProps } = input)
|
|
14
|
-
|
|
15
|
-
const dispatch = createEventDispatcher<{ input: Date | null }>()
|
|
16
|
-
|
|
17
|
-
const handleInput: FormEventHandler<HTMLInputElement> = ({ currentTarget }) => {
|
|
18
|
-
const newValue = currentTarget.valueAsDate
|
|
19
|
-
if (noPreserveTime) newValue?.setHours(0, 0, 0, 0)
|
|
20
|
-
else
|
|
21
|
-
newValue?.setHours(
|
|
22
|
-
value?.getHours() || 0,
|
|
23
|
-
value?.getMinutes() || 0,
|
|
24
|
-
value?.getSeconds() || 0,
|
|
25
|
-
0
|
|
26
|
-
)
|
|
27
|
-
value = newValue
|
|
28
|
-
dispatch('input', value)
|
|
29
|
-
}
|
|
30
|
-
</script>
|
|
31
|
-
|
|
32
|
-
<FormControl {...$$restProps}>
|
|
33
|
-
{#snippet children({ key })}
|
|
34
|
-
<input
|
|
35
|
-
value={value && dayjs(value).format('YYYY-MM-DD')}
|
|
36
|
-
on:input={handleInput}
|
|
37
|
-
on:focus
|
|
38
|
-
on:blur
|
|
39
|
-
type="date"
|
|
40
|
-
id={key}
|
|
41
|
-
class="input input-bordered {inputClass}"
|
|
42
|
-
{...inputProps}
|
|
43
|
-
/>
|
|
44
|
-
|
|
45
|
-
<input type="hidden" name={key} value="{USE_COERCE_DATE}{value?.toJSON()}" />
|
|
46
|
-
{/snippet}
|
|
47
|
-
</FormControl>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
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;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const InputDate: $$__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
|
-
noPreserveTime?: boolean;
|
|
38
|
-
}, {
|
|
39
|
-
focus: FocusEvent;
|
|
40
|
-
blur: FocusEvent;
|
|
41
|
-
input: CustomEvent<Date | null>;
|
|
42
|
-
} & {
|
|
43
|
-
[evt: string]: CustomEvent<any>;
|
|
44
|
-
}, {}, {}, string>;
|
|
45
|
-
type InputDate = InstanceType<typeof InputDate>;
|
|
46
|
-
export default InputDate;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { FormEventHandler, HTMLInputAttributes } from 'svelte/elements'
|
|
3
|
-
import { USE_COERCE_DATE } from '../../utils/constant.js'
|
|
4
|
-
import { FormControl, type InputProps } from './index.js'
|
|
5
|
-
import { createEventDispatcher } from 'svelte'
|
|
6
|
-
import dayjs from 'dayjs'
|
|
7
|
-
|
|
8
|
-
type $$Props = InputProps<Date | null | undefined>
|
|
9
|
-
export let value: Date | null | undefined = undefined
|
|
10
|
-
export let input: HTMLInputAttributes = {}
|
|
11
|
-
$: ({ class: inputClass = '', ...inputProps } = input)
|
|
12
|
-
|
|
13
|
-
const dispatch = createEventDispatcher<{ input: Date | null }>()
|
|
14
|
-
|
|
15
|
-
const handleInput: FormEventHandler<HTMLInputElement> = ({ currentTarget }) => {
|
|
16
|
-
value = getDateTime(currentTarget.value)
|
|
17
|
-
dispatch('input', value)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function getDateTime(v: string | null | undefined): Date | null {
|
|
21
|
-
if (typeof v !== 'string') return null
|
|
22
|
-
return new Date(v)
|
|
23
|
-
}
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<FormControl {...$$restProps}>
|
|
27
|
-
{#snippet children({ key })}
|
|
28
|
-
<input
|
|
29
|
-
value={value && dayjs(value).format('YYYY-MM-DDTHH:mm')}
|
|
30
|
-
on:input={handleInput}
|
|
31
|
-
on:focus
|
|
32
|
-
on:blur
|
|
33
|
-
type="datetime-local"
|
|
34
|
-
id={key}
|
|
35
|
-
class="input input-bordered {inputClass}"
|
|
36
|
-
{...inputProps}
|
|
37
|
-
/>
|
|
38
|
-
|
|
39
|
-
<input type="hidden" name={key} value="{USE_COERCE_DATE}{value?.toJSON()}" />
|
|
40
|
-
{/snippet}
|
|
41
|
-
</FormControl>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type InputProps } from './index.js';
|
|
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;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const InputDateTime: $$__sveltets_2_IsomorphicComponent<InputProps<Date | null | undefined>, {
|
|
16
|
-
focus: FocusEvent;
|
|
17
|
-
blur: FocusEvent;
|
|
18
|
-
input: CustomEvent<Date | null>;
|
|
19
|
-
} & {
|
|
20
|
-
[evt: string]: CustomEvent<any>;
|
|
21
|
-
}, {}, {}, string>;
|
|
22
|
-
type InputDateTime = InstanceType<typeof InputDateTime>;
|
|
23
|
-
export default InputDateTime;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
<script lang="ts" context="module">
|
|
2
|
-
export type Crop = { width: number; height: number; x: number; y: number }
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import { onMount, createEventDispatcher } from 'svelte'
|
|
7
|
-
import Cropper from 'svelte-easy-crop'
|
|
8
|
-
import { mdiTrayArrowUp } from '@mdi/js'
|
|
9
|
-
|
|
10
|
-
import type { TippyInstance } from '../../utils/tippy.js'
|
|
11
|
-
import { Icon } from '../icon/index.js'
|
|
12
|
-
import { DropDown } from '../menu/index.js'
|
|
13
|
-
import { Dialog } from '../dialog/index.js'
|
|
14
|
-
|
|
15
|
-
export let aspect = 1
|
|
16
|
-
export let title = 'Image'
|
|
17
|
-
export let formaction: string | undefined = undefined
|
|
18
|
-
export let key = ''
|
|
19
|
-
let dialog: HTMLDialogElement
|
|
20
|
-
let tip: TippyInstance
|
|
21
|
-
let image = ''
|
|
22
|
-
let crop: Crop | undefined = undefined
|
|
23
|
-
let inputFile: HTMLInputElement
|
|
24
|
-
|
|
25
|
-
const dispatch = createEventDispatcher<{ submit: { crop: Crop; image: string } }>()
|
|
26
|
-
|
|
27
|
-
function onFileSelected() {
|
|
28
|
-
if (!inputFile.files) return
|
|
29
|
-
const file = inputFile.files[0]
|
|
30
|
-
const reader = new FileReader()
|
|
31
|
-
reader.onload = ({ target }) => {
|
|
32
|
-
image = (target?.result || '') as string
|
|
33
|
-
dialog?.showModal()
|
|
34
|
-
}
|
|
35
|
-
reader.readAsDataURL(file)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function close() {
|
|
39
|
-
tip?.hide()
|
|
40
|
-
dialog?.close()
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
onMount(() => {
|
|
44
|
-
if (!$$slots.actions) tip.disable()
|
|
45
|
-
})
|
|
46
|
-
function handleClickActivator() {
|
|
47
|
-
if (!$$slots.actions) inputFile.click()
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function handleValidation() {
|
|
51
|
-
close()
|
|
52
|
-
if (crop && image) dispatch('submit', { crop, image })
|
|
53
|
-
}
|
|
54
|
-
</script>
|
|
55
|
-
|
|
56
|
-
<DropDown tippyProps={{ arrow: true }} hideOnBlur bind:tip>
|
|
57
|
-
<button
|
|
58
|
-
slot="activator"
|
|
59
|
-
type="button"
|
|
60
|
-
class="block overflow-hidden rounded-lg transition-shadow hover:shadow-lg"
|
|
61
|
-
on:click={handleClickActivator}
|
|
62
|
-
>
|
|
63
|
-
<slot>image</slot>
|
|
64
|
-
</button>
|
|
65
|
-
{#if $$slots.actions}
|
|
66
|
-
<div class="flex flex-col">
|
|
67
|
-
<button
|
|
68
|
-
type="button"
|
|
69
|
-
class="menu-item relative"
|
|
70
|
-
on:click={() => {
|
|
71
|
-
inputFile.click()
|
|
72
|
-
}}
|
|
73
|
-
>
|
|
74
|
-
<Icon path={mdiTrayArrowUp} class="opacity-70" size={20} />
|
|
75
|
-
<span>Charger une image</span>
|
|
76
|
-
</button>
|
|
77
|
-
<slot name="actions" />
|
|
78
|
-
</div>
|
|
79
|
-
{/if}
|
|
80
|
-
</DropDown>
|
|
81
|
-
|
|
82
|
-
<Dialog bind:dialog>
|
|
83
|
-
<h2 slot="header" class="card-title">
|
|
84
|
-
{title}
|
|
85
|
-
</h2>
|
|
86
|
-
|
|
87
|
-
<div class="relative aspect-square overflow-hidden rounded-lg">
|
|
88
|
-
<Cropper
|
|
89
|
-
{image}
|
|
90
|
-
{aspect}
|
|
91
|
-
showGrid={false}
|
|
92
|
-
zoomSpeed={0.2}
|
|
93
|
-
on:cropcomplete={(e) => (crop = e.detail.pixels)}
|
|
94
|
-
/>
|
|
95
|
-
</div>
|
|
96
|
-
<div class="mt-2 flex justify-end">
|
|
97
|
-
<input type="hidden" name="{key ? `${key}_` : ''}crop" value={JSON.stringify(crop)} />
|
|
98
|
-
<input
|
|
99
|
-
class="hidden"
|
|
100
|
-
type="file"
|
|
101
|
-
name="{key ? `${key}_` : ''}image"
|
|
102
|
-
accept="image/jpeg, image/png, image/webp, image/gif, image/avif, image/tiff"
|
|
103
|
-
bind:this={inputFile}
|
|
104
|
-
on:change={onFileSelected}
|
|
105
|
-
/>
|
|
106
|
-
|
|
107
|
-
<button
|
|
108
|
-
{formaction}
|
|
109
|
-
type={formaction ? 'submit' : 'button'}
|
|
110
|
-
class="btn btn-primary"
|
|
111
|
-
on:click={handleValidation}
|
|
112
|
-
>
|
|
113
|
-
Valider
|
|
114
|
-
</button>
|
|
115
|
-
</div>
|
|
116
|
-
</Dialog>
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export type Crop = {
|
|
2
|
-
width: number;
|
|
3
|
-
height: number;
|
|
4
|
-
x: number;
|
|
5
|
-
y: number;
|
|
6
|
-
};
|
|
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> {
|
|
8
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
9
|
-
$$bindings?: Bindings;
|
|
10
|
-
} & Exports;
|
|
11
|
-
(internal: unknown, props: Props & {
|
|
12
|
-
$$events?: Events;
|
|
13
|
-
$$slots?: Slots;
|
|
14
|
-
}): Exports & {
|
|
15
|
-
$set?: any;
|
|
16
|
-
$on?: any;
|
|
17
|
-
};
|
|
18
|
-
z_$$bindings?: Bindings;
|
|
19
|
-
}
|
|
20
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
21
|
-
default: any;
|
|
22
|
-
} ? Props extends Record<string, never> ? any : {
|
|
23
|
-
children?: any;
|
|
24
|
-
} : {});
|
|
25
|
-
declare const InputImage: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
26
|
-
aspect?: number;
|
|
27
|
-
title?: string;
|
|
28
|
-
formaction?: string | undefined;
|
|
29
|
-
key?: string;
|
|
30
|
-
close?: () => void;
|
|
31
|
-
}, {
|
|
32
|
-
default: {};
|
|
33
|
-
actions: {};
|
|
34
|
-
}>, {
|
|
35
|
-
submit: CustomEvent<{
|
|
36
|
-
crop: Crop;
|
|
37
|
-
image: string;
|
|
38
|
-
}>;
|
|
39
|
-
} & {
|
|
40
|
-
[evt: string]: CustomEvent<any>;
|
|
41
|
-
}, {
|
|
42
|
-
default: {};
|
|
43
|
-
actions: {};
|
|
44
|
-
}, {
|
|
45
|
-
close: () => void;
|
|
46
|
-
}, string>;
|
|
47
|
-
type InputImage = InstanceType<typeof InputImage>;
|
|
48
|
-
export default InputImage;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { InputImage, type Crop } from './index.js'
|
|
3
|
-
import { PlaceholderImage } from '../placeholder/index.js'
|
|
4
|
-
|
|
5
|
-
export let key = ''
|
|
6
|
-
export let src = ''
|
|
7
|
-
export let alt = ''
|
|
8
|
-
let klass = ''
|
|
9
|
-
export { klass as class }
|
|
10
|
-
export let title = 'Image'
|
|
11
|
-
export let x: number
|
|
12
|
-
export let y: number
|
|
13
|
-
export let aspect = x / y
|
|
14
|
-
|
|
15
|
-
let crop: Crop | null = null
|
|
16
|
-
let image = ''
|
|
17
|
-
let scale = 0
|
|
18
|
-
let preview: HTMLImageElement
|
|
19
|
-
|
|
20
|
-
async function handleSubmit(detail: { crop: Crop; image: string }) {
|
|
21
|
-
crop = detail.crop
|
|
22
|
-
image = detail.image
|
|
23
|
-
scale = x / crop.width
|
|
24
|
-
}
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<InputImage {key} {title} {aspect} on:submit={({ detail }) => handleSubmit(detail)}>
|
|
28
|
-
{#if crop && image}
|
|
29
|
-
<div
|
|
30
|
-
class="relative overflow-hidden rounded-lg border"
|
|
31
|
-
style:width="{x}px"
|
|
32
|
-
style:height="{y}px"
|
|
33
|
-
>
|
|
34
|
-
<img
|
|
35
|
-
src={image}
|
|
36
|
-
alt="preview"
|
|
37
|
-
bind:this={preview}
|
|
38
|
-
class="absolute max-w-none"
|
|
39
|
-
style:margin="-{scale * crop.y}px 0 0 -{scale * crop.x}px"
|
|
40
|
-
style:width="{scale * preview?.naturalWidth}px"
|
|
41
|
-
style:height="{scale * preview?.naturalHeight}px"
|
|
42
|
-
/>
|
|
43
|
-
</div>
|
|
44
|
-
{:else if src}
|
|
45
|
-
<div class="group relative">
|
|
46
|
-
<span
|
|
47
|
-
class="
|
|
48
|
-
absolute inset-px grid
|
|
49
|
-
place-content-center rounded-lg bg-base-300/30
|
|
50
|
-
font-medium opacity-0 backdrop-blur-sm transition-opacity group-hover:opacity-100
|
|
51
|
-
"
|
|
52
|
-
>
|
|
53
|
-
{title}
|
|
54
|
-
</span>
|
|
55
|
-
<img class="{klass} rounded-lg border" {src} {alt} width={x} height={y} />
|
|
56
|
-
</div>
|
|
57
|
-
{:else}
|
|
58
|
-
<PlaceholderImage {x} {y}>{title}</PlaceholderImage>
|
|
59
|
-
{/if}
|
|
60
|
-
</InputImage>
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
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
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: Props & {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const InputImagePreview: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
-
key?: string;
|
|
16
|
-
src?: string;
|
|
17
|
-
alt?: string;
|
|
18
|
-
class?: string;
|
|
19
|
-
title?: string;
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
aspect?: number;
|
|
23
|
-
}, {
|
|
24
|
-
[evt: string]: CustomEvent<any>;
|
|
25
|
-
}, {}, {}, string>;
|
|
26
|
-
type InputImagePreview = InstanceType<typeof InputImagePreview>;
|
|
27
|
-
export default InputImagePreview;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { USE_COERCE_NUMBER } from '../../utils/constant.js'
|
|
3
|
-
import { FormControl, type InputProps } from './index.js'
|
|
4
|
-
import type { HTMLInputAttributes } from 'svelte/elements'
|
|
5
|
-
|
|
6
|
-
type $$Props = InputProps<number>
|
|
7
|
-
|
|
8
|
-
export let value: number | null | undefined = undefined
|
|
9
|
-
export let input: HTMLInputAttributes | undefined = undefined
|
|
10
|
-
export let inputElement: HTMLInputElement | undefined = undefined
|
|
11
|
-
</script>
|
|
12
|
-
|
|
13
|
-
<FormControl {...$$restProps}>
|
|
14
|
-
{#snippet children({ key })}
|
|
15
|
-
<input
|
|
16
|
-
bind:value
|
|
17
|
-
bind:this={inputElement}
|
|
18
|
-
on:input
|
|
19
|
-
on:focus
|
|
20
|
-
on:blur
|
|
21
|
-
type="number"
|
|
22
|
-
id={key}
|
|
23
|
-
inputmode="numeric"
|
|
24
|
-
class="input input-bordered"
|
|
25
|
-
{...input}
|
|
26
|
-
/>
|
|
27
|
-
{#if value !== undefined}
|
|
28
|
-
<input type="hidden" name={key} value="{USE_COERCE_NUMBER}{value}" />
|
|
29
|
-
{/if}
|
|
30
|
-
{/snippet}
|
|
31
|
-
</FormControl>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type InputProps } from './index.js';
|
|
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;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const InputNumber: $$__sveltets_2_IsomorphicComponent<InputProps<number>, {
|
|
16
|
-
input: Event;
|
|
17
|
-
focus: FocusEvent;
|
|
18
|
-
blur: FocusEvent;
|
|
19
|
-
} & {
|
|
20
|
-
[evt: string]: CustomEvent<any>;
|
|
21
|
-
}, {}, {}, string>;
|
|
22
|
-
type InputNumber = InstanceType<typeof InputNumber>;
|
|
23
|
-
export default InputNumber;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { Icon } from '../icon/index.js'
|
|
3
|
-
import { parseOptions, type Options } from '../../utils/options.js'
|
|
4
|
-
import { urlParam } from '../../store/param.js'
|
|
5
|
-
|
|
6
|
-
let klass = ''
|
|
7
|
-
export { klass as class }
|
|
8
|
-
export let key: string
|
|
9
|
-
export let options: Options
|
|
10
|
-
export let removeKeys: string[] = []
|
|
11
|
-
|
|
12
|
-
$: _options = parseOptions(options)
|
|
13
|
-
</script>
|
|
14
|
-
|
|
15
|
-
<div class="join {klass}">
|
|
16
|
-
{#each _options as opt}
|
|
17
|
-
{@const active = $urlParam.hasValue(key, opt.value)}
|
|
18
|
-
<a
|
|
19
|
-
href={$urlParam.toggle({ [key]: opt.value }, ...removeKeys)}
|
|
20
|
-
class="btn join-item btn-sm"
|
|
21
|
-
class:btn-primary={active}
|
|
22
|
-
class:w-9={opt.icon}
|
|
23
|
-
>
|
|
24
|
-
{#if opt.icon}
|
|
25
|
-
<Icon
|
|
26
|
-
path={opt.icon}
|
|
27
|
-
title={opt.label}
|
|
28
|
-
class={active ? 'fill-primary-content' : 'opacity-70'}
|
|
29
|
-
size={20}
|
|
30
|
-
/>
|
|
31
|
-
{:else}
|
|
32
|
-
{opt.label}
|
|
33
|
-
{/if}
|
|
34
|
-
</a>
|
|
35
|
-
{/each}
|
|
36
|
-
</div>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type Options } from '../../utils/options.js';
|
|
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;
|
|
12
|
-
};
|
|
13
|
-
z_$$bindings?: Bindings;
|
|
14
|
-
}
|
|
15
|
-
declare const InputOptionInParam: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
-
class?: string;
|
|
17
|
-
key: string;
|
|
18
|
-
options: Options;
|
|
19
|
-
removeKeys?: string[];
|
|
20
|
-
}, {
|
|
21
|
-
[evt: string]: CustomEvent<any>;
|
|
22
|
-
}, {}, {}, string>;
|
|
23
|
-
type InputOptionInParam = InstanceType<typeof InputOptionInParam>;
|
|
24
|
-
export default InputOptionInParam;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { slide } from 'svelte/transition'
|
|
3
|
-
import { mdiPlus, mdiTrashCanOutline } from '@mdi/js'
|
|
4
|
-
import { toast } from 'svelte-sonner'
|
|
5
|
-
|
|
6
|
-
import { Icon } from '../icon/index.js'
|
|
7
|
-
import { listEditable } from '../../action/list/index.js'
|
|
8
|
-
|
|
9
|
-
export let key: string
|
|
10
|
-
export let value: string | undefined | null = '[]'
|
|
11
|
-
|
|
12
|
-
let options: string[] = JSON.parse(value || '[]')
|
|
13
|
-
let newOption = ''
|
|
14
|
-
let optionInput: HTMLInputElement
|
|
15
|
-
|
|
16
|
-
function handleKeyDown(e: KeyboardEvent) {
|
|
17
|
-
if (e.key === 'Enter') {
|
|
18
|
-
e.preventDefault()
|
|
19
|
-
createOption()
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function createOption() {
|
|
24
|
-
if (!newOption) return
|
|
25
|
-
if (options.includes(newOption)) return toast.warning('Cette option éxiste déjà !')
|
|
26
|
-
options = [...options, newOption]
|
|
27
|
-
newOption = ''
|
|
28
|
-
value = JSON.stringify(options)
|
|
29
|
-
optionInput.focus()
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function removeOption(index: number) {
|
|
33
|
-
options = [...options.slice(0, index), ...options.slice(index + 1)]
|
|
34
|
-
value = JSON.stringify(options)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function onChange(newOrder: string[]) {
|
|
38
|
-
options = newOrder
|
|
39
|
-
value = JSON.stringify(options)
|
|
40
|
-
}
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<input type="hidden" name={key} {value} />
|
|
44
|
-
|
|
45
|
-
<div class="label">
|
|
46
|
-
<span class="label-text">Options</span>
|
|
47
|
-
</div>
|
|
48
|
-
|
|
49
|
-
<div class="bordered rounded-box border p-2">
|
|
50
|
-
<div use:listEditable={{ items: options, onChange }}>
|
|
51
|
-
{#each options as option, index (option)}
|
|
52
|
-
<div class="flex items-center gap-2" transition:slide={{ duration: 200 }}>
|
|
53
|
-
<div class="grow pl-4">
|
|
54
|
-
{option}
|
|
55
|
-
</div>
|
|
56
|
-
<button
|
|
57
|
-
type="button"
|
|
58
|
-
class="btn btn-square btn-ghost btn-sm"
|
|
59
|
-
on:click={() => removeOption(index)}
|
|
60
|
-
>
|
|
61
|
-
<Icon path={mdiTrashCanOutline} size={20} class="fill-error" />
|
|
62
|
-
</button>
|
|
63
|
-
</div>
|
|
64
|
-
{/each}
|
|
65
|
-
</div>
|
|
66
|
-
|
|
67
|
-
<div class="join flex pt-2">
|
|
68
|
-
<input
|
|
69
|
-
bind:this={optionInput}
|
|
70
|
-
type="text"
|
|
71
|
-
placeholder="Nouvelle option"
|
|
72
|
-
class="input join-item input-bordered grow"
|
|
73
|
-
bind:value={newOption}
|
|
74
|
-
on:keydown={handleKeyDown}
|
|
75
|
-
/>
|
|
76
|
-
<button
|
|
77
|
-
type="button"
|
|
78
|
-
class="btn btn-square join-item"
|
|
79
|
-
disabled={!newOption}
|
|
80
|
-
on:click={createOption}
|
|
81
|
-
>
|
|
82
|
-
<Icon path={mdiPlus} title="Ajouter" />
|
|
83
|
-
</button>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|