@motifx-community/ui 0.1.0-beta.1 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +147 -8
- package/README.md +19 -13
- package/dist/components/accordion/Accordion.d.ts +3 -3
- package/dist/components/accordion/AccordionItem.d.ts +1 -1
- package/dist/components/calendar/Calendar.d.ts +12 -0
- package/dist/components/calendar/calendar-props.d.ts +5 -0
- package/dist/components/card/Card.d.ts +1 -1
- package/dist/components/contextmenu/ContextMenu.d.ts +1 -1
- package/dist/components/datagrid/DataGrid.d.ts +5 -5
- package/dist/components/datagrid/data-grid-props.d.ts +2 -2
- package/dist/components/datagrid/grid-adaptive-row-expanded-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-adaptive-row-expanding-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-grouping-changed-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-grouping-changing-event-args.d.ts +2 -2
- package/dist/components/datagrid/grid-master-detail.d.ts +1 -1
- package/dist/components/datagrid/grid-row-expanded-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-row-expanding-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-search-text-changed-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-search-text-changing-event-args.d.ts +1 -1
- package/dist/components/datagrid/grid-sort-changing-event-args.d.ts +1 -1
- package/dist/components/datagrid/model/GridSearch.d.ts +1 -1
- package/dist/components/daterangebox/DateRangeBox.d.ts +121 -0
- package/dist/components/daterangebox/date-range-box-props.d.ts +35 -0
- package/dist/components/daterangebox/date-range-preset.d.ts +6 -0
- package/dist/components/daterangebox/date-range.d.ts +2 -0
- package/dist/components/daterangebox/index.d.ts +4 -0
- package/dist/components/draggable/Draggable.d.ts +99 -0
- package/dist/components/draggable/DropTarget.d.ts +38 -0
- package/dist/components/draggable/draggable-event-args.d.ts +17 -0
- package/dist/components/draggable/draggable-props.d.ts +37 -0
- package/dist/components/draggable/drop-event-args.d.ts +11 -0
- package/dist/components/draggable/drop-target-props.d.ts +13 -0
- package/dist/components/draggable/index.d.ts +6 -0
- package/dist/components/fileuploader/FileUploader.d.ts +133 -0
- package/dist/components/fileuploader/file-uploader-props.d.ts +46 -0
- package/dist/components/fileuploader/files-added-event-args.d.ts +9 -0
- package/dist/components/fileuploader/index.d.ts +7 -0
- package/dist/components/fileuploader/upload-event-args.d.ts +10 -0
- package/dist/components/fileuploader/upload-item.d.ts +12 -0
- package/dist/components/fileuploader/upload-mode.d.ts +2 -0
- package/dist/components/fileuploader/upload-status.d.ts +2 -0
- package/dist/components/filterbuilder/FilterBuilder.d.ts +1 -1
- package/dist/components/gallery/Gallery.d.ts +132 -0
- package/dist/components/gallery/gallery-item-click-event-args.d.ts +9 -0
- package/dist/components/gallery/gallery-item.d.ts +18 -0
- package/dist/components/gallery/gallery-props.d.ts +38 -0
- package/dist/components/gallery/index.d.ts +6 -0
- package/dist/components/gallery/slide-changed-event-args.d.ts +11 -0
- package/dist/components/gallery/slide-changing-event-args.d.ts +14 -0
- package/dist/components/layout/ChildSettings.d.ts +1 -1
- package/dist/components/layout/DockPanel.d.ts +2 -2
- package/dist/components/layout/Grid.d.ts +1 -1
- package/dist/components/layout/SplitContainer.d.ts +1 -1
- package/dist/components/layout/Stack.d.ts +1 -1
- package/dist/components/loadpanel/LoadPanel.d.ts +70 -0
- package/dist/components/loadpanel/index.d.ts +3 -0
- package/dist/components/loadpanel/load-panel-props.d.ts +29 -0
- package/dist/components/loadpanel/load-panel-target.d.ts +3 -0
- package/dist/components/multiview/MultiView.d.ts +87 -0
- package/dist/components/multiview/View.d.ts +41 -0
- package/dist/components/multiview/index.d.ts +6 -0
- package/dist/components/multiview/multi-view-props.d.ts +24 -0
- package/dist/components/multiview/view-props.d.ts +15 -0
- package/dist/components/multiview/view-selecting-event-args.d.ts +15 -0
- package/dist/components/multiview/view-selection-changed-event-args.d.ts +12 -0
- package/dist/components/numberbox/number-box-props.d.ts +1 -1
- package/dist/components/popover/Popover.d.ts +98 -0
- package/dist/components/popover/index.d.ts +5 -0
- package/dist/components/popover/popover-close-reason.d.ts +2 -0
- package/dist/components/popover/popover-closing-event-args.d.ts +8 -0
- package/dist/components/popover/popover-props.d.ts +39 -0
- package/dist/components/popover/popover-show-on.d.ts +2 -0
- package/dist/components/resizable/Resizable.d.ts +84 -0
- package/dist/components/resizable/index.d.ts +3 -0
- package/dist/components/resizable/resizable-props.d.ts +41 -0
- package/dist/components/resizable/resize-event-args.d.ts +13 -0
- package/dist/components/scheduler/AppointmentEditor.d.ts +1 -1
- package/dist/components/scheduler/scheduler-props.d.ts +1 -1
- package/dist/components/scrollview/ScrollView.d.ts +109 -0
- package/dist/components/scrollview/index.d.ts +7 -0
- package/dist/components/scrollview/pull-down-event-args.d.ts +9 -0
- package/dist/components/scrollview/reach-bottom-event-args.d.ts +9 -0
- package/dist/components/scrollview/scroll-event-args.d.ts +7 -0
- package/dist/components/scrollview/scroll-view-bars.d.ts +2 -0
- package/dist/components/scrollview/scroll-view-direction.d.ts +2 -0
- package/dist/components/scrollview/scroll-view-props.d.ts +31 -0
- package/dist/components/skeleton/Skeleton.d.ts +1 -1
- package/dist/components/sortable/Sortable.d.ts +106 -0
- package/dist/components/sortable/index.d.ts +5 -0
- package/dist/components/sortable/sortable-drag-event-args.d.ts +15 -0
- package/dist/components/sortable/sortable-drop-event-args.d.ts +11 -0
- package/dist/components/sortable/sortable-orientation.d.ts +2 -0
- package/dist/components/sortable/sortable-props.d.ts +34 -0
- package/dist/components/speeddial/SpeedDial.d.ts +129 -0
- package/dist/components/speeddial/index.d.ts +6 -0
- package/dist/components/speeddial/speed-dial-action-click-event-args.d.ts +9 -0
- package/dist/components/speeddial/speed-dial-action.d.ts +25 -0
- package/dist/components/speeddial/speed-dial-event-args.d.ts +8 -0
- package/dist/components/speeddial/speed-dial-props.d.ts +49 -0
- package/dist/components/speeddial/speed-dial-tooltip.d.ts +3 -0
- package/dist/components/splitter/SplitPane.d.ts +45 -0
- package/dist/components/splitter/Splitter.d.ts +116 -0
- package/dist/components/splitter/index.d.ts +6 -0
- package/dist/components/splitter/split-pane-props.d.ts +21 -0
- package/dist/components/splitter/splitter-collapse-event-args.d.ts +13 -0
- package/dist/components/splitter/splitter-props.d.ts +25 -0
- package/dist/components/splitter/splitter-resize-event-args.d.ts +10 -0
- package/dist/components/stepper/Stepper.d.ts +121 -0
- package/dist/components/stepper/Wizard.d.ts +112 -0
- package/dist/components/stepper/WizardStep.d.ts +44 -0
- package/dist/components/stepper/index.d.ts +13 -0
- package/dist/components/stepper/step-changed-event-args.d.ts +11 -0
- package/dist/components/stepper/step-changing-event-args.d.ts +18 -0
- package/dist/components/stepper/stepper-item.d.ts +20 -0
- package/dist/components/stepper/stepper-label-position.d.ts +2 -0
- package/dist/components/stepper/stepper-orientation.d.ts +1 -0
- package/dist/components/stepper/stepper-props.d.ts +32 -0
- package/dist/components/stepper/stepper-status.d.ts +2 -0
- package/dist/components/stepper/wizard-finishing-event-args.d.ts +7 -0
- package/dist/components/stepper/wizard-props.d.ts +48 -0
- package/dist/components/stepper/wizard-step-props.d.ts +32 -0
- package/dist/components/tabdocs/TabDocumentManager.d.ts +1 -1
- package/dist/components/tabs/Tabs.d.ts +2 -2
- package/dist/components/tileview/TileView.d.ts +128 -0
- package/dist/components/tileview/index.d.ts +6 -0
- package/dist/components/tileview/tile-click-event-args.d.ts +9 -0
- package/dist/components/tileview/tile-reorder-event-args.d.ts +11 -0
- package/dist/components/tileview/tile-selection-changed-event-args.d.ts +11 -0
- package/dist/components/tileview/tile-view-item.d.ts +18 -0
- package/dist/components/tileview/tile-view-props.d.ts +38 -0
- package/dist/components/timeline/Timeline.d.ts +113 -0
- package/dist/components/timeline/index.d.ts +5 -0
- package/dist/components/timeline/timeline-item-click-event-args.d.ts +9 -0
- package/dist/components/timeline/timeline-item.d.ts +24 -0
- package/dist/components/timeline/timeline-props.d.ts +30 -0
- package/dist/components/timeline/timeline-selection-changed-event-args.d.ts +11 -0
- package/dist/components/tooltip/Tooltip.d.ts +1 -1
- package/dist/components/treeview/TreeView.d.ts +1 -1
- package/dist/components/validationsummary/ValidationSummary.d.ts +56 -0
- package/dist/components/validationsummary/index.d.ts +3 -0
- package/dist/components/validationsummary/summary-item-click-event-args.d.ts +11 -0
- package/dist/components/validationsummary/validation-summary-props.d.ts +17 -0
- package/dist/core/control.d.ts +4 -4
- package/dist/core/flow-home.d.ts +6 -0
- package/dist/core/fold-text.d.ts +6 -0
- package/dist/core/ui-locale.d.ts +0 -2
- package/dist/core/ui-strings.d.ts +67 -0
- package/dist/generated/tokens.d.ts +7270 -4490
- package/dist/index.d.ts +17 -1
- package/dist/index.js +27131 -20490
- package/dist/index.js.map +1 -1
- package/dist/locales/en.json +59 -1
- package/dist/locales/tr.json +59 -1
- package/dist/parts/slide/slide-track-host.d.ts +19 -0
- package/dist/parts/slide/slide-track.d.ts +45 -0
- package/dist/styles.css +4916 -206
- package/dist/tokens/index.d.ts +7270 -4490
- package/dist/tokens/index.js +7270 -4490
- package/dist/tokens/index.js.map +1 -1
- package/dist/tr-C5IXRzAH.js +1233 -0
- package/dist/tr-C5IXRzAH.js.map +1 -0
- package/docs/accordion.md +9 -9
- package/docs/actionsheet.md +2 -2
- package/docs/avatar.md +5 -5
- package/docs/badge.md +6 -6
- package/docs/bottomsheet.md +6 -6
- package/docs/breadcrumb.md +4 -4
- package/docs/button.md +10 -10
- package/docs/buttongroup.md +5 -5
- package/docs/calendar.md +6 -6
- package/docs/card.md +6 -6
- package/docs/checkbox.md +9 -9
- package/docs/chip.md +5 -5
- package/docs/colorbox.md +3 -3
- package/docs/combobox.md +7 -7
- package/docs/control.md +12 -12
- package/docs/datagrid-api.md +7 -7
- package/docs/datagrid-bands.md +1 -1
- package/docs/datagrid-drag-select.md +2 -2
- package/docs/datagrid-drag.md +1 -1
- package/docs/datagrid-editing.md +2 -2
- package/docs/datagrid-filtering.md +3 -3
- package/docs/datagrid-forms.md +1 -1
- package/docs/datagrid-grouping.md +1 -1
- package/docs/datagrid-layout.md +4 -4
- package/docs/datagrid-lookups.md +1 -1
- package/docs/datagrid-master-detail.md +3 -3
- package/docs/datagrid-scrolling.md +1 -1
- package/docs/datagrid-selection.md +3 -3
- package/docs/datagrid.md +8 -8
- package/docs/datebox.md +8 -8
- package/docs/daterangebox.md +192 -0
- package/docs/draggable.md +194 -0
- package/docs/drawer.md +1 -1
- package/docs/dropdown.md +10 -10
- package/docs/fileuploader.md +201 -0
- package/docs/filterbuilder.md +9 -9
- package/docs/formlayout.md +1 -1
- package/docs/gallery.md +244 -0
- package/docs/home.md +11 -7
- package/docs/keyboard.md +1 -1
- package/docs/language.md +229 -0
- package/docs/layout.md +15 -15
- package/docs/listbox.md +10 -10
- package/docs/loadpanel.md +184 -0
- package/docs/lookup.md +1 -1
- package/docs/menus.md +2 -2
- package/docs/multiview.md +202 -0
- package/docs/numberbox.md +9 -9
- package/docs/pagination.md +4 -4
- package/docs/popover.md +221 -0
- package/docs/progress.md +9 -9
- package/docs/radiogroup.md +7 -7
- package/docs/rating.md +4 -4
- package/docs/resizable.md +139 -0
- package/docs/scheduler-agenda.md +1 -1
- package/docs/scheduler-big-data.md +1 -1
- package/docs/scheduler-editing.md +5 -5
- package/docs/scheduler-form.md +1 -1
- package/docs/scheduler-icalendar.md +1 -1
- package/docs/scheduler-mobile.md +1 -1
- package/docs/scheduler-recurrence.md +2 -2
- package/docs/scheduler-resources.md +1 -1
- package/docs/scheduler-timeline.md +1 -1
- package/docs/scheduler.md +4 -4
- package/docs/scrollview.md +185 -0
- package/docs/showcase.md +1 -1
- package/docs/skeleton.md +2 -2
- package/docs/slider.md +9 -9
- package/docs/sortable.md +213 -0
- package/docs/speeddial.md +290 -0
- package/docs/splitter.md +204 -0
- package/docs/stepper.md +238 -0
- package/docs/switch.md +7 -7
- package/docs/tabdocs-dock.md +3 -3
- package/docs/tabdocs-drag.md +1 -1
- package/docs/tabdocs-menus.md +1 -1
- package/docs/tabdocs-mobile.md +1 -1
- package/docs/tabdocs-tabs.md +1 -1
- package/docs/tabdocs-windows.md +1 -1
- package/docs/tabdocs-workspace.md +1 -1
- package/docs/tabdocs.md +5 -5
- package/docs/tabs.md +11 -11
- package/docs/tagbox.md +10 -10
- package/docs/textarea.md +9 -9
- package/docs/textbox.md +10 -10
- package/docs/tileview.md +206 -0
- package/docs/timeline.md +174 -0
- package/docs/toast.md +7 -7
- package/docs/tokens.md +678 -122
- package/docs/toolbar.md +8 -8
- package/docs/tooltip.md +12 -12
- package/docs/treeview.md +11 -11
- package/docs/validationsummary.md +115 -0
- package/docs/window.md +7 -7
- package/docs/wizard.md +240 -0
- package/llms-full.txt +4813 -492
- package/llms.txt +21 -3
- package/package.json +9 -3
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Emitter, type Bind, type Event as MotifEvent, type IBaseProp } from "@motifx/core";
|
|
2
|
+
import type { DateKind } from "../../parts/dates/date-kind";
|
|
3
|
+
import type { DatePattern } from "../../parts/dates/date-pattern";
|
|
4
|
+
import { Field } from "../../parts/field/Field";
|
|
5
|
+
import { OptionList } from "../../parts/list/OptionList";
|
|
6
|
+
import { InputMask } from "../../parts/mask/InputMask";
|
|
7
|
+
import { Popup } from "../../parts/popup/Popup";
|
|
8
|
+
import type { PopupCloseReason } from "../../parts/popup/popup-close-reason";
|
|
9
|
+
import type { ValidationRule } from "../../parts/validation/validation-rule";
|
|
10
|
+
import { Calendar } from "../calendar/Calendar";
|
|
11
|
+
import type { DateRange } from "./date-range";
|
|
12
|
+
import type { DateRangeBoxProps } from "./date-range-box-props";
|
|
13
|
+
import type { DateRangePreset } from "./date-range-preset";
|
|
14
|
+
interface Parts {
|
|
15
|
+
startInput: HTMLInputElement;
|
|
16
|
+
endInput: HTMLInputElement;
|
|
17
|
+
separator: HTMLSpanElement;
|
|
18
|
+
startMask: InputMask;
|
|
19
|
+
endMask: InputMask;
|
|
20
|
+
pattern: DatePattern;
|
|
21
|
+
unfinished: [boolean, boolean];
|
|
22
|
+
toggle: HTMLButtonElement | null;
|
|
23
|
+
popup: Popup | null;
|
|
24
|
+
calendars: Calendar[];
|
|
25
|
+
presetList: OptionList<DateRangePreset> | null;
|
|
26
|
+
stage: 0 | 1;
|
|
27
|
+
opened: Emitter<void>;
|
|
28
|
+
closed: Emitter<PopupCloseReason>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A start and an end date in one field: typed in the locale's order through two masks, or picked on the popup from
|
|
32
|
+
* two months side by side (the first pick the start, the second the end), from ready-made ranges (`presets`), with
|
|
33
|
+
* `min`, `max`, `disabledDates`, and the least and the most days a range may span (`minDays`, `maxDays`). The
|
|
34
|
+
* value is a `[start, end]` pair; `x-model` binds it.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* <DateRangeBox label="Stay" x-model={() => this.booking.nights} minDays={1} maxDays={30} presets />
|
|
38
|
+
* <DateRangeBox label="Report" type="datetime" calendars={1} />
|
|
39
|
+
*/
|
|
40
|
+
export declare class DateRangeBox extends Field<DateRange, DateRangeBoxProps> {
|
|
41
|
+
constructor(props?: IBaseProp<DateRangeBoxProps>);
|
|
42
|
+
get type(): Exclude<DateKind, 'time'>;
|
|
43
|
+
set type(value: Bind<Exclude<DateKind, 'time'>>);
|
|
44
|
+
get min(): Date | null;
|
|
45
|
+
set min(value: Bind<Date | null>);
|
|
46
|
+
get max(): Date | null;
|
|
47
|
+
set max(value: Bind<Date | null>);
|
|
48
|
+
get disabledDates(): ((date: Date) => boolean) | null;
|
|
49
|
+
set disabledDates(value: Bind<((date: Date) => boolean) | null>);
|
|
50
|
+
get minDays(): number | null;
|
|
51
|
+
set minDays(value: Bind<number | null>);
|
|
52
|
+
get maxDays(): number | null;
|
|
53
|
+
set maxDays(value: Bind<number | null>);
|
|
54
|
+
get locale(): string;
|
|
55
|
+
set locale(value: Bind<string>);
|
|
56
|
+
get displayFormat(): Intl.DateTimeFormatOptions | null;
|
|
57
|
+
set displayFormat(value: Bind<Intl.DateTimeFormatOptions | null>);
|
|
58
|
+
get startPlaceholder(): string;
|
|
59
|
+
set startPlaceholder(value: Bind<string>);
|
|
60
|
+
get endPlaceholder(): string;
|
|
61
|
+
set endPlaceholder(value: Bind<string>);
|
|
62
|
+
get clearButton(): boolean;
|
|
63
|
+
set clearButton(value: Bind<boolean>);
|
|
64
|
+
get showSeconds(): boolean;
|
|
65
|
+
set showSeconds(value: Bind<boolean>);
|
|
66
|
+
get firstDayOfWeek(): number | null;
|
|
67
|
+
set firstDayOfWeek(value: Bind<number | null>);
|
|
68
|
+
get showWeekNumbers(): boolean;
|
|
69
|
+
set showWeekNumbers(value: Bind<boolean>);
|
|
70
|
+
get showPickerButton(): boolean;
|
|
71
|
+
set showPickerButton(value: Bind<boolean>);
|
|
72
|
+
get calendars(): 1 | 2;
|
|
73
|
+
set calendars(value: Bind<1 | 2>);
|
|
74
|
+
get presets(): readonly DateRangePreset[] | boolean;
|
|
75
|
+
set presets(value: Bind<readonly DateRangePreset[] | boolean>);
|
|
76
|
+
get closeOnComplete(): boolean;
|
|
77
|
+
set closeOnComplete(value: Bind<boolean>);
|
|
78
|
+
/** The start, and the end, as properties of their own. */
|
|
79
|
+
get startDate(): Date | null;
|
|
80
|
+
set startDate(value: Date | null);
|
|
81
|
+
get endDate(): Date | null;
|
|
82
|
+
set endDate(value: Date | null);
|
|
83
|
+
/** The start's input; the end's is `endInputElement`. */
|
|
84
|
+
get inputElement(): HTMLInputElement;
|
|
85
|
+
get endInputElement(): HTMLInputElement;
|
|
86
|
+
/** A side's text is not a whole, real date yet. */
|
|
87
|
+
get unfinished(): boolean;
|
|
88
|
+
/** Whether the popup is open. Reactive. */
|
|
89
|
+
get opened(): boolean;
|
|
90
|
+
set opened(value: boolean);
|
|
91
|
+
get onOpened(): MotifEvent<void>;
|
|
92
|
+
get onClosed(): MotifEvent<PopupCloseReason>;
|
|
93
|
+
/** Opens the calendars; `false` when disabled or read-only. */
|
|
94
|
+
open(): boolean;
|
|
95
|
+
close(): void;
|
|
96
|
+
clear(): void;
|
|
97
|
+
protected createControl(): HTMLElement;
|
|
98
|
+
protected emptyValue(): DateRange;
|
|
99
|
+
protected normalizeValue(value: DateRange): DateRange;
|
|
100
|
+
protected sameValue(a: DateRange, b: DateRange): boolean;
|
|
101
|
+
protected isEmptyValue(value: DateRange): boolean;
|
|
102
|
+
protected renderValue(value: DateRange): void;
|
|
103
|
+
protected builtInRules(): ValidationRule<DateRange>[];
|
|
104
|
+
written(date: Date | null | undefined): string;
|
|
105
|
+
get rangeParts(): Parts;
|
|
106
|
+
renderPattern(): void;
|
|
107
|
+
renderNames(): void;
|
|
108
|
+
listen(): void;
|
|
109
|
+
typed(side: 0 | 1, e: Event): void;
|
|
110
|
+
showDisplayText(): void;
|
|
111
|
+
renderToggle(): void;
|
|
112
|
+
renderClear(): void;
|
|
113
|
+
createPopup(): Popup;
|
|
114
|
+
fillPopup(): void;
|
|
115
|
+
presetsNow(): DateRangePreset[];
|
|
116
|
+
followMonths(calendar: Calendar, index: number): void;
|
|
117
|
+
picked(day: Date, event?: Event): void;
|
|
118
|
+
pointed(day: Date | null): void;
|
|
119
|
+
syncPicker(): void;
|
|
120
|
+
}
|
|
121
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Bind } from '@motifx/core';
|
|
2
|
+
import type { DateKind } from '../../parts/dates/date-kind';
|
|
3
|
+
import type { FieldProps } from '../../parts/field/field-props';
|
|
4
|
+
import type { DateRange } from './date-range';
|
|
5
|
+
import type { DateRangePreset } from './date-range-preset';
|
|
6
|
+
/** Props of `DateRangeBox`: the field props (the value a `[start, end]` pair) plus its own. Each one is also a settable property. */
|
|
7
|
+
export interface DateRangeBoxProps extends FieldProps<DateRange> {
|
|
8
|
+
/** `'date'` (the default) or `'datetime'`: the time is typed after the date, the calendars keep it. */
|
|
9
|
+
type?: Bind<Exclude<DateKind, 'time'>>;
|
|
10
|
+
min?: Bind<Date | null>;
|
|
11
|
+
max?: Bind<Date | null>;
|
|
12
|
+
disabledDates?: Bind<((date: Date) => boolean) | null>;
|
|
13
|
+
/** The least and the most days a range may span (the end counted from the start). */
|
|
14
|
+
minDays?: Bind<number | null>;
|
|
15
|
+
maxDays?: Bind<number | null>;
|
|
16
|
+
/** Default: the kit's language. It decides the order of the parts and the names of months and days. */
|
|
17
|
+
locale?: Bind<string>;
|
|
18
|
+
/** How the dates are shown while the field is not being edited, e.g. `{ dateStyle: 'medium' }`. */
|
|
19
|
+
displayFormat?: Bind<Intl.DateTimeFormatOptions | null>;
|
|
20
|
+
/** Shown in an empty box: the start's, and the end's. */
|
|
21
|
+
startPlaceholder?: Bind<string>;
|
|
22
|
+
endPlaceholder?: Bind<string>;
|
|
23
|
+
clearButton?: Bind<boolean>;
|
|
24
|
+
showSeconds?: Bind<boolean>;
|
|
25
|
+
firstDayOfWeek?: Bind<number | null>;
|
|
26
|
+
showWeekNumbers?: Bind<boolean>;
|
|
27
|
+
/** The button that opens the calendars. Default `true`. */
|
|
28
|
+
showPickerButton?: Bind<boolean>;
|
|
29
|
+
/** How many months the popup shows side by side. Default `2`. */
|
|
30
|
+
calendars?: Bind<1 | 2>;
|
|
31
|
+
/** Ready-made ranges beside the calendars: `true` for the kit's (today, yesterday, the last 7 and 30 days, this and last month), your own, or none. Default `false`. */
|
|
32
|
+
presets?: Bind<readonly DateRangePreset[] | boolean>;
|
|
33
|
+
/** Closes the popup once both ends are chosen. Default `true`. */
|
|
34
|
+
closeOnComplete?: Bind<boolean>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Component, Emitter, type Bind, type Event as MotifEvent, type IBaseProp } from "@motifx/core";
|
|
2
|
+
import { Control } from "../../core/control";
|
|
3
|
+
import { DragGhost } from "../../parts/drag/DragGhost";
|
|
4
|
+
import type { DraggableEventArgs } from "./draggable-event-args";
|
|
5
|
+
import type { DragAxis, DraggableProps, DragPosition } from "./draggable-props";
|
|
6
|
+
import { DropTarget } from "./DropTarget";
|
|
7
|
+
interface Session {
|
|
8
|
+
pointerId: number;
|
|
9
|
+
touch: boolean;
|
|
10
|
+
startX: number;
|
|
11
|
+
startY: number;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
from: DragPosition;
|
|
15
|
+
started: boolean;
|
|
16
|
+
target: DropTarget | null;
|
|
17
|
+
refused: boolean;
|
|
18
|
+
timer: ReturnType<typeof setTimeout> | null;
|
|
19
|
+
rect: DOMRect | null;
|
|
20
|
+
bound: DOMRect | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Anything the user moves with the pointer, a finger (a long press) or the arrow keys: the JSX children in a box
|
|
24
|
+
* that follows the drag. It moves along `axis`, stays inside `boundary`, is taken by a `handle` only, or sends a
|
|
25
|
+
* `clone` after the pointer and stays where it is. A `DropTarget` of the same `group` under the pointer is told
|
|
26
|
+
* when it comes over, leaves and drops, with its `data`; what a drop does to your data is yours.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <Draggable boundary="parent" x-model={() => this.note.at}><Card>…</Card></Draggable>
|
|
30
|
+
* <Draggable clone group="cards" data={card} handle=".grip">…</Draggable>
|
|
31
|
+
*/
|
|
32
|
+
export declare class Draggable extends Control<HTMLDivElement, DraggableProps> {
|
|
33
|
+
starting: Emitter<DraggableEventArgs>;
|
|
34
|
+
dragging: Emitter<DraggableEventArgs>;
|
|
35
|
+
ending: Emitter<DraggableEventArgs>;
|
|
36
|
+
ended: Emitter<DraggableEventArgs>;
|
|
37
|
+
live: Component<HTMLSpanElement>;
|
|
38
|
+
ghost: DragGhost;
|
|
39
|
+
session: Session | null;
|
|
40
|
+
stops: (() => void)[];
|
|
41
|
+
pos: DragPosition;
|
|
42
|
+
handleEl: HTMLElement | null;
|
|
43
|
+
constructor(props?: IBaseProp<DraggableProps>);
|
|
44
|
+
get axis(): DragAxis;
|
|
45
|
+
set axis(value: Bind<DragAxis>);
|
|
46
|
+
get boundary(): 'parent' | HTMLElement | null;
|
|
47
|
+
set boundary(value: Bind<'parent' | HTMLElement | null>);
|
|
48
|
+
get handle(): string | null;
|
|
49
|
+
set handle(value: Bind<string | null>);
|
|
50
|
+
get clone(): boolean;
|
|
51
|
+
set clone(value: Bind<boolean>);
|
|
52
|
+
get group(): string | null;
|
|
53
|
+
set group(value: Bind<string | null>);
|
|
54
|
+
get data(): unknown;
|
|
55
|
+
set data(value: unknown);
|
|
56
|
+
get step(): number;
|
|
57
|
+
set step(value: Bind<number>);
|
|
58
|
+
get position(): DragPosition | null;
|
|
59
|
+
set position(value: Bind<DragPosition | null>);
|
|
60
|
+
/** `position`, for `x-model`. */
|
|
61
|
+
get value(): DragPosition | null;
|
|
62
|
+
set value(value: DragPosition | null);
|
|
63
|
+
/** A drag is about to begin; `cancel` keeps the draggable in place. */
|
|
64
|
+
get onDragStarting(): MotifEvent<DraggableEventArgs>;
|
|
65
|
+
/** It is being dragged (`x`, `y`, `target`). */
|
|
66
|
+
get onDragging(): MotifEvent<DraggableEventArgs>;
|
|
67
|
+
/** The pointer let go; `cancel` brings the draggable back where it started. */
|
|
68
|
+
get onDragEnding(): MotifEvent<DraggableEventArgs>;
|
|
69
|
+
/** The drag ended (`x`, `y`, `target`, `dropped`). */
|
|
70
|
+
get onDragEnded(): MotifEvent<DraggableEventArgs>;
|
|
71
|
+
/** Where it stands now, in pixels from where it was laid out. */
|
|
72
|
+
get currentPosition(): DragPosition;
|
|
73
|
+
/** Whether it is being dragged. */
|
|
74
|
+
get isDragging(): boolean;
|
|
75
|
+
/** The element that takes the press and the keys: the handle, else the draggable itself. */
|
|
76
|
+
get handleElement(): HTMLElement;
|
|
77
|
+
onBuilt(): void;
|
|
78
|
+
applyPosition(): void;
|
|
79
|
+
drawHandle(): void;
|
|
80
|
+
args(target: DropTarget | null, event?: Event): DraggableEventArgs;
|
|
81
|
+
dropArgs(target: DropTarget, event?: Event): {
|
|
82
|
+
draggable: Draggable;
|
|
83
|
+
data: unknown;
|
|
84
|
+
cancel: boolean;
|
|
85
|
+
source: DropTarget;
|
|
86
|
+
event?: Event;
|
|
87
|
+
};
|
|
88
|
+
boundRect(): DOMRect | null;
|
|
89
|
+
within(dx: number, dy: number, rect: DOMRect | null, bound: DOMRect | null): DragPosition;
|
|
90
|
+
pointerDown(e: PointerEvent): void;
|
|
91
|
+
pointerMove(e: PointerEvent): void;
|
|
92
|
+
pointerUp(e: PointerEvent): void;
|
|
93
|
+
start(e: PointerEvent): boolean;
|
|
94
|
+
track(e: PointerEvent): void;
|
|
95
|
+
end(e: Event | null, drop: boolean): void;
|
|
96
|
+
keyDown(e: KeyboardEvent): void;
|
|
97
|
+
announce(): void;
|
|
98
|
+
}
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Emitter, type Bind, type Event as MotifEvent, type IBaseProp } from "@motifx/core";
|
|
2
|
+
import { Control } from "../../core/control";
|
|
3
|
+
import type { DropEventArgs } from "./drop-event-args";
|
|
4
|
+
import type { DropTargetProps } from "./drop-target-props";
|
|
5
|
+
/** Every drop target on the page, for the draggables to find the one under the pointer. */
|
|
6
|
+
export declare const TARGETS: Set<DropTarget>;
|
|
7
|
+
/**
|
|
8
|
+
* A place a `Draggable` of its group can be dropped on: marked while a drag of the group is under way and while
|
|
9
|
+
* the draggable is over it; `onDragEntering` may refuse it, `onDropped` tells what was dropped, with its `data`. The JSX
|
|
10
|
+
* children are its content; what a drop does to your data is yours.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <DropTarget group="cards" onDropped={e => this.board.move(e.data as Card, 'done')}>…</DropTarget>
|
|
14
|
+
*/
|
|
15
|
+
export declare class DropTarget extends Control<HTMLDivElement, DropTargetProps> {
|
|
16
|
+
entered: Emitter<DropEventArgs>;
|
|
17
|
+
left: Emitter<DropEventArgs>;
|
|
18
|
+
dropped: Emitter<DropEventArgs>;
|
|
19
|
+
constructor(props?: IBaseProp<DropTargetProps>);
|
|
20
|
+
get group(): string | null;
|
|
21
|
+
set group(value: Bind<string | null>);
|
|
22
|
+
/** A draggable came over it (`draggable`, `data`); `cancel` refuses it. */
|
|
23
|
+
get onDragEntering(): MotifEvent<DropEventArgs>;
|
|
24
|
+
/** A draggable left it. */
|
|
25
|
+
get onDragLeaving(): MotifEvent<DropEventArgs>;
|
|
26
|
+
/** A draggable was dropped on it. */
|
|
27
|
+
get onDropped(): MotifEvent<DropEventArgs>;
|
|
28
|
+
/** Whether it takes the draggables of `group`. */
|
|
29
|
+
takes(group: string | null): boolean;
|
|
30
|
+
/** @internal A drag of its group began or ended. */
|
|
31
|
+
markActive(on: boolean): void;
|
|
32
|
+
/** @internal The draggable came over it; `false` when it is refused. */
|
|
33
|
+
enter(args: DropEventArgs): boolean;
|
|
34
|
+
/** @internal The draggable left it. */
|
|
35
|
+
leave(args: DropEventArgs): void;
|
|
36
|
+
/** @internal The draggable was dropped on it. */
|
|
37
|
+
drop(args: DropEventArgs): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EventArgs } from '@motifx/core';
|
|
2
|
+
import type { Draggable } from './Draggable';
|
|
3
|
+
import type { DropTarget } from './DropTarget';
|
|
4
|
+
/** A drag begins (`cancel = true` keeps it in place), goes on, is about to end (`cancel` brings it back), or ended. */
|
|
5
|
+
export interface DraggableEventArgs extends EventArgs {
|
|
6
|
+
/** Where the draggable stands, in pixels from where it was laid out. */
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
/** The drop target under the pointer that takes it, `null` for none. */
|
|
10
|
+
target: DropTarget | null;
|
|
11
|
+
/** By the pointer or a key, else from the props. */
|
|
12
|
+
byUser: boolean;
|
|
13
|
+
/** At the end: a target took it. */
|
|
14
|
+
dropped?: boolean;
|
|
15
|
+
source: Draggable;
|
|
16
|
+
event?: Event;
|
|
17
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Bind } from '@motifx/core';
|
|
2
|
+
import type { ControlProps } from '../../core/control';
|
|
3
|
+
import type { DraggableEventArgs } from './draggable-event-args';
|
|
4
|
+
/** The way a draggable may move. */
|
|
5
|
+
export type DragAxis = 'both' | 'x' | 'y';
|
|
6
|
+
/** Where a draggable stands, in pixels from where it was laid out. */
|
|
7
|
+
export interface DragPosition {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}
|
|
11
|
+
/** Props of `Draggable`. Each one is also a settable property; a function is followed. */
|
|
12
|
+
export interface DraggableProps extends ControlProps {
|
|
13
|
+
/** Default `'both'`. */
|
|
14
|
+
axis?: Bind<DragAxis>;
|
|
15
|
+
/** The draggable stays inside this: its parent, or an element it lies in. Default `null`, no limit. */
|
|
16
|
+
boundary?: Bind<'parent' | HTMLElement | null>;
|
|
17
|
+
/** A selector inside the draggable: only a press there drags it, and it takes the keys. Default `null`, the whole draggable. */
|
|
18
|
+
handle?: Bind<string | null>;
|
|
19
|
+
/** A copy follows the pointer and the draggable stays where it is; for a drop target to take. Default `false`. */
|
|
20
|
+
clone?: Bind<boolean>;
|
|
21
|
+
/** Drop targets of the same group take it. Default `null`. */
|
|
22
|
+
group?: Bind<string | null>;
|
|
23
|
+
/** Anything of your own, given to the drop target. */
|
|
24
|
+
data?: unknown;
|
|
25
|
+
/** Pixels an arrow key moves it by. Default `10`. */
|
|
26
|
+
step?: Bind<number>;
|
|
27
|
+
/** Where it stands: given, it is applied; after every drag or key the new place is written to `x-model`. */
|
|
28
|
+
position?: Bind<DragPosition | null>;
|
|
29
|
+
/** A drag is about to begin; cancelable. */
|
|
30
|
+
onDragStarting?: (e: DraggableEventArgs) => void;
|
|
31
|
+
/** It is being dragged (`x`, `y`, the `target` under the pointer). */
|
|
32
|
+
onDragging?: (e: DraggableEventArgs) => void;
|
|
33
|
+
/** The pointer let go; `cancel = true` brings it back where it started. */
|
|
34
|
+
onDragEnding?: (e: DraggableEventArgs) => void;
|
|
35
|
+
/** The drag ended: where it stands, and whether a target took it (`dropped`). */
|
|
36
|
+
onDragEnded?: (e: DraggableEventArgs) => void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EventArgs } from '@motifx/core';
|
|
2
|
+
import type { Draggable } from './Draggable';
|
|
3
|
+
import type { DropTarget } from './DropTarget';
|
|
4
|
+
/** A draggable came over a target (`cancel = true` refuses it), left it, or was dropped on it. */
|
|
5
|
+
export interface DropEventArgs extends EventArgs {
|
|
6
|
+
draggable: Draggable;
|
|
7
|
+
/** The draggable's `data`, as given. */
|
|
8
|
+
data: unknown;
|
|
9
|
+
source: DropTarget;
|
|
10
|
+
event?: Event;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Bind } from '@motifx/core';
|
|
2
|
+
import type { ControlProps } from '../../core/control';
|
|
3
|
+
import type { DropEventArgs } from './drop-event-args';
|
|
4
|
+
/** Props of `DropTarget`. Each one is also a settable property; a function is followed. */
|
|
5
|
+
export interface DropTargetProps extends ControlProps {
|
|
6
|
+
/** Takes the draggables of this group; `null` takes those without one. Default `null`. */
|
|
7
|
+
group?: Bind<string | null>;
|
|
8
|
+
/** A draggable came over it; `cancel = true` refuses it. */
|
|
9
|
+
onDragEntering?: (e: DropEventArgs) => void;
|
|
10
|
+
onDragLeaving?: (e: DropEventArgs) => void;
|
|
11
|
+
/** A draggable was dropped on it: your data is yours to move. */
|
|
12
|
+
onDropped?: (e: DropEventArgs) => void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Draggable } from './Draggable';
|
|
2
|
+
export { DropTarget } from './DropTarget';
|
|
3
|
+
export type { DraggableProps, DragAxis, DragPosition } from './draggable-props';
|
|
4
|
+
export type { DropTargetProps } from './drop-target-props';
|
|
5
|
+
export type { DraggableEventArgs } from './draggable-event-args';
|
|
6
|
+
export type { DropEventArgs } from './drop-event-args';
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Component, Emitter, type Bind, type Event as MotifEvent, type IBaseProp } from "@motifx/core";
|
|
2
|
+
import { Field } from "../../parts/field/Field";
|
|
3
|
+
import type { ValidationRule } from "../../parts/validation/validation-rule";
|
|
4
|
+
import { Button } from "../button/Button";
|
|
5
|
+
import { ProgressBar } from "../progress/ProgressBar";
|
|
6
|
+
import type { FileUploaderProps } from "./file-uploader-props";
|
|
7
|
+
import type { FilesAddedEventArgs } from "./files-added-event-args";
|
|
8
|
+
import type { UploadEventArgs } from "./upload-event-args";
|
|
9
|
+
import type { UploadItem } from "./upload-item";
|
|
10
|
+
import type { UploadMode } from "./upload-mode";
|
|
11
|
+
import type { UploadStatus } from "./upload-status";
|
|
12
|
+
interface Parts {
|
|
13
|
+
select: HTMLButtonElement;
|
|
14
|
+
selectText: HTMLSpanElement;
|
|
15
|
+
input: HTMLInputElement;
|
|
16
|
+
drop: HTMLSpanElement;
|
|
17
|
+
uploadButton: HTMLButtonElement;
|
|
18
|
+
list: Component<HTMLUListElement> | null;
|
|
19
|
+
rows: Map<UploadItem, Row>;
|
|
20
|
+
items: UploadItem[];
|
|
21
|
+
jobs: Map<UploadItem, AbortController>;
|
|
22
|
+
dragDepth: number;
|
|
23
|
+
}
|
|
24
|
+
interface Row {
|
|
25
|
+
li: Component<HTMLLIElement>;
|
|
26
|
+
name: Component<HTMLSpanElement>;
|
|
27
|
+
size: Component<HTMLSpanElement>;
|
|
28
|
+
state: Component<HTMLSpanElement>;
|
|
29
|
+
bar: ProgressBar;
|
|
30
|
+
abort: Button;
|
|
31
|
+
retry: Button;
|
|
32
|
+
remove: Button;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Files chosen with a button or dropped on the box, listed with their size and what happens to them: uploaded as
|
|
36
|
+
* they come (`uploadUrl`, in one piece or in chunks, or your own `upload`), on an Upload button, or programmatically;
|
|
37
|
+
* progress, cancel, retry and remove on each. `accept`, `maxFileSize`, `minFileSize` and `maxFiles` turn files
|
|
38
|
+
* away, each listed with the reason. The value is the files taken; `x-model` binds it.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* <FileUploader label="Attachments" accept=".pdf,image/*" maxFileSize={5_000_000} uploadUrl="/api/files" x-model={() => this.form.files} />
|
|
42
|
+
* <FileUploader label="Photo" multiple={false} upload={(file, report, signal) => this.api.send(file, report, signal)} />
|
|
43
|
+
*/
|
|
44
|
+
export declare class FileUploader extends Field<readonly File[], FileUploaderProps> {
|
|
45
|
+
filesAdded: Emitter<FilesAddedEventArgs>;
|
|
46
|
+
fileRemoved: Emitter<UploadEventArgs>;
|
|
47
|
+
uploadStarted: Emitter<UploadEventArgs>;
|
|
48
|
+
progressed: Emitter<UploadEventArgs>;
|
|
49
|
+
uploaded: Emitter<UploadEventArgs>;
|
|
50
|
+
uploadFailed: Emitter<UploadEventArgs>;
|
|
51
|
+
uploadAborted: Emitter<UploadEventArgs>;
|
|
52
|
+
uploadWith: ((file: File, report: (fraction: number) => void, signal: AbortSignal) => Promise<unknown>) | null;
|
|
53
|
+
constructor(props?: IBaseProp<FileUploaderProps>);
|
|
54
|
+
get multiple(): boolean;
|
|
55
|
+
set multiple(value: Bind<boolean>);
|
|
56
|
+
get accept(): string;
|
|
57
|
+
set accept(value: Bind<string>);
|
|
58
|
+
get maxFileSize(): number | null;
|
|
59
|
+
set maxFileSize(value: Bind<number | null>);
|
|
60
|
+
get minFileSize(): number | null;
|
|
61
|
+
set minFileSize(value: Bind<number | null>);
|
|
62
|
+
get maxFiles(): number | null;
|
|
63
|
+
set maxFiles(value: Bind<number | null>);
|
|
64
|
+
get allowDrop(): boolean;
|
|
65
|
+
set allowDrop(value: Bind<boolean>);
|
|
66
|
+
get uploadMode(): UploadMode;
|
|
67
|
+
set uploadMode(value: Bind<UploadMode>);
|
|
68
|
+
get uploadUrl(): string | null;
|
|
69
|
+
set uploadUrl(value: Bind<string | null>);
|
|
70
|
+
get uploadMethod(): string;
|
|
71
|
+
set uploadMethod(value: Bind<string>);
|
|
72
|
+
get uploadHeaders(): Record<string, string> | null;
|
|
73
|
+
set uploadHeaders(value: Bind<Record<string, string> | null>);
|
|
74
|
+
get uploadField(): string;
|
|
75
|
+
set uploadField(value: Bind<string>);
|
|
76
|
+
get chunkSize(): number | null;
|
|
77
|
+
set chunkSize(value: Bind<number | null>);
|
|
78
|
+
get selectText(): string;
|
|
79
|
+
set selectText(value: Bind<string>);
|
|
80
|
+
get dropText(): string;
|
|
81
|
+
set dropText(value: Bind<string>);
|
|
82
|
+
get uploadText(): string;
|
|
83
|
+
set uploadText(value: Bind<string>);
|
|
84
|
+
get showFileList(): boolean;
|
|
85
|
+
set showFileList(value: Bind<boolean>);
|
|
86
|
+
/** Every file in the list, the refused ones too, with what happened to each. */
|
|
87
|
+
get items(): readonly UploadItem[];
|
|
88
|
+
/** An upload is running. */
|
|
89
|
+
get isUploading(): boolean;
|
|
90
|
+
get onFilesAdded(): MotifEvent<FilesAddedEventArgs>;
|
|
91
|
+
get onFileRemoved(): MotifEvent<UploadEventArgs>;
|
|
92
|
+
get onUploadStarted(): MotifEvent<UploadEventArgs>;
|
|
93
|
+
get onProgress(): MotifEvent<UploadEventArgs>;
|
|
94
|
+
get onUploaded(): MotifEvent<UploadEventArgs>;
|
|
95
|
+
get onUploadError(): MotifEvent<UploadEventArgs>;
|
|
96
|
+
get onUploadAborted(): MotifEvent<UploadEventArgs>;
|
|
97
|
+
/** Opens the browser's file dialog, as the button does. */
|
|
98
|
+
openDialog(): void;
|
|
99
|
+
/** Takes files as if chosen: the limits apply, `onFilesAdded` is asked, uploads start as the mode says. */
|
|
100
|
+
addFiles(files: Iterable<File>, event?: Event): void;
|
|
101
|
+
/** Uploads the files waiting (or one of them); `manual` mode calls this. */
|
|
102
|
+
upload(item?: UploadItem): Promise<void>;
|
|
103
|
+
/** Stops the upload of a file (or of every one); the file stays, listed as cancelled. */
|
|
104
|
+
abort(item?: UploadItem): void;
|
|
105
|
+
/** Takes a file out of the list and the value; a running upload is stopped. */
|
|
106
|
+
remove(item: UploadItem, event?: Event): void;
|
|
107
|
+
/** Takes every file out. */
|
|
108
|
+
clear(): void;
|
|
109
|
+
protected createControl(): HTMLElement;
|
|
110
|
+
protected emptyValue(): readonly File[];
|
|
111
|
+
protected normalizeValue(value: readonly File[]): readonly File[];
|
|
112
|
+
protected sameValue(a: readonly File[], b: readonly File[]): boolean;
|
|
113
|
+
protected isEmptyValue(value: readonly File[]): boolean;
|
|
114
|
+
protected renderValue(value: readonly File[]): void;
|
|
115
|
+
protected builtInRules(): ValidationRule<readonly File[]>[];
|
|
116
|
+
get uploadParts(): Parts;
|
|
117
|
+
listen(): void;
|
|
118
|
+
drawTexts(): void;
|
|
119
|
+
drawList(): void;
|
|
120
|
+
makeRow(item: UploadItem): Row;
|
|
121
|
+
drawRow(item: UploadItem, row: Row): void;
|
|
122
|
+
setStatus(item: UploadItem, status: UploadStatus, progress?: number, message?: string): void;
|
|
123
|
+
stop(item: UploadItem): void;
|
|
124
|
+
uploadItem(item: UploadItem): Promise<void>;
|
|
125
|
+
send(file: File, url: string, report: (fraction: number) => void, signal: AbortSignal): Promise<unknown>;
|
|
126
|
+
request(url: string, blob: Blob, file: File, piece: {
|
|
127
|
+
index: number;
|
|
128
|
+
count: number;
|
|
129
|
+
start: number;
|
|
130
|
+
end: number;
|
|
131
|
+
} | null, loaded: (bytes: number) => void, signal: AbortSignal): Promise<unknown>;
|
|
132
|
+
}
|
|
133
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Bind } from '@motifx/core';
|
|
2
|
+
import type { FieldProps } from '../../parts/field/field-props';
|
|
3
|
+
import type { FilesAddedEventArgs } from './files-added-event-args';
|
|
4
|
+
import type { UploadEventArgs } from './upload-event-args';
|
|
5
|
+
import type { UploadMode } from './upload-mode';
|
|
6
|
+
/** Props of `FileUploader`: the field props (the value the files taken) plus its own. Each one is also a settable property. */
|
|
7
|
+
export interface FileUploaderProps extends FieldProps<readonly File[]> {
|
|
8
|
+
/** Several files at once. Default `true`. */
|
|
9
|
+
multiple?: Bind<boolean>;
|
|
10
|
+
/** What may be chosen, as for an `<input type="file">`: `.png,.jpg`, `image/*`, `application/pdf`. */
|
|
11
|
+
accept?: Bind<string>;
|
|
12
|
+
/** Bytes. A file outside is listed as refused, with the reason. */
|
|
13
|
+
maxFileSize?: Bind<number | null>;
|
|
14
|
+
minFileSize?: Bind<number | null>;
|
|
15
|
+
/** How many files may be taken in all. */
|
|
16
|
+
maxFiles?: Bind<number | null>;
|
|
17
|
+
/** Files may be dropped on the box. Default `true`. */
|
|
18
|
+
allowDrop?: Bind<boolean>;
|
|
19
|
+
/** When files are uploaded: `instant` (as chosen), `button` (an Upload button), `manual` (`upload()` programmatically). Default `instant` with `uploadUrl` or `upload`, else `manual`. */
|
|
20
|
+
uploadMode?: Bind<UploadMode>;
|
|
21
|
+
/** Where files are sent, by the uploader itself (XMLHttpRequest, with progress). */
|
|
22
|
+
uploadUrl?: Bind<string | null>;
|
|
23
|
+
/** Default `'POST'`. */
|
|
24
|
+
uploadMethod?: Bind<string>;
|
|
25
|
+
uploadHeaders?: Bind<Record<string, string> | null>;
|
|
26
|
+
/** The form field the file is sent in. Default `'file'`. */
|
|
27
|
+
uploadField?: Bind<string>;
|
|
28
|
+
/** Bytes per request; the file goes in pieces, each with its `Content-Range`. Default: the whole file at once. */
|
|
29
|
+
chunkSize?: Bind<number | null>;
|
|
30
|
+
/** Your own upload instead of `uploadUrl`: report progress (0 to 1) and stop on the signal; what it resolves to is the response. */
|
|
31
|
+
upload?: (file: File, report: (fraction: number) => void, signal: AbortSignal) => Promise<unknown>;
|
|
32
|
+
/** The texts: the select button, the drop hint, the Upload button; the kit's when not given. */
|
|
33
|
+
selectText?: Bind<string>;
|
|
34
|
+
dropText?: Bind<string>;
|
|
35
|
+
uploadText?: Bind<string>;
|
|
36
|
+
/** The list of files under the box. Default `true`. */
|
|
37
|
+
showFileList?: Bind<boolean>;
|
|
38
|
+
/** Files were chosen or dropped; cancelable. */
|
|
39
|
+
onFilesAdded?: (e: FilesAddedEventArgs) => void;
|
|
40
|
+
onFileRemoved?: (e: UploadEventArgs) => void;
|
|
41
|
+
onUploadStarted?: (e: UploadEventArgs) => void;
|
|
42
|
+
onProgress?: (e: UploadEventArgs) => void;
|
|
43
|
+
onUploaded?: (e: UploadEventArgs) => void;
|
|
44
|
+
onUploadError?: (e: UploadEventArgs) => void;
|
|
45
|
+
onUploadAborted?: (e: UploadEventArgs) => void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EventArgs } from '@motifx/core';
|
|
2
|
+
import type { FileUploader } from './FileUploader';
|
|
3
|
+
import type { UploadItem } from './upload-item';
|
|
4
|
+
/** Files were chosen or dropped. `cancel = true` takes none of them; `refused` lists those the limits turned away. */
|
|
5
|
+
export interface FilesAddedEventArgs extends EventArgs {
|
|
6
|
+
files: File[];
|
|
7
|
+
refused: UploadItem[];
|
|
8
|
+
source: FileUploader;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { FileUploader } from './FileUploader';
|
|
2
|
+
export type { FileUploaderProps } from './file-uploader-props';
|
|
3
|
+
export type { UploadItem } from './upload-item';
|
|
4
|
+
export type { UploadStatus } from './upload-status';
|
|
5
|
+
export type { UploadMode } from './upload-mode';
|
|
6
|
+
export type { UploadEventArgs } from './upload-event-args';
|
|
7
|
+
export type { FilesAddedEventArgs } from './files-added-event-args';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FileUploader } from './FileUploader';
|
|
2
|
+
import type { UploadItem } from './upload-item';
|
|
3
|
+
/** Something happened to one file of the uploader. */
|
|
4
|
+
export interface UploadEventArgs {
|
|
5
|
+
item: UploadItem;
|
|
6
|
+
file: File;
|
|
7
|
+
/** What went wrong, when it did. */
|
|
8
|
+
error?: unknown;
|
|
9
|
+
source: FileUploader;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { UploadStatus } from './upload-status';
|
|
2
|
+
/** A file in the uploader's list, with what happened to it. */
|
|
3
|
+
export interface UploadItem {
|
|
4
|
+
file: File;
|
|
5
|
+
status: UploadStatus;
|
|
6
|
+
/** 0 to 1 while uploading. */
|
|
7
|
+
progress: number;
|
|
8
|
+
/** What the upload answered (the response, or what your `upload` returned). */
|
|
9
|
+
response: unknown;
|
|
10
|
+
/** Why it failed or was refused, in the kit's language or the server's words. */
|
|
11
|
+
message: string;
|
|
12
|
+
}
|
|
@@ -124,7 +124,7 @@ export declare class FilterBuilder extends Control<HTMLDivElement, FilterBuilder
|
|
|
124
124
|
private fitToField;
|
|
125
125
|
/** The tree changed: the value follows (when it is another filter) and the rows are drawn again. */
|
|
126
126
|
private changed;
|
|
127
|
-
/** A value from the prop or
|
|
127
|
+
/** A value from the prop or programmatically: the tree is built again, unless it is the value the tree stands for already. */
|
|
128
128
|
private takeValue;
|
|
129
129
|
private inTree;
|
|
130
130
|
/** Reads what the rows show, so the drawing effect follows it. */
|