@ember-eui/core 5.8.5 → 5.10.2
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/addon/components/eui-checkbox-group/index.hbs +8 -0
- package/addon/components/eui-combo-box/index.hbs +1 -1
- package/addon/components/eui-combo-box/options/index.hbs +1 -0
- package/addon/components/eui-dual-range/index.ts +2 -2
- package/addon/components/eui-field-text/index.hbs +1 -0
- package/addon/components/eui-global-toast-list/index.ts +1 -1
- package/addon/components/eui-i18n/index.ts +9 -41
- package/addon/components/eui-icon/index.ts +2 -2
- package/addon/components/eui-markdown-editor/index.ts +2 -2
- package/addon/components/eui-portal/index.ts +2 -2
- package/addon/components/eui-range/index.ts +2 -2
- package/addon/components/eui-super-date-picker/date-popover/absolute-tab.hbs +42 -0
- package/addon/components/eui-super-date-picker/date-popover/absolute-tab.ts +79 -0
- package/addon/components/eui-super-date-picker/date-popover/datetime-picker.hbs +125 -0
- package/addon/components/eui-super-date-picker/date-popover/datetime-picker.ts +258 -0
- package/addon/components/eui-super-date-picker/date-popover/eui-date-popover-button.hbs +49 -0
- package/addon/components/eui-super-date-picker/date-popover/eui-date-popover-button.ts +49 -0
- package/addon/components/eui-super-date-picker/date-popover/eui-date-popover-content.hbs +42 -0
- package/addon/components/eui-super-date-picker/date-popover/eui-date-popover-content.ts +73 -0
- package/addon/components/eui-super-date-picker/date-popover/now-tab.hbs +45 -0
- package/addon/components/eui-super-date-picker/date-popover/relative-tab.hbs +47 -0
- package/addon/components/eui-super-date-picker/date-popover/relative-tab.ts +89 -0
- package/addon/components/eui-super-date-picker/eui-date-picker-range.hbs +22 -0
- package/addon/components/eui-super-date-picker/eui-quick-select-popover/eui-commonly-used-time-ranges.hbs +42 -0
- package/addon/components/eui-super-date-picker/eui-quick-select-popover/eui-quick-select.hbs +154 -0
- package/addon/components/eui-super-date-picker/eui-quick-select-popover/eui-quick-select.ts +103 -0
- package/addon/components/eui-super-date-picker/eui-quick-select-popover/eui-recently-used.hbs +48 -0
- package/addon/components/eui-super-date-picker/eui-quick-select-popover/index.hbs +60 -0
- package/addon/components/eui-super-date-picker/eui-quick-select-popover/index.ts +34 -0
- package/addon/components/eui-super-date-picker/eui-super-update-button.hbs +43 -0
- package/addon/components/eui-super-date-picker/index.hbs +123 -0
- package/addon/components/eui-super-date-picker/index.ts +220 -0
- package/addon/components/eui-super-date-picker/types/global.d.ts +52 -0
- package/addon/components/eui-super-date-picker/utils/date-utils.ts +59 -0
- package/addon/components/eui-super-date-picker/utils/index.ts +181 -0
- package/addon/components/eui-super-date-picker/utils/pretty-duration.ts +131 -0
- package/addon/components/eui-super-date-picker/utils/quick-select.ts +75 -0
- package/addon/components/eui-super-date-picker/utils/time-options.ts +216 -0
- package/addon/components/eui-tool-tip/index.ts +2 -2
- package/addon/components/text-block/index.hbs +25 -21
- package/addon/{components/eui-i18n → i18n}/util.ts +1 -6
- package/addon/modifiers/outside-click-detector.ts +2 -2
- package/addon/services/eui-i18n.ts +89 -0
- package/addon/utils/markdown/markdown-unified-plugins.d.ts +0 -14
- package/app/components/eui-super-date-picker/date-popover/absolute-tab.js +1 -0
- package/app/components/eui-super-date-picker/date-popover/datetime-picker.js +1 -0
- package/app/components/eui-super-date-picker/date-popover/eui-date-popover-button.js +1 -0
- package/app/components/eui-super-date-picker/date-popover/eui-date-popover-content.js +1 -0
- package/app/components/eui-super-date-picker/date-popover/now-tab.js +1 -0
- package/app/components/eui-super-date-picker/date-popover/relative-tab.js +1 -0
- package/app/components/eui-super-date-picker/eui-date-picker-range.js +1 -0
- package/app/components/eui-super-date-picker/eui-quick-select-popover/eui-commonly-used-time-ranges.js +1 -0
- package/app/components/eui-super-date-picker/eui-quick-select-popover/eui-quick-select.js +1 -0
- package/app/components/eui-super-date-picker/eui-quick-select-popover/eui-recently-used.js +1 -0
- package/app/components/eui-super-date-picker/eui-quick-select-popover/index.js +1 -0
- package/app/components/eui-super-date-picker/eui-super-update-button.js +1 -0
- package/app/components/eui-super-date-picker/index.js +1 -0
- package/app/services/eui-i18n.js +1 -0
- package/docs/forms/super-date-picker/demo/d01-picker.md +90 -0
- package/docs/forms/super-date-picker/index.md +16 -0
- package/package.json +7 -3
- package/tsconfig.json +1 -0
- package/addon/helpers/unique-id.ts +0 -23
- package/addon/i18n/index.ts +0 -8
- package/app/helpers/unique-id.js +0 -1
- package/app/i18n/index.js +0 -1
- package/docs/templates/super-date-picker/demo/d01-update-button.md +0 -10
- package/docs/templates/super-date-picker/demo/d02-quick-select-panels.md +0 -10
- package/docs/templates/super-date-picker/demo/d03-sizing.md +0 -10
- package/docs/templates/super-date-picker/demo/d04-auto-refresh.md +0 -11
- package/docs/templates/super-date-picker/demo/d05-elastic-pattern-with-kql.md +0 -10
- package/docs/templates/super-date-picker/index.md +0 -12
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{{#let (unique-id) as |legendId|}}
|
|
2
|
+
<fieldset>
|
|
3
|
+
<EuiTitle
|
|
4
|
+
id={{legendId}}
|
|
5
|
+
@tagName="legend"
|
|
6
|
+
@size="xxxs"
|
|
7
|
+
>
|
|
8
|
+
<EuiI18n
|
|
9
|
+
@token="euiCommonlyUsedTimeRanges.legend"
|
|
10
|
+
@default="Commonly used"
|
|
11
|
+
as |Token|
|
|
12
|
+
>
|
|
13
|
+
<Token as |value|>
|
|
14
|
+
{{value}}
|
|
15
|
+
</Token>
|
|
16
|
+
</EuiI18n>
|
|
17
|
+
</EuiTitle>
|
|
18
|
+
<div class="euiQuickSelectPopover__section">
|
|
19
|
+
<EuiFlexGrid
|
|
20
|
+
aria-labelledby={{legendId}}
|
|
21
|
+
@gutterSize="s"
|
|
22
|
+
@columns="2"
|
|
23
|
+
@direction="column"
|
|
24
|
+
@responsive={{false}}
|
|
25
|
+
@tagName="ul"
|
|
26
|
+
>
|
|
27
|
+
{{#each @commonlyUsedRanges as |range|}}
|
|
28
|
+
<EuiFlexItem
|
|
29
|
+
class="euiQuickSelectPopover__sectionItem"
|
|
30
|
+
@tagName="li"
|
|
31
|
+
>
|
|
32
|
+
<EuiLink
|
|
33
|
+
{{on "click" (fn @applyTime (hash start=range.start end=range.end))}}
|
|
34
|
+
>
|
|
35
|
+
{{range.label}}
|
|
36
|
+
</EuiLink>
|
|
37
|
+
</EuiFlexItem>
|
|
38
|
+
{{/each}}
|
|
39
|
+
</EuiFlexGrid>
|
|
40
|
+
</div>
|
|
41
|
+
</fieldset>
|
|
42
|
+
{{/let}}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
{{#let (unique-id) as |legendId|}}
|
|
2
|
+
<fieldset>
|
|
3
|
+
{{!-- <EuiI18n
|
|
4
|
+
token="euiQuickSelect.legendText"
|
|
5
|
+
default="Quick select a time range"
|
|
6
|
+
>
|
|
7
|
+
{(legendText: string) => (
|
|
8
|
+
// Legend needs to be the first thing in a fieldset, but we want the visible title within the flex.
|
|
9
|
+
// So we hide it, but allow screen readers to see it
|
|
10
|
+
<EuiScreenReaderOnly>
|
|
11
|
+
<legend id={{legendId}} class="euiFormLabel">
|
|
12
|
+
{legendText}
|
|
13
|
+
</legend>
|
|
14
|
+
</EuiScreenReaderOnly>
|
|
15
|
+
)}
|
|
16
|
+
</EuiI18n> --}}
|
|
17
|
+
<EuiFlexGroup
|
|
18
|
+
@responsive={{false}}
|
|
19
|
+
@alignItems="center"
|
|
20
|
+
@justifyContent="spaceBetween"
|
|
21
|
+
@gutterSize="s"
|
|
22
|
+
>
|
|
23
|
+
<EuiFlexItem @grow={{false}}>
|
|
24
|
+
<EuiI18n
|
|
25
|
+
@token="euiQuickSelect.quickSelectTitle"
|
|
26
|
+
@default="Quick select"
|
|
27
|
+
as |Token|
|
|
28
|
+
>
|
|
29
|
+
<Token as |quickSelectTitle|>
|
|
30
|
+
<div aria-hidden class="euiFormLabel">
|
|
31
|
+
{{quickSelectTitle}}
|
|
32
|
+
</div>
|
|
33
|
+
</Token>
|
|
34
|
+
</EuiI18n>
|
|
35
|
+
</EuiFlexItem>
|
|
36
|
+
<EuiFlexItem @grow={{false}}>
|
|
37
|
+
<EuiFlexGroup @alignItems="center" @gutterSize="s" @responsive={{false}}>
|
|
38
|
+
<EuiFlexItem @grow={{false}}>
|
|
39
|
+
<EuiI18n
|
|
40
|
+
@token="euiQuickSelect.previousLabel"
|
|
41
|
+
@default="Previous time window"
|
|
42
|
+
as |Token|
|
|
43
|
+
>
|
|
44
|
+
<Token as |previousLabel|>
|
|
45
|
+
<EuiToolTip @content={{previousLabel}}>
|
|
46
|
+
<EuiButtonIcon
|
|
47
|
+
aria-label={{previousLabel}}
|
|
48
|
+
@iconType="arrowLeft"
|
|
49
|
+
{{on "click" this.stepBackward}}
|
|
50
|
+
/>
|
|
51
|
+
</EuiToolTip>
|
|
52
|
+
</Token>
|
|
53
|
+
</EuiI18n>
|
|
54
|
+
</EuiFlexItem>
|
|
55
|
+
<EuiFlexItem @grow={{false}}>
|
|
56
|
+
<EuiI18n
|
|
57
|
+
@token="euiQuickSelect.nextLabel"
|
|
58
|
+
@default="Next time window"
|
|
59
|
+
as |Token|
|
|
60
|
+
>
|
|
61
|
+
<Token as |nextLabel|>
|
|
62
|
+
<EuiToolTip @content={{nextLabel}}>
|
|
63
|
+
<EuiButtonIcon
|
|
64
|
+
aria-label={{nextLabel}}
|
|
65
|
+
@iconType="arrowRight"
|
|
66
|
+
{{on "click" this.stepForward}}
|
|
67
|
+
/>
|
|
68
|
+
</EuiToolTip>
|
|
69
|
+
</Token>
|
|
70
|
+
</EuiI18n>
|
|
71
|
+
</EuiFlexItem>
|
|
72
|
+
</EuiFlexGroup>
|
|
73
|
+
</EuiFlexItem>
|
|
74
|
+
</EuiFlexGroup>
|
|
75
|
+
<EuiSpacer @size="s" />
|
|
76
|
+
<EuiFlexGroup @gutterSize="s" @responsive={{false}}>
|
|
77
|
+
<EuiFlexItem>
|
|
78
|
+
<EuiI18n
|
|
79
|
+
@token="euiQuickSelect.tenseLabel"
|
|
80
|
+
@default="Time tense"
|
|
81
|
+
as |Token|
|
|
82
|
+
>
|
|
83
|
+
<Token as |tenseLabel|>
|
|
84
|
+
<EuiSelect
|
|
85
|
+
@compressed={{true}}
|
|
86
|
+
@onKeyDown={{this.handleKeyDown}}
|
|
87
|
+
aria-label={{tenseLabel}}
|
|
88
|
+
aria-describedby={{concat this.timeSelectionId " " legendId}}
|
|
89
|
+
@value={{this.timeTense}}
|
|
90
|
+
@options={{@timeOptions.timeTenseOptions}}
|
|
91
|
+
{{on "change" (pick "target.value" (set this "timeTense"))}}
|
|
92
|
+
/>
|
|
93
|
+
</Token>
|
|
94
|
+
</EuiI18n>
|
|
95
|
+
</EuiFlexItem>
|
|
96
|
+
<EuiFlexItem>
|
|
97
|
+
<EuiI18n
|
|
98
|
+
@token="euiQuickSelect.valueLabel"
|
|
99
|
+
@default="Time value"
|
|
100
|
+
as |Token|
|
|
101
|
+
>
|
|
102
|
+
<Token as |valueLabel|>
|
|
103
|
+
<EuiFieldNumber
|
|
104
|
+
@compressed={{true}}
|
|
105
|
+
@onKeyDown={{this.handleKeyDown}}
|
|
106
|
+
aria-describedby={{concat this.timeSelectionId " " legendId}}
|
|
107
|
+
aria-label={{valueLabel}}
|
|
108
|
+
@value={{this.timeValue}}
|
|
109
|
+
@onChange={{this.onTimeValueChange}}
|
|
110
|
+
/>
|
|
111
|
+
</Token>
|
|
112
|
+
</EuiI18n>
|
|
113
|
+
</EuiFlexItem>
|
|
114
|
+
<EuiFlexItem>
|
|
115
|
+
<EuiI18n
|
|
116
|
+
@token="euiQuickSelect.unitLabel"
|
|
117
|
+
@default="Time unit"
|
|
118
|
+
as |Token|
|
|
119
|
+
>
|
|
120
|
+
<Token as |unitLabel|>
|
|
121
|
+
<EuiSelect
|
|
122
|
+
@compressed={{true}}
|
|
123
|
+
@onKeyDown={{this.handleKeyDown}}
|
|
124
|
+
aria-label={{unitLabel}}
|
|
125
|
+
aria-describedby={{concat this.timeSelectionId " " legendId}}
|
|
126
|
+
@value={{this.timeUnits}}
|
|
127
|
+
@options={{@timeOptions.timeUnitsOptions}}
|
|
128
|
+
{{on "change" (pick "target.value" (set this "timeUnits"))}}
|
|
129
|
+
/>
|
|
130
|
+
</Token>
|
|
131
|
+
</EuiI18n>
|
|
132
|
+
</EuiFlexItem>
|
|
133
|
+
<EuiFlexItem @grow={{false}}>
|
|
134
|
+
<EuiButton
|
|
135
|
+
aria-describedby={{concat this.timeSelectionId " " legendId}}
|
|
136
|
+
class="euiQuickSelect__applyButton"
|
|
137
|
+
@size="s"
|
|
138
|
+
@disabled={{lte this.timeValue 0}}
|
|
139
|
+
{{on "click" this.applyQuickSelect}}
|
|
140
|
+
>
|
|
141
|
+
<EuiI18n
|
|
142
|
+
@token="euiQuickSelect.applyButton"
|
|
143
|
+
@default="Apply"
|
|
144
|
+
as |Token|
|
|
145
|
+
>
|
|
146
|
+
<Token as |value|>
|
|
147
|
+
{{value}}
|
|
148
|
+
</Token>
|
|
149
|
+
</EuiI18n>
|
|
150
|
+
</EuiButton>
|
|
151
|
+
</EuiFlexItem>
|
|
152
|
+
</EuiFlexGroup>
|
|
153
|
+
</fieldset>
|
|
154
|
+
{{/let}}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { action } from '@ember/object';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
import { ApplyTime, TimeUnitId } from '../types/global';
|
|
5
|
+
import { parseTimeParts } from '../utils/quick-select';
|
|
6
|
+
import { NEXT, TimeOptions } from '../utils/time-options';
|
|
7
|
+
import moment from 'moment';
|
|
8
|
+
import dateMath from '@elastic/datemath';
|
|
9
|
+
|
|
10
|
+
interface EuiQuickSelectState {
|
|
11
|
+
timeTense: string;
|
|
12
|
+
timeValue: number;
|
|
13
|
+
timeUnits: TimeUnitId;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface EuiQuickSelectArgs {
|
|
17
|
+
applyTime: ApplyTime;
|
|
18
|
+
start: string;
|
|
19
|
+
end: string;
|
|
20
|
+
prevQuickSelect?: EuiQuickSelectState;
|
|
21
|
+
timeOptions: TimeOptions;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default class EuiQuickSelect extends Component<EuiQuickSelectArgs> {
|
|
25
|
+
@tracked timeTense: string;
|
|
26
|
+
@tracked timeValue: number;
|
|
27
|
+
@tracked timeUnits: TimeUnitId;
|
|
28
|
+
|
|
29
|
+
constructor(owner: unknown, args: EuiQuickSelectArgs) {
|
|
30
|
+
super(owner, args);
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
timeTense: timeTenseDefault,
|
|
34
|
+
timeUnits: timeUnitsDefault,
|
|
35
|
+
timeValue: timeValueDefault
|
|
36
|
+
} = parseTimeParts(this.args.start, this.args.end);
|
|
37
|
+
|
|
38
|
+
this.timeTense =
|
|
39
|
+
this.args.prevQuickSelect && this.args.prevQuickSelect.timeTense
|
|
40
|
+
? this.args.prevQuickSelect.timeTense
|
|
41
|
+
: timeTenseDefault;
|
|
42
|
+
this.timeValue =
|
|
43
|
+
this.args.prevQuickSelect && this.args.prevQuickSelect.timeValue
|
|
44
|
+
? this.args.prevQuickSelect.timeValue
|
|
45
|
+
: timeValueDefault;
|
|
46
|
+
this.timeUnits =
|
|
47
|
+
this.args.prevQuickSelect && this.args.prevQuickSelect.timeUnits
|
|
48
|
+
? this.args.prevQuickSelect.timeUnits
|
|
49
|
+
: timeUnitsDefault;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getBounds() {
|
|
53
|
+
const startMoment = dateMath.parse(this.args.start);
|
|
54
|
+
const endMoment = dateMath.parse(this.args.end, { roundUp: true });
|
|
55
|
+
return {
|
|
56
|
+
min:
|
|
57
|
+
startMoment && startMoment.isValid()
|
|
58
|
+
? startMoment
|
|
59
|
+
: moment().subtract(15, 'minute'),
|
|
60
|
+
max: endMoment && endMoment.isValid() ? endMoment : moment()
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@action applyQuickSelect() {
|
|
65
|
+
if (this.timeTense === NEXT) {
|
|
66
|
+
this.args.applyTime({
|
|
67
|
+
start: 'now',
|
|
68
|
+
end: `now+${this.timeValue}${this.timeUnits}`
|
|
69
|
+
// quickSelect: { ...this.state },
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
this.args.applyTime({
|
|
73
|
+
start: `now-${this.timeValue}${this.timeUnits}`,
|
|
74
|
+
end: 'now'
|
|
75
|
+
// quickSelect: { ...this.state },
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@action stepForward() {
|
|
81
|
+
const { min, max } = this.getBounds();
|
|
82
|
+
const diff = max.diff(min);
|
|
83
|
+
this.args.applyTime({
|
|
84
|
+
start: moment(max).add(1, 'ms').toISOString(),
|
|
85
|
+
end: moment(max)
|
|
86
|
+
.add(diff + 1, 'ms')
|
|
87
|
+
.toISOString(),
|
|
88
|
+
keepPopoverOpen: true
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@action stepBackward() {
|
|
93
|
+
const { min, max } = this.getBounds();
|
|
94
|
+
const diff = max.diff(min);
|
|
95
|
+
this.args.applyTime({
|
|
96
|
+
start: moment(min)
|
|
97
|
+
.subtract(diff + 1, 'ms')
|
|
98
|
+
.toISOString(),
|
|
99
|
+
end: moment(min).subtract(1, 'ms').toISOString(),
|
|
100
|
+
keepPopoverOpen: true
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{{#let (unique-id) as |legendId|}}
|
|
2
|
+
<fieldset>
|
|
3
|
+
<EuiTitle
|
|
4
|
+
id={{legendId}}
|
|
5
|
+
@tagName="legend"
|
|
6
|
+
@size="xxxs"
|
|
7
|
+
>
|
|
8
|
+
<EuiI18n
|
|
9
|
+
@token="euiRecentlyUsed.legend"
|
|
10
|
+
@default="Recently used date ranges"
|
|
11
|
+
as |Token|
|
|
12
|
+
>
|
|
13
|
+
<Token as |value|>
|
|
14
|
+
{{value}}
|
|
15
|
+
</Token>
|
|
16
|
+
</EuiI18n>
|
|
17
|
+
</EuiTitle>
|
|
18
|
+
<div class="euiQuickSelectPopover__section">
|
|
19
|
+
<EuiFlexGrid
|
|
20
|
+
aria-labelledby={{legendId}}
|
|
21
|
+
@gutterSize="s"
|
|
22
|
+
@columns="2"
|
|
23
|
+
@direction="column"
|
|
24
|
+
@responsive={{false}}
|
|
25
|
+
@tagName="ul"
|
|
26
|
+
>
|
|
27
|
+
{{#each @recentlyUsedRanges as |range|}}
|
|
28
|
+
<EuiFlexItem
|
|
29
|
+
class="euiQuickSelectPopover__sectionItem"
|
|
30
|
+
@tagName="li"
|
|
31
|
+
>
|
|
32
|
+
<EuiLink
|
|
33
|
+
{{on "click" (fn @applyTime (hash start=range.start end=range.end))}}
|
|
34
|
+
>
|
|
35
|
+
{{!-- <PrettyDuration
|
|
36
|
+
timeFrom={start}
|
|
37
|
+
timeTo={end}
|
|
38
|
+
@quickRanges={{@commonlyUsedRanges}}
|
|
39
|
+
@dateFormat={{@dateFormat}}
|
|
40
|
+
/> --}}
|
|
41
|
+
{{range.label}}
|
|
42
|
+
</EuiLink>
|
|
43
|
+
</EuiFlexItem>
|
|
44
|
+
{{/each}}
|
|
45
|
+
</EuiFlexGrid>
|
|
46
|
+
</div>
|
|
47
|
+
</fieldset>
|
|
48
|
+
{{/let}}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<EuiPopover
|
|
2
|
+
@isOpen={{this.isOpen}}
|
|
3
|
+
@closePopover={{set this "isOpen" false}}
|
|
4
|
+
@anchorPosition="downLeft"
|
|
5
|
+
@anchorClassName="euiQuickSelectPopover__anchor"
|
|
6
|
+
>
|
|
7
|
+
<:button>
|
|
8
|
+
<EuiButtonEmpty
|
|
9
|
+
class="euiFormControlLayout__prepend"
|
|
10
|
+
@textClasses="euiQuickSelectPopover__buttonText"
|
|
11
|
+
@size="xs"
|
|
12
|
+
@iconType="arrowDown"
|
|
13
|
+
@iconSide="right"
|
|
14
|
+
@isDisabled={{@isDisabled}}
|
|
15
|
+
{{on "click" (set this "isOpen" (not this.isOpen))}}
|
|
16
|
+
>
|
|
17
|
+
<EuiIcon @type="calendar" />
|
|
18
|
+
</EuiButtonEmpty>
|
|
19
|
+
</:button>
|
|
20
|
+
|
|
21
|
+
<:content>
|
|
22
|
+
<div
|
|
23
|
+
class="euiQuickSelectPopover__content"
|
|
24
|
+
>
|
|
25
|
+
<EuiSuperDatePicker::EuiQuickSelectPopover::EuiQuickSelect
|
|
26
|
+
@applyTime={{this.applyTime}}
|
|
27
|
+
@start={{@start}}
|
|
28
|
+
@end={{@end}}
|
|
29
|
+
@timeOptions={{@timeOptions}}
|
|
30
|
+
{{!-- prevQuickSelect={prevQuickSelect} --}}
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
{{#if (gt @commonlyUsedRanges.length 0)}}
|
|
34
|
+
<EuiHorizontalRule @margin="s" />
|
|
35
|
+
<EuiSuperDatePicker::EuiQuickSelectPopover::EuiCommonlyUsedTimeRanges
|
|
36
|
+
@applyTime={{this.applyTime}}
|
|
37
|
+
@commonlyUsedRanges={{@commonlyUsedRanges}}
|
|
38
|
+
/>
|
|
39
|
+
{{/if}}
|
|
40
|
+
|
|
41
|
+
{{#if (gt @recentlyUsedRanges.length 0)}}
|
|
42
|
+
<EuiHorizontalRule @margin="s" />
|
|
43
|
+
<EuiSuperDatePicker::EuiQuickSelectPopover::EuiRecentlyUsed
|
|
44
|
+
@applyTime={{this.applyTime}}
|
|
45
|
+
@commonlyUsedRanges={{@commonlyUsedRanges}}
|
|
46
|
+
@dateFormat={{@dateFormat}}
|
|
47
|
+
@recentlyUsedRanges={{@recentlyUsedRanges}}
|
|
48
|
+
/>
|
|
49
|
+
{{/if}}
|
|
50
|
+
|
|
51
|
+
{{!-- {this.renderCustomQuickSelectPanels()} --}}
|
|
52
|
+
{{!-- <EuiHorizontalRule @margin="s" />
|
|
53
|
+
<EuiRefreshInterval
|
|
54
|
+
onRefreshChange={applyRefreshInterval}
|
|
55
|
+
isPaused={isPaused}
|
|
56
|
+
refreshInterval={refreshInterval}
|
|
57
|
+
/> --}}
|
|
58
|
+
</div>
|
|
59
|
+
</:content>
|
|
60
|
+
</EuiPopover>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { action } from '@ember/object';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { tracked } from '@glimmer/tracking';
|
|
4
|
+
import { ApplyTime } from '../types/global';
|
|
5
|
+
|
|
6
|
+
interface EuiQuickSelectPopoverArgs {
|
|
7
|
+
applyTime: ApplyTime;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default class EuiQuickSelectPopover extends Component<EuiQuickSelectPopoverArgs> {
|
|
11
|
+
@tracked isOpen = false;
|
|
12
|
+
|
|
13
|
+
@action applyTime({
|
|
14
|
+
start,
|
|
15
|
+
end,
|
|
16
|
+
keepPopoverOpen = false
|
|
17
|
+
}: {
|
|
18
|
+
start: string;
|
|
19
|
+
end: string;
|
|
20
|
+
quickSelect?: { timeTense: string; timeValue: number; timeUnits: string };
|
|
21
|
+
keepPopoverOpen?: boolean;
|
|
22
|
+
}) {
|
|
23
|
+
this.args.applyTime({
|
|
24
|
+
start,
|
|
25
|
+
end
|
|
26
|
+
});
|
|
27
|
+
// if (quickSelect) {
|
|
28
|
+
// this.setState({ prevQuickSelect: quickSelect });
|
|
29
|
+
// }
|
|
30
|
+
if (!keepPopoverOpen) {
|
|
31
|
+
this.isOpen = false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{{#if @iconOnly}}
|
|
2
|
+
<EuiButtonIcon
|
|
3
|
+
class={{class-names
|
|
4
|
+
"euiSuperUpdateButton"
|
|
5
|
+
@className
|
|
6
|
+
}}
|
|
7
|
+
@display={{if @fill "fill"}}
|
|
8
|
+
@color={{if (or @needsUpdate @isLoading) "success" "primary"}}
|
|
9
|
+
@iconType={{if (or @needsUpdate @isLoading) "kqlFunction" "refresh"}}
|
|
10
|
+
@isDisabled={{@isDisabled}}
|
|
11
|
+
@isLoading={{@isLoading}}
|
|
12
|
+
@size={{@size}}
|
|
13
|
+
{{style minWidth="0px"}}
|
|
14
|
+
{{on "click" @onClick}}
|
|
15
|
+
...attributes
|
|
16
|
+
/>
|
|
17
|
+
{{else}}
|
|
18
|
+
<EuiButton
|
|
19
|
+
class={{class-names
|
|
20
|
+
"euiSuperUpdateButton"
|
|
21
|
+
@className
|
|
22
|
+
}}
|
|
23
|
+
@fill={{@fill}}
|
|
24
|
+
@textClasses={{@textClasses}}
|
|
25
|
+
@color={{if (or @needsUpdate @isLoading) "success" "primary"}}
|
|
26
|
+
@iconType={{if (or @needsUpdate @isLoading) "kqlFunction" "refresh"}}
|
|
27
|
+
@isDisabled={{@isDisabled}}
|
|
28
|
+
@isLoading={{@isLoading}}
|
|
29
|
+
@size={{@size}}
|
|
30
|
+
{{on "click" @onClick}}
|
|
31
|
+
...attributes
|
|
32
|
+
>
|
|
33
|
+
{{#if (or @needsUpdate @isLoading)}}
|
|
34
|
+
{{#if @isLoading}}
|
|
35
|
+
Updating
|
|
36
|
+
{{else}}
|
|
37
|
+
Update
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{else}}
|
|
40
|
+
Refresh
|
|
41
|
+
{{/if}}
|
|
42
|
+
</EuiButton>
|
|
43
|
+
{{/if}}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<EuiFlexGroup
|
|
2
|
+
@gutterSize="s"
|
|
3
|
+
@responsive={{false}}
|
|
4
|
+
class={{class-names
|
|
5
|
+
"euiSuperDatePicker__flexWrapper"
|
|
6
|
+
(unless this.showUpdateButton "euiSuperDatePicker__flexWrapper--noUpdateButton")
|
|
7
|
+
(if this.isAutoRefreshOnly "euiSuperDatePicker__flexWrapper--isAutoRefreshOnly")
|
|
8
|
+
(if @isQuickSelectOnly "euiSuperDatePicker__flexWrapper--isQuickSelectOnly")
|
|
9
|
+
(if (eq this.width "full") "euiSuperDatePicker__flexWrapper--fullWidth")
|
|
10
|
+
(if (eq this.width "auto") "euiSuperDatePicker__flexWrapper--autoWidth")
|
|
11
|
+
}}
|
|
12
|
+
>
|
|
13
|
+
<EuiFlexItem>
|
|
14
|
+
<EuiFormControlLayout
|
|
15
|
+
class="euiSuperDatePicker"
|
|
16
|
+
@compressed={{@compressed}}
|
|
17
|
+
@isDisabled={{@isDisabled}}
|
|
18
|
+
@useGroup={{true}}
|
|
19
|
+
{{!-- @fullWidth={{this.fullWidth}} --}}
|
|
20
|
+
{{!-- @readOnly={{@readOnly}} --}}
|
|
21
|
+
>
|
|
22
|
+
<:prepend>
|
|
23
|
+
<EuiSuperDatePicker::EuiQuickSelectPopover
|
|
24
|
+
@start={{this.start}}
|
|
25
|
+
@end={{this.end}}
|
|
26
|
+
@applyTime={{this.applyQuickTime}}
|
|
27
|
+
@timeOptions={{this.timeOptions}}
|
|
28
|
+
@isDisabled={{@isDisabled}}
|
|
29
|
+
@dateFormat={{this.dateFormat}}
|
|
30
|
+
@commonlyUsedRanges={{arg-or-default
|
|
31
|
+
@commonlyUsedRanges
|
|
32
|
+
this.timeOptions.commonDurationRanges
|
|
33
|
+
}}
|
|
34
|
+
{{!-- @applyRefreshInterval={{if @onRefreshChange this.onRefreshChange}} --}}
|
|
35
|
+
{{!-- commonlyUsedRanges={commonlyUsedRanges}
|
|
36
|
+
customQuickSelectPanels={customQuickSelectPanels}
|
|
37
|
+
isPaused={isPaused}
|
|
38
|
+
recentlyUsedRanges={recentlyUsedRanges}
|
|
39
|
+
refreshInterval={refreshInterval} --}}
|
|
40
|
+
/>
|
|
41
|
+
</:prepend>
|
|
42
|
+
|
|
43
|
+
<:field>
|
|
44
|
+
<EuiSuperDatePicker::EuiDatePickerRange
|
|
45
|
+
@className="euiDatePickerRange--inGroup"
|
|
46
|
+
@iconType={{false}}
|
|
47
|
+
@isInvalid={{this.isInvalid}}
|
|
48
|
+
@disabled={{@isDisabled}}
|
|
49
|
+
@isCustom={{true}}
|
|
50
|
+
>
|
|
51
|
+
<:startDateControl>
|
|
52
|
+
<EuiSuperDatePicker::DatePopover::EuiDatePopoverButton
|
|
53
|
+
@className="euiSuperDatePicker__startPopoverButton"
|
|
54
|
+
@value={{this.start}}
|
|
55
|
+
@compressed={{@compressed}}
|
|
56
|
+
@position="start"
|
|
57
|
+
@isDisabled={{@isDisabled}}
|
|
58
|
+
@dateFormat={{this.dateFormat}}
|
|
59
|
+
@onChange={{this.setStart}}
|
|
60
|
+
@isInvalid={{this.isInvalid}}
|
|
61
|
+
@timeOptions={{this.timeOptions}}
|
|
62
|
+
@needsUpdating={{this.hasChanged}}
|
|
63
|
+
@locale={{@locale}}
|
|
64
|
+
{{!--
|
|
65
|
+
isInvalid={isInvalid}
|
|
66
|
+
utcOffset={utcOffset}
|
|
67
|
+
timeFormat={timeFormat}
|
|
68
|
+
isOpen={this.state.isStartDatePopoverOpen}
|
|
69
|
+
onPopoverToggle={this.onStartDatePopoverToggle}
|
|
70
|
+
onPopoverClose={this.onStartDatePopoverClose}
|
|
71
|
+
--}}
|
|
72
|
+
/>
|
|
73
|
+
</:startDateControl>
|
|
74
|
+
|
|
75
|
+
<:endDateControl>
|
|
76
|
+
<EuiSuperDatePicker::DatePopover::EuiDatePopoverButton
|
|
77
|
+
@className="euiSuperDatePicker__startPopoverButton"
|
|
78
|
+
@value={{this.end}}
|
|
79
|
+
@compressed={{@compressed}}
|
|
80
|
+
@position="end"
|
|
81
|
+
@isDisabled={{@isDisabled}}
|
|
82
|
+
@dateFormat={{this.dateFormat}}
|
|
83
|
+
@onChange={{this.setEnd}}
|
|
84
|
+
@isInvalid={{this.isInvalid}}
|
|
85
|
+
@timeOptions={{this.timeOptions}}
|
|
86
|
+
@roundUp={{true}}
|
|
87
|
+
@needsUpdating={{this.hasChanged}}
|
|
88
|
+
@locale={{@locale}}
|
|
89
|
+
{{!--
|
|
90
|
+
utcOffset={utcOffset}
|
|
91
|
+
timeFormat={timeFormat}
|
|
92
|
+
isOpen={this.state.isStartDatePopoverOpen}
|
|
93
|
+
onPopoverToggle={this.onStartDatePopoverToggle}
|
|
94
|
+
onPopoverClose={this.onStartDatePopoverClose}
|
|
95
|
+
--}}
|
|
96
|
+
/>
|
|
97
|
+
</:endDateControl>
|
|
98
|
+
</EuiSuperDatePicker::EuiDatePickerRange>
|
|
99
|
+
</:field>
|
|
100
|
+
</EuiFormControlLayout>
|
|
101
|
+
</EuiFlexItem>
|
|
102
|
+
|
|
103
|
+
{{#if this.showUpdateButton}}
|
|
104
|
+
<EuiFlexItem @grow={{false}}>
|
|
105
|
+
<EuiSuperDatePicker::EuiSuperUpdateButton
|
|
106
|
+
@size={{if @compressed "s" "m"}}
|
|
107
|
+
@onClick={{this.handleClickUpdateButton}}
|
|
108
|
+
@isLoading={{@isLoading}}
|
|
109
|
+
@isDisabled={{or @isDisabled this.isInvalid}}
|
|
110
|
+
@needsUpdate={{this.hasChanged}}
|
|
111
|
+
@fill={{true}}
|
|
112
|
+
@iconOnly={{eq this.showUpdateButton "iconOnly"}}
|
|
113
|
+
{{!--
|
|
114
|
+
showTooltip={
|
|
115
|
+
!this.state.isStartDatePopoverOpen &&
|
|
116
|
+
!this.state.isEndDatePopoverOpen
|
|
117
|
+
}
|
|
118
|
+
responsive
|
|
119
|
+
--}}
|
|
120
|
+
/>
|
|
121
|
+
</EuiFlexItem>
|
|
122
|
+
{{/if}}
|
|
123
|
+
</EuiFlexGroup>
|