@web-atoms/web-controls 2.6.5 → 2.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-editor/InlineHtmlEditor.d.ts +1 -1
- package/dist/html-editor/InlineHtmlEditor.d.ts.map +1 -1
- package/dist/html-editor/InlineHtmlEditor.js +2 -2
- package/dist/html-editor/InlineHtmlEditor.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist-esm/ArrayLike.js +14 -12
- package/dist-esm/DataAttributes.js +18 -19
- package/dist-esm/Focusable.js +10 -11
- package/dist-esm/ModuleFiles.js +43 -42
- package/dist-esm/NumberFormats.js +60 -56
- package/dist-esm/PageNavigator.js +28 -30
- package/dist-esm/animations/Animations.js +36 -33
- package/dist-esm/basic/AtomChips.js +312 -305
- package/dist-esm/basic/AtomRepeater.js +1070 -1035
- package/dist-esm/basic/AtomSuggestions.js +97 -107
- package/dist-esm/basic/AttachedPopup.js +0 -1
- package/dist-esm/basic/Button.js +45 -19
- package/dist-esm/basic/ButtonBar.js +84 -64
- package/dist-esm/basic/Calendar.js +211 -203
- package/dist-esm/basic/CheckBoxList.js +90 -70
- package/dist-esm/basic/Checkbox.js +16 -8
- package/dist-esm/basic/Chip.js +36 -12
- package/dist-esm/basic/ComboBox.js +47 -51
- package/dist-esm/basic/DataGrid.js +258 -252
- package/dist-esm/basic/DateField.js +149 -127
- package/dist-esm/basic/DropDown.js +91 -103
- package/dist-esm/basic/DropDownInput.js +78 -106
- package/dist-esm/basic/Editable.js +82 -77
- package/dist-esm/basic/Expander.js +104 -86
- package/dist-esm/basic/FilesDragDrop.js +84 -80
- package/dist-esm/basic/Form.js +80 -52
- package/dist-esm/basic/FormField.js +164 -106
- package/dist-esm/basic/IElement.js +1 -2
- package/dist-esm/basic/InlinePopup.js +263 -234
- package/dist-esm/basic/InlinePopupButton.js +99 -88
- package/dist-esm/basic/InlinePopupControl.js +24 -23
- package/dist-esm/basic/ItemPath.js +59 -60
- package/dist-esm/basic/LimitedText.js +49 -38
- package/dist-esm/basic/ListRepeater.js +13 -14
- package/dist-esm/basic/MaskedInput.js +37 -29
- package/dist-esm/basic/MaskedInputDiv.js +55 -48
- package/dist-esm/basic/MergeNode.js +64 -35
- package/dist-esm/basic/PasswordBox.js +32 -17
- package/dist-esm/basic/PinchZoomView.js +221 -199
- package/dist-esm/basic/PopupButton.js +39 -16
- package/dist-esm/basic/PopupMenu.js +3 -4
- package/dist-esm/basic/RadioButtonList.js +35 -25
- package/dist-esm/basic/RefreshLock.js +41 -42
- package/dist-esm/basic/Resizable.js +43 -33
- package/dist-esm/basic/Select.js +72 -65
- package/dist-esm/basic/SortByButton.js +41 -31
- package/dist-esm/basic/Swipe.js +91 -84
- package/dist-esm/basic/Switch.js +22 -8
- package/dist-esm/basic/TableRepeater.js +29 -33
- package/dist-esm/basic/TimeEditor.js +97 -52
- package/dist-esm/basic/TitleEditor.js +115 -95
- package/dist-esm/basic/ToggleButtonBar.js +21 -22
- package/dist-esm/basic/Tooltip.js +49 -47
- package/dist-esm/basic/TypeWriter.js +45 -42
- package/dist-esm/basic/UploadEvent.js +211 -178
- package/dist-esm/basic/ZoomView.js +229 -198
- package/dist-esm/basic/combineClasses.js +2 -3
- package/dist-esm/basic/elements/AtomPopover.js +270 -253
- package/dist-esm/basic/elements/getContainingBlock.js +34 -35
- package/dist-esm/basic/elements/relativeRect.js +40 -21
- package/dist-esm/desktop-app/DesktopApp.js +65 -80
- package/dist-esm/desktop-app/MobileDesktopApp.js +20 -23
- package/dist-esm/html-editor/AtomHtmlEditor.js +243 -268
- package/dist-esm/html-editor/HtmlEditorCommands.js +6 -4
- package/dist-esm/html-editor/InlineHtmlEditor.d.ts +1 -1
- package/dist-esm/html-editor/InlineHtmlEditor.d.ts.map +1 -1
- package/dist-esm/html-editor/InlineHtmlEditor.js +175 -167
- package/dist-esm/html-editor/InlineHtmlEditor.js.map +1 -1
- package/dist-esm/html-editor/RangeEditor.js +49 -51
- package/dist-esm/html-editor/commands/AddImage.js +40 -35
- package/dist-esm/html-editor/commands/AddLink.js +56 -54
- package/dist-esm/html-editor/commands/Align.js +24 -7
- package/dist-esm/html-editor/commands/AttachFile.js +23 -13
- package/dist-esm/html-editor/commands/AttachImage.js +35 -25
- package/dist-esm/html-editor/commands/Bold.js +10 -11
- package/dist-esm/html-editor/commands/ChangeColor.js +31 -107
- package/dist-esm/html-editor/commands/ChangeFont.js +42 -42
- package/dist-esm/html-editor/commands/ChangeFontSize.js +15 -5
- package/dist-esm/html-editor/commands/Command.js +34 -16
- package/dist-esm/html-editor/commands/CommandButton.js +51 -32
- package/dist-esm/html-editor/commands/Headings.js +25 -9
- package/dist-esm/html-editor/commands/HorizontalRule.js +9 -10
- package/dist-esm/html-editor/commands/HtmlCommands.js +160 -65
- package/dist-esm/html-editor/commands/IndentLess.js +10 -11
- package/dist-esm/html-editor/commands/IndentMore.js +10 -11
- package/dist-esm/html-editor/commands/Italic.js +10 -11
- package/dist-esm/html-editor/commands/NumberedList.js +10 -11
- package/dist-esm/html-editor/commands/Quote.js +10 -11
- package/dist-esm/html-editor/commands/RemoveFormat.js +10 -11
- package/dist-esm/html-editor/commands/Separator.js +5 -4
- package/dist-esm/html-editor/commands/Source.js +29 -25
- package/dist-esm/html-editor/commands/StrikeThrough.js +10 -11
- package/dist-esm/html-editor/commands/Toolbar.js +6 -4
- package/dist-esm/html-editor/commands/Underline.js +10 -11
- package/dist-esm/html-editor/commands/Unlink.js +10 -9
- package/dist-esm/html-editor/commands/UnorderedList.js +10 -11
- package/dist-esm/mobile-app/BottomPopup.js +137 -148
- package/dist-esm/mobile-app/MasterDetailPage.js +153 -152
- package/dist-esm/mobile-app/MobileApp.js +577 -569
- package/dist-esm/player/AtomVideoPlayer.js +316 -270
- package/dist-esm/player/TrackProgress.js +11 -7
- package/dist-esm/player/input-range-style.js +97 -98
- package/dist-esm/tests/app-test/AppTestApp.js +12 -15
- package/dist-esm/tests/app-test/AppTestApp.pack.js +54 -0
- package/dist-esm/tests/app-test/commands/AppCommands.js +14 -11
- package/dist-esm/tests/app-test/drawer/AppDrawer.js +4 -6
- package/dist-esm/tests/app-test/model/model.js +1 -2
- package/dist-esm/tests/app-test/pages/detail/DetailPage.js +21 -15
- package/dist-esm/tests/app-test/pages/home/HomePage.js +7 -8
- package/dist-esm/tests/app-test/pages/list/ListPage.js +79 -62
- package/dist-esm/tests/basic/PopupTest.js +9 -7
- package/dist-esm/tests/basic/TimeEditorTest.js +5 -9
- package/dist-esm/tests/basic/TimeEditorTest.pack.js +39 -0
- package/dist-esm/tests/basic/TimerTest.js +27 -37
- package/dist-esm/tests/basic/TimerTest.pack.js +40 -0
- package/dist-esm/tests/basic/basic-form/BasicForm.js +47 -27
- package/dist-esm/tests/basic/basic-form/BasicForm.pack.js +44 -0
- package/dist-esm/tests/basic/calendar/BasicCalendarTest.js +5 -9
- package/dist-esm/tests/basic/calendar/BasicCalendarTest.pack.js +53 -0
- package/dist-esm/tests/basic/chips/ChipsTest.js +25 -15
- package/dist-esm/tests/basic/chips/ChipsTest.pack.js +56 -0
- package/dist-esm/tests/basic/data-grid/DataGridTest.js +55 -60
- package/dist-esm/tests/basic/data-grid/DataGridTest.pack.js +58 -0
- package/dist-esm/tests/basic/date/DateFieldTest.js +21 -96
- package/dist-esm/tests/basic/date/DateFieldTest.pack.js +57 -0
- package/dist-esm/tests/basic/drop-down/DropDownTest.js +25 -19
- package/dist-esm/tests/basic/drop-down/DropDownTest.pack.js +52 -0
- package/dist-esm/tests/basic/drop-down-input/DropDownTest.js +32 -32
- package/dist-esm/tests/basic/drop-down-input/DropDownTest.pack.js +54 -0
- package/dist-esm/tests/basic/expander/ExpanderMenuTest.js +20 -14
- package/dist-esm/tests/basic/expander/ExpanderMenuTest.pack.js +38 -0
- package/dist-esm/tests/basic/expander/ExpanderTest.js +11 -12
- package/dist-esm/tests/basic/expander/ExpanderTest.pack.js +38 -0
- package/dist-esm/tests/basic/form2/Form2Test.js +26 -24
- package/dist-esm/tests/basic/form2/Form2Test.pack.js +46 -0
- package/dist-esm/tests/basic/limited-text/LimitedTextTest.js +14 -11
- package/dist-esm/tests/basic/limited-text/LimitedTextTest.pack.js +38 -0
- package/dist-esm/tests/basic/pinch-zoom/PinchZoomViewTest.js +14 -14
- package/dist-esm/tests/basic/pinch-zoom/PinchZoomViewTest.pack.js +38 -0
- package/dist-esm/tests/basic/repeater/DragDropRepater.js +30 -12
- package/dist-esm/tests/basic/repeater/DragDropRepater.pack.js +51 -0
- package/dist-esm/tests/basic/repeater/RepeaterTest.js +45 -35
- package/dist-esm/tests/basic/repeater/RepeaterTest.pack.js +52 -0
- package/dist-esm/tests/basic/swipe/SwipeTest.js +13 -13
- package/dist-esm/tests/basic/swipe/SwipeTest.pack.js +52 -0
- package/dist-esm/tests/basic/switch-test/SwitchTest.js +8 -10
- package/dist-esm/tests/basic/switch-test/SwitchTest.pack.js +38 -0
- package/dist-esm/tests/basic/title-editor/TitleEditorTest.js +8 -9
- package/dist-esm/tests/basic/title-editor/TitleEditorTest.pack.js +38 -0
- package/dist-esm/tests/basic/tooltip/TooltipTest.js +30 -24
- package/dist-esm/tests/basic/tooltip/TooltipTest.pack.js +52 -0
- package/dist-esm/tests/basic/typewriter/TypeWriter.js +10 -9
- package/dist-esm/tests/basic/typewriter/TypeWriter.pack.js +39 -0
- package/dist-esm/tests/basic/video/AtomVideoTest.js +13 -10
- package/dist-esm/tests/basic/video/AtomVideoTest.pack.js +38 -0
- package/dist-esm/tests/basic/zoom/ZoomViewTest.js +13 -13
- package/dist-esm/tests/basic/zoom/ZoomViewTest.pack.js +38 -0
- package/dist-esm/tests/check-box-list/CheckBoxListSample.js +13 -12
- package/dist-esm/tests/check-box-list/CheckBoxListSample.pack.js +52 -0
- package/dist-esm/tests/data-grid/GridTestViewModel.js +203 -227
- package/dist-esm/tests/form/CustomHelp.js +6 -9
- package/dist-esm/tests/form/FormViewModel.js +21 -28
- package/dist-esm/tests/html-editor/HtmlEditorTest.js +7 -37
- package/dist-esm/tests/html-editor/HtmlEditorTest.pack.js +83 -0
- package/dist-esm/tests/html-editor/InlineHtmlEdiorTest.js +9 -38
- package/dist-esm/tests/html-editor/InlineHtmlEdiorTest.pack.js +85 -0
- package/dist-esm/tests/mask/MaskedInputTest.js +11 -12
- package/dist-esm/tests/mask/MaskedInputTest.pack.js +38 -0
- package/dist-esm/tests/mobile-app/DesktopAppTest.js +8 -9
- package/dist-esm/tests/mobile-app/DesktopAppTest.pack.js +60 -0
- package/dist-esm/tests/mobile-app/MobileAppTest.js +64 -53
- package/dist-esm/tests/mobile-app/MobileAppTest.pack.js +55 -0
- package/dist-esm/tests/pop-over/PopOverTest.js +37 -77
- package/dist-esm/tests/switch/SwitchTest.js +9 -8
- package/dist-esm/tests/toggle-view/ToggleViewTest.js +15 -22
- package/dist-esm/tests/toggle-view/ToggleViewTest.pack.js +45 -0
- package/dist-esm/toggle-view/AtomToggleView.js +77 -73
- package/dist-esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/html-editor/InlineHtmlEditor.tsx +1 -1
|
@@ -3,215 +3,237 @@ import Bind from "@web-atoms/core/dist/core/Bind.js";
|
|
|
3
3
|
import { BindableProperty } from "@web-atoms/core/dist/core/BindableProperty.js";
|
|
4
4
|
import XNode from "@web-atoms/core/dist/core/XNode.js";
|
|
5
5
|
import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl.js";
|
|
6
|
-
import
|
|
7
|
-
const center =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
x: touch.clientX,
|
|
12
|
-
y: touch.clientY
|
|
13
|
-
};
|
|
14
|
-
}
|
|
6
|
+
ESMPack.installStyleSheet(import.meta.resolve("./styles/pinch-zoom-view.global.css"));
|
|
7
|
+
const center = ev => {
|
|
8
|
+
const touch = ev.touches[0];
|
|
9
|
+
if (touch) {
|
|
15
10
|
return {
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
x: touch.clientX,
|
|
12
|
+
y: touch.clientY
|
|
18
13
|
};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
x: 0,
|
|
17
|
+
y: 0
|
|
18
|
+
};
|
|
19
19
|
};
|
|
20
20
|
const distance = (first, second) => {
|
|
21
|
-
|
|
21
|
+
return Math.hypot(first.pageX - second.pageX, first.pageY - second.pageY);
|
|
22
22
|
};
|
|
23
23
|
export default class PinchZoomView extends AtomControl {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
preCreate() {
|
|
25
|
+
this.element.title = "Use mouse wheel to zoom";
|
|
26
|
+
this.loading = false;
|
|
27
|
+
this.zoom = {
|
|
28
|
+
scale: 0,
|
|
29
|
+
anchorX: 0,
|
|
30
|
+
anchorY: 0,
|
|
31
|
+
x: 0,
|
|
32
|
+
y: 0
|
|
33
|
+
};
|
|
34
|
+
this.element.dataset.pinchZoom = "true";
|
|
35
|
+
this.element.draggable = false;
|
|
36
|
+
this.render(XNode.create("div", null, XNode.create("div", {
|
|
37
|
+
class: "image-container"
|
|
38
|
+
}, XNode.create("img", {
|
|
39
|
+
src: Bind.oneWay(() => this.getSource(this.source)),
|
|
40
|
+
"style-opacity": Bind.oneWay(() => this.loading ? "0.3" : "1"),
|
|
41
|
+
"event-load": () => {
|
|
26
42
|
this.loading = false;
|
|
27
|
-
this.zoom
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
y,
|
|
94
|
-
scale
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
touchEndDisposable ??= this.bindEvent(scrollView, "touchend", (ev) => {
|
|
98
|
-
touchMoveDisposable?.dispose();
|
|
99
|
-
touchEndDisposable?.dispose();
|
|
100
|
-
touchMoveDisposable = undefined;
|
|
101
|
-
touchEndDisposable = undefined;
|
|
102
|
-
previousDistance = undefined;
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
let mouseMoveDisposable;
|
|
106
|
-
let mouseUpDisposable;
|
|
107
|
-
this.bindEvent(scrollView, "dragstart", (ev) => {
|
|
108
|
-
ev.preventDefault();
|
|
109
|
-
ev.stopImmediatePropagation();
|
|
110
|
-
});
|
|
111
|
-
this.bindEvent(scrollView, "mousedown", (ev) => {
|
|
112
|
-
this.element.dataset.state = "grabbing";
|
|
113
|
-
previous = {
|
|
114
|
-
x: ev.clientX,
|
|
115
|
-
y: ev.clientY
|
|
116
|
-
};
|
|
117
|
-
mouseMoveDisposable ??= this.bindEvent(scrollView, "mousemove", (e) => {
|
|
118
|
-
e.preventDefault();
|
|
119
|
-
e.stopImmediatePropagation?.();
|
|
120
|
-
const { anchorX, anchorY, scale } = this.zoom;
|
|
121
|
-
let { x, y } = this.zoom;
|
|
122
|
-
const cp = { x: e.clientX, y: e.clientY };
|
|
123
|
-
x += (cp.x - previous.x);
|
|
124
|
-
y += (cp.y - previous.y);
|
|
125
|
-
previous = cp;
|
|
126
|
-
this.updateZoom({
|
|
127
|
-
anchorX,
|
|
128
|
-
anchorY,
|
|
129
|
-
x,
|
|
130
|
-
y,
|
|
131
|
-
scale
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
mouseUpDisposable ??= this.bindEvent(scrollView, "mouseup", (e) => {
|
|
135
|
-
e.preventDefault();
|
|
136
|
-
e.stopImmediatePropagation?.();
|
|
137
|
-
this.element.dataset.state = "";
|
|
138
|
-
previous = null;
|
|
139
|
-
mouseMoveDisposable.dispose();
|
|
140
|
-
mouseUpDisposable.dispose();
|
|
141
|
-
mouseMoveDisposable = undefined;
|
|
142
|
-
mouseUpDisposable = undefined;
|
|
143
|
-
});
|
|
43
|
+
this.updateZoom(this.zoom);
|
|
44
|
+
}
|
|
45
|
+
})), XNode.create("i", {
|
|
46
|
+
class: Bind.oneWay(() => this.loading ? "spinner fa-duotone fa-spinner fa-spin" : "hide")
|
|
47
|
+
}), XNode.create("i", {
|
|
48
|
+
"event-click": () => this.updateZoom(),
|
|
49
|
+
class: Bind.oneWay(() => this.zoom.scale ? "scale" : "hide"),
|
|
50
|
+
title: "Display entire image"
|
|
51
|
+
})));
|
|
52
|
+
this.imageContainer = this.element.firstElementChild;
|
|
53
|
+
this.image = this.imageContainer.firstElementChild;
|
|
54
|
+
const scrollView = this.element;
|
|
55
|
+
let previous;
|
|
56
|
+
let touchMoveDisposable;
|
|
57
|
+
let touchEndDisposable;
|
|
58
|
+
this.bindEvent(scrollView, "touchstart", evs => {
|
|
59
|
+
previous = center(evs);
|
|
60
|
+
let previousDistance = undefined;
|
|
61
|
+
touchMoveDisposable ??= this.bindEvent(scrollView, "touchmove", ev => {
|
|
62
|
+
let {
|
|
63
|
+
x,
|
|
64
|
+
y,
|
|
65
|
+
anchorX,
|
|
66
|
+
anchorY,
|
|
67
|
+
scale
|
|
68
|
+
} = this.zoom;
|
|
69
|
+
if (ev.touches.length === 2) {
|
|
70
|
+
ev.preventDefault();
|
|
71
|
+
ev.stopImmediatePropagation();
|
|
72
|
+
const rect = this.element.getBoundingClientRect();
|
|
73
|
+
const first = ev.touches[0];
|
|
74
|
+
const second = ev.touches[1];
|
|
75
|
+
anchorX = (first.clientX + second.clientX) / 2 - rect.left;
|
|
76
|
+
anchorY = (first.clientY + second.clientY) / 2 - rect.top;
|
|
77
|
+
const newScale = distance(first, second);
|
|
78
|
+
if (previousDistance === void 0) {
|
|
79
|
+
previousDistance = newScale;
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (previousDistance === newScale) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
scale += newScale - previousDistance;
|
|
86
|
+
previousDistance = newScale;
|
|
87
|
+
this.updateZoom({
|
|
88
|
+
anchorX,
|
|
89
|
+
anchorY,
|
|
90
|
+
x,
|
|
91
|
+
y,
|
|
92
|
+
scale
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (!previous) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const cp = center(ev);
|
|
100
|
+
x += cp.x - previous.x;
|
|
101
|
+
y += cp.y - previous.y;
|
|
102
|
+
previous = cp;
|
|
103
|
+
this.updateZoom({
|
|
104
|
+
anchorX,
|
|
105
|
+
anchorY,
|
|
106
|
+
x,
|
|
107
|
+
y,
|
|
108
|
+
scale
|
|
144
109
|
});
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
110
|
+
});
|
|
111
|
+
touchEndDisposable ??= this.bindEvent(scrollView, "touchend", ev => {
|
|
112
|
+
touchMoveDisposable?.dispose();
|
|
113
|
+
touchEndDisposable?.dispose();
|
|
114
|
+
touchMoveDisposable = undefined;
|
|
115
|
+
touchEndDisposable = undefined;
|
|
116
|
+
previousDistance = undefined;
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
let mouseMoveDisposable;
|
|
120
|
+
let mouseUpDisposable;
|
|
121
|
+
this.bindEvent(scrollView, "dragstart", ev => {
|
|
122
|
+
ev.preventDefault();
|
|
123
|
+
ev.stopImmediatePropagation();
|
|
124
|
+
});
|
|
125
|
+
this.bindEvent(scrollView, "mousedown", ev => {
|
|
126
|
+
this.element.dataset.state = "grabbing";
|
|
127
|
+
previous = {
|
|
128
|
+
x: ev.clientX,
|
|
129
|
+
y: ev.clientY
|
|
130
|
+
};
|
|
131
|
+
mouseMoveDisposable ??= this.bindEvent(scrollView, "mousemove", e => {
|
|
132
|
+
e.preventDefault();
|
|
133
|
+
e.stopImmediatePropagation?.();
|
|
134
|
+
const {
|
|
135
|
+
anchorX,
|
|
136
|
+
anchorY,
|
|
137
|
+
scale
|
|
138
|
+
} = this.zoom;
|
|
139
|
+
let {
|
|
140
|
+
x,
|
|
141
|
+
y
|
|
142
|
+
} = this.zoom;
|
|
143
|
+
const cp = {
|
|
144
|
+
x: e.clientX,
|
|
145
|
+
y: e.clientY
|
|
146
|
+
};
|
|
147
|
+
x += cp.x - previous.x;
|
|
148
|
+
y += cp.y - previous.y;
|
|
149
|
+
previous = cp;
|
|
150
|
+
this.updateZoom({
|
|
151
|
+
anchorX,
|
|
152
|
+
anchorY,
|
|
153
|
+
x,
|
|
154
|
+
y,
|
|
155
|
+
scale
|
|
162
156
|
});
|
|
157
|
+
});
|
|
158
|
+
mouseUpDisposable ??= this.bindEvent(scrollView, "mouseup", e => {
|
|
159
|
+
e.preventDefault();
|
|
160
|
+
e.stopImmediatePropagation?.();
|
|
161
|
+
this.element.dataset.state = "";
|
|
162
|
+
previous = null;
|
|
163
|
+
mouseMoveDisposable.dispose();
|
|
164
|
+
mouseUpDisposable.dispose();
|
|
165
|
+
mouseMoveDisposable = undefined;
|
|
166
|
+
mouseUpDisposable = undefined;
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
this.bindEvent(scrollView, "wheel", ev => {
|
|
170
|
+
const target = ev.currentTarget;
|
|
171
|
+
ev.preventDefault();
|
|
172
|
+
ev.stopImmediatePropagation?.();
|
|
173
|
+
const newScale = this.zoom.scale - (ev.deltaY < 0 ? -50 : 50);
|
|
174
|
+
const anchorX = ev.offsetX;
|
|
175
|
+
const anchorY = ev.offsetY;
|
|
176
|
+
const {
|
|
177
|
+
x,
|
|
178
|
+
y
|
|
179
|
+
} = this.zoom;
|
|
180
|
+
this.updateZoom({
|
|
181
|
+
anchorX,
|
|
182
|
+
anchorY,
|
|
183
|
+
x,
|
|
184
|
+
y,
|
|
185
|
+
scale: newScale < 0 ? 0 : newScale
|
|
186
|
+
});
|
|
187
|
+
}, undefined, {
|
|
188
|
+
passive: false
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
getSource(text) {
|
|
192
|
+
if (text) {
|
|
193
|
+
this.loading = true;
|
|
163
194
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
195
|
+
return text;
|
|
196
|
+
}
|
|
197
|
+
updateZoom(zoom = {
|
|
198
|
+
x: 0,
|
|
199
|
+
y: 0,
|
|
200
|
+
anchorX: 0,
|
|
201
|
+
anchorY: 0,
|
|
202
|
+
scale: 0
|
|
203
|
+
}) {
|
|
204
|
+
const {
|
|
205
|
+
anchorX,
|
|
206
|
+
anchorY,
|
|
207
|
+
x,
|
|
208
|
+
y
|
|
209
|
+
} = zoom;
|
|
210
|
+
let {
|
|
211
|
+
scale
|
|
212
|
+
} = zoom;
|
|
213
|
+
this.zoom = zoom;
|
|
214
|
+
const image = this.image;
|
|
215
|
+
if (!image.naturalHeight) {
|
|
216
|
+
return;
|
|
169
217
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
const maxHeight = this.element.clientWidth > this.element.clientHeight;
|
|
185
|
-
const s = maxHeight
|
|
186
|
-
? this.element.clientWidth / image.naturalWidth
|
|
187
|
-
: this.element.clientHeight / image.naturalHeight;
|
|
188
|
-
if (scale <= 0) {
|
|
189
|
-
scale = 0;
|
|
190
|
-
}
|
|
191
|
-
const newWidth = (this.element.clientWidth + scale) + "px";
|
|
192
|
-
const newHeight = (this.element.clientHeight + scale) + "px";
|
|
193
|
-
this.image.style.maxWidth = this.element.clientWidth + "px";
|
|
194
|
-
this.image.style.maxHeight = this.element.clientHeight + "px";
|
|
195
|
-
if (scale <= 0) {
|
|
196
|
-
this.imageContainer.style.transform = "";
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const clientWidth = this.element.clientWidth;
|
|
200
|
-
const scaleFactor = (clientWidth + scale) / clientWidth;
|
|
201
|
-
this.imageContainer.style.transformOrigin = `${anchorX}px ${anchorY}`;
|
|
202
|
-
this.imageContainer.style.transform = `translate(${x}px, ${y}px) scale(${scaleFactor})`;
|
|
218
|
+
const maxHeight = this.element.clientWidth > this.element.clientHeight;
|
|
219
|
+
const s = maxHeight ? this.element.clientWidth / image.naturalWidth : this.element.clientHeight / image.naturalHeight;
|
|
220
|
+
if (scale <= 0) {
|
|
221
|
+
scale = 0;
|
|
222
|
+
}
|
|
223
|
+
const newWidth = this.element.clientWidth + scale + "px";
|
|
224
|
+
const newHeight = this.element.clientHeight + scale + "px";
|
|
225
|
+
this.image.style.maxWidth = this.element.clientWidth + "px";
|
|
226
|
+
this.image.style.maxHeight = this.element.clientHeight + "px";
|
|
227
|
+
if (scale <= 0) {
|
|
228
|
+
this.imageContainer.style.transform = "";
|
|
229
|
+
return;
|
|
203
230
|
}
|
|
231
|
+
const clientWidth = this.element.clientWidth;
|
|
232
|
+
const scaleFactor = (clientWidth + scale) / clientWidth;
|
|
233
|
+
this.imageContainer.style.transformOrigin = `${anchorX}px ${anchorY}`;
|
|
234
|
+
this.imageContainer.style.transform = `translate(${x}px, ${y}px) scale(${scaleFactor})`;
|
|
235
|
+
}
|
|
204
236
|
}
|
|
205
|
-
__decorate([
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
], PinchZoomView.prototype, "zoom", void 0);
|
|
209
|
-
__decorate([
|
|
210
|
-
BindableProperty,
|
|
211
|
-
__metadata("design:type", String)
|
|
212
|
-
], PinchZoomView.prototype, "source", void 0);
|
|
213
|
-
__decorate([
|
|
214
|
-
BindableProperty,
|
|
215
|
-
__metadata("design:type", Boolean)
|
|
216
|
-
], PinchZoomView.prototype, "loading", void 0);
|
|
217
|
-
//# sourceMappingURL=PinchZoomView.js.map
|
|
237
|
+
__decorate([BindableProperty, __metadata("design:type", Object)], PinchZoomView.prototype, "zoom", void 0);
|
|
238
|
+
__decorate([BindableProperty, __metadata("design:type", String)], PinchZoomView.prototype, "source", void 0);
|
|
239
|
+
__decorate([BindableProperty, __metadata("design:type", Boolean)], PinchZoomView.prototype, "loading", void 0);
|
|
@@ -1,21 +1,44 @@
|
|
|
1
1
|
import XNode from "@web-atoms/core/dist/core/XNode.js";
|
|
2
|
-
import
|
|
2
|
+
ESMPack.installStyleSheet(import.meta.resolve("./styles/popup-button.global.css"));
|
|
3
3
|
import InlinePopupButton from "./InlinePopupButton.js";
|
|
4
|
-
export function MenuItem({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
export function MenuItem({
|
|
5
|
+
label,
|
|
6
|
+
icon,
|
|
7
|
+
eventClick,
|
|
8
|
+
href,
|
|
9
|
+
target,
|
|
10
|
+
...others
|
|
11
|
+
}) {
|
|
12
|
+
if (href) {
|
|
13
|
+
return XNode.create("a", {
|
|
14
|
+
"data-menu-item": "menu-item",
|
|
15
|
+
href: href,
|
|
16
|
+
target: target,
|
|
17
|
+
...others
|
|
18
|
+
}, icon && XNode.create("i", {
|
|
19
|
+
"data-element": "icon",
|
|
20
|
+
class: icon
|
|
21
|
+
}), label && XNode.create("span", {
|
|
22
|
+
"data-element": "label",
|
|
23
|
+
text: label
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
return XNode.create("div", {
|
|
27
|
+
"data-menu-item": "menu-item",
|
|
28
|
+
eventClick: eventClick,
|
|
29
|
+
...others
|
|
30
|
+
}, icon && XNode.create("i", {
|
|
31
|
+
"data-element": "icon",
|
|
32
|
+
class: icon
|
|
33
|
+
}), label && XNode.create("span", {
|
|
34
|
+
"data-element": "label",
|
|
35
|
+
text: label
|
|
36
|
+
}));
|
|
13
37
|
}
|
|
14
38
|
export default InlinePopupButton;
|
|
15
39
|
export function PopupActionButton(a, ...nodes) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=PopupButton.js.map
|
|
40
|
+
a.closeOnClick ??= true;
|
|
41
|
+
a["anchor-top"] = "parent-bottom";
|
|
42
|
+
a["anchor-right"] = "parent-left";
|
|
43
|
+
return InlinePopupButton(a, ...nodes);
|
|
44
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import InlinePopupButton from "./InlinePopupButton.js";
|
|
2
2
|
export default function PopupMenu(a, ...nodes) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=PopupMenu.js.map
|
|
3
|
+
a.closeOnClick ??= true;
|
|
4
|
+
return InlinePopupButton(a, ...nodes);
|
|
5
|
+
}
|
|
@@ -1,28 +1,38 @@
|
|
|
1
1
|
import XNode from "@web-atoms/core/dist/core/XNode.js";
|
|
2
2
|
import AtomRepeater from "./AtomRepeater.js";
|
|
3
|
-
import
|
|
3
|
+
ESMPack.installStyleSheet(import.meta.resolve("./styles/radio-button-list.global.css"));
|
|
4
4
|
export default class RadioButtonList extends AtomRepeater {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
5
|
+
preCreate() {
|
|
6
|
+
super.preCreate();
|
|
7
|
+
this.valuePath = item => item?.value ?? item;
|
|
8
|
+
this.bindEvent(this.element, "itemClick", e => {
|
|
9
|
+
const s = this.selectedItems;
|
|
10
|
+
if (!s) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const item = e.detail;
|
|
14
|
+
const old = this.selectedItem;
|
|
15
|
+
if (old) {
|
|
16
|
+
this.element.dispatchEvent(new CustomEvent("itemDeselect", {
|
|
17
|
+
detail: old,
|
|
18
|
+
bubbles: false
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
this.selectedItem = item;
|
|
22
|
+
this.element.dispatchEvent(new CustomEvent("itemSelect", {
|
|
23
|
+
detail: item,
|
|
24
|
+
bubbles: false
|
|
25
|
+
}));
|
|
26
|
+
});
|
|
27
|
+
this.element.dataset.radioButtonList = "radio-button-list";
|
|
28
|
+
this.itemRenderer = item => XNode.create("div", {
|
|
29
|
+
"data-item-type": "radio"
|
|
30
|
+
}, XNode.create("i", {
|
|
31
|
+
class: "far fa-dot-circle"
|
|
32
|
+
}), XNode.create("i", {
|
|
33
|
+
class: "far fa-circle"
|
|
34
|
+
}), XNode.create("span", {
|
|
35
|
+
text: item.label
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,45 +1,44 @@
|
|
|
1
1
|
export default class RefreshLock {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
constructor(app, e) {
|
|
3
|
+
this.app = app;
|
|
4
|
+
this.map = new Map();
|
|
5
|
+
this.begin = ce => {
|
|
6
|
+
if (ce.target === ce.currentTarget) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const previous = this.promise;
|
|
10
|
+
this.promise = this.setupNew(previous, ce.detail.id);
|
|
11
|
+
this.app.runAsync(() => this.promise);
|
|
12
|
+
};
|
|
13
|
+
this.end = ce => {
|
|
14
|
+
if (ce.target === ce.currentTarget) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const resolver = this.map.get(ce.detail.id);
|
|
18
|
+
resolver?.();
|
|
19
|
+
};
|
|
20
|
+
e.addEventListener("refreshLockBegin", this.begin);
|
|
21
|
+
e.addEventListener("refreshLockEnd", this.end);
|
|
22
|
+
this.dispose = () => {
|
|
23
|
+
e.removeEventListener("refreshLockBegin", this.begin);
|
|
24
|
+
e.removeEventListener("refreshLockEnd", this.begin);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
queue(fx) {
|
|
28
|
+
if (this.promise) {
|
|
29
|
+
this.promise.then(fx);
|
|
30
|
+
return;
|
|
26
31
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
fx();
|
|
32
|
+
fx();
|
|
33
|
+
}
|
|
34
|
+
async setupNew(previous, id) {
|
|
35
|
+
if (previous) {
|
|
36
|
+
await previous;
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
this.map.delete(id);
|
|
42
|
-
this.promise = null;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=RefreshLock.js.map
|
|
38
|
+
await new Promise((resolve, reject) => {
|
|
39
|
+
this.map.set(id, resolve);
|
|
40
|
+
});
|
|
41
|
+
this.map.delete(id);
|
|
42
|
+
this.promise = null;
|
|
43
|
+
}
|
|
44
|
+
}
|