@operato/input 1.0.0-alpha.9 → 1.0.0-beta.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/CHANGELOG.md +412 -0
- package/assets/images/icon-properties-line-type.png +0 -0
- package/assets/images/icon-properties-table.png +0 -0
- package/demo/index-crontab.html +37 -0
- package/demo/index-partition-keys.html +71 -0
- package/demo/index-select.html +21 -14
- package/demo/index-table.html +39 -0
- package/demo/index-value-map.html +80 -0
- package/demo/index-value-ranges.html +80 -0
- package/demo/index-work-shift.html +59 -0
- package/demo/index.html +10 -0
- package/dist/src/index.d.ts +9 -3
- package/dist/src/index.js +9 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-checkbox.d.ts +1 -1
- package/dist/src/ox-checkbox.js +1 -1
- package/dist/src/ox-checkbox.js.map +1 -1
- package/dist/src/ox-form-field.d.ts +2 -2
- package/dist/src/ox-form-field.js.map +1 -1
- package/dist/src/ox-input-barcode.d.ts +1 -1
- package/dist/src/ox-input-barcode.js +1 -1
- package/dist/src/ox-input-barcode.js.map +1 -1
- package/dist/src/ox-input-code.d.ts +1 -1
- package/dist/src/ox-input-code.js +12 -7
- package/dist/src/ox-input-code.js.map +1 -1
- package/dist/src/ox-input-color-gradient.d.ts +4 -4
- package/dist/src/ox-input-color-gradient.js +3 -3
- package/dist/src/ox-input-color-gradient.js.map +1 -1
- package/dist/src/ox-input-color-stops.js +1 -1
- package/dist/src/ox-input-color-stops.js.map +1 -1
- package/dist/src/ox-input-crontab.d.ts +23 -0
- package/dist/src/ox-input-crontab.js +560 -0
- package/dist/src/ox-input-crontab.js.map +1 -0
- package/dist/src/ox-input-layout/ox-input-card-layout.d.ts +4 -0
- package/dist/src/ox-input-layout/ox-input-card-layout.js +57 -0
- package/dist/src/ox-input-layout/ox-input-card-layout.js.map +1 -0
- package/dist/src/ox-input-layout/ox-input-grid-layout.d.ts +4 -0
- package/dist/src/ox-input-layout/ox-input-grid-layout.js +63 -0
- package/dist/src/ox-input-layout/ox-input-grid-layout.js.map +1 -0
- package/dist/src/ox-input-layout/ox-input-layout.d.ts +5 -0
- package/dist/src/ox-input-layout/ox-input-layout.js +73 -0
- package/dist/src/ox-input-layout/ox-input-layout.js.map +1 -0
- package/dist/src/ox-input-multiple-colors.d.ts +2 -2
- package/dist/src/ox-input-multiple-colors.js +2 -2
- package/dist/src/ox-input-multiple-colors.js.map +1 -1
- package/dist/src/ox-input-options.js.map +1 -1
- package/dist/src/ox-input-partition-keys.d.ts +36 -0
- package/dist/src/ox-input-partition-keys.js +204 -0
- package/dist/src/ox-input-partition-keys.js.map +1 -0
- package/dist/src/ox-input-search.d.ts +1 -0
- package/dist/src/ox-input-search.js +7 -1
- package/dist/src/ox-input-search.js.map +1 -1
- package/dist/src/ox-input-table.d.ts +8 -0
- package/dist/src/ox-input-table.js +379 -0
- package/dist/src/ox-input-table.js.map +1 -0
- package/dist/src/ox-input-value-map.d.ts +41 -0
- package/dist/src/ox-input-value-map.js +279 -0
- package/dist/src/ox-input-value-map.js.map +1 -0
- package/dist/src/ox-input-value-ranges.d.ts +41 -0
- package/dist/src/ox-input-value-ranges.js +298 -0
- package/dist/src/ox-input-value-ranges.js.map +1 -0
- package/dist/src/ox-input-work-shift.d.ts +33 -0
- package/dist/src/ox-input-work-shift.js +229 -0
- package/dist/src/ox-input-work-shift.js.map +1 -0
- package/dist/src/ox-select.d.ts +3 -0
- package/dist/src/ox-select.js +28 -3
- package/dist/src/ox-select.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -8
- package/src/index.ts +9 -3
- package/src/ox-checkbox.ts +2 -2
- package/src/ox-form-field.ts +2 -2
- package/src/ox-input-barcode.ts +2 -3
- package/src/ox-input-code.ts +14 -8
- package/src/{ox-input-color-gradient.ts.xxx → ox-input-color-gradient.ts} +4 -4
- package/src/ox-input-color-stops.ts +1 -1
- package/src/ox-input-crontab.ts +561 -0
- package/src/ox-input-layout/ox-input-card-layout.ts +58 -0
- package/src/ox-input-layout/ox-input-grid-layout.ts +64 -0
- package/src/ox-input-layout/ox-input-layout.ts +77 -0
- package/src/ox-input-multiple-colors.ts +2 -2
- package/src/ox-input-options.ts +1 -1
- package/src/ox-input-partition-keys.ts +243 -0
- package/src/ox-input-search.ts +9 -1
- package/src/ox-input-table.ts +404 -0
- package/src/{ox-input-keyvalues.ts.ing → ox-input-value-map.ts} +120 -89
- package/src/ox-input-value-ranges.ts +325 -0
- package/src/ox-input-work-shift.ts +251 -0
- package/src/ox-select.ts +31 -5
- package/dist/src/ox-input-background-pattern.d.ts +0 -31
- package/dist/src/ox-input-background-pattern.js +0 -147
- package/dist/src/ox-input-background-pattern.js.map +0 -1
- package/dist/src/ox-input-fill-style.d.ts +0 -42
- package/dist/src/ox-input-fill-style.js +0 -323
- package/dist/src/ox-input-fill-style.js.map +0 -1
- package/dist/src/ox-input-id.d.ts +0 -11
- package/dist/src/ox-input-id.js +0 -68
- package/dist/src/ox-input-id.js.map +0 -1
- package/src/ox-input-background-pattern.ts.xxx +0 -163
- package/src/ox-input-fill-style.ts.xxx +0 -361
- package/src/ox-input-ranges.ts.ing +0 -292
@@ -0,0 +1,560 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import '@material/mwc-button';
|
3
|
+
import { css, html } from 'lit';
|
4
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
5
|
+
import { i18next } from '@operato/i18n';
|
6
|
+
import { OxFormField } from './ox-form-field';
|
7
|
+
function createCronRegex(type) {
|
8
|
+
// https://gist.github.com/dkandalov/a2aed17cfdeb65243022
|
9
|
+
var regexByField = {};
|
10
|
+
regexByField['sec'] = '[0-5]?\\d';
|
11
|
+
regexByField['min'] = '[0-5]?\\d';
|
12
|
+
regexByField['hour'] = '[01]?\\d|2[0-3]';
|
13
|
+
regexByField['day'] = '0?[1-9]|[12]\\d|3[01]';
|
14
|
+
regexByField['month'] = '[1-9]|1[012]';
|
15
|
+
regexByField['dayOfWeek'] = '[0-7]';
|
16
|
+
var crontabFields = [type];
|
17
|
+
if (!type)
|
18
|
+
crontabFields = ['sec', 'min', 'hour', 'day', 'month', 'dayOfWeek'];
|
19
|
+
crontabFields.forEach(field => {
|
20
|
+
var number = regexByField[field];
|
21
|
+
var range = '(?:' +
|
22
|
+
number +
|
23
|
+
')' +
|
24
|
+
'(?:' +
|
25
|
+
'(?:-|/|,' +
|
26
|
+
('dayOfWeek' === field ? '|#' : '') +
|
27
|
+
')' +
|
28
|
+
'(?:' +
|
29
|
+
number +
|
30
|
+
')' +
|
31
|
+
')?';
|
32
|
+
if (field === 'dayOfWeek')
|
33
|
+
range += '(?:L)?';
|
34
|
+
if (field === 'month')
|
35
|
+
range += '(?:L|W)?';
|
36
|
+
regexByField[field] = '\\?|\\*|' + range + '(?:,' + range + ')*';
|
37
|
+
});
|
38
|
+
var monthValues = 'JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC';
|
39
|
+
var monthRange = '(?:' + monthValues + ')(?:(?:-)(?:' + monthValues + '))?';
|
40
|
+
regexByField['month'] += '|\\?|\\*|' + monthRange + '(?:,' + monthRange + ')*';
|
41
|
+
var dayOfWeekValues = 'MON|TUE|WED|THU|FRI|SAT|SUN';
|
42
|
+
var dayOfWeekRange = '(?:' + dayOfWeekValues + ')(?:(?:-)(?:' + dayOfWeekValues + '))?';
|
43
|
+
regexByField['dayOfWeek'] += '|\\?|\\*|' + dayOfWeekRange + '(?:,' + dayOfWeekRange + ')*';
|
44
|
+
if (!type)
|
45
|
+
return ('^\\s*($' +
|
46
|
+
'|#' +
|
47
|
+
'|\\w+\\s*=' +
|
48
|
+
'|' +
|
49
|
+
'(' +
|
50
|
+
regexByField['sec'] +
|
51
|
+
')\\s+' +
|
52
|
+
'(' +
|
53
|
+
regexByField['min'] +
|
54
|
+
')\\s+' +
|
55
|
+
'(' +
|
56
|
+
regexByField['hour'] +
|
57
|
+
')\\s+' +
|
58
|
+
'(' +
|
59
|
+
regexByField['day'] +
|
60
|
+
')\\s+' +
|
61
|
+
'(' +
|
62
|
+
regexByField['month'] +
|
63
|
+
')\\s+' +
|
64
|
+
'(' +
|
65
|
+
regexByField['dayOfWeek'] +
|
66
|
+
')(|\\s)+' +
|
67
|
+
')$');
|
68
|
+
else
|
69
|
+
return `^${regexByField[type]}$`;
|
70
|
+
}
|
71
|
+
let OxInputCrontab = class OxInputCrontab extends OxFormField {
|
72
|
+
constructor() {
|
73
|
+
super(...arguments);
|
74
|
+
this.tooltip = [];
|
75
|
+
}
|
76
|
+
static { this.styles = css `
|
77
|
+
:host {
|
78
|
+
display: block;
|
79
|
+
width: 100%;
|
80
|
+
height: 100%;
|
81
|
+
border: 0;
|
82
|
+
background-color: var(--main-section-background-color);
|
83
|
+
}
|
84
|
+
|
85
|
+
:host * {
|
86
|
+
box-sizing: border-box;
|
87
|
+
}
|
88
|
+
:host *:focus {
|
89
|
+
outline: none;
|
90
|
+
}
|
91
|
+
|
92
|
+
form {
|
93
|
+
display: grid;
|
94
|
+
width: 100%;
|
95
|
+
height: 100%;
|
96
|
+
padding: 1rem;
|
97
|
+
grid-template: auto auto 1fr auto / repeat(6, 1fr);
|
98
|
+
grid-gap: 0.5rem;
|
99
|
+
justify-content: center;
|
100
|
+
align-items: center;
|
101
|
+
overflow: auto;
|
102
|
+
}
|
103
|
+
|
104
|
+
label[for='example'] {
|
105
|
+
text-align: right;
|
106
|
+
grid-column: 3;
|
107
|
+
font: normal 1em var(--theme-font);
|
108
|
+
color: var(--secondary-color);
|
109
|
+
text-transform: capitalize;
|
110
|
+
}
|
111
|
+
|
112
|
+
#example {
|
113
|
+
grid-column: 4 / span 3;
|
114
|
+
width: 100%;
|
115
|
+
height: 100%;
|
116
|
+
font: normal 0.9em var(--theme-font);
|
117
|
+
text-transform: capitalize;
|
118
|
+
border-radius: var(--border-radius);
|
119
|
+
border: var(--border-dark-color);
|
120
|
+
}
|
121
|
+
|
122
|
+
input {
|
123
|
+
width: 100%;
|
124
|
+
margin-top: var(--margin-default);
|
125
|
+
padding: 5px;
|
126
|
+
border-radius: var(--border-radius);
|
127
|
+
border: var(--border-dark-color);
|
128
|
+
font: normal 1em var(--theme-font);
|
129
|
+
}
|
130
|
+
input:focus {
|
131
|
+
border: 1px solid var(--primary-color);
|
132
|
+
}
|
133
|
+
|
134
|
+
input:invalid {
|
135
|
+
border: 1px solid var(--status-danger-color);
|
136
|
+
color: var(--status-danger-color);
|
137
|
+
}
|
138
|
+
|
139
|
+
label {
|
140
|
+
width: 100%;
|
141
|
+
height: 100%;
|
142
|
+
font: normal 0.8em var(--theme-font);
|
143
|
+
color: var(--primary-color);
|
144
|
+
}
|
145
|
+
|
146
|
+
label:not([for='example']) {
|
147
|
+
text-align: center;
|
148
|
+
}
|
149
|
+
|
150
|
+
#input-wrapper {
|
151
|
+
grid-column: span 6;
|
152
|
+
display: flex;
|
153
|
+
flex-wrap: wrap;
|
154
|
+
margin: 0 -0.25rem;
|
155
|
+
}
|
156
|
+
|
157
|
+
#input-wrapper > div {
|
158
|
+
flex: 1;
|
159
|
+
display: grid;
|
160
|
+
grid-template-rows: 1fr auto;
|
161
|
+
grid-gap: 0.5rem;
|
162
|
+
min-width: 60px;
|
163
|
+
max-width: 33%;
|
164
|
+
margin: 0.25rem;
|
165
|
+
}
|
166
|
+
|
167
|
+
#tooltip {
|
168
|
+
grid-column: span 6;
|
169
|
+
display: grid;
|
170
|
+
grid-template-columns: auto 1fr;
|
171
|
+
grid-gap: 0;
|
172
|
+
margin: auto;
|
173
|
+
grid-auto-rows: min-content;
|
174
|
+
align-self: center;
|
175
|
+
align-items: center;
|
176
|
+
}
|
177
|
+
|
178
|
+
#tooltip > div {
|
179
|
+
padding: 0.25rem 0.5rem;
|
180
|
+
border-bottom: #ccc 1px dashed;
|
181
|
+
font: normal 0.9em var(--theme-font);
|
182
|
+
}
|
183
|
+
|
184
|
+
#tooltip > .crontab-value {
|
185
|
+
text-align: right;
|
186
|
+
color: var(--secondary-color);
|
187
|
+
}
|
188
|
+
|
189
|
+
#tooltip > .crontab-description {
|
190
|
+
text-align: left;
|
191
|
+
color: #585858;
|
192
|
+
}
|
193
|
+
|
194
|
+
#button-wrapper {
|
195
|
+
grid-column: 1 / span 6;
|
196
|
+
display: flex;
|
197
|
+
flex-wrap: wrap-reverse;
|
198
|
+
flex-direction: row-reverse;
|
199
|
+
margin: -0.25rem;
|
200
|
+
}
|
201
|
+
|
202
|
+
mwc-button {
|
203
|
+
background-color: var(--secondary-color);
|
204
|
+
border-radius: var(--button-border-radius);
|
205
|
+
--mdc-theme-primary: #fff;
|
206
|
+
margin: 0.25rem;
|
207
|
+
}
|
208
|
+
mwc-button:hover,
|
209
|
+
mwc-button:active {
|
210
|
+
background-color: var(--primary-color);
|
211
|
+
}
|
212
|
+
`; }
|
213
|
+
render() {
|
214
|
+
return html `
|
215
|
+
<form>
|
216
|
+
<label for="example">${i18next.t('label.examples')}</label>
|
217
|
+
<select
|
218
|
+
id="example"
|
219
|
+
@change=${(e) => (this.value = e.currentTarget.value)}
|
220
|
+
.value=${this.value}
|
221
|
+
>
|
222
|
+
<optgroup label="${i18next.t('label.second by second')}">
|
223
|
+
<option value="* * * * * *">${i18next.t('text.every second')}</option>
|
224
|
+
<option value="0/2 * * * * *">${i18next.t('text.every 2 seconds')}</option>
|
225
|
+
<option value="0/15 * * * * *">${i18next.t('text.every 15 seconds')}</option>
|
226
|
+
<option value="0/30 * * * * *">${i18next.t('text.every 30 seconds')}</option>
|
227
|
+
</optgroup>
|
228
|
+
<optgroup label="${i18next.t('label.minute by minute')}">
|
229
|
+
<option value="0 * * * * *">${i18next.t('text.every minute')}</option>
|
230
|
+
<option value="0 0/2 * * * *">${i18next.t('text.every 2 minutes')}</option>
|
231
|
+
<option value="0 0/15 * * * *">${i18next.t('text.every 15 minutes')}</option>
|
232
|
+
<option value="0 0/30 * * * *">${i18next.t('text.every half hour')}</option>
|
233
|
+
</optgroup>
|
234
|
+
<optgroup label="${i18next.t('label.hourly')}">
|
235
|
+
<option value="0 0 * * * *">${i18next.t('text.every hour')}</option>
|
236
|
+
<option value="0 0 0/2 * * *">${i18next.t('text.every 2 hours')}</option>
|
237
|
+
<option value="0 0 0/12 * * *">${i18next.t('text.every 12 hours')}</option>
|
238
|
+
<option value="0 0 10-19 * * *">${i18next.t('text.every hour during working time')}</option>
|
239
|
+
</optgroup>
|
240
|
+
<optgroup label="${i18next.t('label.daily')}">
|
241
|
+
<option value="0 0 0 * * *">${i18next.t('text.every day')}</option>
|
242
|
+
</optgroup>
|
243
|
+
<optgroup label="${i18next.t('label.weekly')}">
|
244
|
+
<option value="0 0 0 * * SUN">${i18next.t('text.every sunday')}</option>
|
245
|
+
<option value="0 0 0 * * 0">${i18next.t('text.every sunday(2)')}</option>
|
246
|
+
<option value="0 0 0 * * 1-5">${i18next.t('text.every weekday')}</option>
|
247
|
+
</optgroup>
|
248
|
+
<optgroup label="${i18next.t('label.monthly')}">
|
249
|
+
<option value="0 0 0 1 * *">${i18next.t('text.the first day of every month')}</option>
|
250
|
+
<option value="0 0 10 21 * *">${i18next.t('text.10 am on every payday')}</option>
|
251
|
+
</optgroup>
|
252
|
+
<optgroup label="${i18next.t('label.yearly')}">
|
253
|
+
<option value="0 0 0 1 1 *">${i18next.t('text.the first day of every year')}</option>
|
254
|
+
<option value="0 0 0 25 12 *">${i18next.t('text.every christmas')}</option>
|
255
|
+
</optgroup>
|
256
|
+
</select>
|
257
|
+
<div id="input-wrapper">
|
258
|
+
<div>
|
259
|
+
<input
|
260
|
+
id="second-input"
|
261
|
+
class="second"
|
262
|
+
type="text"
|
263
|
+
.value=${this.second || ''}
|
264
|
+
@input=${(e) => (this.second = e.currentTarget.value)}
|
265
|
+
@focus=${(e) => {
|
266
|
+
this.showTooltip('second');
|
267
|
+
}}
|
268
|
+
pattern=${createCronRegex('sec')}
|
269
|
+
required
|
270
|
+
/>
|
271
|
+
<label for="second-input" class="second">${i18next.t('label.second')}</label>
|
272
|
+
</div>
|
273
|
+
<div>
|
274
|
+
<input
|
275
|
+
id="minute-input"
|
276
|
+
class="minute"
|
277
|
+
type="text"
|
278
|
+
.value=${this.minute || ''}
|
279
|
+
@input=${(e) => (this.minute = e.currentTarget.value)}
|
280
|
+
@focus=${(e) => {
|
281
|
+
this.showTooltip('minute');
|
282
|
+
}}
|
283
|
+
pattern=${createCronRegex('min')}
|
284
|
+
required
|
285
|
+
/>
|
286
|
+
<label for="minute-input" class="minute">${i18next.t('label.minute')}</label>
|
287
|
+
</div>
|
288
|
+
<div>
|
289
|
+
<input
|
290
|
+
id="hour-input"
|
291
|
+
class="hour"
|
292
|
+
type="text"
|
293
|
+
.value=${this.hour || ''}
|
294
|
+
@input=${(e) => (this.hour = e.currentTarget.value)}
|
295
|
+
@focus=${(e) => {
|
296
|
+
this.showTooltip('hour');
|
297
|
+
}}
|
298
|
+
pattern=${createCronRegex('hour')}
|
299
|
+
required
|
300
|
+
/>
|
301
|
+
<label for="hour-input" class="hour">${i18next.t('label.hour')}</label>
|
302
|
+
</div>
|
303
|
+
<div>
|
304
|
+
<input
|
305
|
+
id="day-of-month-input"
|
306
|
+
class="day-of-month"
|
307
|
+
type="text"
|
308
|
+
.value=${this.dayOfMonth || ''}
|
309
|
+
@input=${(e) => (this.dayOfMonth = e.currentTarget.value)}
|
310
|
+
@focus=${(e) => {
|
311
|
+
this.showTooltip('dayOfMonth');
|
312
|
+
}}
|
313
|
+
pattern=${createCronRegex('day')}
|
314
|
+
required
|
315
|
+
/>
|
316
|
+
<label for="day-of-month-input" class="day-of-month">${i18next.t('label.day-of-month')}</label>
|
317
|
+
</div>
|
318
|
+
<div>
|
319
|
+
<input
|
320
|
+
id="month-input"
|
321
|
+
class="month"
|
322
|
+
type="text"
|
323
|
+
.value=${this.month || ''}
|
324
|
+
@input=${(e) => (this.month = e.currentTarget.value)}
|
325
|
+
@focus=${(e) => {
|
326
|
+
this.showTooltip('month');
|
327
|
+
}}
|
328
|
+
pattern=${createCronRegex('month')}
|
329
|
+
required
|
330
|
+
/>
|
331
|
+
<label for="month-input" class="month">${i18next.t('label.month')}</label>
|
332
|
+
</div>
|
333
|
+
<div>
|
334
|
+
<input
|
335
|
+
id="day-of-week-input"
|
336
|
+
class="day-of-week"
|
337
|
+
type="text"
|
338
|
+
.value=${this.dayOfWeek || ''}
|
339
|
+
@input=${(e) => (this.dayOfWeek = e.currentTarget.value)}
|
340
|
+
@focus=${(e) => {
|
341
|
+
this.showTooltip('dayOfWeek');
|
342
|
+
}}
|
343
|
+
pattern=${createCronRegex('dayOfWeek')}
|
344
|
+
required
|
345
|
+
/>
|
346
|
+
<label for="day-of-week-input" class="day-of-week">${i18next.t('label.day-of-week')}</label>
|
347
|
+
</div>
|
348
|
+
</div>
|
349
|
+
<div id="tooltip">
|
350
|
+
${this.tooltip.map(tip => html `
|
351
|
+
<div class="crontab-value">${tip.value}</div>
|
352
|
+
<div class="crontab-description">${i18next.t(`text.${tip.description}`)}</div>
|
353
|
+
`)}
|
354
|
+
</div>
|
355
|
+
</form>
|
356
|
+
`;
|
357
|
+
}
|
358
|
+
get focusableElements() {
|
359
|
+
return Array.from(this.renderRoot.querySelectorAll('select, input, mwc-button'));
|
360
|
+
}
|
361
|
+
firstUpdated() {
|
362
|
+
;
|
363
|
+
this.renderRoot.querySelector('input').focus();
|
364
|
+
this.renderRoot.addEventListener('change', this.onChange.bind(this));
|
365
|
+
}
|
366
|
+
updated(changes) {
|
367
|
+
if (changes.has('value')) {
|
368
|
+
var values = (this.value || '').split(' ');
|
369
|
+
if (values.length == 1)
|
370
|
+
values = ['*', '*', '*', '*', '*', '*'];
|
371
|
+
else if (values.length == 5)
|
372
|
+
values = ['0'].concat(values);
|
373
|
+
this.second = values[0];
|
374
|
+
this.minute = values[1];
|
375
|
+
this.hour = values[2];
|
376
|
+
this.dayOfMonth = values[3];
|
377
|
+
this.month = values[4];
|
378
|
+
this.dayOfWeek = values[5];
|
379
|
+
}
|
380
|
+
}
|
381
|
+
showTooltip(type) {
|
382
|
+
switch (type) {
|
383
|
+
case 'second':
|
384
|
+
case 'minute':
|
385
|
+
this.tooltip = [
|
386
|
+
{
|
387
|
+
value: '*',
|
388
|
+
description: 'any value'
|
389
|
+
},
|
390
|
+
{
|
391
|
+
value: ',',
|
392
|
+
description: 'value list separator'
|
393
|
+
},
|
394
|
+
{
|
395
|
+
value: '-',
|
396
|
+
description: 'range of values'
|
397
|
+
},
|
398
|
+
{
|
399
|
+
value: '/',
|
400
|
+
description: 'step values'
|
401
|
+
},
|
402
|
+
{
|
403
|
+
value: '0-59',
|
404
|
+
description: 'allowed values'
|
405
|
+
}
|
406
|
+
];
|
407
|
+
break;
|
408
|
+
case 'hour':
|
409
|
+
this.tooltip = [
|
410
|
+
{
|
411
|
+
value: '*',
|
412
|
+
description: 'any value'
|
413
|
+
},
|
414
|
+
{
|
415
|
+
value: ',',
|
416
|
+
description: 'value list separator'
|
417
|
+
},
|
418
|
+
{
|
419
|
+
value: '-',
|
420
|
+
description: 'range of values'
|
421
|
+
},
|
422
|
+
{
|
423
|
+
value: '/',
|
424
|
+
description: 'step values'
|
425
|
+
},
|
426
|
+
{
|
427
|
+
value: '0-23',
|
428
|
+
description: 'allowed values'
|
429
|
+
}
|
430
|
+
];
|
431
|
+
break;
|
432
|
+
case 'dayOfMonth':
|
433
|
+
this.tooltip = [
|
434
|
+
{
|
435
|
+
value: '*',
|
436
|
+
description: 'any value'
|
437
|
+
},
|
438
|
+
{
|
439
|
+
value: ',',
|
440
|
+
description: 'value list separator'
|
441
|
+
},
|
442
|
+
{
|
443
|
+
value: '-',
|
444
|
+
description: 'range of values'
|
445
|
+
},
|
446
|
+
{
|
447
|
+
value: '/',
|
448
|
+
description: 'step values'
|
449
|
+
},
|
450
|
+
{
|
451
|
+
value: '1-31',
|
452
|
+
description: 'allowed values'
|
453
|
+
}
|
454
|
+
];
|
455
|
+
break;
|
456
|
+
case 'month':
|
457
|
+
this.tooltip = [
|
458
|
+
{
|
459
|
+
value: '*',
|
460
|
+
description: 'any value'
|
461
|
+
},
|
462
|
+
{
|
463
|
+
value: ',',
|
464
|
+
description: 'value list separator'
|
465
|
+
},
|
466
|
+
{
|
467
|
+
value: '-',
|
468
|
+
description: 'range of values'
|
469
|
+
},
|
470
|
+
{
|
471
|
+
value: '/',
|
472
|
+
description: 'step values'
|
473
|
+
},
|
474
|
+
{
|
475
|
+
value: '1-12',
|
476
|
+
description: 'allowed values'
|
477
|
+
},
|
478
|
+
{
|
479
|
+
value: 'JAN-DEC',
|
480
|
+
description: 'alternative single values'
|
481
|
+
}
|
482
|
+
];
|
483
|
+
break;
|
484
|
+
case 'dayOfWeek':
|
485
|
+
this.tooltip = [
|
486
|
+
{
|
487
|
+
value: '*',
|
488
|
+
description: 'any value'
|
489
|
+
},
|
490
|
+
{
|
491
|
+
value: ',',
|
492
|
+
description: 'value list separator'
|
493
|
+
},
|
494
|
+
{
|
495
|
+
value: '-',
|
496
|
+
description: 'range of values'
|
497
|
+
},
|
498
|
+
{
|
499
|
+
value: '/',
|
500
|
+
description: 'step values'
|
501
|
+
},
|
502
|
+
{
|
503
|
+
value: '0-6',
|
504
|
+
description: 'allowed values'
|
505
|
+
},
|
506
|
+
{
|
507
|
+
value: 'SUN-SAT',
|
508
|
+
description: 'alternative single values'
|
509
|
+
}
|
510
|
+
];
|
511
|
+
break;
|
512
|
+
default:
|
513
|
+
this.tooltip = [];
|
514
|
+
break;
|
515
|
+
}
|
516
|
+
}
|
517
|
+
onChange() {
|
518
|
+
var form = this.renderRoot.querySelector('form');
|
519
|
+
var valid = form.checkValidity();
|
520
|
+
if (!valid) {
|
521
|
+
form.reportValidity();
|
522
|
+
return;
|
523
|
+
}
|
524
|
+
this.value = `${this.second} ${this.minute} ${this.hour} ${this.dayOfMonth} ${this.month} ${this.dayOfWeek}`;
|
525
|
+
this.dispatchEvent(new CustomEvent('change', {
|
526
|
+
bubbles: true,
|
527
|
+
composed: true,
|
528
|
+
detail: this.value
|
529
|
+
}));
|
530
|
+
}
|
531
|
+
};
|
532
|
+
__decorate([
|
533
|
+
property({ type: String })
|
534
|
+
], OxInputCrontab.prototype, "value", void 0);
|
535
|
+
__decorate([
|
536
|
+
property({ type: String })
|
537
|
+
], OxInputCrontab.prototype, "second", void 0);
|
538
|
+
__decorate([
|
539
|
+
property({ type: String })
|
540
|
+
], OxInputCrontab.prototype, "minute", void 0);
|
541
|
+
__decorate([
|
542
|
+
property({ type: String })
|
543
|
+
], OxInputCrontab.prototype, "hour", void 0);
|
544
|
+
__decorate([
|
545
|
+
property({ type: String })
|
546
|
+
], OxInputCrontab.prototype, "dayOfMonth", void 0);
|
547
|
+
__decorate([
|
548
|
+
property({ type: String })
|
549
|
+
], OxInputCrontab.prototype, "month", void 0);
|
550
|
+
__decorate([
|
551
|
+
property({ type: String })
|
552
|
+
], OxInputCrontab.prototype, "dayOfWeek", void 0);
|
553
|
+
__decorate([
|
554
|
+
state()
|
555
|
+
], OxInputCrontab.prototype, "tooltip", void 0);
|
556
|
+
OxInputCrontab = __decorate([
|
557
|
+
customElement('ox-input-crontab')
|
558
|
+
], OxInputCrontab);
|
559
|
+
export { OxInputCrontab };
|
560
|
+
//# sourceMappingURL=ox-input-crontab.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ox-input-crontab.js","sourceRoot":"","sources":["../../src/ox-input-crontab.ts"],"names":[],"mappings":";AAAA,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C,SAAS,eAAe,CAAC,IAA4D;IACnF,yDAAyD;IACzD,IAAI,YAAY,GAAG,EAAS,CAAA;IAC5B,YAAY,CAAC,KAAK,CAAC,GAAG,WAAW,CAAA;IACjC,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IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AACf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAgB;AACf;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAoB;AACnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAAe;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAmB;AAErC;IAAR,KAAK,EAAE;+CAAuD;AAnJpD,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAie1B;SAjeY,cAAc","sourcesContent":["import '@material/mwc-button'\n\nimport { css, html, PropertyValues } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { i18next } from '@operato/i18n'\n\nimport { OxFormField } from './ox-form-field'\n\nfunction createCronRegex(type: 'sec' | 'min' | 'hour' | 'day' | 'month' | 'dayOfWeek') {\n // https://gist.github.com/dkandalov/a2aed17cfdeb65243022\n var regexByField = {} as any\n regexByField['sec'] = '[0-5]?\\\\d'\n regexByField['min'] = '[0-5]?\\\\d'\n regexByField['hour'] = '[01]?\\\\d|2[0-3]'\n regexByField['day'] = '0?[1-9]|[12]\\\\d|3[01]'\n regexByField['month'] = '[1-9]|1[012]'\n regexByField['dayOfWeek'] = '[0-7]'\n\n var crontabFields = [type]\n if (!type) crontabFields = ['sec', 'min', 'hour', 'day', 'month', 'dayOfWeek']\n\n crontabFields.forEach(field => {\n var number = regexByField[field]\n var range =\n '(?:' +\n number +\n ')' +\n '(?:' +\n '(?:-|/|,' +\n ('dayOfWeek' === field ? '|#' : '') +\n ')' +\n '(?:' +\n number +\n ')' +\n ')?'\n if (field === 'dayOfWeek') range += '(?:L)?'\n if (field === 'month') range += '(?:L|W)?'\n regexByField[field] = '\\\\?|\\\\*|' + range + '(?:,' + range + ')*'\n })\n\n var monthValues = 'JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC'\n var monthRange = '(?:' + monthValues + ')(?:(?:-)(?:' + monthValues + '))?'\n regexByField['month'] += '|\\\\?|\\\\*|' + monthRange + '(?:,' + monthRange + ')*'\n\n var dayOfWeekValues = 'MON|TUE|WED|THU|FRI|SAT|SUN'\n var dayOfWeekRange = '(?:' + dayOfWeekValues + ')(?:(?:-)(?:' + dayOfWeekValues + '))?'\n regexByField['dayOfWeek'] += '|\\\\?|\\\\*|' + dayOfWeekRange + '(?:,' + dayOfWeekRange + ')*'\n\n if (!type)\n return (\n '^\\\\s*($' +\n '|#' +\n '|\\\\w+\\\\s*=' +\n '|' +\n '(' +\n regexByField['sec'] +\n ')\\\\s+' +\n '(' +\n regexByField['min'] +\n ')\\\\s+' +\n '(' +\n regexByField['hour'] +\n ')\\\\s+' +\n '(' +\n regexByField['day'] +\n ')\\\\s+' +\n '(' +\n regexByField['month'] +\n ')\\\\s+' +\n '(' +\n regexByField['dayOfWeek'] +\n ')(|\\\\s)+' +\n ')$'\n )\n else return `^${regexByField[type]}$`\n}\n\n@customElement('ox-input-crontab')\nexport class OxInputCrontab extends OxFormField {\n static styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n border: 0;\n background-color: var(--main-section-background-color);\n }\n\n :host * {\n box-sizing: border-box;\n }\n :host *:focus {\n outline: none;\n }\n\n form {\n display: grid;\n width: 100%;\n height: 100%;\n padding: 1rem;\n grid-template: auto auto 1fr auto / repeat(6, 1fr);\n grid-gap: 0.5rem;\n justify-content: center;\n align-items: center;\n overflow: auto;\n }\n\n label[for='example'] {\n text-align: right;\n grid-column: 3;\n font: normal 1em var(--theme-font);\n color: var(--secondary-color);\n text-transform: capitalize;\n }\n\n #example {\n grid-column: 4 / span 3;\n width: 100%;\n height: 100%;\n font: normal 0.9em var(--theme-font);\n text-transform: capitalize;\n border-radius: var(--border-radius);\n border: var(--border-dark-color);\n }\n\n input {\n width: 100%;\n margin-top: var(--margin-default);\n padding: 5px;\n border-radius: var(--border-radius);\n border: var(--border-dark-color);\n font: normal 1em var(--theme-font);\n }\n input:focus {\n border: 1px solid var(--primary-color);\n }\n\n input:invalid {\n border: 1px solid var(--status-danger-color);\n color: var(--status-danger-color);\n }\n\n label {\n width: 100%;\n height: 100%;\n font: normal 0.8em var(--theme-font);\n color: var(--primary-color);\n }\n\n label:not([for='example']) {\n text-align: center;\n }\n\n #input-wrapper {\n grid-column: span 6;\n display: flex;\n flex-wrap: wrap;\n margin: 0 -0.25rem;\n }\n\n #input-wrapper > div {\n flex: 1;\n display: grid;\n grid-template-rows: 1fr auto;\n grid-gap: 0.5rem;\n min-width: 60px;\n max-width: 33%;\n margin: 0.25rem;\n }\n\n #tooltip {\n grid-column: span 6;\n display: grid;\n grid-template-columns: auto 1fr;\n grid-gap: 0;\n margin: auto;\n grid-auto-rows: min-content;\n align-self: center;\n align-items: center;\n }\n\n #tooltip > div {\n padding: 0.25rem 0.5rem;\n border-bottom: #ccc 1px dashed;\n font: normal 0.9em var(--theme-font);\n }\n\n #tooltip > .crontab-value {\n text-align: right;\n color: var(--secondary-color);\n }\n\n #tooltip > .crontab-description {\n text-align: left;\n color: #585858;\n }\n\n #button-wrapper {\n grid-column: 1 / span 6;\n display: flex;\n flex-wrap: wrap-reverse;\n flex-direction: row-reverse;\n margin: -0.25rem;\n }\n\n mwc-button {\n background-color: var(--secondary-color);\n border-radius: var(--button-border-radius);\n --mdc-theme-primary: #fff;\n margin: 0.25rem;\n }\n mwc-button:hover,\n mwc-button:active {\n background-color: var(--primary-color);\n }\n `\n\n @property({ type: String }) value?: string\n @property({ type: String }) second?: string\n @property({ type: String }) minute?: string\n @property({ type: String }) hour?: string\n @property({ type: String }) dayOfMonth?: string\n @property({ type: String }) month?: string\n @property({ type: String }) dayOfWeek?: string\n\n @state() tooltip: { value: string; description: string }[] = []\n\n render() {\n return html`\n <form>\n <label for=\"example\">${i18next.t('label.examples')}</label>\n <select\n id=\"example\"\n @change=${(e: Event) => (this.value = (e.currentTarget as HTMLInputElement).value)}\n .value=${this.value}\n >\n <optgroup label=\"${i18next.t('label.second by second')}\">\n <option value=\"* * * * * *\">${i18next.t('text.every second')}</option>\n <option value=\"0/2 * * * * *\">${i18next.t('text.every 2 seconds')}</option>\n <option value=\"0/15 * * * * *\">${i18next.t('text.every 15 seconds')}</option>\n <option value=\"0/30 * * * * *\">${i18next.t('text.every 30 seconds')}</option>\n </optgroup>\n <optgroup label=\"${i18next.t('label.minute by minute')}\">\n <option value=\"0 * * * * *\">${i18next.t('text.every minute')}</option>\n <option value=\"0 0/2 * * * *\">${i18next.t('text.every 2 minutes')}</option>\n <option value=\"0 0/15 * * * *\">${i18next.t('text.every 15 minutes')}</option>\n <option value=\"0 0/30 * * * *\">${i18next.t('text.every half hour')}</option>\n </optgroup>\n <optgroup label=\"${i18next.t('label.hourly')}\">\n <option value=\"0 0 * * * *\">${i18next.t('text.every hour')}</option>\n <option value=\"0 0 0/2 * * *\">${i18next.t('text.every 2 hours')}</option>\n <option value=\"0 0 0/12 * * *\">${i18next.t('text.every 12 hours')}</option>\n <option value=\"0 0 10-19 * * *\">${i18next.t('text.every hour during working time')}</option>\n </optgroup>\n <optgroup label=\"${i18next.t('label.daily')}\">\n <option value=\"0 0 0 * * *\">${i18next.t('text.every day')}</option>\n </optgroup>\n <optgroup label=\"${i18next.t('label.weekly')}\">\n <option value=\"0 0 0 * * SUN\">${i18next.t('text.every sunday')}</option>\n <option value=\"0 0 0 * * 0\">${i18next.t('text.every sunday(2)')}</option>\n <option value=\"0 0 0 * * 1-5\">${i18next.t('text.every weekday')}</option>\n </optgroup>\n <optgroup label=\"${i18next.t('label.monthly')}\">\n <option value=\"0 0 0 1 * *\">${i18next.t('text.the first day of every month')}</option>\n <option value=\"0 0 10 21 * *\">${i18next.t('text.10 am on every payday')}</option>\n </optgroup>\n <optgroup label=\"${i18next.t('label.yearly')}\">\n <option value=\"0 0 0 1 1 *\">${i18next.t('text.the first day of every year')}</option>\n <option value=\"0 0 0 25 12 *\">${i18next.t('text.every christmas')}</option>\n </optgroup>\n </select>\n <div id=\"input-wrapper\">\n <div>\n <input\n id=\"second-input\"\n class=\"second\"\n type=\"text\"\n .value=${this.second || ''}\n @input=${(e: Event) => (this.second = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('second')\n }}\n pattern=${createCronRegex('sec')}\n required\n />\n <label for=\"second-input\" class=\"second\">${i18next.t('label.second')}</label>\n </div>\n <div>\n <input\n id=\"minute-input\"\n class=\"minute\"\n type=\"text\"\n .value=${this.minute || ''}\n @input=${(e: Event) => (this.minute = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('minute')\n }}\n pattern=${createCronRegex('min')}\n required\n />\n <label for=\"minute-input\" class=\"minute\">${i18next.t('label.minute')}</label>\n </div>\n <div>\n <input\n id=\"hour-input\"\n class=\"hour\"\n type=\"text\"\n .value=${this.hour || ''}\n @input=${(e: Event) => (this.hour = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('hour')\n }}\n pattern=${createCronRegex('hour')}\n required\n />\n <label for=\"hour-input\" class=\"hour\">${i18next.t('label.hour')}</label>\n </div>\n <div>\n <input\n id=\"day-of-month-input\"\n class=\"day-of-month\"\n type=\"text\"\n .value=${this.dayOfMonth || ''}\n @input=${(e: Event) => (this.dayOfMonth = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('dayOfMonth')\n }}\n pattern=${createCronRegex('day')}\n required\n />\n <label for=\"day-of-month-input\" class=\"day-of-month\">${i18next.t('label.day-of-month')}</label>\n </div>\n <div>\n <input\n id=\"month-input\"\n class=\"month\"\n type=\"text\"\n .value=${this.month || ''}\n @input=${(e: Event) => (this.month = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('month')\n }}\n pattern=${createCronRegex('month')}\n required\n />\n <label for=\"month-input\" class=\"month\">${i18next.t('label.month')}</label>\n </div>\n <div>\n <input\n id=\"day-of-week-input\"\n class=\"day-of-week\"\n type=\"text\"\n .value=${this.dayOfWeek || ''}\n @input=${(e: Event) => (this.dayOfWeek = (e.currentTarget as HTMLInputElement).value)}\n @focus=${(e: Event) => {\n this.showTooltip('dayOfWeek')\n }}\n pattern=${createCronRegex('dayOfWeek')}\n required\n />\n <label for=\"day-of-week-input\" class=\"day-of-week\">${i18next.t('label.day-of-week')}</label>\n </div>\n </div>\n <div id=\"tooltip\">\n ${this.tooltip.map(\n tip => html`\n <div class=\"crontab-value\">${tip.value}</div>\n <div class=\"crontab-description\">${i18next.t(`text.${tip.description}`)}</div>\n `\n )}\n </div>\n </form>\n `\n }\n\n get focusableElements(): HTMLElement[] {\n return Array.from(this.renderRoot.querySelectorAll('select, input, mwc-button'))\n }\n\n firstUpdated() {\n ;(this.renderRoot.querySelector('input') as HTMLInputElement).focus()\n this.renderRoot.addEventListener('change', this.onChange.bind(this))\n }\n\n updated(changes: PropertyValues<this>) {\n if (changes.has('value')) {\n var values = (this.value || '').split(' ')\n\n if (values.length == 1) values = ['*', '*', '*', '*', '*', '*']\n else if (values.length == 5) values = ['0'].concat(values)\n\n this.second = values[0]\n this.minute = values[1]\n this.hour = values[2]\n this.dayOfMonth = values[3]\n this.month = values[4]\n this.dayOfWeek = values[5]\n }\n }\n\n showTooltip(type: 'second' | 'minute' | 'hour' | 'dayOfMonth' | 'month' | 'dayOfWeek') {\n switch (type) {\n case 'second':\n case 'minute':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-59',\n description: 'allowed values'\n }\n ]\n break\n case 'hour':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-23',\n description: 'allowed values'\n }\n ]\n break\n\n case 'dayOfMonth':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '1-31',\n description: 'allowed values'\n }\n ]\n break\n\n case 'month':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '1-12',\n description: 'allowed values'\n },\n {\n value: 'JAN-DEC',\n description: 'alternative single values'\n }\n ]\n break\n\n case 'dayOfWeek':\n this.tooltip = [\n {\n value: '*',\n description: 'any value'\n },\n {\n value: ',',\n description: 'value list separator'\n },\n {\n value: '-',\n description: 'range of values'\n },\n {\n value: '/',\n description: 'step values'\n },\n {\n value: '0-6',\n description: 'allowed values'\n },\n {\n value: 'SUN-SAT',\n description: 'alternative single values'\n }\n ]\n break\n\n default:\n this.tooltip = []\n break\n }\n }\n\n onChange() {\n var form = this.renderRoot.querySelector('form') as HTMLFormElement\n var valid = form.checkValidity()\n if (!valid) {\n form.reportValidity()\n return\n }\n\n this.value = `${this.second} ${this.minute} ${this.hour} ${this.dayOfMonth} ${this.month} ${this.dayOfWeek}`\n\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n }\n}\n"]}
|