@operato/input 8.0.0-beta.0 → 8.0.0-beta.1
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 +9 -0
- package/package.json +7 -7
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/src/index.ts +0 -35
- package/src/locale/locale-codes.ts +0 -18
- package/src/locale/locale-picker.ts +0 -43
- package/src/locale/localization.ts +0 -15
- package/src/locales/en.ts +0 -30
- package/src/locales/ko.ts +0 -30
- package/src/locales/ms.ts +0 -30
- package/src/locales/zh.ts +0 -30
- package/src/ox-buttons-radio.ts +0 -140
- package/src/ox-checkbox.ts +0 -181
- package/src/ox-form-field.ts +0 -53
- package/src/ox-input-3axis.ts +0 -77
- package/src/ox-input-3dish.ts +0 -211
- package/src/ox-input-angle.ts +0 -73
- package/src/ox-input-barcode.ts +0 -318
- package/src/ox-input-code.ts +0 -139
- package/src/ox-input-color-gradient.ts +0 -349
- package/src/ox-input-color-stops.ts +0 -525
- package/src/ox-input-color.ts +0 -338
- package/src/ox-input-container.ts +0 -32
- package/src/ox-input-crontab.ts +0 -595
- package/src/ox-input-data.ts +0 -219
- package/src/ox-input-direction.ts +0 -92
- package/src/ox-input-duration.ts +0 -175
- package/src/ox-input-file.ts +0 -209
- package/src/ox-input-hashtags.ts +0 -185
- package/src/ox-input-i18n-label.ts +0 -140
- package/src/ox-input-image.ts +0 -168
- package/src/ox-input-key-values.ts +0 -301
- package/src/ox-input-layout/ox-input-card-layout.ts +0 -58
- package/src/ox-input-layout/ox-input-grid-layout.ts +0 -64
- package/src/ox-input-layout/ox-input-layout.ts +0 -77
- package/src/ox-input-mass-fraction.ts +0 -437
- package/src/ox-input-multiple-colors.ts +0 -135
- package/src/ox-input-options.ts +0 -216
- package/src/ox-input-partition-keys.ts +0 -303
- package/src/ox-input-privilege.ts +0 -163
- package/src/ox-input-quantifier.ts +0 -62
- package/src/ox-input-range.ts +0 -146
- package/src/ox-input-scene-component-id.ts +0 -73
- package/src/ox-input-search.ts +0 -126
- package/src/ox-input-select-buttons.ts +0 -75
- package/src/ox-input-signature.ts +0 -208
- package/src/ox-input-stack.ts +0 -136
- package/src/ox-input-switch.ts +0 -117
- package/src/ox-input-table-column-config.ts +0 -211
- package/src/ox-input-table.ts +0 -404
- package/src/ox-input-textarea.ts +0 -86
- package/src/ox-input-unit-number.ts +0 -354
- package/src/ox-input-value-map.ts +0 -342
- package/src/ox-input-value-ranges.ts +0 -363
- package/src/ox-input-work-shift.ts +0 -290
- package/src/ox-select-floor.ts +0 -246
- package/src/ox-select.ts +0 -219
- package/stories/image-for-select-floor.ts +0 -2
- package/stories/ox-buttons-radio.stories.ts +0 -89
- package/stories/ox-checkbox.stories.ts +0 -111
- package/stories/ox-input-3axis.stories.ts +0 -77
- package/stories/ox-input-3dish.stories.ts +0 -106
- package/stories/ox-input-angle.stories.ts +0 -84
- package/stories/ox-input-barcode.stories.ts +0 -117
- package/stories/ox-input-code.stories.ts +0 -99
- package/stories/ox-input-crontab.stories.ts +0 -82
- package/stories/ox-input-data.stories.ts +0 -82
- package/stories/ox-input-direction.stories.ts +0 -91
- package/stories/ox-input-duration.stories.ts +0 -84
- package/stories/ox-input-file.stories.ts +0 -111
- package/stories/ox-input-hashtags.stories.ts +0 -82
- package/stories/ox-input-i18n-label.stories.ts +0 -103
- package/stories/ox-input-key-values.stories.ts +0 -97
- package/stories/ox-input-mass-fraction.stories.ts +0 -102
- package/stories/ox-input-multiple-colors.stories.ts +0 -72
- package/stories/ox-input-options.stories.ts +0 -80
- package/stories/ox-input-partition-keys.stories.ts +0 -84
- package/stories/ox-input-privilege.stories.ts +0 -108
- package/stories/ox-input-quantifier.stories.ts +0 -80
- package/stories/ox-input-range.stories.ts +0 -89
- package/stories/ox-input-search.stories.ts +0 -91
- package/stories/ox-input-select-buttons.stories.ts +0 -118
- package/stories/ox-input-signature.stories.ts +0 -75
- package/stories/ox-input-switch.stories.ts +0 -91
- package/stories/ox-input-table-column-config.stories.ts +0 -109
- package/stories/ox-input-unit.stories.ts +0 -151
- package/stories/ox-input-value-map.stories.ts +0 -92
- package/stories/ox-input-value-ranges.stories.ts +0 -92
- package/stories/ox-input-work-shift.stories.ts +0 -106
- package/stories/ox-select-floor.stories.ts +0 -197
- package/stories/ox-select-set-options.stories.ts +0 -208
- package/stories/ox-select.stories.ts +0 -181
- package/tsconfig.json +0 -25
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
package/src/ox-input-crontab.ts
DELETED
@@ -1,595 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
import { css, html, PropertyValues } from 'lit'
|
6
|
-
import { customElement, property, state } from 'lit/decorators.js'
|
7
|
-
|
8
|
-
import { i18next } from '@operato/i18n'
|
9
|
-
|
10
|
-
import { OxFormField } from './ox-form-field'
|
11
|
-
|
12
|
-
import '@material/web/fab/fab.js'
|
13
|
-
import '@material/web/icon/icon.js'
|
14
|
-
|
15
|
-
function createCronRegex(type: 'sec' | 'min' | 'hour' | 'day' | 'month' | 'dayOfWeek') {
|
16
|
-
// https://gist.github.com/dkandalov/a2aed17cfdeb65243022
|
17
|
-
var regexByField = {} as any
|
18
|
-
regexByField['sec'] = '[0-5]?\\d'
|
19
|
-
regexByField['min'] = '[0-5]?\\d'
|
20
|
-
regexByField['hour'] = '[01]?\\d|2[0-3]'
|
21
|
-
regexByField['day'] = '0?[1-9]|[12]\\d|3[01]'
|
22
|
-
regexByField['month'] = '[1-9]|1[012]'
|
23
|
-
regexByField['dayOfWeek'] = '[0-7]'
|
24
|
-
|
25
|
-
var crontabFields = [type]
|
26
|
-
if (!type) crontabFields = ['sec', 'min', 'hour', 'day', 'month', 'dayOfWeek']
|
27
|
-
|
28
|
-
crontabFields.forEach(field => {
|
29
|
-
var number = regexByField[field]
|
30
|
-
var range =
|
31
|
-
'(?:' +
|
32
|
-
number +
|
33
|
-
')' +
|
34
|
-
'(?:' +
|
35
|
-
'(?:-|/|,' +
|
36
|
-
('dayOfWeek' === field ? '|#' : '') +
|
37
|
-
')' +
|
38
|
-
'(?:' +
|
39
|
-
number +
|
40
|
-
')' +
|
41
|
-
')?'
|
42
|
-
if (field === 'dayOfWeek') range += '(?:L)?'
|
43
|
-
if (field === 'month') range += '(?:L|W)?'
|
44
|
-
regexByField[field] = '\\?|\\*|' + range + '(?:,' + range + ')*'
|
45
|
-
})
|
46
|
-
|
47
|
-
var monthValues = 'JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC'
|
48
|
-
var monthRange = '(?:' + monthValues + ')(?:(?:-)(?:' + monthValues + '))?'
|
49
|
-
regexByField['month'] += '|\\?|\\*|' + monthRange + '(?:,' + monthRange + ')*'
|
50
|
-
|
51
|
-
var dayOfWeekValues = 'MON|TUE|WED|THU|FRI|SAT|SUN'
|
52
|
-
var dayOfWeekRange = '(?:' + dayOfWeekValues + ')(?:(?:-)(?:' + dayOfWeekValues + '))?'
|
53
|
-
regexByField['dayOfWeek'] += '|\\?|\\*|' + dayOfWeekRange + '(?:,' + dayOfWeekRange + ')*'
|
54
|
-
|
55
|
-
if (!type)
|
56
|
-
return (
|
57
|
-
'^\\s*($' +
|
58
|
-
'|#' +
|
59
|
-
'|\\w+\\s*=' +
|
60
|
-
'|' +
|
61
|
-
'(' +
|
62
|
-
regexByField['sec'] +
|
63
|
-
')\\s+' +
|
64
|
-
'(' +
|
65
|
-
regexByField['min'] +
|
66
|
-
')\\s+' +
|
67
|
-
'(' +
|
68
|
-
regexByField['hour'] +
|
69
|
-
')\\s+' +
|
70
|
-
'(' +
|
71
|
-
regexByField['day'] +
|
72
|
-
')\\s+' +
|
73
|
-
'(' +
|
74
|
-
regexByField['month'] +
|
75
|
-
')\\s+' +
|
76
|
-
'(' +
|
77
|
-
regexByField['dayOfWeek'] +
|
78
|
-
')(|\\s)+' +
|
79
|
-
')$'
|
80
|
-
)
|
81
|
-
else return `^${regexByField[type]}$`
|
82
|
-
}
|
83
|
-
|
84
|
-
@customElement('ox-input-crontab')
|
85
|
-
export class OxInputCrontab extends OxFormField {
|
86
|
-
static styles = css`
|
87
|
-
:host {
|
88
|
-
position: relative;
|
89
|
-
display: block;
|
90
|
-
width: 100%;
|
91
|
-
height: 100%;
|
92
|
-
border: 0;
|
93
|
-
}
|
94
|
-
|
95
|
-
:host * {
|
96
|
-
box-sizing: border-box;
|
97
|
-
}
|
98
|
-
:host *:focus {
|
99
|
-
outline: none;
|
100
|
-
}
|
101
|
-
|
102
|
-
form {
|
103
|
-
display: grid;
|
104
|
-
width: 100%;
|
105
|
-
height: 100%;
|
106
|
-
padding: 1rem;
|
107
|
-
grid-template: auto auto 1fr auto / repeat(6, 1fr);
|
108
|
-
grid-gap: 0.5rem;
|
109
|
-
justify-content: center;
|
110
|
-
align-items: center;
|
111
|
-
overflow: auto;
|
112
|
-
}
|
113
|
-
|
114
|
-
label[for='example'] {
|
115
|
-
text-align: right;
|
116
|
-
grid-column: 3;
|
117
|
-
font-size: var(--md-sys-typescale-label-large-size, 0.875rem);
|
118
|
-
color: var(--md-sys-color-on-primary-container);
|
119
|
-
text-transform: capitalize;
|
120
|
-
}
|
121
|
-
|
122
|
-
#example {
|
123
|
-
grid-column: 4 / span 3;
|
124
|
-
width: 100%;
|
125
|
-
box-sizing: border-box;
|
126
|
-
padding: 0 var(--spacing-small);
|
127
|
-
height: var(--form-element-height-medium);
|
128
|
-
border: 1px solid var(--md-sys-color-outline);
|
129
|
-
border-radius: var(--md-sys-shape-corner-small);
|
130
|
-
background-color: var(--md-sys-color-on-primary);
|
131
|
-
text-transform: capitalize;
|
132
|
-
font-size: var(--md-sys-typescale-label-large-size, 0.875rem);
|
133
|
-
color: var(--md-sys-color-on-primary-container);
|
134
|
-
}
|
135
|
-
|
136
|
-
input {
|
137
|
-
width: 100%;
|
138
|
-
box-sizing: border-box;
|
139
|
-
padding: 0 var(--spacing-small);
|
140
|
-
height: var(--form-element-height-medium);
|
141
|
-
border: 1px solid var(--md-sys-color-outline);
|
142
|
-
border-radius: var(--md-sys-shape-corner-small);
|
143
|
-
background-color: var(--md-sys-color-on-primary);
|
144
|
-
font-size: var(--md-sys-typescale-label-large-size, 0.875rem);
|
145
|
-
color: var(--md-sys-color-on-primary-container);
|
146
|
-
}
|
147
|
-
|
148
|
-
input:focus {
|
149
|
-
outline: none;
|
150
|
-
border-color: var(--md-sys-color-secondary-fixed-dim);
|
151
|
-
}
|
152
|
-
|
153
|
-
input:invalid {
|
154
|
-
border-color: var(--md-sys-color-error);
|
155
|
-
color: var(--md-sys-color-error);
|
156
|
-
}
|
157
|
-
|
158
|
-
label {
|
159
|
-
width: 100%;
|
160
|
-
font-size: var(--md-sys-typescale-label-large-size, 0.875rem);
|
161
|
-
color: var(--md-sys-color-on-primary-container);
|
162
|
-
}
|
163
|
-
|
164
|
-
label:not([for='example']) {
|
165
|
-
text-align: center;
|
166
|
-
}
|
167
|
-
|
168
|
-
#input-wrapper {
|
169
|
-
grid-column: span 6;
|
170
|
-
display: flex;
|
171
|
-
flex-wrap: wrap;
|
172
|
-
margin: 0 -0.25rem;
|
173
|
-
}
|
174
|
-
|
175
|
-
#input-wrapper > div {
|
176
|
-
flex: 1;
|
177
|
-
display: grid;
|
178
|
-
grid-template-rows: 1fr auto;
|
179
|
-
grid-gap: var(--spacing-small);
|
180
|
-
min-width: 60px;
|
181
|
-
max-width: 33%;
|
182
|
-
margin: 0.25rem;
|
183
|
-
}
|
184
|
-
|
185
|
-
#tooltip {
|
186
|
-
grid-column: span 6;
|
187
|
-
display: grid;
|
188
|
-
grid-template-columns: auto 1fr;
|
189
|
-
grid-gap: 0;
|
190
|
-
margin: auto;
|
191
|
-
grid-auto-rows: min-content;
|
192
|
-
align-self: center;
|
193
|
-
align-items: center;
|
194
|
-
}
|
195
|
-
|
196
|
-
#tooltip > div {
|
197
|
-
padding: 0.25rem 0.5rem;
|
198
|
-
border-bottom: var(--md-sys-color-on-surface-variant) 1px dashed;
|
199
|
-
font-size: var(--md-sys-typescale-label-large-size, 0.875rem);
|
200
|
-
color: var(--md-sys-color-on-primary-container);
|
201
|
-
}
|
202
|
-
|
203
|
-
#tooltip > .crontab-value {
|
204
|
-
text-align: right;
|
205
|
-
color: var(--md-sys-color-surface-tint);
|
206
|
-
}
|
207
|
-
|
208
|
-
#tooltip > .crontab-description {
|
209
|
-
text-align: left;
|
210
|
-
color: var (--md-sys-color-on-primary-container);
|
211
|
-
}
|
212
|
-
|
213
|
-
#button-wrapper {
|
214
|
-
grid-column: 1 / span 6;
|
215
|
-
display: flex;
|
216
|
-
flex-wrap: wrap-reverse;
|
217
|
-
flex-direction: row-reverse;
|
218
|
-
margin: -0.25rem;
|
219
|
-
}
|
220
|
-
|
221
|
-
md-fab {
|
222
|
-
margin: 0.25rem;
|
223
|
-
position: absolute;
|
224
|
-
bottom: 1rem;
|
225
|
-
left: 1rem;
|
226
|
-
color: var(--md-sys-color-on-primary);
|
227
|
-
}
|
228
|
-
|
229
|
-
md-icon {
|
230
|
-
font-size: 24px;
|
231
|
-
}
|
232
|
-
`
|
233
|
-
|
234
|
-
@property({ type: String }) value?: string
|
235
|
-
@property({ type: String }) second?: string
|
236
|
-
@property({ type: String }) minute?: string
|
237
|
-
@property({ type: String }) hour?: string
|
238
|
-
@property({ type: String }) dayOfMonth?: string
|
239
|
-
@property({ type: String }) month?: string
|
240
|
-
@property({ type: String }) dayOfWeek?: string
|
241
|
-
|
242
|
-
@state() tooltip: { value: string; description: string }[] = []
|
243
|
-
|
244
|
-
render() {
|
245
|
-
return html`
|
246
|
-
<form>
|
247
|
-
<label for="example">${i18next.t('label.examples')}</label>
|
248
|
-
<select
|
249
|
-
id="example"
|
250
|
-
@change=${(e: Event) => (this.value = (e.currentTarget as HTMLInputElement).value)}
|
251
|
-
.value=${this.value || ''}
|
252
|
-
>
|
253
|
-
<optgroup label="String(${i18next.t('label.second by second')})">
|
254
|
-
<option value="* * * * * *">${i18next.t('text.every second')}</option>
|
255
|
-
<option value="0/2 * * * * *">${i18next.t('text.every 2 seconds')}</option>
|
256
|
-
<option value="0/15 * * * * *">${i18next.t('text.every 15 seconds')}</option>
|
257
|
-
<option value="0/30 * * * * *">${i18next.t('text.every 30 seconds')}</option>
|
258
|
-
</optgroup>
|
259
|
-
<optgroup label="String(${i18next.t('label.minute by minute')})">
|
260
|
-
<option value="0 * * * * *">${i18next.t('text.every minute')}</option>
|
261
|
-
<option value="0 0/2 * * * *">${i18next.t('text.every 2 minutes')}</option>
|
262
|
-
<option value="0 0/15 * * * *">${i18next.t('text.every 15 minutes')}</option>
|
263
|
-
<option value="0 0/30 * * * *">${i18next.t('text.every half hour')}</option>
|
264
|
-
</optgroup>
|
265
|
-
<optgroup label="String(${i18next.t('label.hourly')})">
|
266
|
-
<option value="0 0 * * * *">${i18next.t('text.every hour')}</option>
|
267
|
-
<option value="0 0 0/2 * * *">${i18next.t('text.every 2 hours')}</option>
|
268
|
-
<option value="0 0 0/12 * * *">${i18next.t('text.every 12 hours')}</option>
|
269
|
-
<option value="0 0 10-19 * * *">${i18next.t('text.every hour during working time')}</option>
|
270
|
-
</optgroup>
|
271
|
-
<optgroup label="String(${i18next.t('label.daily')})">
|
272
|
-
<option value="0 0 0 * * *">${i18next.t('text.every day')}</option>
|
273
|
-
</optgroup>
|
274
|
-
<optgroup label="String(${i18next.t('label.weekly')})">
|
275
|
-
<option value="0 0 0 * * SUN">${i18next.t('text.every sunday')}</option>
|
276
|
-
<option value="0 0 0 * * 0">${i18next.t('text.every sunday')}(2)</option>
|
277
|
-
<option value="0 0 0 * * 1-5">${i18next.t('text.every weekday')}</option>
|
278
|
-
</optgroup>
|
279
|
-
<optgroup label="String(${i18next.t('label.monthly')})">
|
280
|
-
<option value="0 0 0 1 * *">${i18next.t('text.the first day of every month')}</option>
|
281
|
-
<option value="0 0 10 21 * *">${i18next.t('text.10 am on every payday')}</option>
|
282
|
-
</optgroup>
|
283
|
-
<optgroup label="String(${i18next.t('label.yearly')})">
|
284
|
-
<option value="0 0 0 1 1 *">${i18next.t('text.the first day of every year')}</option>
|
285
|
-
<option value="0 0 0 25 12 *">${i18next.t('text.every christmas')}</option>
|
286
|
-
</optgroup>
|
287
|
-
</select>
|
288
|
-
<div id="input-wrapper">
|
289
|
-
<div>
|
290
|
-
<input
|
291
|
-
id="second-input"
|
292
|
-
class="second"
|
293
|
-
type="text"
|
294
|
-
.value=${this.second || ''}
|
295
|
-
@input=${(e: Event) => (this.second = (e.currentTarget as HTMLInputElement).value)}
|
296
|
-
@focus=${(e: Event) => {
|
297
|
-
this.showTooltip('second')
|
298
|
-
}}
|
299
|
-
pattern=${createCronRegex('sec')}
|
300
|
-
required
|
301
|
-
/>
|
302
|
-
<label for="second-input" class="second">${i18next.t('label.second')}</label>
|
303
|
-
</div>
|
304
|
-
<div>
|
305
|
-
<input
|
306
|
-
id="minute-input"
|
307
|
-
class="minute"
|
308
|
-
type="text"
|
309
|
-
.value=${this.minute || ''}
|
310
|
-
@input=${(e: Event) => (this.minute = (e.currentTarget as HTMLInputElement).value)}
|
311
|
-
@focus=${(e: Event) => {
|
312
|
-
this.showTooltip('minute')
|
313
|
-
}}
|
314
|
-
pattern=${createCronRegex('min')}
|
315
|
-
required
|
316
|
-
/>
|
317
|
-
<label for="minute-input" class="minute">${i18next.t('label.minute')}</label>
|
318
|
-
</div>
|
319
|
-
<div>
|
320
|
-
<input
|
321
|
-
id="hour-input"
|
322
|
-
class="hour"
|
323
|
-
type="text"
|
324
|
-
.value=${this.hour || ''}
|
325
|
-
@input=${(e: Event) => (this.hour = (e.currentTarget as HTMLInputElement).value)}
|
326
|
-
@focus=${(e: Event) => {
|
327
|
-
this.showTooltip('hour')
|
328
|
-
}}
|
329
|
-
pattern=${createCronRegex('hour')}
|
330
|
-
required
|
331
|
-
/>
|
332
|
-
<label for="hour-input" class="hour">${i18next.t('label.hour')}</label>
|
333
|
-
</div>
|
334
|
-
<div>
|
335
|
-
<input
|
336
|
-
id="day-of-month-input"
|
337
|
-
class="day-of-month"
|
338
|
-
type="text"
|
339
|
-
.value=${this.dayOfMonth || ''}
|
340
|
-
@input=${(e: Event) => (this.dayOfMonth = (e.currentTarget as HTMLInputElement).value)}
|
341
|
-
@focus=${(e: Event) => {
|
342
|
-
this.showTooltip('dayOfMonth')
|
343
|
-
}}
|
344
|
-
pattern=${createCronRegex('day')}
|
345
|
-
required
|
346
|
-
/>
|
347
|
-
<label for="day-of-month-input" class="day-of-month">${i18next.t('label.day-of-month')}</label>
|
348
|
-
</div>
|
349
|
-
<div>
|
350
|
-
<input
|
351
|
-
id="month-input"
|
352
|
-
class="month"
|
353
|
-
type="text"
|
354
|
-
.value=${this.month || ''}
|
355
|
-
@input=${(e: Event) => (this.month = (e.currentTarget as HTMLInputElement).value)}
|
356
|
-
@focus=${(e: Event) => {
|
357
|
-
this.showTooltip('month')
|
358
|
-
}}
|
359
|
-
pattern=${createCronRegex('month')}
|
360
|
-
required
|
361
|
-
/>
|
362
|
-
<label for="month-input" class="month">${i18next.t('label.month')}</label>
|
363
|
-
</div>
|
364
|
-
<div>
|
365
|
-
<input
|
366
|
-
id="day-of-week-input"
|
367
|
-
class="day-of-week"
|
368
|
-
type="text"
|
369
|
-
.value=${this.dayOfWeek || ''}
|
370
|
-
@input=${(e: Event) => (this.dayOfWeek = (e.currentTarget as HTMLInputElement).value)}
|
371
|
-
@focus=${(e: Event) => {
|
372
|
-
this.showTooltip('dayOfWeek')
|
373
|
-
}}
|
374
|
-
pattern=${createCronRegex('dayOfWeek')}
|
375
|
-
required
|
376
|
-
/>
|
377
|
-
<label for="day-of-week-input" class="day-of-week">${i18next.t('label.day-of-week')}</label>
|
378
|
-
</div>
|
379
|
-
</div>
|
380
|
-
<div id="tooltip">
|
381
|
-
${this.tooltip.map(
|
382
|
-
tip => html`
|
383
|
-
<div class="crontab-value">${tip.value}</div>
|
384
|
-
<div class="crontab-description">${i18next.t(`text.${tip.description}`)}</div>
|
385
|
-
`
|
386
|
-
)}
|
387
|
-
</div>
|
388
|
-
<div id="button-wrapper">
|
389
|
-
<md-fab
|
390
|
-
title="clear"
|
391
|
-
@click=${(e: Event) => {
|
392
|
-
e.preventDefault()
|
393
|
-
e.stopPropagation()
|
394
|
-
this.value = ''
|
395
|
-
this.dispatchEvent(
|
396
|
-
new CustomEvent('change', {
|
397
|
-
bubbles: true,
|
398
|
-
composed: true,
|
399
|
-
detail: this.value
|
400
|
-
})
|
401
|
-
)
|
402
|
-
}}
|
403
|
-
>
|
404
|
-
<md-icon slot="icon">delete</md-icon>
|
405
|
-
</md-fab>
|
406
|
-
</div>
|
407
|
-
</form>
|
408
|
-
`
|
409
|
-
}
|
410
|
-
|
411
|
-
get focusableElements(): HTMLElement[] {
|
412
|
-
return Array.from(this.renderRoot.querySelectorAll('select, input, button'))
|
413
|
-
}
|
414
|
-
|
415
|
-
firstUpdated() {
|
416
|
-
;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()
|
417
|
-
this.renderRoot.addEventListener('change', this.onChange.bind(this))
|
418
|
-
}
|
419
|
-
|
420
|
-
updated(changes: PropertyValues<this>) {
|
421
|
-
if (changes.has('value')) {
|
422
|
-
var values = (this.value || '').split(' ')
|
423
|
-
|
424
|
-
if (values.length == 1) values = ['*', '*', '*', '*', '*', '*']
|
425
|
-
else if (values.length == 5) values = ['0'].concat(values)
|
426
|
-
|
427
|
-
this.second = values[0]
|
428
|
-
this.minute = values[1]
|
429
|
-
this.hour = values[2]
|
430
|
-
this.dayOfMonth = values[3]
|
431
|
-
this.month = values[4]
|
432
|
-
this.dayOfWeek = values[5]
|
433
|
-
}
|
434
|
-
}
|
435
|
-
|
436
|
-
showTooltip(type: 'second' | 'minute' | 'hour' | 'dayOfMonth' | 'month' | 'dayOfWeek') {
|
437
|
-
switch (type) {
|
438
|
-
case 'second':
|
439
|
-
case 'minute':
|
440
|
-
this.tooltip = [
|
441
|
-
{
|
442
|
-
value: '*',
|
443
|
-
description: 'any value'
|
444
|
-
},
|
445
|
-
{
|
446
|
-
value: ',',
|
447
|
-
description: 'value list separator'
|
448
|
-
},
|
449
|
-
{
|
450
|
-
value: '-',
|
451
|
-
description: 'range of values'
|
452
|
-
},
|
453
|
-
{
|
454
|
-
value: '/',
|
455
|
-
description: 'step values'
|
456
|
-
},
|
457
|
-
{
|
458
|
-
value: '0-59',
|
459
|
-
description: 'allowed values'
|
460
|
-
}
|
461
|
-
]
|
462
|
-
break
|
463
|
-
case 'hour':
|
464
|
-
this.tooltip = [
|
465
|
-
{
|
466
|
-
value: '*',
|
467
|
-
description: 'any value'
|
468
|
-
},
|
469
|
-
{
|
470
|
-
value: ',',
|
471
|
-
description: 'value list separator'
|
472
|
-
},
|
473
|
-
{
|
474
|
-
value: '-',
|
475
|
-
description: 'range of values'
|
476
|
-
},
|
477
|
-
{
|
478
|
-
value: '/',
|
479
|
-
description: 'step values'
|
480
|
-
},
|
481
|
-
{
|
482
|
-
value: '0-23',
|
483
|
-
description: 'allowed values'
|
484
|
-
}
|
485
|
-
]
|
486
|
-
break
|
487
|
-
|
488
|
-
case 'dayOfMonth':
|
489
|
-
this.tooltip = [
|
490
|
-
{
|
491
|
-
value: '*',
|
492
|
-
description: 'any value'
|
493
|
-
},
|
494
|
-
{
|
495
|
-
value: ',',
|
496
|
-
description: 'value list separator'
|
497
|
-
},
|
498
|
-
{
|
499
|
-
value: '-',
|
500
|
-
description: 'range of values'
|
501
|
-
},
|
502
|
-
{
|
503
|
-
value: '/',
|
504
|
-
description: 'step values'
|
505
|
-
},
|
506
|
-
{
|
507
|
-
value: '1-31',
|
508
|
-
description: 'allowed values'
|
509
|
-
}
|
510
|
-
]
|
511
|
-
break
|
512
|
-
|
513
|
-
case 'month':
|
514
|
-
this.tooltip = [
|
515
|
-
{
|
516
|
-
value: '*',
|
517
|
-
description: 'any value'
|
518
|
-
},
|
519
|
-
{
|
520
|
-
value: ',',
|
521
|
-
description: 'value list separator'
|
522
|
-
},
|
523
|
-
{
|
524
|
-
value: '-',
|
525
|
-
description: 'range of values'
|
526
|
-
},
|
527
|
-
{
|
528
|
-
value: '/',
|
529
|
-
description: 'step values'
|
530
|
-
},
|
531
|
-
{
|
532
|
-
value: '1-12',
|
533
|
-
description: 'allowed values'
|
534
|
-
},
|
535
|
-
{
|
536
|
-
value: 'JAN-DEC',
|
537
|
-
description: 'alternative single values'
|
538
|
-
}
|
539
|
-
]
|
540
|
-
break
|
541
|
-
|
542
|
-
case 'dayOfWeek':
|
543
|
-
this.tooltip = [
|
544
|
-
{
|
545
|
-
value: '*',
|
546
|
-
description: 'any value'
|
547
|
-
},
|
548
|
-
{
|
549
|
-
value: ',',
|
550
|
-
description: 'value list separator'
|
551
|
-
},
|
552
|
-
{
|
553
|
-
value: '-',
|
554
|
-
description: 'range of values'
|
555
|
-
},
|
556
|
-
{
|
557
|
-
value: '/',
|
558
|
-
description: 'step values'
|
559
|
-
},
|
560
|
-
{
|
561
|
-
value: '0-6',
|
562
|
-
description: 'allowed values'
|
563
|
-
},
|
564
|
-
{
|
565
|
-
value: 'SUN-SAT',
|
566
|
-
description: 'alternative single values'
|
567
|
-
}
|
568
|
-
]
|
569
|
-
break
|
570
|
-
|
571
|
-
default:
|
572
|
-
this.tooltip = []
|
573
|
-
break
|
574
|
-
}
|
575
|
-
}
|
576
|
-
|
577
|
-
onChange() {
|
578
|
-
var form = this.renderRoot.querySelector('form') as HTMLFormElement
|
579
|
-
var valid = form.checkValidity()
|
580
|
-
if (!valid) {
|
581
|
-
form.reportValidity()
|
582
|
-
return
|
583
|
-
}
|
584
|
-
|
585
|
-
this.value = `${this.second} ${this.minute} ${this.hour} ${this.dayOfMonth} ${this.month} ${this.dayOfWeek}`
|
586
|
-
|
587
|
-
this.dispatchEvent(
|
588
|
-
new CustomEvent('change', {
|
589
|
-
bubbles: true,
|
590
|
-
composed: true,
|
591
|
-
detail: this.value
|
592
|
-
})
|
593
|
-
)
|
594
|
-
}
|
595
|
-
}
|