@operato/data-grist 2.0.0-alpha.86 → 2.0.0-alpha.88

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 (43) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/src/data-grid/data-grid-header.js +9 -0
  3. package/dist/src/data-grid/data-grid-header.js.map +1 -1
  4. package/dist/src/data-grid/data-grid.js +3 -1
  5. package/dist/src/data-grid/data-grid.js.map +1 -1
  6. package/dist/src/data-grist.js +1 -0
  7. package/dist/src/data-grist.js.map +1 -1
  8. package/dist/stories/accumulator.stories.js +2 -2
  9. package/dist/stories/accumulator.stories.js.map +1 -1
  10. package/dist/stories/default-filters.stories.js +1 -1
  11. package/dist/stories/default-filters.stories.js.map +1 -1
  12. package/dist/stories/dynamic-editable.stories.js +28 -0
  13. package/dist/stories/dynamic-editable.stories.js.map +1 -1
  14. package/dist/stories/fixed-column.stories.js +0 -1
  15. package/dist/stories/fixed-column.stories.js.map +1 -1
  16. package/dist/stories/grid-setting.stories.d.ts +36 -0
  17. package/dist/stories/grid-setting.stories.js +517 -0
  18. package/dist/stories/grid-setting.stories.js.map +1 -0
  19. package/dist/stories/grist-modes.stories.js +0 -1
  20. package/dist/stories/grist-modes.stories.js.map +1 -1
  21. package/dist/stories/group-header.stories.js +0 -1
  22. package/dist/stories/group-header.stories.js.map +1 -1
  23. package/dist/stories/textarea.stories.js +1 -1
  24. package/dist/stories/textarea.stories.js.map +1 -1
  25. package/dist/stories/tree-column-with-checkbox.stories.js +1 -2
  26. package/dist/stories/tree-column-with-checkbox.stories.js.map +1 -1
  27. package/dist/stories/tree-column.stories.js +0 -1
  28. package/dist/stories/tree-column.stories.js.map +1 -1
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +5 -5
  31. package/src/data-grid/data-grid-header.ts +9 -0
  32. package/src/data-grid/data-grid.ts +3 -1
  33. package/src/data-grist.ts +1 -0
  34. package/stories/accumulator.stories.ts +2 -2
  35. package/stories/default-filters.stories.ts +1 -1
  36. package/stories/dynamic-editable.stories.ts +28 -0
  37. package/stories/fixed-column.stories.ts +0 -1
  38. package/stories/grid-setting.stories.ts +553 -0
  39. package/stories/grist-modes.stories.ts +0 -1
  40. package/stories/group-header.stories.ts +0 -1
  41. package/stories/textarea.stories.ts +1 -1
  42. package/stories/tree-column-with-checkbox.stories.ts +1 -2
  43. package/stories/tree-column.stories.ts +0 -1
@@ -0,0 +1,517 @@
1
+ import '../src/index.js';
2
+ import '../src/filters/filters-form.js';
3
+ import '../src/sorters/sorters-control.js';
4
+ import '../src/record-view/record-creator.js';
5
+ import '@operato/popup/ox-popup-list.js';
6
+ import '@material/web/icon/icon.js';
7
+ import { html } from 'lit';
8
+ const fetchHandler = async ({ page, limit }) => {
9
+ var total = 120993;
10
+ var start = (page - 1) * limit;
11
+ await new Promise(resolve => setTimeout(resolve, 500));
12
+ return {
13
+ total,
14
+ records: Array(limit * page > total ? total % limit : limit)
15
+ .fill('')
16
+ .map((item, idx) => {
17
+ return {
18
+ id: String(idx),
19
+ name: idx % 2 ? `shnam-${start + idx + 1}` : `heartyoh-${start + idx + 1}`,
20
+ description: idx % 2 ? `hatiolabmanager${start + idx + 1}1234567890` : `hatiosea manager-${start + idx + 1}`,
21
+ email: idx % 2 ? `shnam-${start + idx + 1}@gmail.com` : `heartyoh-${start + idx + 1}@gmail.com`,
22
+ active: Math.round(Math.random() * 2) % 2 ? true : false,
23
+ barcode: idx % 2 ? `1234567890${start + idx + 1}` : `0987654321${start + idx + 1}`,
24
+ company: idx % 2
25
+ ? {
26
+ id: '2',
27
+ name: 'HatioLAB',
28
+ description: `경기도 성남시-${start + idx + 1}`
29
+ }
30
+ : {
31
+ id: '3',
32
+ name: 'HatioSEA',
33
+ description: `말레이시아 세티아알람-${start + idx + 1}`
34
+ },
35
+ thumbnail: idx % 4 === 0
36
+ ? '' /* no source */
37
+ : idx % 4 === 1
38
+ ? `http://www.hatiolab.com/assets/img/operato-biz3.png`
39
+ : idx % 4 === 2
40
+ ? `http://www.hatiolab.com/assets/img/thingsboard-30.png`
41
+ : `http://www.hatiolab.com/wrong-url.png` /* wrong source */,
42
+ role: ['admin', 'worker', 'tester'][idx % 3],
43
+ color: idx % 2 ? `#87f018` : `#180f87`,
44
+ rate: Math.round(Math.random() * 100),
45
+ dynamicType: ['text', 'email', 'checkbox', 'color', 'progress', 'barcode'][idx % 5],
46
+ dynamicValue: ['abcdefghijkl', 'heartyoh@hatiolab.com', 'true', 'orange', '50', '1234567890'][idx % 5],
47
+ homepage: idx % 2 ? `http://hatiolab.com/${start + idx + 1}` : `http://deadpool.hatiolab.com/${start + idx + 1}`,
48
+ json5: {
49
+ abc: 'abc',
50
+ value: 123
51
+ },
52
+ createdAt: Date.now(),
53
+ updatedAt: Date.now()
54
+ };
55
+ })
56
+ };
57
+ };
58
+ const config = {
59
+ list: {
60
+ thumbnail: 'thumbnail',
61
+ fields: ['name', 'description'],
62
+ details: ['role', 'email']
63
+ },
64
+ columns: [
65
+ {
66
+ type: 'gutter',
67
+ gutterName: 'dirty'
68
+ },
69
+ {
70
+ type: 'gutter',
71
+ gutterName: 'sequence'
72
+ },
73
+ {
74
+ type: 'gutter',
75
+ gutterName: 'row-selector',
76
+ multiple: true
77
+ },
78
+ {
79
+ type: 'gutter',
80
+ gutterName: 'button',
81
+ icon: 'edit',
82
+ title: 'edit',
83
+ handlers: {
84
+ click: function () {
85
+ console.log('clicked');
86
+ }
87
+ }
88
+ },
89
+ {
90
+ type: 'gutter',
91
+ gutterName: 'button',
92
+ icon: 'add',
93
+ title: 'add',
94
+ handlers: {
95
+ click: 'record-copy'
96
+ }
97
+ },
98
+ {
99
+ type: 'gutter',
100
+ gutterName: 'button',
101
+ icon: 'arrow_downward',
102
+ title: 'download',
103
+ handlers: {
104
+ click: 'move-down'
105
+ }
106
+ },
107
+ {
108
+ type: 'string',
109
+ name: 'id',
110
+ hidden: true
111
+ },
112
+ {
113
+ type: 'link',
114
+ name: 'name',
115
+ label: true,
116
+ fixed: true,
117
+ header: 'name',
118
+ record: {
119
+ editable: true,
120
+ options: {
121
+ // href: 'http://hatiolab.com',
122
+ href: function (column, record, rowIndex) {
123
+ return record['homepage'];
124
+ },
125
+ target: '_blank'
126
+ }
127
+ },
128
+ filter: 'search',
129
+ sortable: true,
130
+ width: 120
131
+ },
132
+ {
133
+ type: 'string',
134
+ name: 'description',
135
+ header: 'description',
136
+ filter: 'search',
137
+ record: {
138
+ editable: true,
139
+ align: 'left'
140
+ },
141
+ width: 200,
142
+ handlers: {
143
+ click: (columns, data, column, record, rowIndex, target) => {
144
+ alert(`${column.name} ${record[column.name]}, row : ${rowIndex}`);
145
+ }
146
+ }
147
+ },
148
+ {
149
+ type: 'email',
150
+ name: 'email',
151
+ label: true,
152
+ header: 'email',
153
+ record: {
154
+ editable: true
155
+ },
156
+ filter: 'search',
157
+ sortable: true,
158
+ width: 130,
159
+ validation: function (after, before, record, column) {
160
+ if (after.indexOf('@') == -1) {
161
+ document.dispatchEvent(new CustomEvent('notify', {
162
+ detail: {
163
+ type: 'error',
164
+ message: `invalid value - ${after}`
165
+ }
166
+ }));
167
+ return false;
168
+ }
169
+ return true;
170
+ }
171
+ },
172
+ {
173
+ type: 'boolean',
174
+ name: 'active',
175
+ header: 'active',
176
+ record: {
177
+ editable: true
178
+ },
179
+ filter: true,
180
+ handlers: {
181
+ dblclick: () => {
182
+ const grist = document.querySelector('ox-grist');
183
+ console.log(grist.dirtyRecords);
184
+ }
185
+ },
186
+ sortable: true,
187
+ width: 60
188
+ },
189
+ {
190
+ type: 'select',
191
+ name: 'role',
192
+ label: true,
193
+ header: 'role',
194
+ record: {
195
+ options: ['', 'admin', 'worker', 'tester'],
196
+ editable: true
197
+ },
198
+ filter: true,
199
+ sortable: true,
200
+ width: 120
201
+ },
202
+ {
203
+ type: 'color',
204
+ name: 'color',
205
+ header: 'color',
206
+ record: {
207
+ editable: true
208
+ },
209
+ sortable: true,
210
+ width: 50
211
+ },
212
+ {
213
+ type: 'float',
214
+ name: 'rate',
215
+ header: 'rate',
216
+ record: {
217
+ align: 'right',
218
+ editable: true,
219
+ defaultValue: 10000.1
220
+ },
221
+ filter: {
222
+ operator: 'between',
223
+ value: [1, 100]
224
+ },
225
+ sortable: true,
226
+ width: 50
227
+ },
228
+ {
229
+ type: 'json5',
230
+ name: 'json5',
231
+ header: 'JSON5',
232
+ width: 200
233
+ },
234
+ {
235
+ type: 'image',
236
+ name: 'thumbnail',
237
+ header: 'thumbnail',
238
+ record: {
239
+ editable: true
240
+ },
241
+ width: 120
242
+ },
243
+ {
244
+ type: 'datetime',
245
+ name: 'updatedAt',
246
+ header: 'updated at',
247
+ record: {
248
+ editable: true,
249
+ defaultValue: {
250
+ name: 'now'
251
+ }
252
+ },
253
+ filter: {
254
+ operator: 'between',
255
+ type: 'datetime',
256
+ value: [
257
+ {
258
+ name: 'today',
259
+ params: {
260
+ type: 'datetime'
261
+ }
262
+ },
263
+ {
264
+ name: 'now',
265
+ params: {
266
+ type: 'datetime',
267
+ relativeDays: 1
268
+ }
269
+ }
270
+ ]
271
+ },
272
+ sortable: true,
273
+ width: 180
274
+ },
275
+ {
276
+ type: 'datetime',
277
+ name: 'createdAt',
278
+ header: 'created at',
279
+ record: {
280
+ editable: false
281
+ },
282
+ sortable: true,
283
+ width: 180
284
+ }
285
+ ],
286
+ rows: {
287
+ selectable: {
288
+ multiple: true
289
+ },
290
+ handlers: {
291
+ focus: 'select-row-toggle'
292
+ },
293
+ classifier: function (record, rowIndex) {
294
+ const rate = record['rate'];
295
+ const emphasized = rate < 10 ? ['black', 'white'] : rate < 25 ? ['yellow', 'blue'] : rate < 40 ? ['cyan', 'red'] : undefined;
296
+ return {
297
+ emphasized
298
+ };
299
+ }
300
+ },
301
+ sorters: [
302
+ {
303
+ name: 'name',
304
+ desc: true
305
+ },
306
+ {
307
+ name: 'email'
308
+ }
309
+ ],
310
+ pagination: {
311
+ pages: [20, 30, 50, 100, 200]
312
+ }
313
+ };
314
+ export default {
315
+ title: 'grid setting',
316
+ component: 'ox-grist',
317
+ argTypes: {
318
+ config: { control: 'object' },
319
+ mode: { control: 'select', options: ['GRID', 'LIST', 'CARD'] },
320
+ urlParamsSensitive: { control: 'boolean' }
321
+ }
322
+ };
323
+ const Template = ({ config, mode = 'GRID', urlParamsSensitive = false, fetchHandler }) => html ` <link
324
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
325
+ rel="stylesheet"
326
+ />
327
+ <link
328
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
329
+ rel="stylesheet"
330
+ />
331
+ <link
332
+ href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
333
+ rel="stylesheet"
334
+ />
335
+
336
+ <link href="/themes/app-theme.css" rel="stylesheet" />
337
+ <link href="/themes/oops-theme.css" rel="stylesheet" />
338
+ <link href="/themes/grist-theme.css" rel="stylesheet" />
339
+
340
+ <style>
341
+ ox-filters-form {
342
+ --input-gap-vertical: 8px;
343
+ --input-gap-horizontal: 16px;
344
+
345
+ --ox-filters-input-placeholder-color: var(--primary-color);
346
+
347
+ --ox-filters-input-border: 1px solid rgba(0, 0, 0, 0.2);
348
+ --ox-filters-input-focus-border: 1px solid var(--primary-color);
349
+ --ox-filters-input-font: normal 14px var(--theme-font);
350
+ --ox-filters-input-color: var(--primary-text-color);
351
+ --ox-filters-input-focus-color: var(--primary-color);
352
+ --ox-filters-label-font: normal 14px var(--theme-font);
353
+ --ox-filters-label-color: var(--primary-text-color);
354
+
355
+ --ox-filters-form-gap: var(--input-gap-vertical, 8px) var(--input-gap-horizontal, 16px);
356
+ --ox-filters-input-padding: 6px 2px;
357
+ }
358
+ </style>
359
+
360
+ <style>
361
+ ox-grist {
362
+ width: 100%;
363
+ height: 600px;
364
+ }
365
+
366
+ [slot='headroom'] {
367
+ display: flex;
368
+ flex-direction: row;
369
+ align-items: center;
370
+ padding: var(--padding-default) var(--padding-wide);
371
+ background-color: var(--theme-white-color);
372
+ box-shadow: var(--box-shadow);
373
+
374
+ --md-icon-size: 24px;
375
+ }
376
+ #sorters md-icon,
377
+ #modes md-icon {
378
+ --md-icon-size: 18px;
379
+ }
380
+ #sorters {
381
+ margin-left: auto;
382
+ margin-right: var(--margin-default);
383
+ padding-left: var(--padding-narrow);
384
+ border-bottom: var(--border-dark-color);
385
+ position: relative;
386
+ color: var(--secondary-color);
387
+ font-size: var(--fontsize-default);
388
+ user-select: none;
389
+ }
390
+
391
+ #sorters > * {
392
+ padding: var(--padding-narrow);
393
+ vertical-align: middle;
394
+ }
395
+
396
+ #modes > * {
397
+ padding: var(--padding-narrow);
398
+ opacity: 0.5;
399
+ color: var(--primary-text-color);
400
+ cursor: pointer;
401
+ }
402
+
403
+ #modes > md-icon[active] {
404
+ border-radius: 9px;
405
+ background-color: rgba(var(--primary-color-rgb), 0.05);
406
+ opacity: 1;
407
+ color: var(--secondary-text-color);
408
+ cursor: default;
409
+ }
410
+
411
+ #modes > md-icon:hover {
412
+ opacity: 1;
413
+ color: var(--secondary-text-color);
414
+ }
415
+
416
+ #add {
417
+ text-align: right;
418
+ }
419
+
420
+ #add button {
421
+ display: flex;
422
+ align-items: center;
423
+ justify-content: center;
424
+
425
+ background-color: var(--primary-color);
426
+ border: 0;
427
+ border-radius: 50%;
428
+ padding: 5px;
429
+ width: 32px;
430
+ height: 32px;
431
+ cursor: pointer;
432
+ }
433
+
434
+ #add button:hover {
435
+ background-color: var(--focus-background-color);
436
+ box-shadow: var(--box-shadow);
437
+ }
438
+
439
+ #add button md-icon {
440
+ font-size: 1.5em;
441
+ color: var(--theme-white-color);
442
+ }
443
+
444
+ #filters {
445
+ display: flex;
446
+ justify-content: center;
447
+ align-items: center;
448
+ }
449
+
450
+ #filters * {
451
+ margin-right: var(--margin-default);
452
+ }
453
+
454
+ [slot='setting'] {
455
+ --md-icon-size: 18px;
456
+ }
457
+
458
+ @media only screen and (max-width: 460px) {
459
+ #filters {
460
+ flex-direction: column;
461
+ }
462
+
463
+ #modes {
464
+ display: none;
465
+ }
466
+ }
467
+ </style>
468
+
469
+ <ox-grist
470
+ .config=${config}
471
+ .mode=${mode}
472
+ .fetchHandler=${fetchHandler}
473
+ ?url-params-sensitive=${urlParamsSensitive}
474
+ @filters-change=${(e) => console.log('filters', e.target.filters)}
475
+ >
476
+ <div slot="headroom">
477
+ <div id="filters">
478
+ <ox-filters-form autofocus></ox-filters-form>
479
+ </div>
480
+
481
+ <div id="sorters">
482
+ Sort
483
+ <md-icon
484
+ @click=${(e) => {
485
+ const target = e.currentTarget;
486
+ target.closest('#sorters').querySelector('#sorter-control').open({
487
+ right: 0,
488
+ top: target.offsetTop + target.offsetHeight
489
+ });
490
+ }}
491
+ >expand_more</md-icon
492
+ >
493
+ <ox-popup id="sorter-control">
494
+ <ox-sorters-control> </ox-sorters-control>
495
+ </ox-popup>
496
+ </div>
497
+
498
+ <div id="modes">
499
+ <md-icon @click=${() => (mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
500
+ <md-icon @click=${() => (mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
501
+ <md-icon @click=${() => (mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
502
+ </div>
503
+
504
+ <ox-record-creator id="add" light-popup>
505
+ <button><md-icon>add</md-icon></button>
506
+ </ox-record-creator>
507
+ </div>
508
+
509
+ <md-icon slot="setting" @click=${(e) => alert('setting clicked')}>tune</md-icon>
510
+ </ox-grist>`;
511
+ export const Regular = Template.bind({});
512
+ Regular.args = {
513
+ config,
514
+ fetchHandler,
515
+ mode: 'GRID'
516
+ };
517
+ //# sourceMappingURL=grid-setting.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid-setting.stories.js","sourceRoot":"","sources":["../../stories/grid-setting.stories.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA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CAAC;gBAClE,CAAA;AAEhB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,MAAM;IACN,YAAY;IACZ,IAAI,EAAE,MAAM;CACb,CAAA","sourcesContent":["import '../src/index.js'\nimport '../src/filters/filters-form.js'\nimport '../src/sorters/sorters-control.js'\nimport '../src/record-view/record-creator.js'\nimport '@operato/popup/ox-popup-list.js'\nimport '@material/web/icon/icon.js'\n\nimport { html, TemplateResult } from 'lit'\n\nimport {\n ColumnConfig,\n FetchHandler,\n GristClassifier,\n GristEventHandlerSet,\n GristRecord,\n ValidationCallback\n} from '../src/types.js'\n\nconst fetchHandler: FetchHandler = async ({ page, limit }) => {\n var total = 120993\n var start = (page! - 1) * limit!\n\n await new Promise(resolve => setTimeout(resolve, 500))\n\n return {\n total,\n records: Array(limit! * page! > total ? total % limit! : limit)\n .fill('')\n .map((item, idx) => {\n return {\n id: String(idx),\n name: idx % 2 ? `shnam-${start + idx + 1}` : `heartyoh-${start + idx + 1}`,\n description: idx % 2 ? `hatiolabmanager${start + idx + 1}1234567890` : `hatiosea manager-${start + idx + 1}`,\n email: idx % 2 ? `shnam-${start + idx + 1}@gmail.com` : `heartyoh-${start + idx + 1}@gmail.com`,\n active: Math.round(Math.random() * 2) % 2 ? true : false,\n barcode: idx % 2 ? `1234567890${start + idx + 1}` : `0987654321${start + idx + 1}`,\n company:\n idx % 2\n ? {\n id: '2',\n name: 'HatioLAB',\n description: `경기도 성남시-${start + idx + 1}`\n }\n : {\n id: '3',\n name: 'HatioSEA',\n description: `말레이시아 세티아알람-${start + idx + 1}`\n },\n thumbnail:\n idx % 4 === 0\n ? '' /* no source */\n : idx % 4 === 1\n ? `http://www.hatiolab.com/assets/img/operato-biz3.png`\n : idx % 4 === 2\n ? `http://www.hatiolab.com/assets/img/thingsboard-30.png`\n : `http://www.hatiolab.com/wrong-url.png` /* wrong source */,\n role: ['admin', 'worker', 'tester'][idx % 3],\n color: idx % 2 ? `#87f018` : `#180f87`,\n rate: Math.round(Math.random() * 100),\n dynamicType: ['text', 'email', 'checkbox', 'color', 'progress', 'barcode'][idx % 5],\n dynamicValue: ['abcdefghijkl', 'heartyoh@hatiolab.com', 'true', 'orange', '50', '1234567890'][idx % 5],\n homepage:\n idx % 2 ? `http://hatiolab.com/${start + idx + 1}` : `http://deadpool.hatiolab.com/${start + idx + 1}`,\n json5: {\n abc: 'abc',\n value: 123\n },\n createdAt: Date.now(),\n updatedAt: Date.now()\n }\n })\n }\n}\n\nconst config = {\n list: {\n thumbnail: 'thumbnail',\n fields: ['name', 'description'],\n details: ['role', 'email']\n },\n columns: [\n {\n type: 'gutter',\n gutterName: 'dirty'\n },\n {\n type: 'gutter',\n gutterName: 'sequence'\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: true\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'edit',\n title: 'edit',\n handlers: {\n click: function () {\n console.log('clicked')\n }\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n title: 'add',\n handlers: {\n click: 'record-copy'\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_downward',\n title: 'download',\n handlers: {\n click: 'move-down'\n }\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'link',\n name: 'name',\n label: true,\n fixed: true,\n header: 'name',\n record: {\n editable: true,\n options: {\n // href: 'http://hatiolab.com',\n href: function (column: ColumnConfig, record: GristRecord, rowIndex: number) {\n return record['homepage']\n },\n target: '_blank'\n }\n },\n filter: 'search',\n sortable: true,\n width: 120\n },\n {\n type: 'string',\n name: 'description',\n header: 'description',\n filter: 'search',\n record: {\n editable: true,\n align: 'left'\n },\n width: 200,\n handlers: {\n click: (columns, data, column, record, rowIndex, target) => {\n alert(`${column!.name} ${record![column!.name]}, row : ${rowIndex}`)\n }\n } as GristEventHandlerSet\n },\n {\n type: 'email',\n name: 'email',\n label: true,\n header: 'email',\n record: {\n editable: true\n },\n filter: 'search',\n sortable: true,\n width: 130,\n validation: function (after, before, record, column) {\n if (after.indexOf('@') == -1) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n type: 'error',\n message: `invalid value - ${after}`\n }\n })\n )\n return false\n }\n return true\n } as ValidationCallback\n },\n {\n type: 'boolean',\n name: 'active',\n header: 'active',\n record: {\n editable: true\n },\n filter: true,\n handlers: {\n dblclick: () => {\n const grist = document.querySelector('ox-grist') as any\n console.log(grist!.dirtyRecords)\n }\n },\n sortable: true,\n width: 60\n },\n {\n type: 'select',\n name: 'role',\n label: true,\n header: 'role',\n record: {\n options: ['', 'admin', 'worker', 'tester'],\n editable: true\n },\n filter: true,\n sortable: true,\n width: 120\n },\n {\n type: 'color',\n name: 'color',\n header: 'color',\n record: {\n editable: true\n },\n sortable: true,\n width: 50\n },\n {\n type: 'float',\n name: 'rate',\n header: 'rate',\n record: {\n align: 'right',\n editable: true,\n defaultValue: 10000.1\n },\n filter: {\n operator: 'between',\n value: [1, 100]\n },\n sortable: true,\n width: 50\n },\n {\n type: 'json5',\n name: 'json5',\n header: 'JSON5',\n width: 200\n },\n {\n type: 'image',\n name: 'thumbnail',\n header: 'thumbnail',\n record: {\n editable: true\n },\n width: 120\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: 'updated at',\n record: {\n editable: true,\n defaultValue: {\n name: 'now'\n }\n },\n filter: {\n operator: 'between',\n type: 'datetime',\n value: [\n {\n name: 'today',\n params: {\n type: 'datetime'\n }\n },\n {\n name: 'now',\n params: {\n type: 'datetime',\n relativeDays: 1\n }\n }\n ]\n },\n sortable: true,\n width: 180\n },\n {\n type: 'datetime',\n name: 'createdAt',\n header: 'created at',\n record: {\n editable: false\n },\n sortable: true,\n width: 180\n }\n ],\n rows: {\n selectable: {\n multiple: true\n },\n handlers: {\n focus: 'select-row-toggle'\n },\n classifier: function (record, rowIndex) {\n const rate = record['rate']\n const emphasized =\n rate < 10 ? ['black', 'white'] : rate < 25 ? ['yellow', 'blue'] : rate < 40 ? ['cyan', 'red'] : undefined\n return {\n emphasized\n }\n } as GristClassifier\n },\n sorters: [\n {\n name: 'name',\n desc: true\n },\n {\n name: 'email'\n }\n ],\n pagination: {\n pages: [20, 30, 50, 100, 200]\n }\n}\n\nexport default {\n title: 'grid setting',\n component: 'ox-grist',\n argTypes: {\n config: { control: 'object' },\n mode: { control: 'select', options: ['GRID', 'LIST', 'CARD'] },\n urlParamsSensitive: { control: 'boolean' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n config: object\n mode: string\n urlParamsSensitive: boolean\n fetchHandler: object\n}\n\nconst Template: Story<ArgTypes> = ({ config, mode = 'GRID', urlParamsSensitive = false, fetchHandler }: ArgTypes) =>\n html` <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 ox-filters-form {\n --input-gap-vertical: 8px;\n --input-gap-horizontal: 16px;\n\n --ox-filters-input-placeholder-color: var(--primary-color);\n\n --ox-filters-input-border: 1px solid rgba(0, 0, 0, 0.2);\n --ox-filters-input-focus-border: 1px solid var(--primary-color);\n --ox-filters-input-font: normal 14px var(--theme-font);\n --ox-filters-input-color: var(--primary-text-color);\n --ox-filters-input-focus-color: var(--primary-color);\n --ox-filters-label-font: normal 14px var(--theme-font);\n --ox-filters-label-color: var(--primary-text-color);\n\n --ox-filters-form-gap: var(--input-gap-vertical, 8px) var(--input-gap-horizontal, 16px);\n --ox-filters-input-padding: 6px 2px;\n }\n </style>\n\n <style>\n ox-grist {\n width: 100%;\n height: 600px;\n }\n\n [slot='headroom'] {\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: var(--padding-default) var(--padding-wide);\n background-color: var(--theme-white-color);\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(--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 #modes > * {\n padding: var(--padding-narrow);\n opacity: 0.5;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n #modes > md-icon[active] {\n border-radius: 9px;\n background-color: rgba(var(--primary-color-rgb), 0.05);\n opacity: 1;\n color: var(--secondary-text-color);\n cursor: default;\n }\n\n #modes > md-icon:hover {\n opacity: 1;\n color: var(--secondary-text-color);\n }\n\n #add {\n text-align: right;\n }\n\n #add button {\n display: flex;\n align-items: center;\n justify-content: center;\n\n background-color: var(--primary-color);\n border: 0;\n border-radius: 50%;\n padding: 5px;\n width: 32px;\n height: 32px;\n cursor: pointer;\n }\n\n #add button:hover {\n background-color: var(--focus-background-color);\n box-shadow: var(--box-shadow);\n }\n\n #add button md-icon {\n font-size: 1.5em;\n color: var(--theme-white-color);\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 [slot='setting'] {\n --md-icon-size: 18px;\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\n .config=${config}\n .mode=${mode}\n .fetchHandler=${fetchHandler}\n ?url-params-sensitive=${urlParamsSensitive}\n @filters-change=${(e: Event) => console.log('filters', (e.target as any).filters)}\n >\n <div slot=\"headroom\">\n <div id=\"filters\">\n <ox-filters-form autofocus></ox-filters-form>\n </div>\n\n <div id=\"sorters\">\n Sort\n <md-icon\n @click=${(e: Event) => {\n const target = e.currentTarget as HTMLElement\n ;(target.closest('#sorters')!.querySelector('#sorter-control') as any).open({\n right: 0,\n top: target.offsetTop + target.offsetHeight\n })\n }}\n >expand_more</md-icon\n >\n <ox-popup id=\"sorter-control\">\n <ox-sorters-control> </ox-sorters-control>\n </ox-popup>\n </div>\n\n <div id=\"modes\">\n <md-icon @click=${() => (mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>\n <md-icon @click=${() => (mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>\n <md-icon @click=${() => (mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>\n </div>\n\n <ox-record-creator id=\"add\" light-popup>\n <button><md-icon>add</md-icon></button>\n </ox-record-creator>\n </div>\n\n <md-icon slot=\"setting\" @click=${(e: MouseEvent) => alert('setting clicked')}>tune</md-icon>\n </ox-grist>`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n config,\n fetchHandler,\n mode: 'GRID'\n}\n"]}
@@ -414,7 +414,6 @@ const Template = ({ config, mode = 'GRID', urlParamsSensitive = false, fetchHand
414
414
  }
415
415
 
416
416
  #add {
417
- width: 50px;
418
417
  text-align: right;
419
418
  }
420
419