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,140 +1 @@
|
|
|
1
|
-
import { Component,
|
|
2
|
-
function getShortValidationMessage(input) {
|
|
3
|
-
if (input.validity.valueMissing)
|
|
4
|
-
return TextField.validateMessage.valueMissing;
|
|
5
|
-
if (input.validity.typeMismatch)
|
|
6
|
-
return TextField.validateMessage.typeMismatch;
|
|
7
|
-
if (input.validity.patternMismatch)
|
|
8
|
-
return TextField.validateMessage.patternMismatch;
|
|
9
|
-
if (input.validity.tooShort)
|
|
10
|
-
return TextField.validateMessage.tooShort.replace("{0}", input.minLength.toString());
|
|
11
|
-
if (input.validity.tooLong)
|
|
12
|
-
return TextField.validateMessage.tooLong.replace("{0}", input.maxLength.toString());
|
|
13
|
-
if (input.validity.rangeUnderflow)
|
|
14
|
-
return TextField.validateMessage.rangeUnderflow.replace("{0}", input.min.toString());
|
|
15
|
-
if (input.validity.rangeOverflow)
|
|
16
|
-
return TextField.validateMessage.rangeOverflow.replace("{0}", input.max.toString());
|
|
17
|
-
if (input.validity.stepMismatch)
|
|
18
|
-
return TextField.validateMessage.stepMismatch;
|
|
19
|
-
if (input.validity.badInput)
|
|
20
|
-
return TextField.validateMessage.badInput;
|
|
21
|
-
if (input.validity.customError)
|
|
22
|
-
return TextField.validateMessage.customError;
|
|
23
|
-
return "";
|
|
24
|
-
}
|
|
25
|
-
export class TextField extends Component {
|
|
26
|
-
static TAG = "tc-text-field";
|
|
27
|
-
static validateMessage = {
|
|
28
|
-
valueMissing: "required field!",
|
|
29
|
-
typeMismatch: "invalid format!",
|
|
30
|
-
patternMismatch: "invalid pattern!",
|
|
31
|
-
tooShort: "min {0} chars!",
|
|
32
|
-
tooLong: "max {0} chars!",
|
|
33
|
-
rangeUnderflow: "min value: {0}!",
|
|
34
|
-
rangeOverflow: "max value: {0}!",
|
|
35
|
-
stepMismatch: "invalid step!",
|
|
36
|
-
badInput: "invalid input!",
|
|
37
|
-
customError: "invalid input!"
|
|
38
|
-
};
|
|
39
|
-
input;
|
|
40
|
-
placeholder;
|
|
41
|
-
placeholderAnimation;
|
|
42
|
-
label;
|
|
43
|
-
labelError;
|
|
44
|
-
customError;
|
|
45
|
-
constructor(props) {
|
|
46
|
-
super();
|
|
47
|
-
this.label = props?.label || "";
|
|
48
|
-
this.customError = props?.customError;
|
|
49
|
-
this.placeholderAnimation = props?.placeholderAnimation !== undefined ? props?.placeholderAnimation : true;
|
|
50
|
-
this.labelError = props?.labelError !== undefined ? props?.labelError : false;
|
|
51
|
-
this.placeholder = props?.placeholder || "";
|
|
52
|
-
this.input = new InputElement();
|
|
53
|
-
this.variant = props?.variant?.toString();
|
|
54
|
-
Component.applyProps(this.input, { ...props, className: undefined, id: undefined }, true);
|
|
55
|
-
delete props?.value;
|
|
56
|
-
delete props?.text;
|
|
57
|
-
Component.applyProps(this, props);
|
|
58
|
-
}
|
|
59
|
-
set disabled(value) {
|
|
60
|
-
this.input.disabled = value;
|
|
61
|
-
super.disabled = value;
|
|
62
|
-
}
|
|
63
|
-
get value() {
|
|
64
|
-
return this.input.value;
|
|
65
|
-
}
|
|
66
|
-
set value(value) {
|
|
67
|
-
if (value instanceof ref) {
|
|
68
|
-
// @ts-ignore
|
|
69
|
-
const onInput = () => (value.value = this.value);
|
|
70
|
-
this.input.addEventListener("input", onInput);
|
|
71
|
-
value.subscribe(this, "value", () => this.input.removeEventListener("input", onInput));
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
// @ts-ignore
|
|
75
|
-
this.input.value = value;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
TypeComposer.defineElement(TextField.TAG, TextField);
|
|
80
|
-
function setVariant(element, value) {
|
|
81
|
-
element.innerHTML = "";
|
|
82
|
-
if (element["__checkValidity"])
|
|
83
|
-
element.input.removeEventListener("input", element["__checkValidity"]);
|
|
84
|
-
if (value == "default") {
|
|
85
|
-
element.appendChild(new LabelElement({ text: element.label })).addEventListener("click", () => element.input.focus());
|
|
86
|
-
element.append(element.input);
|
|
87
|
-
element.input.placeholder = element.placeholder;
|
|
88
|
-
element.addClassName("tc-tf-d");
|
|
89
|
-
}
|
|
90
|
-
else if (value == "outline" || value == "solo" || value == "standard" || value == "underlined") {
|
|
91
|
-
const fieldset = new FieldSetElement();
|
|
92
|
-
if (element.placeholderAnimation !== false) {
|
|
93
|
-
fieldset.append(new LegendElement({ text: element.placeholder }));
|
|
94
|
-
element.appendChild(new LabelElement({ text: element.label })).addEventListener("click", () => element.input.focus());
|
|
95
|
-
element.input.placeholder = "";
|
|
96
|
-
element.append(element.input, fieldset);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
element.input.placeholder = element.placeholder;
|
|
100
|
-
element.append(element.input, fieldset);
|
|
101
|
-
}
|
|
102
|
-
element.addClassName("tc-tf-osu");
|
|
103
|
-
}
|
|
104
|
-
if ((value == "default" || value == "outline" || value == "solo" || value == "standard" || value == "underlined")) {
|
|
105
|
-
const paragraph = element.labelError ? new ParagraphElement({ id: "error-message", style: { display: "none" } }) : undefined;
|
|
106
|
-
const fieldset = element.querySelector("fieldset");
|
|
107
|
-
if (paragraph && value == "default")
|
|
108
|
-
element.append(paragraph);
|
|
109
|
-
const action = () => {
|
|
110
|
-
element.input.setCustomValidity("");
|
|
111
|
-
element.input.validity;
|
|
112
|
-
if (element.input.validationMessage != "") {
|
|
113
|
-
fieldset?.addClassName("tc-m-e");
|
|
114
|
-
if (paragraph) {
|
|
115
|
-
paragraph.style.display = "block";
|
|
116
|
-
paragraph.innerText = element?.customError ? element.customError(element.input.validity) : getShortValidationMessage(element.input);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
fieldset?.removeClassName("tc-m-e");
|
|
121
|
-
if (paragraph) {
|
|
122
|
-
paragraph.style.display = "none";
|
|
123
|
-
paragraph.innerText = "";
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
element["__checkValidity"] = action;
|
|
128
|
-
element.input.addEventListener("input", action);
|
|
129
|
-
element.input.oninvalid = (e) => {
|
|
130
|
-
const msg = element?.customError ? element.customError(element.input.validity) : getShortValidationMessage(element.input);
|
|
131
|
-
element.input.setCustomValidity(msg);
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
Component.setVariant(TextField, "default", (element) => setVariant(element, "default"));
|
|
136
|
-
Component.setVariant(TextField, "outline", (element) => setVariant(element, "outline"));
|
|
137
|
-
Component.setVariant(TextField, "solo", (element) => setVariant(element, "solo"));
|
|
138
|
-
Component.setVariant(TextField, "standard", (element) => setVariant(element, "standard"));
|
|
139
|
-
Component.setVariant(TextField, "underlined", (element) => setVariant(element, "underlined"));
|
|
140
|
-
//# sourceMappingURL=TextField.js.map
|
|
1
|
+
import{Component,FieldSetElement,InputElement,LabelElement,LegendElement,ref,ParagraphElement}from"../../";function getShortValidationMessage(e){return e.validity.valueMissing?TextField.validateMessage.valueMissing:e.validity.typeMismatch?TextField.validateMessage.typeMismatch:e.validity.patternMismatch?TextField.validateMessage.patternMismatch:e.validity.tooShort?TextField.validateMessage.tooShort.replace("{0}",e.minLength.toString()):e.validity.tooLong?TextField.validateMessage.tooLong.replace("{0}",e.maxLength.toString()):e.validity.rangeUnderflow?TextField.validateMessage.rangeUnderflow.replace("{0}",e.min.toString()):e.validity.rangeOverflow?TextField.validateMessage.rangeOverflow.replace("{0}",e.max.toString()):e.validity.stepMismatch?TextField.validateMessage.stepMismatch:e.validity.badInput?TextField.validateMessage.badInput:e.validity.customError?TextField.validateMessage.customError:""}export class TextField extends Component{static TAG="tc-text-field";static validateMessage={valueMissing:"required field!",typeMismatch:"invalid format!",patternMismatch:"invalid pattern!",tooShort:"min {0} chars!",tooLong:"max {0} chars!",rangeUnderflow:"min value: {0}!",rangeOverflow:"max value: {0}!",stepMismatch:"invalid step!",badInput:"invalid input!",customError:"invalid input!"};input;placeholder;placeholderAnimation;label;labelError;customError;constructor(e){super(),this.label=e?.label||"",this.customError=e?.customError,this.placeholderAnimation=void 0===e?.placeholderAnimation||e?.placeholderAnimation,this.labelError=void 0!==e?.labelError&&e?.labelError,this.placeholder=e?.placeholder||"",this.input=new InputElement,this.variant=e?.variant?.toString(),Component.applyProps(this.input,{...e,className:void 0,id:void 0},!0),delete e?.value,delete e?.text,Component.applyProps(this,e)}set disabled(e){this.input.disabled=e,super.disabled=e}get value(){return this.input.value}set value(e){if(e instanceof ref){const t=()=>e.value=this.value;this.input.addEventListener("input",t),e.subscribe(this,"value",()=>this.input.removeEventListener("input",t))}else this.input.value=e}}function setVariant(e,t){if(e.innerHTML="",e.__checkValidity&&e.input.removeEventListener("input",e.__checkValidity),"default"==t)e.appendChild(new LabelElement({text:e.label})).addEventListener("click",()=>e.input.focus()),e.append(e.input),e.input.placeholder=e.placeholder,e.addClassName("tc-tf-d");else if("outline"==t||"solo"==t||"standard"==t||"underlined"==t){const t=new FieldSetElement;!1!==e.placeholderAnimation?(t.append(new LegendElement({text:e.placeholder})),e.appendChild(new LabelElement({text:e.label})).addEventListener("click",()=>e.input.focus()),e.input.placeholder="",e.append(e.input,t)):(e.input.placeholder=e.placeholder,e.append(e.input,t)),e.addClassName("tc-tf-osu")}if("default"==t||"outline"==t||"solo"==t||"standard"==t||"underlined"==t){const i=e.labelError?new ParagraphElement({id:"error-message",style:{display:"none"}}):void 0,a=e.querySelector("fieldset");i&&"default"==t&&e.append(i);const n=()=>{e.input.setCustomValidity(""),e.input.validity,""!=e.input.validationMessage?(a?.addClassName("tc-m-e"),i&&(i.style.display="block",i.innerText=e?.customError?e.customError(e.input.validity):getShortValidationMessage(e.input))):(a?.removeClassName("tc-m-e"),i&&(i.style.display="none",i.innerText=""))};e.__checkValidity=n,e.input.addEventListener("input",n),e.input.oninvalid=t=>{const i=e?.customError?e.customError(e.input.validity):getShortValidationMessage(e.input);e.input.setCustomValidity(i)}}}TypeComposer.defineElement(TextField.TAG,TextField),Component.setVariant(TextField,"default",e=>setVariant(e,"default")),Component.setVariant(TextField,"outline",e=>setVariant(e,"outline")),Component.setVariant(TextField,"solo",e=>setVariant(e,"solo")),Component.setVariant(TextField,"standard",e=>setVariant(e,"standard")),Component.setVariant(TextField,"underlined",e=>setVariant(e,"underlined"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../src/core/components/TextField.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EAEf,YAAY,EACZ,YAAY,EACZ,aAAa,
|
|
1
|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AC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAC7F,SAAS,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC,OAAkB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AACrG,SAAS,CAAC,UAAU,CAAC,SAAS,EAAE,YAAY,EAAE,CAAC,OAAkB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface DataToggleButton extends
|
|
1
|
+
import { ElementType, CheckBox } from "../..";
|
|
2
|
+
export interface DataToggleButton extends ElementType {
|
|
3
3
|
}
|
|
4
4
|
export declare class ToggleButton extends CheckBox {
|
|
5
5
|
static readonly TAG: string;
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export class ToggleButton extends CheckBox {
|
|
3
|
-
static TAG = "tc-toggle-button";
|
|
4
|
-
constructor(props) {
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
super({ ...data, color: props?.color || undefined });
|
|
7
|
-
this.input.classList.remove("checkbox");
|
|
8
|
-
const labelColor = this.label.style.backgroundColor;
|
|
9
|
-
this.addEventListener("change", (e) => {
|
|
10
|
-
if (this.input.checked) {
|
|
11
|
-
this.label.style.backgroundColor = this.input.style.accentColor;
|
|
12
|
-
}
|
|
13
|
-
else
|
|
14
|
-
this.label.style.backgroundColor = labelColor;
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
TypeComposer.defineElement(ToggleButton.TAG, ToggleButton);
|
|
20
|
-
//# sourceMappingURL=ToggleButton.js.map
|
|
1
|
+
import{CheckBox}from"../..";export class ToggleButton extends CheckBox{static TAG="tc-toggle-button";constructor(t){super({...data,color:t?.color||void 0}),this.input.classList.remove("checkbox");const o=this.label.style.backgroundColor;this.addEventListener("change",t=>{this.input.checked?this.label.style.backgroundColor=this.input.style.accentColor:this.label.style.backgroundColor=o})}}TypeComposer.defineElement(ToggleButton.TAG,ToggleButton);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleButton.js","sourceRoot":"","sources":["../../../src/core/components/ToggleButton.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ToggleButton.js","sourceRoot":"","sources":["../../../src/core/components/ToggleButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI9C,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACxC,MAAM,CAAU,GAAG,GAAW,kBAAkB,CAAC;IACjD,YAAY,KAAwB;QAClC,aAAa;QACb,KAAK,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,CAAC,CAAC;QACrD,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACxC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC;QACpD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACpC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBACvB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC;YAClE,CAAC;;gBAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,GAAG,UAAU,CAAC;QACvD,CAAC,CAAC,CAAC;IACL,CAAC;;AAEH,aAAa;AACb,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Component } from "..";
|
|
2
|
-
import {
|
|
3
|
-
export interface TooltipProps extends ElementProps {
|
|
4
|
-
text: string;
|
|
5
|
-
align?: "top" | "bottom" | "left" | "right";
|
|
6
|
-
}
|
|
2
|
+
import { ElementType } from "../styles";
|
|
7
3
|
export declare class Tooltip extends Component {
|
|
8
4
|
static readonly TAG: string;
|
|
9
|
-
constructor(props:
|
|
5
|
+
constructor(props: ElementType<Tooltip>);
|
|
6
|
+
set align(value: "top" | "bottom" | "left" | "right");
|
|
7
|
+
get align(): "top" | "bottom" | "left" | "right";
|
|
10
8
|
}
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export class Tooltip extends Component {
|
|
3
|
-
static TAG = "tc-tooltip";
|
|
4
|
-
constructor(props) {
|
|
5
|
-
super();
|
|
6
|
-
this.addClassName("tc-tooltip");
|
|
7
|
-
this.appendChild(new SpanElement({ className: `tc-tooltiptext tc-tooltiptext-${props.align || "bottom"}`, text: props.text }));
|
|
8
|
-
delete props.text;
|
|
9
|
-
delete props.align;
|
|
10
|
-
Component.applyProps(this, props);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
TypeComposer.defineElement(Tooltip.TAG, Tooltip);
|
|
14
|
-
//# sourceMappingURL=Tooltip.js.map
|
|
1
|
+
import{Component,SpanElement}from"..";export class Tooltip extends Component{static TAG="tc-tooltip";constructor(t){super(t),this.appendChild(new SpanElement({className:`tc-tooltiptext tc-tooltiptext-${t.align||"bottom"}`,text:t.text||""})),delete t?.text,this.addClassName("tc-tooltip"),Component.initComponent(this,Tooltip,t)}set align(t){const e=this.getElementsByClassName("tc-tooltiptext")[0];e&&(e.className=`tc-tooltiptext tc-tooltiptext-${t}`)}get align(){const t=this.getElementsByClassName("tc-tooltiptext")[0];if(!t)return"bottom";return t.className.replace("tc-tooltiptext ","").replace("tc-tooltiptext-","")}}TypeComposer.defineElement(Tooltip.TAG,Tooltip);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/core/components/Tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../src/core/components/Tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAG5C,MAAM,OAAO,OAAQ,SAAQ,SAAS;IACrC,MAAM,CAAU,GAAG,GAAW,YAAY,CAAC;IAE3C,YAAY,KAA2B;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,EAAE,SAAS,EAAE,iCAAiC,KAAK,CAAC,KAAK,IAAI,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QACrI,OAAO,KAAK,EAAE,IAAI,CAAC;QACnB,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAChC,aAAa;QACb,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,KAAK,CAAC,KAA0C;QACnD,MAAM,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,IAAI,OAAO;YAAE,OAAO,CAAC,SAAS,GAAG,iCAAiC,KAAK,EAAE,CAAC;IAC3E,CAAC;IAED,IAAI,KAAK;QACR,MAAM,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,IAAI,CAAC,OAAO;YAAE,OAAO,QAAQ,CAAC;QAC9B,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACpC,OAAO,SAAS,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAwC,CAAC;IACvH,CAAC;;AAIF,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC"}
|
package/core/components/VBox.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export class VBox extends Component {
|
|
3
|
-
static TAG = "tc-vbox";
|
|
4
|
-
constructor(props) {
|
|
5
|
-
super(props);
|
|
6
|
-
this.addClassName("vbox");
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
TypeComposer.defineElement(VBox.TAG, VBox);
|
|
10
|
-
//# sourceMappingURL=VBox.js.map
|
|
1
|
+
import{Component}from"../..";export class VBox extends Component{static TAG="tc-vbox";constructor(o){super(o),this.addClassName("vbox")}}TypeComposer.defineElement(VBox.TAG,VBox);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VBox.js","sourceRoot":"","sources":["../../../src/core/components/VBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"VBox.js","sourceRoot":"","sources":["../../../src/core/components/VBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,OAAO,CAAC;AAEpD,MAAM,OAAO,IAAK,SAAQ,SAAS;IACjC,MAAM,CAAU,GAAG,GAAW,SAAS,CAAC;IACxC,YAAY,KAAmB;QAC7B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;;AAEH,YAAY,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from "../";
|
|
2
|
-
import {
|
|
3
|
-
export interface VirtualScrollProps extends
|
|
2
|
+
import { ElementType } from "../styles";
|
|
3
|
+
export interface VirtualScrollProps extends ElementType {
|
|
4
4
|
items: any[];
|
|
5
5
|
renderItem: (item: any, index: number) => HTMLElement;
|
|
6
6
|
itemHeight?: number;
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export class VirtualScroll extends Component {
|
|
3
|
-
static TAG = "tc-virtual-scroll";
|
|
4
|
-
items;
|
|
5
|
-
renderItem;
|
|
6
|
-
itemHeight;
|
|
7
|
-
buffer;
|
|
8
|
-
#innerContainer;
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super({ style: { overflowY: "auto", position: "relative" }, ...props });
|
|
11
|
-
this.items = props.items;
|
|
12
|
-
this.renderItem = props.renderItem;
|
|
13
|
-
this.itemHeight = props.itemHeight ?? 50;
|
|
14
|
-
this.buffer = props.buffer ?? 5;
|
|
15
|
-
this.#innerContainer = new DivElement();
|
|
16
|
-
this.#innerContainer.style.position = "relative";
|
|
17
|
-
this.#innerContainer.style.height = `${this.items.length * this.itemHeight}px`;
|
|
18
|
-
this.appendChild(this.#innerContainer);
|
|
19
|
-
this.addEventListener("scroll", this.onScroll.bind(this));
|
|
20
|
-
this.addEventListener("onConnected", this.renderVisibleItems.bind(this));
|
|
21
|
-
}
|
|
22
|
-
get innerContainer() {
|
|
23
|
-
return this.#innerContainer;
|
|
24
|
-
}
|
|
25
|
-
onScroll() {
|
|
26
|
-
this.renderVisibleItems();
|
|
27
|
-
}
|
|
28
|
-
renderVisibleItems() {
|
|
29
|
-
const scrollTop = this.scrollTop;
|
|
30
|
-
const containerHeight = this.clientHeight;
|
|
31
|
-
const startIndex = Math.floor(scrollTop / this.itemHeight) - this.buffer;
|
|
32
|
-
const endIndex = Math.ceil((scrollTop + containerHeight) / this.itemHeight) + this.buffer;
|
|
33
|
-
const clampedStartIndex = Math.max(0, startIndex);
|
|
34
|
-
const clampedEndIndex = Math.min(this.items.length, endIndex);
|
|
35
|
-
this.#innerContainer.innerHTML = "";
|
|
36
|
-
for (let i = clampedStartIndex; i < clampedEndIndex; i++) {
|
|
37
|
-
const item = this.items[i];
|
|
38
|
-
const element = this.renderItem(item, i);
|
|
39
|
-
element.style.position = "absolute";
|
|
40
|
-
element.style.top = `${i * this.itemHeight}px`;
|
|
41
|
-
element.style.width = "100%";
|
|
42
|
-
this.#innerContainer.appendChild(element);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
TypeComposer.defineElement(VirtualScroll.TAG, VirtualScroll);
|
|
47
|
-
//# sourceMappingURL=VirtualScroll.js.map
|
|
1
|
+
import{Component,DivElement}from"../";export class VirtualScroll extends Component{static TAG="tc-virtual-scroll";items;renderItem;itemHeight;buffer;#t;constructor(t){super({style:{overflowY:"auto",position:"relative"},...t}),this.items=t.items,this.renderItem=t.renderItem,this.itemHeight=t.itemHeight??50,this.buffer=t.buffer??5,this.#t=new DivElement,this.#t.style.position="relative",this.#t.style.height=this.items.length*this.itemHeight+"px",this.appendChild(this.#t),this.addEventListener("scroll",this.onScroll.bind(this)),this.addEventListener("onConnected",this.renderVisibleItems.bind(this))}get innerContainer(){return this.#t}onScroll(){this.renderVisibleItems()}renderVisibleItems(){const t=this.scrollTop,e=this.clientHeight,i=Math.floor(t/this.itemHeight)-this.buffer,n=Math.ceil((t+e)/this.itemHeight)+this.buffer,s=Math.max(0,i),r=Math.min(this.items.length,n);this.#t.innerHTML="";for(let t=s;t<r;t++){const e=this.items[t],i=this.renderItem(e,t);i.style.position="absolute",i.style.top=t*this.itemHeight+"px",i.style.width="100%",this.#t.appendChild(i)}}}TypeComposer.defineElement(VirtualScroll.TAG,VirtualScroll);
|
|
@@ -16,7 +16,6 @@ export { ListPanel } from "./ListPanel";
|
|
|
16
16
|
export { PopUpButton } from "./PopUpButton";
|
|
17
17
|
export { ScrollPanel } from "./ScrollPanel";
|
|
18
18
|
export { StackPanel } from "./StackPanel";
|
|
19
|
-
export { TablePanel } from "./TablePanel";
|
|
20
19
|
export { TabItem } from "./TabItem";
|
|
21
20
|
export { TabPanel } from "./TabPanel";
|
|
22
21
|
export { TextEdit } from "./TextEdit";
|
|
@@ -24,5 +23,5 @@ export { ToggleButton } from "./ToggleButton";
|
|
|
24
23
|
export { VBox } from "./VBox";
|
|
25
24
|
export { VirtualScroll, type VirtualScrollProps } from "./VirtualScroll";
|
|
26
25
|
export { ContextMenu, ContextMenuItem } from "./ContextMenu";
|
|
27
|
-
export { Tooltip
|
|
26
|
+
export { Tooltip } from "./Tooltip";
|
|
28
27
|
export { SliderPanel } from "./SliderPanel";
|
package/core/components/index.js
CHANGED
|
@@ -1,30 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { AvatarPanel } from "./AvatarPanel";
|
|
3
|
-
export { BorderPanel } from "./BorderPanel";
|
|
4
|
-
export { CardPanel } from "./CardPanel";
|
|
5
|
-
export { CheckBox } from "./CheckBox";
|
|
6
|
-
export { ColorPicker } from "./ColorPicker";
|
|
7
|
-
export { DialogPanel } from "./DialogPanel";
|
|
8
|
-
export { TextField } from "./TextField";
|
|
9
|
-
export { DropDown, DropDownItem } from "./DropDown";
|
|
10
|
-
export { FlowPanel } from "./FlowPanel";
|
|
11
|
-
export { ForEach } from "./ForEach";
|
|
12
|
-
export { GridPanel } from "./GridPanel";
|
|
13
|
-
export { HBox } from "./HBox";
|
|
14
|
-
export { LazyLoading } from "./LazyLoading";
|
|
15
|
-
export { ListPanel } from "./ListPanel";
|
|
16
|
-
export { PopUpButton } from "./PopUpButton";
|
|
17
|
-
export { ScrollPanel } from "./ScrollPanel";
|
|
18
|
-
// Missing
|
|
19
|
-
export { StackPanel } from "./StackPanel";
|
|
20
|
-
export { TablePanel } from "./TablePanel";
|
|
21
|
-
export { TabItem } from "./TabItem";
|
|
22
|
-
export { TabPanel } from "./TabPanel";
|
|
23
|
-
export { TextEdit } from "./TextEdit";
|
|
24
|
-
export { ToggleButton } from "./ToggleButton";
|
|
25
|
-
export { VBox } from "./VBox";
|
|
26
|
-
export { VirtualScroll } from "./VirtualScroll";
|
|
27
|
-
export { ContextMenu, ContextMenuItem } from "./ContextMenu";
|
|
28
|
-
export { Tooltip } from "./Tooltip";
|
|
29
|
-
export { SliderPanel } from "./SliderPanel";
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export{AlertPanel}from"./AlertPanel";export{AvatarPanel}from"./AvatarPanel";export{BorderPanel}from"./BorderPanel";export{CardPanel}from"./CardPanel";export{CheckBox}from"./CheckBox";export{ColorPicker}from"./ColorPicker";export{DialogPanel}from"./DialogPanel";export{TextField}from"./TextField";export{DropDown,DropDownItem}from"./DropDown";export{FlowPanel}from"./FlowPanel";export{ForEach}from"./ForEach";export{GridPanel}from"./GridPanel";export{HBox}from"./HBox";export{LazyLoading}from"./LazyLoading";export{ListPanel}from"./ListPanel";export{PopUpButton}from"./PopUpButton";export{ScrollPanel}from"./ScrollPanel";export{StackPanel}from"./StackPanel";export{TabItem}from"./TabItem";export{TabPanel}from"./TabPanel";export{TextEdit}from"./TextEdit";export{ToggleButton}from"./ToggleButton";export{VBox}from"./VBox";export{VirtualScroll}from"./VirtualScroll";export{ContextMenu,ContextMenuItem}from"./ContextMenu";export{Tooltip}from"./Tooltip";export{SliderPanel}from"./SliderPanel";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/components/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,Y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AAe,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,UAAU;AACV,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,qDAAqD;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAA2B,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
let index = 1;
|
|
2
|
-
function converClasNameToTag(className, isExported = true) {
|
|
3
|
-
if (className == undefined)
|
|
4
|
-
return `base-${Math.random().toString(36).substring(7)}-element`;
|
|
5
|
-
let name = className.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/(\d+)([A-Z])/g, '$1-$2').toLowerCase();
|
|
6
|
-
if (isExported == false) {
|
|
7
|
-
name = `${name}-${Math.random().toString(36).substring(7) + index.toString()}`;
|
|
8
|
-
}
|
|
9
|
-
else if (!name.includes("-"))
|
|
10
|
-
name = name + "-element";
|
|
11
|
-
return name;
|
|
12
|
-
}
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
export function Register(options) {
|
|
15
|
-
return function (constructor) {
|
|
16
|
-
const tag = options?.tag || converClasNameToTag(constructor.name, options?.scoped || false);
|
|
17
|
-
TypeComposer.defineElement(tag, constructor, { extends: options?.extends });
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=RegisterComponent.js.map
|
|
1
|
+
let index=1;function converClasNameToTag(e,n=!0){if(null==e)return`base-${Math.random().toString(36).substring(7)}-element`;let t=e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/(\d+)([A-Z])/g,"$1-$2").toLowerCase();return 0==n?t=`${t}-${Math.random().toString(36).substring(7)+index.toString()}`:t.includes("-")||(t+="-element"),t}export function Register(e){return function(n){const t=e?.tag||converClasNameToTag(n.name,e?.scoped||!1);TypeComposer.defineElement(t,n,{extends:e?.extends})}}
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
export function StyleLink(
|
|
2
|
-
return (__) => {
|
|
3
|
-
if (url != undefined) {
|
|
4
|
-
if (url.indexOf("src/") == -1)
|
|
5
|
-
url = "src/" + url;
|
|
6
|
-
// if (constructor.prototype._onLoad == undefined)
|
|
7
|
-
// constructor.prototype._onLoad = [function (this: Component) { this.addStyleLink(url) }];
|
|
8
|
-
// else
|
|
9
|
-
// constructor.prototype._onLoad.push(function (this: Component) { this.addStyleLink(url) });
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=StyleLink.js.map
|
|
1
|
+
export function StyleLink(n){return r=>{null!=n&&-1==n.indexOf("src/")&&(n="src/"+n)}}
|
package/core/decorators/index.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { StyleLink } from "./StyleLink";
|
|
3
|
-
export function scoped(target) {
|
|
4
|
-
return function (_) { };
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export{Register}from"./RegisterComponent";export{StyleLink}from"./StyleLink";export function scoped(e){return function(e){}}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementType } from "../../";
|
|
2
2
|
export declare class AbbreviationElement extends HTMLElement implements IComponent {
|
|
3
3
|
static readonly TAG: string;
|
|
4
|
-
constructor(props?:
|
|
5
|
-
title?: string;
|
|
6
|
-
});
|
|
4
|
+
constructor(props?: ElementType);
|
|
7
5
|
}
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export class AbbreviationElement extends HTMLElement {
|
|
3
|
-
static TAG = "tc-abbr-element";
|
|
4
|
-
constructor(props) {
|
|
5
|
-
super();
|
|
6
|
-
Component.applyProps(this, props);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
TypeComposer.defineElement(AbbreviationElement.TAG, AbbreviationElement, { extends: "abbr" });
|
|
10
|
-
//# sourceMappingURL=AbbreviationElement.js.map
|
|
1
|
+
import{Component}from"../../";export class AbbreviationElement extends HTMLElement{static TAG="tc-abbr-element";constructor(e){super(),Component.initComponent(this,AbbreviationElement,e)}}TypeComposer.defineElement(AbbreviationElement.TAG,AbbreviationElement,{extends:"abbr"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbbreviationElement.js","sourceRoot":"","sources":["../../../src/core/element/AbbreviationElement.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AbbreviationElement.js","sourceRoot":"","sources":["../../../src/core/element/AbbreviationElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEhD,MAAM,OAAO,mBAAoB,SAAQ,WAAW;IAEnD,MAAM,CAAU,GAAG,GAAW,iBAAiB,CAAC;IAEhD,YAAY,KAAmB;QAC9B,KAAK,EAAE,CAAC;QACR,aAAa;QACb,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;;AAGF,YAAY,CAAC,aAAa,CAAC,mBAAmB,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC"}
|
|
@@ -1,24 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface DataAnchorElement extends ElementProps {
|
|
3
|
-
href?: string;
|
|
4
|
-
rlink?: string;
|
|
5
|
-
target?: string;
|
|
6
|
-
}
|
|
1
|
+
import { ElementType } from "../../";
|
|
7
2
|
export declare class AnchorElement extends HTMLAnchorElement implements IComponent {
|
|
8
3
|
#private;
|
|
9
4
|
static readonly TAG: string;
|
|
10
|
-
constructor(props?:
|
|
11
|
-
download?: string;
|
|
12
|
-
href?: string;
|
|
13
|
-
hreflang?: string;
|
|
14
|
-
media?: string;
|
|
15
|
-
ping?: string;
|
|
16
|
-
referrerpolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
17
|
-
rel?: "alternate" | "author" | "bookmark" | "external" | "help" | "license" | "next" | "nofollow" | "noopener" | "noreferrer" | "opener" | "prev" | "search" | "tag";
|
|
18
|
-
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
19
|
-
type?: string;
|
|
20
|
-
rlink?: string;
|
|
21
|
-
});
|
|
5
|
+
constructor(props?: ElementType<AnchorElement>);
|
|
22
6
|
set rlink(link: string);
|
|
23
7
|
get rlink(): string;
|
|
24
8
|
}
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
import { Component, Router }
|
|
2
|
-
export class AnchorElement extends HTMLAnchorElement {
|
|
3
|
-
static TAG = "tc-anchor-element";
|
|
4
|
-
#rlinkController = undefined;
|
|
5
|
-
constructor(props) {
|
|
6
|
-
super();
|
|
7
|
-
Component.applyProps(this, props);
|
|
8
|
-
}
|
|
9
|
-
set rlink(link) {
|
|
10
|
-
if (this.#rlinkController)
|
|
11
|
-
this.removeEventListener("click", this.#rlinkController.action);
|
|
12
|
-
this.href = link;
|
|
13
|
-
if (link) {
|
|
14
|
-
this.#rlinkController = {
|
|
15
|
-
rlink: link,
|
|
16
|
-
action: (e) => {
|
|
17
|
-
e.preventDefault();
|
|
18
|
-
Router.go(link);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
this.addEventListener("click", this.#rlinkController.action);
|
|
22
|
-
}
|
|
23
|
-
else
|
|
24
|
-
this.#rlinkController;
|
|
25
|
-
}
|
|
26
|
-
get rlink() {
|
|
27
|
-
return this.#rlinkController?.rlink || "";
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
TypeComposer.defineElement(AnchorElement.TAG, AnchorElement, { extends: "a" });
|
|
31
|
-
//# sourceMappingURL=AnchorElement.js.map
|
|
1
|
+
import{Component,Router}from"../../";export class AnchorElement extends HTMLAnchorElement{static TAG="tc-anchor-element";#e=void 0;constructor(e){super(),Component.initComponent(this,AnchorElement,e)}set rlink(e){this.#e&&this.removeEventListener("click",this.#e.action),this.href=e,e?(this.#e={rlink:e,action:n=>{n.preventDefault(),Router.go(e)}},this.addEventListener("click",this.#e.action)):this.#e=void 0}get rlink(){return this.#e?.rlink||""}}TypeComposer.defineElement(AnchorElement.TAG,AnchorElement,{extends:"a"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnchorElement.js","sourceRoot":"","sources":["../../../src/core/element/AnchorElement.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AnchorElement.js","sourceRoot":"","sources":["../../../src/core/element/AnchorElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExD,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAClD,MAAM,CAAU,GAAG,GAAW,mBAAmB,CAAC;IAElD,gBAAgB,GAGZ,SAAS,CAAC;IAEd,YAAY,KAAkC;QAC5C,KAAK,EAAE,CAAC;QACR,aAAa;QACb,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED,IAAI,KAAK,CAAC,IAAY;QACpB,IAAI,IAAI,CAAC,gBAAgB;YAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC3F,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,gBAAgB,GAAG;gBACtB,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,CAAC,CAAM,EAAE,EAAE;oBACjB,CAAC,CAAC,cAAc,EAAE,CAAC;oBACnB,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;gBAClB,CAAC;aACF,CAAC;YACF,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAC/D,CAAC;;YAAM,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAC3C,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC;IAC5C,CAAC;;AAGH,YAAY,CAAC,aAAa,CAAC,aAAa,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC"}
|
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementType } from "../../";
|
|
2
2
|
export declare class AreaElement extends HTMLAreaElement implements IComponent {
|
|
3
3
|
static readonly TAG: string;
|
|
4
|
-
constructor(props?:
|
|
5
|
-
alt?: string;
|
|
6
|
-
coords?: string;
|
|
7
|
-
download?: string;
|
|
8
|
-
href?: string;
|
|
9
|
-
hreflang?: string;
|
|
10
|
-
media?: string;
|
|
11
|
-
ping?: string;
|
|
12
|
-
referrerpolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
13
|
-
rel?: "alternate" | "author" | "bookmark" | "external" | "help" | "license" | "next" | "nofollow" | "noopener" | "noreferrer" | "opener" | "prev" | "search" | "tag";
|
|
14
|
-
shape?: "circle" | "default" | "poly" | "rect";
|
|
15
|
-
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
16
|
-
type?: string;
|
|
17
|
-
});
|
|
4
|
+
constructor(props?: ElementType<AreaElement>);
|
|
18
5
|
}
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
// area
|
|
3
|
-
export class AreaElement extends HTMLAreaElement {
|
|
4
|
-
static TAG = "tc-area-element";
|
|
5
|
-
constructor(props) {
|
|
6
|
-
super();
|
|
7
|
-
Component.applyProps(this, props);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
TypeComposer.defineElement(AreaElement.TAG, AreaElement, { extends: "area" });
|
|
11
|
-
//# sourceMappingURL=AreaElement.js.map
|
|
1
|
+
import{Component}from"../../";export class AreaElement extends HTMLAreaElement{static TAG="tc-area-element";constructor(e){super(),Component.initComponent(this,AreaElement,e)}}TypeComposer.defineElement(AreaElement.TAG,AreaElement,{extends:"area"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AreaElement.js","sourceRoot":"","sources":["../../../src/core/element/AreaElement.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AreaElement.js","sourceRoot":"","sources":["../../../src/core/element/AreaElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEhD,MAAM,OAAO,WAAY,SAAQ,eAAe;IAC/C,MAAM,CAAU,GAAG,GAAW,iBAAiB,CAAC;IAEhD,YAAY,KAAgC;QAC3C,KAAK,EAAE,CAAC;QACR,aAAa;QACb,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;;AAGF,YAAY,CAAC,aAAa,CAAC,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementType } from "../../";
|
|
2
2
|
export declare class ArticleElement extends HTMLElement implements IComponent {
|
|
3
3
|
static readonly TAG: string;
|
|
4
|
-
constructor(props?:
|
|
4
|
+
constructor(props?: ElementType);
|
|
5
5
|
}
|