@operato/grist-editor 1.0.0-beta.39 → 1.0.0-beta.40

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/src/index.d.ts +1 -0
  3. package/dist/src/index.js.map +1 -0
  4. package/dist/src/ox-grist-editor-crontab.d.ts +8 -0
  5. package/dist/src/ox-grist-editor-crontab.js +50 -0
  6. package/dist/src/ox-grist-editor-crontab.js.map +1 -0
  7. package/dist/src/ox-grist-editor-duration.d.ts +8 -0
  8. package/dist/src/ox-grist-editor-duration.js +50 -0
  9. package/dist/src/ox-grist-editor-duration.js.map +1 -0
  10. package/dist/src/ox-grist-editor-parameters.d.ts +12 -0
  11. package/dist/src/ox-grist-editor-parameters.js +84 -0
  12. package/dist/src/ox-grist-editor-parameters.js.map +1 -0
  13. package/dist/src/ox-grist-editor-partition-keys.d.ts +11 -0
  14. package/dist/src/ox-grist-editor-partition-keys.js +74 -0
  15. package/dist/src/ox-grist-editor-partition-keys.js.map +1 -0
  16. package/dist/src/ox-grist-editor-value-map.d.ts +11 -0
  17. package/dist/src/ox-grist-editor-value-map.js +74 -0
  18. package/dist/src/ox-grist-editor-value-map.js.map +1 -0
  19. package/dist/src/ox-grist-renderer-crontab.d.ts +2 -0
  20. package/dist/src/ox-grist-renderer-crontab.js +26 -0
  21. package/dist/src/ox-grist-renderer-crontab.js.map +1 -0
  22. package/dist/src/ox-parameters-builder.d.ts +4 -0
  23. package/dist/src/ox-parameters-builder.js +116 -0
  24. package/dist/src/ox-parameters-builder.js.map +1 -0
  25. package/dist/src/ox-popup-crontab-input.d.ts +11 -0
  26. package/dist/src/ox-popup-crontab-input.js +75 -0
  27. package/dist/src/ox-popup-crontab-input.js.map +1 -0
  28. package/dist/src/ox-popup-duration-input.d.ts +11 -0
  29. package/dist/src/ox-popup-duration-input.js +75 -0
  30. package/dist/src/ox-popup-duration-input.js.map +1 -0
  31. package/dist/src/ox-popup-parameters-builder.d.ts +13 -0
  32. package/dist/src/ox-popup-parameters-builder.js +112 -0
  33. package/dist/src/ox-popup-parameters-builder.js.map +1 -0
  34. package/dist/src/ox-popup-partition-keys-input.d.ts +12 -0
  35. package/dist/src/ox-popup-partition-keys-input.js +100 -0
  36. package/dist/src/ox-popup-partition-keys-input.js.map +1 -0
  37. package/dist/src/ox-popup-value-map-input.d.ts +12 -0
  38. package/dist/src/ox-popup-value-map-input.js +105 -0
  39. package/dist/src/ox-popup-value-map-input.js.map +1 -0
  40. package/dist/stories/ox-grist-editor-crontab.stories.d.ts +24 -0
  41. package/dist/stories/ox-grist-editor-crontab.stories.js +406 -0
  42. package/dist/stories/ox-grist-editor-crontab.stories.js.map +1 -0
  43. package/dist/tsconfig.tsbuildinfo +1 -0
  44. package/package.json +11 -9
@@ -0,0 +1,406 @@
1
+ import { __decorate } from "tslib";
2
+ import '@operato/property-editor/ox-property-editor-checkbox.js';
3
+ import '@operato/property-editor/ox-property-editor-number.js';
4
+ import '@operato/property-editor/ox-property-editor-string.js';
5
+ import '@operato/property-editor/ox-property-editor-options.js';
6
+ import '@operato/property-editor/ox-properties-dynamic-view.js';
7
+ import '@operato/data-grist';
8
+ import '@operato/data-grist/ox-filters-form.js';
9
+ import '@operato/data-grist/ox-sorters-control.js';
10
+ import '@material/mwc-icon';
11
+ /* set grist-editors */
12
+ import { css, html, LitElement } from 'lit';
13
+ import { state } from 'lit/decorators.js';
14
+ import { OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist';
15
+ import { i18next } from '@operato/i18n';
16
+ import { OxPropertyEditor } from '@operato/property-editor';
17
+ import { CommonGristStyles } from '@operato/styles';
18
+ import { OxGristEditorCrontab } from '../src/ox-grist-editor-crontab.js';
19
+ import { OxGristEditorDuration } from '../src/ox-grist-editor-duration.js';
20
+ import { OxGristEditorParameters } from '../src/ox-grist-editor-parameters.js';
21
+ import { OxGristEditorPartitionKeys } from '../src/ox-grist-editor-partition-keys.js';
22
+ // import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'
23
+ import { OxGristEditorValueMap } from '../src/ox-grist-editor-value-map.js';
24
+ // import { OxGristEditorJson } from './ox-grist-editor-json.js'
25
+ // import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'
26
+ OxPropertyEditor.register({
27
+ number: 'ox-property-editor-number',
28
+ string: 'ox-property-editor-string',
29
+ boolean: 'ox-property-editor-checkbox',
30
+ options: 'ox-property-editor-options'
31
+ });
32
+ registerEditor('parameters', OxGristEditorParameters);
33
+ registerEditor('crontab', OxGristEditorCrontab);
34
+ registerEditor('value-map', OxGristEditorValueMap);
35
+ registerEditor('partition-keys', OxGristEditorPartitionKeys);
36
+ /* register grist renderer/editor for id */
37
+ // registerEditor('resource-id', OxGristEditorResourceId)
38
+ // registerEditor('resource-object', OxGristEditorResourceObject)
39
+ // registerEditor('resource-code', OxGristEditorResourceCode)
40
+ registerEditor('parameters', OxGristEditorParameters);
41
+ registerEditor('value-map', OxGristEditorValueMap);
42
+ registerEditor('partition-keys', OxGristEditorPartitionKeys);
43
+ registerEditor('crontab', OxGristEditorCrontab);
44
+ registerEditor('duration', OxGristEditorDuration);
45
+ // registerEditor('json', OxGristEditorJson)
46
+ // registerRenderer('resource-id', OxGristRendererResourceId)
47
+ // registerRenderer('resource-object', OxGristRendererResourceObject)
48
+ registerRenderer('parameters', OxGristRendererJson5);
49
+ registerRenderer('value-map', OxGristRendererJson5);
50
+ registerRenderer('partition-keys', OxGristRendererJson5);
51
+ // registerRenderer('crontab', OxGristRendererCrontab)
52
+ const fetchHandler = async ({ page = 1, limit = 100, sortings = [], filters = [] }) => {
53
+ var total = 10;
54
+ var start = (page - 1) * limit;
55
+ return {
56
+ total,
57
+ records: Array(limit * page > total ? total % limit : limit)
58
+ .fill('')
59
+ .map((item, idx) => {
60
+ return {
61
+ id: idx,
62
+ name: `name-${start + idx + 1}`,
63
+ description: `description-${start + idx + 1}`,
64
+ sequence: idx + 1,
65
+ active: true,
66
+ tag: `tag-${idx + 1}`,
67
+ type: idx % 3 === 0 ? 'select' : idx % 3 === 1 ? 'number' : 'string',
68
+ spec: {
69
+ ccp: {
70
+ criticalLimits: 100,
71
+ targetLimits: 200
72
+ },
73
+ qc: {
74
+ criticalLimits: 300,
75
+ targetLimits: true
76
+ }
77
+ },
78
+ options: idx % 2 === 0
79
+ ? {
80
+ options: [
81
+ {
82
+ text: 'A',
83
+ value: 'a'
84
+ },
85
+ {
86
+ text: 'B',
87
+ value: 'b'
88
+ }
89
+ ]
90
+ }
91
+ : undefined,
92
+ schedule: '* * * * * *',
93
+ keyvalue: {},
94
+ createdAt: Date.now(),
95
+ updatedAt: Date.now()
96
+ };
97
+ })
98
+ };
99
+ };
100
+ class GristDemo extends LitElement {
101
+ constructor() {
102
+ super(...arguments);
103
+ this.mode = 'CARD';
104
+ this.config = {
105
+ list: { fields: ['name', 'description', 'active'] },
106
+ columns: [
107
+ { type: 'gutter', gutterName: 'row-selector', multiple: true },
108
+ {
109
+ type: 'gutter',
110
+ gutterName: 'button',
111
+ icon: 'add',
112
+ handlers: {
113
+ click: 'record-copy'
114
+ }
115
+ },
116
+ { type: 'gutter', gutterName: 'sequence' },
117
+ {
118
+ type: 'gutter',
119
+ gutterName: 'button',
120
+ icon: 'arrow_upward',
121
+ handlers: {
122
+ click: 'move-up'
123
+ }
124
+ },
125
+ {
126
+ type: 'gutter',
127
+ gutterName: 'button',
128
+ icon: 'arrow_downward',
129
+ handlers: {
130
+ click: 'move-down'
131
+ }
132
+ },
133
+ {
134
+ type: 'number',
135
+ name: 'sequence',
136
+ hidden: true
137
+ },
138
+ {
139
+ type: 'string',
140
+ name: 'id',
141
+ hidden: true
142
+ },
143
+ {
144
+ type: 'string',
145
+ name: 'name',
146
+ header: i18next.t('field.name'),
147
+ record: {
148
+ editable: true
149
+ },
150
+ width: 140
151
+ },
152
+ {
153
+ type: 'string',
154
+ name: 'description',
155
+ header: i18next.t('field.description'),
156
+ record: {
157
+ editable: true
158
+ },
159
+ width: 180
160
+ },
161
+ {
162
+ type: 'checkbox',
163
+ name: 'active',
164
+ label: true,
165
+ header: i18next.t('field.active'),
166
+ record: {
167
+ editable: true
168
+ },
169
+ sortable: true,
170
+ width: 60
171
+ },
172
+ {
173
+ type: 'string',
174
+ name: 'tag',
175
+ header: i18next.t('field.tag'),
176
+ record: {
177
+ editable: true
178
+ },
179
+ width: 180
180
+ },
181
+ {
182
+ type: 'select',
183
+ name: 'type',
184
+ header: i18next.t('field.type'),
185
+ record: {
186
+ options: ['', 'number', 'text', 'select', 'boolean', 'file'],
187
+ editable: true
188
+ },
189
+ width: 120
190
+ },
191
+ {
192
+ type: 'crontab',
193
+ name: 'schedule',
194
+ header: i18next.t('field.schedule'),
195
+ record: {
196
+ editable: true
197
+ },
198
+ width: 120
199
+ },
200
+ {
201
+ type: 'partition-keys',
202
+ name: 'keyvalue',
203
+ header: i18next.t('field.keyvalue'),
204
+ record: {
205
+ editable: true,
206
+ options: {
207
+ objectified: true,
208
+ valuetype: 'string'
209
+ }
210
+ },
211
+ width: 120
212
+ },
213
+ {
214
+ type: 'parameters',
215
+ name: 'options',
216
+ header: i18next.t('field.options'),
217
+ record: {
218
+ editable: true,
219
+ renderer: (value) => {
220
+ return typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : '';
221
+ },
222
+ options: async (value, column, record, row, field) => {
223
+ return {
224
+ name: record.type,
225
+ help: '',
226
+ spec: record.type === 'select'
227
+ ? [
228
+ {
229
+ type: 'options',
230
+ name: 'options',
231
+ label: 'options'
232
+ }
233
+ ]
234
+ : [],
235
+ context: this.grist,
236
+ objectified: true /* tell parameters editor not to need to parse */
237
+ };
238
+ }
239
+ },
240
+ width: 120
241
+ },
242
+ {
243
+ type: 'string',
244
+ name: 'unit',
245
+ header: i18next.t('field.unit'),
246
+ record: {
247
+ editable: true
248
+ },
249
+ width: 120
250
+ },
251
+ {
252
+ type: 'number',
253
+ name: 'quota',
254
+ header: i18next.t('field.quota'),
255
+ record: {
256
+ editable: true
257
+ },
258
+ width: 60
259
+ },
260
+ {
261
+ type: 'crontab',
262
+ name: 'spec',
263
+ header: i18next.t('field.spec'),
264
+ record: {
265
+ editable: true,
266
+ options: {
267
+ name,
268
+ objectified: true
269
+ }
270
+ },
271
+ width: 200
272
+ }
273
+ ],
274
+ rows: {
275
+ selectable: {
276
+ multiple: true
277
+ }
278
+ },
279
+ pagination: {
280
+ infinite: true
281
+ },
282
+ sorters: [
283
+ {
284
+ name: 'sequence'
285
+ }
286
+ ]
287
+ };
288
+ }
289
+ get grist() {
290
+ return this.renderRoot.querySelector('ox-grist');
291
+ }
292
+ render() {
293
+ const mode = this.mode || 'CARD';
294
+ return html `
295
+ <ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${fetchHandler}>
296
+ <div id="filters" slot="headroom">
297
+ <ox-filters-form @filters-change=${(e) => console.log('changed', e.detail)}></ox-filters-form>
298
+ </div>
299
+
300
+ <div slot="headroom" id="headroom">
301
+ <div id="modes">
302
+ <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</mwc-icon>
303
+ <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</mwc-icon>
304
+ <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>
305
+ </div>
306
+ </div>
307
+ </ox-grist>
308
+ `;
309
+ }
310
+ }
311
+ GristDemo.styles = [
312
+ CommonGristStyles,
313
+ css `
314
+ :host {
315
+ display: flex;
316
+ flex-direction: column;
317
+ }
318
+
319
+ #tailer {
320
+ display: flex;
321
+ flex-direction: row;
322
+ margin: 0 var(--margin-default);
323
+ }
324
+
325
+ #tailer a {
326
+ padding: 0 var(--padding-default) 0 var(--padding-default);
327
+ margin: 0 var(--margin-narrow);
328
+ border-right: 1px solid rgba(0, 0, 0, 0.1);
329
+ font-size: var(--fontsize-default);
330
+ color: var(--primary-color);
331
+ }
332
+ `
333
+ ];
334
+ __decorate([
335
+ state()
336
+ ], GristDemo.prototype, "mode", void 0);
337
+ customElements.define('ox-grist-demo', GristDemo);
338
+ export default {
339
+ title: 'ox-grist-editor-crontab',
340
+ component: 'ox-grist-editor-crontab',
341
+ argTypes: {}
342
+ };
343
+ const Template = ({}) => html `
344
+ <link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet" />
345
+ <link href="/themes/app-theme.css" rel="stylesheet" />
346
+ <link href="/themes/oops-theme.css" rel="stylesheet" />
347
+ <link href="/themes/grist-theme.css" rel="stylesheet" />
348
+
349
+ <style>
350
+ [slot='headroom'] {
351
+ display: flex;
352
+ flex-direction: row;
353
+ align-items: center;
354
+ padding: var(--padding-default) var(--padding-wide);
355
+ border-top: 2px solid rgba(0, 0, 0, 0.2);
356
+ background-color: var(--theme-white-color);
357
+ box-shadow: var(--box-shadow);
358
+
359
+ --mdc-icon-size: 24px;
360
+ }
361
+ #sorters mwc-icon,
362
+ #modes mwc-icon {
363
+ --mdc-icon-size: 18px;
364
+ }
365
+ #sorters {
366
+ margin-left: auto;
367
+ margin-right: var(--margin-default);
368
+ padding-left: var(--padding-narrow);
369
+ border-bottom: var(--border-dark-color);
370
+ position: relative;
371
+ color: var(--secondary-color);
372
+ font-size: var(--fontsize-default);
373
+ user-select: none;
374
+ }
375
+
376
+ #sorters > * {
377
+ padding: var(--padding-narrow);
378
+ vertical-align: middle;
379
+ }
380
+
381
+ #filters {
382
+ display: flex;
383
+ justify-content: center;
384
+ align-items: center;
385
+ }
386
+
387
+ #filters * {
388
+ margin-right: var(--margin-default);
389
+ }
390
+
391
+ @media only screen and (max-width: 460px) {
392
+ #filters {
393
+ flex-direction: column;
394
+ }
395
+
396
+ #modes {
397
+ display: none;
398
+ }
399
+ }
400
+ </style>
401
+
402
+ <ox-grist-demo mode="LIST"></ox-grist-demo>
403
+ `;
404
+ export const Regular = Template.bind({});
405
+ Regular.args = {};
406
+ //# sourceMappingURL=ox-grist-editor-crontab.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ox-grist-editor-crontab.stories.js","sourceRoot":"","sources":["../../stories/ox-grist-editor-crontab.stories.ts"],"names":[],"mappings":";AAAA,OAAO,yDAAyD,CAAA;AAChE,OAAO,uDAAuD,CAAA;AAC9D,OAAO,uDAAuD,CAAA;AAC9D,OAAO,wDAAwD,CAAA;AAC/D,OAAO,wDAAwD,CAAA;AAC/D,OAAO,qBAAqB,CAAA;AAC5B,OAAO,wCAAwC,CAAA;AAC/C,OAAO,2CAA2C,CAAA;AAClD,OAAO,oBAAoB,CAAA;AAE3B,uBAAuB;AACvB,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAEzC,OAAO,EAA4B,oBAAoB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtH,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAA;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAA;AACrF,+EAA+E;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAA;AAE3E,gEAAgE;AAChE,+EAA+E;AAE/E,gBAAgB,CAAC,QAAQ,CAAC;IACxB,MAAM,EAAE,2BAA2B;IACnC,MAAM,EAAE,2BAA2B;IACnC,OAAO,EAAE,6BAA6B;IACtC,OAAO,EAAE,4BAA4B;CACtC,CAAC,CAAA;AAEF,cA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Ae;IACb,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,yBAAyB;IACpC,QAAQ,EAAE,EAAE;CACb,CAAA;AAUD,MAAM,QAAQ,GAAoB,CAAC,EAAY,EAAE,EAAE,CACjD,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DH,CAAA;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG,EAAE,CAAA","sourcesContent":["import '@operato/property-editor/ox-property-editor-checkbox.js'\nimport '@operato/property-editor/ox-property-editor-number.js'\nimport '@operato/property-editor/ox-property-editor-string.js'\nimport '@operato/property-editor/ox-property-editor-options.js'\nimport '@operato/property-editor/ox-properties-dynamic-view.js'\nimport '@operato/data-grist'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/data-grist/ox-sorters-control.js'\nimport '@material/mwc-icon'\n\n/* set grist-editors */\nimport { css, html, LitElement, TemplateResult } from 'lit'\nimport { state } from 'lit/decorators.js'\n\nimport { FetchOption, GristRecord, OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'\nimport { i18next } from '@operato/i18n'\nimport { OxPropertyEditor } from '@operato/property-editor'\nimport { CommonGristStyles } from '@operato/styles'\n\nimport { OxGristEditorCrontab } from '../src/ox-grist-editor-crontab.js'\nimport { OxGristEditorDuration } from '../src/ox-grist-editor-duration.js'\nimport { OxGristEditorParameters } from '../src/ox-grist-editor-parameters.js'\nimport { OxGristEditorPartitionKeys } from '../src/ox-grist-editor-partition-keys.js'\n// import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'\nimport { OxGristEditorValueMap } from '../src/ox-grist-editor-value-map.js'\n\n// import { OxGristEditorJson } from './ox-grist-editor-json.js'\n// import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'\n\nOxPropertyEditor.register({\n number: 'ox-property-editor-number',\n string: 'ox-property-editor-string',\n boolean: 'ox-property-editor-checkbox',\n options: 'ox-property-editor-options'\n})\n\nregisterEditor('parameters', OxGristEditorParameters)\nregisterEditor('crontab', OxGristEditorCrontab)\nregisterEditor('value-map', OxGristEditorValueMap)\nregisterEditor('partition-keys', OxGristEditorPartitionKeys)\n\n/* register grist renderer/editor for id */\n// registerEditor('resource-id', OxGristEditorResourceId)\n// registerEditor('resource-object', OxGristEditorResourceObject)\n// registerEditor('resource-code', OxGristEditorResourceCode)\nregisterEditor('parameters', OxGristEditorParameters)\nregisterEditor('value-map', OxGristEditorValueMap)\nregisterEditor('partition-keys', OxGristEditorPartitionKeys)\nregisterEditor('crontab', OxGristEditorCrontab)\nregisterEditor('duration', OxGristEditorDuration)\n// registerEditor('json', OxGristEditorJson)\n\n// registerRenderer('resource-id', OxGristRendererResourceId)\n// registerRenderer('resource-object', OxGristRendererResourceObject)\nregisterRenderer('parameters', OxGristRendererJson5)\nregisterRenderer('value-map', OxGristRendererJson5)\nregisterRenderer('partition-keys', OxGristRendererJson5)\n// registerRenderer('crontab', OxGristRendererCrontab)\n\nconst fetchHandler = async ({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) => {\n var total = 10\n var start = (page - 1) * limit\n\n return {\n total,\n records: Array(limit * page > total ? total % limit : limit)\n .fill('')\n .map((item, idx) => {\n return {\n id: idx,\n name: `name-${start + idx + 1}`,\n description: `description-${start + idx + 1}`,\n sequence: idx + 1,\n active: true,\n tag: `tag-${idx + 1}`,\n type: idx % 3 === 0 ? 'select' : idx % 3 === 1 ? 'number' : 'string',\n spec: {\n ccp: {\n criticalLimits: 100,\n targetLimits: 200\n },\n qc: {\n criticalLimits: 300,\n targetLimits: true\n }\n },\n options:\n idx % 2 === 0\n ? {\n options: [\n {\n text: 'A',\n value: 'a'\n },\n {\n text: 'B',\n value: 'b'\n }\n ]\n }\n : undefined,\n schedule: '* * * * * *',\n keyvalue: {},\n createdAt: Date.now(),\n updatedAt: Date.now()\n }\n })\n }\n}\n\nclass GristDemo extends LitElement {\n static styles = [\n CommonGristStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n }\n\n #tailer {\n display: flex;\n flex-direction: row;\n margin: 0 var(--margin-default);\n }\n\n #tailer a {\n padding: 0 var(--padding-default) 0 var(--padding-default);\n margin: 0 var(--margin-narrow);\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n font-size: var(--fontsize-default);\n color: var(--primary-color);\n }\n `\n ]\n\n @state() mode: String = 'CARD'\n\n get grist() {\n return this.renderRoot.querySelector('ox-grist')\n }\n\n config: any = {\n list: { fields: ['name', 'description', 'active'] },\n columns: [\n { type: 'gutter', gutterName: 'row-selector', multiple: true },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n handlers: {\n click: 'record-copy'\n }\n },\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_upward',\n handlers: {\n click: 'move-up'\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_downward',\n handlers: {\n click: 'move-down'\n }\n },\n {\n type: 'number',\n name: 'sequence',\n hidden: true\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'string',\n name: 'name',\n header: i18next.t('field.name'),\n record: {\n editable: true\n },\n width: 140\n },\n {\n type: 'string',\n name: 'description',\n header: i18next.t('field.description'),\n record: {\n editable: true\n },\n width: 180\n },\n {\n type: 'checkbox',\n name: 'active',\n label: true,\n header: i18next.t('field.active'),\n record: {\n editable: true\n },\n sortable: true,\n width: 60\n },\n {\n type: 'string',\n name: 'tag',\n header: i18next.t('field.tag'),\n record: {\n editable: true\n },\n width: 180\n },\n {\n type: 'select',\n name: 'type',\n header: i18next.t('field.type'),\n record: {\n options: ['', 'number', 'text', 'select', 'boolean', 'file'],\n editable: true\n },\n width: 120\n },\n {\n type: 'crontab',\n name: 'schedule',\n header: i18next.t('field.schedule'),\n record: {\n editable: true\n },\n width: 120\n },\n {\n type: 'partition-keys',\n name: 'keyvalue',\n header: i18next.t('field.keyvalue'),\n record: {\n editable: true,\n options: {\n objectified: true,\n valuetype: 'string'\n }\n },\n width: 120\n },\n {\n type: 'parameters',\n name: 'options',\n header: i18next.t('field.options'),\n record: {\n editable: true,\n renderer: (value: any) => {\n return typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : ''\n },\n options: async (value: any, column: any, record: GristRecord, row: GristRecord, field: any) => {\n return {\n name: record.type,\n help: '',\n spec:\n record.type === 'select'\n ? [\n {\n type: 'options',\n name: 'options',\n label: 'options'\n }\n ]\n : [],\n context: this.grist,\n objectified: true /* tell parameters editor not to need to parse */\n }\n }\n },\n width: 120\n },\n {\n type: 'string',\n name: 'unit',\n header: i18next.t('field.unit'),\n record: {\n editable: true\n },\n width: 120\n },\n {\n type: 'number',\n name: 'quota',\n header: i18next.t('field.quota'),\n record: {\n editable: true\n },\n width: 60\n },\n {\n type: 'crontab',\n name: 'spec',\n header: i18next.t('field.spec'),\n record: {\n editable: true,\n options: {\n name,\n objectified: true\n }\n },\n width: 200\n }\n ],\n rows: {\n selectable: {\n multiple: true\n }\n },\n pagination: {\n infinite: true\n },\n sorters: [\n {\n name: 'sequence'\n }\n ]\n }\n\n render() {\n const mode = this.mode || 'CARD'\n\n return html`\n <ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${fetchHandler}>\n <div id=\"filters\" slot=\"headroom\">\n <ox-filters-form @filters-change=${(e: CustomEvent) => console.log('changed', e.detail)}></ox-filters-form>\n </div>\n\n <div slot=\"headroom\" id=\"headroom\">\n <div id=\"modes\">\n <mwc-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</mwc-icon>\n <mwc-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</mwc-icon>\n </div>\n </div>\n </ox-grist>\n `\n }\n}\n\ncustomElements.define('ox-grist-demo', GristDemo)\n\nexport default {\n title: 'ox-grist-editor-crontab',\n component: 'ox-grist-editor-crontab',\n argTypes: {}\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {}\n\nconst Template: Story<ArgTypes> = ({}: ArgTypes) =>\n html`\n <link href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\" rel=\"stylesheet\" />\n <link href=\"/themes/app-theme.css\" rel=\"stylesheet\" />\n <link href=\"/themes/oops-theme.css\" rel=\"stylesheet\" />\n <link href=\"/themes/grist-theme.css\" rel=\"stylesheet\" />\n\n <style>\n [slot='headroom'] {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: var(--padding-default) var(--padding-wide);\n border-top: 2px solid rgba(0, 0, 0, 0.2);\n background-color: var(--theme-white-color);\n box-shadow: var(--box-shadow);\n\n --mdc-icon-size: 24px;\n }\n #sorters mwc-icon,\n #modes mwc-icon {\n --mdc-icon-size: 18px;\n }\n #sorters {\n margin-left: auto;\n margin-right: var(--margin-default);\n padding-left: var(--padding-narrow);\n border-bottom: var(--border-dark-color);\n position: relative;\n color: var(--secondary-color);\n font-size: var(--fontsize-default);\n user-select: none;\n }\n\n #sorters > * {\n padding: var(--padding-narrow);\n vertical-align: middle;\n }\n\n #filters {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n #filters * {\n margin-right: var(--margin-default);\n }\n\n @media only screen and (max-width: 460px) {\n #filters {\n flex-direction: column;\n }\n\n #modes {\n display: none;\n }\n }\n </style>\n\n <ox-grist-demo mode=\"LIST\"></ox-grist-demo>\n `\n\nexport const Regular = Template.bind({})\nRegular.args = {}\n"]}