@progress/kendo-vue-inputs 3.5.0 → 3.5.1-dev.202208100944
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/js/kendo-vue-inputs.js +1 -1
- package/dist/es/checkbox/Checkbox.js +1 -1
- package/dist/es/checkbox/interfaces/CheckboxChangeEvent.js +1 -0
- package/dist/es/checkbox/interfaces/CheckboxFocusEvent.js +1 -0
- package/dist/es/checkbox/interfaces/CheckboxProps.js +1 -0
- package/dist/es/colors/ColorContrastLabels.js +3 -3
- package/dist/es/colors/ColorContrastSvg.js +2 -2
- package/dist/es/colors/ColorGradient.js +7 -7
- package/dist/es/colors/ColorPalette.js +1 -1
- package/dist/es/colors/ColorPicker.js +4 -4
- package/dist/es/colors/interfaces/ColorGradientChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorGradientProps.js +1 -0
- package/dist/es/colors/interfaces/ColorPaletteChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPaletteProps.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerActiveColorClick.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerBlurEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerFocusEvent.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerPaletteSettings.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerPopupSettings.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerProps.js +1 -0
- package/dist/es/colors/interfaces/ColorPickerView.js +1 -0
- package/dist/es/colors/interfaces/FlatColorPickerViewChangeEvent.js +1 -0
- package/dist/es/colors/interfaces/PickerPopupSettings.js +1 -0
- package/dist/es/colors/interfaces/PickerProps.js +1 -0
- package/dist/es/colors/models/hsva.js +1 -0
- package/dist/es/colors/models/output-format.js +1 -0
- package/dist/es/colors/models/rgb.js +1 -0
- package/dist/es/colors/models/rgba.js +1 -0
- package/dist/es/colors/models/table-cell.js +1 -0
- package/dist/es/colors/models/tile-size.js +1 -0
- package/dist/es/colors/utils/color-parser.js +1 -1
- package/dist/es/colors/utils/svg-calc.js +4 -4
- package/dist/es/input/Input.js +2 -2
- package/dist/es/interfaces/Direction.js +1 -0
- package/dist/es/interfaces/ToggleBaseProps.js +1 -0
- package/dist/es/maskedtextbox/MaskedTextBox.js +3 -3
- package/dist/es/maskedtextbox/MaskedTextBoxProps.js +1 -0
- package/dist/es/maskedtextbox/parsing/result.js +1 -1
- package/dist/es/numerictextbox/NumericTextBox.js +2 -2
- package/dist/es/numerictextbox/interfaces/NumericTextBoxData.js +1 -0
- package/dist/es/numerictextbox/interfaces/NumericTextBoxProps.js +1 -0
- package/dist/es/numerictextbox/utils/index.js +4 -4
- package/dist/es/package-metadata.js +1 -1
- package/dist/es/radiobutton/RadioButton.js +1 -1
- package/dist/es/radiobutton/interfaces/RadioButtonBlurEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioButtonChangeEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioButtonFocusEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioButtonProps.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioGroupChangeEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioGroupFocusEvent.js +1 -0
- package/dist/es/radiobutton/interfaces/RadioGroupProps.js +1 -0
- package/dist/es/range-slider/RangeSlider.js +4 -4
- package/dist/es/slider/SliderLabel.js +2 -2
- package/dist/es/switch/Switch.js +3 -3
- package/dist/es/textarea/TextArea.js +3 -3
- package/dist/es/textarea/interfaces/TextAreaBlurEvent.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaChangeEvent.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaFlow.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaFocusEvent.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaProps.js +1 -0
- package/dist/es/textarea/interfaces/TextAreaResize.js +1 -0
- package/dist/esm/additionalTypes.ts +21 -0
- package/dist/esm/checkbox/Checkbox.d.ts +79 -0
- package/dist/esm/checkbox/Checkbox.js +373 -0
- package/dist/esm/checkbox/interfaces/CheckboxChangeEvent.d.ts +9 -0
- package/dist/esm/checkbox/interfaces/CheckboxChangeEvent.js +1 -0
- package/dist/esm/checkbox/interfaces/CheckboxFocusEvent.d.ts +5 -0
- package/dist/esm/checkbox/interfaces/CheckboxFocusEvent.js +1 -0
- package/dist/esm/checkbox/interfaces/CheckboxProps.d.ts +110 -0
- package/dist/esm/checkbox/interfaces/CheckboxProps.js +1 -0
- package/dist/esm/colors/ColorContrastLabels.d.ts +49 -0
- package/dist/esm/colors/ColorContrastLabels.js +84 -0
- package/dist/esm/colors/ColorContrastSvg.d.ts +50 -0
- package/dist/esm/colors/ColorContrastSvg.js +130 -0
- package/dist/esm/colors/ColorGradient.d.ts +54 -0
- package/dist/esm/colors/ColorGradient.js +515 -0
- package/dist/esm/colors/ColorInput.d.ts +57 -0
- package/dist/esm/colors/ColorInput.js +343 -0
- package/dist/esm/colors/ColorPalette.d.ts +60 -0
- package/dist/esm/colors/ColorPalette.js +343 -0
- package/dist/esm/colors/ColorPicker.d.ts +57 -0
- package/dist/esm/colors/ColorPicker.js +505 -0
- package/dist/esm/colors/FlatColorPicker.d.ts +139 -0
- package/dist/esm/colors/FlatColorPicker.js +539 -0
- package/dist/esm/colors/HexInput.d.ts +52 -0
- package/dist/esm/colors/HexInput.js +110 -0
- package/dist/esm/colors/Picker.d.ts +46 -0
- package/dist/esm/colors/Picker.js +110 -0
- package/dist/esm/colors/interfaces/ColorGradientChangeEvent.d.ts +13 -0
- package/dist/esm/colors/interfaces/ColorGradientChangeEvent.js +1 -0
- package/dist/esm/colors/interfaces/ColorGradientProps.d.ts +68 -0
- package/dist/esm/colors/interfaces/ColorGradientProps.js +1 -0
- package/dist/esm/colors/interfaces/ColorPaletteChangeEvent.d.ts +13 -0
- package/dist/esm/colors/interfaces/ColorPaletteChangeEvent.js +1 -0
- package/dist/esm/colors/interfaces/ColorPaletteProps.d.ts +71 -0
- package/dist/esm/colors/interfaces/ColorPaletteProps.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerActiveColorClick.d.ts +13 -0
- package/dist/esm/colors/interfaces/ColorPickerActiveColorClick.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerBlurEvent.d.ts +9 -0
- package/dist/esm/colors/interfaces/ColorPickerBlurEvent.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerChangeEvent.d.ts +17 -0
- package/dist/esm/colors/interfaces/ColorPickerChangeEvent.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerFocusEvent.d.ts +9 -0
- package/dist/esm/colors/interfaces/ColorPickerFocusEvent.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerPaletteSettings.d.ts +32 -0
- package/dist/esm/colors/interfaces/ColorPickerPaletteSettings.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerPopupSettings.d.ts +14 -0
- package/dist/esm/colors/interfaces/ColorPickerPopupSettings.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerProps.d.ts +176 -0
- package/dist/esm/colors/interfaces/ColorPickerProps.js +1 -0
- package/dist/esm/colors/interfaces/ColorPickerView.d.ts +10 -0
- package/dist/esm/colors/interfaces/ColorPickerView.js +1 -0
- package/dist/esm/colors/interfaces/FlatColorPickerViewChangeEvent.d.ts +13 -0
- package/dist/esm/colors/interfaces/FlatColorPickerViewChangeEvent.js +1 -0
- package/dist/esm/colors/interfaces/PickerPopupSettings.d.ts +14 -0
- package/dist/esm/colors/interfaces/PickerPopupSettings.js +1 -0
- package/dist/esm/colors/interfaces/PickerProps.d.ts +46 -0
- package/dist/esm/colors/interfaces/PickerProps.js +1 -0
- package/dist/esm/colors/models/hsva.d.ts +9 -0
- package/dist/esm/colors/models/hsva.js +1 -0
- package/dist/esm/colors/models/output-format.d.ts +4 -0
- package/dist/esm/colors/models/output-format.js +1 -0
- package/dist/esm/colors/models/palette-presets.d.ts +53 -0
- package/dist/esm/colors/models/palette-presets.js +54 -0
- package/dist/esm/colors/models/rgb.d.ts +8 -0
- package/dist/esm/colors/models/rgb.js +1 -0
- package/dist/esm/colors/models/rgba.d.ts +9 -0
- package/dist/esm/colors/models/rgba.js +1 -0
- package/dist/esm/colors/models/table-cell.d.ts +7 -0
- package/dist/esm/colors/models/table-cell.js +1 -0
- package/dist/esm/colors/models/tile-size.d.ts +11 -0
- package/dist/esm/colors/models/tile-size.js +1 -0
- package/dist/esm/colors/utils/color-cache.d.ts +43 -0
- package/dist/esm/colors/utils/color-cache.js +75 -0
- package/dist/esm/colors/utils/color-palette.service.d.ts +13 -0
- package/dist/esm/colors/utils/color-palette.service.js +67 -0
- package/dist/esm/colors/utils/color-parser.d.ts +71 -0
- package/dist/esm/colors/utils/color-parser.js +145 -0
- package/dist/esm/colors/utils/misc.d.ts +15 -0
- package/dist/esm/colors/utils/misc.js +20 -0
- package/dist/esm/colors/utils/svg-calc.d.ts +62 -0
- package/dist/esm/colors/utils/svg-calc.js +103 -0
- package/dist/esm/input/Input.d.ts +189 -0
- package/dist/esm/input/Input.js +426 -0
- package/dist/esm/input-separator/InputSeparator.d.ts +26 -0
- package/dist/esm/input-separator/InputSeparator.js +43 -0
- package/dist/esm/interfaces/Direction.d.ts +1 -0
- package/dist/esm/interfaces/Direction.js +1 -0
- package/dist/esm/interfaces/ToggleBaseProps.d.ts +8 -0
- package/dist/esm/interfaces/ToggleBaseProps.js +1 -0
- package/dist/esm/main.d.ts +39 -0
- package/dist/esm/main.js +37 -0
- package/dist/esm/maskedtextbox/MaskedTextBox.d.ts +76 -0
- package/dist/esm/maskedtextbox/MaskedTextBox.js +511 -0
- package/dist/esm/maskedtextbox/MaskedTextBoxProps.d.ts +219 -0
- package/dist/esm/maskedtextbox/MaskedTextBoxProps.js +2 -0
- package/dist/esm/maskedtextbox/masking.service.d.ts +41 -0
- package/dist/esm/maskedtextbox/masking.service.js +206 -0
- package/dist/esm/maskedtextbox/parsing/combinators.d.ts +9 -0
- package/dist/esm/maskedtextbox/parsing/combinators.js +24 -0
- package/dist/esm/maskedtextbox/parsing/parsers.d.ts +47 -0
- package/dist/esm/maskedtextbox/parsing/parsers.js +154 -0
- package/dist/esm/maskedtextbox/parsing/result.d.ts +23 -0
- package/dist/esm/maskedtextbox/parsing/result.js +39 -0
- package/dist/esm/maskedtextbox/parsing/stream.d.ts +22 -0
- package/dist/esm/maskedtextbox/parsing/stream.js +41 -0
- package/dist/esm/maskedtextbox/utils.d.ts +16 -0
- package/dist/esm/maskedtextbox/utils.js +56 -0
- package/dist/esm/messages/index.d.ts +160 -0
- package/dist/esm/messages/index.js +162 -0
- package/dist/esm/numerictextbox/NumericTextBox.d.ts +87 -0
- package/dist/esm/numerictextbox/NumericTextBox.js +684 -0
- package/dist/esm/numerictextbox/interfaces/NumericTextBoxData.d.ts +15 -0
- package/dist/esm/numerictextbox/interfaces/NumericTextBoxData.js +1 -0
- package/dist/esm/numerictextbox/interfaces/NumericTextBoxProps.d.ts +178 -0
- package/dist/esm/numerictextbox/interfaces/NumericTextBoxProps.js +1 -0
- package/dist/esm/numerictextbox/utils/index.d.ts +119 -0
- package/dist/esm/numerictextbox/utils/index.js +646 -0
- package/dist/esm/package-metadata.d.ts +5 -0
- package/dist/esm/package-metadata.js +11 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/radiobutton/RadioButton.d.ts +55 -0
- package/dist/esm/radiobutton/RadioButton.js +195 -0
- package/dist/esm/radiobutton/RadioGroup.d.ts +57 -0
- package/dist/esm/radiobutton/RadioGroup.js +218 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonBlurEvent.d.ts +5 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonBlurEvent.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonChangeEvent.d.ts +9 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonChangeEvent.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonFocusEvent.d.ts +5 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonFocusEvent.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonProps.d.ts +107 -0
- package/dist/esm/radiobutton/interfaces/RadioButtonProps.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupChangeEvent.d.ts +9 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupChangeEvent.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupFocusEvent.d.ts +5 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupFocusEvent.js +1 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupProps.d.ts +81 -0
- package/dist/esm/radiobutton/interfaces/RadioGroupProps.js +1 -0
- package/dist/esm/range-slider/RangeSlider.d.ts +176 -0
- package/dist/esm/range-slider/RangeSlider.js +617 -0
- package/dist/esm/range-slider/range-raducer.d.ts +35 -0
- package/dist/esm/range-slider/range-raducer.js +157 -0
- package/dist/esm/slider/Slider.d.ts +140 -0
- package/dist/esm/slider/Slider.js +395 -0
- package/dist/esm/slider/SliderLabel.d.ts +65 -0
- package/dist/esm/slider/SliderLabel.js +121 -0
- package/dist/esm/switch/Switch.d.ts +182 -0
- package/dist/esm/switch/Switch.js +342 -0
- package/dist/esm/switch/util.d.ts +8 -0
- package/dist/esm/switch/util.js +46 -0
- package/dist/esm/textarea/TextArea.d.ts +81 -0
- package/dist/esm/textarea/TextArea.js +422 -0
- package/dist/esm/textarea/interfaces/TextAreaBlurEvent.d.ts +5 -0
- package/dist/esm/textarea/interfaces/TextAreaBlurEvent.js +1 -0
- package/dist/esm/textarea/interfaces/TextAreaChangeEvent.d.ts +9 -0
- package/dist/esm/textarea/interfaces/TextAreaChangeEvent.js +1 -0
- package/dist/esm/textarea/interfaces/TextAreaFlow.d.ts +8 -0
- package/dist/esm/textarea/interfaces/TextAreaFlow.js +1 -0
- package/dist/esm/textarea/interfaces/TextAreaFocusEvent.d.ts +5 -0
- package/dist/esm/textarea/interfaces/TextAreaFocusEvent.js +1 -0
- package/dist/esm/textarea/interfaces/TextAreaProps.d.ts +170 -0
- package/dist/esm/textarea/interfaces/TextAreaProps.js +1 -0
- package/dist/esm/textarea/interfaces/TextAreaResize.d.ts +10 -0
- package/dist/esm/textarea/interfaces/TextAreaResize.js +1 -0
- package/dist/npm/checkbox/Checkbox.js +12 -12
- package/dist/npm/colors/ColorContrastLabels.js +5 -5
- package/dist/npm/colors/ColorContrastSvg.js +4 -4
- package/dist/npm/colors/ColorGradient.js +42 -42
- package/dist/npm/colors/ColorInput.js +2 -2
- package/dist/npm/colors/ColorPalette.js +12 -12
- package/dist/npm/colors/ColorPicker.js +15 -15
- package/dist/npm/colors/FlatColorPicker.js +10 -10
- package/dist/npm/colors/HexInput.js +4 -4
- package/dist/npm/colors/Picker.js +2 -2
- package/dist/npm/colors/utils/color-palette.service.js +6 -6
- package/dist/npm/colors/utils/color-parser.js +48 -37
- package/dist/npm/colors/utils/misc.js +5 -3
- package/dist/npm/colors/utils/svg-calc.js +12 -8
- package/dist/npm/input/Input.js +4 -4
- package/dist/npm/input-separator/InputSeparator.js +1 -1
- package/dist/npm/main.js +7 -2
- package/dist/npm/maskedtextbox/MaskedTextBox.js +8 -8
- package/dist/npm/maskedtextbox/masking.service.js +19 -19
- package/dist/npm/maskedtextbox/parsing/combinators.js +4 -2
- package/dist/npm/maskedtextbox/parsing/parsers.js +14 -7
- package/dist/npm/maskedtextbox/parsing/result.js +1 -1
- package/dist/npm/numerictextbox/NumericTextBox.js +22 -22
- package/dist/npm/numerictextbox/utils/index.js +145 -116
- package/dist/npm/package-metadata.js +1 -1
- package/dist/npm/radiobutton/RadioButton.js +8 -8
- package/dist/npm/radiobutton/RadioGroup.js +5 -5
- package/dist/npm/range-slider/RangeSlider.js +17 -17
- package/dist/npm/range-slider/range-raducer.js +4 -2
- package/dist/npm/slider/Slider.js +7 -7
- package/dist/npm/slider/SliderLabel.js +3 -3
- package/dist/npm/switch/Switch.js +13 -13
- package/dist/npm/switch/util.js +2 -1
- package/dist/npm/textarea/TextArea.js +7 -7
- package/package.json +11 -11
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { FormComponentProps } from '@progress/kendo-vue-common';
|
|
2
|
+
/**
|
|
3
|
+
* The arguments for a MaskedTextBox event.
|
|
4
|
+
*/
|
|
5
|
+
export interface MaskedTextBoxEvent {
|
|
6
|
+
/**
|
|
7
|
+
* A native DOM event.
|
|
8
|
+
*/
|
|
9
|
+
event: Event;
|
|
10
|
+
/**
|
|
11
|
+
* An event target.
|
|
12
|
+
*/
|
|
13
|
+
target: any;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The arguments for the `change` event of the MaskedTextBox.
|
|
17
|
+
*/
|
|
18
|
+
export interface MaskedTextBoxChangeEvent extends MaskedTextBoxEvent {
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the start of the selection which will be set to the MaskedTextBox when it is updated.
|
|
21
|
+
*/
|
|
22
|
+
selectionStart: number;
|
|
23
|
+
/**
|
|
24
|
+
* Specifies the end of the selection which will be set to the MaskedTextBox when it is updated.
|
|
25
|
+
*/
|
|
26
|
+
selectionEnd: number;
|
|
27
|
+
/**
|
|
28
|
+
* The current value of the component.
|
|
29
|
+
*/
|
|
30
|
+
value: any;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Represents the props of the [Kendo UI for Vue MaskedTextBox component]({% slug overview_maskedtextbox %}).
|
|
34
|
+
*/
|
|
35
|
+
export interface MaskedTextBoxProps extends FormComponentProps {
|
|
36
|
+
/**
|
|
37
|
+
* Specifies the value of the MaskedTextBox.
|
|
38
|
+
*/
|
|
39
|
+
value?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Specifies the initial value. Leaves the subsequent updates uncontrolled.
|
|
42
|
+
*/
|
|
43
|
+
defaultValue?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Specifies the input placeholder.
|
|
46
|
+
*/
|
|
47
|
+
placeholder?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the title of the `input` element of the MaskedTextBox.
|
|
50
|
+
*/
|
|
51
|
+
title?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Represents the `dir` HTML attribute.
|
|
54
|
+
*/
|
|
55
|
+
dir?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Configures the `size` of the MaskedTextBox.
|
|
58
|
+
*
|
|
59
|
+
* The available options are:
|
|
60
|
+
* - small
|
|
61
|
+
* - medium
|
|
62
|
+
* - large
|
|
63
|
+
* - null—Does not set a size `class`.
|
|
64
|
+
*
|
|
65
|
+
* @default `medium`
|
|
66
|
+
*/
|
|
67
|
+
size?: null | 'small' | 'medium' | 'large' | string;
|
|
68
|
+
/**
|
|
69
|
+
* Configures the `roundness` of the MaskedTextBox.
|
|
70
|
+
*
|
|
71
|
+
* The available options are:
|
|
72
|
+
* - small
|
|
73
|
+
* - medium
|
|
74
|
+
* - large
|
|
75
|
+
* - full
|
|
76
|
+
* - null—Does not set a rounded `class`.
|
|
77
|
+
*
|
|
78
|
+
* @default `medium`
|
|
79
|
+
*/
|
|
80
|
+
rounded?: null | 'small' | 'medium' | 'large' | 'full' | string;
|
|
81
|
+
/**
|
|
82
|
+
* Configures the `fillMode` of the MaskedTextBox.
|
|
83
|
+
*
|
|
84
|
+
* The available options are:
|
|
85
|
+
* - solid
|
|
86
|
+
* - outline
|
|
87
|
+
* - flat
|
|
88
|
+
* - null—Does not set a fillMode `class`.
|
|
89
|
+
*
|
|
90
|
+
* @default `solid`
|
|
91
|
+
*/
|
|
92
|
+
fillMode?: null | 'solid' | 'flat' | 'outline' | string;
|
|
93
|
+
/**
|
|
94
|
+
* Sets the `tabIndex` property of the MaskedTextBox.
|
|
95
|
+
*/
|
|
96
|
+
tabIndex?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Specifies the `accessKey` of the MaskedTextBox.
|
|
99
|
+
*/
|
|
100
|
+
accessKey?: string;
|
|
101
|
+
/**
|
|
102
|
+
* Specifies the width of the MaskedTextBox.
|
|
103
|
+
*/
|
|
104
|
+
width?: number | string;
|
|
105
|
+
/**
|
|
106
|
+
* Determines whether the MaskedTextBox is disabled.
|
|
107
|
+
*/
|
|
108
|
+
disabled?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Renders a floating label for the MaskedTextBox.
|
|
111
|
+
*/
|
|
112
|
+
label?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Sets the `id` of the `input` DOM element.
|
|
115
|
+
*/
|
|
116
|
+
id?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
|
|
119
|
+
* For example these elements could contain error or hint message.
|
|
120
|
+
*/
|
|
121
|
+
ariaDescribedBy?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Identifies the element(s) which will label the component.
|
|
124
|
+
*/
|
|
125
|
+
ariaLabelledBy?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Determines whether the MaskedTextBox is in its read-only state.
|
|
128
|
+
*/
|
|
129
|
+
readonly?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Represents a prompt character for the masked value. Defaults to `_`.
|
|
132
|
+
*/
|
|
133
|
+
prompt?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Indicates a character which represents an empty position in the raw value. Defaults to ` `.
|
|
136
|
+
*/
|
|
137
|
+
promptPlaceholder?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Indicates whether to include literals in the raw value. Defaults to `false`.
|
|
140
|
+
*/
|
|
141
|
+
includeLiterals?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Determines whether the built-in mask validator is enforced when a form is validated. Defaults to `true`.
|
|
144
|
+
*/
|
|
145
|
+
maskValidation?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Represents the current mask. If no mask is set, the component behaves as a standard `type="text"` input.
|
|
148
|
+
*/
|
|
149
|
+
mask?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Represents the RegExp-based mask validation array.
|
|
152
|
+
*/
|
|
153
|
+
rules?: {
|
|
154
|
+
[key: string]: RegExp;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Represents the beginning and ending of the selected portion of the input content that will be applied the next time when the MaskedTextBox is rendered.
|
|
158
|
+
*/
|
|
159
|
+
selection?: {
|
|
160
|
+
start: number;
|
|
161
|
+
end: number;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Determines the event handler that will be fired when the user edits the value.
|
|
165
|
+
*/
|
|
166
|
+
onChange?: (event: MaskedTextBoxChangeEvent) => void;
|
|
167
|
+
/**
|
|
168
|
+
* Fires each time the user focuses the MaskedTextBox.
|
|
169
|
+
*/
|
|
170
|
+
onFocus?: (event: MaskedTextBoxEvent) => void;
|
|
171
|
+
/**
|
|
172
|
+
* Fires each time the MaskedTextBox gets blurred.
|
|
173
|
+
*/
|
|
174
|
+
onBlur?: (event: MaskedTextBoxEvent) => void;
|
|
175
|
+
/**
|
|
176
|
+
* v-model raw value
|
|
177
|
+
*/
|
|
178
|
+
modelRawValue?: string;
|
|
179
|
+
/**
|
|
180
|
+
* v-model value
|
|
181
|
+
*/
|
|
182
|
+
modelValue?: string;
|
|
183
|
+
/**
|
|
184
|
+
* The type of the input - 'text' by default
|
|
185
|
+
*/
|
|
186
|
+
type?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Defines a string prop that controls the input icon.
|
|
189
|
+
*/
|
|
190
|
+
iconName?: String;
|
|
191
|
+
/**
|
|
192
|
+
* Defines if the inputPrefix will be shown. Accepts a slot name, a `render` function, or a Vue component.
|
|
193
|
+
*/
|
|
194
|
+
inputPrefix?: Boolean | String | Object | Function;
|
|
195
|
+
/**
|
|
196
|
+
* Defines if the inputSuffix will be shown. Accepts a slot name, a `render` function, or a Vue component.
|
|
197
|
+
*/
|
|
198
|
+
inputSuffix?: Boolean | String | Object | Function;
|
|
199
|
+
/**
|
|
200
|
+
* Defines a boolean prop that controls whether to show the validation icon. Defaults to 'false'.
|
|
201
|
+
*/
|
|
202
|
+
showValidationIcon?: Boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Defines a boolean prop that controls whether to show the loading icon. Defaults to 'false'.
|
|
205
|
+
*/
|
|
206
|
+
showLoadingIcon?: Boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Defines a boolean prop that controls whether to show the clear icon. Defaults to 'false'.
|
|
209
|
+
*/
|
|
210
|
+
showClearButton?: Boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Defines additional class to the inner input element.
|
|
213
|
+
*/
|
|
214
|
+
inputClass?: String;
|
|
215
|
+
/**
|
|
216
|
+
* Defines additional class to the wrapper element.
|
|
217
|
+
*/
|
|
218
|
+
wrapperClass?: String;
|
|
219
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @hidden
|
|
3
|
+
*/
|
|
4
|
+
export declare class MaskingService {
|
|
5
|
+
rules: {
|
|
6
|
+
[key: string]: RegExp;
|
|
7
|
+
};
|
|
8
|
+
prompt: string;
|
|
9
|
+
mask: string;
|
|
10
|
+
promptPlaceholder: string;
|
|
11
|
+
includeLiterals: boolean;
|
|
12
|
+
maskTokens: any[];
|
|
13
|
+
unmaskTokens: any[];
|
|
14
|
+
rawTokens: any[];
|
|
15
|
+
validationTokens: any[];
|
|
16
|
+
update({ mask, prompt, promptPlaceholder, rules, includeLiterals }: any): void;
|
|
17
|
+
validationValue(maskedValue?: string): string;
|
|
18
|
+
rawValue(maskedValue?: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
maskRaw(rawValue?: string): string;
|
|
23
|
+
maskInput(input: string, control: string, splitPoint: number): any;
|
|
24
|
+
maskInRange(pasted: string, oldValue: string, start: number, end: number): any;
|
|
25
|
+
private maskRemoved;
|
|
26
|
+
private adjustPosition;
|
|
27
|
+
private maskInserted;
|
|
28
|
+
protected get maskTokenCreator(): {
|
|
29
|
+
[key: string]: Function;
|
|
30
|
+
};
|
|
31
|
+
protected get unmaskTokenCreator(): {
|
|
32
|
+
[key: string]: Function;
|
|
33
|
+
};
|
|
34
|
+
protected get rawTokenCreator(): {
|
|
35
|
+
[key: string]: Function;
|
|
36
|
+
};
|
|
37
|
+
protected get validationTokenCreator(): {
|
|
38
|
+
[key: string]: Function;
|
|
39
|
+
};
|
|
40
|
+
private tokenize;
|
|
41
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { greedy, sequence } from './parsing/combinators.js';
|
|
2
|
+
import { literal, mask as maskParser, rawLiteral, rawMask, token, unliteral, unmask } from './parsing/parsers.js';
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
var MaskingService = /** @class */ (function () {
|
|
7
|
+
function MaskingService() {
|
|
8
|
+
this.rules = {};
|
|
9
|
+
this.prompt = '_';
|
|
10
|
+
this.mask = '';
|
|
11
|
+
this.promptPlaceholder = ' ';
|
|
12
|
+
this.includeLiterals = false;
|
|
13
|
+
this.maskTokens = [];
|
|
14
|
+
this.unmaskTokens = [];
|
|
15
|
+
this.rawTokens = [];
|
|
16
|
+
this.validationTokens = [];
|
|
17
|
+
}
|
|
18
|
+
MaskingService.prototype.update = function (_a) {
|
|
19
|
+
var _b = _a.mask, mask = _b === void 0 ? '' : _b, _c = _a.prompt, prompt = _c === void 0 ? '' : _c, _d = _a.promptPlaceholder, promptPlaceholder = _d === void 0 ? ' ' : _d, _e = _a.rules, rules = _e === void 0 ? {} : _e, _f = _a.includeLiterals, includeLiterals = _f === void 0 ? false : _f;
|
|
20
|
+
this.mask = mask;
|
|
21
|
+
this.prompt = prompt;
|
|
22
|
+
this.promptPlaceholder = promptPlaceholder;
|
|
23
|
+
this.rules = rules;
|
|
24
|
+
this.includeLiterals = includeLiterals;
|
|
25
|
+
this.tokenize();
|
|
26
|
+
};
|
|
27
|
+
MaskingService.prototype.validationValue = function (maskedValue) {
|
|
28
|
+
if (maskedValue === void 0) { maskedValue = ''; }
|
|
29
|
+
var value = maskedValue;
|
|
30
|
+
sequence(this.validationTokens)
|
|
31
|
+
.run(maskedValue)
|
|
32
|
+
.fold(function (unmasked) {
|
|
33
|
+
value = unmasked.join('');
|
|
34
|
+
});
|
|
35
|
+
return value;
|
|
36
|
+
};
|
|
37
|
+
MaskingService.prototype.rawValue = function (maskedValue) {
|
|
38
|
+
if (maskedValue === void 0) { maskedValue = ''; }
|
|
39
|
+
var value = maskedValue;
|
|
40
|
+
if (!this.rawTokens.length) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
sequence(this.rawTokens)
|
|
44
|
+
.run(maskedValue)
|
|
45
|
+
.fold(function (unmasked) {
|
|
46
|
+
value = unmasked.join('');
|
|
47
|
+
});
|
|
48
|
+
return value;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* @hidden
|
|
52
|
+
*/
|
|
53
|
+
MaskingService.prototype.maskRaw = function (rawValue) {
|
|
54
|
+
if (rawValue === void 0) { rawValue = ''; }
|
|
55
|
+
var value = rawValue;
|
|
56
|
+
if (!this.maskTokens.length) {
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
sequence(this.maskTokens)
|
|
60
|
+
.run(rawValue)
|
|
61
|
+
.fold(function (masked) {
|
|
62
|
+
value = masked.join('');
|
|
63
|
+
});
|
|
64
|
+
return value;
|
|
65
|
+
};
|
|
66
|
+
MaskingService.prototype.maskInput = function (input, control, splitPoint) {
|
|
67
|
+
if (input.length < control.length) {
|
|
68
|
+
return this.maskRemoved(input, control, splitPoint);
|
|
69
|
+
}
|
|
70
|
+
return this.maskInserted(input, control, splitPoint);
|
|
71
|
+
};
|
|
72
|
+
MaskingService.prototype.maskInRange = function (pasted, oldValue, start, end) {
|
|
73
|
+
var value = '';
|
|
74
|
+
var selection = end;
|
|
75
|
+
var beforeChange = oldValue.split('').slice(0, start);
|
|
76
|
+
var afterChange = oldValue.split('').slice(end);
|
|
77
|
+
sequence(this.maskTokens.slice(start, end))
|
|
78
|
+
.run(pasted)
|
|
79
|
+
.fold(function (masked) {
|
|
80
|
+
value = beforeChange
|
|
81
|
+
.concat(masked)
|
|
82
|
+
.concat(afterChange)
|
|
83
|
+
.join('');
|
|
84
|
+
});
|
|
85
|
+
return {
|
|
86
|
+
selection: selection,
|
|
87
|
+
value: value
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
MaskingService.prototype.maskRemoved = function (input, control, splitPoint) {
|
|
91
|
+
var _this = this;
|
|
92
|
+
var value = '';
|
|
93
|
+
var selection = splitPoint;
|
|
94
|
+
var unchanged = input.split('').slice(splitPoint);
|
|
95
|
+
var changed = input.split('').slice(0, splitPoint).join('');
|
|
96
|
+
var take = this.maskTokens.length - (input.length - splitPoint);
|
|
97
|
+
sequence(this.maskTokens.slice(0, take))
|
|
98
|
+
.run(changed, control)
|
|
99
|
+
.fold(function (masked) {
|
|
100
|
+
selection = _this.adjustPosition(masked, selection);
|
|
101
|
+
value = masked.concat(unchanged).join('');
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
selection: selection,
|
|
105
|
+
value: value
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
MaskingService.prototype.adjustPosition = function (input, selection) {
|
|
109
|
+
var caretChar = input[selection];
|
|
110
|
+
var isLiteral = this.maskTokens[selection].isLiteral(caretChar);
|
|
111
|
+
if (!isLiteral && caretChar !== this.prompt) {
|
|
112
|
+
return selection + 1;
|
|
113
|
+
}
|
|
114
|
+
return selection;
|
|
115
|
+
};
|
|
116
|
+
MaskingService.prototype.maskInserted = function (input, control, splitPoint) {
|
|
117
|
+
var _this = this;
|
|
118
|
+
var value = '';
|
|
119
|
+
var selection = splitPoint;
|
|
120
|
+
var changed = input.slice(0, splitPoint);
|
|
121
|
+
sequence(this.unmaskTokens)
|
|
122
|
+
.run(changed, control)
|
|
123
|
+
.chain(function (unmasked) {
|
|
124
|
+
selection = unmasked.join('').length;
|
|
125
|
+
var unchanged = control.slice(selection);
|
|
126
|
+
return sequence(_this.maskTokens)
|
|
127
|
+
.run(unmasked.join('') + unchanged, control);
|
|
128
|
+
})
|
|
129
|
+
.fold(function (masked) {
|
|
130
|
+
value = masked.join('');
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
selection: selection,
|
|
134
|
+
value: value
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
Object.defineProperty(MaskingService.prototype, "maskTokenCreator", {
|
|
138
|
+
get: function () {
|
|
139
|
+
var _a = this, prompt = _a.prompt, promptPlaceholder = _a.promptPlaceholder;
|
|
140
|
+
return {
|
|
141
|
+
literal: function (rule) { return literal(rule); },
|
|
142
|
+
mask: function (rule) { return maskParser({ prompt: prompt, promptPlaceholder: promptPlaceholder })(rule); }
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
enumerable: false,
|
|
146
|
+
configurable: true
|
|
147
|
+
});
|
|
148
|
+
Object.defineProperty(MaskingService.prototype, "unmaskTokenCreator", {
|
|
149
|
+
get: function () {
|
|
150
|
+
var _this = this;
|
|
151
|
+
return {
|
|
152
|
+
literal: function (rule) { return unliteral(rule); },
|
|
153
|
+
mask: function (rule) { return unmask(_this.prompt)(rule); }
|
|
154
|
+
};
|
|
155
|
+
},
|
|
156
|
+
enumerable: false,
|
|
157
|
+
configurable: true
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(MaskingService.prototype, "rawTokenCreator", {
|
|
160
|
+
get: function () {
|
|
161
|
+
var _a = this, prompt = _a.prompt, promptPlaceholder = _a.promptPlaceholder, includeLiterals = _a.includeLiterals;
|
|
162
|
+
return {
|
|
163
|
+
literal: function (_) { return rawLiteral(includeLiterals); },
|
|
164
|
+
mask: function (_) { return rawMask({ prompt: prompt, promptPlaceholder: promptPlaceholder }); }
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
enumerable: false,
|
|
168
|
+
configurable: true
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(MaskingService.prototype, "validationTokenCreator", {
|
|
171
|
+
get: function () {
|
|
172
|
+
var prompt = this.prompt;
|
|
173
|
+
return {
|
|
174
|
+
literal: function (_) { return rawLiteral(false); },
|
|
175
|
+
mask: function (_) { return rawMask({ prompt: prompt, promptPlaceholder: '' }); }
|
|
176
|
+
};
|
|
177
|
+
},
|
|
178
|
+
enumerable: false,
|
|
179
|
+
configurable: true
|
|
180
|
+
});
|
|
181
|
+
MaskingService.prototype.tokenize = function () {
|
|
182
|
+
var _this = this;
|
|
183
|
+
greedy(token(this.rules, this.maskTokenCreator))
|
|
184
|
+
.run(this.mask)
|
|
185
|
+
.fold(function (tokens, _) {
|
|
186
|
+
_this.maskTokens = tokens;
|
|
187
|
+
});
|
|
188
|
+
greedy(token(this.rules, this.unmaskTokenCreator))
|
|
189
|
+
.run(this.mask)
|
|
190
|
+
.fold(function (tokens, _) {
|
|
191
|
+
_this.unmaskTokens = tokens;
|
|
192
|
+
});
|
|
193
|
+
greedy(token(this.rules, this.rawTokenCreator))
|
|
194
|
+
.run(this.mask)
|
|
195
|
+
.fold(function (tokens, _) {
|
|
196
|
+
_this.rawTokens = tokens;
|
|
197
|
+
});
|
|
198
|
+
greedy(token(this.rules, this.validationTokenCreator))
|
|
199
|
+
.run(this.mask)
|
|
200
|
+
.fold(function (tokens, _) {
|
|
201
|
+
_this.validationTokens = tokens;
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
return MaskingService;
|
|
205
|
+
}());
|
|
206
|
+
export { MaskingService };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Parser } from './parsers.js';
|
|
2
|
+
import { Result } from './result.js';
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
var always = function (value) { return new Parser(function (stream) { return new Result(value, stream); }); };
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
var append = function (p1, p2) { return p1.chain(function (vs) { return p2.map(function (v) { return vs.concat([v]); }); }); };
|
|
11
|
+
/**
|
|
12
|
+
* @hidden
|
|
13
|
+
*/
|
|
14
|
+
export var sequence = function (list) { return list.reduce(function (acc, parser) { return append(acc, parser); }, always([])); };
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
export var greedy = function (parser) { return new Parser(function (stream) {
|
|
19
|
+
var result = new Result([], stream);
|
|
20
|
+
while (!stream.eof()) {
|
|
21
|
+
result = result.concat(parser.run(stream));
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}); };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Result } from './result';
|
|
2
|
+
import { Stream } from './stream';
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
export declare class Parser {
|
|
7
|
+
private parse;
|
|
8
|
+
constructor(parse: Function);
|
|
9
|
+
run(input: Stream | string, control?: string): Result;
|
|
10
|
+
map(f: Function): Parser;
|
|
11
|
+
chain(f: Function): Parser;
|
|
12
|
+
isLiteral(c: string): boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export declare const mask: ({ prompt, promptPlaceholder }: {
|
|
18
|
+
prompt: any;
|
|
19
|
+
promptPlaceholder: any;
|
|
20
|
+
}) => (rule: any) => Parser;
|
|
21
|
+
/**
|
|
22
|
+
* @hidden
|
|
23
|
+
*/
|
|
24
|
+
export declare const literal: (_token: any) => Parser;
|
|
25
|
+
/**
|
|
26
|
+
* @hidden
|
|
27
|
+
*/
|
|
28
|
+
export declare const unmask: (prompt: any) => (rule: any) => Parser;
|
|
29
|
+
/**
|
|
30
|
+
* @hidden
|
|
31
|
+
*/
|
|
32
|
+
export declare const unliteral: (_token: any) => Parser;
|
|
33
|
+
/**
|
|
34
|
+
* @hidden
|
|
35
|
+
*/
|
|
36
|
+
export declare const token: (rules: any, creator: any) => Parser;
|
|
37
|
+
/**
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
export declare const rawMask: ({ prompt, promptPlaceholder }: {
|
|
41
|
+
prompt: any;
|
|
42
|
+
promptPlaceholder: any;
|
|
43
|
+
}) => Parser;
|
|
44
|
+
/**
|
|
45
|
+
* @hidden
|
|
46
|
+
*/
|
|
47
|
+
export declare const rawLiteral: (includeLiterals: any) => Parser;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Result, ResultType } from './result.js';
|
|
2
|
+
import { Stream } from './stream.js';
|
|
3
|
+
var toArray = function (value) { return (value || '').split(''); };
|
|
4
|
+
var ESCAPE_CHARACTER = '\\';
|
|
5
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
var Parser = /** @class */ (function () {
|
|
9
|
+
function Parser(parse) {
|
|
10
|
+
this.parse = parse;
|
|
11
|
+
}
|
|
12
|
+
Parser.prototype.run = function (input, control) {
|
|
13
|
+
if (control === void 0) { control = ''; }
|
|
14
|
+
if (input instanceof Stream) {
|
|
15
|
+
return this.parse(input);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return this.parse(new Stream(toArray(input), toArray(control)));
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
// map :: Functor f => f a ~> (a -> b) -> f b
|
|
22
|
+
Parser.prototype.map = function (f) {
|
|
23
|
+
var _this = this;
|
|
24
|
+
return new Parser(function (stream) { return _this.parse(stream).map(f); });
|
|
25
|
+
};
|
|
26
|
+
// chain :: Chain m => m a ~> (a -> m b) -> m b
|
|
27
|
+
Parser.prototype.chain = function (f) {
|
|
28
|
+
var _this = this;
|
|
29
|
+
return new Parser(function (stream) { return _this.parse(stream).chain(function (v, s) { return f(v).run(s); }); });
|
|
30
|
+
};
|
|
31
|
+
Parser.prototype.isLiteral = function (c) {
|
|
32
|
+
return this.run(c).type === ResultType.Literal;
|
|
33
|
+
};
|
|
34
|
+
return Parser;
|
|
35
|
+
}());
|
|
36
|
+
export { Parser };
|
|
37
|
+
/**
|
|
38
|
+
* @hidden
|
|
39
|
+
*/
|
|
40
|
+
export var mask = function (_a) {
|
|
41
|
+
var prompt = _a.prompt, promptPlaceholder = _a.promptPlaceholder;
|
|
42
|
+
return function (rule) { return new Parser(function (stream) {
|
|
43
|
+
while (!stream.eof()) {
|
|
44
|
+
var _a = stream.peek(), char = _a.char, control = _a.control;
|
|
45
|
+
if (char === control && control === prompt) {
|
|
46
|
+
stream.eat();
|
|
47
|
+
return new Result(prompt, stream, ResultType.Mask);
|
|
48
|
+
}
|
|
49
|
+
if (rule.test(char)) {
|
|
50
|
+
stream.eat();
|
|
51
|
+
return new Result(char, stream, ResultType.Mask);
|
|
52
|
+
}
|
|
53
|
+
if (char === promptPlaceholder) {
|
|
54
|
+
stream.eat();
|
|
55
|
+
return new Result(prompt, stream, ResultType.Mask);
|
|
56
|
+
}
|
|
57
|
+
stream.eat_input();
|
|
58
|
+
}
|
|
59
|
+
stream.eat();
|
|
60
|
+
return new Result(prompt, stream, ResultType.Mask);
|
|
61
|
+
}); };
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* @hidden
|
|
65
|
+
*/
|
|
66
|
+
export var literal = function (_token) { return new Parser(function (stream) {
|
|
67
|
+
// let {char, control} = stream.peek();
|
|
68
|
+
var char = stream.peek().char;
|
|
69
|
+
if (char === _token) {
|
|
70
|
+
stream.eat();
|
|
71
|
+
return new Result(_token, stream, ResultType.Literal);
|
|
72
|
+
}
|
|
73
|
+
// if (control === _token) {
|
|
74
|
+
// while (!stream.eof() && char !== _token) {
|
|
75
|
+
// stream.eat_input();
|
|
76
|
+
// char = stream.peek().char;
|
|
77
|
+
// }
|
|
78
|
+
// }
|
|
79
|
+
//
|
|
80
|
+
// if (control !== undefined) {
|
|
81
|
+
// stream.eat();
|
|
82
|
+
// }
|
|
83
|
+
return new Result(_token, stream, ResultType.Literal);
|
|
84
|
+
}); };
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
*/
|
|
88
|
+
export var unmask = function (prompt) { return function (rule) { return new Parser(function (stream) {
|
|
89
|
+
while (!stream.eof()) {
|
|
90
|
+
var _a = stream.peek(), char = _a.char, control = _a.control;
|
|
91
|
+
if (char === prompt && control === prompt) {
|
|
92
|
+
stream.eat();
|
|
93
|
+
return new Result(char, stream);
|
|
94
|
+
}
|
|
95
|
+
if (rule.test(char)) {
|
|
96
|
+
stream.eat();
|
|
97
|
+
return new Result(char, stream);
|
|
98
|
+
}
|
|
99
|
+
stream.eat_input();
|
|
100
|
+
}
|
|
101
|
+
stream.eat();
|
|
102
|
+
return new Result('', stream);
|
|
103
|
+
}); }; };
|
|
104
|
+
/**
|
|
105
|
+
* @hidden
|
|
106
|
+
*/
|
|
107
|
+
export var unliteral = function (_token) { return new Parser(function (stream) {
|
|
108
|
+
if (stream.eof()) {
|
|
109
|
+
return new Result('', stream);
|
|
110
|
+
}
|
|
111
|
+
var char = stream.peek().char;
|
|
112
|
+
if (char === _token) {
|
|
113
|
+
stream.eat();
|
|
114
|
+
}
|
|
115
|
+
return new Result(_token, stream);
|
|
116
|
+
}); };
|
|
117
|
+
/**
|
|
118
|
+
* @hidden
|
|
119
|
+
*/
|
|
120
|
+
export var token = function (rules, creator) { return new Parser(function (stream) {
|
|
121
|
+
var char = stream.next().char;
|
|
122
|
+
var rule = rules[char];
|
|
123
|
+
if (char === ESCAPE_CHARACTER) {
|
|
124
|
+
char = stream.next().char;
|
|
125
|
+
return new Result(creator.literal(char), stream);
|
|
126
|
+
}
|
|
127
|
+
if (!rule) {
|
|
128
|
+
return new Result(creator.literal(char), stream);
|
|
129
|
+
}
|
|
130
|
+
return new Result(creator.mask(rule), stream);
|
|
131
|
+
}); };
|
|
132
|
+
/**
|
|
133
|
+
* @hidden
|
|
134
|
+
*/
|
|
135
|
+
export var rawMask = function (_a) {
|
|
136
|
+
var prompt = _a.prompt, promptPlaceholder = _a.promptPlaceholder;
|
|
137
|
+
return new Parser(function (stream) {
|
|
138
|
+
var char = stream.next().char;
|
|
139
|
+
if (char === prompt) {
|
|
140
|
+
return new Result(promptPlaceholder, stream);
|
|
141
|
+
}
|
|
142
|
+
return new Result(char, stream);
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* @hidden
|
|
147
|
+
*/
|
|
148
|
+
export var rawLiteral = function (includeLiterals) { return new Parser(function (stream) {
|
|
149
|
+
var char = stream.next().char;
|
|
150
|
+
if (includeLiterals) {
|
|
151
|
+
return new Result(char, stream);
|
|
152
|
+
}
|
|
153
|
+
return new Result('', stream);
|
|
154
|
+
}); };
|