@ember-eui/core 1.2.4 → 1.3.4
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/CHANGELOG.md +28 -1
- package/README.md +1 -1
- package/addon/components/common.ts +13 -0
- package/addon/components/eui-button/index.hbs +2 -0
- package/addon/components/eui-button-content/index.hbs +1 -0
- package/addon/components/eui-button-empty/index.hbs +2 -0
- package/addon/components/eui-button-icon/index.hbs +2 -0
- package/addon/components/eui-code/index.hbs +9 -0
- package/addon/components/eui-code-block/index.d.ts +2 -0
- package/addon/components/eui-code-block/index.hbs +10 -0
- package/addon/components/eui-code-block-impl/code-block-controls/index.hbs +33 -0
- package/addon/components/eui-code-block-impl/index.hbs +111 -0
- package/addon/components/eui-code-block-impl/index.ts +121 -0
- package/addon/components/eui-combo-box/index.hbs +3 -2
- package/addon/components/eui-combo-box/trigger/index.hbs +118 -112
- package/addon/components/eui-copy/index.hbs +8 -0
- package/addon/components/eui-copy/index.ts +37 -0
- package/addon/components/eui-icon/index.hbs +37 -32
- package/addon/components/eui-inner-text/index.hbs +1 -0
- package/addon/components/eui-inner-text/index.ts +61 -0
- package/addon/components/eui-markdown-editor/index.hbs +63 -0
- package/addon/components/eui-markdown-editor/index.ts +221 -0
- package/addon/components/eui-markdown-editor-drop-zone/index.hbs +21 -0
- package/addon/components/eui-markdown-editor-drop-zone/index.ts +5 -0
- package/addon/components/eui-markdown-editor-footer/index.hbs +108 -0
- package/addon/components/eui-markdown-editor-footer/index.ts +20 -0
- package/addon/components/eui-markdown-editor-text-area/index.hbs +8 -0
- package/addon/components/eui-markdown-editor-toolbar/index.hbs +86 -0
- package/addon/components/eui-markdown-editor-toolbar/index.ts +97 -0
- package/addon/components/eui-markdown-format/index.hbs +13 -0
- package/addon/components/eui-markdown-format/index.ts +45 -0
- package/addon/components/eui-markdown-format/markdown-checkbox/index.hbs +8 -0
- package/addon/components/eui-markdown-format/markdown-checkbox/index.ts +28 -0
- package/addon/components/eui-markdown-format/markdown-code/index.hbs +3 -0
- package/addon/components/eui-markdown-format/markdown-code-block/index.hbs +7 -0
- package/addon/components/eui-markdown-format/markdown-tooltip/index.hbs +8 -0
- package/addon/components/markdown-checkmark-icon/index.hbs +0 -0
- package/addon/modifiers/get-cursor-node.ts +54 -0
- package/addon/modifiers/resize-observer.ts +6 -2
- package/addon/utils/copy-to-clipboard.ts +70 -0
- package/addon/utils/css-mappings/eui-code-block-impl.ts +24 -0
- package/addon/utils/css-mappings/index.ts +2 -0
- package/addon/utils/markdown/markdown-actions.ts +616 -0
- package/addon/utils/markdown/markdown-modes.ts +23 -0
- package/addon/utils/markdown/markdown-types.ts +140 -0
- package/addon/utils/markdown/markdown-unified-plugins.d.ts +27 -0
- package/addon/utils/markdown/plugins/markdown-add-components.ts +63 -0
- package/addon/utils/markdown/plugins/markdown-checkbox.ts +80 -0
- package/addon/utils/markdown/plugins/markdown-default-plugins.ts +100 -0
- package/addon/utils/markdown/plugins/markdown-tooltip.ts +113 -0
- package/addon/utils/markdown/plugins/to-dom.ts +93 -0
- package/app/components/eui-code/index.js +1 -0
- package/app/components/eui-code-block/index.js +1 -0
- package/app/components/eui-code-block-impl/code-block-controls/index.js +1 -0
- package/app/components/eui-code-block-impl/index.js +1 -0
- package/app/components/eui-copy/index.js +1 -0
- package/app/components/eui-inner-text/index.js +1 -0
- package/app/components/eui-markdown-editor/index.js +1 -0
- package/app/components/eui-markdown-editor-drop-zone/index.js +1 -0
- package/app/components/eui-markdown-editor-footer/index.js +1 -0
- package/app/components/eui-markdown-editor-text-area/index.js +1 -0
- package/app/components/eui-markdown-editor-toolbar/index.js +1 -0
- package/app/components/eui-markdown-format/index.js +1 -0
- package/app/components/eui-markdown-format/markdown-checkbox/index.js +1 -0
- package/app/components/eui-markdown-format/markdown-code/index.js +1 -0
- package/app/components/eui-markdown-format/markdown-code-block/index.js +1 -0
- package/app/components/eui-markdown-format/markdown-tooltip/index.js +1 -0
- package/app/modifiers/get-cursor-node.js +1 -0
- package/app/styles/ember-eui.scss +13 -0
- package/docs/editors/code/code-block-demo/demo1.md +62 -0
- package/docs/editors/code/code-block.md +1 -0
- package/docs/editors/code/inline-demo/demo1.md +49 -0
- package/docs/editors/code/inline.md +1 -0
- package/docs/editors/markdown-editor/base-editor-demo/demo1.md +86 -0
- package/docs/editors/markdown-editor/base-editor.md +1 -0
- package/package.json +17 -4
- package/public/markdown-checkmark.svg +3 -0
- package/public/markdown-logo.svg +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,15 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
### Master
|
|
4
4
|
|
|
5
|
+
### 1.3.4
|
|
6
|
+
🐛 Bug / Fixes
|
|
7
|
+
- Fix docs related to ember-svg-jar and netlify demo
|
|
8
|
+
|
|
9
|
+
### 1.3.0 - 1.3.3
|
|
10
|
+
🐛 Bug / Fixes
|
|
11
|
+
- Ts bugs
|
|
12
|
+
|
|
13
|
+
### 1.3.0
|
|
14
|
+
🚀 Enhancements
|
|
15
|
+
`@ember-eui/core`
|
|
16
|
+
- `<EuiMarkdownEditor />` `<EuiMarkdownFormat />` `<EuiCode />` `<EuiCopy />` `<EuiCodeBlock />`
|
|
17
|
+
|
|
18
|
+
`@ember-eui/validated-form`
|
|
19
|
+
- `<Form.FieldMarkdownEditor />`
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### 1.2.6
|
|
23
|
+
🐛 Bug / Fixes
|
|
24
|
+
- Update ember-svg-jar dependency
|
|
25
|
+
|
|
26
|
+
### 1.2.5
|
|
27
|
+
🐛 Bug / Fixes
|
|
28
|
+
`@ember-eui/core`
|
|
29
|
+
- Fix `<EuiComboBox/>` isClereable
|
|
30
|
+
|
|
5
31
|
### 1.2.4
|
|
6
32
|
🏠 Internal
|
|
7
33
|
`@ember-eui/changeset-form`,`@ember-eui/validated-form`
|
|
8
|
-
- Pass down isCleareable to wrapped
|
|
34
|
+
- Pass down isCleareable to <EuiComboBox /> wrapped components
|
|
9
35
|
|
|
10
36
|
### 1.2.3
|
|
11
37
|
🚀 Enhancements
|
|
12
38
|
`@ember-eui/core`
|
|
13
39
|
- add errorMessage for validatable-control for i18n or so
|
|
40
|
+
|
|
14
41
|
🏠 Internal
|
|
15
42
|
`@ember-eui/core`
|
|
16
43
|
- update ember-power-select in order to be able to pass attributes to trigger
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ For icons to work you will need to:
|
|
|
9
9
|
- install `ember-svg-jar`
|
|
10
10
|
- add the following `ember-svg-jar` options to your `ember-cli-build.js`:
|
|
11
11
|
- NOTICE: we are currently using a fork from ember-svg-jar, for the hbs strategy
|
|
12
|
-
`"ember-svg-jar": "github
|
|
12
|
+
`"ember-svg-jar": "https://github.com/betocantu93/ember-svg-jar.git#add-bundle-flag"`
|
|
13
13
|
|
|
14
14
|
```javascript
|
|
15
15
|
// ember-cli-build.js
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
// utility types:
|
|
2
|
+
/**
|
|
3
|
+
* XOR for some properties applied to a type
|
|
4
|
+
* (XOR is one of these but not both or neither)
|
|
5
|
+
*
|
|
6
|
+
* Usage: OneOf<typeToExtend, one | but | not | multiple | of | these | are | required>
|
|
7
|
+
*
|
|
8
|
+
* To require aria-label or aria-labelledby but not both
|
|
9
|
+
* Example: OneOf<Type, 'aria-label' | 'aria-labelledby'>
|
|
10
|
+
*/
|
|
11
|
+
export type OneOf<T, K extends keyof T> = Omit<T, K> &
|
|
12
|
+
{ [k in K]: Pick<Required<T>, k> & { [k1 in Exclude<K, k>]?: never } }[K];
|
|
13
|
+
|
|
1
14
|
export interface CommonArgs {
|
|
2
15
|
'aria-label'?: string;
|
|
3
16
|
'data-test-subj'?: string;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
@iconType={{@iconType}}
|
|
21
21
|
@iconSide={{@iconSide}}
|
|
22
22
|
@iconClasses={{@iconClasses}}
|
|
23
|
+
@useSvg={{@useSvg}}
|
|
23
24
|
@textClasses={{class-names "euiButton__text" @textClasses}}
|
|
24
25
|
>
|
|
25
26
|
{{yield}}
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
@iconType={{@iconType}}
|
|
47
48
|
@iconSide={{@iconSide}}
|
|
48
49
|
@iconClasses={{@iconClasses}}
|
|
50
|
+
@useSvg={{@useSvg}}
|
|
49
51
|
@textClasses={{class-names "euiButton__text" @textClasses}}
|
|
50
52
|
>
|
|
51
53
|
{{yield}}
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
@iconType={{@iconType}}
|
|
18
18
|
@iconSide={{@iconSide}}
|
|
19
19
|
@iconClasses={{@iconClasses}}
|
|
20
|
+
@useSvg={{@useSvg}}
|
|
20
21
|
@textClasses={{class-names "euiButtonEmpty__text" @textClasses}}
|
|
21
22
|
>
|
|
22
23
|
{{yield}}
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
@iconType={{@iconType}}
|
|
43
44
|
@iconSide={{@iconSide}}
|
|
44
45
|
@iconClasses={{@iconClasses}}
|
|
46
|
+
@useSvg={{@useSvg}}
|
|
45
47
|
@textClasses={{class-names "euiButtonEmpty__text" @textClasses}}
|
|
46
48
|
>
|
|
47
49
|
{{yield}}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
class="euiButtonIcon__icon {{@iconClasses}}"
|
|
11
11
|
@type={{@iconType}}
|
|
12
12
|
@size={{arg-or-default @iconSize "m"}}
|
|
13
|
+
@useSvg={{@useSvg}}
|
|
13
14
|
aria-hidden="true"
|
|
14
15
|
/>
|
|
15
16
|
{{/if}}
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
class="euiButtonIcon__icon {{@iconClasses}}"
|
|
28
29
|
@type={{@iconType}}
|
|
29
30
|
@size={{@iconSize}}
|
|
31
|
+
@useSvg={{@useSvg}}
|
|
30
32
|
aria-hidden="true"
|
|
31
33
|
/>
|
|
32
34
|
{{/if}}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{{#if (or (and @isCopyable @innerText) @overflowHeight)}}
|
|
2
|
+
<div class="euiCodeBlock__controls">
|
|
3
|
+
{{#if @overflowHeight}}
|
|
4
|
+
<EuiButtonIcon
|
|
5
|
+
class="euiCodeBlock__fullScreenButton"
|
|
6
|
+
@size="s"
|
|
7
|
+
{{on "click" @toggleFullScreen}}
|
|
8
|
+
@iconType={{if @isFullScreen "cross" "fullScreen"}}
|
|
9
|
+
@color="text"
|
|
10
|
+
aria-label={{if @isFullScreen "Collapse" "Expand"}}
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
{{/if}}
|
|
14
|
+
{{#if (and @isCopyable @innerText)}}
|
|
15
|
+
<div class="euiCodeBlock__copyButton">
|
|
16
|
+
<EuiCopy
|
|
17
|
+
@textToCopy={{@innerText}}
|
|
18
|
+
@beforeMessage="Copy"
|
|
19
|
+
@afterMessage="Copied"
|
|
20
|
+
as |copy|
|
|
21
|
+
>
|
|
22
|
+
<EuiButtonIcon
|
|
23
|
+
@size="s"
|
|
24
|
+
{{on "click" copy}}
|
|
25
|
+
@iconType="copy"
|
|
26
|
+
@color="text"
|
|
27
|
+
aria-label="Copy"
|
|
28
|
+
/>
|
|
29
|
+
</EuiCopy>
|
|
30
|
+
</div>
|
|
31
|
+
{{/if}}
|
|
32
|
+
</div>
|
|
33
|
+
{{/if}}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{{#let
|
|
2
|
+
(class-names
|
|
3
|
+
"euiCodeBlock__pre"
|
|
4
|
+
(if (eq this.whiteSpace "pre") "euiCodeBlock__pre--whiteSpacePre")
|
|
5
|
+
(if (eq this.whiteSpace "pre-wrap") "euiCodeBlock__pre--whiteSpacePreWrap")
|
|
6
|
+
)
|
|
7
|
+
(class-names "euiCodeBlock__code" @language)
|
|
8
|
+
(class-names
|
|
9
|
+
"euiCodeBlock"
|
|
10
|
+
(if this.transparentBackground "euiCodeBlock--transparentBackground")
|
|
11
|
+
(if @inline "euiCodeBlock--inline")
|
|
12
|
+
(if (or @isCopyable @overflowHeight) "euiCodeBlock--hasControls")
|
|
13
|
+
componentName="EuiCodeBlockImpl"
|
|
14
|
+
paddingSize=this.paddingSize
|
|
15
|
+
fontSize=this.fontSize
|
|
16
|
+
)
|
|
17
|
+
as |preClasses codeClasses classes|
|
|
18
|
+
}}
|
|
19
|
+
{{#if @inline}}
|
|
20
|
+
{{#if this.isPortalTargetReady}}
|
|
21
|
+
{{#in-element this.codeTarget}}
|
|
22
|
+
{{yield}}
|
|
23
|
+
{{/in-element}}
|
|
24
|
+
<span
|
|
25
|
+
class={{classes}}
|
|
26
|
+
{{style (if @overflowHeight (hash maxHeight=@overflowHeight))}}
|
|
27
|
+
><code
|
|
28
|
+
{{did-insert (set this "code")}}
|
|
29
|
+
class={{codeClasses}}
|
|
30
|
+
></code></span>
|
|
31
|
+
{{/if}}
|
|
32
|
+
{{else}}
|
|
33
|
+
{{! Not inline }}
|
|
34
|
+
{{#if this.isPortalTargetReady}}
|
|
35
|
+
{{#in-element this.codeTarget}}
|
|
36
|
+
{{yield}}
|
|
37
|
+
{{/in-element}}
|
|
38
|
+
<EuiInnerText @fallback="" as |setRef innerText|>
|
|
39
|
+
<div
|
|
40
|
+
class={{classes}}
|
|
41
|
+
{{style (if @overflowHeight (hash maxHeight=@overflowHeight))}}
|
|
42
|
+
>
|
|
43
|
+
<pre
|
|
44
|
+
{{did-insert setRef}}
|
|
45
|
+
class={{preClasses}}
|
|
46
|
+
{{style (if @overflowHeight (hash maxHeight=@overflowHeight))}}
|
|
47
|
+
><code
|
|
48
|
+
{{did-insert (set this "code")}}
|
|
49
|
+
class={{codeClasses}}
|
|
50
|
+
></code></pre>
|
|
51
|
+
|
|
52
|
+
<EuiCodeBlockImpl::CodeBlockControls
|
|
53
|
+
@innerText={{innerText}}
|
|
54
|
+
@isCopyable={{@isCopyable}}
|
|
55
|
+
@overflowHeight={{@overflowHeight}}
|
|
56
|
+
@toggleFullScreen={{set this "isFullScreen" (not this.isFullScreen)}}
|
|
57
|
+
@isFullScreen={{this.isFullScreen}}
|
|
58
|
+
/>
|
|
59
|
+
|
|
60
|
+
{{#if this.isFullScreen}}
|
|
61
|
+
<EuiOverlayMask>
|
|
62
|
+
<div
|
|
63
|
+
{{focus-trap
|
|
64
|
+
isActive=true
|
|
65
|
+
focusTrapOptions=(hash
|
|
66
|
+
clickOutsideDeactivates=true returnFocusOnDeactivate=true
|
|
67
|
+
)
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
<div
|
|
71
|
+
class={{class-names
|
|
72
|
+
"euiCodeBlock euiCodeBlock-paddingLarge euiCodeBlock-isFullScreen"
|
|
73
|
+
fontSize=this.fontSize
|
|
74
|
+
componentName="EuiCodeBlockImpl"
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<pre class={{preClasses}}>
|
|
78
|
+
{{!template-lint-disable}}
|
|
79
|
+
<code
|
|
80
|
+
{{did-insert
|
|
81
|
+
(queue (set this "codeFullScreen") this.update)
|
|
82
|
+
}}
|
|
83
|
+
{{will-destroy (set this "codeFullScreen" null)}}
|
|
84
|
+
{{did-update this.update @language}}
|
|
85
|
+
class={{codeClasses}}
|
|
86
|
+
tabIndex={{0}}
|
|
87
|
+
tabIndex={{0}}
|
|
88
|
+
{{on "keydown" this.onKeyDown}}
|
|
89
|
+
></code>
|
|
90
|
+
{{!template-lint-enable}}
|
|
91
|
+
</pre>
|
|
92
|
+
<EuiCodeBlockImpl::CodeBlockControls
|
|
93
|
+
@innerText={{innerText}}
|
|
94
|
+
@isCopyable={{@isCopyable}}
|
|
95
|
+
@overflowHeight={{@overflowHeight}}
|
|
96
|
+
@toggleFullScreen={{set
|
|
97
|
+
this
|
|
98
|
+
"isFullScreen"
|
|
99
|
+
(not this.isFullScreen)
|
|
100
|
+
}}
|
|
101
|
+
@isFullScreen={{this.isFullScreen}}
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</EuiOverlayMask>
|
|
106
|
+
{{/if}}
|
|
107
|
+
</div>
|
|
108
|
+
</EuiInnerText>
|
|
109
|
+
{{/if}}
|
|
110
|
+
{{/if}}
|
|
111
|
+
{{/let}}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
import { argOrDefaultDecorator as argOrDefault } from '../../helpers/arg-or-default';
|
|
5
|
+
import { PaddingSize, FontSize } from '../eui-code-block';
|
|
6
|
+
//@ts-ignore
|
|
7
|
+
import hljs from 'highlight.js';
|
|
8
|
+
import { keys } from '../../utils/keys';
|
|
9
|
+
import { scheduleOnce } from '@ember/runloop';
|
|
10
|
+
|
|
11
|
+
type EuiCodeImplArgs = {
|
|
12
|
+
fontSize?: FontSize;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Displays the passed code in an inline format. Also removes any margins set.
|
|
16
|
+
*/
|
|
17
|
+
inline?: boolean;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Displays an icon button to copy the code snippet to the clipboard.
|
|
21
|
+
*/
|
|
22
|
+
isCopyable?: boolean;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Sets the syntax highlighting for a specific language
|
|
26
|
+
*/
|
|
27
|
+
language?: string;
|
|
28
|
+
overflowHeight?: number;
|
|
29
|
+
paddingSize?: PaddingSize;
|
|
30
|
+
transparentBackground?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Specify how `white-space` inside the element is handled.
|
|
33
|
+
* `pre` respects line breaks/white space but doesn't force them to wrap the line
|
|
34
|
+
* `pre-wrap` respects line breaks/white space but does force them to wrap the line when necessary.
|
|
35
|
+
*/
|
|
36
|
+
whiteSpace?: 'pre' | 'pre-wrap';
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default class EuiAccordionAccordionComponent extends Component<EuiCodeImplArgs> {
|
|
40
|
+
// Defaults
|
|
41
|
+
@argOrDefault(false) declare transparentBackground: boolean;
|
|
42
|
+
@argOrDefault('l') declare paddingSize: string;
|
|
43
|
+
@argOrDefault('s') declare fontSize: string;
|
|
44
|
+
@argOrDefault(false) declare isCopyable: boolean;
|
|
45
|
+
@argOrDefault('pre-wrap') declare whiteSpace: string;
|
|
46
|
+
|
|
47
|
+
@tracked isFullScreen: boolean = false;
|
|
48
|
+
@tracked isPortalTargetReady: boolean = false;
|
|
49
|
+
@tracked codeTarget: HTMLDivElement | null = null;
|
|
50
|
+
@tracked code: HTMLElement | null = null;
|
|
51
|
+
@tracked codeFullScreen: HTMLElement | null = null;
|
|
52
|
+
|
|
53
|
+
observer: MutationObserver | null = null;
|
|
54
|
+
|
|
55
|
+
constructor(owner: unknown, args: EuiCodeImplArgs) {
|
|
56
|
+
super(owner, args);
|
|
57
|
+
this.codeTarget = document.createElement('div');
|
|
58
|
+
this.isPortalTargetReady = true;
|
|
59
|
+
this.setupObserver();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setupObserver() {
|
|
63
|
+
this.observer?.disconnect();
|
|
64
|
+
this.observer = new MutationObserver((mutationsList) => {
|
|
65
|
+
if (mutationsList.length) this.update();
|
|
66
|
+
});
|
|
67
|
+
if (this.codeTarget) {
|
|
68
|
+
this.update();
|
|
69
|
+
this.observer.observe(this.codeTarget, {
|
|
70
|
+
characterData: true,
|
|
71
|
+
subtree: true,
|
|
72
|
+
childList: true
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
willDestroy(): void {
|
|
78
|
+
this.observer?.disconnect();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@action
|
|
82
|
+
update() {
|
|
83
|
+
const render = () => {
|
|
84
|
+
const language = this.args.language;
|
|
85
|
+
const html = (
|
|
86
|
+
this.isPortalTargetReady && this.codeTarget?.innerHTML
|
|
87
|
+
? this.codeTarget.innerHTML
|
|
88
|
+
: ''
|
|
89
|
+
).trim();
|
|
90
|
+
|
|
91
|
+
const code = this.code;
|
|
92
|
+
|
|
93
|
+
if (code) {
|
|
94
|
+
code.innerHTML = html;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (language) {
|
|
98
|
+
if (code) {
|
|
99
|
+
hljs.highlightBlock(code);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (this.codeFullScreen) {
|
|
104
|
+
this.codeFullScreen.innerHTML = html;
|
|
105
|
+
if (language) {
|
|
106
|
+
hljs.highlightBlock(this.codeFullScreen);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
scheduleOnce('afterRender', this, render);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@action
|
|
114
|
+
onKeyDown(event: KeyboardEvent): void {
|
|
115
|
+
if (event.key === keys.ESCAPE) {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
this.isFullScreen = false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
onCreateOption=(if
|
|
28
28
|
@onCreateOption (pipe this.onCreateOption @onCreateOption)
|
|
29
29
|
)
|
|
30
|
+
isClearable=@isClearable
|
|
30
31
|
}}
|
|
31
32
|
@matcher={{@matcher}}
|
|
32
33
|
@initiallyOpen={{@initiallyOpen}}
|
|
@@ -81,8 +82,8 @@
|
|
|
81
82
|
)
|
|
82
83
|
(component "eui-combo-box/no-matches-message")
|
|
83
84
|
}}
|
|
84
|
-
@dropdownClass="euiComboBoxOptionsList euiPanel euiPanel euiPanel--borderRadiusMedium euiPanel--noShadow euiPanel--plain euiPopover__panel-isAttached euiPopover__panel-noArrow euiPopover__panel--bottom euiPopover__panel-isOpen euiComboBoxOptionsList__rowWrap
|
|
85
|
-
|
|
85
|
+
@dropdownClass="euiComboBoxOptionsList euiPanel euiPanel euiPanel--borderRadiusMedium euiPanel--noShadow euiPanel--plain euiPopover__panel-isAttached euiPopover__panel-noArrow euiPopover__panel--bottom euiPopover__panel-isOpen euiComboBoxOptionsList__rowWrap {{@dropdownClass}}"
|
|
86
|
+
as |option i|
|
|
86
87
|
>
|
|
87
88
|
{{yield option i}}
|
|
88
89
|
</PowerSelectMultiple>
|
|
@@ -1,115 +1,121 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
opt.disabled
|
|
46
|
-
"ember-power-select-multiple-option--disabled"
|
|
47
|
-
}}"
|
|
48
|
-
@option={{opt}}
|
|
49
|
-
@onClose={{if
|
|
50
|
-
(or @select.disabled @singleSelection)
|
|
51
|
-
false
|
|
52
|
-
(if @onClose (fn (optional @onClose) opt) true)
|
|
1
|
+
{{#let (arg-or-default @isClearable true) as |isClearable|}}
|
|
2
|
+
<EuiFormControlLayout
|
|
3
|
+
@icon="arrowDown"
|
|
4
|
+
@iconSide="right"
|
|
5
|
+
@fullWidth={{@fullWidth}}
|
|
6
|
+
@compressed={{@compressed}}
|
|
7
|
+
@readOnly={{@readOnly}}
|
|
8
|
+
@clear={{if
|
|
9
|
+
(and @select.selected isClearable)
|
|
10
|
+
(fn @select.actions.select (array))
|
|
11
|
+
}}
|
|
12
|
+
@disabled={{@select.disabled}}
|
|
13
|
+
>
|
|
14
|
+
<:field>
|
|
15
|
+
{{! template-lint-disable }}
|
|
16
|
+
<ul
|
|
17
|
+
id="ember-power-select-multiple-options-{{@select.uniqueId}}"
|
|
18
|
+
class={{class-names
|
|
19
|
+
"euiComboBox__inputWrap ember-power-select-multiple-options"
|
|
20
|
+
(if @compressed "euiComboBox__inputWrap--compressed")
|
|
21
|
+
(if @fullWidth "euiComboBox__inputWrap--fullWidth")
|
|
22
|
+
(if @singleSelection "euiComboBox__inputWrap--noWrap")
|
|
23
|
+
(if @isLoading "euiComboBox__inputWrap--isLoading")
|
|
24
|
+
(if isClearable "euiComboBox__inputWrap-isClearable")
|
|
25
|
+
}}
|
|
26
|
+
...attributes
|
|
27
|
+
{{did-update this.openChanged @select.isOpen}}
|
|
28
|
+
{{on "touchstart" this.chooseOption}}
|
|
29
|
+
{{on "mousedown" this.chooseOption}}
|
|
30
|
+
>
|
|
31
|
+
{{! template-lint-enable }}
|
|
32
|
+
{{#if
|
|
33
|
+
(or
|
|
34
|
+
(and @singleSelection (not @select.searchText))
|
|
35
|
+
(not @singleSelection)
|
|
36
|
+
)
|
|
37
|
+
}}
|
|
38
|
+
{{#each @select.selected as |opt idx|}}
|
|
39
|
+
{{#if @selectedItemComponent}}
|
|
40
|
+
{{component
|
|
41
|
+
@selectedItemComponent
|
|
42
|
+
extra=@extra
|
|
43
|
+
option=opt
|
|
44
|
+
select=@select
|
|
53
45
|
}}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
{{else}}
|
|
47
|
+
<EuiComboBoxPill
|
|
48
|
+
class="ember-power-select-multiple-option
|
|
49
|
+
{{if
|
|
50
|
+
opt.disabled
|
|
51
|
+
"ember-power-select-multiple-option--disabled"
|
|
52
|
+
}}"
|
|
53
|
+
@option={{opt}}
|
|
54
|
+
@onClose={{if
|
|
55
|
+
(or @select.disabled @singleSelection)
|
|
56
|
+
false
|
|
57
|
+
(if @onClose (fn (optional @onClose) opt) true)
|
|
58
|
+
}}
|
|
59
|
+
@dataSelectedIconIndex={{idx}}
|
|
60
|
+
@color={{opt.color}}
|
|
61
|
+
@asPlainText={{@singleSelection.asPlainText}}
|
|
62
|
+
>
|
|
63
|
+
{{yield opt @select}}
|
|
64
|
+
</EuiComboBoxPill>
|
|
65
|
+
{{/if}}
|
|
66
|
+
{{else if (and @placeholder (not @searchEnabled))}}
|
|
67
|
+
<span class="ember-power-select-placeholder">
|
|
68
|
+
{{@placeholder}}
|
|
69
|
+
</span>
|
|
70
|
+
{{/each}}
|
|
71
|
+
{{/if}}
|
|
72
|
+
{{#if @searchEnabled}}
|
|
73
|
+
{{! template-lint-disable }}
|
|
74
|
+
{{#if (and this.maybePlaceholder (not @select.searchText))}}
|
|
75
|
+
<p class="euiComboBoxPlaceholder">
|
|
76
|
+
{{this.maybePlaceholder}}
|
|
77
|
+
</p>
|
|
60
78
|
{{/if}}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
<div
|
|
80
|
+
class="euiComboBox__input"
|
|
81
|
+
style="font-size: 14px; display: inline-block; position: relative;"
|
|
82
|
+
>
|
|
83
|
+
<input
|
|
84
|
+
tabindex="-1"
|
|
85
|
+
style="opacity: 0px; width:0px; height:0px; position: absolute; top: 40%; border:solid 1px transparent !important; margin:0px !important;"
|
|
86
|
+
class="fake-input-for-html-form-validity"
|
|
87
|
+
{{validatable-control @isInvalid}}
|
|
88
|
+
/>
|
|
89
|
+
<input
|
|
90
|
+
class="ember-power-select-trigger-multiple-input euiComboBox__input"
|
|
91
|
+
autocomplete="off"
|
|
92
|
+
autocorrect="off"
|
|
93
|
+
autocapitalize="off"
|
|
94
|
+
spellcheck={{false}}
|
|
95
|
+
id="ember-power-select-trigger-multiple-input-{{@select.uniqueId}}"
|
|
96
|
+
value={{@select.searchText}}
|
|
97
|
+
aria-controls={{@listboxId}}
|
|
98
|
+
style={{this.triggerMultipleInputStyle}}
|
|
99
|
+
disabled={{@select.disabled}}
|
|
100
|
+
tabindex={{@tabindex}}
|
|
101
|
+
form="power-select-fake-form"
|
|
102
|
+
{{on "focus" @onFocus}}
|
|
103
|
+
{{on "blur" @onBlur}}
|
|
104
|
+
{{on "input" this.handleInput}}
|
|
105
|
+
{{on "keydown" this.handleKeydown}}
|
|
106
|
+
{{did-insert this.storeInputStyles}}
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
{{! template-lint-enable }}
|
|
110
|
+
{{else}}
|
|
111
|
+
{{! template-lint-disable }}
|
|
112
|
+
<div
|
|
113
|
+
class="euiComboBox__input"
|
|
114
|
+
style="font-size: 14px; display: inline-block;"
|
|
115
|
+
></div>
|
|
116
|
+
{{! template-lint-enable }}
|
|
73
117
|
{{/if}}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<input
|
|
79
|
-
tabindex="-1"
|
|
80
|
-
style="opacity: 0px; width:0px; height:0px; position: absolute; top: 40%; border:solid 1px transparent !important; margin:0px !important;"
|
|
81
|
-
class="fake-input-for-html-form-validity"
|
|
82
|
-
{{validatable-control @isInvalid}}
|
|
83
|
-
/>
|
|
84
|
-
<input
|
|
85
|
-
class="ember-power-select-trigger-multiple-input euiComboBox__input"
|
|
86
|
-
autocomplete="off"
|
|
87
|
-
autocorrect="off"
|
|
88
|
-
autocapitalize="off"
|
|
89
|
-
spellcheck={{false}}
|
|
90
|
-
id="ember-power-select-trigger-multiple-input-{{@select.uniqueId}}"
|
|
91
|
-
value={{@select.searchText}}
|
|
92
|
-
aria-controls={{@listboxId}}
|
|
93
|
-
style={{this.triggerMultipleInputStyle}}
|
|
94
|
-
disabled={{@select.disabled}}
|
|
95
|
-
tabindex={{@tabindex}}
|
|
96
|
-
form="power-select-fake-form"
|
|
97
|
-
{{on "focus" @onFocus}}
|
|
98
|
-
{{on "blur" @onBlur}}
|
|
99
|
-
{{on "input" this.handleInput}}
|
|
100
|
-
{{on "keydown" this.handleKeydown}}
|
|
101
|
-
{{did-insert this.storeInputStyles}}
|
|
102
|
-
/>
|
|
103
|
-
</div>
|
|
104
|
-
{{! template-lint-enable }}
|
|
105
|
-
{{else}}
|
|
106
|
-
{{! template-lint-disable }}
|
|
107
|
-
<div
|
|
108
|
-
class="euiComboBox__input"
|
|
109
|
-
style="font-size: 14px; display: inline-block;"
|
|
110
|
-
></div>
|
|
111
|
-
{{! template-lint-enable }}
|
|
112
|
-
{{/if}}
|
|
113
|
-
</ul>
|
|
114
|
-
</:field>
|
|
115
|
-
</EuiFormControlLayout>
|
|
118
|
+
</ul>
|
|
119
|
+
</:field>
|
|
120
|
+
</EuiFormControlLayout>
|
|
121
|
+
{{/let}}
|