@operato/grist-editor 9.0.0-beta.6 → 9.0.0-beta.62

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/grist-editor",
3
- "version": "9.0.0-beta.6",
3
+ "version": "9.0.0-beta.62",
4
4
  "description": "Webcomponent for grist-editor following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "type": "module",
@@ -111,13 +111,13 @@
111
111
  },
112
112
  "dependencies": {
113
113
  "@material/web": "^2.0.0",
114
- "@operato/data-grist": "^9.0.0-beta.6",
115
- "@operato/help": "^9.0.0-beta.6",
116
- "@operato/i18n": "^9.0.0-beta.5",
117
- "@operato/input": "^9.0.0-beta.6",
118
- "@operato/popup": "^9.0.0-beta.6",
119
- "@operato/property-editor": "^9.0.0-beta.6",
120
- "@operato/styles": "^9.0.0-beta.6",
114
+ "@operato/data-grist": "^9.0.0-beta.62",
115
+ "@operato/help": "^9.0.0-beta.62",
116
+ "@operato/i18n": "^9.0.0-beta.37",
117
+ "@operato/input": "^9.0.0-beta.61",
118
+ "@operato/popup": "^9.0.0-beta.52",
119
+ "@operato/property-editor": "^9.0.0-beta.62",
120
+ "@operato/styles": "^9.0.0-beta.47",
121
121
  "cronstrue": "^2.2.0",
122
122
  "cross-fetch": "^3.1.5",
123
123
  "lit": "^3.1.2",
@@ -157,5 +157,5 @@
157
157
  "prettier --write"
158
158
  ]
159
159
  },
160
- "gitHead": "7e4dd57049f0a3dd0cbd194f7998e81f3b2c7559"
160
+ "gitHead": "ce8ef98553e40dbf150cfac5f1ebe574dc22d426"
161
161
  }
@@ -1,24 +0,0 @@
1
- import '@operato/property-editor/ox-property-editor-checkbox.js';
2
- import '@operato/property-editor/ox-property-editor-number.js';
3
- import '@operato/property-editor/ox-property-editor-string.js';
4
- import '@operato/property-editor/ox-property-editor-options.js';
5
- import '@operato/property-editor/ox-properties-dynamic-view.js';
6
- import '@operato/data-grist';
7
- import '@operato/data-grist/ox-filters-form.js';
8
- import '@operato/data-grist/ox-sorters-control.js';
9
- import '@material/web/icon/icon.js';
10
- import { TemplateResult } from 'lit';
11
- declare const _default: {
12
- title: string;
13
- component: string;
14
- argTypes: {};
15
- };
16
- export default _default;
17
- interface Story<T> {
18
- (args: T): TemplateResult;
19
- args?: Partial<T>;
20
- argTypes?: Record<string, unknown>;
21
- }
22
- interface ArgTypes {
23
- }
24
- export declare const Regular: Story<ArgTypes>;
@@ -1,429 +0,0 @@
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/web/icon/icon.js';
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 { OxGristRendererDuration } from '../src/ox-grist-renderer-duration.js';
25
- // import { OxGristEditorJson } from './ox-grist-editor-json.js'
26
- // import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'
27
- OxPropertyEditor.register({
28
- number: 'ox-property-editor-number',
29
- string: 'ox-property-editor-string',
30
- boolean: 'ox-property-editor-checkbox',
31
- options: 'ox-property-editor-options'
32
- });
33
- registerEditor('parameters', OxGristEditorParameters);
34
- registerEditor('crontab', OxGristEditorCrontab);
35
- registerEditor('value-map', OxGristEditorValueMap);
36
- registerEditor('partition-keys', OxGristEditorPartitionKeys);
37
- /* register grist renderer/editor for id */
38
- // registerEditor('resource-id', OxGristEditorResourceId)
39
- // registerEditor('resource-object', OxGristEditorResourceObject)
40
- // registerEditor('resource-code', OxGristEditorResourceCode)
41
- registerEditor('parameters', OxGristEditorParameters);
42
- registerEditor('value-map', OxGristEditorValueMap);
43
- registerEditor('partition-keys', OxGristEditorPartitionKeys);
44
- registerEditor('crontab', OxGristEditorCrontab);
45
- registerEditor('duration', OxGristEditorDuration);
46
- // registerEditor('json', OxGristEditorJson)
47
- // registerRenderer('resource-id', OxGristRendererResourceId)
48
- // registerRenderer('resource-object', OxGristRendererResourceObject)
49
- registerRenderer('parameters', OxGristRendererJson5);
50
- registerRenderer('value-map', OxGristRendererJson5);
51
- registerRenderer('partition-keys', OxGristRendererJson5);
52
- registerRenderer('duration', OxGristRendererDuration);
53
- // registerRenderer('crontab', OxGristRendererCrontab)
54
- const fetchHandler = async ({ page = 1, limit = 100, sortings = [], filters = [] }) => {
55
- var total = 10;
56
- var start = (page - 1) * limit;
57
- return {
58
- total,
59
- records: Array(limit * page > total ? total % limit : limit)
60
- .fill('')
61
- .map((item, idx) => {
62
- return {
63
- id: idx,
64
- name: `name-${start + idx + 1}`,
65
- description: `description-${start + idx + 1}`,
66
- sequence: idx + 1,
67
- active: true,
68
- tag: `tag-${idx + 1}`,
69
- type: idx % 3 === 0 ? 'select' : idx % 3 === 1 ? 'number' : 'string',
70
- spec: {
71
- ccp: {
72
- criticalLimits: 100,
73
- targetLimits: 200
74
- },
75
- qc: {
76
- criticalLimits: 300,
77
- targetLimits: true
78
- }
79
- },
80
- options: idx % 2 === 0
81
- ? {
82
- options: [
83
- {
84
- text: 'A',
85
- value: 'a'
86
- },
87
- {
88
- text: 'B',
89
- value: 'b'
90
- }
91
- ]
92
- }
93
- : undefined,
94
- schedule: '* * * * * *',
95
- duration: -3600,
96
- keyvalue: {},
97
- createdAt: Date.now(),
98
- updatedAt: Date.now()
99
- };
100
- })
101
- };
102
- };
103
- class GristDemo extends LitElement {
104
- constructor() {
105
- super(...arguments);
106
- this.mode = 'CARD';
107
- this.config = {
108
- list: { fields: ['name', 'description', 'active'] },
109
- columns: [
110
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
111
- {
112
- type: 'gutter',
113
- gutterName: 'button',
114
- icon: 'add',
115
- handlers: {
116
- click: 'record-copy'
117
- }
118
- },
119
- { type: 'gutter', gutterName: 'sequence' },
120
- {
121
- type: 'gutter',
122
- gutterName: 'button',
123
- icon: 'arrow_upward',
124
- handlers: {
125
- click: 'move-up'
126
- }
127
- },
128
- {
129
- type: 'gutter',
130
- gutterName: 'button',
131
- icon: 'arrow_downward',
132
- handlers: {
133
- click: 'move-down'
134
- }
135
- },
136
- {
137
- type: 'number',
138
- name: 'sequence',
139
- hidden: true
140
- },
141
- {
142
- type: 'string',
143
- name: 'id',
144
- hidden: true
145
- },
146
- {
147
- type: 'string',
148
- name: 'name',
149
- header: i18next.t('field.name'),
150
- record: {
151
- editable: true
152
- },
153
- width: 140
154
- },
155
- {
156
- type: 'string',
157
- name: 'description',
158
- header: i18next.t('field.description'),
159
- record: {
160
- editable: true
161
- },
162
- width: 180
163
- },
164
- {
165
- type: 'checkbox',
166
- name: 'active',
167
- label: true,
168
- header: i18next.t('field.active'),
169
- record: {
170
- editable: true
171
- },
172
- sortable: true,
173
- width: 60
174
- },
175
- {
176
- type: 'string',
177
- name: 'tag',
178
- header: i18next.t('field.tag'),
179
- record: {
180
- editable: true
181
- },
182
- width: 180
183
- },
184
- {
185
- type: 'select',
186
- name: 'type',
187
- header: i18next.t('field.type'),
188
- record: {
189
- options: ['', 'number', 'text', 'select', 'boolean', 'file'],
190
- editable: true
191
- },
192
- width: 120
193
- },
194
- {
195
- type: 'crontab',
196
- name: 'schedule',
197
- header: i18next.t('field.schedule'),
198
- record: {
199
- editable: true
200
- },
201
- width: 120
202
- },
203
- {
204
- type: 'duration',
205
- name: 'duration',
206
- header: i18next.t('field.duration'),
207
- record: {
208
- editable: true
209
- },
210
- width: 120
211
- },
212
- {
213
- type: 'partition-keys',
214
- name: 'keyvalue',
215
- header: i18next.t('field.keyvalue'),
216
- record: {
217
- editable: true,
218
- options: {
219
- objectified: true,
220
- valuetype: 'string'
221
- }
222
- },
223
- width: 120
224
- },
225
- {
226
- type: 'parameters',
227
- name: 'options',
228
- header: i18next.t('field.options'),
229
- record: {
230
- editable: true,
231
- renderer: (value) => {
232
- return typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : '';
233
- },
234
- options: async (value, column, record, row, field) => {
235
- return {
236
- name: record.type,
237
- help: '',
238
- spec: record.type === 'select'
239
- ? [
240
- {
241
- type: 'options',
242
- name: 'options',
243
- label: 'options'
244
- }
245
- ]
246
- : [],
247
- context: this.grist,
248
- objectified: true /* tell parameters editor not to need to parse */
249
- };
250
- }
251
- },
252
- width: 120
253
- },
254
- {
255
- type: 'string',
256
- name: 'unit',
257
- header: i18next.t('field.unit'),
258
- record: {
259
- editable: true
260
- },
261
- width: 120
262
- },
263
- {
264
- type: 'number',
265
- name: 'quota',
266
- header: i18next.t('field.quota'),
267
- record: {
268
- editable: true
269
- },
270
- width: 60
271
- },
272
- {
273
- type: 'crontab',
274
- name: 'spec',
275
- header: i18next.t('field.spec'),
276
- record: {
277
- editable: true,
278
- options: {
279
- name,
280
- objectified: true
281
- }
282
- },
283
- width: 200
284
- }
285
- ],
286
- rows: {
287
- selectable: {
288
- multiple: true
289
- }
290
- },
291
- pagination: {
292
- infinite: true
293
- },
294
- sorters: [
295
- {
296
- name: 'sequence'
297
- }
298
- ]
299
- };
300
- }
301
- get grist() {
302
- return this.renderRoot.querySelector('ox-grist');
303
- }
304
- render() {
305
- const mode = this.mode || 'CARD';
306
- return html `
307
- <ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${fetchHandler}>
308
- <div id="filters" slot="headroom">
309
- <ox-filters-form @filters-change=${(e) => console.log('changed', e.detail)}></ox-filters-form>
310
- </div>
311
-
312
- <div slot="headroom" id="headroom">
313
- <div id="modes">
314
- <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</md-icon>
315
- <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</md-icon>
316
- <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
317
- </div>
318
- </div>
319
- </ox-grist>
320
- `;
321
- }
322
- }
323
- GristDemo.styles = [
324
- CommonGristStyles,
325
- css `
326
- :host {
327
- display: flex;
328
- flex-direction: column;
329
- }
330
-
331
- #tailer {
332
- display: flex;
333
- flex-direction: row;
334
- margin: 0 var(--spacing-medium);
335
- }
336
-
337
- #tailer a {
338
- padding: 0 var(--padding-default) 0 var(--padding-default);
339
- margin: 0 var(--spacing-small);
340
- border-right: 1px solid rgba(0, 0, 0, 0.1);
341
- font-size: var(--fontsize-default);
342
- color: var(--md-sys-color-on-primary-container);
343
- }
344
- `
345
- ];
346
- __decorate([
347
- state()
348
- ], GristDemo.prototype, "mode", void 0);
349
- customElements.define('ox-grist-demo', GristDemo);
350
- export default {
351
- title: 'ox-grist-editor-crontab',
352
- component: 'ox-grist-editor-crontab',
353
- argTypes: {}
354
- };
355
- const Template = ({}) => html `
356
- <link
357
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
358
- rel="stylesheet"
359
- />
360
- <link
361
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
362
- rel="stylesheet"
363
- />
364
- <link
365
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
366
- rel="stylesheet"
367
- />
368
-
369
- <link href="/themes/app-theme.css" rel="stylesheet" />
370
- <link href="/themes/oops-theme.css" rel="stylesheet" />
371
- <link href="/themes/grist-theme.css" rel="stylesheet" />
372
-
373
- <style>
374
- [slot='headroom'] {
375
- display: flex;
376
- flex-direction: row;
377
- align-items: center;
378
- padding: var(--padding-default) var(--spacing-large);
379
- background-color: var(--md-sys-color-surface);
380
- box-shadow: var(--box-shadow);
381
-
382
- --md-icon-size: 24px;
383
- }
384
- #sorters md-icon,
385
- #modes md-icon {
386
- --md-icon-size: 18px;
387
- }
388
- #sorters {
389
- margin-left: auto;
390
- margin-right: var(--spacing-medium);
391
- padding-left: var(--spacing-small);
392
- border-bottom: var(--border-dim-color);
393
- position: relative;
394
- color: var(--md-sys-color-on-secondary-container);
395
- font-size: var(--fontsize-default);
396
- user-select: none;
397
- }
398
-
399
- #sorters > * {
400
- padding: var(--spacing-small);
401
- vertical-align: middle;
402
- }
403
-
404
- #filters {
405
- display: flex;
406
- justify-content: center;
407
- align-items: center;
408
- }
409
-
410
- #filters * {
411
- margin-right: var(--spacing-medium);
412
- }
413
-
414
- @media only screen and (max-width: 460px) {
415
- #filters {
416
- flex-direction: column;
417
- }
418
-
419
- #modes {
420
- display: none;
421
- }
422
- }
423
- </style>
424
-
425
- <ox-grist-demo mode="LIST"></ox-grist-demo>
426
- `;
427
- export const Regular = Template.bind({});
428
- Regular.args = {};
429
- //# sourceMappingURL=ox-grist-editor-crontab.stories.js.map
@@ -1 +0,0 @@
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;AA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sB;AA8NhC,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,SAAS,CAAC,CAAA;AAEjD,eAAe;IACb,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,yBAAyB;IACpC,QAAQ,EAAE,EAAE;CACb,CAAA;AAUD,MAAM,QAAQ,GAAoB,CAAC,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEvD,CAAA;AAED,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/web/icon/icon.js'\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'\nimport { OxGristRendererDuration } from '../src/ox-grist-renderer-duration.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)\nregisterRenderer('duration', OxGristRendererDuration)\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 duration: -3600,\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(--spacing-medium);\n }\n\n #tailer a {\n padding: 0 var(--padding-default) 0 var(--padding-default);\n margin: 0 var(--spacing-small);\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n font-size: var(--fontsize-default);\n color: var(--md-sys-color-on-primary-container);\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: 'duration',\n name: 'duration',\n header: i18next.t('field.duration'),\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 <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</md-icon>\n <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</md-icon>\n <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-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) => html`\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\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(--spacing-large);\n background-color: var(--md-sys-color-surface);\n box-shadow: var(--box-shadow);\n\n --md-icon-size: 24px;\n }\n #sorters md-icon,\n #modes md-icon {\n --md-icon-size: 18px;\n }\n #sorters {\n margin-left: auto;\n margin-right: var(--spacing-medium);\n padding-left: var(--spacing-small);\n border-bottom: var(--border-dim-color);\n position: relative;\n color: var(--md-sys-color-on-secondary-container);\n font-size: var(--fontsize-default);\n user-select: none;\n }\n\n #sorters > * {\n padding: var(--spacing-small);\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(--spacing-medium);\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"]}