@operato/grist-editor 8.0.0-alpha.9 → 8.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +187 -0
  2. package/dist/src/ox-grist-renderer-hashtags.js +0 -1
  3. package/dist/src/ox-grist-renderer-hashtags.js.map +1 -1
  4. package/dist/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +17 -17
  6. package/.storybook/main.js +0 -3
  7. package/.storybook/preview.js +0 -52
  8. package/.storybook/server.mjs +0 -8
  9. package/src/index.ts +0 -40
  10. package/src/ox-grist-editor-crontab.ts +0 -63
  11. package/src/ox-grist-editor-duration.ts +0 -63
  12. package/src/ox-grist-editor-hashtags.ts +0 -68
  13. package/src/ox-grist-editor-i18n-label.ts +0 -101
  14. package/src/ox-grist-editor-parameters.ts +0 -100
  15. package/src/ox-grist-editor-partition-keys.ts +0 -88
  16. package/src/ox-grist-editor-quantifier.ts +0 -13
  17. package/src/ox-grist-editor-signature.ts +0 -13
  18. package/src/ox-grist-editor-value-map.ts +0 -97
  19. package/src/ox-grist-editor-value-ranges.ts +0 -96
  20. package/src/ox-grist-renderer-crontab.ts +0 -18
  21. package/src/ox-grist-renderer-duration.ts +0 -31
  22. package/src/ox-grist-renderer-hashtags.ts +0 -14
  23. package/src/ox-grist-renderer-i18n-label.ts +0 -12
  24. package/src/ox-grist-renderer-partition-keys.ts +0 -29
  25. package/src/ox-grist-renderer-quantifier.ts +0 -9
  26. package/src/ox-grist-renderer-signature.ts +0 -9
  27. package/src/ox-parameters-builder.ts +0 -134
  28. package/src/ox-popup-crontab-input.ts +0 -75
  29. package/src/ox-popup-duration-input.ts +0 -65
  30. package/src/ox-popup-hashtags-input.ts +0 -66
  31. package/src/ox-popup-i18n-label-input.ts +0 -98
  32. package/src/ox-popup-parameters-builder.ts +0 -112
  33. package/src/ox-popup-partition-keys-input.ts +0 -97
  34. package/src/ox-popup-value-map-input.ts +0 -105
  35. package/src/ox-popup-value-ranges-input.ts +0 -104
  36. package/stories/ox-grist-editor-crontab.stories.ts +0 -451
  37. package/tsconfig.json +0 -24
  38. package/web-dev-server.config.mjs +0 -28
  39. package/web-test-runner.config.mjs +0 -29
@@ -1,451 +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
-
11
- /* set grist-editors */
12
- import { css, html, LitElement, TemplateResult } from 'lit'
13
- import { state } from 'lit/decorators.js'
14
-
15
- import { FetchOption, GristRecord, OxGristRendererJson5, registerEditor, registerRenderer } from '@operato/data-grist'
16
- import { i18next } from '@operato/i18n'
17
- import { OxPropertyEditor } from '@operato/property-editor'
18
- import { CommonGristStyles } from '@operato/styles'
19
-
20
- import { OxGristEditorCrontab } from '../src/ox-grist-editor-crontab.js'
21
- import { OxGristEditorDuration } from '../src/ox-grist-editor-duration.js'
22
- import { OxGristEditorParameters } from '../src/ox-grist-editor-parameters.js'
23
- import { OxGristEditorPartitionKeys } from '../src/ox-grist-editor-partition-keys.js'
24
- // import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'
25
- import { OxGristEditorValueMap } from '../src/ox-grist-editor-value-map.js'
26
- import { OxGristRendererDuration } from '../src/ox-grist-renderer-duration.js'
27
-
28
- // import { OxGristEditorJson } from './ox-grist-editor-json.js'
29
- // import { OxGristRendererCrontab } from '../src/ox-grist-renderer-crontab.js'
30
-
31
- OxPropertyEditor.register({
32
- number: 'ox-property-editor-number',
33
- string: 'ox-property-editor-string',
34
- boolean: 'ox-property-editor-checkbox',
35
- options: 'ox-property-editor-options'
36
- })
37
-
38
- registerEditor('parameters', OxGristEditorParameters)
39
- registerEditor('crontab', OxGristEditorCrontab)
40
- registerEditor('value-map', OxGristEditorValueMap)
41
- registerEditor('partition-keys', OxGristEditorPartitionKeys)
42
-
43
- /* register grist renderer/editor for id */
44
- // registerEditor('resource-id', OxGristEditorResourceId)
45
- // registerEditor('resource-object', OxGristEditorResourceObject)
46
- // registerEditor('resource-code', OxGristEditorResourceCode)
47
- registerEditor('parameters', OxGristEditorParameters)
48
- registerEditor('value-map', OxGristEditorValueMap)
49
- registerEditor('partition-keys', OxGristEditorPartitionKeys)
50
- registerEditor('crontab', OxGristEditorCrontab)
51
- registerEditor('duration', OxGristEditorDuration)
52
- // registerEditor('json', OxGristEditorJson)
53
-
54
- // registerRenderer('resource-id', OxGristRendererResourceId)
55
- // registerRenderer('resource-object', OxGristRendererResourceObject)
56
- registerRenderer('parameters', OxGristRendererJson5)
57
- registerRenderer('value-map', OxGristRendererJson5)
58
- registerRenderer('partition-keys', OxGristRendererJson5)
59
- registerRenderer('duration', OxGristRendererDuration)
60
- // registerRenderer('crontab', OxGristRendererCrontab)
61
-
62
- const fetchHandler = async ({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) => {
63
- var total = 10
64
- var start = (page - 1) * limit
65
-
66
- return {
67
- total,
68
- records: Array(limit * page > total ? total % limit : limit)
69
- .fill('')
70
- .map((item, idx) => {
71
- return {
72
- id: idx,
73
- name: `name-${start + idx + 1}`,
74
- description: `description-${start + idx + 1}`,
75
- sequence: idx + 1,
76
- active: true,
77
- tag: `tag-${idx + 1}`,
78
- type: idx % 3 === 0 ? 'select' : idx % 3 === 1 ? 'number' : 'string',
79
- spec: {
80
- ccp: {
81
- criticalLimits: 100,
82
- targetLimits: 200
83
- },
84
- qc: {
85
- criticalLimits: 300,
86
- targetLimits: true
87
- }
88
- },
89
- options:
90
- idx % 2 === 0
91
- ? {
92
- options: [
93
- {
94
- text: 'A',
95
- value: 'a'
96
- },
97
- {
98
- text: 'B',
99
- value: 'b'
100
- }
101
- ]
102
- }
103
- : undefined,
104
- schedule: '* * * * * *',
105
- duration: -3600,
106
- keyvalue: {},
107
- createdAt: Date.now(),
108
- updatedAt: Date.now()
109
- }
110
- })
111
- }
112
- }
113
-
114
- class GristDemo extends LitElement {
115
- static styles = [
116
- CommonGristStyles,
117
- css`
118
- :host {
119
- display: flex;
120
- flex-direction: column;
121
- }
122
-
123
- #tailer {
124
- display: flex;
125
- flex-direction: row;
126
- margin: 0 var(--spacing-medium);
127
- }
128
-
129
- #tailer a {
130
- padding: 0 var(--padding-default) 0 var(--padding-default);
131
- margin: 0 var(--spacing-small);
132
- border-right: 1px solid rgba(0, 0, 0, 0.1);
133
- font-size: var(--fontsize-default);
134
- color: var(--md-sys-color-on-primary-container);
135
- }
136
- `
137
- ]
138
-
139
- @state() mode: String = 'CARD'
140
-
141
- get grist() {
142
- return this.renderRoot.querySelector('ox-grist')
143
- }
144
-
145
- config: any = {
146
- list: { fields: ['name', 'description', 'active'] },
147
- columns: [
148
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
149
- {
150
- type: 'gutter',
151
- gutterName: 'button',
152
- icon: 'add',
153
- handlers: {
154
- click: 'record-copy'
155
- }
156
- },
157
- { type: 'gutter', gutterName: 'sequence' },
158
- {
159
- type: 'gutter',
160
- gutterName: 'button',
161
- icon: 'arrow_upward',
162
- handlers: {
163
- click: 'move-up'
164
- }
165
- },
166
- {
167
- type: 'gutter',
168
- gutterName: 'button',
169
- icon: 'arrow_downward',
170
- handlers: {
171
- click: 'move-down'
172
- }
173
- },
174
- {
175
- type: 'number',
176
- name: 'sequence',
177
- hidden: true
178
- },
179
- {
180
- type: 'string',
181
- name: 'id',
182
- hidden: true
183
- },
184
- {
185
- type: 'string',
186
- name: 'name',
187
- header: i18next.t('field.name'),
188
- record: {
189
- editable: true
190
- },
191
- width: 140
192
- },
193
- {
194
- type: 'string',
195
- name: 'description',
196
- header: i18next.t('field.description'),
197
- record: {
198
- editable: true
199
- },
200
- width: 180
201
- },
202
- {
203
- type: 'checkbox',
204
- name: 'active',
205
- label: true,
206
- header: i18next.t('field.active'),
207
- record: {
208
- editable: true
209
- },
210
- sortable: true,
211
- width: 60
212
- },
213
- {
214
- type: 'string',
215
- name: 'tag',
216
- header: i18next.t('field.tag'),
217
- record: {
218
- editable: true
219
- },
220
- width: 180
221
- },
222
- {
223
- type: 'select',
224
- name: 'type',
225
- header: i18next.t('field.type'),
226
- record: {
227
- options: ['', 'number', 'text', 'select', 'boolean', 'file'],
228
- editable: true
229
- },
230
- width: 120
231
- },
232
- {
233
- type: 'crontab',
234
- name: 'schedule',
235
- header: i18next.t('field.schedule'),
236
- record: {
237
- editable: true
238
- },
239
- width: 120
240
- },
241
- {
242
- type: 'duration',
243
- name: 'duration',
244
- header: i18next.t('field.duration'),
245
- record: {
246
- editable: true
247
- },
248
- width: 120
249
- },
250
- {
251
- type: 'partition-keys',
252
- name: 'keyvalue',
253
- header: i18next.t('field.keyvalue'),
254
- record: {
255
- editable: true,
256
- options: {
257
- objectified: true,
258
- valuetype: 'string'
259
- }
260
- },
261
- width: 120
262
- },
263
- {
264
- type: 'parameters',
265
- name: 'options',
266
- header: i18next.t('field.options'),
267
- record: {
268
- editable: true,
269
- renderer: (value: any) => {
270
- return typeof value === 'string' ? value : typeof value === 'object' ? JSON.stringify(value) : ''
271
- },
272
- options: async (value: any, column: any, record: GristRecord, row: GristRecord, field: any) => {
273
- return {
274
- name: record.type,
275
- help: '',
276
- spec:
277
- record.type === 'select'
278
- ? [
279
- {
280
- type: 'options',
281
- name: 'options',
282
- label: 'options'
283
- }
284
- ]
285
- : [],
286
- context: this.grist,
287
- objectified: true /* tell parameters editor not to need to parse */
288
- }
289
- }
290
- },
291
- width: 120
292
- },
293
- {
294
- type: 'string',
295
- name: 'unit',
296
- header: i18next.t('field.unit'),
297
- record: {
298
- editable: true
299
- },
300
- width: 120
301
- },
302
- {
303
- type: 'number',
304
- name: 'quota',
305
- header: i18next.t('field.quota'),
306
- record: {
307
- editable: true
308
- },
309
- width: 60
310
- },
311
- {
312
- type: 'crontab',
313
- name: 'spec',
314
- header: i18next.t('field.spec'),
315
- record: {
316
- editable: true,
317
- options: {
318
- name,
319
- objectified: true
320
- }
321
- },
322
- width: 200
323
- }
324
- ],
325
- rows: {
326
- selectable: {
327
- multiple: true
328
- }
329
- },
330
- pagination: {
331
- infinite: true
332
- },
333
- sorters: [
334
- {
335
- name: 'sequence'
336
- }
337
- ]
338
- }
339
-
340
- render() {
341
- const mode = this.mode || 'CARD'
342
-
343
- return html`
344
- <ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${fetchHandler}>
345
- <div id="filters" slot="headroom">
346
- <ox-filters-form @filters-change=${(e: CustomEvent) => console.log('changed', e.detail)}></ox-filters-form>
347
- </div>
348
-
349
- <div slot="headroom" id="headroom">
350
- <div id="modes">
351
- <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>view_list</md-icon>
352
- <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>menu</md-icon>
353
- <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
354
- </div>
355
- </div>
356
- </ox-grist>
357
- `
358
- }
359
- }
360
-
361
- customElements.define('ox-grist-demo', GristDemo)
362
-
363
- export default {
364
- title: 'ox-grist-editor-crontab',
365
- component: 'ox-grist-editor-crontab',
366
- argTypes: {}
367
- }
368
-
369
- interface Story<T> {
370
- (args: T): TemplateResult
371
- args?: Partial<T>
372
- argTypes?: Record<string, unknown>
373
- }
374
-
375
- interface ArgTypes {}
376
-
377
- const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
378
- <link
379
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
380
- rel="stylesheet"
381
- />
382
- <link
383
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
384
- rel="stylesheet"
385
- />
386
- <link
387
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
388
- rel="stylesheet"
389
- />
390
-
391
- <link href="/themes/app-theme.css" rel="stylesheet" />
392
- <link href="/themes/oops-theme.css" rel="stylesheet" />
393
- <link href="/themes/grist-theme.css" rel="stylesheet" />
394
-
395
- <style>
396
- [slot='headroom'] {
397
- display: flex;
398
- flex-direction: row;
399
- align-items: center;
400
- padding: var(--padding-default) var(--spacing-large);
401
- background-color: var(--md-sys-color-surface);
402
- box-shadow: var(--box-shadow);
403
-
404
- --md-icon-size: 24px;
405
- }
406
- #sorters md-icon,
407
- #modes md-icon {
408
- --md-icon-size: 18px;
409
- }
410
- #sorters {
411
- margin-left: auto;
412
- margin-right: var(--spacing-medium);
413
- padding-left: var(--spacing-small);
414
- border-bottom: var(--border-dim-color);
415
- position: relative;
416
- color: var(--md-sys-color-on-secondary-container);
417
- font-size: var(--fontsize-default);
418
- user-select: none;
419
- }
420
-
421
- #sorters > * {
422
- padding: var(--spacing-small);
423
- vertical-align: middle;
424
- }
425
-
426
- #filters {
427
- display: flex;
428
- justify-content: center;
429
- align-items: center;
430
- }
431
-
432
- #filters * {
433
- margin-right: var(--spacing-medium);
434
- }
435
-
436
- @media only screen and (max-width: 460px) {
437
- #filters {
438
- flex-direction: column;
439
- }
440
-
441
- #modes {
442
- display: none;
443
- }
444
- }
445
- </style>
446
-
447
- <ox-grist-demo mode="LIST"></ox-grist-demo>
448
- `
449
-
450
- export const Regular = Template.bind({})
451
- Regular.args = {}
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2018",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "noEmitOnError": true,
7
- "lib": ["es2017", "dom"],
8
- "strict": true,
9
- "esModuleInterop": false,
10
- "allowSyntheticDefaultImports": true,
11
- "experimentalDecorators": true,
12
- "useDefineForClassFields": false,
13
- "importHelpers": true,
14
- "outDir": "dist",
15
- "sourceMap": true,
16
- "inlineSources": true,
17
- "rootDir": "./",
18
- "declaration": true,
19
- "incremental": true,
20
- "skipLibCheck": true,
21
- "types": ["node", "mocha"]
22
- },
23
- "include": ["**/*.ts"]
24
- }
@@ -1,28 +0,0 @@
1
- // import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
2
-
3
- /** Use Hot Module replacement by adding --hmr to the start command */
4
- const hmr = process.argv.includes('--hmr')
5
-
6
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
- nodeResolve: true,
8
- open: '/demo/',
9
- watch: !hmr,
10
-
11
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
12
- // esbuildTarget: 'auto'
13
-
14
- /** Set appIndex to enable SPA routing */
15
- // appIndex: 'demo/index.html',
16
-
17
- /** Confgure bare import resolve plugin */
18
- // nodeResolve: {
19
- // exportConditions: ['browser', 'development']
20
- // },
21
-
22
- plugins: [
23
- /** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
24
- // hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
25
- ]
26
-
27
- // See documentation for all available options
28
- })
@@ -1,29 +0,0 @@
1
- // import { playwrightLauncher } from '@web/test-runner-playwright';
2
-
3
- export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
4
- files: 'dist/test/**/*.test.js',
5
- nodeResolve: true
6
-
7
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
8
- // esbuildTarget: 'auto',
9
-
10
- /** Confgure bare import resolve plugin */
11
- // nodeResolve: {
12
- // exportConditions: ['browser', 'development']
13
- // },
14
-
15
- /** Amount of browsers to run concurrently */
16
- // concurrentBrowsers: 2,
17
-
18
- /** Amount of test files per browser to test concurrently */
19
- // concurrency: 1,
20
-
21
- /** Browsers to run tests on */
22
- // browsers: [
23
- // playwrightLauncher({ product: 'chromium' }),
24
- // playwrightLauncher({ product: 'firefox' }),
25
- // playwrightLauncher({ product: 'webkit' }),
26
- // ],
27
-
28
- // See documentation for all available options
29
- })