@operato/grist-editor 10.29.81 → 10.29.83

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 (36) hide show
  1. package/dist/stories/ox-grist-editor-crontab.stories.d.ts +24 -0
  2. package/dist/stories/ox-grist-editor-crontab.stories.js +429 -0
  3. package/package.json +23 -9
  4. package/CHANGELOG.md +0 -5850
  5. package/dist/src/index.js.map +0 -1
  6. package/dist/src/ox-grist-editor-crontab.js.map +0 -1
  7. package/dist/src/ox-grist-editor-data.js.map +0 -1
  8. package/dist/src/ox-grist-editor-duration.js.map +0 -1
  9. package/dist/src/ox-grist-editor-formula.js.map +0 -1
  10. package/dist/src/ox-grist-editor-hashtags.js.map +0 -1
  11. package/dist/src/ox-grist-editor-i18n-label.js.map +0 -1
  12. package/dist/src/ox-grist-editor-parameters.js.map +0 -1
  13. package/dist/src/ox-grist-editor-partition-keys.js.map +0 -1
  14. package/dist/src/ox-grist-editor-quantifier.js.map +0 -1
  15. package/dist/src/ox-grist-editor-signature.js.map +0 -1
  16. package/dist/src/ox-grist-editor-value-map.js.map +0 -1
  17. package/dist/src/ox-grist-editor-value-ranges.js.map +0 -1
  18. package/dist/src/ox-grist-renderer-crontab.js.map +0 -1
  19. package/dist/src/ox-grist-renderer-duration.js.map +0 -1
  20. package/dist/src/ox-grist-renderer-hashtags.js.map +0 -1
  21. package/dist/src/ox-grist-renderer-i18n-label.js.map +0 -1
  22. package/dist/src/ox-grist-renderer-partition-keys.js.map +0 -1
  23. package/dist/src/ox-grist-renderer-quantifier.js.map +0 -1
  24. package/dist/src/ox-grist-renderer-signature.js.map +0 -1
  25. package/dist/src/ox-parameters-builder.js.map +0 -1
  26. package/dist/src/ox-popup-crontab-input.js.map +0 -1
  27. package/dist/src/ox-popup-data-input.js.map +0 -1
  28. package/dist/src/ox-popup-duration-input.js.map +0 -1
  29. package/dist/src/ox-popup-formula-input.js.map +0 -1
  30. package/dist/src/ox-popup-hashtags-input.js.map +0 -1
  31. package/dist/src/ox-popup-i18n-label-input.js.map +0 -1
  32. package/dist/src/ox-popup-parameters-builder.js.map +0 -1
  33. package/dist/src/ox-popup-partition-keys-input.js.map +0 -1
  34. package/dist/src/ox-popup-value-map-input.js.map +0 -1
  35. package/dist/src/ox-popup-value-ranges-input.js.map +0 -1
  36. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,24 @@
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>;
@@ -0,0 +1,429 @@
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/grist-editor",
3
- "version": "10.29.81",
3
+ "version": "10.29.83",
4
4
  "description": "Webcomponent for grist-editor following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "type": "module",
@@ -41,6 +41,20 @@
41
41
  "./ox-grist-editor-data.js": "./dist/src/ox-grist-editor-data.js",
42
42
  "./ox-grist-editor-formula.js": "./dist/src/ox-grist-editor-formula.js"
43
43
  },
44
+ "files": [
45
+ "README.md",
46
+ "dist",
47
+ "themes",
48
+ "translations",
49
+ "!**/*.map",
50
+ "!**/*.test.*",
51
+ "!**/*.spec.*",
52
+ "!**/test/**",
53
+ "!**/tests/**",
54
+ "!**/__tests__/**",
55
+ "!**/*.tsbuildinfo",
56
+ "!**/.DS_Store"
57
+ ],
44
58
  "typesVersions": {
45
59
  "*": {
46
60
  "ox-grist-editor-crontab.js": [
@@ -119,13 +133,13 @@
119
133
  },
120
134
  "dependencies": {
121
135
  "@material/web": "^2.0.0",
122
- "@operato/data-grist": "^10.29.81",
123
- "@operato/help": "^10.29.81",
124
- "@operato/i18n": "^10.29.27",
125
- "@operato/input": "^10.29.81",
126
- "@operato/popup": "^10.29.81",
127
- "@operato/property-editor": "^10.29.81",
128
- "@operato/styles": "^10.29.81",
136
+ "@operato/data-grist": "^10.29.83",
137
+ "@operato/help": "^10.29.83",
138
+ "@operato/i18n": "^10.29.83",
139
+ "@operato/input": "^10.29.83",
140
+ "@operato/popup": "^10.29.83",
141
+ "@operato/property-editor": "^10.29.83",
142
+ "@operato/styles": "^10.29.83",
129
143
  "cronstrue": "^2.2.0",
130
144
  "cross-fetch": "^3.1.5",
131
145
  "lit": "^3.1.2",
@@ -165,5 +179,5 @@
165
179
  "prettier --write"
166
180
  ]
167
181
  },
168
- "gitHead": "e59c974dc6f94baeea7e1b21224bb347bbd222a7"
182
+ "gitHead": "2ca4d6573a612baf0613c92dce13b424604022d5"
169
183
  }