typecomposer 0.1.47 → 0.1.50
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/assets/index.js +1 -2
- package/core/components/AlertPanel.d.ts +6 -6
- package/core/components/AlertPanel.js +1 -75
- package/core/components/AlertPanel.js.map +1 -1
- package/core/components/AvatarPanel.d.ts +2 -2
- package/core/components/AvatarPanel.js +1 -62
- package/core/components/AvatarPanel.js.map +1 -1
- package/core/components/BorderPanel.d.ts +2 -2
- package/core/components/BorderPanel.js +1 -90
- package/core/components/BorderPanel.js.map +1 -1
- package/core/components/CardPanel.d.ts +2 -2
- package/core/components/CardPanel.js +1 -11
- package/core/components/CardPanel.js.map +1 -1
- package/core/components/CheckBox.d.ts +2 -2
- package/core/components/CheckBox.js +1 -109
- package/core/components/CheckBox.js.map +1 -1
- package/core/components/ColorPicker.d.ts +2 -2
- package/core/components/ColorPicker.js +1 -36
- package/core/components/ColorPicker.js.map +1 -1
- package/core/components/ContextMenu.d.ts +3 -3
- package/core/components/ContextMenu.js +1 -64
- package/core/components/ContextMenu.js.map +1 -1
- package/core/components/DialogPanel.d.ts +2 -2
- package/core/components/DialogPanel.js +1 -62
- package/core/components/DialogPanel.js.map +1 -1
- package/core/components/DropDown.d.ts +3 -3
- package/core/components/DropDown.js +1 -231
- package/core/components/DropDown.js.map +1 -1
- package/core/components/FlowPanel.d.ts +2 -2
- package/core/components/FlowPanel.js +1 -40
- package/core/components/FlowPanel.js.map +1 -1
- package/core/components/ForEach.d.ts +2 -2
- package/core/components/ForEach.js +1 -88
- package/core/components/ForEach.js.map +1 -1
- package/core/components/GridPanel.d.ts +4 -7
- package/core/components/GridPanel.js +1 -30
- package/core/components/GridPanel.js.map +1 -1
- package/core/components/HBox.d.ts +2 -2
- package/core/components/HBox.js +1 -10
- package/core/components/HBox.js.map +1 -1
- package/core/components/LazyLoading.d.ts +2 -2
- package/core/components/LazyLoading.js +1 -36
- package/core/components/LazyLoading.js.map +1 -1
- package/core/components/ListPanel.d.ts +2 -2
- package/core/components/ListPanel.js +1 -153
- package/core/components/ListPanel.js.map +1 -1
- package/core/components/PopUpButton.d.ts +2 -2
- package/core/components/PopUpButton.js +1 -57
- package/core/components/PopUpButton.js.map +1 -1
- package/core/components/ScrollPanel.d.ts +2 -2
- package/core/components/ScrollPanel.js +1 -35
- package/core/components/ScrollPanel.js.map +1 -1
- package/core/components/SliderPanel.d.ts +2 -2
- package/core/components/SliderPanel.js +1 -135
- package/core/components/SliderPanel.js.map +1 -1
- package/core/components/StackPanel.d.ts +2 -2
- package/core/components/StackPanel.js +1 -10
- package/core/components/StackPanel.js.map +1 -1
- package/core/components/TabItem.js +1 -84
- package/core/components/TabPanel.d.ts +2 -2
- package/core/components/TabPanel.js +1 -96
- package/core/components/TabPanel.js.map +1 -1
- package/core/components/TextEdit.js +1 -174
- package/core/components/TextField.d.ts +2 -2
- package/core/components/TextField.js +1 -140
- package/core/components/TextField.js.map +1 -1
- package/core/components/ToggleButton.d.ts +2 -2
- package/core/components/ToggleButton.js +1 -20
- package/core/components/ToggleButton.js.map +1 -1
- package/core/components/Tooltip.d.ts +4 -6
- package/core/components/Tooltip.js +1 -14
- package/core/components/Tooltip.js.map +1 -1
- package/core/components/VBox.d.ts +2 -2
- package/core/components/VBox.js +1 -10
- package/core/components/VBox.js.map +1 -1
- package/core/components/VirtualScroll.d.ts +2 -2
- package/core/components/VirtualScroll.js +1 -47
- package/core/components/index.d.ts +1 -2
- package/core/components/index.js +1 -30
- package/core/components/index.js.map +1 -1
- package/core/decorators/RegisterComponent.js +1 -20
- package/core/decorators/StyleLink.js +1 -13
- package/core/decorators/index.js +1 -6
- package/core/element/AbbreviationElement.d.ts +2 -4
- package/core/element/AbbreviationElement.js +1 -10
- package/core/element/AbbreviationElement.js.map +1 -1
- package/core/element/AnchorElement.d.ts +2 -18
- package/core/element/AnchorElement.js +1 -31
- package/core/element/AnchorElement.js.map +1 -1
- package/core/element/AreaElement.d.ts +2 -15
- package/core/element/AreaElement.js +1 -11
- package/core/element/AreaElement.js.map +1 -1
- package/core/element/ArticleElement.d.ts +2 -2
- package/core/element/ArticleElement.js +1 -12
- package/core/element/ArticleElement.js.map +1 -1
- package/core/element/AudioElement.d.ts +2 -9
- package/core/element/AudioElement.js +1 -10
- package/core/element/AudioElement.js.map +1 -1
- package/core/element/BaseElement.d.ts +2 -5
- package/core/element/BaseElement.js +1 -11
- package/core/element/BaseElement.js.map +1 -1
- package/core/element/BodyElement.d.ts +2 -2
- package/core/element/BodyElement.js +1 -11
- package/core/element/BodyElement.js.map +1 -1
- package/core/element/BoldElement.d.ts +2 -2
- package/core/element/BoldElement.js +1 -10
- package/core/element/BoldElement.js.map +1 -1
- package/core/element/BreakElement.d.ts +2 -2
- package/core/element/BreakElement.js +1 -10
- package/core/element/BreakElement.js.map +1 -1
- package/core/element/ButtonElement.d.ts +4 -21
- package/core/element/ButtonElement.js +1 -47
- package/core/element/ButtonElement.js.map +1 -1
- package/core/element/CanvasElement.d.ts +2 -2
- package/core/element/CanvasElement.js +1 -14
- package/core/element/CanvasElement.js.map +1 -1
- package/core/element/CaptionElement.d.ts +2 -2
- package/core/element/CaptionElement.js +1 -13
- package/core/element/CaptionElement.js.map +1 -1
- package/core/element/CiteElement.d.ts +2 -2
- package/core/element/CiteElement.js +1 -11
- package/core/element/CiteElement.js.map +1 -1
- package/core/element/CodeElement.d.ts +2 -2
- package/core/element/CodeElement.js +1 -13
- package/core/element/CodeElement.js.map +1 -1
- package/core/element/DataListElement.d.ts +2 -2
- package/core/element/DataListElement.js +1 -13
- package/core/element/DataListElement.js.map +1 -1
- package/core/element/DefinitionDescriptionElement.d.ts +2 -2
- package/core/element/DefinitionDescriptionElement.js +1 -13
- package/core/element/DefinitionDescriptionElement.js.map +1 -1
- package/core/element/DefinitionElement.d.ts +2 -2
- package/core/element/DefinitionElement.js +1 -13
- package/core/element/DefinitionElement.js.map +1 -1
- package/core/element/DeletedTextElement.d.ts +2 -4
- package/core/element/DeletedTextElement.js +1 -15
- package/core/element/DeletedTextElement.js.map +1 -1
- package/core/element/DetailsElement.d.ts +3 -6
- package/core/element/DetailsElement.js +1 -28
- package/core/element/DetailsElement.js.map +1 -1
- package/core/element/DialogElement.d.ts +2 -4
- package/core/element/DialogElement.js +1 -14
- package/core/element/DialogElement.js.map +1 -1
- package/core/element/DivElement.d.ts +2 -2
- package/core/element/DivElement.js +1 -10
- package/core/element/DivElement.js.map +1 -1
- package/core/element/EmElement.d.ts +2 -2
- package/core/element/EmElement.js +1 -10
- package/core/element/EmElement.js.map +1 -1
- package/core/element/EmbedElement.d.ts +2 -7
- package/core/element/EmbedElement.js +1 -19
- package/core/element/EmbedElement.js.map +1 -1
- package/core/element/FieldSetElement.d.ts +3 -6
- package/core/element/FieldSetElement.js +1 -34
- package/core/element/FieldSetElement.js.map +1 -1
- package/core/element/FooterElement.d.ts +2 -2
- package/core/element/FooterElement.js +1 -13
- package/core/element/FooterElement.js.map +1 -1
- package/core/element/FormElement.d.ts +2 -17
- package/core/element/FormElement.js +1 -36
- package/core/element/FormElement.js.map +1 -1
- package/core/element/Fragment.js +1 -103
- package/core/element/H1Element.d.ts +2 -2
- package/core/element/H1Element.js +1 -10
- package/core/element/H1Element.js.map +1 -1
- package/core/element/H2Element.d.ts +2 -2
- package/core/element/H2Element.js +1 -10
- package/core/element/H2Element.js.map +1 -1
- package/core/element/H3Element.d.ts +2 -2
- package/core/element/H3Element.js +1 -10
- package/core/element/H3Element.js.map +1 -1
- package/core/element/H4Element.d.ts +2 -2
- package/core/element/H4Element.js +1 -10
- package/core/element/H4Element.js.map +1 -1
- package/core/element/H5Element.d.ts +2 -2
- package/core/element/H5Element.js +1 -10
- package/core/element/H5Element.js.map +1 -1
- package/core/element/H6Element.d.ts +2 -2
- package/core/element/H6Element.js +1 -10
- package/core/element/H6Element.js.map +1 -1
- package/core/element/HeadElement.d.ts +2 -2
- package/core/element/HeadElement.js +1 -11
- package/core/element/HeadElement.js.map +1 -1
- package/core/element/HeaderElement.d.ts +2 -2
- package/core/element/HeaderElement.js +1 -13
- package/core/element/HeaderElement.js.map +1 -1
- package/core/element/HorizontalRuleElement.d.ts +2 -2
- package/core/element/HorizontalRuleElement.js +1 -13
- package/core/element/HorizontalRuleElement.js.map +1 -1
- package/core/element/HtmlElement.d.ts +2 -4
- package/core/element/HtmlElement.js +1 -19
- package/core/element/HtmlElement.js.map +1 -1
- package/core/element/IFrameElement.d.ts +2 -15
- package/core/element/IFrameElement.js +1 -67
- package/core/element/IFrameElement.js.map +1 -1
- package/core/element/ILayout.d.ts +2 -2
- package/core/element/ILayout.js +1 -9
- package/core/element/ILayout.js.map +1 -1
- package/core/element/IconElement.d.ts +2 -2
- package/core/element/IconElement.js +1 -32
- package/core/element/IconElement.js.map +1 -1
- package/core/element/IdiomaticElement.d.ts +2 -1
- package/core/element/IdiomaticElement.js +1 -6
- package/core/element/IdiomaticElement.js.map +1 -1
- package/core/element/ImageElement.d.ts +2 -2
- package/core/element/ImageElement.js +1 -17
- package/core/element/ImageElement.js.map +1 -1
- package/core/element/InputElement.d.ts +2 -16
- package/core/element/InputElement.js +1 -81
- package/core/element/InputElement.js.map +1 -1
- package/core/element/LabelElement.d.ts +2 -5
- package/core/element/LabelElement.js +1 -10
- package/core/element/LabelElement.js.map +1 -1
- package/core/element/LegendElement.d.ts +2 -4
- package/core/element/LegendElement.js +1 -15
- package/core/element/LegendElement.js.map +1 -1
- package/core/element/ListItemElement.d.ts +2 -4
- package/core/element/ListItemElement.js +1 -28
- package/core/element/ListItemElement.js.map +1 -1
- package/core/element/MainElement.d.ts +2 -2
- package/core/element/MainElement.js +1 -10
- package/core/element/MainElement.js.map +1 -1
- package/core/element/NavElement.d.ts +2 -2
- package/core/element/NavElement.js +1 -10
- package/core/element/NavElement.js.map +1 -1
- package/core/element/OrderedListElement.d.ts +2 -2
- package/core/element/OrderedListElement.js +1 -10
- package/core/element/OrderedListElement.js.map +1 -1
- package/core/element/ParagraphElement.d.ts +2 -2
- package/core/element/ParagraphElement.js +1 -10
- package/core/element/ParagraphElement.js.map +1 -1
- package/core/element/PreElement.d.ts +2 -2
- package/core/element/PreElement.js +1 -10
- package/core/element/PreElement.js.map +1 -1
- package/core/element/SectionElement.d.ts +2 -2
- package/core/element/SectionElement.js +1 -12
- package/core/element/SectionElement.js.map +1 -1
- package/core/element/SelectElement.d.ts +2 -2
- package/core/element/SelectElement.js +1 -12
- package/core/element/SelectElement.js.map +1 -1
- package/core/element/SourceElement.d.ts +2 -5
- package/core/element/SourceElement.js +1 -14
- package/core/element/SourceElement.js.map +1 -1
- package/core/element/SpanElement.d.ts +2 -2
- package/core/element/SpanElement.js +1 -10
- package/core/element/SpanElement.js.map +1 -1
- package/core/element/StrongElement.d.ts +2 -2
- package/core/element/StrongElement.js +1 -12
- package/core/element/StrongElement.js.map +1 -1
- package/core/element/StyleElement.d.ts +2 -2
- package/core/element/StyleElement.js +1 -10
- package/core/element/StyleElement.js.map +1 -1
- package/core/element/SummaryElement.d.ts +2 -2
- package/core/element/SummaryElement.js +1 -12
- package/core/element/SummaryElement.js.map +1 -1
- package/core/element/SvgElement.d.ts +3 -3
- package/core/element/SvgElement.js +1 -151
- package/core/element/SvgElement.js.map +1 -1
- package/core/element/TableBodyElement.d.ts +2 -2
- package/core/element/TableBodyElement.js +1 -10
- package/core/element/TableBodyElement.js.map +1 -1
- package/core/element/TableCellElement.d.ts +3 -6
- package/core/element/TableCellElement.js +1 -25
- package/core/element/TableCellElement.js.map +1 -1
- package/core/element/TableColElement.d.ts +2 -4
- package/core/element/TableColElement.js +1 -13
- package/core/element/TableColElement.js.map +1 -1
- package/core/element/TableColGroupElement.d.ts +2 -4
- package/core/element/TableColGroupElement.js +1 -15
- package/core/element/TableColGroupElement.js.map +1 -1
- package/core/element/TableElement.d.ts +2 -42
- package/core/element/TableElement.js +1 -228
- package/core/element/TableElement.js.map +1 -1
- package/core/element/TableFootElement.d.ts +2 -2
- package/core/element/TableFootElement.js +1 -10
- package/core/element/TableFootElement.js.map +1 -1
- package/core/element/TableFootRowElement.d.ts +2 -2
- package/core/element/TableFootRowElement.js +1 -23
- package/core/element/TableFootRowElement.js.map +1 -1
- package/core/element/TableHeadCellElement.d.ts +2 -2
- package/core/element/TableHeadCellElement.js +1 -24
- package/core/element/TableHeadCellElement.js.map +1 -1
- package/core/element/TableHeadElement.d.ts +2 -2
- package/core/element/TableHeadElement.js +1 -10
- package/core/element/TableHeadElement.js.map +1 -1
- package/core/element/TableHeadRowElement.d.ts +2 -2
- package/core/element/TableHeadRowElement.js +1 -29
- package/core/element/TableHeadRowElement.js.map +1 -1
- package/core/element/TableRowElement.d.ts +2 -2
- package/core/element/TableRowElement.js +1 -29
- package/core/element/TableRowElement.js.map +1 -1
- package/core/element/TextAreaElement.d.ts +2 -4
- package/core/element/TextAreaElement.js +1 -10
- package/core/element/TextAreaElement.js.map +1 -1
- package/core/element/UListElement.d.ts +2 -2
- package/core/element/UListElement.js +1 -10
- package/core/element/UListElement.js.map +1 -1
- package/core/element/VideoElement.d.ts +2 -10
- package/core/element/VideoElement.js +1 -16
- package/core/element/VideoElement.js.map +1 -1
- package/core/element/index.d.ts +3 -3
- package/core/element/index.js +1 -73
- package/core/element/index.js.map +1 -1
- package/core/event/index.js +1 -75
- package/core/index.d.ts +0 -3
- package/core/index.js +1 -10
- package/core/index.js.map +1 -1
- package/core/ref/Computed.js +1 -75
- package/core/ref/Computed.js.map +1 -1
- package/core/ref/RefBoolean.js +1 -119
- package/core/ref/RefContainer.js +1 -114
- package/core/ref/RefContainer.js.map +1 -1
- package/core/ref/RefList.js +1 -240
- package/core/ref/RefMap.js +1 -149
- package/core/ref/RefNumber.js +1 -157
- package/core/ref/RefObject.js +1 -265
- package/core/ref/RefObject.js.map +1 -1
- package/core/ref/RefProperty.js +1 -46
- package/core/ref/RefSet.js +1 -148
- package/core/ref/RefState.js +1 -89
- package/core/ref/RefString.js +1 -179
- package/core/ref/RefString.js.map +1 -1
- package/core/ref/index.js +1 -71
- package/core/router/RouteView.d.ts +2 -2
- package/core/router/RouteView.js +1 -84
- package/core/router/RouteView.js.map +1 -1
- package/core/router/Router.d.ts +8 -9
- package/core/router/Router.js +1 -307
- package/core/router/Router.js.map +1 -1
- package/core/router/RouterEvent.js +1 -43
- package/core/router/RouterGuard.js +1 -3
- package/core/router/index.js +1 -5
- package/core/styles/index.d.ts +3 -3
- package/core/styles/index.js +1 -36
- package/core/styles/index.js.map +1 -1
- package/{core/app/index.d.ts → global/app.d.ts} +5 -7
- package/global/app.js +1 -0
- package/global/app.js.map +1 -0
- package/global/index.d.ts +10 -4
- package/global/index.js +1 -1286
- package/global/index.js.map +1 -1
- package/global/safari-polyfill.js +1 -234
- package/index.d.ts +1 -0
- package/index.js +1 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/style.scss +2 -17
- package/typings/index.d.ts +58 -66
- package/LICENSE +0 -21
- package/README.md +0 -62
- package/core/app/Validate.d.ts +0 -61
- package/core/app/Validate.js +0 -2
- package/core/app/Validate.js.map +0 -1
- package/core/app/index.js +0 -181
- package/core/app/index.js.map +0 -1
- package/core/components/TablePanel.d.ts +0 -34
- package/core/components/TablePanel.js +0 -127
- package/core/components/TablePanel.js.map +0 -1
- package/core/components/VirtualScroll copy 2.d.ts +0 -24
- package/core/components/VirtualScroll copy 2.js +0 -92
- package/core/components/VirtualScroll copy 2.js.map +0 -1
- package/core/ref/RefObject copy.d.ts +0 -124
- package/core/ref/RefObject copy.js +0 -271
- package/core/ref/RefObject copy.js.map +0 -1
|
@@ -1,64 +1 @@
|
|
|
1
|
-
import { Component
|
|
2
|
-
export class ContextMenuItem extends HTMLElement {
|
|
3
|
-
static TAG = "tc-context-menu-item";
|
|
4
|
-
constructor(props) {
|
|
5
|
-
super();
|
|
6
|
-
this.addClassName("tc-context-menu-item");
|
|
7
|
-
this.innerHTML = "<i class='fa fa-cut'></i>";
|
|
8
|
-
Component.applyProps(this, props);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
TypeComposer.defineElement(ContextMenuItem.TAG, ContextMenuItem);
|
|
12
|
-
export class ContextMenu extends Component {
|
|
13
|
-
static TAG = "tc-context-menu";
|
|
14
|
-
constructor(props) {
|
|
15
|
-
super({ ...props, style: { display: "none", flexDirection: "column", ...props?.style } });
|
|
16
|
-
this.addClassName("tc-context-menu");
|
|
17
|
-
Component.applyProps(this, props);
|
|
18
|
-
//window.addEventListener("contextmenu", (event) => {
|
|
19
|
-
// event.preventDefault();
|
|
20
|
-
// this.setPosition(event.clientX, event.clientY);
|
|
21
|
-
//});
|
|
22
|
-
}
|
|
23
|
-
setPosition(x, y) {
|
|
24
|
-
this.style.top = y + "px";
|
|
25
|
-
this.style.left = x + "px";
|
|
26
|
-
}
|
|
27
|
-
setPositionTarget(target, type = "bottom") {
|
|
28
|
-
const rect = target.getBoundingClientRect();
|
|
29
|
-
if (type == "top") {
|
|
30
|
-
this.style.top = rect.top + "px";
|
|
31
|
-
this.style.left = rect.left + "px";
|
|
32
|
-
}
|
|
33
|
-
else if (type == "bottom") {
|
|
34
|
-
this.style.top = rect.bottom + "px";
|
|
35
|
-
this.style.left = rect.left + "px";
|
|
36
|
-
}
|
|
37
|
-
else if (type == "left") {
|
|
38
|
-
this.style.top = rect.top + "px";
|
|
39
|
-
this.style.left = rect.left + "px";
|
|
40
|
-
}
|
|
41
|
-
else if (type == "right") {
|
|
42
|
-
this.style.top = rect.top + "px";
|
|
43
|
-
this.style.left = rect.right + "px";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
show() {
|
|
47
|
-
this.style.display = "flex";
|
|
48
|
-
this.onOpen();
|
|
49
|
-
}
|
|
50
|
-
toggle() {
|
|
51
|
-
if (this.style.display == "flex")
|
|
52
|
-
this.close();
|
|
53
|
-
else
|
|
54
|
-
this.show();
|
|
55
|
-
}
|
|
56
|
-
close() {
|
|
57
|
-
this.style.display = "none";
|
|
58
|
-
this.onClose();
|
|
59
|
-
}
|
|
60
|
-
onClose = () => { };
|
|
61
|
-
onOpen = () => { };
|
|
62
|
-
}
|
|
63
|
-
TypeComposer.defineElement(ContextMenu.TAG, ContextMenu);
|
|
64
|
-
//# sourceMappingURL=ContextMenu.js.map
|
|
1
|
+
import{Component}from"../../";export class ContextMenuItem extends HTMLElement{static TAG="tc-context-menu-item";constructor(t){super(),this.addClassName("tc-context-menu-item"),this.innerHTML="<i class='fa fa-cut'></i>",Component.applyProps(this,t)}}TypeComposer.defineElement(ContextMenuItem.TAG,ContextMenuItem);export class ContextMenu extends Component{static TAG="tc-context-menu";constructor(t){super({...t,style:{display:"none",flexDirection:"column",...t?.style}}),this.addClassName("tc-context-menu"),Component.applyProps(this,t)}setPosition(t,e){this.style.top=e+"px",this.style.left=t+"px"}setPositionTarget(t,e="bottom"){const s=t.getBoundingClientRect();"top"==e?(this.style.top=s.top+"px",this.style.left=s.left+"px"):"bottom"==e?(this.style.top=s.bottom+"px",this.style.left=s.left+"px"):"left"==e?(this.style.top=s.top+"px",this.style.left=s.left+"px"):"right"==e&&(this.style.top=s.top+"px",this.style.left=s.right+"px")}show(){this.style.display="flex",this.onOpen()}toggle(){"flex"==this.style.display?this.close():this.show()}close(){this.style.display="none",this.onClose()}onClose=()=>{};onOpen=()=>{}}TypeComposer.defineElement(ContextMenu.TAG,ContextMenu);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../../src/core/components/ContextMenu.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ContextMenu.js","sourceRoot":"","sources":["../../../src/core/components/ContextMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGhD,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C,MAAM,CAAU,GAAG,GAAW,sBAAsB,CAAC;IACtD,YAAY,KAAmB;QAC9B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,CAAC,sBAAsB,CAAC,CA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,MAAM,GAAG,IAAI,CAAC;YACpC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACpC,CAAC;aACI,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YACzB,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;YACjC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACpC,CAAC;aACI,IAAI,IAAI,IAAI,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;YACjC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACrC,CAAC;IACF,CAAC;IAED,IAAI;QACH,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;IAED,MAAM;QACL,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,MAAM;YAAE,IAAI,CAAC,KAAK,EAAE,CAAC;;YAC1C,IAAI,CAAC,IAAI,EAAE,CAAC;IAClB,CAAC;IAED,KAAK;QACJ,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;QAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;IACpB,MAAM,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;;AAIpB,YAAY,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementType, DialogElement } from "../..";
|
|
2
2
|
export declare class DialogPanel extends DialogElement implements IComponent {
|
|
3
3
|
#private;
|
|
4
4
|
static readonly TAG: string;
|
|
@@ -7,7 +7,7 @@ export declare class DialogPanel extends DialogElement implements IComponent {
|
|
|
7
7
|
show?: boolean | "modal" | "popover" | "show";
|
|
8
8
|
clickOutsideToClose?: boolean;
|
|
9
9
|
root?: HTMLElement | "body";
|
|
10
|
-
} &
|
|
10
|
+
} & ElementType);
|
|
11
11
|
showModal(): void;
|
|
12
12
|
showPopover(): void;
|
|
13
13
|
onOpen(): void;
|
|
@@ -1,62 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export class DialogPanel extends DialogElement {
|
|
3
|
-
static TAG = "tc-dialog-panel";
|
|
4
|
-
clickOutsideToClose = true;
|
|
5
|
-
#initShow = false;
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super();
|
|
8
|
-
props = props || {};
|
|
9
|
-
this.close();
|
|
10
|
-
this.addEventListener("click", (event) => {
|
|
11
|
-
const rect = this.getBoundingClientRect();
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
const padding = parseFloat(this.style?.padding || 0);
|
|
14
|
-
const innerLeft = rect.left + padding;
|
|
15
|
-
const innerRight = rect.right - padding;
|
|
16
|
-
const innerTop = rect.top + padding;
|
|
17
|
-
const innerBottom = rect.bottom - padding;
|
|
18
|
-
const isInMargin = event.clientX < innerLeft || event.clientX > innerRight || event.clientY < innerTop || event.clientY > innerBottom;
|
|
19
|
-
if (isInMargin && this.clickOutsideToClose)
|
|
20
|
-
if (this.clickOutsideToClose)
|
|
21
|
-
this.close("close");
|
|
22
|
-
event.stopPropagation();
|
|
23
|
-
});
|
|
24
|
-
this.addEventListener("close", () => {
|
|
25
|
-
this.onClose(this.returnValue);
|
|
26
|
-
});
|
|
27
|
-
if (props?.clickOutsideToClose !== undefined)
|
|
28
|
-
this.clickOutsideToClose = props.clickOutsideToClose;
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
if (props?.content)
|
|
31
|
-
this.content = props.content;
|
|
32
|
-
delete props?.variant;
|
|
33
|
-
this.#initShow = props?.show || false;
|
|
34
|
-
delete props?.show;
|
|
35
|
-
this.addEventListener("onConnected", () => {
|
|
36
|
-
if (this.#initShow == true || this.#initShow == "modal")
|
|
37
|
-
this.showModal();
|
|
38
|
-
else if (this.#initShow == "popover")
|
|
39
|
-
this.showPopover();
|
|
40
|
-
else if (this.#initShow == "show")
|
|
41
|
-
this.show();
|
|
42
|
-
});
|
|
43
|
-
if (props.root == "body")
|
|
44
|
-
document.body.appendChild(this);
|
|
45
|
-
else if (props.root)
|
|
46
|
-
props.root.appendChild(this);
|
|
47
|
-
delete props?.root;
|
|
48
|
-
Component.applyProps(this, props);
|
|
49
|
-
}
|
|
50
|
-
showModal() {
|
|
51
|
-
this.onOpen();
|
|
52
|
-
super.showModal();
|
|
53
|
-
}
|
|
54
|
-
showPopover() {
|
|
55
|
-
this.onOpen();
|
|
56
|
-
super.showPopover();
|
|
57
|
-
}
|
|
58
|
-
onOpen() { }
|
|
59
|
-
onClose(returnValue) { }
|
|
60
|
-
}
|
|
61
|
-
TypeComposer.defineElement(DialogPanel.TAG, DialogPanel, { extends: "dialog" });
|
|
62
|
-
//# sourceMappingURL=DialogPanel.js.map
|
|
1
|
+
import{Component,DialogElement}from"../..";export class DialogPanel extends DialogElement{static TAG="tc-dialog-panel";clickOutsideToClose=!0;#o=!1;constructor(o){super(),o=o||{},this.close(),this.addEventListener("click",o=>{const t=this.getBoundingClientRect(),e=parseFloat(this.style?.padding||0),i=t.left+e,s=t.right-e,n=t.top+e,l=t.bottom-e;(o.clientX<i||o.clientX>s||o.clientY<n||o.clientY>l)&&this.clickOutsideToClose&&this.clickOutsideToClose&&this.close("close"),o.stopPropagation()}),this.addEventListener("close",()=>{this.onClose(this.returnValue)}),void 0!==o?.clickOutsideToClose&&(this.clickOutsideToClose=o.clickOutsideToClose),o?.content&&(this.content=o.content),delete o?.variant,this.#o=o?.show||!1,delete o?.show,this.addEventListener("onConnected",()=>{1==this.#o||"modal"==this.#o?this.showModal():"popover"==this.#o?this.showPopover():"show"==this.#o&&this.show()}),"body"==o.root?document.body.appendChild(this):o.root&&o.root.appendChild(this),delete o?.root,Component.applyProps(this,o)}showModal(){this.onOpen(),super.showModal()}showPopover(){this.onOpen(),super.showPopover()}onOpen(){}onClose(o){}}TypeComposer.defineElement(DialogPanel.TAG,DialogPanel,{extends:"dialog"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogPanel.js","sourceRoot":"","sources":["../../../src/core/components/DialogPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"DialogPanel.js","sourceRoot":"","sources":["../../../src/core/components/DialogPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAe,aAAa,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,OAAO,WAAY,SAAQ,aAAa;IAC5C,MAAM,CAAU,GAAG,GAAW,iBAAiB,CAAC;IAChD,mBAAmB,GAAG,IAAI,CAAC;IAC3B,SAAS,GAA2C,KAAK,CAAC;IAE1D,YACE,KAIe;QAEf,KAAK,EAAE,CAAC;QACR,KAAK,GAAG,KAAK,IAAI,EAAG,CAAC;QACrB,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,KAAU,EAAE,EAAE;YAC5C,MAAM,IAAI,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC1C,aAAa;YACb,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC;YACrD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;YACtC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;YACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC;YACpC,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;YAE1C,MAAM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Q,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;aACrD,IAAI,KAAK,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAClD,OAAO,KAAK,EAAE,IAAI,CAAC;QACnB,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,KAAoB,CAAC,CAAC;IACnD,CAAC;IAED,SAAS;QACP,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,KAAK,CAAC,SAAS,EAAE,CAAC;IACpB,CAAC;IAED,WAAW;QACT,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,KAAK,CAAC,WAAW,EAAE,CAAC;IACtB,CAAC;IAED,MAAM,KAAW,CAAC;IAElB,OAAO,CAAC,WAAoB,IAAI,CAAC;;AAGnC,YAAY,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Component, DivElement,
|
|
1
|
+
import { Component, DivElement, ElementType, TextField, ref } from "../..";
|
|
2
2
|
export type SelectionType = "closeAndClean" | "closeAndKeep" | "openAndClean" | "openAndKeep";
|
|
3
3
|
export declare class DropDownItem extends Component {
|
|
4
4
|
static readonly TAG: string;
|
|
5
|
-
constructor(props?:
|
|
5
|
+
constructor(props?: ElementType);
|
|
6
6
|
}
|
|
7
7
|
export declare class DropDown<T = any> extends TextField {
|
|
8
8
|
#private;
|
|
@@ -18,7 +18,7 @@ export declare class DropDown<T = any> extends TextField {
|
|
|
18
18
|
textValue: (value: T | undefined) => string | undefined;
|
|
19
19
|
textSelected: (value: T | undefined) => string | undefined;
|
|
20
20
|
private _filter;
|
|
21
|
-
constructor(props?:
|
|
21
|
+
constructor(props?: ElementType & {
|
|
22
22
|
required?: boolean;
|
|
23
23
|
noContent?: string;
|
|
24
24
|
options?: T[];
|
|
@@ -1,231 +1 @@
|
|
|
1
|
-
import { Component, DivElement, TextField, ref }
|
|
2
|
-
export class DropDownItem extends Component {
|
|
3
|
-
static TAG = "tc-drop-down-item";
|
|
4
|
-
constructor(props) {
|
|
5
|
-
super({ ...props, style: { display: "block", unicodeBidi: "isolate", ...props?.style } });
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
TypeComposer.defineElement(DropDownItem.TAG, DropDownItem);
|
|
9
|
-
export class DropDown extends TextField {
|
|
10
|
-
props;
|
|
11
|
-
static TAG = "tc-drop-down";
|
|
12
|
-
onSelectionAction = this.closeAndClean.bind(this);
|
|
13
|
-
_selectionType;
|
|
14
|
-
previousSelected = [];
|
|
15
|
-
#options;
|
|
16
|
-
#value;
|
|
17
|
-
_dropdownContent;
|
|
18
|
-
_idClass;
|
|
19
|
-
_arrow;
|
|
20
|
-
_selected = -1;
|
|
21
|
-
textValue = undefined;
|
|
22
|
-
textSelected = undefined;
|
|
23
|
-
_filter = () => true;
|
|
24
|
-
constructor(props) {
|
|
25
|
-
super({ required: props?.required, label: props?.placeholder, placeholder: props?.placeholder, placeholderAnimation: props?.placeholder == undefined ? false : props?.placeholderAnimation, variant: props?.variant || "outline" });
|
|
26
|
-
this.props = props;
|
|
27
|
-
const v = props?.value;
|
|
28
|
-
delete props?.value;
|
|
29
|
-
Component.applyProps(this, props);
|
|
30
|
-
props.value = v;
|
|
31
|
-
this.#value = v;
|
|
32
|
-
this.dropdownContent = new DivElement({ className: "dropdown-content" });
|
|
33
|
-
this.dropdownContent.variant = props?.variant;
|
|
34
|
-
this.append(this.dropdownContent);
|
|
35
|
-
this.#onInit();
|
|
36
|
-
this.selectionType = props.selectionType || "closeAndClean";
|
|
37
|
-
if (props.textValue)
|
|
38
|
-
this.textValue = props.textValue;
|
|
39
|
-
if (props.textSelected)
|
|
40
|
-
this.textSelected = props.textSelected;
|
|
41
|
-
if (props.textSelected == undefined && props.textValue != undefined)
|
|
42
|
-
this.textSelected = props.textValue;
|
|
43
|
-
this.#options = props.options;
|
|
44
|
-
this.input.addEventListener("input", () => {
|
|
45
|
-
if (this.input.readOnly == false) {
|
|
46
|
-
this.updateContent();
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
this.filter = props.filter;
|
|
50
|
-
this.updateContent();
|
|
51
|
-
}
|
|
52
|
-
get filter() {
|
|
53
|
-
return this._filter;
|
|
54
|
-
}
|
|
55
|
-
set filter(filter) {
|
|
56
|
-
if (!this.input.required)
|
|
57
|
-
this.input.readOnly = filter == undefined;
|
|
58
|
-
if (filter == undefined)
|
|
59
|
-
filter = () => true;
|
|
60
|
-
else
|
|
61
|
-
this._filter = filter;
|
|
62
|
-
}
|
|
63
|
-
#onInit() {
|
|
64
|
-
this._arrow = new DivElement({ className: "arrow-down", text: "▼" });
|
|
65
|
-
this.append(this._arrow);
|
|
66
|
-
this.onclick = (event) => {
|
|
67
|
-
if (this.options.length === 0)
|
|
68
|
-
return;
|
|
69
|
-
if (this.dropdownContent.contains(event.target)) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
this.dropdownContent.classList.toggle("pressed");
|
|
73
|
-
this._arrow.classList.toggle("up");
|
|
74
|
-
};
|
|
75
|
-
this.handleClickOutside = this.handleClickOutside.bind(this);
|
|
76
|
-
document.addEventListener("mousedown", this.handleClickOutside);
|
|
77
|
-
if (this.input.required) {
|
|
78
|
-
this.input.removeAttribute("readonly");
|
|
79
|
-
this.input.readOnly = undefined;
|
|
80
|
-
this.input.style.pointerEvents = "none";
|
|
81
|
-
this.input.oninvalid = (event) => {
|
|
82
|
-
if (!this.input.validity.valueMissing) {
|
|
83
|
-
this.input.setCustomValidity("");
|
|
84
|
-
event.preventDefault();
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
this.input.setCustomValidity(TextField.validateMessage.valueMissing);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
handleClickOutside(event) {
|
|
93
|
-
if (!this.contains(event.target) && !this.dropdownContent.contains(event.target) && this.dropdownContent.classList.contains("pressed")) {
|
|
94
|
-
this._arrow.classList.toggle("pressed");
|
|
95
|
-
this.dropdownContent.classList.toggle("pressed");
|
|
96
|
-
this._arrow.classList.toggle("up");
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
get arrow() {
|
|
100
|
-
return this._arrow;
|
|
101
|
-
}
|
|
102
|
-
get selected() {
|
|
103
|
-
return this.#options.value[this._selected];
|
|
104
|
-
}
|
|
105
|
-
set selected(value) {
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
if (this.#value instanceof ref)
|
|
108
|
-
this.#value.value = value;
|
|
109
|
-
else
|
|
110
|
-
this.#value = value;
|
|
111
|
-
this._selected = this.options.findIndex((option) => new String(option).toString() == new String(value).toString());
|
|
112
|
-
if (this._selected == -1)
|
|
113
|
-
return;
|
|
114
|
-
const items = this.dropdownContent.querySelectorAll(".option");
|
|
115
|
-
if (items)
|
|
116
|
-
this.selectOption(this.options[this._selected], this._selected, items[this._selected]);
|
|
117
|
-
this.dropdownContent.classList.remove("pressed");
|
|
118
|
-
}
|
|
119
|
-
closeAndClean() {
|
|
120
|
-
// @ts-ignore
|
|
121
|
-
Array.from(this.dropdownContent.children).forEach((value) => {
|
|
122
|
-
value.classList.remove("selected");
|
|
123
|
-
});
|
|
124
|
-
this.arrow.classList.toggle("pressed");
|
|
125
|
-
this.dropdownContent.classList.toggle("pressed");
|
|
126
|
-
this.arrow.classList.toggle("up");
|
|
127
|
-
}
|
|
128
|
-
closeAndKeep() {
|
|
129
|
-
this.arrow.classList.toggle("pressed");
|
|
130
|
-
this.dropdownContent.classList.toggle("pressed");
|
|
131
|
-
this.arrow.classList.toggle("up");
|
|
132
|
-
}
|
|
133
|
-
openAndClean() {
|
|
134
|
-
// @ts-ignore
|
|
135
|
-
Array.from(this.dropdownContent.children).forEach((child) => {
|
|
136
|
-
child.classList.remove("selected");
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
get selectionType() {
|
|
140
|
-
return this._selectionType;
|
|
141
|
-
}
|
|
142
|
-
set selectionType(selectionType) {
|
|
143
|
-
if (selectionType == "closeAndKeep") {
|
|
144
|
-
this.onSelectionAction = this.closeAndKeep.bind(this);
|
|
145
|
-
}
|
|
146
|
-
else if (selectionType == "openAndClean") {
|
|
147
|
-
this.onSelectionAction = this.openAndClean.bind(this);
|
|
148
|
-
}
|
|
149
|
-
else if (selectionType == "openAndKeep") {
|
|
150
|
-
this.onSelectionAction = () => { };
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
this.onSelectionAction = this.closeAndClean.bind(this);
|
|
154
|
-
}
|
|
155
|
-
this._selectionType = selectionType;
|
|
156
|
-
}
|
|
157
|
-
get options() {
|
|
158
|
-
return this.#options;
|
|
159
|
-
}
|
|
160
|
-
set options(items) {
|
|
161
|
-
this.#options = items;
|
|
162
|
-
this.updateContent();
|
|
163
|
-
}
|
|
164
|
-
updateContent() {
|
|
165
|
-
if (!this.dropdownContent)
|
|
166
|
-
return;
|
|
167
|
-
this.dropdownContent.innerHTML = "";
|
|
168
|
-
const options = this.options;
|
|
169
|
-
for (let i = 0; i < options.length; i++) {
|
|
170
|
-
const option = options[i];
|
|
171
|
-
if (!this.filter(option, this.input.value.toString()))
|
|
172
|
-
continue;
|
|
173
|
-
let node;
|
|
174
|
-
if (option instanceof Node)
|
|
175
|
-
node = this.dropdownContent.appendChild(option);
|
|
176
|
-
else {
|
|
177
|
-
const div = new DropDownItem({
|
|
178
|
-
text: this.textValue ? this.textValue(option) : option?.toString() || "",
|
|
179
|
-
});
|
|
180
|
-
node = div;
|
|
181
|
-
if (this.previousSelected.includes(option)) {
|
|
182
|
-
div.classList.toggle("selected");
|
|
183
|
-
}
|
|
184
|
-
this.dropdownContent.append(div);
|
|
185
|
-
}
|
|
186
|
-
node.classList.add("option");
|
|
187
|
-
node.onclick = () => this.selectOption(option, i, node);
|
|
188
|
-
}
|
|
189
|
-
if (this.input.readOnly)
|
|
190
|
-
this.input.value =
|
|
191
|
-
this.selected == undefined ? this.props?.defaultOption || "" : this.textSelected ? this.textSelected(this.selected) : this.selected?.toString() || "";
|
|
192
|
-
if (this._selected == -1 && this.#value) {
|
|
193
|
-
// @ts-ignore
|
|
194
|
-
this.selected = this.#value instanceof ref ? this.#value.toJSON() : this.#value;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
selectOption(option, index, element) {
|
|
198
|
-
this.onSelectionAction();
|
|
199
|
-
element.classList.toggle("selected");
|
|
200
|
-
if (element.classList.contains("selected")) {
|
|
201
|
-
this.previousSelected.push(option);
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
this.previousSelected = this.previousSelected.filter((selectedOption) => selectedOption !== option);
|
|
205
|
-
}
|
|
206
|
-
// @ts-ignore
|
|
207
|
-
if (this.#value instanceof ref)
|
|
208
|
-
this.#value.value = option;
|
|
209
|
-
else
|
|
210
|
-
this.#value = option;
|
|
211
|
-
this.input.value = this.textSelected ? this.textSelected(option) : option?.toString() || "";
|
|
212
|
-
this._selected = index;
|
|
213
|
-
this.input.style.color = "black";
|
|
214
|
-
this.dispatchEvent(new CustomEvent("change", { detail: { item: option, index } }));
|
|
215
|
-
}
|
|
216
|
-
get dropdownContent() {
|
|
217
|
-
return this._dropdownContent;
|
|
218
|
-
}
|
|
219
|
-
set dropdownContent(dropdownContent) {
|
|
220
|
-
this._dropdownContent = dropdownContent;
|
|
221
|
-
}
|
|
222
|
-
get idClass() {
|
|
223
|
-
return this._idClass;
|
|
224
|
-
}
|
|
225
|
-
set idClass(idClass) {
|
|
226
|
-
this._idClass = idClass;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
TypeComposer.defineElement(DropDown.TAG, DropDown);
|
|
230
|
-
Component.mergeVariant(DropDown, TextField);
|
|
231
|
-
//# sourceMappingURL=DropDown.js.map
|
|
1
|
+
import{Component,DivElement,TextField,ref}from"../..";export class DropDownItem extends Component{static TAG="tc-drop-down-item";constructor(t){super({...t,style:{display:"block",unicodeBidi:"isolate",...t?.style}})}}TypeComposer.defineElement(DropDownItem.TAG,DropDownItem);export class DropDown extends TextField{props;static TAG="tc-drop-down";onSelectionAction=this.closeAndClean.bind(this);_selectionType;previousSelected=[];#t;#e;_dropdownContent;_idClass;_arrow;_selected=-1;textValue=void 0;textSelected=void 0;_filter=()=>!0;constructor(t){super({required:t?.required,label:t?.placeholder,placeholder:t?.placeholder,placeholderAnimation:null!=t?.placeholder&&t?.placeholderAnimation,variant:t?.variant||"outline"}),this.props=t;const e=t?.value;delete t?.value,Component.applyProps(this,t),t.value=e,this.#e=e,this.dropdownContent=new DivElement({className:"dropdown-content"}),this.dropdownContent.variant=t?.variant,this.append(this.dropdownContent),this.#s(),this.selectionType=t.selectionType||"closeAndClean",t.textValue&&(this.textValue=t.textValue),t.textSelected&&(this.textSelected=t.textSelected),null==t.textSelected&&null!=t.textValue&&(this.textSelected=t.textValue),this.#t=t.options,this.input.addEventListener("input",()=>{0==this.input.readOnly&&this.updateContent()}),this.filter=t.filter,this.updateContent()}get filter(){return this._filter}set filter(t){this.input.required||(this.input.readOnly=null==t),null==t?t=()=>!0:this._filter=t}#s(){this._arrow=new DivElement({className:"arrow-down",text:"▼"}),this.append(this._arrow),this.onclick=t=>{0!==this.options.length&&(this.dropdownContent.contains(t.target)||(this.dropdownContent.classList.toggle("pressed"),this._arrow.classList.toggle("up")))},this.handleClickOutside=this.handleClickOutside.bind(this),document.addEventListener("mousedown",this.handleClickOutside),this.input.required&&(this.input.removeAttribute("readonly"),this.input.readOnly=void 0,this.input.style.pointerEvents="none",this.input.oninvalid=t=>{this.input.validity.valueMissing?this.input.setCustomValidity(TextField.validateMessage.valueMissing):(this.input.setCustomValidity(""),t.preventDefault())})}handleClickOutside(t){this.contains(t.target)||this.dropdownContent.contains(t.target)||!this.dropdownContent.classList.contains("pressed")||(this._arrow.classList.toggle("pressed"),this.dropdownContent.classList.toggle("pressed"),this._arrow.classList.toggle("up"))}get arrow(){return this._arrow}get selected(){return this.#t.value[this._selected]}set selected(t){if(this.#e instanceof ref?this.#e.value=t:this.#e=t,this._selected=this.options.findIndex(e=>new String(e).toString()==new String(t).toString()),-1==this._selected)return;const e=this.dropdownContent.querySelectorAll(".option");e&&this.selectOption(this.options[this._selected],this._selected,e[this._selected]),this.dropdownContent.classList.remove("pressed")}closeAndClean(){Array.from(this.dropdownContent.children).forEach(t=>{t.classList.remove("selected")}),this.arrow.classList.toggle("pressed"),this.dropdownContent.classList.toggle("pressed"),this.arrow.classList.toggle("up")}closeAndKeep(){this.arrow.classList.toggle("pressed"),this.dropdownContent.classList.toggle("pressed"),this.arrow.classList.toggle("up")}openAndClean(){Array.from(this.dropdownContent.children).forEach(t=>{t.classList.remove("selected")})}get selectionType(){return this._selectionType}set selectionType(t){this.onSelectionAction="closeAndKeep"==t?this.closeAndKeep.bind(this):"openAndClean"==t?this.openAndClean.bind(this):"openAndKeep"==t?()=>{}:this.closeAndClean.bind(this),this._selectionType=t}get options(){return this.#t}set options(t){this.#t=t,this.updateContent()}updateContent(){if(!this.dropdownContent)return;this.dropdownContent.innerHTML="";const t=this.options;for(let e=0;e<t.length;e++){const s=t[e];if(!this.filter(s,this.input.value.toString()))continue;let i;if(s instanceof Node)i=this.dropdownContent.appendChild(s);else{const t=new DropDownItem({text:this.textValue?this.textValue(s):s?.toString()||""});i=t,this.previousSelected.includes(s)&&t.classList.toggle("selected"),this.dropdownContent.append(t)}i.classList.add("option"),i.onclick=()=>this.selectOption(s,e,i)}this.input.readOnly&&(this.input.value=null==this.selected?this.props?.defaultOption||"":this.textSelected?this.textSelected(this.selected):this.selected?.toString()||""),-1==this._selected&&this.#e&&(this.selected=this.#e instanceof ref?this.#e.toJSON():this.#e)}selectOption(t,e,s){this.onSelectionAction(),s.classList.toggle("selected"),s.classList.contains("selected")?this.previousSelected.push(t):this.previousSelected=this.previousSelected.filter(e=>e!==t),this.#e instanceof ref?this.#e.value=t:this.#e=t,this.input.value=this.textSelected?this.textSelected(t):t?.toString()||"",this._selected=e,this.input.style.color="black",this.dispatchEvent(new CustomEvent("change",{detail:{item:t,index:e}}))}get dropdownContent(){return this._dropdownContent}set dropdownContent(t){this._dropdownContent=t}get idClass(){return this._idClass}set idClass(t){this._idClass=t}}TypeComposer.defineElement(DropDown.TAG,DropDown),Component.mergeVariant(DropDown,TextField);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropDown.js","sourceRoot":"","sources":["../../../src/core/components/DropDown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"DropDown.js","sourceRoot":"","sources":["../../../src/core/components/DropDown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAe,SAAS,EAAE,GAAG,EAAoB,MAAM,OAAO,CAAC;AAI7F,MAAM,OAAO,YAAa,SAAQ,SAAS;IACzC,MAAM,CAAU,GAAG,GAAW,mBAAmB,CAAC;IAClD,YAAY,KAAmB;QAC7B,KAAK,CAAC,EAAG,GAAG,KAAK,EAAC,KAAK,EAAE,EAAC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,KAAK,EAAC,EAAE,CAAC,CAAC;IAC1F,CAAC;;AAGH,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;AAE3D,MAAM,OAAO,QAAkB,SAAQ,SAAS;IAgBpC;IAfV,MAAM,CAAU,GAAG,GAAW,cAAc,CAAC;IACrC,iBAAiB,GAAe,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9D,cAAc,CAAgB;IAC9B,gBAAgB,GAAQ,EAAE,CAAC;IACnC,QAAQ,CAAM;IACd,MAAM,CAAa;IACX,gBAAgB,CAAa;IAC7B,QAAQ,CAAS;IACjB,MAAM,CAAa;IACnB,SAAS,GAAW,CAAC,CAAC,CAAC;IAC/B,SAAS,GAAiD,SAAS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AC,aAAa,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAEnD,SAAS,CAAC,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Component, type
|
|
1
|
+
import { Component, type ElementType } from "../..";
|
|
2
2
|
export type FlowType = "flow-1" | "flow-2" | "flow-3" | "flow-4" | "flow-5" | "flow-6" | "flow-7" | "flow-8" | "flow-9" | "flow-10" | "flow-11" | "flow-12";
|
|
3
3
|
export declare class FlowPanel extends Component {
|
|
4
4
|
static readonly TAG: string;
|
|
5
|
-
constructor(props?:
|
|
5
|
+
constructor(props?: ElementType);
|
|
6
6
|
appendChild<T extends Node>(node: T, flowType?: FlowType): T;
|
|
7
7
|
removeChild<T extends Node>(child: T): T;
|
|
8
8
|
private addClassNameInChilds;
|
|
@@ -1,40 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export class FlowPanel extends Component {
|
|
3
|
-
static TAG = "tc-flow-panel";
|
|
4
|
-
constructor(props) {
|
|
5
|
-
super({ ...props, style: { overflow: "hidden", ...props?.style } });
|
|
6
|
-
this.addClassName("flow-panel");
|
|
7
|
-
}
|
|
8
|
-
appendChild(node, flowType = "flow-6") {
|
|
9
|
-
if (node && !node.classList.contains("flow-pane-item"))
|
|
10
|
-
this.addClassNameInChilds(node, flowType);
|
|
11
|
-
return super.appendChild(node);
|
|
12
|
-
}
|
|
13
|
-
removeChild(child) {
|
|
14
|
-
if (child instanceof HTMLElement)
|
|
15
|
-
this.removeClassNameInChilds(child);
|
|
16
|
-
return super.removeChild(child);
|
|
17
|
-
}
|
|
18
|
-
addClassNameInChilds(element, flowType) {
|
|
19
|
-
element.style.width = "auto";
|
|
20
|
-
element.removeAttribute("height");
|
|
21
|
-
if (!element.classList.contains(flowType))
|
|
22
|
-
element.classList.add(flowType);
|
|
23
|
-
if (!element.classList.contains("flow-12"))
|
|
24
|
-
element.classList.add("flow-12");
|
|
25
|
-
}
|
|
26
|
-
removeClassNameInChilds(element) {
|
|
27
|
-
if (element.classList.contains("flow-pane-item"))
|
|
28
|
-
element.classList.remove("flow-pane-item");
|
|
29
|
-
for (let i = 1; i <= 12; i++) {
|
|
30
|
-
if (element.classList.contains(`flow-${i}`))
|
|
31
|
-
element.classList.remove(`flow-${i}`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
setFlowType(element, flowType) {
|
|
35
|
-
this.removeClassNameInChilds(element);
|
|
36
|
-
this.addClassNameInChilds(element, flowType);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
TypeComposer.defineElement(FlowPanel.TAG, FlowPanel);
|
|
40
|
-
//# sourceMappingURL=FlowPanel.js.map
|
|
1
|
+
import{Component}from"../..";export class FlowPanel extends Component{static TAG="tc-flow-panel";constructor(s){super({...s,style:{overflow:"hidden",...s?.style}}),this.addClassName("flow-panel")}appendChild(s,e="flow-6"){return s&&!s.classList.contains("flow-pane-item")&&this.addClassNameInChilds(s,e),super.appendChild(s)}removeChild(s){return s instanceof HTMLElement&&this.removeClassNameInChilds(s),super.removeChild(s)}addClassNameInChilds(s,e){s.style.width="auto",s.removeAttribute("height"),s.classList.contains(e)||s.classList.add(e),s.classList.contains("flow-12")||s.classList.add("flow-12")}removeClassNameInChilds(s){s.classList.contains("flow-pane-item")&&s.classList.remove("flow-pane-item");for(let e=1;e<=12;e++)s.classList.contains(`flow-${e}`)&&s.classList.remove(`flow-${e}`)}setFlowType(s,e){this.removeClassNameInChilds(s),this.addClassNameInChilds(s,e)}}TypeComposer.defineElement(FlowPanel.TAG,FlowPanel);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowPanel.js","sourceRoot":"","sources":["../../../src/core/components/FlowPanel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"FlowPanel.js","sourceRoot":"","sources":["../../../src/core/components/FlowPanel.ts"],"names":[],"mappings":"AAAA,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CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YAAE,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC7F,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7B,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAAE,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrF,CAAC;IACH,CAAC;IAEM,WAAW,CAAC,OAAoB,EAAE,QAAkB;QACzD,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;;AAEH,YAAY,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, ElementType } from "../..";
|
|
2
2
|
export declare class ForEach extends Component {
|
|
3
3
|
#private;
|
|
4
4
|
static readonly TAG: string;
|
|
5
|
-
constructor(props:
|
|
5
|
+
constructor(props: ElementType);
|
|
6
6
|
get of(): any[];
|
|
7
7
|
get item(): string;
|
|
8
8
|
set of(value: string);
|
|
@@ -1,88 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export class ForEach extends Component {
|
|
3
|
-
static TAG = "tc-for-each";
|
|
4
|
-
#content = "";
|
|
5
|
-
#of = null;
|
|
6
|
-
#item = null;
|
|
7
|
-
#parents = null;
|
|
8
|
-
#ref = null;
|
|
9
|
-
#props = {};
|
|
10
|
-
constructor(props) {
|
|
11
|
-
super(props);
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
//this.#content = this.innerHTML;
|
|
14
|
-
this.innerHTML = "";
|
|
15
|
-
this.#of = this.getAttribute("of") || "";
|
|
16
|
-
this.#item = this.getAttribute("item") || "item";
|
|
17
|
-
try {
|
|
18
|
-
this.#props = JSON.parse(this.getAttribute("props") || "{}");
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
new Error("ForEach: Invalid props");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
get of() {
|
|
25
|
-
if (this.#of) {
|
|
26
|
-
if (/^this\./.test(this.#of)) {
|
|
27
|
-
const value = this.#of.replace("this.", "");
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
const baseRef = refType(this.#parents[value]);
|
|
30
|
-
if (baseRef) {
|
|
31
|
-
if (this.#ref) {
|
|
32
|
-
}
|
|
33
|
-
if (this.#ref !== baseRef) {
|
|
34
|
-
baseRef.subscribe(this, "loop");
|
|
35
|
-
this.#ref = baseRef;
|
|
36
|
-
}
|
|
37
|
-
return baseRef.value;
|
|
38
|
-
}
|
|
39
|
-
// @ts-ignore
|
|
40
|
-
return this.#parents[value];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return this.#of?.split(",") || [];
|
|
44
|
-
}
|
|
45
|
-
get item() {
|
|
46
|
-
return this.#item || "";
|
|
47
|
-
}
|
|
48
|
-
set of(value) {
|
|
49
|
-
this.setAttribute("of", value);
|
|
50
|
-
}
|
|
51
|
-
set loop(items) {
|
|
52
|
-
let index = 0;
|
|
53
|
-
this.innerHTML = "";
|
|
54
|
-
const regex = /\{\{(.*?)\}\}/g;
|
|
55
|
-
const matches = [];
|
|
56
|
-
let match;
|
|
57
|
-
while ((match = regex.exec(this.#content)) !== null) {
|
|
58
|
-
const key = match[1].trim();
|
|
59
|
-
if (/^this\./.test(key))
|
|
60
|
-
matches.push(key.replace("this.", ""));
|
|
61
|
-
}
|
|
62
|
-
let content = this.#content;
|
|
63
|
-
for (const key in this.#props) {
|
|
64
|
-
const value = this.#props[key];
|
|
65
|
-
content = content.replaceAll(`{{${key}}}`, value);
|
|
66
|
-
}
|
|
67
|
-
for (const key of matches) {
|
|
68
|
-
const value = this.#parents[key];
|
|
69
|
-
content = content.replaceAll(`{{this.${key}}}`, value);
|
|
70
|
-
}
|
|
71
|
-
for (const i of items) {
|
|
72
|
-
const div = document.createElement("div");
|
|
73
|
-
Component.applyProps(div, {});
|
|
74
|
-
div.innerHTML = content.replaceAll(`{{${this.item}}}`, i).replaceAll(`{{index}}`, index.toString());
|
|
75
|
-
index++;
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
this.append(...div.children);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
apply(parents, of = this.#of) {
|
|
81
|
-
this.#parents = parents;
|
|
82
|
-
this.#of = of;
|
|
83
|
-
if (this.#of)
|
|
84
|
-
this.loop = this.of;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
TypeComposer.defineElement(ForEach.TAG, ForEach);
|
|
88
|
-
//# sourceMappingURL=ForEach.js.map
|
|
1
|
+
import{Component}from"../..";export class ForEach extends Component{static TAG="tc-for-each";#t="";#e=null;#s=null;#o=null;#i=null;#r={};constructor(t){super(t),this.innerHTML="",this.#e=this.getAttribute("of")||"",this.#s=this.getAttribute("item")||"item";try{this.#r=JSON.parse(this.getAttribute("props")||"{}")}catch(t){new Error("ForEach: Invalid props")}}get of(){if(this.#e&&/^this\./.test(this.#e)){const t=this.#e.replace("this.",""),e=refType(this.#o[t]);return e?(this.#i,this.#i!==e&&(e.subscribe(this,"loop"),this.#i=e),e.value):this.#o[t]}return this.#e?.split(",")||[]}get item(){return this.#s||""}set of(t){this.setAttribute("of",t)}set loop(t){let e=0;this.innerHTML="";const s=/\{\{(.*?)\}\}/g,o=[];let i;for(;null!==(i=s.exec(this.#t));){const t=i[1].trim();/^this\./.test(t)&&o.push(t.replace("this.",""))}let r=this.#t;for(const t in this.#r){const e=this.#r[t];r=r.replaceAll(`{{${t}}}`,e)}for(const t of o){const e=this.#o[t];r=r.replaceAll(`{{this.${t}}}`,e)}for(const s of t){const t=document.createElement("div");Component.applyProps(t,{}),t.innerHTML=r.replaceAll(`{{${this.item}}}`,s).replaceAll("{{index}}",e.toString()),e++,this.append(...t.children)}}apply(t,e=this.#e){this.#o=t,this.#e=e,this.#e&&(this.loop=this.of)}}TypeComposer.defineElement(ForEach.TAG,ForEach);
|