@ckeditor/ckeditor5-ui 36.0.0 → 37.0.0-alpha.0
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/package.json +23 -22
- package/src/bindings/addkeyboardhandlingforgrid.d.ts +27 -0
- package/src/bindings/addkeyboardhandlingforgrid.js +42 -34
- package/src/bindings/clickoutsidehandler.d.ts +28 -0
- package/src/bindings/clickoutsidehandler.js +5 -6
- package/src/bindings/csstransitiondisablermixin.d.ts +40 -0
- package/src/bindings/csstransitiondisablermixin.js +55 -0
- package/src/bindings/injectcsstransitiondisabler.d.ts +59 -0
- package/src/bindings/injectcsstransitiondisabler.js +23 -20
- package/src/bindings/preventdefault.d.ts +33 -0
- package/src/bindings/preventdefault.js +13 -15
- package/src/bindings/submithandler.d.ts +57 -0
- package/src/bindings/submithandler.js +22 -23
- package/src/button/button.d.ts +154 -0
- package/src/button/buttonview.d.ts +155 -0
- package/src/button/buttonview.js +16 -60
- package/src/button/switchbuttonview.d.ts +45 -0
- package/src/button/switchbuttonview.js +9 -18
- package/src/colorgrid/colorgridview.d.ts +132 -0
- package/src/colorgrid/colorgridview.js +8 -40
- package/src/colorgrid/colortileview.d.ts +28 -0
- package/src/colorgrid/colortileview.js +0 -13
- package/src/colorgrid/utils.d.ts +47 -0
- package/src/colorgrid/utils.js +7 -13
- package/src/componentfactory.d.ts +81 -0
- package/src/componentfactory.js +21 -35
- package/src/dropdown/button/dropdownbutton.d.ts +25 -0
- package/src/dropdown/button/dropdownbuttonview.d.ts +48 -0
- package/src/dropdown/button/dropdownbuttonview.js +11 -21
- package/src/dropdown/button/splitbuttonview.d.ts +145 -0
- package/src/dropdown/button/splitbuttonview.js +10 -51
- package/src/dropdown/dropdownpanelfocusable.d.ts +21 -0
- package/src/dropdown/dropdownpanelview.d.ts +62 -0
- package/src/dropdown/dropdownpanelview.js +2 -30
- package/src/dropdown/dropdownview.d.ts +315 -0
- package/src/dropdown/dropdownview.js +121 -222
- package/src/dropdown/utils.d.ts +219 -0
- package/src/dropdown/utils.js +112 -106
- package/src/editableui/editableuiview.d.ts +71 -0
- package/src/editableui/editableuiview.js +14 -43
- package/src/editableui/inline/inlineeditableuiview.d.ts +40 -0
- package/src/editableui/inline/inlineeditableuiview.js +5 -15
- package/src/editorui/bodycollection.d.ts +51 -0
- package/src/editorui/bodycollection.js +2 -16
- package/src/editorui/boxed/boxededitoruiview.d.ts +40 -0
- package/src/editorui/boxed/boxededitoruiview.js +1 -27
- package/src/editorui/editorui.d.ts +264 -0
- package/src/editorui/editorui.js +21 -128
- package/src/editorui/editoruiview.d.ts +39 -0
- package/src/editorui/editoruiview.js +1 -10
- package/src/focuscycler.d.ts +183 -0
- package/src/focuscycler.js +34 -90
- package/src/formheader/formheaderview.d.ts +53 -0
- package/src/formheader/formheaderview.js +3 -24
- package/src/icon/iconview.d.ts +78 -0
- package/src/icon/iconview.js +0 -50
- package/src/iframe/iframeview.d.ts +50 -0
- package/src/iframe/iframeview.js +2 -2
- package/src/index.d.ts +54 -0
- package/src/index.js +1 -0
- package/src/input/inputview.d.ts +121 -0
- package/src/input/inputview.js +0 -82
- package/src/inputnumber/inputnumberview.d.ts +49 -0
- package/src/inputnumber/inputnumberview.js +5 -28
- package/src/inputtext/inputtextview.d.ts +18 -0
- package/src/inputtext/inputtextview.js +0 -2
- package/src/label/labelview.d.ts +36 -0
- package/src/label/labelview.js +0 -20
- package/src/labeledfield/labeledfieldview.d.ts +182 -0
- package/src/labeledfield/labeledfieldview.js +20 -126
- package/src/labeledfield/utils.d.ts +93 -0
- package/src/labeledfield/utils.js +24 -18
- package/src/labeledinput/labeledinputview.d.ts +125 -0
- package/src/labeledinput/labeledinputview.js +7 -90
- package/src/list/listitemview.d.ts +35 -0
- package/src/list/listitemview.js +0 -16
- package/src/list/listseparatorview.d.ts +18 -0
- package/src/list/listseparatorview.js +0 -2
- package/src/list/listview.d.ts +59 -0
- package/src/list/listview.js +0 -33
- package/src/model.d.ts +22 -0
- package/src/model.js +2 -4
- package/src/notification/notification.d.ts +216 -0
- package/src/notification/notification.js +64 -51
- package/src/panel/balloon/balloonpanelview.d.ts +685 -0
- package/src/panel/balloon/balloonpanelview.js +146 -168
- package/src/panel/balloon/contextualballoon.d.ts +240 -0
- package/src/panel/balloon/contextualballoon.js +41 -171
- package/src/panel/sticky/stickypanelview.d.ts +132 -0
- package/src/panel/sticky/stickypanelview.js +0 -115
- package/src/template.d.ts +940 -0
- package/src/template.js +396 -460
- package/src/toolbar/balloon/balloontoolbar.d.ts +124 -0
- package/src/toolbar/balloon/balloontoolbar.js +15 -81
- package/src/toolbar/block/blockbuttonview.d.ts +35 -0
- package/src/toolbar/block/blockbuttonview.js +1 -13
- package/src/toolbar/block/blocktoolbar.d.ts +159 -0
- package/src/toolbar/block/blocktoolbar.js +32 -69
- package/src/toolbar/normalizetoolbarconfig.d.ts +39 -0
- package/src/toolbar/normalizetoolbarconfig.js +12 -8
- package/src/toolbar/toolbarlinebreakview.d.ts +18 -0
- package/src/toolbar/toolbarlinebreakview.js +0 -2
- package/src/toolbar/toolbarseparatorview.d.ts +18 -0
- package/src/toolbar/toolbarseparatorview.js +0 -2
- package/src/toolbar/toolbarview.d.ts +241 -0
- package/src/toolbar/toolbarview.js +54 -305
- package/src/tooltipmanager.d.ts +180 -0
- package/src/tooltipmanager.js +47 -94
- package/src/uiconfig.d.ts +82 -0
- package/src/uiconfig.js +5 -0
- package/src/view.d.ts +422 -0
- package/src/view.js +182 -251
- package/src/viewcollection.d.ts +139 -0
- package/src/viewcollection.js +62 -56
package/src/icon/iconview.js
CHANGED
|
@@ -10,8 +10,6 @@ import View from '../view';
|
|
|
10
10
|
import '../../theme/components/icon/icon.css';
|
|
11
11
|
/**
|
|
12
12
|
* The icon view class.
|
|
13
|
-
*
|
|
14
|
-
* @extends module:ui/view~View
|
|
15
13
|
*/
|
|
16
14
|
export default class IconView extends View {
|
|
17
15
|
/**
|
|
@@ -20,50 +18,9 @@ export default class IconView extends View {
|
|
|
20
18
|
constructor() {
|
|
21
19
|
super();
|
|
22
20
|
const bind = this.bindTemplate;
|
|
23
|
-
/**
|
|
24
|
-
* The SVG source of the icon.
|
|
25
|
-
*
|
|
26
|
-
* @observable
|
|
27
|
-
* @member {String} #content
|
|
28
|
-
*/
|
|
29
21
|
this.set('content', '');
|
|
30
|
-
/**
|
|
31
|
-
* This attribute specifies the boundaries to which the
|
|
32
|
-
* icon content should stretch.
|
|
33
|
-
*
|
|
34
|
-
* @observable
|
|
35
|
-
* @default '0 0 20 20'
|
|
36
|
-
* @member {String} #viewBox
|
|
37
|
-
*/
|
|
38
22
|
this.set('viewBox', '0 0 20 20');
|
|
39
|
-
/**
|
|
40
|
-
* The fill color of the child `path.ck-icon__fill`.
|
|
41
|
-
*
|
|
42
|
-
* @observable
|
|
43
|
-
* @default ''
|
|
44
|
-
* @member {String} #fillColor
|
|
45
|
-
*/
|
|
46
23
|
this.set('fillColor', '');
|
|
47
|
-
/**
|
|
48
|
-
* When set true (default), all parts of the icon inherit the fill color from the CSS `color` property of the
|
|
49
|
-
* icon's DOM parent.
|
|
50
|
-
*
|
|
51
|
-
* This effectively makes the icon monochromatic and allows it to change its fill color dynamically, for instance,
|
|
52
|
-
* when a {@link module:ui/button/buttonview~ButtonView} displays an icon and it switches between different states
|
|
53
|
-
* (pushed, hovered, etc.) the icon will follow along.
|
|
54
|
-
*
|
|
55
|
-
* **Note**: For the monochromatic icon to render properly, it must be made up of shapes that can be filled
|
|
56
|
-
* with color instead of, for instance, paths with strokes. Be sure to use the *outline stroke* tool
|
|
57
|
-
* (the name could be different in your vector graphics editor) before exporting your icon. Also, remove any
|
|
58
|
-
* excess `fill="..."` attributes that could break the color inheritance.
|
|
59
|
-
*
|
|
60
|
-
* **Note**: If you want to preserve the original look of your icon and disable dynamic color inheritance,
|
|
61
|
-
* set this flag to `false`.
|
|
62
|
-
*
|
|
63
|
-
* @observable
|
|
64
|
-
* @default true
|
|
65
|
-
* @member {Boolean} #isColorInherited
|
|
66
|
-
*/
|
|
67
24
|
this.set('isColorInherited', true);
|
|
68
25
|
this.setTemplate({
|
|
69
26
|
tag: 'svg',
|
|
@@ -102,8 +59,6 @@ export default class IconView extends View {
|
|
|
102
59
|
}
|
|
103
60
|
/**
|
|
104
61
|
* Updates the {@link #element} with the value of {@link #content}.
|
|
105
|
-
*
|
|
106
|
-
* @private
|
|
107
62
|
*/
|
|
108
63
|
_updateXMLContent() {
|
|
109
64
|
if (this.content) {
|
|
@@ -130,8 +85,6 @@ export default class IconView extends View {
|
|
|
130
85
|
}
|
|
131
86
|
/**
|
|
132
87
|
* Fills all child `path.ck-icon__fill` with the `#fillColor`.
|
|
133
|
-
*
|
|
134
|
-
* @private
|
|
135
88
|
*/
|
|
136
89
|
_colorFillPaths() {
|
|
137
90
|
if (this.fillColor) {
|
|
@@ -146,9 +99,6 @@ export default class IconView extends View {
|
|
|
146
99
|
* when the icon {@link module:ui/icon/iconview~IconView#content content} is loaded.
|
|
147
100
|
*
|
|
148
101
|
* See the [specification](https://www.w3.org/TR/SVG/styling.html#TermPresentationAttribute) to learn more.
|
|
149
|
-
*
|
|
150
|
-
* @protected
|
|
151
|
-
* @member {Array.<String>} module:ui/icon/iconview~IconView.presentationalAttributeNames
|
|
152
102
|
*/
|
|
153
103
|
IconView.presentationalAttributeNames = [
|
|
154
104
|
'alignment-baseline', 'baseline-shift', 'clip-path', 'clip-rule', 'color', 'color-interpolation',
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/iframe/iframeview
|
|
7
|
+
*/
|
|
8
|
+
import View from '../view';
|
|
9
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
|
+
/**
|
|
11
|
+
* The iframe view class.
|
|
12
|
+
*
|
|
13
|
+
* ```ts
|
|
14
|
+
* const iframe = new IframeView();
|
|
15
|
+
*
|
|
16
|
+
* iframe.render();
|
|
17
|
+
* document.body.appendChild( iframe.element );
|
|
18
|
+
*
|
|
19
|
+
* iframe.on( 'loaded', () => {
|
|
20
|
+
* console.log( 'The iframe has loaded', iframe.element.contentWindow );
|
|
21
|
+
* } );
|
|
22
|
+
*
|
|
23
|
+
* iframe.element.src = 'https://ckeditor.com';
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export default class IframeView extends View<HTMLIFrameElement> {
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new instance of the iframe view.
|
|
29
|
+
*
|
|
30
|
+
* @param locale The locale instance.
|
|
31
|
+
*/
|
|
32
|
+
constructor(locale?: Locale);
|
|
33
|
+
/**
|
|
34
|
+
* Renders the iframe's {@link #element} and returns a `Promise` for asynchronous
|
|
35
|
+
* child `contentDocument` loading process.
|
|
36
|
+
*
|
|
37
|
+
* @returns A promise which resolves once the iframe `contentDocument` has
|
|
38
|
+
* been {@link #event:loaded}.
|
|
39
|
+
*/
|
|
40
|
+
render(): Promise<unknown>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Fired when the DOM iframe's `contentDocument` finished loading.
|
|
44
|
+
*
|
|
45
|
+
* @eventName loaded
|
|
46
|
+
*/
|
|
47
|
+
export type IframeViewLoadedEvent = {
|
|
48
|
+
name: 'loaded';
|
|
49
|
+
args: [];
|
|
50
|
+
};
|
package/src/iframe/iframeview.js
CHANGED
|
@@ -26,7 +26,7 @@ export default class IframeView extends View {
|
|
|
26
26
|
/**
|
|
27
27
|
* Creates a new instance of the iframe view.
|
|
28
28
|
*
|
|
29
|
-
* @param
|
|
29
|
+
* @param locale The locale instance.
|
|
30
30
|
*/
|
|
31
31
|
constructor(locale) {
|
|
32
32
|
super(locale);
|
|
@@ -51,7 +51,7 @@ export default class IframeView extends View {
|
|
|
51
51
|
* Renders the iframe's {@link #element} and returns a `Promise` for asynchronous
|
|
52
52
|
* child `contentDocument` loading process.
|
|
53
53
|
*
|
|
54
|
-
* @returns
|
|
54
|
+
* @returns A promise which resolves once the iframe `contentDocument` has
|
|
55
55
|
* been {@link #event:loaded}.
|
|
56
56
|
*/
|
|
57
57
|
render() {
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui
|
|
7
|
+
*/
|
|
8
|
+
export { default as clickOutsideHandler } from './bindings/clickoutsidehandler';
|
|
9
|
+
export { default as injectCssTransitionDisabler } from './bindings/injectcsstransitiondisabler';
|
|
10
|
+
export { default as CssTransitionDisablerMixin, type ViewWithCssTransitionDisabler } from './bindings/csstransitiondisablermixin';
|
|
11
|
+
export { default as submitHandler } from './bindings/submithandler';
|
|
12
|
+
export { default as addKeyboardHandlingForGrid } from './bindings/addkeyboardhandlingforgrid';
|
|
13
|
+
export { default as BodyCollection } from './editorui/bodycollection';
|
|
14
|
+
export { type ButtonExecuteEvent } from './button/button';
|
|
15
|
+
export { default as ButtonView } from './button/buttonview';
|
|
16
|
+
export { default as SwitchButtonView } from './button/switchbuttonview';
|
|
17
|
+
export * from './colorgrid/utils';
|
|
18
|
+
export { default as ColorGridView, type ColorDefinition } from './colorgrid/colorgridview';
|
|
19
|
+
export { default as ColorTileView } from './colorgrid/colortileview';
|
|
20
|
+
export { default as ComponentFactory } from './componentfactory';
|
|
21
|
+
export { default as DropdownView } from './dropdown/dropdownview';
|
|
22
|
+
export { default as DropdownButtonView } from './dropdown/button/dropdownbuttonview';
|
|
23
|
+
export { default as SplitButtonView } from './dropdown/button/splitbuttonview';
|
|
24
|
+
export * from './dropdown/utils';
|
|
25
|
+
export { default as EditorUI, type EditorUIReadyEvent, type EditorUIUpdateEvent } from './editorui/editorui';
|
|
26
|
+
export { default as EditorUIView } from './editorui/editoruiview';
|
|
27
|
+
export { default as BoxedEditorUIView } from './editorui/boxed/boxededitoruiview';
|
|
28
|
+
export { default as InlineEditableUIView } from './editableui/inline/inlineeditableuiview';
|
|
29
|
+
export { default as FormHeaderView } from './formheader/formheaderview';
|
|
30
|
+
export { default as FocusCycler, type FocusableView } from './focuscycler';
|
|
31
|
+
export { default as IconView } from './icon/iconview';
|
|
32
|
+
export { default as InputView } from './input/inputview';
|
|
33
|
+
export { default as InputTextView } from './inputtext/inputtextview';
|
|
34
|
+
export { default as InputNumberView } from './inputnumber/inputnumberview';
|
|
35
|
+
export { default as IframeView } from './iframe/iframeview';
|
|
36
|
+
export { default as LabelView } from './label/labelview';
|
|
37
|
+
export { default as LabeledFieldView } from './labeledfield/labeledfieldview';
|
|
38
|
+
export * from './labeledfield/utils';
|
|
39
|
+
export { default as ListItemView } from './list/listitemview';
|
|
40
|
+
export { default as ListView } from './list/listview';
|
|
41
|
+
export { default as Notification } from './notification/notification';
|
|
42
|
+
export { default as Model } from './model';
|
|
43
|
+
export { default as BalloonPanelView } from './panel/balloon/balloonpanelview';
|
|
44
|
+
export { default as ContextualBalloon } from './panel/balloon/contextualballoon';
|
|
45
|
+
export { default as StickyPanelView } from './panel/sticky/stickypanelview';
|
|
46
|
+
export { default as TooltipManager } from './tooltipmanager';
|
|
47
|
+
export { default as Template, type TemplateDefinition } from './template';
|
|
48
|
+
export { default as ToolbarView } from './toolbar/toolbarview';
|
|
49
|
+
export { default as ToolbarSeparatorView } from './toolbar/toolbarseparatorview';
|
|
50
|
+
export { default as normalizeToolbarConfig } from './toolbar/normalizetoolbarconfig';
|
|
51
|
+
export { default as BalloonToolbar, type BaloonToolbarShowEvent } from './toolbar/balloon/balloontoolbar';
|
|
52
|
+
export { default as BlockToolbar } from './toolbar/block/blocktoolbar';
|
|
53
|
+
export { default as View, type UIViewRenderEvent } from './view';
|
|
54
|
+
export { default as ViewCollection } from './viewcollection';
|
package/src/index.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { default as clickOutsideHandler } from './bindings/clickoutsidehandler';
|
|
9
9
|
export { default as injectCssTransitionDisabler } from './bindings/injectcsstransitiondisabler';
|
|
10
|
+
export { default as CssTransitionDisablerMixin } from './bindings/csstransitiondisablermixin';
|
|
10
11
|
export { default as submitHandler } from './bindings/submithandler';
|
|
11
12
|
export { default as addKeyboardHandlingForGrid } from './bindings/addkeyboardhandlingforgrid';
|
|
12
13
|
export { default as BodyCollection } from './editorui/bodycollection';
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/input/inputview
|
|
7
|
+
*/
|
|
8
|
+
import View from '../view';
|
|
9
|
+
import { FocusTracker, type Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
|
+
import '../../theme/components/input/input.css';
|
|
11
|
+
/**
|
|
12
|
+
* The base input view class.
|
|
13
|
+
*/
|
|
14
|
+
export default class InputView extends View<HTMLInputElement> {
|
|
15
|
+
/**
|
|
16
|
+
* Stores information about the editor UI focus and propagates it so various plugins and components
|
|
17
|
+
* are unified as a focus group.
|
|
18
|
+
*/
|
|
19
|
+
readonly focusTracker: FocusTracker;
|
|
20
|
+
/**
|
|
21
|
+
* The value of the input.
|
|
22
|
+
*
|
|
23
|
+
* @observable
|
|
24
|
+
*/
|
|
25
|
+
value: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The `id` attribute of the input (i.e. to pair with a `<label>` element).
|
|
28
|
+
*
|
|
29
|
+
* @observable
|
|
30
|
+
*/
|
|
31
|
+
id: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* The `placeholder` attribute of the input.
|
|
34
|
+
*
|
|
35
|
+
* @observable
|
|
36
|
+
*/
|
|
37
|
+
placeholder: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Controls whether the input view is in read-only mode.
|
|
40
|
+
*
|
|
41
|
+
* @observable
|
|
42
|
+
*/
|
|
43
|
+
isReadOnly: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Set to `true` when the field has some error. Usually controlled via
|
|
46
|
+
* {@link module:ui/labeledinput/labeledinputview~LabeledInputView#errorText}.
|
|
47
|
+
*
|
|
48
|
+
* @observable
|
|
49
|
+
*/
|
|
50
|
+
hasError: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The `id` of the element describing this field, e.g. when it has
|
|
53
|
+
* some error; it helps screen readers read the error text.
|
|
54
|
+
*
|
|
55
|
+
* @observable
|
|
56
|
+
*/
|
|
57
|
+
ariaDescribedById: string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* An observable flag set to `true` when the input is currently focused by the user.
|
|
60
|
+
* Set to `false` otherwise.
|
|
61
|
+
*
|
|
62
|
+
* @readonly
|
|
63
|
+
* @observable
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
isFocused: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* An observable flag set to `true` when the input contains no text, i.e.
|
|
69
|
+
* when {@link #value} is `''`, `null`, or `false`.
|
|
70
|
+
*
|
|
71
|
+
* @readonly
|
|
72
|
+
* @observable
|
|
73
|
+
* @default true
|
|
74
|
+
*/
|
|
75
|
+
isEmpty: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Corresponds to the `inputmode` DOM attribute. Can be `text`, `numeric`, `decimal`, etc.
|
|
78
|
+
*
|
|
79
|
+
* @observable
|
|
80
|
+
* @default 'text'
|
|
81
|
+
*/
|
|
82
|
+
inputMode: string;
|
|
83
|
+
/**
|
|
84
|
+
* @inheritDoc
|
|
85
|
+
*/
|
|
86
|
+
constructor(locale?: Locale);
|
|
87
|
+
/**
|
|
88
|
+
* @inheritDoc
|
|
89
|
+
*/
|
|
90
|
+
render(): void;
|
|
91
|
+
/**
|
|
92
|
+
* @inheritDoc
|
|
93
|
+
*/
|
|
94
|
+
destroy(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Moves the focus to the input and selects the value.
|
|
97
|
+
*/
|
|
98
|
+
select(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Focuses the input.
|
|
101
|
+
*/
|
|
102
|
+
focus(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Updates the {@link #isEmpty} property value on demand.
|
|
105
|
+
*/
|
|
106
|
+
private _updateIsEmpty;
|
|
107
|
+
/**
|
|
108
|
+
* Sets the `value` property of the {@link #element DOM element} on demand.
|
|
109
|
+
*/
|
|
110
|
+
private _setDomElementValue;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Fired when the user types in the input. Corresponds to the native
|
|
114
|
+
* DOM `input` event.
|
|
115
|
+
*
|
|
116
|
+
* @eventName input
|
|
117
|
+
*/
|
|
118
|
+
export type InputViewInputEvent = {
|
|
119
|
+
name: 'input';
|
|
120
|
+
args: [InputEvent];
|
|
121
|
+
};
|
package/src/input/inputview.js
CHANGED
|
@@ -10,8 +10,6 @@ import { FocusTracker } from '@ckeditor/ckeditor5-utils';
|
|
|
10
10
|
import '../../theme/components/input/input.css';
|
|
11
11
|
/**
|
|
12
12
|
* The base input view class.
|
|
13
|
-
*
|
|
14
|
-
* @extends module:ui/view~View
|
|
15
13
|
*/
|
|
16
14
|
export default class InputView extends View {
|
|
17
15
|
/**
|
|
@@ -19,85 +17,15 @@ export default class InputView extends View {
|
|
|
19
17
|
*/
|
|
20
18
|
constructor(locale) {
|
|
21
19
|
super(locale);
|
|
22
|
-
/**
|
|
23
|
-
* The value of the input.
|
|
24
|
-
*
|
|
25
|
-
* @observable
|
|
26
|
-
* @member {String} #value
|
|
27
|
-
*/
|
|
28
20
|
this.set('value', undefined);
|
|
29
|
-
/**
|
|
30
|
-
* The `id` attribute of the input (i.e. to pair with a `<label>` element).
|
|
31
|
-
*
|
|
32
|
-
* @observable
|
|
33
|
-
* @member {String} #id
|
|
34
|
-
*/
|
|
35
21
|
this.set('id', undefined);
|
|
36
|
-
/**
|
|
37
|
-
* The `placeholder` attribute of the input.
|
|
38
|
-
*
|
|
39
|
-
* @observable
|
|
40
|
-
* @member {String} #placeholder
|
|
41
|
-
*/
|
|
42
22
|
this.set('placeholder', undefined);
|
|
43
|
-
/**
|
|
44
|
-
* Controls whether the input view is in read-only mode.
|
|
45
|
-
*
|
|
46
|
-
* @observable
|
|
47
|
-
* @member {Boolean} #isReadOnly
|
|
48
|
-
*/
|
|
49
23
|
this.set('isReadOnly', false);
|
|
50
|
-
/**
|
|
51
|
-
* Set to `true` when the field has some error. Usually controlled via
|
|
52
|
-
* {@link module:ui/labeledinput/labeledinputview~LabeledInputView#errorText}.
|
|
53
|
-
*
|
|
54
|
-
* @observable
|
|
55
|
-
* @member {Boolean} #hasError
|
|
56
|
-
*/
|
|
57
24
|
this.set('hasError', false);
|
|
58
|
-
/**
|
|
59
|
-
* The `id` of the element describing this field, e.g. when it has
|
|
60
|
-
* some error; it helps screen readers read the error text.
|
|
61
|
-
*
|
|
62
|
-
* @observable
|
|
63
|
-
* @member {Boolean} #ariaDescribedById
|
|
64
|
-
*/
|
|
65
25
|
this.set('ariaDescribedById', undefined);
|
|
66
|
-
/**
|
|
67
|
-
* Stores information about the editor UI focus and propagates it so various plugins and components
|
|
68
|
-
* are unified as a focus group.
|
|
69
|
-
*
|
|
70
|
-
* @readonly
|
|
71
|
-
* @member {module:utils/focustracker~FocusTracker} #focusTracker
|
|
72
|
-
*/
|
|
73
26
|
this.focusTracker = new FocusTracker();
|
|
74
|
-
/**
|
|
75
|
-
* An observable flag set to `true` when the input is currently focused by the user.
|
|
76
|
-
* Set to `false` otherwise.
|
|
77
|
-
*
|
|
78
|
-
* @readonly
|
|
79
|
-
* @observable
|
|
80
|
-
* @member {Boolean} #isFocused
|
|
81
|
-
* @default false
|
|
82
|
-
*/
|
|
83
27
|
this.bind('isFocused').to(this.focusTracker);
|
|
84
|
-
/**
|
|
85
|
-
* An observable flag set to `true` when the input contains no text, i.e.
|
|
86
|
-
* when {@link #value} is `''`, `null`, or `false`.
|
|
87
|
-
*
|
|
88
|
-
* @readonly
|
|
89
|
-
* @observable
|
|
90
|
-
* @member {Boolean} #isEmpty
|
|
91
|
-
* @default true
|
|
92
|
-
*/
|
|
93
28
|
this.set('isEmpty', true);
|
|
94
|
-
/**
|
|
95
|
-
* Corresponds to the `inputmode` DOM attribute. Can be `text`, `numeric`, `decimal`, etc.
|
|
96
|
-
*
|
|
97
|
-
* @observable
|
|
98
|
-
* @member {Boolean} #inputMode
|
|
99
|
-
* @default 'text'
|
|
100
|
-
*/
|
|
101
29
|
this.set('inputMode', 'text');
|
|
102
30
|
const bind = this.bindTemplate;
|
|
103
31
|
this.setTemplate({
|
|
@@ -125,12 +53,6 @@ export default class InputView extends View {
|
|
|
125
53
|
change: bind.to(this._updateIsEmpty.bind(this))
|
|
126
54
|
}
|
|
127
55
|
});
|
|
128
|
-
/**
|
|
129
|
-
* Fired when the user types in the input. Corresponds to the native
|
|
130
|
-
* DOM `input` event.
|
|
131
|
-
*
|
|
132
|
-
* @event input
|
|
133
|
-
*/
|
|
134
56
|
}
|
|
135
57
|
/**
|
|
136
58
|
* @inheritDoc
|
|
@@ -168,16 +90,12 @@ export default class InputView extends View {
|
|
|
168
90
|
}
|
|
169
91
|
/**
|
|
170
92
|
* Updates the {@link #isEmpty} property value on demand.
|
|
171
|
-
*
|
|
172
|
-
* @private
|
|
173
93
|
*/
|
|
174
94
|
_updateIsEmpty() {
|
|
175
95
|
this.isEmpty = isInputElementEmpty(this.element);
|
|
176
96
|
}
|
|
177
97
|
/**
|
|
178
98
|
* Sets the `value` property of the {@link #element DOM element} on demand.
|
|
179
|
-
*
|
|
180
|
-
* @private
|
|
181
99
|
*/
|
|
182
100
|
_setDomElementValue(value) {
|
|
183
101
|
this.element.value = (!value && value !== 0) ? '' : value;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/inputnumber/inputnumberview
|
|
7
|
+
*/
|
|
8
|
+
import InputView from '../input/inputview';
|
|
9
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
|
+
/**
|
|
11
|
+
* The number input view class.
|
|
12
|
+
*/
|
|
13
|
+
export default class InputNumberView extends InputView {
|
|
14
|
+
/**
|
|
15
|
+
* The value of the `min` DOM attribute (the lowest accepted value) set on the {@link #element}.
|
|
16
|
+
*
|
|
17
|
+
* @observable
|
|
18
|
+
* @default undefined
|
|
19
|
+
*/
|
|
20
|
+
min: number | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The value of the `max` DOM attribute (the highest accepted value) set on the {@link #element}.
|
|
23
|
+
*
|
|
24
|
+
* @observable
|
|
25
|
+
* @default undefined
|
|
26
|
+
*/
|
|
27
|
+
max: number | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The value of the `step` DOM attribute set on the {@link #element}.
|
|
30
|
+
*
|
|
31
|
+
* @observable
|
|
32
|
+
* @default undefined
|
|
33
|
+
*/
|
|
34
|
+
step: number | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Creates an instance of the input number view.
|
|
37
|
+
*
|
|
38
|
+
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
39
|
+
* @param options The options of the input.
|
|
40
|
+
* @param options.min The value of the `min` DOM attribute (the lowest accepted value).
|
|
41
|
+
* @param options.max The value of the `max` DOM attribute (the highest accepted value).
|
|
42
|
+
* @param options.step The value of the `step` DOM attribute.
|
|
43
|
+
*/
|
|
44
|
+
constructor(locale?: Locale, { min, max, step }?: {
|
|
45
|
+
min?: number;
|
|
46
|
+
max?: number;
|
|
47
|
+
step?: number;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -8,45 +8,22 @@
|
|
|
8
8
|
import InputView from '../input/inputview';
|
|
9
9
|
/**
|
|
10
10
|
* The number input view class.
|
|
11
|
-
*
|
|
12
|
-
* @extends module:ui/input/inputview~InputView
|
|
13
11
|
*/
|
|
14
12
|
export default class InputNumberView extends InputView {
|
|
15
13
|
/**
|
|
16
14
|
* Creates an instance of the input number view.
|
|
17
15
|
*
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
16
|
+
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
17
|
+
* @param options The options of the input.
|
|
18
|
+
* @param options.min The value of the `min` DOM attribute (the lowest accepted value).
|
|
19
|
+
* @param options.max The value of the `max` DOM attribute (the highest accepted value).
|
|
20
|
+
* @param options.step The value of the `step` DOM attribute.
|
|
23
21
|
*/
|
|
24
22
|
constructor(locale, { min, max, step } = {}) {
|
|
25
23
|
super(locale);
|
|
26
24
|
const bind = this.bindTemplate;
|
|
27
|
-
/**
|
|
28
|
-
* The value of the `min` DOM attribute (the lowest accepted value) set on the {@link #element}.
|
|
29
|
-
*
|
|
30
|
-
* @observable
|
|
31
|
-
* @default undefined
|
|
32
|
-
* @member {Number} #min
|
|
33
|
-
*/
|
|
34
25
|
this.set('min', min);
|
|
35
|
-
/**
|
|
36
|
-
* The value of the `max` DOM attribute (the highest accepted value) set on the {@link #element}.
|
|
37
|
-
*
|
|
38
|
-
* @observable
|
|
39
|
-
* @default undefined
|
|
40
|
-
* @member {Number} #max
|
|
41
|
-
*/
|
|
42
26
|
this.set('max', max);
|
|
43
|
-
/**
|
|
44
|
-
* The value of the `step` DOM attribute set on the {@link #element}.
|
|
45
|
-
*
|
|
46
|
-
* @observable
|
|
47
|
-
* @default undefined
|
|
48
|
-
* @member {Number} #step
|
|
49
|
-
*/
|
|
50
27
|
this.set('step', step);
|
|
51
28
|
this.extendTemplate({
|
|
52
29
|
attributes: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/inputtext/inputtextview
|
|
7
|
+
*/
|
|
8
|
+
import InputView from '../input/inputview';
|
|
9
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
|
+
/**
|
|
11
|
+
* The text input view class.
|
|
12
|
+
*/
|
|
13
|
+
export default class InputTextView extends InputView {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
constructor(locale?: Locale);
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/label/labelview
|
|
7
|
+
*/
|
|
8
|
+
import View from '../view';
|
|
9
|
+
import { type Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
|
+
import '../../theme/components/label/label.css';
|
|
11
|
+
/**
|
|
12
|
+
* The label view class.
|
|
13
|
+
*/
|
|
14
|
+
export default class LabelView extends View {
|
|
15
|
+
/**
|
|
16
|
+
* An unique id of the label. It can be used by other UI components to reference
|
|
17
|
+
* the label, for instance, using the `aria-describedby` DOM attribute.
|
|
18
|
+
*/
|
|
19
|
+
readonly id: string;
|
|
20
|
+
/**
|
|
21
|
+
* The text of the label.
|
|
22
|
+
*
|
|
23
|
+
* @observable
|
|
24
|
+
*/
|
|
25
|
+
text: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The `for` attribute of the label (i.e. to pair with an `<input>` element).
|
|
28
|
+
*
|
|
29
|
+
* @observable
|
|
30
|
+
*/
|
|
31
|
+
for: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* @inheritDoc
|
|
34
|
+
*/
|
|
35
|
+
constructor(locale?: Locale);
|
|
36
|
+
}
|
package/src/label/labelview.js
CHANGED
|
@@ -10,8 +10,6 @@ import { uid } from '@ckeditor/ckeditor5-utils';
|
|
|
10
10
|
import '../../theme/components/label/label.css';
|
|
11
11
|
/**
|
|
12
12
|
* The label view class.
|
|
13
|
-
*
|
|
14
|
-
* @extends module:ui/view~View
|
|
15
13
|
*/
|
|
16
14
|
export default class LabelView extends View {
|
|
17
15
|
/**
|
|
@@ -19,26 +17,8 @@ export default class LabelView extends View {
|
|
|
19
17
|
*/
|
|
20
18
|
constructor(locale) {
|
|
21
19
|
super(locale);
|
|
22
|
-
/**
|
|
23
|
-
* The text of the label.
|
|
24
|
-
*
|
|
25
|
-
* @observable
|
|
26
|
-
* @member {String} #text
|
|
27
|
-
*/
|
|
28
20
|
this.set('text', undefined);
|
|
29
|
-
/**
|
|
30
|
-
* The `for` attribute of the label (i.e. to pair with an `<input>` element).
|
|
31
|
-
*
|
|
32
|
-
* @observable
|
|
33
|
-
* @member {String} #for
|
|
34
|
-
*/
|
|
35
21
|
this.set('for', undefined);
|
|
36
|
-
/**
|
|
37
|
-
* An unique id of the label. It can be used by other UI components to reference
|
|
38
|
-
* the label, for instance, using the `aria-describedby` DOM attribute.
|
|
39
|
-
*
|
|
40
|
-
* @member {String} #id
|
|
41
|
-
*/
|
|
42
22
|
this.id = `ck-editor__label_${uid()}`;
|
|
43
23
|
const bind = this.bindTemplate;
|
|
44
24
|
this.setTemplate({
|