@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,98 @@
|
|
|
1
|
+
import { Component, Emitter, type Bind, type ComponentBase, type Event as MotifEvent, type IBaseProp } from "@motifx/core";
|
|
2
|
+
import { Control } from "../../core/control";
|
|
3
|
+
import type { PopupPlacement } from "../../parts/popup/popup-placement";
|
|
4
|
+
import { Button } from "../button/Button";
|
|
5
|
+
import type { TooltipTarget } from "../tooltip/tooltip-target";
|
|
6
|
+
import type { PopoverCloseReason } from "./popover-close-reason";
|
|
7
|
+
import type { PopoverClosingEventArgs } from "./popover-closing-event-args";
|
|
8
|
+
import type { PopoverProps } from "./popover-props";
|
|
9
|
+
import type { PopoverShowOn } from "./popover-show-on";
|
|
10
|
+
/**
|
|
11
|
+
* Content next to the element it belongs to: a title, a close button, anything in it. It opens on a press on its
|
|
12
|
+
* target (`showOn: 'click'`), when the pointer rests on the target (`'hover'`) or programmatically; it follows the target
|
|
13
|
+
* while the page scrolls, opens on the other side when there is no room, and points at the target with an arrow
|
|
14
|
+
* where the design language draws one. Focus goes in when it opens by a press and back to the target when it
|
|
15
|
+
* closes; Escape, a press outside, focus leaving and the close button close it.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <Button ref={b => (this.info = b)} text="Details" />
|
|
19
|
+
* <Popover target={() => this.info} title="Order 42" showClose>
|
|
20
|
+
* <p>Shipped yesterday.</p>
|
|
21
|
+
* </Popover>
|
|
22
|
+
*/
|
|
23
|
+
export declare class Popover extends Control<HTMLDivElement, PopoverProps> {
|
|
24
|
+
arrowPart: Component<HTMLSpanElement>;
|
|
25
|
+
header: Component<HTMLDivElement>;
|
|
26
|
+
titlePart: Component<HTMLDivElement>;
|
|
27
|
+
closeButton: Button;
|
|
28
|
+
body: Component<HTMLDivElement>;
|
|
29
|
+
contentPart: ComponentBase | null;
|
|
30
|
+
anchor: HTMLElement | null;
|
|
31
|
+
opened: boolean;
|
|
32
|
+
placedItself: boolean;
|
|
33
|
+
watched: Document | null;
|
|
34
|
+
frame: number;
|
|
35
|
+
showTimer: ReturnType<typeof setTimeout> | null;
|
|
36
|
+
hideTimer: ReturnType<typeof setTimeout> | null;
|
|
37
|
+
unlink: (() => void) | null;
|
|
38
|
+
telling: boolean;
|
|
39
|
+
openedEmitter: Emitter<void>;
|
|
40
|
+
closing: Emitter<PopoverClosingEventArgs>;
|
|
41
|
+
closed: Emitter<PopoverCloseReason>;
|
|
42
|
+
constructor(props?: IBaseProp<PopoverProps>);
|
|
43
|
+
get target(): TooltipTarget | null;
|
|
44
|
+
set target(value: Bind<TooltipTarget | null>);
|
|
45
|
+
get title(): string;
|
|
46
|
+
set title(value: Bind<string>);
|
|
47
|
+
get label(): string;
|
|
48
|
+
set label(value: Bind<string>);
|
|
49
|
+
get content(): ComponentBase | null;
|
|
50
|
+
set content(value: Bind<ComponentBase | null>);
|
|
51
|
+
get showOn(): PopoverShowOn;
|
|
52
|
+
set showOn(value: Bind<PopoverShowOn>);
|
|
53
|
+
get placement(): PopupPlacement;
|
|
54
|
+
set placement(value: Bind<PopupPlacement>);
|
|
55
|
+
get arrow(): boolean;
|
|
56
|
+
set arrow(value: Bind<boolean>);
|
|
57
|
+
get showClose(): boolean;
|
|
58
|
+
set showClose(value: Bind<boolean>);
|
|
59
|
+
get width(): string | number | null;
|
|
60
|
+
set width(value: Bind<string | number | null>);
|
|
61
|
+
get closeOnOutside(): boolean;
|
|
62
|
+
set closeOnOutside(value: Bind<boolean>);
|
|
63
|
+
get delay(): number;
|
|
64
|
+
set delay(value: Bind<number>);
|
|
65
|
+
get hideDelay(): number;
|
|
66
|
+
set hideDelay(value: Bind<number>);
|
|
67
|
+
/** Open or not. Reactive; setting it opens or closes. */
|
|
68
|
+
get value(): boolean;
|
|
69
|
+
set value(value: Bind<boolean>);
|
|
70
|
+
/** Whether it is open now. */
|
|
71
|
+
get isOpen(): boolean;
|
|
72
|
+
get onOpened(): MotifEvent<void>;
|
|
73
|
+
/** About to close (`reason`); `cancel = true` keeps it open. */
|
|
74
|
+
get onClosing(): MotifEvent<PopoverClosingEventArgs>;
|
|
75
|
+
get onClosed(): MotifEvent<PopoverCloseReason>;
|
|
76
|
+
/** Opens it next to its target; `false` without a target on the page, or when disabled. Focus goes in. */
|
|
77
|
+
open(): boolean;
|
|
78
|
+
/** Closes it; `onClosing` may keep it open. Focus inside goes back to the target. */
|
|
79
|
+
close(reason?: PopoverCloseReason): boolean;
|
|
80
|
+
toggle(): void;
|
|
81
|
+
/** Lines it up with its target again, e.g. after its content changed size. */
|
|
82
|
+
place(): void;
|
|
83
|
+
tell(open: boolean): void;
|
|
84
|
+
drawHeader(): void;
|
|
85
|
+
drawContent(): void;
|
|
86
|
+
attach(anchor: HTMLElement | null, again?: boolean): void;
|
|
87
|
+
pointerIn(): void;
|
|
88
|
+
pointerOut(): void;
|
|
89
|
+
clearTimers(): void;
|
|
90
|
+
listen(doc: Document): void;
|
|
91
|
+
stopListening(): void;
|
|
92
|
+
schedule: () => void;
|
|
93
|
+
onScroll: (e: Event) => void;
|
|
94
|
+
onPointerDown: (e: PointerEvent) => void;
|
|
95
|
+
keyDown(e: KeyboardEvent): void;
|
|
96
|
+
focusOut(e: FocusEvent): void;
|
|
97
|
+
protected applyProperty(name: string, value: unknown): void;
|
|
98
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Popover } from './Popover';
|
|
2
|
+
export type { PopoverProps } from './popover-props';
|
|
3
|
+
export type { PopoverShowOn } from './popover-show-on';
|
|
4
|
+
export type { PopoverCloseReason } from './popover-close-reason';
|
|
5
|
+
export type { PopoverClosingEventArgs } from './popover-closing-event-args';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EventArgs } from '@motifx/core';
|
|
2
|
+
import type { Popover } from './Popover';
|
|
3
|
+
import type { PopoverCloseReason } from './popover-close-reason';
|
|
4
|
+
/** The popover is about to close. `cancel = true` keeps it open. */
|
|
5
|
+
export interface PopoverClosingEventArgs extends EventArgs {
|
|
6
|
+
reason: PopoverCloseReason;
|
|
7
|
+
source: Popover;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Bind, ComponentBase } from '@motifx/core';
|
|
2
|
+
import type { ControlProps } from '../../core/control';
|
|
3
|
+
import type { PopupPlacement } from '../../parts/popup/popup-placement';
|
|
4
|
+
import type { TooltipTarget } from '../tooltip/tooltip-target';
|
|
5
|
+
import type { PopoverClosingEventArgs } from './popover-closing-event-args';
|
|
6
|
+
import type { PopoverShowOn } from './popover-show-on';
|
|
7
|
+
/** Props of `Popover`. Each one is also a settable property; a function is followed. */
|
|
8
|
+
export interface PopoverProps extends ControlProps {
|
|
9
|
+
/** The element or component it opens next to. */
|
|
10
|
+
target?: Bind<TooltipTarget | null | undefined>;
|
|
11
|
+
/** A title in the header. The same property as `text`. */
|
|
12
|
+
title?: Bind<string>;
|
|
13
|
+
/** What screen readers call it when it has no title. */
|
|
14
|
+
label?: Bind<string>;
|
|
15
|
+
/** Content programmatically, after the JSX children. */
|
|
16
|
+
content?: Bind<ComponentBase | null | undefined>;
|
|
17
|
+
/** Default `'click'`. */
|
|
18
|
+
showOn?: Bind<PopoverShowOn>;
|
|
19
|
+
/** Default `'bottom'`. It opens on the other side when there is no room. */
|
|
20
|
+
placement?: Bind<PopupPlacement>;
|
|
21
|
+
/** An arrow towards the target, where the design language draws one. Default `true`. */
|
|
22
|
+
arrow?: Bind<boolean>;
|
|
23
|
+
/** A close button in the header. Default `false`. */
|
|
24
|
+
showClose?: Bind<boolean>;
|
|
25
|
+
/** A width of its own (a CSS length, or pixels); without one it takes its content's. */
|
|
26
|
+
width?: Bind<string | number | null>;
|
|
27
|
+
/** Closes on a press outside it and its target. Default `true`. */
|
|
28
|
+
closeOnOutside?: Bind<boolean>;
|
|
29
|
+
/** Milliseconds the pointer rests on the target before it opens (`showOn: 'hover'`). Default 300. */
|
|
30
|
+
delay?: Bind<number>;
|
|
31
|
+
/** Milliseconds it stays after the pointer leaves both, so the pointer can move onto it. Default 200. */
|
|
32
|
+
hideDelay?: Bind<number>;
|
|
33
|
+
/** Open or not; `x-model` binds it two-way. */
|
|
34
|
+
value?: Bind<boolean>;
|
|
35
|
+
onOpened?: () => void;
|
|
36
|
+
/** About to close; cancelable. */
|
|
37
|
+
onClosing?: (e: PopoverClosingEventArgs) => void;
|
|
38
|
+
onClosed?: (reason: unknown) => void;
|
|
39
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Component, Emitter, type Bind, type Event as MotifEvent, type IBaseProp } from "@motifx/core";
|
|
2
|
+
import { Control } from "../../core/control";
|
|
3
|
+
import type { WindowBox } from "../../parts/window/window-box";
|
|
4
|
+
import type { ResizeEventArgs } from "./resize-event-args";
|
|
5
|
+
import type { ResizableProps, ResizeEdge, ResizeHandles, ResizeSize } from "./resizable-props";
|
|
6
|
+
interface Limits {
|
|
7
|
+
minW: number;
|
|
8
|
+
minH: number;
|
|
9
|
+
maxW: number;
|
|
10
|
+
maxH: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A box the user resizes from its sides and corners with the pointer, or with the arrow keys on the grip in its
|
|
14
|
+
* end corner. The JSX children are its content. It stays at least `minWidth` × `minHeight`, at most the maximums,
|
|
15
|
+
* and inside `area` when one is given; `keepAspectRatio` keeps its shape. A box laid out by its position
|
|
16
|
+
* (`absolute`, `fixed`) also moves when a start or top side is dragged, so the far side stays; one in the flow
|
|
17
|
+
* only changes size.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Resizable minWidth={160} minHeight={100} x-model={() => this.layout.size}><Panel padding="md">…</Panel></Resizable>
|
|
21
|
+
* <Resizable handles={['end', 'bottom', 'bottom-end']} area="parent" keepAspectRatio><img src="…" /></Resizable>
|
|
22
|
+
*/
|
|
23
|
+
export declare class Resizable extends Control<HTMLDivElement, ResizableProps> {
|
|
24
|
+
starting: Emitter<ResizeEventArgs>;
|
|
25
|
+
resizing: Emitter<ResizeEventArgs>;
|
|
26
|
+
resized: Emitter<ResizeEventArgs>;
|
|
27
|
+
frame: HTMLDivElement;
|
|
28
|
+
grip: Component<HTMLDivElement>;
|
|
29
|
+
live: Component<HTMLSpanElement>;
|
|
30
|
+
constructor(props?: IBaseProp<ResizableProps>);
|
|
31
|
+
get handles(): ResizeHandles;
|
|
32
|
+
set handles(value: Bind<ResizeHandles>);
|
|
33
|
+
get minWidth(): number;
|
|
34
|
+
set minWidth(value: Bind<number>);
|
|
35
|
+
get minHeight(): number;
|
|
36
|
+
set minHeight(value: Bind<number>);
|
|
37
|
+
get maxWidth(): number | null;
|
|
38
|
+
set maxWidth(value: Bind<number | null>);
|
|
39
|
+
get maxHeight(): number | null;
|
|
40
|
+
set maxHeight(value: Bind<number | null>);
|
|
41
|
+
get area(): 'parent' | HTMLElement | null;
|
|
42
|
+
set area(value: Bind<'parent' | HTMLElement | null>);
|
|
43
|
+
get keepAspectRatio(): boolean;
|
|
44
|
+
set keepAspectRatio(value: Bind<boolean>);
|
|
45
|
+
get step(): number;
|
|
46
|
+
set step(value: Bind<number>);
|
|
47
|
+
get width(): number | string | null;
|
|
48
|
+
set width(value: Bind<number | string | null>);
|
|
49
|
+
get height(): number | string | null;
|
|
50
|
+
set height(value: Bind<number | string | null>);
|
|
51
|
+
get size(): ResizeSize | null;
|
|
52
|
+
set size(value: Bind<ResizeSize | null>);
|
|
53
|
+
/** `size`, for `x-model`. */
|
|
54
|
+
get value(): ResizeSize | null;
|
|
55
|
+
set value(value: ResizeSize | null);
|
|
56
|
+
/** A resize is about to begin from a handle (`edge`); `cancel` keeps the size. */
|
|
57
|
+
get onResizeStarting(): MotifEvent<ResizeEventArgs>;
|
|
58
|
+
/** The box is being resized (`width`, `height` so far). */
|
|
59
|
+
get onResizing(): MotifEvent<ResizeEventArgs>;
|
|
60
|
+
/** A resize ended: the pointer let go, or a key moved a side. */
|
|
61
|
+
get onResized(): MotifEvent<ResizeEventArgs>;
|
|
62
|
+
/** The box's size in pixels now. */
|
|
63
|
+
get currentSize(): ResizeSize;
|
|
64
|
+
/** The grip in the end corner, the Tab stop that takes the keys. */
|
|
65
|
+
get gripElement(): HTMLDivElement;
|
|
66
|
+
length(value: number | string | null | undefined): string;
|
|
67
|
+
allowed(): Set<ResizeEdge>;
|
|
68
|
+
drawHandles(): void;
|
|
69
|
+
box(): WindowBox;
|
|
70
|
+
room(): {
|
|
71
|
+
w: number;
|
|
72
|
+
h: number;
|
|
73
|
+
};
|
|
74
|
+
limits(): Limits;
|
|
75
|
+
get positioned(): boolean;
|
|
76
|
+
physical(edge: ResizeEdge): ResizeEdge;
|
|
77
|
+
next(edge: ResizeEdge, start: WindowBox, dx: number, dy: number): WindowBox;
|
|
78
|
+
applyBox(box: WindowBox): void;
|
|
79
|
+
args(edge: ResizeEdge, box: WindowBox, event?: Event): ResizeEventArgs;
|
|
80
|
+
pointerDown(e: PointerEvent, given: ResizeEdge | null): void;
|
|
81
|
+
keyDown(e: KeyboardEvent): void;
|
|
82
|
+
finish(edge: ResizeEdge, box: WindowBox, event?: Event): void;
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Bind } from '@motifx/core';
|
|
2
|
+
import type { ControlProps } from '../../core/control';
|
|
3
|
+
import type { WindowEdge } from '../../parts/window/window-edge';
|
|
4
|
+
import type { ResizeEventArgs } from './resize-event-args';
|
|
5
|
+
/** A side or a corner the box is resized from; `start` and `end` follow the reading direction. */
|
|
6
|
+
export type ResizeEdge = WindowEdge;
|
|
7
|
+
/** Which handles the box has: every side and corner, the sides, the corners, or a list of them. */
|
|
8
|
+
export type ResizeHandles = 'all' | 'edges' | 'corners' | readonly ResizeEdge[];
|
|
9
|
+
/** The box's size in pixels. */
|
|
10
|
+
export interface ResizeSize {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}
|
|
14
|
+
/** Props of `Resizable`. Each one is also a settable property; a function is followed. */
|
|
15
|
+
export interface ResizableProps extends ControlProps {
|
|
16
|
+
/** Default `'all'`. */
|
|
17
|
+
handles?: Bind<ResizeHandles>;
|
|
18
|
+
/** The least width and height, in pixels. Default `30`. */
|
|
19
|
+
minWidth?: Bind<number>;
|
|
20
|
+
minHeight?: Bind<number>;
|
|
21
|
+
/** The most width and height, in pixels; `null` for no limit. Default `null`. */
|
|
22
|
+
maxWidth?: Bind<number | null>;
|
|
23
|
+
maxHeight?: Bind<number | null>;
|
|
24
|
+
/** The box stays inside this: its parent, or an element it lies in. Default `null`, no limit. */
|
|
25
|
+
area?: Bind<'parent' | HTMLElement | null>;
|
|
26
|
+
/** The width and the height keep their ratio. Default `false`. */
|
|
27
|
+
keepAspectRatio?: Bind<boolean>;
|
|
28
|
+
/** Pixels an arrow key changes a side by. Default `10`. */
|
|
29
|
+
step?: Bind<number>;
|
|
30
|
+
/** The width to start with, a CSS length or pixels. Without one the content decides. */
|
|
31
|
+
width?: Bind<number | string | null>;
|
|
32
|
+
height?: Bind<number | string | null>;
|
|
33
|
+
/** The size in pixels: given, it is applied; after every resize the new one is written to `x-model`. */
|
|
34
|
+
size?: Bind<ResizeSize | null>;
|
|
35
|
+
/** A resize is about to begin from a handle; cancelable. */
|
|
36
|
+
onResizeStarting?: (e: ResizeEventArgs) => void;
|
|
37
|
+
/** The box is being resized. */
|
|
38
|
+
onResizing?: (e: ResizeEventArgs) => void;
|
|
39
|
+
/** A resize ended (the pointer let go, or a key moved a side). */
|
|
40
|
+
onResized?: (e: ResizeEventArgs) => void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EventArgs } from '@motifx/core';
|
|
2
|
+
import type { Resizable } from './Resizable';
|
|
3
|
+
import type { ResizeEdge } from './resizable-props';
|
|
4
|
+
/** A resize begins (`cancel = true` keeps the size), goes on, or ended: the edge it is from and the size in pixels. */
|
|
5
|
+
export interface ResizeEventArgs extends EventArgs {
|
|
6
|
+
edge: ResizeEdge;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
/** By a handle or a key, else from the props. */
|
|
10
|
+
byUser: boolean;
|
|
11
|
+
source: Resizable;
|
|
12
|
+
event?: Event;
|
|
13
|
+
}
|
|
@@ -129,7 +129,7 @@ export declare class AppointmentEditor<T> implements DragHost<T> {
|
|
|
129
129
|
private unsave;
|
|
130
130
|
/** A change to a series that did not go through: `onDataError` says what was saved and whether it was taken back. */
|
|
131
131
|
private failed;
|
|
132
|
-
/** What a change reaches: the setting's answer, the occurrence
|
|
132
|
+
/** What a change reaches: the setting's answer, the occurrence programmatically, else the user's answer. */
|
|
133
133
|
private scopeFor;
|
|
134
134
|
/**
|
|
135
135
|
* Asks the user what a change (or a delete) of an occurrence reaches: `onSeriesAsking` first (it
|
|
@@ -112,7 +112,7 @@ export interface SchedulerProps<T> extends ControlProps, SchedulerTemplates<T> {
|
|
|
112
112
|
* browser's. An appointment's own zone (`fields.startTimeZone`) is the one its series repeats in.
|
|
113
113
|
*/
|
|
114
114
|
timeZone?: Bind<string | null>;
|
|
115
|
-
/** What changing or deleting an occurrence of a series reaches: `'ask'` (default) asks the user;
|
|
115
|
+
/** What changing or deleting an occurrence of a series reaches: `'ask'` (default) asks the user; programmatically it is the occurrence. */
|
|
116
116
|
seriesEdit?: Bind<SeriesEditMode>;
|
|
117
117
|
/** Occurrences of a series, and ones changed apart from it, carry a mark where the design language draws one. Default `true`. */
|
|
118
118
|
recurrenceMarks?: Bind<boolean>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Component, Emitter, type Bind, type Event as MotifEvent, type IBaseProp } from "@motifx/core";
|
|
2
|
+
import { Control } from "../../core/control";
|
|
3
|
+
import { ResizeWatch } from "../../core/resize-watch";
|
|
4
|
+
import { Spinner } from "../progress/Spinner";
|
|
5
|
+
import type { PullDownEventArgs } from "./pull-down-event-args";
|
|
6
|
+
import type { ReachBottomEventArgs } from "./reach-bottom-event-args";
|
|
7
|
+
import type { ScrollEventArgs } from "./scroll-event-args";
|
|
8
|
+
import type { ScrollViewBars } from "./scroll-view-bars";
|
|
9
|
+
import type { ScrollViewDirection } from "./scroll-view-direction";
|
|
10
|
+
import type { ScrollViewProps } from "./scroll-view-props";
|
|
11
|
+
interface Pull {
|
|
12
|
+
pointerId: number;
|
|
13
|
+
startY: number;
|
|
14
|
+
distance: number;
|
|
15
|
+
taken: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Content that scrolls in a box of its own, with the scrollbars shown as told (`showScrollbar`), a pull from the top
|
|
19
|
+
* that asks for what is new (`pullToRefresh`, `onPullDown`) and a reach near the end that asks for more
|
|
20
|
+
* (`loadOnReachBottom`, `onReachBottom`). `scrollTo`, `scrollBy` and `scrollToElement` move it programmatically.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <ScrollView style="block-size: 20rem" pullToRefresh onPullDown={e => (e.promise = this.reload())} loadOnReachBottom onReachBottom={e => (e.promise = this.loadMore())}>
|
|
24
|
+
* {this.rows.map(row => <Row key={row.id} row={row} />)}
|
|
25
|
+
* </ScrollView>
|
|
26
|
+
*/
|
|
27
|
+
export declare class ScrollView extends Control<HTMLDivElement, ScrollViewProps> {
|
|
28
|
+
content: Component<HTMLDivElement>;
|
|
29
|
+
pullPanel: Component<HTMLDivElement>;
|
|
30
|
+
pullSpinner: Spinner;
|
|
31
|
+
pullText: Component<HTMLSpanElement>;
|
|
32
|
+
bottomPanel: Component<HTMLDivElement>;
|
|
33
|
+
bottomSpinner: Spinner;
|
|
34
|
+
bottomText: Component<HTMLSpanElement>;
|
|
35
|
+
pull: Pull | null;
|
|
36
|
+
refreshing: boolean;
|
|
37
|
+
loading: boolean;
|
|
38
|
+
ended: boolean;
|
|
39
|
+
scrollTimer: ReturnType<typeof setTimeout> | null;
|
|
40
|
+
sizes: ResizeWatch;
|
|
41
|
+
refreshCount: number;
|
|
42
|
+
pulled: Emitter<PullDownEventArgs>;
|
|
43
|
+
reached: Emitter<ReachBottomEventArgs>;
|
|
44
|
+
scrolled: Emitter<ScrollEventArgs>;
|
|
45
|
+
stops: (() => void)[];
|
|
46
|
+
constructor(props?: IBaseProp<ScrollViewProps>);
|
|
47
|
+
get direction(): ScrollViewDirection;
|
|
48
|
+
set direction(value: Bind<ScrollViewDirection>);
|
|
49
|
+
get showScrollbar(): ScrollViewBars;
|
|
50
|
+
set showScrollbar(value: Bind<ScrollViewBars>);
|
|
51
|
+
get pullToRefresh(): boolean;
|
|
52
|
+
set pullToRefresh(value: Bind<boolean>);
|
|
53
|
+
get loadOnReachBottom(): boolean;
|
|
54
|
+
set loadOnReachBottom(value: Bind<boolean>);
|
|
55
|
+
get reachBottomOffset(): number;
|
|
56
|
+
set reachBottomOffset(value: Bind<number>);
|
|
57
|
+
get pullDownText(): string;
|
|
58
|
+
set pullDownText(value: Bind<string>);
|
|
59
|
+
get releaseText(): string;
|
|
60
|
+
set releaseText(value: Bind<string>);
|
|
61
|
+
get refreshingText(): string;
|
|
62
|
+
set refreshingText(value: Bind<string>);
|
|
63
|
+
get reachBottomText(): string;
|
|
64
|
+
set reachBottomText(value: Bind<string>);
|
|
65
|
+
get label(): string;
|
|
66
|
+
set label(value: Bind<string>);
|
|
67
|
+
get onPullDown(): MotifEvent<PullDownEventArgs>;
|
|
68
|
+
get onReachBottom(): MotifEvent<ReachBottomEventArgs>;
|
|
69
|
+
get onScrolled(): MotifEvent<ScrollEventArgs>;
|
|
70
|
+
/** Where the content stands. */
|
|
71
|
+
get scrollTop(): number;
|
|
72
|
+
get scrollLeft(): number;
|
|
73
|
+
/** A refresh (a pull) is going on. */
|
|
74
|
+
get isRefreshing(): boolean;
|
|
75
|
+
/** More is being loaded (a reach near the end). */
|
|
76
|
+
get isLoading(): boolean;
|
|
77
|
+
/** Scrolls to a position: `{ top, left }`, or a top. */
|
|
78
|
+
scrollTo(where: number | {
|
|
79
|
+
top?: number;
|
|
80
|
+
left?: number;
|
|
81
|
+
}, smooth?: boolean): void;
|
|
82
|
+
scrollBy(by: {
|
|
83
|
+
top?: number;
|
|
84
|
+
left?: number;
|
|
85
|
+
}, smooth?: boolean): void;
|
|
86
|
+
/** Brings an element of the content into view. */
|
|
87
|
+
scrollToElement(target: Element | {
|
|
88
|
+
element: Element;
|
|
89
|
+
}, smooth?: boolean): void;
|
|
90
|
+
/** Starts a refresh as a pull would: the panel shows, `onPullDown` is asked. */
|
|
91
|
+
refresh(): void;
|
|
92
|
+
/** Ends a refresh: the panel goes back. */
|
|
93
|
+
release(): void;
|
|
94
|
+
/** Asks for more now, as a reach near the end would. */
|
|
95
|
+
loadMore(): boolean;
|
|
96
|
+
/** Looks at the position again (the content changed): near the end, more is asked for. */
|
|
97
|
+
update(): void;
|
|
98
|
+
pullHeight(): number;
|
|
99
|
+
drawTexts(): void;
|
|
100
|
+
handleScroll(): void;
|
|
101
|
+
onMounted(): void;
|
|
102
|
+
check(): void;
|
|
103
|
+
pointerDown(e: PointerEvent): void;
|
|
104
|
+
pointerMove(e: PointerEvent): void;
|
|
105
|
+
pointerUp(e: PointerEvent): void;
|
|
106
|
+
stopPull(): void;
|
|
107
|
+
touchMove(e: TouchEvent): void;
|
|
108
|
+
}
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ScrollView } from './ScrollView';
|
|
2
|
+
export type { ScrollViewProps } from './scroll-view-props';
|
|
3
|
+
export type { ScrollViewDirection } from './scroll-view-direction';
|
|
4
|
+
export type { ScrollViewBars } from './scroll-view-bars';
|
|
5
|
+
export type { PullDownEventArgs } from './pull-down-event-args';
|
|
6
|
+
export type { ReachBottomEventArgs } from './reach-bottom-event-args';
|
|
7
|
+
export type { ScrollEventArgs } from './scroll-event-args';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ScrollView } from './ScrollView';
|
|
2
|
+
/** The content was pulled down and let go: load what is new, then `release()` (or set `promise`) and the indicator goes. */
|
|
3
|
+
export interface PullDownEventArgs {
|
|
4
|
+
/** Ends the refresh. */
|
|
5
|
+
release: () => void;
|
|
6
|
+
/** Set it to wait: the refresh ends when it settles. */
|
|
7
|
+
promise?: Promise<unknown>;
|
|
8
|
+
source: ScrollView;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ScrollView } from './ScrollView';
|
|
2
|
+
/** The content was scrolled near its end: load more, then `release()` (or set `promise`) and the indicator goes. */
|
|
3
|
+
export interface ReachBottomEventArgs {
|
|
4
|
+
/** Ends the loading; `done = true` says there is no more and the view stops asking. */
|
|
5
|
+
release: (done?: boolean) => void;
|
|
6
|
+
/** Set it to wait: the loading ends when it settles. */
|
|
7
|
+
promise?: Promise<unknown>;
|
|
8
|
+
source: ScrollView;
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Bind } from '@motifx/core';
|
|
2
|
+
import type { ControlProps } from '../../core/control';
|
|
3
|
+
import type { PullDownEventArgs } from './pull-down-event-args';
|
|
4
|
+
import type { ReachBottomEventArgs } from './reach-bottom-event-args';
|
|
5
|
+
import type { ScrollEventArgs } from './scroll-event-args';
|
|
6
|
+
import type { ScrollViewBars } from './scroll-view-bars';
|
|
7
|
+
import type { ScrollViewDirection } from './scroll-view-direction';
|
|
8
|
+
/** Props of `ScrollView`. Each one is also a settable property; a function is followed. */
|
|
9
|
+
export interface ScrollViewProps extends ControlProps {
|
|
10
|
+
/** Default `'vertical'`. */
|
|
11
|
+
direction?: Bind<ScrollViewDirection>;
|
|
12
|
+
/** When the scrollbars show. Default `'onScroll'`. */
|
|
13
|
+
showScrollbar?: Bind<ScrollViewBars>;
|
|
14
|
+
/** Pulling the content down from the top asks `onPullDown` for what is new. Default `false`. */
|
|
15
|
+
pullToRefresh?: Bind<boolean>;
|
|
16
|
+
/** Scrolling near the end asks `onReachBottom` for more. Default `false`. */
|
|
17
|
+
loadOnReachBottom?: Bind<boolean>;
|
|
18
|
+
/** Pixels from the end at which `onReachBottom` is asked. Default `100`. */
|
|
19
|
+
reachBottomOffset?: Bind<number>;
|
|
20
|
+
/** The texts of the pull-down panel; the kit's when not given. */
|
|
21
|
+
pullDownText?: Bind<string>;
|
|
22
|
+
releaseText?: Bind<string>;
|
|
23
|
+
refreshingText?: Bind<string>;
|
|
24
|
+
/** The text under the content while more is loading; the kit's "Loading…" when not given. */
|
|
25
|
+
reachBottomText?: Bind<string>;
|
|
26
|
+
/** What screen readers call the scrolling region. */
|
|
27
|
+
label?: Bind<string>;
|
|
28
|
+
onPullDown?: (e: PullDownEventArgs) => void;
|
|
29
|
+
onReachBottom?: (e: ReachBottomEventArgs) => void;
|
|
30
|
+
onScrolled?: (e: ScrollEventArgs) => void;
|
|
31
|
+
}
|
|
@@ -34,7 +34,7 @@ export declare class Skeleton extends Control<HTMLDivElement, SkeletonProps> {
|
|
|
34
34
|
set loading(value: Bind<boolean>);
|
|
35
35
|
get label(): string;
|
|
36
36
|
set label(value: Bind<string>);
|
|
37
|
-
/** The part holding what shows once loaded, for adding to it
|
|
37
|
+
/** The part holding what shows once loaded, for adding to it programmatically. */
|
|
38
38
|
get content(): Component<HTMLDivElement>;
|
|
39
39
|
onMounted(): void;
|
|
40
40
|
private countOf;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Component, Emitter, type Bind, type ComponentBase, 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 { SortableDragEventArgs } from "./sortable-drag-event-args";
|
|
5
|
+
import type { SortableDropEventArgs } from "./sortable-drop-event-args";
|
|
6
|
+
import type { SortableOrientation } from "./sortable-orientation";
|
|
7
|
+
import type { SortableProps } from "./sortable-props";
|
|
8
|
+
interface Session {
|
|
9
|
+
pointerId: number;
|
|
10
|
+
touch: boolean;
|
|
11
|
+
startX: number;
|
|
12
|
+
startY: number;
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
item: unknown;
|
|
16
|
+
element: HTMLElement;
|
|
17
|
+
fromIndex: number;
|
|
18
|
+
started: boolean;
|
|
19
|
+
to: Sortable<unknown> | null;
|
|
20
|
+
toIndex: number;
|
|
21
|
+
refused: boolean;
|
|
22
|
+
timer: ReturnType<typeof setTimeout> | null;
|
|
23
|
+
frame: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Items the user puts in order by dragging them, with the pointer or a finger (a long press), or with the keys
|
|
27
|
+
* (Ctrl + an arrow moves the focused item a place); sortables of one `group` take each other's items. The items
|
|
28
|
+
* are the JSX children, or `items` drawn with `itemTemplate`. A drop moves the item's element and tells
|
|
29
|
+
* `onReorder` (`onRemove` and `onAdd` across sortables) with the indexes: your data is yours to reorder.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* <Sortable label="Steps" onReorder={e => this.steps.splice(e.toIndex, 0, ...this.steps.splice(e.fromIndex, 1))}>
|
|
33
|
+
* {this.steps.map(step => <StepRow key={step.id} step={step} />)}
|
|
34
|
+
* </Sortable>
|
|
35
|
+
* <Sortable items={() => this.todo} itemTemplate={item => new TodoRow({ item })} group="tasks" onAdd={…} onRemove={…} />
|
|
36
|
+
*/
|
|
37
|
+
export declare class Sortable<T = unknown> extends Control<HTMLDivElement, SortableProps<T>> {
|
|
38
|
+
dragStarting: Emitter<SortableDragEventArgs<T>>;
|
|
39
|
+
dragChanging: Emitter<SortableDragEventArgs<T>>;
|
|
40
|
+
dragEnding: Emitter<SortableDragEventArgs<T>>;
|
|
41
|
+
reordered: Emitter<SortableDropEventArgs<T>>;
|
|
42
|
+
added: Emitter<SortableDropEventArgs<T>>;
|
|
43
|
+
removed: Emitter<SortableDropEventArgs<T>>;
|
|
44
|
+
rows: Map<unknown, ComponentBase<any, any>>;
|
|
45
|
+
stopItems: (() => void) | null;
|
|
46
|
+
session: Session | null;
|
|
47
|
+
stops: (() => void)[];
|
|
48
|
+
line: Component<HTMLSpanElement>;
|
|
49
|
+
live: Component<HTMLSpanElement>;
|
|
50
|
+
ghost: DragGhost;
|
|
51
|
+
focusedAt: number;
|
|
52
|
+
constructor(props?: IBaseProp<SortableProps<T>>);
|
|
53
|
+
get items(): readonly T[];
|
|
54
|
+
set items(value: Bind<readonly T[]>);
|
|
55
|
+
get itemTemplate(): ((item: T, index: number) => ComponentBase) | undefined;
|
|
56
|
+
set itemTemplate(value: ((item: T, index: number) => ComponentBase) | undefined);
|
|
57
|
+
get handle(): string | null;
|
|
58
|
+
set handle(value: Bind<string | null>);
|
|
59
|
+
get group(): string | null;
|
|
60
|
+
set group(value: Bind<string | null>);
|
|
61
|
+
get allowReordering(): boolean;
|
|
62
|
+
set allowReordering(value: Bind<boolean>);
|
|
63
|
+
get orientation(): SortableOrientation;
|
|
64
|
+
set orientation(value: Bind<SortableOrientation>);
|
|
65
|
+
get label(): string;
|
|
66
|
+
set label(value: Bind<string>);
|
|
67
|
+
get onDragStarting(): MotifEvent<SortableDragEventArgs<T>>;
|
|
68
|
+
get onDragChanging(): MotifEvent<SortableDragEventArgs<T>>;
|
|
69
|
+
get onDragEnding(): MotifEvent<SortableDragEventArgs<T>>;
|
|
70
|
+
get onReorder(): MotifEvent<SortableDropEventArgs<T>>;
|
|
71
|
+
get onAdd(): MotifEvent<SortableDropEventArgs<T>>;
|
|
72
|
+
get onRemove(): MotifEvent<SortableDropEventArgs<T>>;
|
|
73
|
+
/** The items' elements, in order. */
|
|
74
|
+
get elements(): readonly HTMLElement[];
|
|
75
|
+
/** Whether an item is being dragged. */
|
|
76
|
+
get isDragging(): boolean;
|
|
77
|
+
/** Moves the item at `fromIndex` to `toIndex` as a drop would, and tells `onReorder`; `false` when nothing moved. */
|
|
78
|
+
move(fromIndex: number, toIndex: number, event?: Event): boolean;
|
|
79
|
+
onBuilt(): void;
|
|
80
|
+
/** Reads the items again after they were changed in place. */
|
|
81
|
+
refresh(): void;
|
|
82
|
+
itemElements(): HTMLElement[];
|
|
83
|
+
itemOf(el: HTMLElement): T;
|
|
84
|
+
renderItems(): void;
|
|
85
|
+
drawRows(items: T[]): void;
|
|
86
|
+
plainRow(item: T): ComponentBase;
|
|
87
|
+
drawItems(): void;
|
|
88
|
+
focusableOf(el: HTMLElement): HTMLElement | null;
|
|
89
|
+
drawStops(): void;
|
|
90
|
+
place(el: HTMLElement, toIndex: number): void;
|
|
91
|
+
announce(toIndex: number): void;
|
|
92
|
+
keyDown(e: KeyboardEvent): void;
|
|
93
|
+
pointerDown(e: PointerEvent): void;
|
|
94
|
+
pointerMove(e: PointerEvent): void;
|
|
95
|
+
pointerUp(e: PointerEvent): void;
|
|
96
|
+
args(s: Session, event?: Event): SortableDragEventArgs<T>;
|
|
97
|
+
start(e: PointerEvent): boolean;
|
|
98
|
+
track(e: PointerEvent): void;
|
|
99
|
+
takes(from: Sortable<unknown>): boolean;
|
|
100
|
+
indexAt(x: number, y: number, dragged: HTMLElement): number;
|
|
101
|
+
showLine(index: number, dragged: HTMLElement): void;
|
|
102
|
+
autoScroll(): void;
|
|
103
|
+
end(e: Event | null, drop: boolean): void;
|
|
104
|
+
drop(s: Session, to: Sortable<unknown>, event?: Event): void;
|
|
105
|
+
}
|
|
106
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Sortable } from './Sortable';
|
|
2
|
+
export type { SortableProps } from './sortable-props';
|
|
3
|
+
export type { SortableOrientation } from './sortable-orientation';
|
|
4
|
+
export type { SortableDragEventArgs } from './sortable-drag-event-args';
|
|
5
|
+
export type { SortableDropEventArgs } from './sortable-drop-event-args';
|