@operato/data-grist 1.11.5 → 1.11.7

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 (47) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/demo/data-grist-test.html +2 -1
  3. package/dist/src/configure/column-builder.js +8 -0
  4. package/dist/src/configure/column-builder.js.map +1 -1
  5. package/dist/src/data-grid/data-grid-accum-field.js +2 -15
  6. package/dist/src/data-grid/data-grid-accum-field.js.map +1 -1
  7. package/dist/src/data-grid/data-grid-field.js +4 -7
  8. package/dist/src/data-grid/data-grid-field.js.map +1 -1
  9. package/dist/src/data-grid/data-grid-header.d.ts +8 -5
  10. package/dist/src/data-grid/data-grid-header.js +131 -47
  11. package/dist/src/data-grid/data-grid-header.js.map +1 -1
  12. package/dist/src/editors/ox-grist-editor-multiple-select.d.ts +1 -0
  13. package/dist/src/editors/ox-grist-editor-multiple-select.js +9 -1
  14. package/dist/src/editors/ox-grist-editor-multiple-select.js.map +1 -1
  15. package/dist/src/editors/ox-grist-editor.d.ts +1 -1
  16. package/dist/src/editors/ox-grist-editor.js +2 -2
  17. package/dist/src/editors/ox-grist-editor.js.map +1 -1
  18. package/dist/src/renderers/ox-grist-renderer-tree.d.ts +8 -0
  19. package/dist/src/renderers/ox-grist-renderer-tree.js +134 -0
  20. package/dist/src/renderers/ox-grist-renderer-tree.js.map +1 -0
  21. package/dist/src/types.d.ts +2 -0
  22. package/dist/src/types.js.map +1 -1
  23. package/dist/stories/fixed-column.stories copy.d.ts +26 -0
  24. package/dist/stories/fixed-column.stories copy.js +448 -0
  25. package/dist/stories/fixed-column.stories copy.js.map +1 -0
  26. package/dist/stories/fixed-column.stories.js +3 -2
  27. package/dist/stories/fixed-column.stories.js.map +1 -1
  28. package/dist/stories/grist-modes.stories.js +2 -1
  29. package/dist/stories/grist-modes.stories.js.map +1 -1
  30. package/dist/stories/group-header.stories.d.ts +26 -0
  31. package/dist/stories/group-header.stories.js +473 -0
  32. package/dist/stories/group-header.stories.js.map +1 -0
  33. package/dist/stories/tree-column.stories.d.ts +26 -0
  34. package/dist/stories/tree-column.stories.js +310 -0
  35. package/dist/stories/tree-column.stories.js.map +1 -0
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +2 -2
  38. package/src/configure/column-builder.ts +8 -0
  39. package/src/data-grid/data-grid-accum-field.ts +2 -15
  40. package/src/data-grid/data-grid-field.ts +5 -9
  41. package/src/data-grid/data-grid-header.ts +148 -47
  42. package/src/editors/ox-grist-editor-multiple-select.ts +10 -1
  43. package/src/editors/ox-grist-editor.ts +2 -2
  44. package/src/types.ts +2 -0
  45. package/stories/fixed-column.stories.ts +3 -2
  46. package/stories/grist-modes.stories.ts +2 -1
  47. package/stories/group-header.stories.ts +505 -0
@@ -0,0 +1,448 @@
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/mwc-icon';
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
+ fixed: true
69
+ },
70
+ {
71
+ type: 'gutter',
72
+ gutterName: 'sequence',
73
+ fixed: true
74
+ },
75
+ {
76
+ type: 'gutter',
77
+ gutterName: 'row-selector',
78
+ multiple: true,
79
+ fixed: true
80
+ },
81
+ {
82
+ type: 'gutter',
83
+ gutterName: 'button',
84
+ icon: 'edit',
85
+ title: 'edit',
86
+ handlers: {
87
+ click: function () {
88
+ console.log('clicked');
89
+ }
90
+ },
91
+ fixed: true
92
+ },
93
+ {
94
+ type: 'gutter',
95
+ gutterName: 'button',
96
+ icon: 'add',
97
+ title: 'add',
98
+ handlers: {
99
+ click: 'record-copy'
100
+ },
101
+ fixed: true
102
+ },
103
+ {
104
+ type: 'gutter',
105
+ gutterName: 'button',
106
+ icon: 'arrow_downward',
107
+ title: 'download',
108
+ handlers: {
109
+ click: 'move-down'
110
+ },
111
+ fixed: true
112
+ },
113
+ {
114
+ type: 'string',
115
+ name: 'id',
116
+ hidden: true
117
+ },
118
+ {
119
+ type: 'link',
120
+ name: 'name',
121
+ label: true,
122
+ header: 'name',
123
+ record: {
124
+ editable: true,
125
+ options: {
126
+ // href: 'http://hatiolab.com',
127
+ href: function (column, record, rowIndex) {
128
+ return record['homepage'];
129
+ },
130
+ target: '_blank'
131
+ }
132
+ },
133
+ filter: 'search',
134
+ sortable: true,
135
+ width: 120,
136
+ fixed: true
137
+ },
138
+ {
139
+ type: 'string',
140
+ name: 'description',
141
+ header: 'description',
142
+ filter: 'search',
143
+ record: {
144
+ editable: true,
145
+ align: 'left'
146
+ },
147
+ width: 200,
148
+ handlers: {
149
+ click: (columns, data, column, record, rowIndex, target) => {
150
+ alert(`${column.name} ${record[column.name]}, row : ${rowIndex}`);
151
+ }
152
+ }
153
+ },
154
+ {
155
+ type: 'email',
156
+ name: 'email',
157
+ label: true,
158
+ header: 'email',
159
+ record: {
160
+ editable: true
161
+ },
162
+ filter: 'search',
163
+ sortable: true,
164
+ width: 130,
165
+ validation: function (after, before, record, column) {
166
+ if (after.indexOf('@') == -1) {
167
+ document.dispatchEvent(new CustomEvent('notify', {
168
+ detail: {
169
+ type: 'error',
170
+ message: `invalid value - ${after}`
171
+ }
172
+ }));
173
+ return false;
174
+ }
175
+ return true;
176
+ }
177
+ },
178
+ {
179
+ type: 'boolean',
180
+ name: 'active',
181
+ header: 'active',
182
+ record: {
183
+ editable: true
184
+ },
185
+ filter: true,
186
+ handlers: {
187
+ dblclick: () => {
188
+ const grist = document.querySelector('ox-grist');
189
+ console.log(grist.dirtyRecords);
190
+ }
191
+ },
192
+ sortable: true,
193
+ width: 60
194
+ },
195
+ {
196
+ type: 'string[]',
197
+ name: 'role',
198
+ label: true,
199
+ header: 'role',
200
+ record: {
201
+ options: ['', 'admin', 'worker', 'tester'],
202
+ editable: true
203
+ },
204
+ filter: true,
205
+ sortable: true,
206
+ width: 120
207
+ },
208
+ {
209
+ type: 'color',
210
+ name: 'color',
211
+ header: 'color',
212
+ record: {
213
+ editable: true
214
+ },
215
+ sortable: true,
216
+ width: 50
217
+ },
218
+ {
219
+ type: 'float',
220
+ name: 'rate',
221
+ header: 'rate',
222
+ record: {
223
+ align: 'right',
224
+ editable: true,
225
+ defaultValue: 10000.1
226
+ },
227
+ filter: 'between',
228
+ sortable: true,
229
+ width: 50
230
+ },
231
+ {
232
+ type: 'json5',
233
+ name: 'json5',
234
+ header: 'JSON5',
235
+ width: 200
236
+ },
237
+ {
238
+ type: 'image',
239
+ name: 'thumbnail',
240
+ header: 'thumbnail',
241
+ record: {
242
+ editable: true
243
+ },
244
+ width: 120
245
+ },
246
+ {
247
+ type: 'datetime',
248
+ name: 'updatedAt',
249
+ header: 'updated at',
250
+ record: {
251
+ editable: true,
252
+ defaultValue: {
253
+ name: 'now'
254
+ }
255
+ },
256
+ filter: 'between',
257
+ sortable: true,
258
+ width: 180
259
+ },
260
+ {
261
+ type: 'datetime',
262
+ name: 'createdAt',
263
+ header: 'created at',
264
+ record: {
265
+ editable: false
266
+ },
267
+ sortable: true,
268
+ width: 180
269
+ }
270
+ ],
271
+ rows: {
272
+ selectable: {
273
+ multiple: true
274
+ },
275
+ handlers: {
276
+ focus: 'select-row-toggle'
277
+ },
278
+ classifier: function (record, rowIndex) {
279
+ const rate = record['rate'];
280
+ const emphasized = rate < 10 ? ['black', 'white'] : rate < 25 ? ['yellow', 'blue'] : rate < 40 ? ['cyan', 'red'] : undefined;
281
+ return {
282
+ emphasized
283
+ };
284
+ }
285
+ },
286
+ sorters: [
287
+ {
288
+ name: 'name',
289
+ desc: true
290
+ },
291
+ {
292
+ name: 'email'
293
+ }
294
+ ],
295
+ pagination: {
296
+ pages: [20, 30, 50, 100, 200]
297
+ }
298
+ };
299
+ export default {
300
+ title: 'fixed column',
301
+ component: 'ox-grist',
302
+ argTypes: {
303
+ config: { control: 'object' }
304
+ }
305
+ };
306
+ const Template = ({ config }) => html ` <link
307
+ href="https://fonts.googleapis.com/css?family=Material+Icons&display=block"
308
+ rel="stylesheet"
309
+ />
310
+ <link href="/themes/app-theme.css" rel="stylesheet" />
311
+ <link href="/themes/oops-theme.css" rel="stylesheet" />
312
+ <link href="/themes/grist-theme.css" rel="stylesheet" />
313
+
314
+ <style>
315
+ [slot='headroom'] {
316
+ display: flex;
317
+ flex-direction: row;
318
+ align-items: center;
319
+ padding: var(--padding-default) var(--padding-wide);
320
+ background-color: var(--theme-white-color);
321
+ box-shadow: var(--box-shadow);
322
+
323
+ --mdc-icon-size: 24px;
324
+ }
325
+ #sorters mwc-icon,
326
+ #modes mwc-icon {
327
+ --mdc-icon-size: 18px;
328
+ }
329
+ #sorters {
330
+ margin-left: auto;
331
+ margin-right: var(--margin-default);
332
+ padding-left: var(--padding-narrow);
333
+ border-bottom: var(--border-dark-color);
334
+ position: relative;
335
+ color: var(--secondary-color);
336
+ font-size: var(--fontsize-default);
337
+ user-select: none;
338
+ }
339
+
340
+ #sorters > * {
341
+ padding: var(--padding-narrow);
342
+ vertical-align: middle;
343
+ }
344
+
345
+ #modes > * {
346
+ padding: var(--padding-narrow);
347
+ opacity: 0.5;
348
+ color: var(--primary-text-color);
349
+ cursor: pointer;
350
+ }
351
+
352
+ #modes > mwc-icon[active] {
353
+ border-radius: 9px;
354
+ background-color: rgba(var(--primary-color-rgb), 0.05);
355
+ opacity: 1;
356
+ color: var(--secondary-text-color);
357
+ cursor: default;
358
+ }
359
+
360
+ #modes > mwc-icon:hover {
361
+ opacity: 1;
362
+ color: var(--secondary-text-color);
363
+ }
364
+
365
+ #add {
366
+ width: 50px;
367
+ text-align: right;
368
+ }
369
+
370
+ #add button {
371
+ background-color: var(--primary-color);
372
+ border: 0;
373
+ border-radius: 50%;
374
+ padding: 5px;
375
+ width: 36px;
376
+ height: 36px;
377
+ cursor: pointer;
378
+ }
379
+
380
+ #add button:hover {
381
+ background-color: var(--focus-background-color);
382
+ box-shadow: var(--box-shadow);
383
+ }
384
+
385
+ #add button mwc-icon {
386
+ font-size: 2em;
387
+ color: var(--theme-white-color);
388
+ }
389
+
390
+ #filters {
391
+ display: flex;
392
+ justify-content: center;
393
+ align-items: center;
394
+ }
395
+
396
+ #filters * {
397
+ margin-right: var(--margin-default);
398
+ }
399
+
400
+ @media only screen and (max-width: 460px) {
401
+ #filters {
402
+ flex-direction: column;
403
+ }
404
+
405
+ #modes {
406
+ display: none;
407
+ }
408
+ }
409
+ </style>
410
+
411
+ <ox-grist
412
+ mode="GRID"
413
+ .config=${config}
414
+ .fetchHandler=${fetchHandler}
415
+ @filters-change=${(e) => console.log('filters', e.target.filters)}
416
+ >
417
+ <div slot="headroom">
418
+ <div id="filters">
419
+ <ox-filters-form autofocus></ox-filters-form>
420
+ </div>
421
+
422
+ <div id="sorters">
423
+ Sort
424
+ <mwc-icon
425
+ @click=${(e) => {
426
+ const target = e.currentTarget;
427
+ target.closest('#sorters').querySelector('#sorter-control').open({
428
+ right: 0,
429
+ top: target.offsetTop + target.offsetHeight
430
+ });
431
+ }}
432
+ >expand_more</mwc-icon
433
+ >
434
+ <ox-popup id="sorter-control">
435
+ <ox-sorters-control> </ox-sorters-control>
436
+ </ox-popup>
437
+ </div>
438
+
439
+ <ox-record-creator id="add" light-popup>
440
+ <button><mwc-icon>add</mwc-icon></button>
441
+ </ox-record-creator>
442
+ </div>
443
+ </ox-grist>`;
444
+ export const Regular = Template.bind({});
445
+ Regular.args = {
446
+ config
447
+ };
448
+ //# sourceMappingURL=fixed-column.stories%20copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixed-column.stories copy.js","sourceRoot":"","sources":["../../stories/fixed-column.stories copy.ts"],"names":[],"mappings":"AAAA,OA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lD,MAAM;oBACA,YAAY;sBACV,CAAC,CAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAG,CAAC,CAAC,MAAc,CAAC,OAAO,CAAC;;;;;;;;;;mBAUlE,CAAC,CAAQ,EAAE,EAAE;IACpB,MAAM,MAAM,GAAG,CAAC,CAAC,aAA4B,CAC5C;IAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAE,CAAC,aAAa,CAAC,iBAAiB,CAAS,CAAC,IAAI,CAAC;QAC1E,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,YAAY;KAC5C,CAAC,CAAA;AACJ,CAAC;;;;;;;;;;;;cAYG,CAAA;AAEd,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,MAAM;CACP,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/mwc-icon'\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 fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'sequence',\n fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: true,\n fixed: 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 fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n title: 'add',\n handlers: {\n click: 'record-copy'\n },\n fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_downward',\n title: 'download',\n handlers: {\n click: 'move-down'\n },\n fixed: true\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'link',\n name: 'name',\n label: 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 fixed: true\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: 'string[]',\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: 'between',\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: 'between',\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: 'fixed column',\n component: 'ox-grist',\n argTypes: {\n config: { control: 'object' }\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}\n\nconst Template: Story<ArgTypes> = ({ config }: ArgTypes) => html` <link\n href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\"\n rel=\"stylesheet\"\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(--padding-wide);\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 #modes > * {\n padding: var(--padding-narrow);\n opacity: 0.5;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n #modes > mwc-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 > mwc-icon:hover {\n opacity: 1;\n color: var(--secondary-text-color);\n }\n\n #add {\n width: 50px;\n text-align: right;\n }\n\n #add button {\n background-color: var(--primary-color);\n border: 0;\n border-radius: 50%;\n padding: 5px;\n width: 36px;\n height: 36px;\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 mwc-icon {\n font-size: 2em;\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 @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 mode=\"GRID\"\n .config=${config}\n .fetchHandler=${fetchHandler}\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 <mwc-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</mwc-icon\n >\n <ox-popup id=\"sorter-control\">\n <ox-sorters-control> </ox-sorters-control>\n </ox-popup>\n </div>\n\n <ox-record-creator id=\"add\" light-popup>\n <button><mwc-icon>add</mwc-icon></button>\n </ox-record-creator>\n </div>\n </ox-grist>`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n config\n}\n"]}
@@ -193,7 +193,7 @@ const config = {
193
193
  width: 60
194
194
  },
195
195
  {
196
- type: 'select',
196
+ type: 'string[]',
197
197
  name: 'role',
198
198
  label: true,
199
199
  header: 'role',
@@ -240,7 +240,8 @@ const config = {
240
240
  header: 'thumbnail',
241
241
  record: {
242
242
  editable: true
243
- }
243
+ },
244
+ width: 120
244
245
  },
245
246
  {
246
247
  type: 'datetime',
@@ -1 +1 @@
1
- {"version":3,"file":"fixed-column.stories.js","sourceRoot":"","sources":["../../stories/fixed-column.stories.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,gCAAgC,CAAA;AACvC,OAAO,mCAAmC,CAAA;AAC1C,OAAO,sCAAsC,CAAA;AAC7C,OAAO,iCAAiC,CAAA;AACxC,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAW1C,MAAM,YAAY,GAAiB,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3D,IAAI,KAAK,GAAG,MAAM,CAAA;IAClB,IAAI,KAAK,GAAG,CAAC,IAAK,GAAG,CAAC,CAAC,GAAG,KAAM,CAAA;IAEhC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;IAEtD,OAAO;QACL,KAAK;QACL,OAAO,EAAE,KAAK,CAAC,KAAM,GAAG,IAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAM,CAAC,CAAC,CAAC,KAAK,CAAC;aAC5D,IAAI,CAAC,EAAE,CAAC;aACR,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACjB,OAAO;gBACL,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;gBACf,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CA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AS,EAAE,UAAU;IACrB,QAAQ,EAAE;QACR,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;KAC9B;CACF,CAAA;AAYD,MAAM,QAAQ,GAAoB,CAAC,EAAE,MAAM,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2GlD,MAAM;oBACA,YAAY;sBACV,CAAC,CAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAG,CAAC,CAAC,MAAc,CAAC,OAAO,CAAC;;;;;;;;;;mBAUlE,CAAC,CAAQ,EAAE,EAAE;IACpB,MAAM,MAAM,GAAG,CAAC,CAAC,aAA4B,CAC5C;IAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAE,CAAC,aAAa,CAAC,iBAAiB,CAAS,CAAC,IAAI,CAAC;QAC1E,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,YAAY;KAC5C,CAAC,CAAA;AACJ,CAAC;;;;;;;;;;;;cAYG,CAAA;AAEd,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,MAAM;CACP,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/mwc-icon'\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 fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'sequence',\n fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: true,\n fixed: 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 fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n title: 'add',\n handlers: {\n click: 'record-copy'\n },\n fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_downward',\n title: 'download',\n handlers: {\n click: 'move-down'\n },\n fixed: true\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'link',\n name: 'name',\n label: 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 fixed: true\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: 'between',\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 },\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: 'between',\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: 'fixed column',\n component: 'ox-grist',\n argTypes: {\n config: { control: 'object' }\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}\n\nconst Template: Story<ArgTypes> = ({ config }: ArgTypes) => html` <link\n href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\"\n rel=\"stylesheet\"\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(--padding-wide);\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 #modes > * {\n padding: var(--padding-narrow);\n opacity: 0.5;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n #modes > mwc-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 > mwc-icon:hover {\n opacity: 1;\n color: var(--secondary-text-color);\n }\n\n #add {\n width: 50px;\n text-align: right;\n }\n\n #add button {\n background-color: var(--primary-color);\n border: 0;\n border-radius: 50%;\n padding: 5px;\n width: 36px;\n height: 36px;\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 mwc-icon {\n font-size: 2em;\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 @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 mode=\"GRID\"\n .config=${config}\n .fetchHandler=${fetchHandler}\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 <mwc-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</mwc-icon\n >\n <ox-popup id=\"sorter-control\">\n <ox-sorters-control> </ox-sorters-control>\n </ox-popup>\n </div>\n\n <ox-record-creator id=\"add\" light-popup>\n <button><mwc-icon>add</mwc-icon></button>\n </ox-record-creator>\n </div>\n </ox-grist>`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n config\n}\n"]}
1
+ {"version":3,"file":"fixed-column.stories.js","sourceRoot":"","sources":["../../stories/fixed-column.stories.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,CAAA;AACxB,OAAO,gCAAgC,CAAA;AACvC,OAAO,mCAAmC,CAAA;AAC1C,OAAO,sCAAsC,CAAA;AAC7C,OAAO,iCAAiC,CAAA;AACxC,OAAO,oBAAoB,CAAA;AAE3B,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAA;AAW1C,MAAM,YAAY,GAAiB,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3D,IAAI,KAAK,GAAG,MAAM,CAAA;IAClB,IAAI,KAAK,GAAG,CAAC,IAAK,GAAG,CAAC,CAAC,GAAG,KAAM,CAAA;IAEhC,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;IAEtD,OAAO;QACL,KAAK;QACL,OAAO,EAAE,KAAK,CAAC,KAAM,GAAG,IAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,KAAM,CAAC,CAAC,CAAC,KAAK,CAAC;aAC5D,IAAI,CAAC,EAAE,CAAC;aACR,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACjB,OAAO;gBACL,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;gBACf,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,KAAK,G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CAAC;KAC9B;CACF,CAAA;AAED,eAAe;IACb,KAAK,EAAE,cAAc;IACrB,SAAS,EAAE,UAAU;IACrB,QAAQ,EAAE;QACR,MAAM,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;KAC9B;CACF,CAAA;AAYD,MAAM,QAAQ,GAAoB,CAAC,EAAE,MAAM,EAAY,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2GlD,MAAM;oBACA,YAAY;sBACV,CAAC,CAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAG,CAAC,CAAC,MAAc,CAAC,OAAO,CAAC;;;;;;;;;;mBAUlE,CAAC,CAAQ,EAAE,EAAE;IACpB,MAAM,MAAM,GAAG,CAAC,CAAC,aAA4B,CAC5C;IAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAE,CAAC,aAAa,CAAC,iBAAiB,CAAS,CAAC,IAAI,CAAC;QAC1E,KAAK,EAAE,CAAC;QACR,GAAG,EAAE,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,YAAY;KAC5C,CAAC,CAAA;AACJ,CAAC;;;;;;;;;;;;cAYG,CAAA;AAEd,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,MAAM;CACP,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/mwc-icon'\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 fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'sequence',\n fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'row-selector',\n multiple: true,\n fixed: 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 fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'add',\n title: 'add',\n handlers: {\n click: 'record-copy'\n },\n fixed: true\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'arrow_downward',\n title: 'download',\n handlers: {\n click: 'move-down'\n },\n fixed: true\n },\n {\n type: 'string',\n name: 'id',\n hidden: true\n },\n {\n type: 'link',\n name: 'name',\n label: 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 fixed: true\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: 'string[]',\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: 'between',\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: 'between',\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: 'fixed column',\n component: 'ox-grist',\n argTypes: {\n config: { control: 'object' }\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}\n\nconst Template: Story<ArgTypes> = ({ config }: ArgTypes) => html` <link\n href=\"https://fonts.googleapis.com/css?family=Material+Icons&display=block\"\n rel=\"stylesheet\"\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(--padding-wide);\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 #modes > * {\n padding: var(--padding-narrow);\n opacity: 0.5;\n color: var(--primary-text-color);\n cursor: pointer;\n }\n\n #modes > mwc-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 > mwc-icon:hover {\n opacity: 1;\n color: var(--secondary-text-color);\n }\n\n #add {\n width: 50px;\n text-align: right;\n }\n\n #add button {\n background-color: var(--primary-color);\n border: 0;\n border-radius: 50%;\n padding: 5px;\n width: 36px;\n height: 36px;\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 mwc-icon {\n font-size: 2em;\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 @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 mode=\"GRID\"\n .config=${config}\n .fetchHandler=${fetchHandler}\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 <mwc-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</mwc-icon\n >\n <ox-popup id=\"sorter-control\">\n <ox-sorters-control> </ox-sorters-control>\n </ox-popup>\n </div>\n\n <ox-record-creator id=\"add\" light-popup>\n <button><mwc-icon>add</mwc-icon></button>\n </ox-record-creator>\n </div>\n </ox-grist>`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n config\n}\n"]}
@@ -233,7 +233,8 @@ const config = {
233
233
  header: 'thumbnail',
234
234
  record: {
235
235
  editable: true
236
- }
236
+ },
237
+ width: 120
237
238
  },
238
239
  {
239
240
  type: 'datetime',